Skip to contentSkip to conversation

powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()

PATCH New Grant Likely 1 participant 1 message Aug 28, 2009 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()

From: Grant Likely <[email protected]>

The two versions are doing almost exactly the same thing. No need to maintain them as separate files. This patch also has the side effect of making the PCI device tree scanning code available to 32 bit powerpc machines, but no board ports actually make use of this feature at this point.

---

Changes in v3: Fixed up calls to scan_phb() in of_platform.c and
pc_dlpar.c
Changes in v2: renamed pcibios_scan_phb 'data' argument to 'sysdata'

 arch/powerpc/include/asm/pci.h             |    2 +
 arch/powerpc/include/asm/ppc-pci.h         |    1 -
 arch/powerpc/kernel/of_platform.c          |    2 +
 arch/powerpc/kernel/pci-common.c           |   49 ++++++++++++++++++++++++++++
 arch/powerpc/kernel/pci_32.c               |   25 +-------------
 arch/powerpc/kernel/pci_64.c               |   46 +++-----------------------
 arch/powerpc/platforms/pseries/pci_dlpar.c |    2 +
 7 files changed, 61 insertions(+), 66 deletions(-)
arch/powerpc/include/asm/pci.h +2 -0
index 9ae2e3e..6205a24 100644
@@ -233,6 +233,8 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
 
 extern void pcibios_setup_bus_devices(struct pci_bus *bus);
 extern void pcibios_setup_bus_self(struct pci_bus *bus);
+extern void pcibios_setup_phb_io_space(struct pci_controller *hose);
+extern void pcibios_scan_phb(struct pci_controller *hose, void *sysdata);
 
 #endif	/* __KERNEL__ */
 #endif /* __ASM_POWERPC_PCI_H */
arch/powerpc/include/asm/ppc-pci.h +0 -1
index 854ab71..2828f9d 100644
@@ -39,7 +39,6 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
 
 extern void pci_devs_phb_init(void);
 extern void pci_devs_phb_init_dynamic(struct pci_controller *phb);
-extern void scan_phb(struct pci_controller *hose);
 
 /* From rtas_pci.h */
 extern void init_pci_config_tokens (void);
arch/powerpc/kernel/of_platform.c +1 -1
index 87df428..1a4fc0d 100644
@@ -276,7 +276,7 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
 #endif /* CONFIG_EEH */
 
 	/* Scan the bus */
-	scan_phb(phb);
+	pcibios_scan_phb(phb, dev->node);
 	if (phb->bus == NULL)
 		return -ENXIO;
 
arch/powerpc/kernel/pci-common.c +49 -0

52 lines not on this page · raw message

arch/powerpc/kernel/pci_32.c +2 -23
index 1e807fe..4e415e1 100644
@@ -354,36 +354,15 @@ pci_create_OF_bus_map(void)
 	}
 }
 
-static void __devinit pcibios_scan_phb(struct pci_controller *hose)
+void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose)
 {
-	struct pci_bus *bus;
-	struct device_node *node = hose->dn;
 	unsigned long io_offset;
 	struct resource *res = &hose->io_resource;
 
-	pr_debug("PCI: Scanning PHB %s\n",
-		 node ? node->full_name : "<NO NAME>");
-
-	/* Create an empty bus for the toplevel */
-	bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose);
-	if (bus == NULL) {
-		printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
-		       hose->global_number);
-		return;
-	}
-	bus->secondary = hose->first_busno;
-	hose->bus = bus;
-
 	/* Fixup IO space offset */
 	io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
 	res->start = (res->start + io_offset) & 0xffffffffu;
 	res->end = (res->end + io_offset) & 0xffffffffu;
-
-	/* Wire up PHB bus resources */
-	pcibios_setup_phb_resources(hose);
-
-	/* Scan children */
-	hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
 }
 
 static int __init pcibios_init(void)
@@ -401,7 +380,7 @@ static int __init pcibios_init(void)
 		if (pci_assign_all_buses)
 			hose->first_busno = next_busno;
 		hose->last_busno = 0xff;
-		pcibios_scan_phb(hose);
+		pcibios_scan_phb(hose, hose);
 		pci_bus_add_devices(hose->bus);
 		if (pci_assign_all_buses || next_busno <= hose->last_busno)
 			next_busno = hose->last_busno + pcibios_assign_bus_offset;
arch/powerpc/kernel/pci_64.c +6 -40

64 lines not on this page · raw message

arch/powerpc/platforms/pseries/pci_dlpar.c +1 -1
index ad152a0..b6fa3e4 100644
@@ -151,7 +151,7 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
 	if (dn->child)
 		eeh_add_device_tree_early(dn);
 
-	scan_phb(phb);
+	pcibios_scan_phb(phb, dn);
 	pcibios_finish_adding_to_bus(phb->bus);
 
 	return phb;