aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2006-05-19 02:54:42 -0400
committerPaul Mackerras <paulus@samba.org>2006-05-24 02:08:57 -0400
commit095eed4f8d0be13a7934031434b6e9ceddb87ff6 (patch)
tree6ae36b38c3cb8ab78e8cc8e019ed226829304ad6
parentefbd386967aaa7fcf7ffbb13e4975df1cdf04cb8 (diff)
[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>
-rw-r--r--arch/powerpc/kernel/pci_dn.c6
-rw-r--r--arch/powerpc/platforms/iseries/pci.c42
-rw-r--r--arch/powerpc/platforms/iseries/setup.c2
3 files changed, 21 insertions, 29 deletions
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 12c4c9e9bbc7..1c18953514c3 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -31,6 +31,7 @@
31#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
32#include <asm/pSeries_reconfig.h> 32#include <asm/pSeries_reconfig.h>
33#include <asm/ppc-pci.h> 33#include <asm/ppc-pci.h>
34#include <asm/firmware.h>
34 35
35/* 36/*
36 * Traverse_func that inits the PCI fields of the device node. 37 * Traverse_func that inits the PCI fields of the device node.
@@ -59,6 +60,11 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
59 pdn->busno = (regs[0] >> 16) & 0xff; 60 pdn->busno = (regs[0] >> 16) & 0xff;
60 pdn->devfn = (regs[0] >> 8) & 0xff; 61 pdn->devfn = (regs[0] >> 8) & 0xff;
61 } 62 }
63 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
64 u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL);
65 if (busp)
66 pdn->bussubno = *busp;
67 }
62 68
63 pdn->pci_ext_config_space = (type && *type == 1); 69 pdn->pci_ext_config_space = (type && *type == 1);
64 return NULL; 70 return NULL;
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,
166void iSeries_pcibios_init(void) 166void iSeries_pcibios_init(void)
167{ 167{
168 struct pci_controller *phb; 168 struct pci_controller *phb;
169 struct device_node *node; 169 struct device_node *root = of_find_node_by_path("/");
170 struct device_node *dn; 170 struct device_node *node = NULL;
171 171
172 for_each_node_by_type(node, "pci") { 172 if (root == NULL) {
173 printk(KERN_CRIT "iSeries_pcibios_init: can't find root "
174 "of device tree\n");
175 return;
176 }
177 while ((node = of_get_next_child(root, node)) != NULL) {
173 HvBusNumber bus; 178 HvBusNumber bus;
174 u32 *busp; 179 u32 *busp;
175 180
181 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
182 continue;
183
176 busp = (u32 *)get_property(node, "bus-range", NULL); 184 busp = (u32 *)get_property(node, "bus-range", NULL);
177 if (busp == NULL) 185 if (busp == NULL)
178 continue; 186 continue;
@@ -186,33 +194,11 @@ void iSeries_pcibios_init(void)
186 phb->first_busno = bus; 194 phb->first_busno = bus;
187 phb->last_busno = bus; 195 phb->last_busno = bus;
188 phb->ops = &iSeries_pci_ops; 196 phb->ops = &iSeries_pci_ops;
197 }
189 198
190 /* Find and connect the devices. */ 199 of_node_put(root);
191 for (dn = NULL; (dn = of_get_next_child(node, dn)) != NULL;) {
192 struct pci_dn *pdn;
193 u32 *reg;
194
195 reg = (u32 *)get_property(dn, "reg", NULL);
196 if (reg == NULL) {
197 printk(KERN_DEBUG "no reg property!\n");
198 continue;
199 }
200 busp = (u32 *)get_property(dn, "linux,subbus", NULL);
201 if (busp == NULL) {
202 printk(KERN_DEBUG "no subbus property!\n");
203 continue;
204 }
205 200
206 pdn = kzalloc(sizeof(*pdn), GFP_KERNEL); 201 pci_devs_phb_init();
207 if (pdn == NULL)
208 return;
209 dn->data = pdn;
210 pdn->node = dn;
211 pdn->busno = bus;
212 pdn->devfn = (reg[0] >> 8) & 0xff;
213 pdn->bussubno = *busp;
214 }
215 }
216} 202}
217 203
218/* 204/*
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index d83f5ed4ec1f..0f49412b438e 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -1073,7 +1073,7 @@ static void scan_bridge_slot(struct iseries_flat_dt *dt, HvBusNumber bus,
1073 snprintf(buf, sizeof(buf), "pci@%x,%d", 1073 snprintf(buf, sizeof(buf), "pci@%x,%d",
1074 PCI_SLOT(devfn), function); 1074 PCI_SLOT(devfn), function);
1075 dt_start_node(dt, buf); 1075 dt_start_node(dt, buf);
1076 reg[0] = (bus << 18) | (devfn << 8); 1076 reg[0] = (bus << 16) | (devfn << 8);
1077 reg[1] = 0; 1077 reg[1] = 0;
1078 reg[2] = 0; 1078 reg[2] = 0;
1079 reg[3] = 0; 1079 reg[3] = 0;