diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2017-09-15 15:40:48 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-09-15 02:49:27 -0500 |
commit | 6d67361b59b70d930144b47f6fbbef956ca2fb40 (patch) | |
tree | eb23994b060466d15686286a8447449534a8470c /platforms | |
parent | cc41ce944b978395366177a29340facde3f1150b (diff) | |
download | skiboot-6d67361b59b70d930144b47f6fbbef956ca2fb40.zip skiboot-6d67361b59b70d930144b47f6fbbef956ca2fb40.tar.gz skiboot-6d67361b59b70d930144b47f6fbbef956ca2fb40.tar.bz2 |
core/pci-slots: Move slot-label construction to a helper
Move this out of the astbmc specific part into a generic helper. This
allows us to use it more commonly.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms')
-rw-r--r-- | platforms/astbmc/slots.c | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/platforms/astbmc/slots.c b/platforms/astbmc/slots.c index 92d52f7..5de5120 100644 --- a/platforms/astbmc/slots.c +++ b/platforms/astbmc/slots.c @@ -88,42 +88,12 @@ static const struct slot_table_entry *match_slot_dev_entry(struct phb *phb, static void slot_table_add_properties(struct pci_slot *slot, struct dt_node *np) { - struct phb *phb = slot->phb; - struct pci_device *pd = slot->pd; struct slot_table_entry *ent = slot->data; - size_t base_loc_code_len, slot_label_len; - char label[8], loc_code[LOC_CODE_SIZE]; - - if (!np) - return; - - if (ent) { - dt_add_property_string(np, "ibm,slot-label", ent->name); - slot_label_len = strlen(ent->name); - } else { - snprintf(label, 8, "S%04x%02x", phb->opal_id, pd->secondary_bus); - dt_add_property_string(np, "ibm,slot-label", label); - slot_label_len = strlen(label); - } - - base_loc_code_len = phb->base_loc_code ? strlen(phb->base_loc_code) : 0; - if ((base_loc_code_len + slot_label_len + 1) >= LOC_CODE_SIZE) - return; - - /* Location code */ - if (phb->base_loc_code) { - strcpy(loc_code, phb->base_loc_code); - strcat(loc_code, "-"); - } else { - loc_code[0] = '\0'; - } if (ent) - strcat(loc_code, ent->name); + pci_slot_add_loc(slot, np, ent->name); else - strcat(loc_code, label); - dt_add_property(np, "ibm,slot-location-code", - loc_code, strlen(loc_code) + 1); + pci_slot_add_loc(slot, np, NULL); } void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd) |