+2007-09-03 Martin Mares <mj@ucw.cz>
+
+ * Resurrected the Windows port, including cross-compilation by MinGW.
+ Patch by Samuel Bronson <naesten@gmail.com>.
+
2007-08-31 Martin Mares <mj@ucw.cz>
* Makefile, lib/Makefile: `ar' and `ranlib' can be overriden to allow
Since 2.1.99-test5, pciutils should also be compilable on Windows. Thanks
to Alexander Stock for contributing the port.
-To build this port, you need to install WinIO.dll first. You can get it
+Updated after version 2.2.6 to compile again, and with MinGW, even (only?)
+cross-compiling. (Hopefully it works with MSVC too.)
+
+To use this port, you need to install WinIO.dll first. You can get it
from http://www.internals.com/.
-However, you need to use win32/config.h instead of the automatically
-generated lib/config.h as lib/configure does not run on Windows.
+However, you need to use win32/config.{h,mk} instead of the automatically
+generated lib/config.{h,mk} as lib/configure does not run on Windows.
*/
#include <io.h>
-#include <conio.h>
#include <windows.h>
+#ifndef __GNUC__
+#include <conio.h>
+#else
+int _outp(unsigned short port, int databyte);
+unsigned short _outpw(unsigned short port, unsigned short dataword);
+unsigned long _outpd(unsigned short port, unsigned long dataword);
+int _inp(unsigned short port);
+unsigned short _inpw(unsigned short port);
+unsigned long _inpd(unsigned short port);
+#endif
+
#define outb(x,y) _outp(y,x)
#define outw(x,y) _outpw(y,x)
#define outl(x,y) _outpd(y,x)
MYPROC InitializeWinIo;
HMODULE lib;
- intel_iopl_set = 0;
-
lib = LoadLibrary("WinIo.dll");
if (!lib)
{
#ifndef PCI_HAVE_Uxx_TYPES
#ifdef PCI_OS_WINDOWS
-typedef unsigned __int8 u8;
-typedef unsigned __int16 u16;
-typedef unsigned __int32 u32;
+#include <windef.h>
+typedef BYTE u8;
+typedef WORD u16;
+typedef DWORD u32;
#elif defined(PCI_HAVE_STDINT_H)
#include <stdint.h>
typedef uint8_t u8;
* use alloca() much.
*/
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(PCI_OS_WINDOWS)
#include <alloca.h>
#else
#undef alloca
#define PCI_ARCH_I386
#define PCI_OS_WINDOWS
#define PCI_HAVE_PM_INTEL_CONF
-#define PCI_PATH_IDS "pci.ids"
+#define PCI_IDS "pci.ids"
+#define PCI_PATH_IDS_DIR "."
#define PCILIB_VERSION "@VERSION@"
--- /dev/null
+# TOOLPREFIX is for cross compiling
+
+CC=$(TOOLPREFIX)gcc
+LD=$(TOOLPREFIX)ld
+AR=$(TOOLPREFIX)ar
+RANLIB=$(TOOLPREFIX)ranlib
+
+PCI_ARCH_I386=yes
+PCI_OS_WINDOWS=yes
+PCI_HAVE_PM_INTEL_CONF=yes