From: Benjamin Herrenschmidt Date: Thu, 31 Jul 2008 05:24:13 +0000 (+1000) Subject: powerpc/pci: Don't keep ISA memory hole resources in the tree X-Git-Tag: v2.6.27-rc3~56^2~4 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=8db13a0e1e87ae2741ca1677caa90e9592c4cc43;p=linux-2.6-omap-h63xx.git powerpc/pci: Don't keep ISA memory hole resources in the tree When we have an ISA memory hole (ie, a PCI window that allows us to generate PCI memory cycles at low PCI address) mixed with other resources using a different CPU <=> PCI mapping, we must not keep the ISA hole in the bridge resource list. If we do, things might start trying to allocate device resources in there and will get the PCI addresses wrong. This fixes it by arranging to remove the ISA memory hole resource in this case. This fixes various cases of PCMCIA breakage on PowerBooks using the MPC106 "grackle" bridge. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 224e9a11765..ea0c61e09b7 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -650,11 +650,18 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, } } - /* Out of paranoia, let's put the ISA hole last if any */ - if (isa_hole >= 0 && memno > 0 && isa_hole != (memno-1)) { - struct resource tmp = hose->mem_resources[isa_hole]; - hose->mem_resources[isa_hole] = hose->mem_resources[memno-1]; - hose->mem_resources[memno-1] = tmp; + /* If there's an ISA hole and the pci_mem_offset is -not- matching + * the ISA hole offset, then we need to remove the ISA hole from + * the resource list for that brige + */ + if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) { + unsigned int next = isa_hole + 1; + printk(KERN_INFO " Removing ISA hole at 0x%016llx\n", isa_mb); + if (next < memno) + memmove(&hose->mem_resources[isa_hole], + &hose->mem_resources[next], + sizeof(struct resource) * (memno - next)); + hose->mem_resources[--memno].flags = 0; } }