diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2006-05-19 02:54:42 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-05-24 02:08:57 -0400 |
commit | 095eed4f8d0be13a7934031434b6e9ceddb87ff6 (patch) | |
tree | 6ae36b38c3cb8ab78e8cc8e019ed226829304ad6 /arch/powerpc/platforms/iseries | |
parent | efbd386967aaa7fcf7ffbb13e4975df1cdf04cb8 (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>
Diffstat (limited to 'arch/powerpc/platforms/iseries')
-rw-r--r-- | arch/powerpc/platforms/iseries/pci.c | 42 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/setup.c | 2 |
2 files changed, 15 insertions, 29 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, | |||
166 | void iSeries_pcibios_init(void) | 166 | void 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; |