From 2a881a553e67fa066b2dc74064c17ff8c9ecb927 Mon Sep 17 00:00:00 2001 From: marcel Date: Sun, 10 Jun 2007 16:53:01 +0000 Subject: Work around a firmware bug in the HP rx2660, where in ACPI an I/O port is really a memory mapped I/O address. The bug is in the GAS that describes the address and in particular the SpaceId field. The field should not say the address is an I/O port when it clearly is not. With an additional check for the IA64_BUS_SPACE_IO case in the bus access functions, and the fact that I/O ports pretty much not used in general on ia64, make the calculation of the I/O port address a function. This avoids inlining the work-around into every driver, and also helps reduce overall code bloat. --- sys/ia64/ia64/machdep.c | 10 ++++++++++ sys/ia64/include/cpufunc.h | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index ab49f48..6b8ec5a 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -817,6 +817,16 @@ ia64_init(void) /* NOTREACHED */ } +__volatile void * +ia64_ioport_address(u_int port) +{ + uint64_t addr; + + addr = (port > 0xffff) ? IA64_PHYS_TO_RR6((uint64_t)port) : + ia64_port_base | ((port & 0xfffc) << 10) | (port & 0xFFF); + return ((__volatile void *)addr); +} + uint64_t ia64_get_hcdp(void) { diff --git a/sys/ia64/include/cpufunc.h b/sys/ia64/include/cpufunc.h index 27d66ef..339bd95 100644 --- a/sys/ia64/include/cpufunc.h +++ b/sys/ia64/include/cpufunc.h @@ -54,10 +54,9 @@ breakpoint(void) #define HAVE_INLINE_FFS #define ffs(x) __builtin_ffs(x) -extern uint64_t ia64_port_base; #define __MEMIO_ADDR(x) (__volatile void*)(IA64_PHYS_TO_RR6(x)) -#define __PIO_ADDR(x) (__volatile void*)(ia64_port_base | \ - (((x) & 0xFFFC) << 10) | ((x) & 0xFFF)) +extern __volatile void *ia64_ioport_address(u_int); +#define __PIO_ADDR(x) ia64_ioport_address(x) /* * I/O port reads with ia32 semantics. -- cgit v1.1