From 8fc75dbcb77abd5bfbfc1eb109503eeff57a8a9b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 26 Dec 2003 23:13:13 +0000 Subject: [PATCH] Added support for SunOS/i386 Merged support for Solaris on i386 by Bill Moore and cleaned up: * lib/configure: Recognize SunOS. * lib/internal.h: Learn how to recognize byte order on SunOS. * lib/i386-ports.c: Split OS-dependent I/O port access from i386-ports.c. * lib/i386-io-linux.h: Linux specific part. * lib/i386-io-hurd.h: GNU/Hurd specific part. * lib/i386-io-sunos.h: SunOS specific part. git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-18 --- ChangeLog | 12 ++++++++++++ lib/configure | 17 +++++++++++++++-- lib/i386-ports.c | 47 ++++++++--------------------------------------- lib/internal.h | 10 ++++++++++ 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc5648c..e48b7f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-12-27 Martin Mares + + Merged support for Solaris on i386 by Bill Moore + and cleaned up: + + * lib/configure: Recognize SunOS. + * lib/internal.h: Learn how to recognize byte order on SunOS. + * lib/i386-ports.c: Split OS-dependent I/O port access from i386-ports.c. + * lib/i386-io-linux.h: Linux specific part. + * lib/i386-io-hurd.h: GNU/Hurd specific part. + * lib/i386-io-sunos.h: SunOS specific part. + 2003-12-26 Martin Mares * lib/header.h (PCI_*_MASK): Cast to pciaddr_t explicitly. diff --git a/lib/configure b/lib/configure index 43f7c5f..9ac2983 100755 --- a/lib/configure +++ b/lib/configure @@ -20,7 +20,7 @@ then proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1` cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'` else - cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/'` + cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/'` fi echo " $sys/$cpu $rel" @@ -50,6 +50,19 @@ case $sys in ;; esac ;; + SunOS) + case $cpu in + i386) echo_n " i386-ports" + echo >>$c "#define HAVE_PM_INTEL_CONF" + ok=1 + ;; + *) + echo " The PCI library is does not support Solaris for this architecture: $cpu" + exit 1 + ;; + esac + ;; + FreeBSD) echo_n " fbsd-device" echo >>$c '#define HAVE_PM_FBSD_DEVICE' @@ -68,7 +81,7 @@ case $sys in ok=1 ;; GNU) - echo_n " intel-conf" + echo_n " i386-ports" echo >>$c '#define HAVE_PM_INTEL_CONF' ok=1 ;; diff --git a/lib/i386-ports.c b/lib/i386-ports.c index 6aacd9c..ada1ee1 100644 --- a/lib/i386-ports.c +++ b/lib/i386-ports.c @@ -8,47 +8,16 @@ #include -#ifdef __GLIBC__ -#include -#else -#include -#endif - #include "internal.h" -#ifdef OS_LINUX -static int intel_iopl_set = -1; - -static int -intel_setup_io(void) -{ - if (intel_iopl_set < 0) - intel_iopl_set = (iopl(3) < 0) ? 0 : 1; - return intel_iopl_set; -} - -static inline void -intel_cleanup_io(void) -{ - if (intel_iopl_set > 0) - iopl(3); - intel_iopl_set = -1; -} -#endif - -#ifdef OS_GNU -/* The GNU Hurd doesn't have an iopl() call */ - -static inline int -intel_setup_io(void) -{ - return 1; -} - -static inline int -intel_cleanup_io(void) -{ -} +#if defined(OS_LINUX) +#include "i386-io-linux.h" +#elif defined(OS_GNU) +#include "i386-io-hurd.h" +#elif defined(OS_SunOS) +#include "i386-io-sunos.h" +#else +#error Do not know how to access I/O ports on this OS. #endif static void diff --git a/lib/internal.h b/lib/internal.h index 3c6187e..63f3c9e 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -35,6 +35,16 @@ #include #endif +#ifdef OS_SunOS +#include +#define BIG_ENDIAN 4321 +#ifdef _LITTLE_ENDIAN +#define BYTE_ORDER 1234 +#else +#define BYTE_ORDER 4321 +#endif +#endif + #if BYTE_ORDER == BIG_ENDIAN #define cpu_to_le16 swab16 #define cpu_to_le32 swab32 -- 2.39.2