diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-08-20 11:29:28 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-09-01 16:11:45 +1000 |
commit | 58ccf6a977ade80e4475d7d350c4c076ab1accad (patch) | |
tree | 68e4e4b43f01654791634e55d9f91ac0709bcbb7 /core | |
parent | ed76b810b9f026969041e7a79594664e1e7e9c74 (diff) | |
download | skiboot-58ccf6a977ade80e4475d7d350c4c076ab1accad.zip skiboot-58ccf6a977ade80e4475d7d350c4c076ab1accad.tar.gz skiboot-58ccf6a977ade80e4475d7d350c4c076ab1accad.tar.bz2 |
pci: Support absence of base location code
We support having no base location code in the PHB. In that case we
only use the slot label, if it exists, to create the location code.
This allows us to support simpler loc codes for OpenPower.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/pci.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -20,6 +20,7 @@ #include <pci-cfg.h> #include <timebase.h> #include <device.h> +#include <fsp.h> /* The eeh event code will need updating if this is ever increased to * support more than 64 phbs */ @@ -1122,22 +1123,25 @@ static void pci_add_slot_properties(struct phb *phb, struct pci_slot_info *info, struct dt_node *np) { char loc_code[LOC_CODE_SIZE]; - size_t base_loc_code_len, slot_label_len; + size_t base_loc_code_len = 0, slot_label_len = 0; if (phb->base_loc_code) { base_loc_code_len = strlen(phb->base_loc_code); + strcpy(loc_code, phb->base_loc_code); + } + if (info->label) { slot_label_len = strlen(info->label); - if ((base_loc_code_len + slot_label_len +1) < LOC_CODE_SIZE) { - strcpy(loc_code, phb->base_loc_code); - strcat(loc_code, "-"); + if ((base_loc_code_len + slot_label_len + 1) < LOC_CODE_SIZE) { + if (base_loc_code_len) + strcat(loc_code, "-"); strcat(loc_code, info->label); dt_add_property(np, "ibm,slot-location-code", loc_code, strlen(loc_code) + 1); - } else + } else { PCIERR(phb, 0, "Loc Code too long - %zu + %zu + 1\n", base_loc_code_len, slot_label_len); - } else - PCIERR(phb, 0, "Base Loc code not found...\n"); + } + } /* Add other slot information */ dt_add_property_cells(np, "ibm,slot-pluggable", info->pluggable); |