]> mj.ucw.cz Git - pciutils.git/commitdiff
Added a Cygwin port.
authorMartin Mares <mj@ucw.cz>
Tue, 26 Aug 2008 15:10:20 +0000 (17:10 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 26 Aug 2008 15:10:20 +0000 (17:10 +0200)
Patch by Christopher Voltz, ported to the current tree by me.

README
lib/Makefile
lib/configure
lib/i386-io-cygwin.h [new file with mode: 0644]
lib/i386-ports.c

diff --git a/README b/README
index d111b916a0385220ddf15a83b58d5361975dbe89..4b3cb1a2142e03bb5d108406585190a7add4a4e2 100644 (file)
--- a/README
+++ b/README
@@ -23,6 +23,7 @@ In runs on the following systems:
        Aix             (via /dev/pci and odmget)
        GNU Hurd        (direct port access)
        Windows         (direct port access)
+       CYGWIN          (direct port access)
 
 It should be very easy to add support for other systems as well (volunteers
 wanted; if you want to try that, I'll be very glad to see the patches and
index acbd420d2ee82810a4c677264bbdf7dd77a4427a..31ca1c106ddc78149edd3ee2041846af4e5508a7 100644 (file)
@@ -66,7 +66,7 @@ $(PCILIBPC): libpci.pc.in
 init.o: init.c $(INCL)
 access.o: access.c $(INCL)
 params.o: params.c $(INCL)
-i386-ports.o: i386-ports.c $(INCL) i386-io-hurd.h i386-io-linux.h i386-io-sunos.h i386-io-windows.h
+i386-ports.o: i386-ports.c $(INCL) i386-io-hurd.h i386-io-linux.h i386-io-sunos.h i386-io-windows.h i386-io-cygwin.h
 proc.o: proc.c $(INCL) pread.h
 sysfs.o: sysfs.c $(INCL) pread.h
 generic.o: generic.c $(INCL)
index 4861be1dec7706f950276f203a3829f16eb3a7ae..521cd7100cd4b7e034f5f811902be9d6a329b3ba 100755 (executable)
@@ -32,6 +32,10 @@ if [ -z "$HOST" ] ; then
        then
                sys=freebsd
        fi
+       if [ "$sys" = "CYGWIN_NT-5.1" ]
+       then
+               sys=cygwin
+       fi
        HOST=${3:-$cpu-$sys}
 fi
 # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
@@ -108,6 +112,11 @@ case $sys in
                echo_n " i386-ports"
                echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
                ;;
+       cygwin)
+               echo_n " i386-ports"
+               echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
+               echo >>$m 'LDLIBS+=-lioperm'
+               ;;
         *)
                echo " Unfortunately, your OS is not supported by the PCI Library"
                exit 1
diff --git a/lib/i386-io-cygwin.h b/lib/i386-io-cygwin.h
new file mode 100644 (file)
index 0000000..4af2f81
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ *     The PCI Library -- Access to i386 I/O ports under Windows with CYGWIN
+ *
+ *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
+ *
+ *     Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <sys/io.h>
+
+static int
+intel_setup_io(struct pci_access *a UNUSED)
+{
+  return (iopl(3) < 0) ? 0 : 1;
+}
+
+static inline int
+intel_cleanup_io(struct pci_access *a UNUSED)
+{
+  iopl(3);
+  return -1;
+}
index 041e47fb90fb0427ee0e09bf640febcda99b080f..666b7497345d41992c5221347e4bb2a67a9fd9a3 100644 (file)
@@ -20,6 +20,8 @@
 #include "i386-io-sunos.h"
 #elif defined(PCI_OS_WINDOWS)
 #include "i386-io-windows.h"
+#elif defined(PCI_OS_CYGWIN)
+#include "i386-io-cygwin.h"
 #else
 #error Do not know how to access I/O ports on this OS.
 #endif