Joel Stanley | d9669fe | 2016-01-22 16:13:06 +1030 | [diff] [blame] | 1 | From 3cbe4777b9d0640df25fa4eb41b15199f78f9e99 Mon Sep 17 00:00:00 2001 |
| 2 | From: Gavin Shan <gwshan@linux.vnet.ibm.com> |
| 3 | Date: Thu, 28 Jan 2016 16:18:37 +1100 |
| 4 | Subject: [PATCH 4/5] powerpc/eeh: Fix PE location code |
| 5 | |
| 6 | In eeh_pe_loc_get(), the PE location code is retrieved from the |
| 7 | "ibm,loc-code" property of the device node for the bridge of the |
| 8 | PE's primary bus. It's not correct because the property indicates |
| 9 | the parent PE's location code. |
| 10 | |
| 11 | This reads the correct PE location code from "ibm,io-base-loc-code" |
| 12 | or "ibm,slot-location-code" property of PE parent bus's device node. |
| 13 | |
| 14 | Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> |
| 15 | Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com> |
| 16 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 17 | --- |
| 18 | arch/powerpc/kernel/eeh_pe.c | 33 +++++++++++++++------------------ |
| 19 | 1 file changed, 15 insertions(+), 18 deletions(-) |
| 20 | |
| 21 | diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c |
| 22 | index 8654cb166c19..ca9e5371930e 100644 |
| 23 | --- a/arch/powerpc/kernel/eeh_pe.c |
| 24 | +++ b/arch/powerpc/kernel/eeh_pe.c |
| 25 | @@ -883,32 +883,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe) |
| 26 | const char *eeh_pe_loc_get(struct eeh_pe *pe) |
| 27 | { |
| 28 | struct pci_bus *bus = eeh_pe_bus_get(pe); |
| 29 | - struct device_node *dn = pci_bus_to_OF_node(bus); |
| 30 | + struct device_node *dn; |
| 31 | const char *loc = NULL; |
| 32 | |
| 33 | - if (!dn) |
| 34 | - goto out; |
| 35 | + while (bus) { |
| 36 | + dn = pci_bus_to_OF_node(bus); |
| 37 | + if (!dn) { |
| 38 | + bus = bus->parent; |
| 39 | + continue; |
| 40 | + } |
| 41 | |
| 42 | - /* PHB PE or root PE ? */ |
| 43 | - if (pci_is_root_bus(bus)) { |
| 44 | - loc = of_get_property(dn, "ibm,loc-code", NULL); |
| 45 | - if (!loc) |
| 46 | + if (pci_is_root_bus(bus)) |
| 47 | loc = of_get_property(dn, "ibm,io-base-loc-code", NULL); |
| 48 | + else |
| 49 | + loc = of_get_property(dn, "ibm,slot-location-code", |
| 50 | + NULL); |
| 51 | + |
| 52 | if (loc) |
| 53 | - goto out; |
| 54 | + return loc; |
| 55 | |
| 56 | - /* Check the root port */ |
| 57 | - dn = dn->child; |
| 58 | - if (!dn) |
| 59 | - goto out; |
| 60 | + bus = bus->parent; |
| 61 | } |
| 62 | |
| 63 | - loc = of_get_property(dn, "ibm,loc-code", NULL); |
| 64 | - if (!loc) |
| 65 | - loc = of_get_property(dn, "ibm,slot-location-code", NULL); |
| 66 | - |
| 67 | -out: |
| 68 | - return loc ? loc : "N/A"; |
| 69 | + return "N/A"; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | -- |
| 74 | 2.7.0.rc3 |
| 75 | |