[Skiboot] [PATCH] hdata/vpd: Reorganize vpd name mapping

Oliver O'Halloran oohall at gmail.com
Fri Feb 17 11:13:12 AEDT 2017


On Thu, Feb 16, 2017 at 8:31 PM, Ananth N Mavinakayanahalli
<ananth at linux.vnet.ibm.com> wrote:
> to use a more graceful structured representation.
>
> Signed-off-by: Ananth N Mavinakayanahalli <ananth at linux.vnet.ibm.com>
> ---
>  hdata/vpd.c |  424 +++++++++++++++++++----------------------------------------
>  1 file changed, 137 insertions(+), 287 deletions(-)
>
> diff --git a/hdata/vpd.c b/hdata/vpd.c
> index 18bc070..6e5a47e 100644
> --- a/hdata/vpd.c
> +++ b/hdata/vpd.c
> @@ -71,6 +71,143 @@ static const struct card_info card_table[] = {
>         /* Other cards */
>  };
>
> +struct vpd_key_map {
> +       const char *keyword;            /* 2 char keyword  */
> +       const char *description;
> +};
> +
> +static const struct vpd_key_map vpd_key_table[] = {
> +       {"AA", "ac-power-supply"},
> +       {"AM", "air-mover"},
> +       {"AV", "anchor-card"},
> +
> +       {"BA", "bus-adapter-card"},
> +       {"BC", "battery-charger"},
> +       {"BD", "bus-daughter-card"},
> +       {"BE", "bus-expansion-card"},
> +       {"BP", "backplane"},
> +       {"BR", "backplane-riser"},
> +       {"BX", "backplane-extender"},
> +
> +       {"CA", "calgary-bridge"},
> +       {"CB", "infiniband-connector"},
> +       {"CC", "clock-card"},
> +       {"CD", "card-connector"},
> +       {"CE", "ethernet-connector"},
> +       {"CL", "calgary-phb"},
> +       {"CI", "capacity-card"},
> +       {"CO", "sma-connector"},
> +       {"CP", "processor-capacity-card"},
> +       {"CR", "rio-connector"},
> +       {"CS", "serial-connector"},
> +       {"CU", "usb-connector"},
> +
> +       {"DB", "dasd-backplane"},
> +       {"DC", "drawer-card"},
> +       {"DE", "drawer-extension"},
> +       {"DI", "drawer-interposer"},
> +       {"DL", "p7ih-dlink-connector"},
> +       {"DT", "legacy-pci-card"},
> +       {"DV", "media-drawer-led"},
> +
> +       {"EI", "enclosure-led"},
> +       {"EF", "enclosure-fault-led"},
> +       {"ES", "embedded-sas"},
> +       {"ET", "ethernet-riser"},
> +       {"EV", "enclosure"},
> +
> +       {"FM", "frame"},
> +
> +       {"HB", "host-rio-pci-card"},
> +       {"HD", "high-speed-card"},
> +       {"HM", "hmc-connector"},
> +
> +       {"IB", "io-backplane"},
> +       {"IC", "io-card"},
> +       {"ID", "ide-connector"},
> +       {"II", "io-drawer-led"},
> +       {"IP", "interplane-card"},
> +       {"IS", "smp-vbus-cable"},
> +       {"IT", "enclosure-cable"},
> +       {"IV", "io-enclosure"},
> +
> +       {"KV", "keyboard-led"},
> +
> +       {"L2", "l2-cache-module"},
> +       {"L3", "l3-cache-module"},
> +       {"LC", "squadrons-light-connector"},
> +       {"LR", "p7ih-connector"},
> +       {"LO", "system-locate-led"},
> +       {"LT", "squadrons-light-strip"},
> +
> +       {"MB", "media-backplane"},
> +       {"ME", "map-extension"},
> +       {"MM", "mip-meter"},
> +       {"MS", "ms-dimm"},
> +
> +       {"NB", "nvram-battery"},
> +       {"NC", "sp-node-controller"},
> +       {"ND", "numa-dimm"},
> +
> +       {"OD", "cuod-card"},
> +       {"OP", "op-panel"},
> +       {"OS", "oscillator"},
> +
> +       {"P2", "ioc"},
> +       {"P5", "ioc-bridge"},
> +       {"PB", "io-drawer-backplane"},
> +       {"PC", "power-capacitor"},
> +       {"PD", "processor-card"},
> +       {"PF", "processor"},
> +       {"PI", "ioc-phb"},
> +       {"PO", "spcn"},
> +       {"PN", "spcn-connector"},
> +       {"PR", "pci-riser-card"},
> +       {"PS", "power-supply"},
> +       {"PT", "pass-through-card"},
> +       {"PX", "psc-sync-card"},
> +       {"PW", "power-connector"},
> +
> +       {"RG", "regulator"},
> +       {"RI", "riser"},
> +       {"RK", "rack-indicator"},
> +       {"RW", "riscwatch-connector"},
> +
> +       {"SA", "sys-attn-led"},
> +       {"SB", "backup-sysvpd"},
> +       {"SC", "scsi-connector"},
> +       {"SD", "sas-connector"},
> +       {"SI", "scsi-ide-converter"},
> +       {"SL", "phb-slot"},
> +       {"SP", "service-processor"},
> +       {"SR", "service-card"},
> +       {"SS", "soft-switch"},
> +       {"SV", "system-vpd"},
> +       {"SY", "legacy-sysvpd"},
> +
> +       {"TD", "tod-clock"},
> +       {"TI", "torrent-pcie-phb"},
> +       {"TL", "torrent-riser"},
> +       {"TM", "thermal-sensor"},
> +       {"TP", "tpmd-adapter"},
> +       {"TR", "torrent-bridge"},
> +
> +       {"VV", "root-node-vpd"},
> +
> +       {"WD", "water_device"},
> +};
> +

> +static const char *vpd_map_name(const char *vpd_name)
> +{
> +       int i;
> +
> +       for (i = 0; i < ARRAY_SIZE(vpd_key_table); i++)
> +               if (!strcmp(vpd_key_table[i].keyword, vpd_name))
> +                       return vpd_key_table[i].description;
> +
> +       return "Unknown";
> +}
> +

The current code emits a warning when returning "Unknown" which we
should probably keep. Otherwise, looks good.

Reviewed-by: Oliver O'Halloran <oohall at gmail.com>

>  static struct dt_node *dt_create_vpd_node(struct dt_node *parent,
>                                           const struct slca_entry *entry);
>
> @@ -148,293 +285,6 @@ no_memory:
>         prerror("VPD: memory allocation failure in VINI parsing\n");
>  }
>
> -static const char *vpd_map_name(const char *vpd_name)
> -{
> -       *snip*
> -
> -       prlog(PR_WARNING,
> -             "VPD: Could not map FRU ID %s to a known name\n", vpd_name);
> -       return "Unknown";
> -}
> -
>  static bool valid_child_entry(const struct slca_entry *entry)
>  {
>         if ((entry->install_indic == SLCA_INSTALL_INSTALLED) &&
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot


More information about the Skiboot mailing list