diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2006-05-19 16:54:42 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-05-24 16:08:57 +1000 |
commit | 095eed4f8d0be13a7934031434b6e9ceddb87ff6 (patch) | |
tree | 6ae36b38c3cb8ab78e8cc8e019ed226829304ad6 /arch/powerpc/platforms/iseries/pci.c | |
parent | efbd386967aaa7fcf7ffbb13e4975df1cdf04cb8 (diff) | |
download | blackbird-op-linux-095eed4f8d0be13a7934031434b6e9ceddb87ff6.tar.gz blackbird-op-linux-095eed4f8d0be13a7934031434b6e9ceddb87ff6.zip |
[PATCH] powerpc: clean up iSeries PCI probe
Only scan the host bridges and then use the existing pci_devs_phb_init()
routine.
Also fix typo in setup of reg property.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/iseries/pci.c')
-rw-r--r-- | arch/powerpc/platforms/iseries/pci.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index 86a869839d34..35bcc98111f5 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c @@ -166,13 +166,21 @@ static void pci_Log_Error(char *Error_Text, int Bus, int SubBus, void iSeries_pcibios_init(void) { struct pci_controller *phb; - struct device_node *node; - struct device_node *dn; + struct device_node *root = of_find_node_by_path("/"); + struct device_node *node = NULL; - for_each_node_by_type(node, "pci") { + if (root == NULL) { + printk(KERN_CRIT "iSeries_pcibios_init: can't find root " + "of device tree\n"); + return; + } + while ((node = of_get_next_child(root, node)) != NULL) { HvBusNumber bus; u32 *busp; + if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) + continue; + busp = (u32 *)get_property(node, "bus-range", NULL); if (busp == NULL) continue; @@ -186,33 +194,11 @@ void iSeries_pcibios_init(void) phb->first_busno = bus; phb->last_busno = bus; phb->ops = &iSeries_pci_ops; + } - /* Find and connect the devices. */ - for (dn = NULL; (dn = of_get_next_child(node, dn)) != NULL;) { - struct pci_dn *pdn; - u32 *reg; - - reg = (u32 *)get_property(dn, "reg", NULL); - if (reg == NULL) { - printk(KERN_DEBUG "no reg property!\n"); - continue; - } - busp = (u32 *)get_property(dn, "linux,subbus", NULL); - if (busp == NULL) { - printk(KERN_DEBUG "no subbus property!\n"); - continue; - } + of_node_put(root); - pdn = kzalloc(sizeof(*pdn), GFP_KERNEL); - if (pdn == NULL) - return; - dn->data = pdn; - pdn->node = dn; - pdn->busno = bus; - pdn->devfn = (reg[0] >> 8) & 0xff; - pdn->bussubno = *busp; - } - } + pci_devs_phb_init(); } /* |