diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-11-11 01:25:06 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 04:38:45 -0500 |
commit | 6506e7102fd57b138979f131d751014462181202 (patch) | |
tree | 0f9e974c89027955210c6c338a49d0b0fa4519d1 /arch/powerpc | |
parent | e557a1c96c82f4d1a91b5c2e2e0275b5999c297d (diff) |
[POWERPC] Resolve the BUID for RTAS PCI config space accesses
The BUID is the first entry of a PCI host bridge "reg" property.
Now that PCI busses can be anywhere in the device-tree, we need to
fully translate the value there to a CPU physical address before
we can use it with RTAS.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/rtas_pci.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c index b4a0de79c060..2576e12d7255 100644 --- a/arch/powerpc/kernel/rtas_pci.c +++ b/arch/powerpc/kernel/rtas_pci.c | |||
@@ -231,32 +231,13 @@ void __init init_pci_config_tokens (void) | |||
231 | 231 | ||
232 | unsigned long __devinit get_phb_buid (struct device_node *phb) | 232 | unsigned long __devinit get_phb_buid (struct device_node *phb) |
233 | { | 233 | { |
234 | int addr_cells; | 234 | struct resource r; |
235 | const unsigned int *buid_vals; | ||
236 | unsigned int len; | ||
237 | unsigned long buid; | ||
238 | |||
239 | if (ibm_read_pci_config == -1) return 0; | ||
240 | 235 | ||
241 | /* PHB's will always be children of the root node, | 236 | if (ibm_read_pci_config == -1) |
242 | * or so it is promised by the current firmware. */ | ||
243 | if (phb->parent == NULL) | ||
244 | return 0; | 237 | return 0; |
245 | if (phb->parent->parent) | 238 | if (of_address_to_resource(phb, 0, &r)) |
246 | return 0; | ||
247 | |||
248 | buid_vals = get_property(phb, "reg", &len); | ||
249 | if (buid_vals == NULL) | ||
250 | return 0; | 239 | return 0; |
251 | 240 | return r.start; | |
252 | addr_cells = prom_n_addr_cells(phb); | ||
253 | if (addr_cells == 1) { | ||
254 | buid = (unsigned long) buid_vals[0]; | ||
255 | } else { | ||
256 | buid = (((unsigned long)buid_vals[0]) << 32UL) | | ||
257 | (((unsigned long)buid_vals[1]) & 0xffffffff); | ||
258 | } | ||
259 | return buid; | ||
260 | } | 241 | } |
261 | 242 | ||
262 | static int phb_set_bus_ranges(struct device_node *dev, | 243 | static int phb_set_bus_ranges(struct device_node *dev, |