]> mj.ucw.cz Git - pciutils.git/commitdiff
Resurrected the Windows port.
authorMartin Mares <mj@ucw.cz>
Mon, 3 Sep 2007 08:47:50 +0000 (10:47 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 3 Sep 2007 08:47:50 +0000 (10:47 +0200)
ChangeLog
README.Windows
lib/i386-io-windows.h
lib/types.h
lspci.c
win32/config.h
win32/config.mk [new file with mode: 0644]

index 962d6426b836f7b3e231b2c055c1f4c06a1c794f..181074a95c96fa05e9528a15cfceaa65832e1cf9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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
index 14c11e47ae129da1c90e8720d6d10544a11cfa74..7a85fdaa3ef3a86f2ecb8731798a58aeff28438d 100644 (file)
@@ -1,8 +1,11 @@
 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.
index 0e282442a792cd0a41a1e0f405f326e28f63ed68..6e3dec009afc2061f8e1497c3975a959305ed13a 100644 (file)
@@ -8,9 +8,19 @@
  */
 
 #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)
@@ -26,8 +36,6 @@ intel_setup_io(struct pci_access *a)
   MYPROC InitializeWinIo;
   HMODULE lib;
 
-  intel_iopl_set = 0;
-
   lib = LoadLibrary("WinIo.dll");
   if (!lib)
     {
index 5191d151cd13bcdfb05e5da59d14cc04f3e5923c..f7ab470c86b034528410c05f889b4fa1feb4b6eb 100644 (file)
 #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;
diff --git a/lspci.c b/lspci.c
index db5a8bdcf0672ba35ac0de5acf04b8b81afedd86..9ec1056d9e98d5c24f7066464a50aaa9e120a3d5 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -59,7 +59,7 @@ static struct pci_access *pacc;
  *  use alloca() much.
  */
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(PCI_OS_WINDOWS)
 #include <alloca.h>
 #else
 #undef alloca
index 38d282df45933ee1edf1b3ae958d7b5b1bd3ec8e..455deac3ced1d55add1f679e8a5a30c3a4b7d44a 100644 (file)
@@ -1,5 +1,6 @@
 #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@"
diff --git a/win32/config.mk b/win32/config.mk
new file mode 100644 (file)
index 0000000..98240c0
--- /dev/null
@@ -0,0 +1,10 @@
+# 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