aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-12-02 00:25:32 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2016-01-26 19:37:37 -0500
commit7e56f627768da4e6480986b5145dc3422bc448a5 (patch)
tree84fa1cbcd9887d98141771e618867a8ae5f6717f /arch/powerpc/kernel
parente256caa7d0515e301f8c8c6e7d1204a2b67b1381 (diff)
powerpc/eeh: Fix PE location code
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. Cc: stable@vger.kernel.org # v3.16+ Fixes: 357b2f3dd9b7 ("powerpc/eeh: Dump PE location code") Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Tested-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/eeh_pe.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 8654cb166c19..ca9e5371930e 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -883,32 +883,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe)
883const char *eeh_pe_loc_get(struct eeh_pe *pe) 883const char *eeh_pe_loc_get(struct eeh_pe *pe)
884{ 884{
885 struct pci_bus *bus = eeh_pe_bus_get(pe); 885 struct pci_bus *bus = eeh_pe_bus_get(pe);
886 struct device_node *dn = pci_bus_to_OF_node(bus); 886 struct device_node *dn;
887 const char *loc = NULL; 887 const char *loc = NULL;
888 888
889 if (!dn) 889 while (bus) {
890 goto out; 890 dn = pci_bus_to_OF_node(bus);
891 if (!dn) {
892 bus = bus->parent;
893 continue;
894 }
891 895
892 /* PHB PE or root PE ? */ 896 if (pci_is_root_bus(bus))
893 if (pci_is_root_bus(bus)) {
894 loc = of_get_property(dn, "ibm,loc-code", NULL);
895 if (!loc)
896 loc = of_get_property(dn, "ibm,io-base-loc-code", NULL); 897 loc = of_get_property(dn, "ibm,io-base-loc-code", NULL);
898 else
899 loc = of_get_property(dn, "ibm,slot-location-code",
900 NULL);
901
897 if (loc) 902 if (loc)
898 goto out; 903 return loc;
899 904
900 /* Check the root port */ 905 bus = bus->parent;
901 dn = dn->child;
902 if (!dn)
903 goto out;
904 } 906 }
905 907
906 loc = of_get_property(dn, "ibm,loc-code", NULL); 908 return "N/A";
907 if (!loc)
908 loc = of_get_property(dn, "ibm,slot-location-code", NULL);
909
910out:
911 return loc ? loc : "N/A";
912} 909}
913 910
914/** 911/**