Commit 5d34d783 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by David Mosberger

[PATCH] ia64: multi-ioport space support

This has been in my 2.4 BK tree for a while, but I should have
posted it in case there's feedback from other people working
on large machines.  So here it is, in four parts:

  1  enhance __ia64_mk_io_addr(port)
  2  enhance pcibios_scan_root to get multiple mem & io windows
      from ACPI _CRS, and fixup all the resources
  3  add support for /proc/iomem and /proc/ioports
  4  trivial (whitespace, copyright, and move pcibios_fixup_device_resources
       closer to related code)

The current scheme is that IO ports are 64 bits, with the low 24
bits being the port number within an IO port space, and the upper
bits identifying the space.  There is currently a limit of 16
spaces.
parent 4effe89c
...@@ -63,6 +63,8 @@ struct ia64_boot_param *ia64_boot_param; ...@@ -63,6 +63,8 @@ struct ia64_boot_param *ia64_boot_param;
struct screen_info screen_info; struct screen_info screen_info;
unsigned long ia64_iobase; /* virtual address for I/O accesses */ unsigned long ia64_iobase; /* virtual address for I/O accesses */
struct io_space io_space[MAX_IO_SPACES];
unsigned int num_io_spaces;
unsigned char aux_device_present = 0xaa; /* XXX remove this when legacy I/O is gone */ unsigned char aux_device_present = 0xaa; /* XXX remove this when legacy I/O is gone */
...@@ -415,6 +417,11 @@ setup_arch (char **cmdline_p) ...@@ -415,6 +417,11 @@ setup_arch (char **cmdline_p)
} }
ia64_iobase = (unsigned long) ioremap(phys_iobase, 0); ia64_iobase = (unsigned long) ioremap(phys_iobase, 0);
/* setup legacy IO port space */
io_space[0].mmio_base = ia64_iobase;
io_space[0].sparse = 1;
num_io_spaces = 1;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
cpu_physical_id(0) = hard_smp_processor_id(); cpu_physical_id(0) = hard_smp_processor_id();
#endif #endif
......
...@@ -32,6 +32,24 @@ ...@@ -32,6 +32,24 @@
*/ */
#define IO_SPACE_LIMIT 0xffffffffffffffffUL #define IO_SPACE_LIMIT 0xffffffffffffffffUL
#define MAX_IO_SPACES 16
#define IO_SPACE_BITS 24
#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS)
#define IO_SPACE_NR(port) ((port) >> IO_SPACE_BITS)
#define IO_SPACE_BASE(space) ((space) << IO_SPACE_BITS)
#define IO_SPACE_PORT(port) ((port) & (IO_SPACE_SIZE - 1))
#define IO_SPACE_SPARSE_ENCODING(p) ((((p) >> 2) << 12) | (p & 0xfff))
struct io_space {
unsigned long mmio_base; /* base in MMIO space */
int sparse;
};
extern struct io_space io_space[];
extern unsigned int num_io_spaces;
# ifdef __KERNEL__ # ifdef __KERNEL__
#include <asm/machvec.h> #include <asm/machvec.h>
...@@ -80,11 +98,17 @@ __ia64_get_io_port_base (void) ...@@ -80,11 +98,17 @@ __ia64_get_io_port_base (void)
static inline void* static inline void*
__ia64_mk_io_addr (unsigned long port) __ia64_mk_io_addr (unsigned long port)
{ {
const unsigned long io_base = __ia64_get_io_port_base(); struct io_space *space;
unsigned long addr; unsigned long offset;
space = &io_space[IO_SPACE_NR(port)];
port = IO_SPACE_PORT(port);
if (space->sparse)
offset = IO_SPACE_SPARSE_ENCODING(port);
else
offset = port;
addr = io_base | ((port >> 2) << 12) | (port & 0xfff); return (void *) (space->mmio_base | offset);
return (void *) addr;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment