Skip to content

Commit

Permalink
core/pci: Prefer ibm, slot-label when finding loc codes
Browse files Browse the repository at this point in the history
On OpenPower systems the ibm,slot-label property is used to identify
slots rather than the more verbose ibm,slot-location-code. The
slot-label lookup is currently broken since it assumes that the
ibm,slot-label is in the PCI device node rather than in the node of the
device that provides the slot (e.g. root port or switch downstream
port).

This patch corrects the lookup code to search the parent node (and
possibly it's grandparents), similar to how we search for
ibm,slot-location-code.

Fixes: 1c3baae ("hdata/iohub: Look for IOVPD on P9")
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
oohal authored and stewartsmith committed Apr 16, 2019
1 parent ff79070 commit ff960a7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1423,15 +1423,20 @@ static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd)
uint8_t class, sub;
uint8_t pos, len;

/* If there is a label assigned to the function, use it on openpower machines */
if (pd->slot)
blcode = dt_prop_get_def(np, "ibm,slot-label", NULL);
while (p) {
/* if we have a slot label (i.e. openpower) use that */
blcode = dt_prop_get_def(p, "ibm,slot-label", NULL);
if (blcode)
break;

/* Look for a parent with a slot-location-code */
while (!blcode && p) {
/* otherwise use the fully qualified location code */
blcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL);
if (blcode)
break;

p = p->parent;
}

if (!blcode)
return;

Expand Down

0 comments on commit ff960a7

Please sign in to comment.