[POWERPC] Fixup skipping of PowerMac PCI<->PCI bridge "closed" resources

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, January 30, 2008 - 8:01 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be8cbc...
Commit:     be8cbcd8896670a01ead7a29e33ffe29604ed734
Parent:     d0264ce796e4e3d77fdadf72d6625f8e6c1c96bd
Author:     Benjamin Herrenschmidt <benh@kernel.crashing.org>
AuthorDate: Thu Dec 20 14:55:04 2007 +1100
Committer:  Paul Mackerras <paulus@samba.org>
CommitDate: Thu Dec 20 16:18:15 2007 +1100

    [POWERPC] Fixup skipping of PowerMac PCI<->PCI bridge "closed" resources
    
    Apple firmware has a strange way to "close" bridge resources by setting
    them to some bogus values that overlap RAM (strangely, I haven't seen it
    conflicting with DMA so far...).  This explicitely closes them to avoid
    problems.  Previously, they would be closed as a consequence of failing
    to be allocated, but this makes it more explicit, and thus the log
    message is more explicit too.
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/kernel/pci-common.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index b6d4767..1037b3a 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -776,6 +776,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
 
 static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
 {
+	struct pci_controller *hose = pci_bus_to_host(bus);
 	struct pci_dev *dev = bus->self;
 
 	pr_debug("PCI: Fixup bus %d (%s)\n", bus->number, dev ? pci_name(dev) : "PHB");
@@ -793,6 +794,27 @@ static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
 			if (!res->flags || bus->self->transparent)
 				continue;
 
+			/* On PowerMac, Apple leaves bridge windows open over
+			 * an inaccessible region of memory space (0...fffff)
+			 * which is somewhat bogus, but that's what they think
+			 * means disabled...
+			 *
+			 * We clear those to force them to be reallocated later
+			 *
+			 * We detect such regions by the fact that the base is
+			 * equal to the pci_mem_offset of the host bridge and
+			 * their size is smaller than 1M.
+			 */
+			if (res->start == hose->pci_mem_offset &&
+			    res->end < 0x100000) {
+				printk(KERN_INFO
+				       "PCI: Closing bogus Apple Firmware"
+				       " region %d on bus 0x%02x\n",
+				       i, bus->number);
+				res->flags = 0;
+				continue;
+			}
+
 			pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n",
 				 pci_name(dev), i,
 				 (unsigned long long)res->start,\
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[POWERPC] Fixup skipping of PowerMac PCI<->PCI bridge "clo ..., Linux Kernel Mailing ..., (Wed Jan 30, 8:01 pm)