Subject: [PATCH] [POWERPC] Don't try to allocate resources for a POWERPC PHB

From: Kumar Gala <[email-masked]>
Date: Wed, 25 Jul 2007 00:48:08 -0500

The Freescale PCI PHBs actual report back values in the BAR registers
this causes issues in that we try to allocate resources for them
and will get error messages like the following on MPC8544 DS:

PCI: Failed to allocate mem resource #1:80000000@0 for 0000:00:00.0

To address this if we are class PCI_CLASS_PROCESSOR_POWERPC, a normal
header type, and the PHB don't try to assign resources.

Signed-off-by: Kumar Gala <[email-masked]>
---
 arch/powerpc/kernel/pci_32.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 721a694..39f8cb1 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -508,6 +508,13 @@ pcibios_allocate_resources(int pass)
 	struct resource *r;
 
 	for_each_pci_dev(dev) {
+		int class = dev->class >> 8;
+
+		if ((class == PCI_CLASS_PROCESSOR_POWERPC) &&
+		    (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+		    (dev->bus->parent == NULL))
+			continue;
+
 		pci_read_config_word(dev, PCI_COMMAND, &command);
 		for (idx = 0; idx < 6; idx++) {
 			r = &dev->resource[idx];
@@ -550,6 +557,10 @@ pcibios_assign_resources(void)
 		/* Don't touch classless devices and host bridges */
 		if (!class || class == PCI_CLASS_BRIDGE_HOST)
 			continue;
+		if ((class == PCI_CLASS_PROCESSOR_POWERPC) &&
+		    (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+		    (dev->bus->parent == NULL))
+			continue;
 
 		for (idx = 0; idx < 6; idx++) {
 			r = &dev->resource[idx];
-- 
1.5.2.2