about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-01-23 04:24:20 +0000
committerUlrich Drepper <drepper@redhat.com>1997-01-23 04:24:20 +0000
commit8d57beeab10d2afd72e2e3bc6b1ad4695b791955 (patch)
tree1c9bfe3e425125543b2b90c93945576267ffe44e /sysdeps/unix/sysv/linux/alpha/ioperm.c
parent1ef32c3dc40295020b91220399d24435f6a78e48 (diff)
downloadglibc-8d57beeab10d2afd72e2e3bc6b1ad4695b791955.tar.gz
glibc-8d57beeab10d2afd72e2e3bc6b1ad4695b791955.tar.xz
glibc-8d57beeab10d2afd72e2e3bc6b1ad4695b791955.zip
update from main archive 970121 cvs/libc-970123
Thu Jan 23 04:06:42 1997  Ulrich Drepper  <drepper@cygnus.com>

	* Make-dist (.PHONY: dist): Remove duplicate declaration.
	(README): Depend on version.h not version.c.
	* Makefile (README): Depend on version.h not version.c.

	* Makeconfig (inst_libdir, inst_slibdir, inst_includedir,
	inst_datadir, inst_zonedir, inst_localedir, inst_i18ndir, inst_bindir,
	inst_sbindir, inst_infodir, inst_sysconfdir): New variables.  Same
	as variable withough inst_ but prepended with $(install_root).
	(localtime-time): Use $(inst_sysconfdir) not $(sysconfdir).
	* Makefile (install-others): Use $(inst_includedir).
	(gnu/stabs.h, gnu/lib-names.h): Use $(inst_includedir).
	* Makerules (tons of install rules): Use inst_% variables.
	* elf/Makefile: Likewise.
	* hurd/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* manual/Makefile: Likewise.
	* po/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	* sysdeps/mach/hurd/Makefile: Likewise.
	* sysdeps/standalone/i386/force_cpu386/Makefile: Likewise.
	* time/Makefile: Likewise.

	* config.make.in: Revert patch from Sat Jan 18 22:15:26 1997,
	leave install_root in place.

	* gnu-versions.h (_GNU_GETOPT_INTERFACE_VERSION): Define to 2.
	* posix/getopt.c (GETOPT_INTERFACE_VERSION): Define to 2.
	* posix/getopt1.c (GETOPT_INTERFACE_VERSION): Define to 2.

	* elf/Makefile [yes==$(has-ldconfig)]: Correct dependencies of
	ldconfig.
	(CFLAGS-dl-load.c): New variable, avoid gcc warning.

	* sysdeps/mach/hurd/configure.in: Add _LIBC_REENTRENT to DEFINES.

	* sysdeps/mach/hurd/getdents.c: Update copyright.  De-ANSI-declfy.
	* sysdeps/stub/getdents.c: Likewise.  Correct return value.
	* sysdeps/unix/getdents.c: Likewise.
	* sysdeps/unix/sysv/getdents.c: Likewise.

	* sysdeps/unix/readdir.c: Update copyright.

	* sysdeps/unix/bsd/sony/newsos4/Makefile: Correct ifeq arguments.
	* sysdeps/unix/bsd/sun/sunos4/Makefile: Likewise.
	* sysdeps/unix/sysv/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/alpha/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/i386/Makefile: Likewise.

	* sysdeps/unix/sysv/linux/Dist: Don't distribute kernel_termios.h,
	but sys/kernel_termios.h.
	* sysdeps/unix/sysv/linux/alpha/Dist: Likewise.
	* sysdeps/unix/sysv/linux/Makefile [$(subdir)==termios]
	(sysdep_headers): Add sys/kernel_termios.h.
	* sysdeps/unix/sysv/linux/kernel_termios.h: Moved to...
	* sysdeps/unix/sysv/linux/sys/kernel_termios.h: ...here.
	* sysdeps/unix/sysv/linux/sys/tcgetattr.c: Use __kernel_termios and
	__KERNEL_NCCS instead of kernel_termios and KERNEL_NCCS resp.

	* sysdeps/unix/sysv/linux/alpha/ioctls.h: New file.

	* sysdeps/unix/sysv/linux/getdents.c: Correct problems with alignment.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove getdents.
	Reported by Eirik Fuller <eirik@netcom.com>.

	* time/Banner: Removed.  Wrong and unnecessary information.  It's now
	in...
	* time/README: New file.
	* time/Makefile (distribute): Remove Banner, add README.

Wed Jan 22 13:19:56 1997  Richard Henderson  <rth@tamu.edu>

	* sysdeps/unix/sysv/linux/alpha/ioperm.c (platforms): Add Sable.
	(init_iosys): Recognize /etc/alpha_systype as a four-tuple for
	the purpose of supporting brand new systems.
	(*): The type of iosys variables should be iosys_t.

1997-01-22  Paul Eggert  <eggert@twinsun.com>

	* strftime.c (_strftime_copytm):
	New function, to work around Solaris 2.5 tzset bug.

Wed Jan 22 23:05:14 1997  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/mach/hurd/vdprintf.c: Complete de-ANSI-declfication.
	* sysdeps/posix/pipestream.c (writedecl): Fix typo.
	Reported by Marcus G. Daniels <marcus@shannon.sysc.pdx.edu>.

Wed Jan 22 13:58:56 1997  Andreas Jaeger  <aj@arthur.pfalz.de>

	* elf/Makefile (CFLAGS-dl-load.c): New Variable to keep gcc silent
	since name_copy is initialized.

Wed Jan 22 16:58:12 1997  Ulrich Drepper  <drepper@cygnus.com>

	* stdio-common/Makefile (tests): Remove scanf11.
	* stdio-common/scanf11.c: Removed.
	* stdio-common/vfscanf.c Revert patch of Thu Jan 16 23:39:25 1997.
	Although the Corrigendum 1 describes the result as implemented the
	even more recent Amendement 1 seconds the position of ISO C:1990
	where the %n directive has no effect on the assignment count.
	* stdio-common/bug10.c: Likewise.
	* stdio-common/scanf1.c: Likewise.
	* stdio-common/scanf3.c: Likewise.
	* stdio-common/scanf10.c: Likewise.
	* stdio-common/tstdiomisc.c: Likewise.

	* new-malloc/obstack.h: Don't define malloc using bcopy if malloc
	is not available.  This leads to problems since bcopy does not
	return a value.  Instead define _obstack_memcpy based on memcpy or
	bcopy.  This name isn't used outside obstack.h and so no problems
	from using the memcpy function in a file including obstack.h can
	result.
	Reported by Martin Trapp <trapp@ipd.info.uni-karlsruhe.de>.

Tue Jan 21 18:35:55 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* misc/regexp.h (compile): Fix typos.

Tue Jan 21 01:01:59 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prpsinfo): Fix
	type of pr_{pid,ppid,pgrp,sid} fields.
	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct
	elf_prpsinfo): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/alpha/ioperm.c')
-rw-r--r--sysdeps/unix/sysv/linux/alpha/ioperm.c194
1 files changed, 108 insertions, 86 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c
index 924fc473b2..488265a069 100644
--- a/sysdeps/unix/sysv/linux/alpha/ioperm.c
+++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c
@@ -1,36 +1,36 @@
-/* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by David Mosberger.
+/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* I/O access is restricted to ISA port space (ports 0..65535).
-Modern devices hopefully are sane enough not to put any performance
-critical registers in i/o space.
+   Modern devices hopefully are sane enough not to put any performance
+   critical registers in i/o space.
 
-On the first call to ioperm() or _sethae(), the entire (E)ISA port
-space is mapped into the virtual address space at address io.base.
-mprotect() calls are then used to enable/disable access to ports.  Per
-page, there are PAGE_SIZE>>IO_SHIFT I/O ports (e.g., 256 ports on a
-Low Cost Alpha based system using 8KB pages).
+   On the first call to ioperm() or _sethae(), the entire (E)ISA port
+   space is mapped into the virtual address space at address io.base.
+   mprotect() calls are then used to enable/disable access to ports.  Per
+   page, there are PAGE_SIZE>>IO_SHIFT I/O ports (e.g., 256 ports on a
+   Low Cost Alpha based system using 8KB pages).
 
-Keep in mind that this code should be able to run in a 32bit address
-space.  It is therefore unreasonable to expect mmap'ing the entire
-sparse address space would work (e.g., the Low Cost Alpha chip has an
-I/O address space that's 512MB large!).  */
+   Keep in mind that this code should be able to run in a 32bit address
+   space.  It is therefore unreasonable to expect mmap'ing the entire
+   sparse address space would work (e.g., the Low Cost Alpha chip has an
+   I/O address space that's 512MB large!).  */
 
 #include <errno.h>
 #include <fcntl.h>
@@ -66,27 +66,30 @@ I/O address space that's 512MB large!).  */
 #define CIA_SPARSE_MEM		(0xfffffc8000000000UL)
 #define CIA_DENSE_MEM		(0xfffffc8600000000UL)
 
+#define T2_IO_BASE		(0xfffffc03a0000000UL)
+#define T2_SPARSE_BASE		(0xfffffc0200000000UL)
+#define T2_DENSE_BASE		(0xfffffc03c0000000UL)
 
-enum {
-  IOSYS_JENSEN = 0, IOSYS_APECS = 1, IOSYS_CIA = 2
+typedef enum {
+  IOSYS_UNKNOWN, IOSYS_JENSEN, IOSYS_APECS, IOSYS_CIA, IOSYS_T2
 } iosys_t;
 
 struct ioswtch {
-  void		(*sethae)(unsigned long addr);
-  void		(*outb)(unsigned char b, unsigned long port);
-  void		(*outw)(unsigned short b, unsigned long port);
-  void		(*outl)(unsigned int b, unsigned long port);
-  unsigned int	(*inb)(unsigned long port);
-  unsigned int	(*inw)(unsigned long port);
-  unsigned int	(*inl)(unsigned long port);
+  void		(*sethae)(unsigned long int addr);
+  void		(*outb)(unsigned char b, unsigned long int port);
+  void		(*outw)(unsigned short b, unsigned long int port);
+  void		(*outl)(unsigned int b, unsigned long int port);
+  unsigned int	(*inb)(unsigned long int port);
+  unsigned int	(*inw)(unsigned long int port);
+  unsigned int	(*inl)(unsigned long int port);
 };
 
 static struct platform {
-  const char	*name;
-  int		io_sys;
-  int		hae_shift;
-  unsigned long	bus_memory_base;
-  unsigned long	sparse_bus_memory_base;
+  const char	   *name;
+  int		    io_sys;
+  iosys_t	    hae_shift;
+  unsigned long	int bus_memory_base;
+  unsigned long	int sparse_bus_memory_base;
 } platform[] = {
   {"Alcor",	IOSYS_CIA,	5, CIA_DENSE_MEM,	CIA_SPARSE_MEM},
   {"Avanti",	IOSYS_APECS,	5, APECS_DENSE_MEM,	APECS_SPARSE_MEM},
@@ -99,27 +102,29 @@ static struct platform {
   {"Mikasa",	IOSYS_APECS,	5, APECS_DENSE_MEM,	APECS_SPARSE_MEM},
   {"Mustang",	IOSYS_APECS,	5, APECS_DENSE_MEM,	APECS_SPARSE_MEM},
   {"Noname",	IOSYS_APECS,	5, APECS_DENSE_MEM,	APECS_SPARSE_MEM},
+  {"Sable",	IOSYS_T2,	5, T2_DENSE_MEM,	T2_SPARSE_MEM},
 };
 
 
 static struct {
   struct hae {
-    unsigned long	cache;
-    unsigned long *	reg;
+    unsigned long int	cache;
+    unsigned long int *	reg;
   } hae;
-  unsigned long		base;
+  unsigned long int	base;
   struct ioswtch *	swp;
-  int			sys;
+  unsigned long int	bus_memory_base;
+  unsigned long int	sparse_bus_memory_base;
+  unsigned long int	io_base;
+  iosys_t		sys;
   int			hae_shift;
-  unsigned long		bus_memory_base;
-  unsigned long		sparse_bus_memory_base;
 } io;
 
-extern void __sethae (unsigned long);	/* we can't use asm/io.h */
+extern void __sethae (unsigned long int);	/* we can't use asm/io.h */
 
 
-static inline unsigned long
-port_to_cpu_addr (unsigned long port, int iosys, int size)
+static inline unsigned long int
+port_to_cpu_addr (unsigned long int port, iosys_t iosys, int size)
 {
   if (iosys == IOSYS_JENSEN)
     return (port << 7) + ((size - 1) << 5) + io.base;
@@ -129,7 +134,7 @@ port_to_cpu_addr (unsigned long port, int iosys, int size)
 
 
 static inline void
-inline_sethae (unsigned long addr, int iosys)
+inline_sethae (unsigned long int addr, iosys_t iosys)
 {
   if (iosys == IOSYS_JENSEN)
     {
@@ -143,7 +148,7 @@ inline_sethae (unsigned long addr, int iosys)
     }
   else
     {
-      unsigned long msb;
+      unsigned long int msb;
 
       /* no need to set hae if msb is 0: */
       msb = addr & 0xf8000000;
@@ -157,10 +162,10 @@ inline_sethae (unsigned long addr, int iosys)
 
 
 static inline void
-inline_outb (unsigned char b, unsigned long port, int iosys)
+inline_outb (unsigned char b, unsigned long int port, iosys_t iosys)
 {
   unsigned int w;
-  unsigned long addr = port_to_cpu_addr (port, iosys, 1);
+  unsigned long int addr = port_to_cpu_addr (port, iosys, 1);
 
   inline_sethae (0, iosys);
   asm ("insbl %2,%1,%0" : "r=" (w) : "ri" (port & 0x3), "r" (b));
@@ -170,10 +175,10 @@ inline_outb (unsigned char b, unsigned long port, int iosys)
 
 
 static inline void
-inline_outw (unsigned short b, unsigned long port, int iosys)
+inline_outw (unsigned short int b, unsigned long int port, iosys_t iosys)
 {
   unsigned int w;
-  unsigned long addr = port_to_cpu_addr (port, iosys, 2);
+  unsigned long int addr = port_to_cpu_addr (port, iosys, 2);
 
   inline_sethae (0, iosys);
   asm ("inswl %2,%1,%0" : "r=" (w) : "ri" (port & 0x3), "r" (b));
@@ -183,9 +188,9 @@ inline_outw (unsigned short b, unsigned long port, int iosys)
 
 
 static inline void
-inline_outl (unsigned int b, unsigned long port, int iosys)
+inline_outl (unsigned int b, unsigned long int port, iosys_t iosys)
 {
-  unsigned long addr = port_to_cpu_addr (port, iosys, 4);
+  unsigned long int addr = port_to_cpu_addr (port, iosys, 4);
 
   if (port >= MAX_PORT)
     return;
@@ -197,9 +202,9 @@ inline_outl (unsigned int b, unsigned long port, int iosys)
 
 
 static inline unsigned int
-inline_inb (unsigned long port, int iosys)
+inline_inb (unsigned long int port, iosys_t iosys)
 {
-  unsigned long result, addr = port_to_cpu_addr (port, iosys, 1);
+  unsigned long int result, addr = port_to_cpu_addr (port, iosys, 1);
 
   inline_sethae (0, iosys);
   result = *(vuip) addr;
@@ -209,9 +214,9 @@ inline_inb (unsigned long port, int iosys)
 
 
 static inline unsigned int
-inline_inw (unsigned long port, int iosys)
+inline_inw (unsigned long int port, iosys_t iosys)
 {
-  unsigned long result, addr = port_to_cpu_addr (port, iosys, 2);
+  unsigned long int result, addr = port_to_cpu_addr (port, iosys, 2);
 
   inline_sethae (0, iosys);
   result = *(vuip) addr;
@@ -221,9 +226,9 @@ inline_inw (unsigned long port, int iosys)
 
 
 static inline unsigned int
-inline_inl (unsigned long port, int iosys)
+inline_inl (unsigned long int port, iosys_t iosys)
 {
-  unsigned long addr = port_to_cpu_addr (port, iosys, 4);
+  unsigned long int addr = port_to_cpu_addr (port, iosys, 4);
 
   inline_sethae (0, iosys);
   return *(vuip) addr;
@@ -232,14 +237,14 @@ inline_inl (unsigned long port, int iosys)
 
 #define DCL_SETHAE(name, iosys)			\
 static void						\
-name##_sethae (unsigned long addr)			\
+name##_sethae (unsigned long int addr)			\
 {							\
   inline_sethae (addr, IOSYS_##iosys);			\
 }
 
 #define DCL_OUT(name, func, type, iosys)		\
 static void						\
-name##_##func (unsigned type b, unsigned long addr)	\
+name##_##func (unsigned type b, unsigned long int addr)	\
 {							\
   inline_##func (b, addr, IOSYS_##iosys);		\
 }
@@ -247,7 +252,7 @@ name##_##func (unsigned type b, unsigned long addr)	\
 
 #define DCL_IN(name, func, iosys)			\
 static unsigned int					\
-name##_##func (unsigned long addr)			\
+name##_##func (unsigned long int addr)			\
 {							\
   return inline_##func (addr, IOSYS_##iosys);		\
 }
@@ -255,7 +260,7 @@ name##_##func (unsigned long addr)			\
 
 DCL_SETHAE(jensen, JENSEN)
 DCL_OUT(jensen, outb, char,  JENSEN)
-DCL_OUT(jensen, outw, short, JENSEN)
+DCL_OUT(jensen, outw, short int, JENSEN)
 DCL_OUT(jensen, outl, int,   JENSEN)
 DCL_IN(jensen, inb, JENSEN)
 DCL_IN(jensen, inw, JENSEN)
@@ -266,7 +271,7 @@ DCL_IN(jensen, inl, JENSEN)
 
 DCL_SETHAE(apecs, APECS)
 DCL_OUT(apecs, outb, char,  APECS)
-DCL_OUT(apecs, outw, short, APECS)
+DCL_OUT(apecs, outw, short int, APECS)
 DCL_OUT(apecs, outl, int,   APECS)
 DCL_IN(apecs, inb, APECS)
 DCL_IN(apecs, inw, APECS)
@@ -291,6 +296,10 @@ struct ioswtch ioswtch[] = {
  * with, we first try to read the value of symlink PATH_ALPHA_SYSTYPE,
  * if that fails, we lookup the "system type" field in /proc/cpuinfo.
  * If that fails as well, we give up.
+ *
+ * If the value received from PATH_ALPHA_SYSTYPE begins with a number,
+ * assume this is a previously unsupported system and the values encode,
+ * in order, "<io_base>,<hae_shift>,<dense_base>,<sparse_base>".
  */
 static int
 init_iosys (void)
@@ -298,10 +307,21 @@ init_iosys (void)
   char systype[256];
   int i, n;
 
-  n = readlink(PATH_ALPHA_SYSTYPE, systype, sizeof(systype) - 1);
+  n = readlink (PATH_ALPHA_SYSTYPE, systype, sizeof (systype) - 1);
   if (n > 0)
     {
       systype[n] = '\0';
+      if (isdigit (systype[0]))
+	{
+	  if (sscanf (systype, "%li,%i,%li,%li", &io.io_base, &io.hae_shift,
+		      &io.bus_memory_base, &io.sparse_bus_memory_base) == 4)
+	    {
+	      io.sys = IOSYS_UNKNOWN;
+	      io.swp = &ioswtch[1];
+	      return 0;
+	    }
+	  /* else we're likely going to fail with the system match below */
+	}
     }
   else
     {
@@ -318,14 +338,14 @@ init_iosys (void)
 	  else
 	    fgets (systype, 256, fp);
 	}
-      fclose(fp);
+      fclose (fp);
 
       if (n == EOF)
 	{
 	  /* this can happen if the format of /proc/cpuinfo changes...  */
-	  fprintf(stderr,
-		  "ioperm.init_iosys(): Unable to determine system type.\n"
-		  "\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n");
+	  fprintf (stderr,
+		   "ioperm.init_iosys(): Unable to determine system type.\n"
+		   "\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n");
 	  __set_errno (ENODEV);
 	  return -1;
 	}
@@ -355,9 +375,9 @@ init_iosys (void)
 
 
 int
-_ioperm (unsigned long from, unsigned long num, int turn_on)
+_ioperm (unsigned long int from, unsigned long int num, int turn_on)
 {
-  unsigned long addr, len;
+  unsigned long int addr, len;
   int prot;
 
   if (!io.swp && init_iosys () < 0)
@@ -374,7 +394,7 @@ _ioperm (unsigned long from, unsigned long num, int turn_on)
     {
       if (!io.base)
 	{
-	  unsigned long base;
+	  unsigned long int base;
 	  int fd;
 
 	  io.hae.reg   = 0;		/* not used in user-level */
@@ -387,6 +407,7 @@ _ioperm (unsigned long from, unsigned long num, int turn_on)
 
 	  switch (io.sys)
 	    {
+	    case IOSYS_UNKNOWN: base = io.io_base; break;
 	    case IOSYS_JENSEN:	base = JENSEN_IO_BASE; break;
 	    case IOSYS_APECS:	base = APECS_IO_BASE; break;
 	    case IOSYS_CIA:	base = CIA_IO_BASE; break;
@@ -398,7 +419,8 @@ _ioperm (unsigned long from, unsigned long num, int turn_on)
 	  addr &= PAGE_MASK;
 	  len = port_to_cpu_addr (MAX_PORT, io.sys, 1) - addr;
 	  io.base =
-	    (unsigned long) __mmap (0, len, PROT_NONE, MAP_SHARED, fd, base);
+	    (unsigned long int) __mmap (0, len, PROT_NONE, MAP_SHARED,
+					fd, base);
 	  close (fd);
 	  if ((long) io.base == -1)
 	    return -1;
@@ -437,7 +459,7 @@ _iopl (unsigned int level)
 
 
 void
-_sethae (unsigned long addr)
+_sethae (unsigned long int addr)
 {
   if (!io.swp && init_iosys () < 0)
     return;
@@ -447,7 +469,7 @@ _sethae (unsigned long addr)
 
 
 void
-_outb (unsigned char b, unsigned long port)
+_outb (unsigned char b, unsigned long int port)
 {
   if (port >= MAX_PORT)
     return;
@@ -457,7 +479,7 @@ _outb (unsigned char b, unsigned long port)
 
 
 void
-_outw (unsigned short b, unsigned long port)
+_outw (unsigned short b, unsigned long int port)
 {
   if (port >= MAX_PORT)
     return;
@@ -467,7 +489,7 @@ _outw (unsigned short b, unsigned long port)
 
 
 void
-_outl (unsigned int b, unsigned long port)
+_outl (unsigned int b, unsigned long int port)
 {
   if (port >= MAX_PORT)
     return;
@@ -477,27 +499,27 @@ _outl (unsigned int b, unsigned long port)
 
 
 unsigned int
-_inb (unsigned long port)
+_inb (unsigned long int port)
 {
   return io.swp->inb (port);
 }
 
 
 unsigned int
-_inw (unsigned long port)
+_inw (unsigned long int port)
 {
   return io.swp->inw (port);
 }
 
 
 unsigned int
-_inl (unsigned long port)
+_inl (unsigned long int port)
 {
   return io.swp->inl (port);
 }
 
 
-unsigned long
+unsigned long int
 _bus_base(void)
 {
   if (!io.swp && init_iosys () < 0)
@@ -505,7 +527,7 @@ _bus_base(void)
   return io.bus_memory_base;
 }
 
-unsigned long
+unsigned long int
 _bus_base_sparse(void)
 {
   if (!io.swp && init_iosys () < 0)