X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ls-vpd.c;h=fcb80ae030eabdc2d61378103349908cc58f4f0e;hb=2e05a86bf0c9d3d383f93517581395a1d2f17b6f;hp=cc279c3bf945b76dc8e1c635c10ad964440553cd;hpb=eff7cc9ee7f8b6efeb7d5854abbcfb8cdc486a95;p=pciutils.git diff --git a/ls-vpd.c b/ls-vpd.c index cc279c3..fcb80ae 100644 --- a/ls-vpd.c +++ b/ls-vpd.c @@ -6,10 +6,13 @@ * Written by Ben Hutchings * Improved by Martin Mares * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ #include +#include #include "lspci.h" @@ -41,19 +44,13 @@ static const struct vpd_item { { 'Y','A', F_TEXT, "Asset tag" }, { 'V', 0 , F_TEXT, "Vendor specific" }, { 'Y', 0 , F_TEXT, "System specific" }, -/* - * The following VPD keywords are vendor specific or not part of any - * current PCI-SIG specification - */ - { 'C','C', F_TEXT, "CCIN" }, - { 'F','C', F_TEXT, "Feature code" }, - { 'F','N', F_TEXT, "FRU" }, - { 'N','A', F_TEXT, "Network address" }, - { 'R','M', F_TEXT, "Firmware version" }, - { 'Z', 0 , F_TEXT, "Product specific" }, -/* - * End vendor specific VPD keywords - */ + /* Non-standard extensions */ + { 'C','C', F_TEXT, "CCIN" }, + { 'F','C', F_TEXT, "Feature code" }, + { 'F','N', F_TEXT, "FRU" }, + { 'N','A', F_TEXT, "Network address" }, + { 'R','M', F_TEXT, "Firmware version" }, + { 'Z', 0 , F_TEXT, "Product specific" }, { 0, 0 , F_BINARY, "Unknown" } }; @@ -162,13 +159,14 @@ cap_vpd(struct device *d) { word read_len; const struct vpd_item *item; - byte id1, id2; + byte id[2], id1, id2; if (!read_vpd(d, res_addr + part_pos, buf, 3, &csum)) break; part_pos += 3; - id1 = buf[0]; - id2 = buf[1]; + memcpy(id, buf, 2); + id1 = id[0]; + id2 = id[1]; part_len = buf[2]; if (part_len > res_len - part_pos) break; @@ -184,7 +182,9 @@ cap_vpd(struct device *d) if (!read_vpd(d, res_addr + part_pos, buf, read_len, &csum)) break; - printf("\t\t\t[%c%c] %s: ", id1, id2, item->name); + printf("\t\t\t["); + print_vpd_string(id, 2); + printf("] %s: ", item->name); switch (item->format) {