linux/arch/powerpc
Paul Mackerras 11fbb00c67 [POWERPC] Cope with PCI host bridge I/O window not starting at 0
Currently our code to set up the data structures for a PCI host bridge
and create the mapping for its I/O window assumes that the window
starts at I/O port 0 on the PCI side.  If this is not true, we can end
up with I/O port numbers in the resources for PCI devices which will
cause an oops if a driver tries to access them via inb/outb etc.,
because there is no mapping for the corresponding addresses.

Normally the I/O window starts at 0, but there are some situations on
partitioned machines with a hypervisor where the window may not start
at 0.

This fixes the problem by allocating space for the range from 0 to the
end of the I/O window.  That is, hose->io_base_virt contains the
virtual address for I/O port 0 on the PCI bus, and thus the assumption
that hose->io_base_virt - pci_io_base is the offset between the
"global" I/O port numbers (those in the PCI device resources) and the
I/O port numbers on the PCI bus is maintained.

For PCI host bridges that are present at boot, we only map the portion
of that range that correspond to the bridge's I/O window.  For bridges
added after boot we ioremap the range from 0 to the end of the I/O
window, for now; in fact hot-added bridges should be using
reserve_phb_iospace() and __ioremap_explicit (so they get sensible
global port numbers), but we don't have the infrastructure yet to do
that (basically a free_phb_iospace() routine plus appropriate
locking).

Interestingly, this makes the two arms of the if statement in
get_bus_io_range do almost exactly the same thing; that function could
now be simplified in a further patch.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-05-08 11:54:19 +10:00
..
boot [POWERPC] lite5200(b) support for i2c 2007-05-07 20:31:15 +10:00
configs [POWERPC] PS3: Defconfig updates 2007-05-02 20:04:31 +10:00
kernel [POWERPC] Cope with PCI host bridge I/O window not starting at 0 2007-05-08 11:54:19 +10:00
lib Merge branch 'linux-2.6' into for-2.6.22 2007-04-30 12:38:01 +10:00
math-emu [POWERPC] ppc math-emu needs -fno-builtin-fabs for math.c and fabs.c 2006-09-26 15:24:35 +10:00
mm [POWERPC] 64K page support for kexec 2007-05-07 20:31:12 +10:00
oprofile [POWERPC] Spinlock initializer cleanup 2007-04-30 11:02:06 +10:00
platforms [POWERPC] mpc52xx suspend to deep-sleep 2007-05-07 20:31:15 +10:00
sysdev [POWERPC] DART iommu suspend 2007-05-07 20:31:14 +10:00
xmon [POWERPC] Fix WARN_ON when entering xmon 2007-04-27 21:13:28 +10:00
.gitignore [POWERPC] Add files build to .gitignore 2006-12-04 20:41:29 +11:00
Kconfig [POWERPC] powermac: Suspend to disk on G5 2007-05-07 20:31:14 +10:00
Kconfig.debug [POWERPC] DEBUG_PAGEALLOC for 64-bit 2007-04-13 04:09:39 +10:00
Makefile [POWERPC] Small cleanups to the cuboot bootwrapper code 2007-05-02 20:04:31 +10:00