Commit ee86cd39 authored by Gavin Shan's avatar Gavin Shan Committed by Luis Henriques

powerpc/eeh: Fix PE location code

commit 7e56f627 upstream.

In eeh_pe_loc_get(), the PE location code is retrieved from the
"ibm,loc-code" property of the device node for the bridge of the
PE's primary bus. It's not correct because the property indicates
the parent PE's location code.

This reads the correct PE location code from "ibm,io-base-loc-code"
or "ibm,slot-location-code" property of PE parent bus's device node.

Fixes: 357b2f3d ("powerpc/eeh: Dump PE location code")
Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Tested-by: default avatarRussell Currey <ruscur@russell.cc>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent f026380e
...@@ -818,32 +818,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe) ...@@ -818,32 +818,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe)
const char *eeh_pe_loc_get(struct eeh_pe *pe) const char *eeh_pe_loc_get(struct eeh_pe *pe)
{ {
struct pci_bus *bus = eeh_pe_bus_get(pe); struct pci_bus *bus = eeh_pe_bus_get(pe);
struct device_node *dn = pci_bus_to_OF_node(bus); struct device_node *dn;
const char *loc = NULL; const char *loc = NULL;
if (!dn) while (bus) {
goto out; dn = pci_bus_to_OF_node(bus);
if (!dn) {
bus = bus->parent;
continue;
}
/* PHB PE or root PE ? */ if (pci_is_root_bus(bus))
if (pci_is_root_bus(bus)) {
loc = of_get_property(dn, "ibm,loc-code", NULL);
if (!loc)
loc = of_get_property(dn, "ibm,io-base-loc-code", NULL); loc = of_get_property(dn, "ibm,io-base-loc-code", NULL);
else
loc = of_get_property(dn, "ibm,slot-location-code",
NULL);
if (loc) if (loc)
goto out; return loc;
/* Check the root port */ bus = bus->parent;
dn = dn->child;
if (!dn)
goto out;
} }
loc = of_get_property(dn, "ibm,loc-code", NULL); return "N/A";
if (!loc)
loc = of_get_property(dn, "ibm,slot-location-code", NULL);
out:
return loc ? loc : "N/A";
} }
/** /**
......
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