Commit 6506e710 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras

[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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent e557a1c9
...@@ -231,32 +231,13 @@ void __init init_pci_config_tokens (void) ...@@ -231,32 +231,13 @@ void __init init_pci_config_tokens (void)
unsigned long __devinit get_phb_buid (struct device_node *phb) unsigned long __devinit get_phb_buid (struct device_node *phb)
{ {
int addr_cells; struct resource r;
const unsigned int *buid_vals;
unsigned int len;
unsigned long buid;
if (ibm_read_pci_config == -1) return 0;
/* PHB's will always be children of the root node, if (ibm_read_pci_config == -1)
* or so it is promised by the current firmware. */
if (phb->parent == NULL)
return 0; return 0;
if (phb->parent->parent) if (of_address_to_resource(phb, 0, &r))
return 0;
buid_vals = get_property(phb, "reg", &len);
if (buid_vals == NULL)
return 0; return 0;
return r.start;
addr_cells = prom_n_addr_cells(phb);
if (addr_cells == 1) {
buid = (unsigned long) buid_vals[0];
} else {
buid = (((unsigned long)buid_vals[0]) << 32UL) |
(((unsigned long)buid_vals[1]) & 0xffffffff);
}
return buid;
} }
static int phb_set_bus_ranges(struct device_node *dev, static int phb_set_bus_ranges(struct device_node *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment