import dmidecode-3.2-6.el8
This commit is contained in:
parent
ace4185ba2
commit
ee2b86766a
@ -0,0 +1,30 @@
|
||||
From 65438a7ec0f4cddccf810136da6f280bd148af71 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:20 +0100
|
||||
Subject: [PATCH 01/23] dmidecode: Print type 33 name unconditionally
|
||||
|
||||
Even if a type 33 structure is too short, we can still display its
|
||||
type name as we do for all other structure types.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 8ebd8626d6ea..71c166f0595d 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -4807,8 +4807,8 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 33: /* 7.34 64-bit Memory Error Information */
|
||||
- if (h->length < 0x1F) break;
|
||||
printf("64-bit Memory Error Information\n");
|
||||
+ if (h->length < 0x1F) break;
|
||||
printf("\tType: %s\n",
|
||||
dmi_memory_error_type(data[0x04]));
|
||||
printf("\tGranularity: %s\n",
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 5bb7eb173b72256f70c6b3f3916d7a444be93340 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:23 +0100
|
||||
Subject: [PATCH 02/23] dmidecode: Don't choke on invalid processor voltage
|
||||
|
||||
If the processor voltage encoding has some of the reserved bits set
|
||||
and none of the proper bits set, print it as "Unknown" instead of an
|
||||
empty field.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 71c166f0595d..ef9bbd54b7f8 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -1190,13 +1190,13 @@ static void dmi_processor_voltage(u8 code)
|
||||
|
||||
if (code & 0x80)
|
||||
printf(" %.1f V", (float)(code & 0x7f) / 10);
|
||||
+ else if ((code & 0x07) == 0x00)
|
||||
+ printf(" Unknown");
|
||||
else
|
||||
{
|
||||
for (i = 0; i <= 2; i++)
|
||||
if (code & (1 << i))
|
||||
printf(" %s", voltage[i]);
|
||||
- if (code == 0x00)
|
||||
- printf(" Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,58 @@
|
||||
From 1347ccca96db6e157af39fcc565466fa98b9220b Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:27 +0100
|
||||
Subject: [PATCH 03/23] dmidecode: Simplify the formatting of memory error
|
||||
status
|
||||
|
||||
Make the logic more simple so that we always report the status on a
|
||||
single line.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 19 ++++++++++---------
|
||||
1 file changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index ef9bbd54b7f8..5a0631e926c7 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -1515,18 +1515,19 @@ static void dmi_memory_module_size(u8 code)
|
||||
printf(" (Single-bank Connection)");
|
||||
}
|
||||
|
||||
-static void dmi_memory_module_error(u8 code, const char *prefix)
|
||||
+static void dmi_memory_module_error(u8 code)
|
||||
{
|
||||
+ static const char *status[] = {
|
||||
+ "OK", /* 0x00 */
|
||||
+ "Uncorrectable Errors",
|
||||
+ "Correctable Errors",
|
||||
+ "Correctable and Uncorrectable Errors" /* 0x03 */
|
||||
+ };
|
||||
+
|
||||
if (code & (1 << 2))
|
||||
printf(" See Event Log\n");
|
||||
else
|
||||
- { if ((code & 0x03) == 0)
|
||||
- printf(" OK\n");
|
||||
- if (code & (1 << 0))
|
||||
- printf("%sUncorrectable Errors\n", prefix);
|
||||
- if (code & (1 << 1))
|
||||
- printf("%sCorrectable Errors\n", prefix);
|
||||
- }
|
||||
+ printf(" %s\n", status[code & 0x03]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4142,7 +4143,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
dmi_memory_module_size(data[0x0A]);
|
||||
printf("\n");
|
||||
printf("\tError Status:");
|
||||
- dmi_memory_module_error(data[0x0B], "\t\t");
|
||||
+ dmi_memory_module_error(data[0x0B]);
|
||||
break;
|
||||
|
||||
case 7: /* 7.8 Cache Information */
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 557c3c373a9992d45d4358a6a2ccf53b03276f39 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:30 +0100
|
||||
Subject: [PATCH 04/23] dmidecode: Fix the alignment of type 25 name
|
||||
|
||||
No tabulation needed before DMI structure names.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 5a0631e926c7..b459ed0ff84e 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -4651,7 +4651,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 25: /* 7.26 System Power Controls */
|
||||
- printf("\tSystem Power Controls\n");
|
||||
+ printf("System Power Controls\n");
|
||||
if (h->length < 0x09) break;
|
||||
printf("\tNext Scheduled Power-on:");
|
||||
dmi_power_controls_power_on(data + 0x04);
|
||||
--
|
||||
2.17.1
|
||||
|
35
SOURCES/0005-dmidecode-Code-indentation-fixes.patch
Normal file
35
SOURCES/0005-dmidecode-Code-indentation-fixes.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 37a856266e4fb2f85bd8f2f269db8bcfb1962eb0 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:33 +0100
|
||||
Subject: [PATCH 05/23] dmidecode: Code indentation fixes
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index b459ed0ff84e..0d95cf9d8f7b 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -3588,7 +3588,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
printf("%s\t\tHost IP Assignment Type: %s\n", prefix,
|
||||
dmi_protocol_assignment_type(assign_val));
|
||||
|
||||
- /* DSP0270: 8.6: Redfish Over IP Host Address format */
|
||||
+ /* DSP0270: 8.6: Redfish Over IP Host Address format */
|
||||
addrtype = rdata[17];
|
||||
addrstr = dmi_address_type(addrtype);
|
||||
printf("%s\t\tHost IP Address Format: %s\n", prefix,
|
||||
@@ -4856,7 +4856,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
WORD(data + 0x07));
|
||||
if (WORD(data + 0x09) != 0xFFFF)
|
||||
printf("\tThreshold Handle: 0x%04X\n",
|
||||
- WORD(data + 0x09));
|
||||
+ WORD(data + 0x09));
|
||||
}
|
||||
break;
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,161 @@
|
||||
From 61f3f163b98b271c6613b9744128b99f33e6e19e Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:37 +0100
|
||||
Subject: [PATCH 06/23] dmidecode: Reduce the indentation of type 42 structures
|
||||
|
||||
There is no reason to indent the device information that much in type
|
||||
42 structures. Remove the extra level of indentation for consistency
|
||||
and readability.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 40 ++++++++++++++++++++--------------------
|
||||
1 file changed, 20 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 0d95cf9d8f7b..fc140e7e36a9 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -3545,7 +3545,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
/* DSP0270: 8.5: Protocol Record Data */
|
||||
rdata = &rec[0x2];
|
||||
|
||||
- printf("%s\tProtocol ID: %02x (%s)\n", prefix, rid,
|
||||
+ printf("%sProtocol ID: %02x (%s)\n", prefix, rid,
|
||||
dmi_protocol_record_type(rid));
|
||||
|
||||
/*
|
||||
@@ -3575,7 +3575,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
* endianess of the field is always little after version 2.6.0
|
||||
* we can just pick a sufficiently recent version here.
|
||||
*/
|
||||
- printf("%s\t\tService UUID: ", prefix);
|
||||
+ printf("%s\tService UUID: ", prefix);
|
||||
dmi_system_uuid(&rdata[0], 0x311);
|
||||
printf("\n");
|
||||
|
||||
@@ -3585,13 +3585,13 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
* uses decimal, so as to make it more comparable
|
||||
*/
|
||||
assign_val = rdata[16];
|
||||
- printf("%s\t\tHost IP Assignment Type: %s\n", prefix,
|
||||
+ printf("%s\tHost IP Assignment Type: %s\n", prefix,
|
||||
dmi_protocol_assignment_type(assign_val));
|
||||
|
||||
/* DSP0270: 8.6: Redfish Over IP Host Address format */
|
||||
addrtype = rdata[17];
|
||||
addrstr = dmi_address_type(addrtype);
|
||||
- printf("%s\t\tHost IP Address Format: %s\n", prefix,
|
||||
+ printf("%s\tHost IP Address Format: %s\n", prefix,
|
||||
addrstr);
|
||||
|
||||
/* DSP0270: 8.6 IP Assignment types */
|
||||
@@ -3599,24 +3599,24 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
if (assign_val == 0x1 || assign_val == 0x3)
|
||||
{
|
||||
/* DSP0270: 8.6: the Host IPv[4|6] Address */
|
||||
- printf("%s\t\t%s Address: %s\n", prefix, addrstr,
|
||||
+ printf("%s\t%s Address: %s\n", prefix, addrstr,
|
||||
dmi_address_decode(&rdata[18], buf, addrtype));
|
||||
|
||||
/* DSP0270: 8.6: Prints the Host IPv[4|6] Mask */
|
||||
- printf("%s\t\t%s Mask: %s\n", prefix, addrstr,
|
||||
+ printf("%s\t%s Mask: %s\n", prefix, addrstr,
|
||||
dmi_address_decode(&rdata[34], buf, addrtype));
|
||||
}
|
||||
|
||||
/* DSP0270: 8.6: Get the Redfish Service IP Discovery Type */
|
||||
assign_val = rdata[50];
|
||||
/* Redfish Service IP Discovery type mirrors Host IP Assignment type */
|
||||
- printf("%s\t\tRedfish Service IP Discovery Type: %s\n", prefix,
|
||||
+ printf("%s\tRedfish Service IP Discovery Type: %s\n", prefix,
|
||||
dmi_protocol_assignment_type(assign_val));
|
||||
|
||||
/* DSP0270: 8.6: Get the Redfish Service IP Address Format */
|
||||
addrtype = rdata[51];
|
||||
addrstr = dmi_address_type(addrtype);
|
||||
- printf("%s\t\tRedfish Service IP Address Format: %s\n", prefix,
|
||||
+ printf("%s\tRedfish Service IP Address Format: %s\n", prefix,
|
||||
addrstr);
|
||||
|
||||
if (assign_val == 0x1 || assign_val == 0x3)
|
||||
@@ -3625,20 +3625,20 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
u32 vlan;
|
||||
|
||||
/* DSP0270: 8.6: Prints the Redfish IPv[4|6] Service Address */
|
||||
- printf("%s\t\t%s Redfish Service Address: %s\n", prefix,
|
||||
+ printf("%s\t%s Redfish Service Address: %s\n", prefix,
|
||||
addrstr, dmi_address_decode(&rdata[52], buf,
|
||||
addrtype));
|
||||
|
||||
/* DSP0270: 8.6: Prints the Redfish IPv[4|6] Service Mask */
|
||||
- printf("%s\t\t%s Redfish Service Mask: %s\n", prefix,
|
||||
+ printf("%s\t%s Redfish Service Mask: %s\n", prefix,
|
||||
addrstr, dmi_address_decode(&rdata[68], buf,
|
||||
addrtype));
|
||||
|
||||
/* DSP0270: 8.6: Redfish vlan and port info */
|
||||
port = WORD(&rdata[84]);
|
||||
vlan = DWORD(&rdata[86]);
|
||||
- printf("%s\t\tRedfish Service Port: %hu\n", prefix, port);
|
||||
- printf("%s\t\tRedfish Service Vlan: %u\n", prefix, vlan);
|
||||
+ printf("%s\tRedfish Service Port: %hu\n", prefix, port);
|
||||
+ printf("%s\tRedfish Service Vlan: %u\n", prefix, vlan);
|
||||
}
|
||||
|
||||
/* DSP0270: 8.6: Redfish host length and name */
|
||||
@@ -3655,7 +3655,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
hname = out_of_spec;
|
||||
hlen = strlen(out_of_spec);
|
||||
}
|
||||
- printf("%s\t\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname);
|
||||
+ printf("%s\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3728,10 +3728,10 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
/* USB Device Type - need at least 6 bytes */
|
||||
u8 *usbdata = &data[0x7];
|
||||
/* USB Device Descriptor: idVendor */
|
||||
- printf("%s\tidVendor: 0x%04x\n", prefix,
|
||||
+ printf("%sidVendor: 0x%04x\n", prefix,
|
||||
WORD(&usbdata[0x0]));
|
||||
/* USB Device Descriptor: idProduct */
|
||||
- printf("%s\tidProduct: 0x%04x\n", prefix,
|
||||
+ printf("%sidProduct: 0x%04x\n", prefix,
|
||||
WORD(&usbdata[0x2]));
|
||||
/*
|
||||
* USB Serial number is here, but its useless, don't
|
||||
@@ -3743,16 +3743,16 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
/* PCI Device Type - Need at least 8 bytes */
|
||||
u8 *pcidata = &data[0x7];
|
||||
/* PCI Device Descriptor: VendorID */
|
||||
- printf("%s\tVendorID: 0x%04x\n", prefix,
|
||||
+ printf("%sVendorID: 0x%04x\n", prefix,
|
||||
WORD(&pcidata[0x0]));
|
||||
/* PCI Device Descriptor: DeviceID */
|
||||
- printf("%s\tDeviceID: 0x%04x\n", prefix,
|
||||
+ printf("%sDeviceID: 0x%04x\n", prefix,
|
||||
WORD(&pcidata[0x2]));
|
||||
/* PCI Device Descriptor: PCI SubvendorID */
|
||||
- printf("%s\tSubVendorID: 0x%04x\n", prefix,
|
||||
+ printf("%sSubVendorID: 0x%04x\n", prefix,
|
||||
WORD(&pcidata[0x4]));
|
||||
/* PCI Device Descriptor: PCI SubdeviceID */
|
||||
- printf("%s\tSubDeviceID: 0x%04x\n", prefix,
|
||||
+ printf("%sSubDeviceID: 0x%04x\n", prefix,
|
||||
WORD(&pcidata[0x6]));
|
||||
}
|
||||
else if (type == 0x4 && len >= 5)
|
||||
@@ -3760,7 +3760,7 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
/* OEM Device Type - Need at least 4 bytes */
|
||||
u8 *oemdata = &data[0x7];
|
||||
/* OEM Device Descriptor: IANA */
|
||||
- printf("%s\tVendor ID: 0x%02x:0x%02x:0x%02x:0x%02x\n",
|
||||
+ printf("%sVendor ID: 0x%02x:0x%02x:0x%02x:0x%02x\n",
|
||||
prefix, oemdata[0x0], oemdata[0x1],
|
||||
oemdata[0x2], oemdata[0x3]);
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 30121a064378b2c0174659cd52449c70aa2c271f Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:40 +0100
|
||||
Subject: [PATCH 07/23] dmidecode: Move type 42 warning messages to stderr
|
||||
|
||||
Write warning messages about invalid type 42 structures to stderr as
|
||||
we do for all other warning messages.
|
||||
|
||||
Also include the handle and record numbers in these warning messages
|
||||
to make the problem easier to analyze.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index fc140e7e36a9..50fd0bffa26d 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -3780,8 +3780,9 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
total_read++;
|
||||
if (total_read > h->length)
|
||||
{
|
||||
- printf("%s\tWARN: Total read length %d exceeds total structure length %d\n",
|
||||
- prefix, total_read, h->length);
|
||||
+ fprintf(stderr,
|
||||
+ "Total read length %d exceeds total structure length %d (handle 0x%04hx)\n",
|
||||
+ total_read, h->length, h->handle);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3801,8 +3802,9 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
total_read += rec[1] + 2;
|
||||
if (total_read > h->length)
|
||||
{
|
||||
- printf("%s\tWARN: Total read length %d exceeds total structure length %d\n",
|
||||
- prefix, total_read, h->length);
|
||||
+ fprintf(stderr,
|
||||
+ "Total read length %d exceeds total structure length %d (handle 0x%04hx, record %d)\n",
|
||||
+ total_read, h->length, h->handle, i + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,122 @@
|
||||
From 26a66d708c6caef09912245c93371ec96c1e0cbd Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 23 Mar 2020 16:47:44 +0100
|
||||
Subject: [PATCH 08/23] dmidecode: Refactor ASCII filtering of DMI strings
|
||||
|
||||
Split dmi_string into 3 functions to make it more modular. ASCII
|
||||
filtering is an explicit option now to give the caller more control.
|
||||
|
||||
Use the new functions in dmi_dump to avoid reimplementing the ASCII
|
||||
filtering and printing characters one by one.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 60 ++++++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 32 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 50fd0bffa26d..8ec1d6b9597a 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -109,13 +109,19 @@ int is_printable(const u8 *data, int len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-const char *dmi_string(const struct dmi_header *dm, u8 s)
|
||||
+/* Replace non-ASCII characters with dots */
|
||||
+static void ascii_filter(char *bp, size_t len)
|
||||
{
|
||||
- char *bp = (char *)dm->data;
|
||||
- size_t i, len;
|
||||
+ size_t i;
|
||||
|
||||
- if (s == 0)
|
||||
- return "Not Specified";
|
||||
+ for (i = 0; i < len; i++)
|
||||
+ if (bp[i] < 32 || bp[i] == 127)
|
||||
+ bp[i] = '.';
|
||||
+}
|
||||
+
|
||||
+static char *_dmi_string(const struct dmi_header *dm, u8 s, int filter)
|
||||
+{
|
||||
+ char *bp = (char *)dm->data;
|
||||
|
||||
bp += dm->length;
|
||||
while (s > 1 && *bp)
|
||||
@@ -126,16 +132,24 @@ const char *dmi_string(const struct dmi_header *dm, u8 s)
|
||||
}
|
||||
|
||||
if (!*bp)
|
||||
- return bad_index;
|
||||
+ return NULL;
|
||||
|
||||
- if (!(opt.flags & FLAG_DUMP))
|
||||
- {
|
||||
- /* ASCII filtering */
|
||||
- len = strlen(bp);
|
||||
- for (i = 0; i < len; i++)
|
||||
- if (bp[i] < 32 || bp[i] == 127)
|
||||
- bp[i] = '.';
|
||||
- }
|
||||
+ if (filter)
|
||||
+ ascii_filter(bp, strlen(bp));
|
||||
+
|
||||
+ return bp;
|
||||
+}
|
||||
+
|
||||
+const char *dmi_string(const struct dmi_header *dm, u8 s)
|
||||
+{
|
||||
+ char *bp;
|
||||
+
|
||||
+ if (s == 0)
|
||||
+ return "Not Specified";
|
||||
+
|
||||
+ bp = _dmi_string(dm, s, 1);
|
||||
+ if (bp == NULL)
|
||||
+ return bad_index;
|
||||
|
||||
return bp;
|
||||
}
|
||||
@@ -208,7 +222,7 @@ static int dmi_bcd_range(u8 value, u8 low, u8 high)
|
||||
static void dmi_dump(const struct dmi_header *h, const char *prefix)
|
||||
{
|
||||
int row, i;
|
||||
- const char *s;
|
||||
+ char *s;
|
||||
|
||||
printf("%sHeader and Data:\n", prefix);
|
||||
for (row = 0; row < ((h->length - 1) >> 4) + 1; row++)
|
||||
@@ -224,7 +238,7 @@ static void dmi_dump(const struct dmi_header *h, const char *prefix)
|
||||
{
|
||||
printf("%sStrings:\n", prefix);
|
||||
i = 1;
|
||||
- while ((s = dmi_string(h, i++)) != bad_index)
|
||||
+ while ((s = _dmi_string(h, i++, !(opt.flags & FLAG_DUMP))))
|
||||
{
|
||||
if (opt.flags & FLAG_DUMP)
|
||||
{
|
||||
@@ -238,19 +252,9 @@ static void dmi_dump(const struct dmi_header *h, const char *prefix)
|
||||
printf("\n");
|
||||
}
|
||||
/* String isn't filtered yet so do it now */
|
||||
- printf("%s\t\"", prefix);
|
||||
- while (*s)
|
||||
- {
|
||||
- if (*s < 32 || *s == 127)
|
||||
- fputc('.', stdout);
|
||||
- else
|
||||
- fputc(*s, stdout);
|
||||
- s++;
|
||||
- }
|
||||
- printf("\"\n");
|
||||
+ ascii_filter(s, l - 1);
|
||||
}
|
||||
- else
|
||||
- printf("%s\t%s\n", prefix, s);
|
||||
+ printf("%s\t%s\n", prefix, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
214
SOURCES/0009-dmidecode-Add-helper-function-pr_comment.patch
Normal file
214
SOURCES/0009-dmidecode-Add-helper-function-pr_comment.patch
Normal file
@ -0,0 +1,214 @@
|
||||
From 2241f1dd232fe8e1d57fdb2482ad417ebe23279e Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 09:51:46 +0200
|
||||
Subject: [PATCH 09/23] dmidecode: Add helper function pr_comment
|
||||
|
||||
Print all comments through a helper function pr_comment.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
Makefile | 7 +++++--
|
||||
dmidecode.c | 33 +++++++++++++++++----------------
|
||||
dmioutput.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
dmioutput.h | 22 ++++++++++++++++++++++
|
||||
4 files changed, 79 insertions(+), 18 deletions(-)
|
||||
create mode 100644 dmioutput.c
|
||||
create mode 100644 dmioutput.h
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 77c931091b0f..5d58266ef2de 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -61,8 +61,8 @@ all : $(PROGRAMS)
|
||||
# Programs
|
||||
#
|
||||
|
||||
-dmidecode : dmidecode.o dmiopt.o dmioem.o util.o
|
||||
- $(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o util.o -o $@
|
||||
+dmidecode : dmidecode.o dmiopt.o dmioem.o dmioutput.o util.o
|
||||
+ $(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o dmioutput.o util.o -o $@
|
||||
|
||||
biosdecode : biosdecode.o util.o
|
||||
$(CC) $(LDFLAGS) biosdecode.o util.o -o $@
|
||||
@@ -87,6 +87,9 @@ dmiopt.o : dmiopt.c config.h types.h util.h dmidecode.h dmiopt.h
|
||||
dmioem.o : dmioem.c types.h dmidecode.h dmioem.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
+dmioutput.o : dmioutput.c types.h dmioutput.h
|
||||
+ $(CC) $(CFLAGS) -c $< -o $@
|
||||
+
|
||||
biosdecode.o : biosdecode.c version.h types.h util.h config.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 8ec1d6b9597a..2939b2d307fc 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -80,6 +80,7 @@
|
||||
#include "dmidecode.h"
|
||||
#include "dmiopt.h"
|
||||
#include "dmioem.h"
|
||||
+#include "dmioutput.h"
|
||||
|
||||
#define out_of_spec "<OUT OF SPEC>"
|
||||
static const char *bad_index = "<BAD INDEX>";
|
||||
@@ -5162,7 +5163,7 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
|
||||
static void dmi_table_dump(const u8 *buf, u32 len)
|
||||
{
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("# Writing %d bytes to %s.\n", len, opt.dumpfile);
|
||||
+ pr_comment("Writing %d bytes to %s.", len, opt.dumpfile);
|
||||
write_dump(32, len, buf, opt.dumpfile, 0);
|
||||
}
|
||||
|
||||
@@ -5283,11 +5284,11 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
|
||||
|
||||
if (ver > SUPPORTED_SMBIOS_VER && !(opt.flags & FLAG_QUIET))
|
||||
{
|
||||
- printf("# SMBIOS implementations newer than version %u.%u.%u are not\n"
|
||||
- "# fully supported by this version of dmidecode.\n",
|
||||
- SUPPORTED_SMBIOS_VER >> 16,
|
||||
- (SUPPORTED_SMBIOS_VER >> 8) & 0xFF,
|
||||
- SUPPORTED_SMBIOS_VER & 0xFF);
|
||||
+ pr_comment("SMBIOS implementations newer than version %u.%u.%u are not",
|
||||
+ SUPPORTED_SMBIOS_VER >> 16,
|
||||
+ (SUPPORTED_SMBIOS_VER >> 8) & 0xFF,
|
||||
+ SUPPORTED_SMBIOS_VER & 0xFF);
|
||||
+ pr_comment("fully supported by this version of dmidecode.");
|
||||
}
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
@@ -5417,8 +5418,8 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
|
||||
overwrite_smbios3_address(crafted);
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("# Writing %d bytes to %s.\n", crafted[0x06],
|
||||
- opt.dumpfile);
|
||||
+ pr_comment("Writing %d bytes to %s.", crafted[0x06],
|
||||
+ opt.dumpfile);
|
||||
write_dump(0, crafted[0x06], crafted, opt.dumpfile, 1);
|
||||
}
|
||||
|
||||
@@ -5478,8 +5479,8 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
|
||||
overwrite_dmi_address(crafted + 0x10);
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("# Writing %d bytes to %s.\n", crafted[0x05],
|
||||
- opt.dumpfile);
|
||||
+ pr_comment("Writing %d bytes to %s.", crafted[0x05],
|
||||
+ opt.dumpfile);
|
||||
write_dump(0, crafted[0x05], crafted, opt.dumpfile, 1);
|
||||
}
|
||||
|
||||
@@ -5507,8 +5508,8 @@ static int legacy_decode(u8 *buf, const char *devmem, u32 flags)
|
||||
overwrite_dmi_address(crafted);
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("# Writing %d bytes to %s.\n", 0x0F,
|
||||
- opt.dumpfile);
|
||||
+ pr_comment("Writing %d bytes to %s.", 0x0F,
|
||||
+ opt.dumpfile);
|
||||
write_dump(0, 0x0F, crafted, opt.dumpfile, 1);
|
||||
}
|
||||
|
||||
@@ -5586,8 +5587,8 @@ static int address_from_efi(off_t *address)
|
||||
#endif
|
||||
|
||||
if (ret == 0 && !(opt.flags & FLAG_QUIET))
|
||||
- printf("# %s entry point at 0x%08llx\n",
|
||||
- eptype, (unsigned long long)*address);
|
||||
+ pr_comment("%s entry point at 0x%08llx",
|
||||
+ eptype, (unsigned long long)*address);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -5638,7 +5639,7 @@ int main(int argc, char * const argv[])
|
||||
}
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("# dmidecode %s\n", VERSION);
|
||||
+ pr_comment("dmidecode %s", VERSION);
|
||||
|
||||
/* Read from dump if so instructed */
|
||||
if (opt.flags & FLAG_FROM_DUMP)
|
||||
@@ -5783,7 +5784,7 @@ int main(int argc, char * const argv[])
|
||||
|
||||
done:
|
||||
if (!found && !(opt.flags & FLAG_QUIET))
|
||||
- printf("# No SMBIOS nor DMI entry point found, sorry.\n");
|
||||
+ pr_comment("No SMBIOS nor DMI entry point found, sorry.");
|
||||
|
||||
free(buf);
|
||||
exit_free:
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
new file mode 100644
|
||||
index 000000000000..e762a035f39d
|
||||
--- /dev/null
|
||||
+++ b/dmioutput.c
|
||||
@@ -0,0 +1,35 @@
|
||||
+/*
|
||||
+ * Generic output functions
|
||||
+ * This file is part of the dmidecode project.
|
||||
+ *
|
||||
+ * Copyright (C) 2020 Jean Delvare <jdelvare@suse.de>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+ */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+#include <stdio.h>
|
||||
+#include "dmioutput.h"
|
||||
+
|
||||
+void pr_comment(const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ printf("# ");
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ printf("\n");
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
new file mode 100644
|
||||
index 000000000000..b6cf5ee8b60e
|
||||
--- /dev/null
|
||||
+++ b/dmioutput.h
|
||||
@@ -0,0 +1,22 @@
|
||||
+/*
|
||||
+ * Generic output functions
|
||||
+ * This file is part of the dmidecode project.
|
||||
+ *
|
||||
+ * Copyright (C) 2020 Jean Delvare <jdelvare@suse.de>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+ */
|
||||
+
|
||||
+void pr_comment(const char *format, ...);
|
||||
--
|
||||
2.17.1
|
||||
|
142
SOURCES/0010-dmidecode-Add-helper-function-pr_info.patch
Normal file
142
SOURCES/0010-dmidecode-Add-helper-function-pr_info.patch
Normal file
@ -0,0 +1,142 @@
|
||||
From dd593d2f0c7272658070208d0a6957d77fc7e6f2 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 09:51:51 +0200
|
||||
Subject: [PATCH 10/23] dmidecode: Add helper function pr_info
|
||||
|
||||
Print all info messages through a helper function pr_info.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 30 +++++++++++++++---------------
|
||||
dmioutput.c | 10 ++++++++++
|
||||
dmioutput.h | 1 +
|
||||
3 files changed, 26 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 2939b2d307fc..e3f6e300efc2 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -5296,11 +5296,11 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
|
||||
if (opt.type == NULL)
|
||||
{
|
||||
if (num)
|
||||
- printf("%u structures occupying %u bytes.\n",
|
||||
- num, len);
|
||||
+ pr_info("%u structures occupying %u bytes.",
|
||||
+ num, len);
|
||||
if (!(opt.flags & FLAG_FROM_DUMP))
|
||||
- printf("Table at 0x%08llX.\n",
|
||||
- (unsigned long long)base);
|
||||
+ pr_info("Table at 0x%08llX.",
|
||||
+ (unsigned long long)base);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
@@ -5397,8 +5397,8 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
|
||||
|
||||
ver = (buf[0x07] << 16) + (buf[0x08] << 8) + buf[0x09];
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("SMBIOS %u.%u.%u present.\n",
|
||||
- buf[0x07], buf[0x08], buf[0x09]);
|
||||
+ pr_info("SMBIOS %u.%u.%u present.",
|
||||
+ buf[0x07], buf[0x08], buf[0x09]);
|
||||
|
||||
offset = QWORD(buf + 0x10);
|
||||
if (!(flags & FLAG_NO_FILE_OFFSET) && offset.h && sizeof(off_t) < 8)
|
||||
@@ -5465,7 +5465,7 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
|
||||
break;
|
||||
}
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("SMBIOS %u.%u present.\n",
|
||||
+ pr_info("SMBIOS %u.%u present.",
|
||||
ver >> 8, ver & 0xFF);
|
||||
|
||||
dmi_table(DWORD(buf + 0x18), WORD(buf + 0x16), WORD(buf + 0x1C),
|
||||
@@ -5493,7 +5493,7 @@ static int legacy_decode(u8 *buf, const char *devmem, u32 flags)
|
||||
return 0;
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("Legacy DMI %u.%u present.\n",
|
||||
+ pr_info("Legacy DMI %u.%u present.",
|
||||
buf[0x0E] >> 4, buf[0x0E] & 0x0F);
|
||||
|
||||
dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06), WORD(buf + 0x0C),
|
||||
@@ -5645,8 +5645,8 @@ int main(int argc, char * const argv[])
|
||||
if (opt.flags & FLAG_FROM_DUMP)
|
||||
{
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("Reading SMBIOS/DMI data from file %s.\n",
|
||||
- opt.dumpfile);
|
||||
+ pr_info("Reading SMBIOS/DMI data from file %s.",
|
||||
+ opt.dumpfile);
|
||||
if ((buf = mem_chunk(0, 0x20, opt.dumpfile)) == NULL)
|
||||
{
|
||||
ret = 1;
|
||||
@@ -5681,7 +5681,7 @@ int main(int argc, char * const argv[])
|
||||
&& (buf = read_file(0, &size, SYS_ENTRY_FILE)) != NULL)
|
||||
{
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("Getting SMBIOS data from sysfs.\n");
|
||||
+ pr_info("Getting SMBIOS data from sysfs.");
|
||||
if (size >= 24 && memcmp(buf, "_SM3_", 5) == 0)
|
||||
{
|
||||
if (smbios3_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET))
|
||||
@@ -5701,7 +5701,7 @@ int main(int argc, char * const argv[])
|
||||
if (found)
|
||||
goto done;
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("Failed to get SMBIOS data from sysfs.\n");
|
||||
+ pr_info("Failed to get SMBIOS data from sysfs.");
|
||||
}
|
||||
|
||||
/* Next try EFI (ia64, Intel-based Mac, arm64) */
|
||||
@@ -5716,8 +5716,8 @@ int main(int argc, char * const argv[])
|
||||
}
|
||||
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("Found SMBIOS entry point in EFI, reading table from %s.\n",
|
||||
- opt.devmem);
|
||||
+ pr_info("Found SMBIOS entry point in EFI, reading table from %s.",
|
||||
+ opt.devmem);
|
||||
if ((buf = mem_chunk(fp, 0x20, opt.devmem)) == NULL)
|
||||
{
|
||||
ret = 1;
|
||||
@@ -5739,7 +5739,7 @@ int main(int argc, char * const argv[])
|
||||
memory_scan:
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- printf("Scanning %s for entry point.\n", opt.devmem);
|
||||
+ pr_info("Scanning %s for entry point.", opt.devmem);
|
||||
/* Fallback to memory scan (x86, x86_64) */
|
||||
if ((buf = mem_chunk(0xF0000, 0x10000, opt.devmem)) == NULL)
|
||||
{
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index e762a035f39d..e702f114bb4a 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -33,3 +33,13 @@ void pr_comment(const char *format, ...)
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
+
|
||||
+void pr_info(const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ printf("\n");
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index b6cf5ee8b60e..0dd8f0811934 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -20,3 +20,4 @@
|
||||
*/
|
||||
|
||||
void pr_comment(const char *format, ...);
|
||||
+void pr_info(const char *format, ...);
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 0c6f1819b5421166f55369bb33f538bf64805ff6 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 09:51:54 +0200
|
||||
Subject: [PATCH 11/23] dmidecode: Protect dmidecode.h against double inclusion
|
||||
|
||||
We'll soon need to include dmidecode.h from another header file, so
|
||||
protect it against double inclusion.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.h | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/dmidecode.h b/dmidecode.h
|
||||
index 20e7e96efc0f..9ecc1791702d 100644
|
||||
--- a/dmidecode.h
|
||||
+++ b/dmidecode.h
|
||||
@@ -18,6 +18,9 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
+#ifndef DMIDECODE_H
|
||||
+#define DMIDECODE_H
|
||||
+
|
||||
#include "types.h"
|
||||
|
||||
struct dmi_header
|
||||
@@ -30,3 +33,5 @@ struct dmi_header
|
||||
|
||||
int is_printable(const u8 *data, int len);
|
||||
const char *dmi_string(const struct dmi_header *dm, u8 s);
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.17.1
|
||||
|
58
SOURCES/0012-dmidecode-Add-helper-function-pr_handle.patch
Normal file
58
SOURCES/0012-dmidecode-Add-helper-function-pr_handle.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From d37eed24b07da16719ce969f119b4c636e0e2d96 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 09:51:57 +0200
|
||||
Subject: [PATCH 12/23] dmidecode: Add helper function pr_handle
|
||||
|
||||
Print the handle information through a helper function pr_handle.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 3 +--
|
||||
dmioutput.c | 6 ++++++
|
||||
dmioutput.h | 3 +++
|
||||
3 files changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index e3f6e300efc2..8ba8d078614e 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -5212,8 +5212,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
|
||||
|
||||
if (display
|
||||
&& (!(opt.flags & FLAG_QUIET) || (opt.flags & FLAG_DUMP)))
|
||||
- printf("Handle 0x%04X, DMI type %d, %d bytes\n",
|
||||
- h.handle, h.type, h.length);
|
||||
+ pr_handle(&h);
|
||||
|
||||
/* Look for the next handle */
|
||||
next = data + h.length;
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index e702f114bb4a..ad3b0398c446 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -43,3 +43,9 @@ void pr_info(const char *format, ...)
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
+
|
||||
+void pr_handle(const struct dmi_header *h)
|
||||
+{
|
||||
+ printf("Handle 0x%04X, DMI type %d, %d bytes\n",
|
||||
+ h->handle, h->type, h->length);
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index 0dd8f0811934..6ef60f0ee3cd 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -19,5 +19,8 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
+#include "dmidecode.h"
|
||||
+
|
||||
void pr_comment(const char *format, ...);
|
||||
void pr_info(const char *format, ...);
|
||||
+void pr_handle(const struct dmi_header *h);
|
||||
--
|
||||
2.17.1
|
||||
|
569
SOURCES/0013-dmidecode-Add-helper-function-pr_handle_name.patch
Normal file
569
SOURCES/0013-dmidecode-Add-helper-function-pr_handle_name.patch
Normal file
@ -0,0 +1,569 @@
|
||||
From ebbe1dbe9a4413232949d97a506db6a7c00865fa Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 09:52:00 +0200
|
||||
Subject: [PATCH 13/23] dmidecode: Add helper function pr_handle_name
|
||||
|
||||
Print the name of each handle type through a helper function
|
||||
pr_handle_name.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 99 ++++++++++++++++++++++++++---------------------------
|
||||
dmioem.c | 25 +++++++-------
|
||||
dmioutput.c | 10 ++++++
|
||||
dmioutput.h | 1 +
|
||||
4 files changed, 73 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 8ba8d078614e..c226bad06638 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -2083,11 +2083,10 @@ static void dmi_on_board_devices(const struct dmi_header *h, const char *prefix)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (count == 1)
|
||||
- printf("%sOn Board Device Information\n",
|
||||
- prefix);
|
||||
+ pr_handle_name("On Board Device Information");
|
||||
else
|
||||
- printf("%sOn Board Device %d Information\n",
|
||||
- prefix, i + 1);
|
||||
+ pr_handle_name("On Board Device %d Information",
|
||||
+ i + 1);
|
||||
printf("%s\tType: %s\n",
|
||||
prefix, dmi_on_board_devices_type(p[2 * i] & 0x7F));
|
||||
printf("%s\tStatus: %s\n",
|
||||
@@ -3397,7 +3396,7 @@ static void dmi_additional_info(const struct dmi_header *h, const char *prefix)
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
- printf("%sAdditional Information %d\n", prefix, i + 1);
|
||||
+ pr_handle_name("Additional Information %d", i + 1);
|
||||
|
||||
/* Check for short entries */
|
||||
if (h->length < offset + 1) break;
|
||||
@@ -3893,7 +3892,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
switch (h->type)
|
||||
{
|
||||
case 0: /* 7.1 BIOS Information */
|
||||
- printf("BIOS Information\n");
|
||||
+ pr_handle_name("BIOS Information");
|
||||
if (h->length < 0x12) break;
|
||||
printf("\tVendor: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -3933,7 +3932,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 1: /* 7.2 System Information */
|
||||
- printf("System Information\n");
|
||||
+ pr_handle_name("System Information");
|
||||
if (h->length < 0x08) break;
|
||||
printf("\tManufacturer: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -3957,7 +3956,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 2: /* 7.3 Base Board Information */
|
||||
- printf("Base Board Information\n");
|
||||
+ pr_handle_name("Base Board Information");
|
||||
if (h->length < 0x08) break;
|
||||
printf("\tManufacturer: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -3988,7 +3987,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 3: /* 7.4 Chassis Information */
|
||||
- printf("Chassis Information\n");
|
||||
+ pr_handle_name("Chassis Information");
|
||||
if (h->length < 0x09) break;
|
||||
printf("\tManufacturer: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4030,7 +4029,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 4: /* 7.5 Processor Information */
|
||||
- printf("Processor Information\n");
|
||||
+ pr_handle_name("Processor Information");
|
||||
if (h->length < 0x1A) break;
|
||||
printf("\tSocket Designation: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4100,7 +4099,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 5: /* 7.6 Memory Controller Information */
|
||||
- printf("Memory Controller Information\n");
|
||||
+ pr_handle_name("Memory Controller Information");
|
||||
if (h->length < 0x0F) break;
|
||||
printf("\tError Detecting Method: %s\n",
|
||||
dmi_memory_controller_ed_method(data[0x04]));
|
||||
@@ -4130,7 +4129,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 6: /* 7.7 Memory Module Information */
|
||||
- printf("Memory Module Information\n");
|
||||
+ pr_handle_name("Memory Module Information");
|
||||
if (h->length < 0x0C) break;
|
||||
printf("\tSocket Designation: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4154,7 +4153,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 7: /* 7.8 Cache Information */
|
||||
- printf("Cache Information\n");
|
||||
+ pr_handle_name("Cache Information");
|
||||
if (h->length < 0x0F) break;
|
||||
printf("\tSocket Designation: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4197,7 +4196,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 8: /* 7.9 Port Connector Information */
|
||||
- printf("Port Connector Information\n");
|
||||
+ pr_handle_name("Port Connector Information");
|
||||
if (h->length < 0x09) break;
|
||||
printf("\tInternal Reference Designator: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4212,7 +4211,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 9: /* 7.10 System Slots */
|
||||
- printf("System Slot Information\n");
|
||||
+ pr_handle_name("System Slot Information");
|
||||
if (h->length < 0x0C) break;
|
||||
printf("\tDesignation: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4243,19 +4242,19 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 11: /* 7.12 OEM Strings */
|
||||
- printf("OEM Strings\n");
|
||||
+ pr_handle_name("OEM Strings");
|
||||
if (h->length < 0x05) break;
|
||||
dmi_oem_strings(h, "\t");
|
||||
break;
|
||||
|
||||
case 12: /* 7.13 System Configuration Options */
|
||||
- printf("System Configuration Options\n");
|
||||
+ pr_handle_name("System Configuration Options");
|
||||
if (h->length < 0x05) break;
|
||||
dmi_system_configuration_options(h, "\t");
|
||||
break;
|
||||
|
||||
case 13: /* 7.14 BIOS Language Information */
|
||||
- printf("BIOS Language Information\n");
|
||||
+ pr_handle_name("BIOS Language Information");
|
||||
if (h->length < 0x16) break;
|
||||
if (ver >= 0x0201)
|
||||
{
|
||||
@@ -4269,7 +4268,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 14: /* 7.15 Group Associations */
|
||||
- printf("Group Associations\n");
|
||||
+ pr_handle_name("Group Associations");
|
||||
if (h->length < 0x05) break;
|
||||
printf("\tName: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4279,7 +4278,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 15: /* 7.16 System Event Log */
|
||||
- printf("System Event Log\n");
|
||||
+ pr_handle_name("System Event Log");
|
||||
if (h->length < 0x14) break;
|
||||
printf("\tArea Length: %u bytes\n",
|
||||
WORD(data + 0x04));
|
||||
@@ -4311,7 +4310,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 16: /* 7.17 Physical Memory Array */
|
||||
- printf("Physical Memory Array\n");
|
||||
+ pr_handle_name("Physical Memory Array");
|
||||
if (h->length < 0x0F) break;
|
||||
printf("\tLocation: %s\n",
|
||||
dmi_memory_array_location(data[0x04]));
|
||||
@@ -4347,7 +4346,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 17: /* 7.18 Memory Device */
|
||||
- printf("Memory Device\n");
|
||||
+ pr_handle_name("Memory Device");
|
||||
if (h->length < 0x15) break;
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
{
|
||||
@@ -4457,7 +4456,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 18: /* 7.19 32-bit Memory Error Information */
|
||||
- printf("32-bit Memory Error Information\n");
|
||||
+ pr_handle_name("32-bit Memory Error Information");
|
||||
if (h->length < 0x17) break;
|
||||
printf("\tType: %s\n",
|
||||
dmi_memory_error_type(data[0x04]));
|
||||
@@ -4480,7 +4479,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 19: /* 7.20 Memory Array Mapped Address */
|
||||
- printf("Memory Array Mapped Address\n");
|
||||
+ pr_handle_name("Memory Array Mapped Address");
|
||||
if (h->length < 0x0F) break;
|
||||
if (h->length >= 0x1F && DWORD(data + 0x04) == 0xFFFFFFFF)
|
||||
{
|
||||
@@ -4516,7 +4515,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 20: /* 7.21 Memory Device Mapped Address */
|
||||
- printf("Memory Device Mapped Address\n");
|
||||
+ pr_handle_name("Memory Device Mapped Address");
|
||||
if (h->length < 0x13) break;
|
||||
if (h->length >= 0x23 && DWORD(data + 0x04) == 0xFFFFFFFF)
|
||||
{
|
||||
@@ -4559,7 +4558,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 21: /* 7.22 Built-in Pointing Device */
|
||||
- printf("Built-in Pointing Device\n");
|
||||
+ pr_handle_name("Built-in Pointing Device");
|
||||
if (h->length < 0x07) break;
|
||||
printf("\tType: %s\n",
|
||||
dmi_pointing_device_type(data[0x04]));
|
||||
@@ -4570,7 +4569,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 22: /* 7.23 Portable Battery */
|
||||
- printf("Portable Battery\n");
|
||||
+ pr_handle_name("Portable Battery");
|
||||
if (h->length < 0x10) break;
|
||||
printf("\tLocation: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4618,7 +4617,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 23: /* 7.24 System Reset */
|
||||
- printf("System Reset\n");
|
||||
+ pr_handle_name("System Reset");
|
||||
if (h->length < 0x0D) break;
|
||||
printf("\tStatus: %s\n",
|
||||
data[0x04] & (1 << 0) ? "Enabled" : "Disabled");
|
||||
@@ -4645,7 +4644,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 24: /* 7.25 Hardware Security */
|
||||
- printf("Hardware Security\n");
|
||||
+ pr_handle_name("Hardware Security");
|
||||
if (h->length < 0x05) break;
|
||||
printf("\tPower-On Password Status: %s\n",
|
||||
dmi_hardware_security_status(data[0x04] >> 6));
|
||||
@@ -4658,7 +4657,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 25: /* 7.26 System Power Controls */
|
||||
- printf("System Power Controls\n");
|
||||
+ pr_handle_name("System Power Controls");
|
||||
if (h->length < 0x09) break;
|
||||
printf("\tNext Scheduled Power-on:");
|
||||
dmi_power_controls_power_on(data + 0x04);
|
||||
@@ -4666,7 +4665,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 26: /* 7.27 Voltage Probe */
|
||||
- printf("Voltage Probe\n");
|
||||
+ pr_handle_name("Voltage Probe");
|
||||
if (h->length < 0x14) break;
|
||||
printf("\tDescription: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4698,7 +4697,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 27: /* 7.28 Cooling Device */
|
||||
- printf("Cooling Device\n");
|
||||
+ pr_handle_name("Cooling Device");
|
||||
if (h->length < 0x0C) break;
|
||||
if (!(opt.flags & FLAG_QUIET) && WORD(data + 0x04) != 0xFFFF)
|
||||
printf("\tTemperature Probe Handle: 0x%04X\n",
|
||||
@@ -4721,7 +4720,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 28: /* 7.29 Temperature Probe */
|
||||
- printf("Temperature Probe\n");
|
||||
+ pr_handle_name("Temperature Probe");
|
||||
if (h->length < 0x14) break;
|
||||
printf("\tDescription: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4753,7 +4752,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 29: /* 7.30 Electrical Current Probe */
|
||||
- printf("Electrical Current Probe\n");
|
||||
+ pr_handle_name("Electrical Current Probe");
|
||||
if (h->length < 0x14) break;
|
||||
printf("\tDescription: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4785,7 +4784,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 30: /* 7.31 Out-of-band Remote Access */
|
||||
- printf("Out-of-band Remote Access\n");
|
||||
+ pr_handle_name("Out-of-band Remote Access");
|
||||
if (h->length < 0x06) break;
|
||||
printf("\tManufacturer Name: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4796,7 +4795,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 31: /* 7.32 Boot Integrity Services Entry Point */
|
||||
- printf("Boot Integrity Services Entry Point\n");
|
||||
+ pr_handle_name("Boot Integrity Services Entry Point");
|
||||
if (h->length < 0x1C) break;
|
||||
printf("\tChecksum: %s\n",
|
||||
checksum(data, h->length) ? "OK" : "Invalid");
|
||||
@@ -4808,14 +4807,14 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 32: /* 7.33 System Boot Information */
|
||||
- printf("System Boot Information\n");
|
||||
+ pr_handle_name("System Boot Information");
|
||||
if (h->length < 0x0B) break;
|
||||
printf("\tStatus: %s\n",
|
||||
dmi_system_boot_status(data[0x0A]));
|
||||
break;
|
||||
|
||||
case 33: /* 7.34 64-bit Memory Error Information */
|
||||
- printf("64-bit Memory Error Information\n");
|
||||
+ pr_handle_name("64-bit Memory Error Information");
|
||||
if (h->length < 0x1F) break;
|
||||
printf("\tType: %s\n",
|
||||
dmi_memory_error_type(data[0x04]));
|
||||
@@ -4838,7 +4837,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 34: /* 7.35 Management Device */
|
||||
- printf("Management Device\n");
|
||||
+ pr_handle_name("Management Device");
|
||||
if (h->length < 0x0B) break;
|
||||
printf("\tDescription: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4851,7 +4850,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 35: /* 7.36 Management Device Component */
|
||||
- printf("Management Device Component\n");
|
||||
+ pr_handle_name("Management Device Component");
|
||||
if (h->length < 0x0B) break;
|
||||
printf("\tDescription: %s\n",
|
||||
dmi_string(h, data[0x04]));
|
||||
@@ -4868,7 +4867,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 36: /* 7.37 Management Device Threshold Data */
|
||||
- printf("Management Device Threshold Data\n");
|
||||
+ pr_handle_name("Management Device Threshold Data");
|
||||
if (h->length < 0x10) break;
|
||||
if (WORD(data + 0x04) != 0x8000)
|
||||
printf("\tLower Non-critical Threshold: %d\n",
|
||||
@@ -4891,7 +4890,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 37: /* 7.38 Memory Channel */
|
||||
- printf("Memory Channel\n");
|
||||
+ pr_handle_name("Memory Channel");
|
||||
if (h->length < 0x07) break;
|
||||
printf("\tType: %s\n",
|
||||
dmi_memory_channel_type(data[0x04]));
|
||||
@@ -4908,7 +4907,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
* We use the word "Version" instead of "Revision", conforming to
|
||||
* the IPMI specification.
|
||||
*/
|
||||
- printf("IPMI Device Information\n");
|
||||
+ pr_handle_name("IPMI Device Information");
|
||||
if (h->length < 0x10) break;
|
||||
printf("\tInterface Type: %s\n",
|
||||
dmi_ipmi_interface_type(data[0x04]));
|
||||
@@ -4946,7 +4945,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 39: /* 7.40 System Power Supply */
|
||||
- printf("System Power Supply\n");
|
||||
+ pr_handle_name("System Power Supply");
|
||||
if (h->length < 0x10) break;
|
||||
if (data[0x04] != 0x00)
|
||||
printf("\tPower Unit Group: %u\n",
|
||||
@@ -5006,7 +5005,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 41: /* 7.42 Onboard Device Extended Information */
|
||||
- printf("Onboard Device\n");
|
||||
+ pr_handle_name("Onboard Device");
|
||||
if (h->length < 0x0B) break;
|
||||
printf("\tReference Designation: %s\n", dmi_string(h, data[0x04]));
|
||||
printf("\tType: %s\n",
|
||||
@@ -5018,7 +5017,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 42: /* 7.43 Management Controller Host Interface */
|
||||
- printf("Management Controller Host Interface\n");
|
||||
+ pr_handle_name("Management Controller Host Interface");
|
||||
if (ver < 0x0302)
|
||||
{
|
||||
if (h->length < 0x05) break;
|
||||
@@ -5043,7 +5042,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 43: /* 7.44 TPM Device */
|
||||
- printf("TPM Device\n");
|
||||
+ pr_handle_name("TPM Device");
|
||||
if (h->length < 0x1B) break;
|
||||
printf("\tVendor ID:");
|
||||
dmi_tpm_vendor_id(data + 0x04);
|
||||
@@ -5080,11 +5079,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
|
||||
case 126: /* 7.44 Inactive */
|
||||
- printf("Inactive\n");
|
||||
+ pr_handle_name("Inactive");
|
||||
break;
|
||||
|
||||
case 127: /* 7.45 End Of Table */
|
||||
- printf("End Of Table\n");
|
||||
+ pr_handle_name("End Of Table");
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -5092,7 +5091,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
if (opt.flags & FLAG_QUIET)
|
||||
return;
|
||||
- printf("%s Type\n",
|
||||
+ pr_handle_name("%s Type",
|
||||
h->type >= 128 ? "OEM-specific" : "Unknown");
|
||||
dmi_dump(h, "\t");
|
||||
}
|
||||
diff --git a/dmioem.c b/dmioem.c
|
||||
index 1a9bd8264fcb..c999c08c4475 100644
|
||||
--- a/dmioem.c
|
||||
+++ b/dmioem.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "types.h"
|
||||
#include "dmidecode.h"
|
||||
#include "dmioem.h"
|
||||
+#include "dmioutput.h"
|
||||
|
||||
/*
|
||||
* Globals for vendor-specific decodes
|
||||
@@ -92,7 +93,7 @@ static int dmi_decode_acer(const struct dmi_header *h)
|
||||
* brands, including Fujitsu-Siemens, Medion, Lenovo,
|
||||
* and eMachines.
|
||||
*/
|
||||
- printf("Acer Hotkey Function\n");
|
||||
+ pr_handle_name("Acer Hotkey Function");
|
||||
if (h->length < 0x0F) break;
|
||||
cap = WORD(data + 0x04);
|
||||
printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap);
|
||||
@@ -157,7 +158,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
/*
|
||||
* Vendor Specific: HPE ProLiant System/Rack Locator
|
||||
*/
|
||||
- printf("%s ProLiant System/Rack Locator\n", company);
|
||||
+ pr_handle_name("%s ProLiant System/Rack Locator", company);
|
||||
if (h->length < 0x0B) break;
|
||||
printf("\tRack Name: %s\n", dmi_string(h, data[0x04]));
|
||||
printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05]));
|
||||
@@ -189,10 +190,9 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
*
|
||||
* Type 221: is deprecated in the latest docs
|
||||
*/
|
||||
- printf("%s %s\n", company,
|
||||
- h->type == 221 ?
|
||||
- "BIOS iSCSI NIC PCI and MAC Information" :
|
||||
- "BIOS PXE NIC PCI and MAC Information");
|
||||
+ pr_handle_name("%s %s", company, h->type == 221 ?
|
||||
+ "BIOS iSCSI NIC PCI and MAC Information" :
|
||||
+ "BIOS PXE NIC PCI and MAC Information");
|
||||
nic = 1;
|
||||
ptr = 4;
|
||||
while (h->length >= ptr + 8)
|
||||
@@ -224,7 +224,8 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
* 0x08 | MAC | 32B | MAC addr padded w/ 0s
|
||||
* 0x28 | Port No| BYTE | Each NIC maps to a Port
|
||||
*/
|
||||
- printf("%s BIOS PXE NIC PCI and MAC Information\n", company);
|
||||
+ pr_handle_name("%s BIOS PXE NIC PCI and MAC Information",
|
||||
+ company);
|
||||
if (h->length < 0x0E) break;
|
||||
/* If the record isn't long enough, we don't have an ID
|
||||
* use 0xFF to use the internal counter.
|
||||
@@ -240,7 +241,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
*
|
||||
* Source: hpwdt kernel driver
|
||||
*/
|
||||
- printf("%s 64-bit CRU Information\n", company);
|
||||
+ pr_handle_name("%s 64-bit CRU Information", company);
|
||||
if (h->length < 0x18) break;
|
||||
printf("\tSignature: 0x%08x", DWORD(data + 0x04));
|
||||
if (is_printable(data + 0x04, 4))
|
||||
@@ -265,7 +266,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
*
|
||||
* Source: hpwdt kernel driver
|
||||
*/
|
||||
- printf("%s ProLiant Information\n", company);
|
||||
+ pr_handle_name("%s ProLiant Information", company);
|
||||
if (h->length < 0x08) break;
|
||||
printf("\tPower Features: 0x%08x\n", DWORD(data + 0x04));
|
||||
if (h->length < 0x0C) break;
|
||||
@@ -318,7 +319,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
||||
|| strcmp(dmi_string(h, 1), "TVT-Enablement") != 0)
|
||||
return 0;
|
||||
|
||||
- printf("ThinkVantage Technologies\n");
|
||||
+ pr_handle_name("ThinkVantage Technologies");
|
||||
printf("\tVersion: %u\n", data[0x04]);
|
||||
printf("\tDiagnostics: %s\n",
|
||||
data[0x14] & 0x80 ? "Available" : "No");
|
||||
@@ -357,7 +358,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
||||
if (data[0x06] != 0x07 || data[0x07] != 0x03 || data[0x08] != 0x01)
|
||||
return 0;
|
||||
|
||||
- printf("ThinkPad Device Presence Detection\n");
|
||||
+ pr_handle_name("ThinkPad Device Presence Detection");
|
||||
printf("\tFingerprint Reader: %s\n",
|
||||
data[0x09] & 0x01 ? "Present" : "No");
|
||||
break;
|
||||
@@ -390,7 +391,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
||||
if (data[0x0A] != 0x0B || data[0x0B] != 0x07 || data[0x0C] != 0x01)
|
||||
return 0;
|
||||
|
||||
- printf("ThinkPad Embedded Controller Program\n");
|
||||
+ pr_handle_name("ThinkPad Embedded Controller Program");
|
||||
printf("\tVersion ID: %s\n", dmi_string(h, 1));
|
||||
printf("\tRelease Date: %s\n", dmi_string(h, 2));
|
||||
break;
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index ad3b0398c446..ca7edab5cc69 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -49,3 +49,13 @@ void pr_handle(const struct dmi_header *h)
|
||||
printf("Handle 0x%04X, DMI type %d, %d bytes\n",
|
||||
h->handle, h->type, h->length);
|
||||
}
|
||||
+
|
||||
+void pr_handle_name(const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ printf("\n");
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index 6ef60f0ee3cd..0acdce7658c9 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -24,3 +24,4 @@
|
||||
void pr_comment(const char *format, ...);
|
||||
void pr_info(const char *format, ...);
|
||||
void pr_handle(const struct dmi_header *h);
|
||||
+void pr_handle_name(const char *format, ...);
|
||||
--
|
||||
2.17.1
|
||||
|
2987
SOURCES/0014-dmidecode-Add-helper-function-pr_attr.patch
Normal file
2987
SOURCES/0014-dmidecode-Add-helper-function-pr_attr.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,727 @@
|
||||
From 5893721859b73354a935135b4aee297bd41a5b1a Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 09:57:56 +0200
|
||||
Subject: [PATCH 15/23] dmidecode: Add helper functions pr_list_start/item/end
|
||||
|
||||
Print lists through helper functions. pr_list_start() starts the
|
||||
list, with an optional value. pr_list_item() prints a single item.
|
||||
pr_list_end() is a no-op for plain text output, but is in place in
|
||||
anticipation of supporting other output formats such as HTML.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 260 +++++++++++++++++++++++++++++-----------------------
|
||||
dmioutput.c | 35 +++++++
|
||||
dmioutput.h | 3 +
|
||||
3 files changed, 184 insertions(+), 114 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 7ab058b61ef0..5a5299ed13ba 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -340,7 +340,7 @@ static void dmi_bios_rom_size(u8 code1, u16 code2)
|
||||
pr_attr("ROM Size", "%u %s", code2 & 0x3FFF, unit[code2 >> 14]);
|
||||
}
|
||||
|
||||
-static void dmi_bios_characteristics(u64 code, const char *prefix)
|
||||
+static void dmi_bios_characteristics(u64 code)
|
||||
{
|
||||
/* 7.1.1 */
|
||||
static const char *characteristics[] = {
|
||||
@@ -381,18 +381,16 @@ static void dmi_bios_characteristics(u64 code, const char *prefix)
|
||||
*/
|
||||
if (code.l & (1 << 3))
|
||||
{
|
||||
- printf("%s%s\n",
|
||||
- prefix, characteristics[0]);
|
||||
+ pr_list_item("%s", characteristics[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 4; i <= 31; i++)
|
||||
if (code.l & (1 << i))
|
||||
- printf("%s%s\n",
|
||||
- prefix, characteristics[i - 3]);
|
||||
+ pr_list_item("%s", characteristics[i - 3]);
|
||||
}
|
||||
|
||||
-static void dmi_bios_characteristics_x1(u8 code, const char *prefix)
|
||||
+static void dmi_bios_characteristics_x1(u8 code)
|
||||
{
|
||||
/* 7.1.2.1 */
|
||||
static const char *characteristics[] = {
|
||||
@@ -409,11 +407,10 @@ static void dmi_bios_characteristics_x1(u8 code, const char *prefix)
|
||||
|
||||
for (i = 0; i <= 7; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s\n",
|
||||
- prefix, characteristics[i]);
|
||||
+ pr_list_item("%s", characteristics[i]);
|
||||
}
|
||||
|
||||
-static void dmi_bios_characteristics_x2(u8 code, const char *prefix)
|
||||
+static void dmi_bios_characteristics_x2(u8 code)
|
||||
{
|
||||
/* 37.1.2.2 */
|
||||
static const char *characteristics[] = {
|
||||
@@ -427,8 +424,7 @@ static void dmi_bios_characteristics_x2(u8 code, const char *prefix)
|
||||
|
||||
for (i = 0; i <= 4; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s\n",
|
||||
- prefix, characteristics[i]);
|
||||
+ pr_list_item("%s", characteristics[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -521,7 +517,7 @@ static const char *dmi_system_wake_up_type(u8 code)
|
||||
* 7.3 Base Board Information (Type 2)
|
||||
*/
|
||||
|
||||
-static void dmi_base_board_features(u8 code, const char *prefix)
|
||||
+static void dmi_base_board_features(u8 code)
|
||||
{
|
||||
/* 7.3.1 */
|
||||
static const char *features[] = {
|
||||
@@ -533,17 +529,17 @@ static void dmi_base_board_features(u8 code, const char *prefix)
|
||||
};
|
||||
|
||||
if ((code & 0x1F) == 0)
|
||||
- printf(" None\n");
|
||||
+ pr_list_start("Features", "%s", "None");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("\n");
|
||||
+ pr_list_start("Features", NULL);
|
||||
for (i = 0; i <= 4; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s\n",
|
||||
- prefix, features[i]);
|
||||
+ pr_list_item("%s", features[i]);
|
||||
}
|
||||
+ pr_list_end();
|
||||
}
|
||||
|
||||
static const char *dmi_base_board_type(u8 code)
|
||||
@@ -570,15 +566,14 @@ static const char *dmi_base_board_type(u8 code)
|
||||
return out_of_spec;
|
||||
}
|
||||
|
||||
-static void dmi_base_board_handles(u8 count, const u8 *p, const char *prefix)
|
||||
+static void dmi_base_board_handles(u8 count, const u8 *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("%sContained Object Handles: %u\n",
|
||||
- prefix, count);
|
||||
+ pr_list_start("Contained Object Handles", "%u", count);
|
||||
for (i = 0; i < count; i++)
|
||||
- printf("%s\t0x%04X\n",
|
||||
- prefix, WORD(p + sizeof(u16) * i));
|
||||
+ pr_list_item("0x%04X", WORD(p + sizeof(u16) * i));
|
||||
+ pr_list_end();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -693,27 +688,29 @@ static void dmi_chassis_power_cords(u8 code)
|
||||
pr_attr("Number Of Power Cords", "%u", code);
|
||||
}
|
||||
|
||||
-static void dmi_chassis_elements(u8 count, u8 len, const u8 *p, const char *prefix)
|
||||
+static void dmi_chassis_elements(u8 count, u8 len, const u8 *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("%sContained Elements: %u\n",
|
||||
- prefix, count);
|
||||
+ pr_list_start("Contained Elements", "%u", count);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (len >= 0x03)
|
||||
{
|
||||
- printf("%s\t%s (",
|
||||
- prefix, p[i * len] & 0x80 ?
|
||||
+ const char *type;
|
||||
+
|
||||
+ type = (p[i * len] & 0x80) ?
|
||||
dmi_smbios_structure_type(p[i * len] & 0x7F) :
|
||||
- dmi_base_board_type(p[i * len] & 0x7F));
|
||||
+ dmi_base_board_type(p[i * len] & 0x7F);
|
||||
+
|
||||
if (p[1 + i * len] == p[2 + i * len])
|
||||
- printf("%u", p[1 + i * len]);
|
||||
+ pr_list_item("%s (%u)", type, p[1 + i * len]);
|
||||
else
|
||||
- printf("%u-%u", p[1 + i * len], p[2 + i * len]);
|
||||
- printf(")\n");
|
||||
+ pr_list_item("%s (%u-%u)", type, p[1 + i * len],
|
||||
+ p[2 + i * len]);
|
||||
}
|
||||
}
|
||||
+ pr_list_end();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1033,7 +1030,7 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver)
|
||||
}
|
||||
}
|
||||
|
||||
-static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
|
||||
+static void dmi_processor_id(const struct dmi_header *h)
|
||||
{
|
||||
/* Intel AP-485 revision 36, table 2-4 */
|
||||
static const char *flags[32] = {
|
||||
@@ -1203,18 +1200,18 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
|
||||
}
|
||||
|
||||
edx = DWORD(p + 4);
|
||||
- printf("%sFlags:", prefix);
|
||||
if ((edx & 0xBFEFFBFF) == 0)
|
||||
- printf(" None\n");
|
||||
+ pr_list_start("Flags", "None");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("\n");
|
||||
+ pr_list_start("Flags", NULL);
|
||||
for (i = 0; i <= 31; i++)
|
||||
if (flags[i] != NULL && edx & (1 << i))
|
||||
- printf("%s\t%s\n", prefix, flags[i]);
|
||||
+ pr_list_item("%s", flags[i]);
|
||||
}
|
||||
+ pr_list_end();
|
||||
}
|
||||
|
||||
static void dmi_processor_voltage(const char *attr, u8 code)
|
||||
@@ -1373,7 +1370,7 @@ static void dmi_processor_cache(const char *attr, u16 code, const char *level,
|
||||
pr_attr(attr, "0x%04X", code);
|
||||
}
|
||||
|
||||
-static void dmi_processor_characteristics(u16 code, const char *prefix)
|
||||
+static void dmi_processor_characteristics(const char *attr, u16 code)
|
||||
{
|
||||
/* 7.5.9 */
|
||||
static const char *characteristics[] = {
|
||||
@@ -1386,15 +1383,16 @@ static void dmi_processor_characteristics(u16 code, const char *prefix)
|
||||
};
|
||||
|
||||
if ((code & 0x00FC) == 0)
|
||||
- printf(" None\n");
|
||||
+ pr_attr(attr, "None");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("\n");
|
||||
+ pr_list_start(attr, NULL);
|
||||
for (i = 2; i <= 7; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s\n", prefix, characteristics[i - 2]);
|
||||
+ pr_list_item("%s", characteristics[i - 2]);
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1421,7 +1419,7 @@ static const char *dmi_memory_controller_ed_method(u8 code)
|
||||
return out_of_spec;
|
||||
}
|
||||
|
||||
-static void dmi_memory_controller_ec_capabilities(u8 code, const char *prefix)
|
||||
+static void dmi_memory_controller_ec_capabilities(const char *attr, u8 code)
|
||||
{
|
||||
/* 7.6.2 */
|
||||
static const char *capabilities[] = {
|
||||
@@ -1434,15 +1432,16 @@ static void dmi_memory_controller_ec_capabilities(u8 code, const char *prefix)
|
||||
};
|
||||
|
||||
if ((code & 0x3F) == 0)
|
||||
- printf(" None\n");
|
||||
+ pr_attr(attr, "None");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("\n");
|
||||
+ pr_list_start(attr, NULL);
|
||||
for (i = 0; i <= 5; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s\n", prefix, capabilities[i]);
|
||||
+ pr_list_item("%s", capabilities[i]);
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1464,7 +1463,7 @@ static const char *dmi_memory_controller_interleave(u8 code)
|
||||
return out_of_spec;
|
||||
}
|
||||
|
||||
-static void dmi_memory_controller_speeds(u16 code, const char *prefix)
|
||||
+static void dmi_memory_controller_speeds(const char *attr, u16 code)
|
||||
{
|
||||
/* 7.6.4 */
|
||||
const char *speeds[] = {
|
||||
@@ -1476,34 +1475,34 @@ static void dmi_memory_controller_speeds(u16 code, const char *prefix)
|
||||
};
|
||||
|
||||
if ((code & 0x001F) == 0)
|
||||
- printf(" None\n");
|
||||
+ pr_attr(attr, "None");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("\n");
|
||||
+ pr_list_start(attr, NULL);
|
||||
for (i = 0; i <= 4; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s\n", prefix, speeds[i]);
|
||||
+ pr_list_item("%s", speeds[i]);
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
-static void dmi_memory_controller_slots(u8 count, const u8 *p, const char *prefix)
|
||||
+static void dmi_memory_controller_slots(u8 count, const u8 *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("%sAssociated Memory Slots: %u\n",
|
||||
- prefix, count);
|
||||
+ pr_list_start("Associated Memory Slots", "%u", count);
|
||||
for (i = 0; i < count; i++)
|
||||
- printf("%s\t0x%04X\n",
|
||||
- prefix, WORD(p + sizeof(u16) * i));
|
||||
+ pr_list_item("0x%04X", WORD(p + sizeof(u16) * i));
|
||||
+ pr_list_end();
|
||||
}
|
||||
|
||||
/*
|
||||
* 7.7 Memory Module Information (Type 6)
|
||||
*/
|
||||
|
||||
-static void dmi_memory_module_types(u16 code, const char *sep)
|
||||
+static void dmi_memory_module_types(const char *attr, u16 code, int flat)
|
||||
{
|
||||
/* 7.7.1 */
|
||||
static const char *types[] = {
|
||||
@@ -1521,14 +1520,34 @@ static void dmi_memory_module_types(u16 code, const char *sep)
|
||||
};
|
||||
|
||||
if ((code & 0x07FF) == 0)
|
||||
- printf(" None");
|
||||
+ pr_attr(attr, "None");
|
||||
+ else if (flat)
|
||||
+ {
|
||||
+ char type_str[68];
|
||||
+ int i, off = 0;
|
||||
+
|
||||
+ for (i = 0; i <= 10; i++)
|
||||
+ {
|
||||
+ if (code & (1 << i))
|
||||
+ {
|
||||
+ /* Insert space if not the first value */
|
||||
+ off += sprintf(type_str + off,
|
||||
+ off ? " %s" :"%s",
|
||||
+ types[i]);
|
||||
+ }
|
||||
+ }
|
||||
+ if (off)
|
||||
+ pr_attr(attr, type_str);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
+ pr_list_start(attr, NULL);
|
||||
for (i = 0; i <= 10; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s", sep, types[i]);
|
||||
+ pr_list_item("%s", types[i]);
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1649,7 +1668,7 @@ static void dmi_cache_size(const char *attr, u16 code)
|
||||
(((u32)code & 0x8000LU) << 16) | (code & 0x7FFFLU));
|
||||
}
|
||||
|
||||
-static void dmi_cache_types(u16 code, const char *sep)
|
||||
+static void dmi_cache_types(const char *attr, u16 code, int flat)
|
||||
{
|
||||
/* 7.8.2 */
|
||||
static const char *types[] = {
|
||||
@@ -1663,14 +1682,34 @@ static void dmi_cache_types(u16 code, const char *sep)
|
||||
};
|
||||
|
||||
if ((code & 0x007F) == 0)
|
||||
- printf(" None");
|
||||
+ pr_attr(attr, "None");
|
||||
+ else if (flat)
|
||||
+ {
|
||||
+ char type_str[70];
|
||||
+ int i, off = 0;
|
||||
+
|
||||
+ for (i = 0; i <= 6; i++)
|
||||
+ {
|
||||
+ if (code & (1 << i))
|
||||
+ {
|
||||
+ /* Insert space if not the first value */
|
||||
+ off += sprintf(type_str + off,
|
||||
+ off ? " %s" :"%s",
|
||||
+ types[i]);
|
||||
+ }
|
||||
+ }
|
||||
+ if (off)
|
||||
+ pr_attr(attr, type_str);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
+ pr_list_start(attr, NULL);
|
||||
for (i = 0; i <= 6; i++)
|
||||
if (code & (1 << i))
|
||||
- printf("%s%s", sep, types[i]);
|
||||
+ pr_list_item("%s", types[i]);
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2053,7 +2092,7 @@ static void dmi_slot_id(u8 code1, u8 code2, u8 type)
|
||||
}
|
||||
}
|
||||
|
||||
-static void dmi_slot_characteristics(u8 code1, u8 code2, const char *prefix)
|
||||
+static void dmi_slot_characteristics(const char *attr, u8 code1, u8 code2)
|
||||
{
|
||||
/* 7.10.6 */
|
||||
static const char *characteristics1[] = {
|
||||
@@ -2074,20 +2113,21 @@ static void dmi_slot_characteristics(u8 code1, u8 code2, const char *prefix)
|
||||
};
|
||||
|
||||
if (code1 & (1 << 0))
|
||||
- printf(" Unknown\n");
|
||||
+ pr_attr(attr, "Unknown");
|
||||
else if ((code1 & 0xFE) == 0 && (code2 & 0x07) == 0)
|
||||
- printf(" None\n");
|
||||
+ pr_attr(attr, "None");
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
- printf("\n");
|
||||
+ pr_list_start(attr, NULL);
|
||||
for (i = 1; i <= 7; i++)
|
||||
if (code1 & (1 << i))
|
||||
- printf("%s%s\n", prefix, characteristics1[i - 1]);
|
||||
+ pr_list_item("%s", characteristics1[i - 1]);
|
||||
for (i = 0; i <= 3; i++)
|
||||
if (code2 & (1 << i))
|
||||
- printf("%s%s\n", prefix, characteristics2[i]);
|
||||
+ pr_list_item("%s", characteristics2[i]);
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2199,15 +2239,14 @@ static void dmi_system_configuration_options(const struct dmi_header *h)
|
||||
* 7.14 BIOS Language Information (Type 13)
|
||||
*/
|
||||
|
||||
-static void dmi_bios_languages(const struct dmi_header *h, const char *prefix)
|
||||
+static void dmi_bios_languages(const struct dmi_header *h)
|
||||
{
|
||||
u8 *p = h->data + 4;
|
||||
u8 count = p[0x00];
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= count; i++)
|
||||
- printf("%s%s\n",
|
||||
- prefix, dmi_string(h, i));
|
||||
+ pr_list_item("%s", dmi_string(h, i));
|
||||
}
|
||||
|
||||
static const char *dmi_bios_language_format(u8 code)
|
||||
@@ -2222,14 +2261,14 @@ static const char *dmi_bios_language_format(u8 code)
|
||||
* 7.15 Group Associations (Type 14)
|
||||
*/
|
||||
|
||||
-static void dmi_group_associations_items(u8 count, const u8 *p, const char *prefix)
|
||||
+static void dmi_group_associations_items(u8 count, const u8 *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
- printf("%s0x%04X (%s)\n",
|
||||
- prefix, WORD(p + 3 * i + 1),
|
||||
+ pr_list_item("0x%04X (%s)",
|
||||
+ WORD(p + 3 * i + 1),
|
||||
dmi_smbios_structure_type(p[3 * i]));
|
||||
}
|
||||
}
|
||||
@@ -3936,7 +3975,7 @@ static void dmi_tpm_vendor_id(const u8 *p)
|
||||
pr_attr("Vendor ID", "%s", vendor_id);
|
||||
}
|
||||
|
||||
-static void dmi_tpm_characteristics(u64 code, const char *prefix)
|
||||
+static void dmi_tpm_characteristics(u64 code)
|
||||
{
|
||||
/* 7.1.1 */
|
||||
static const char *characteristics[] = {
|
||||
@@ -3952,15 +3991,13 @@ static void dmi_tpm_characteristics(u64 code, const char *prefix)
|
||||
*/
|
||||
if (code.l & (1 << 2))
|
||||
{
|
||||
- printf("%s%s\n",
|
||||
- prefix, characteristics[0]);
|
||||
+ pr_list_item("%s", characteristics[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 3; i <= 5; i++)
|
||||
if (code.l & (1 << i))
|
||||
- printf("%s%s\n",
|
||||
- prefix, characteristics[i - 2]);
|
||||
+ pr_list_item("%s", characteristics[i - 2]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3997,12 +4034,13 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
dmi_bios_runtime_size((0x10000 - WORD(data + 0x06)) << 4);
|
||||
}
|
||||
dmi_bios_rom_size(data[0x09], h->length < 0x1A ? 16 : WORD(data + 0x18));
|
||||
- printf("\tCharacteristics:\n");
|
||||
- dmi_bios_characteristics(QWORD(data + 0x0A), "\t\t");
|
||||
+ pr_list_start("Characteristics", NULL);
|
||||
+ dmi_bios_characteristics(QWORD(data + 0x0A));
|
||||
+ pr_list_end();
|
||||
if (h->length < 0x13) break;
|
||||
- dmi_bios_characteristics_x1(data[0x12], "\t\t");
|
||||
+ dmi_bios_characteristics_x1(data[0x12]);
|
||||
if (h->length < 0x14) break;
|
||||
- dmi_bios_characteristics_x2(data[0x13], "\t\t");
|
||||
+ dmi_bios_characteristics_x2(data[0x13]);
|
||||
if (h->length < 0x18) break;
|
||||
if (data[0x14] != 0xFF && data[0x15] != 0xFF)
|
||||
pr_attr("BIOS Revision", "%u.%u",
|
||||
@@ -4049,8 +4087,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
pr_attr("Asset Tag", "%s",
|
||||
dmi_string(h, data[0x08]));
|
||||
if (h->length < 0x0A) break;
|
||||
- printf("\tFeatures:");
|
||||
- dmi_base_board_features(data[0x09], "\t\t");
|
||||
+ dmi_base_board_features(data[0x09]);
|
||||
if (h->length < 0x0E) break;
|
||||
pr_attr("Location In Chassis", "%s",
|
||||
dmi_string(h, data[0x0A]));
|
||||
@@ -4062,7 +4099,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
if (h->length < 0x0F) break;
|
||||
if (h->length < 0x0F + data[0x0E] * sizeof(u16)) break;
|
||||
if (!(opt.flags & FLAG_QUIET))
|
||||
- dmi_base_board_handles(data[0x0E], data + 0x0F, "\t");
|
||||
+ dmi_base_board_handles(data[0x0E], data + 0x0F);
|
||||
break;
|
||||
|
||||
case 3: /* 7.4 Chassis Information */
|
||||
@@ -4097,7 +4134,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
dmi_chassis_power_cords(data[0x12]);
|
||||
if (h->length < 0x15) break;
|
||||
if (h->length < 0x15 + data[0x13] * data[0x14]) break;
|
||||
- dmi_chassis_elements(data[0x13], data[0x14], data + 0x15, "\t");
|
||||
+ dmi_chassis_elements(data[0x13], data[0x14], data + 0x15);
|
||||
if (h->length < 0x16 + data[0x13] * data[0x14]) break;
|
||||
pr_attr("SKU Number", "%s",
|
||||
dmi_string(h, data[0x15 + data[0x13] * data[0x14]]));
|
||||
@@ -4114,7 +4151,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
dmi_processor_family(h, ver));
|
||||
pr_attr("Manufacturer", "%s",
|
||||
dmi_string(h, data[0x07]));
|
||||
- dmi_processor_id(h, "\t");
|
||||
+ dmi_processor_id(h);
|
||||
pr_attr("Version", "%s",
|
||||
dmi_string(h, data[0x10]));
|
||||
dmi_processor_voltage("Voltage", data[0x11]);
|
||||
@@ -4158,8 +4195,8 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
pr_attr("Thread Count", "%u",
|
||||
h->length >= 0x30 && data[0x25] == 0xFF ?
|
||||
WORD(data + 0x2E) : data[0x25]);
|
||||
- printf("\tCharacteristics:");
|
||||
- dmi_processor_characteristics(WORD(data + 0x26), "\t\t");
|
||||
+ dmi_processor_characteristics("Characteristics",
|
||||
+ WORD(data + 0x26));
|
||||
break;
|
||||
|
||||
case 5: /* 7.6 Memory Controller Information */
|
||||
@@ -4167,8 +4204,8 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
if (h->length < 0x0F) break;
|
||||
pr_attr("Error Detecting Method", "%s",
|
||||
dmi_memory_controller_ed_method(data[0x04]));
|
||||
- printf("\tError Correcting Capabilities:");
|
||||
- dmi_memory_controller_ec_capabilities(data[0x05], "\t\t");
|
||||
+ dmi_memory_controller_ec_capabilities("Error Correcting Capabilities",
|
||||
+ data[0x05]);
|
||||
pr_attr("Supported Interleave", "%s",
|
||||
dmi_memory_controller_interleave(data[0x06]));
|
||||
pr_attr("Current Interleave", "%s",
|
||||
@@ -4177,17 +4214,16 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
1 << data[0x08]);
|
||||
pr_attr("Maximum Total Memory Size", "%u MB",
|
||||
data[0x0E] * (1 << data[0x08]));
|
||||
- printf("\tSupported Speeds:");
|
||||
- dmi_memory_controller_speeds(WORD(data + 0x09), "\t\t");
|
||||
- printf("\tSupported Memory Types:");
|
||||
- dmi_memory_module_types(WORD(data + 0x0B), "\n\t\t");
|
||||
- printf("\n");
|
||||
+ dmi_memory_controller_speeds("Supported Speeds",
|
||||
+ WORD(data + 0x09));
|
||||
+ dmi_memory_module_types("Supported Memory Types",
|
||||
+ WORD(data + 0x0B), 0);
|
||||
dmi_processor_voltage("Memory Module Voltage", data[0x0D]);
|
||||
if (h->length < 0x0F + data[0x0E] * sizeof(u16)) break;
|
||||
- dmi_memory_controller_slots(data[0x0E], data + 0x0F, "\t");
|
||||
+ dmi_memory_controller_slots(data[0x0E], data + 0x0F);
|
||||
if (h->length < 0x10 + data[0x0E] * sizeof(u16)) break;
|
||||
- printf("\tEnabled Error Correcting Capabilities:");
|
||||
- dmi_memory_controller_ec_capabilities(data[0x0F + data[0x0E] * sizeof(u16)], "\t\t");
|
||||
+ dmi_memory_controller_ec_capabilities("Enabled Error Correcting Capabilities",
|
||||
+ data[0x0F + data[0x0E] * sizeof(u16)]);
|
||||
break;
|
||||
|
||||
case 6: /* 7.7 Memory Module Information */
|
||||
@@ -4197,9 +4233,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
dmi_string(h, data[0x04]));
|
||||
dmi_memory_module_connections(data[0x05]);
|
||||
dmi_memory_module_speed("Current Speed", data[0x06]);
|
||||
- printf("\tType:");
|
||||
- dmi_memory_module_types(WORD(data + 0x07), " ");
|
||||
- printf("\n");
|
||||
+ dmi_memory_module_types("Type", WORD(data + 0x07), 1);
|
||||
dmi_memory_module_size("Installed Size", data[0x09]);
|
||||
dmi_memory_module_size("Enabled Size", data[0x0A]);
|
||||
dmi_memory_module_error(data[0x0B]);
|
||||
@@ -4226,12 +4260,8 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
dmi_cache_size_2("Maximum Size", DWORD(data + 0x13));
|
||||
else
|
||||
dmi_cache_size("Maximum Size", WORD(data + 0x07));
|
||||
- printf("\tSupported SRAM Types:");
|
||||
- dmi_cache_types(WORD(data + 0x0B), "\n\t\t");
|
||||
- printf("\n");
|
||||
- printf("\tInstalled SRAM Type:");
|
||||
- dmi_cache_types(WORD(data + 0x0D), " ");
|
||||
- printf("\n");
|
||||
+ dmi_cache_types("Supported SRAM Types", WORD(data + 0x0B), 0);
|
||||
+ dmi_cache_types("Installed SRAM Type", WORD(data + 0x0D), 1);
|
||||
if (h->length < 0x13) break;
|
||||
dmi_memory_module_speed("Speed", data[0x0F]);
|
||||
pr_attr("Error Correction Type", "%s",
|
||||
@@ -4270,11 +4300,10 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
pr_attr("Length", "%s",
|
||||
dmi_slot_length(data[0x08]));
|
||||
dmi_slot_id(data[0x09], data[0x0A], data[0x05]);
|
||||
- printf("\tCharacteristics:");
|
||||
if (h->length < 0x0D)
|
||||
- dmi_slot_characteristics(data[0x0B], 0x00, "\t\t");
|
||||
+ dmi_slot_characteristics("Characteristics", data[0x0B], 0x00);
|
||||
else
|
||||
- dmi_slot_characteristics(data[0x0B], data[0x0C], "\t\t");
|
||||
+ dmi_slot_characteristics("Characteristics", data[0x0B], data[0x0C]);
|
||||
if (h->length < 0x11) break;
|
||||
dmi_slot_segment_bus_func(WORD(data + 0x0D), data[0x0F], data[0x10]);
|
||||
if (h->length < 0x13) break;
|
||||
@@ -4308,8 +4337,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
pr_attr("Language Description Format", "%s",
|
||||
dmi_bios_language_format(data[0x05]));
|
||||
}
|
||||
- printf("\tInstallable Languages: %u\n", data[0x04]);
|
||||
- dmi_bios_languages(h, "\t\t");
|
||||
+ pr_list_start("Installable Languages", "%u", data[0x04]);
|
||||
+ dmi_bios_languages(h);
|
||||
+ pr_list_end();
|
||||
pr_attr("Currently Installed Language", "%s",
|
||||
dmi_string(h, data[0x15]));
|
||||
break;
|
||||
@@ -4319,9 +4349,10 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
if (h->length < 0x05) break;
|
||||
pr_attr("Name", "%s",
|
||||
dmi_string(h, data[0x04]));
|
||||
- printf("\tItems: %u\n",
|
||||
+ pr_list_start("Items", "%u",
|
||||
(h->length - 0x05) / 3);
|
||||
- dmi_group_associations_items((h->length - 0x05) / 3, data + 0x05, "\t\t");
|
||||
+ dmi_group_associations_items((h->length - 0x05) / 3, data + 0x05);
|
||||
+ pr_list_end();
|
||||
break;
|
||||
|
||||
case 15: /* 7.16 System Event Log */
|
||||
@@ -5002,8 +5033,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
break;
|
||||
}
|
||||
pr_attr("Description", "%s", dmi_string(h, data[0x12]));
|
||||
- printf("\tCharacteristics:\n");
|
||||
- dmi_tpm_characteristics(QWORD(data + 0x13), "\t\t");
|
||||
+ pr_list_start("Characteristics", NULL);
|
||||
+ dmi_tpm_characteristics(QWORD(data + 0x13));
|
||||
+ pr_list_end();
|
||||
if (h->length < 0x1F) break;
|
||||
pr_attr("OEM-specific Information", "0x%08X",
|
||||
DWORD(data + 0x1B));
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index 2330b65755c9..4c8a32a3569a 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -71,3 +71,38 @@ void pr_attr(const char *name, const char *format, ...)
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
+
|
||||
+void pr_list_start(const char *name, const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ printf("\t%s:", name);
|
||||
+
|
||||
+ /* format is optional, skip value if not provided */
|
||||
+ if (format)
|
||||
+ {
|
||||
+ printf(" ");
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ }
|
||||
+ printf("\n");
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void pr_list_item(const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ printf("\t\t");
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ printf("\n");
|
||||
+}
|
||||
+
|
||||
+void pr_list_end(void)
|
||||
+{
|
||||
+ /* a no-op for text output */
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index 981dcb45f26a..33f09c4452bb 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -26,3 +26,6 @@ void pr_info(const char *format, ...);
|
||||
void pr_handle(const struct dmi_header *h);
|
||||
void pr_handle_name(const char *format, ...);
|
||||
void pr_attr(const char *name, const char *format, ...);
|
||||
+void pr_list_start(const char *name, const char *format, ...);
|
||||
+void pr_list_item(const char *format, ...);
|
||||
+void pr_list_end(void);
|
||||
--
|
||||
2.17.1
|
||||
|
307
SOURCES/0016-dmidecode-Add-helper-function-pr_subattr.patch
Normal file
307
SOURCES/0016-dmidecode-Add-helper-function-pr_subattr.patch
Normal file
@ -0,0 +1,307 @@
|
||||
From 20d50c70b98d2a7013b604d575656a098d294f7f Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 10:00:27 +0200
|
||||
Subject: [PATCH 16/23] dmidecode: Add helper function pr_subattr
|
||||
|
||||
Print all second-level attributes through a helper function pr_subattr.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 68 ++++++++++++++++++++++++++++-------------------------
|
||||
dmioem.c | 12 +++++-----
|
||||
dmioutput.c | 12 ++++++++++
|
||||
dmioutput.h | 1 +
|
||||
4 files changed, 55 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 5a5299ed13ba..3d1da955bab8 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -431,7 +431,8 @@ static void dmi_bios_characteristics_x2(u8 code)
|
||||
* 7.2 System Information (Type 1)
|
||||
*/
|
||||
|
||||
-static void dmi_system_uuid(const char *attr, const u8 *p, u16 ver)
|
||||
+static void dmi_system_uuid(void (*print_cb)(const char *name, const char *format, ...),
|
||||
+ const char *attr, const u8 *p, u16 ver)
|
||||
{
|
||||
int only0xFF = 1, only0x00 = 1;
|
||||
int i;
|
||||
@@ -444,16 +445,16 @@ static void dmi_system_uuid(const char *attr, const u8 *p, u16 ver)
|
||||
|
||||
if (only0xFF)
|
||||
{
|
||||
- if (attr)
|
||||
- pr_attr(attr, "Not Present");
|
||||
+ if (print_cb)
|
||||
+ print_cb(attr, "Not Present");
|
||||
else
|
||||
printf("Not Present\n");
|
||||
return;
|
||||
}
|
||||
if (only0x00)
|
||||
{
|
||||
- if (attr)
|
||||
- pr_attr(attr, "Not Settable");
|
||||
+ if (print_cb)
|
||||
+ print_cb(attr, "Not Settable");
|
||||
else
|
||||
printf("Not Settable\n");
|
||||
return;
|
||||
@@ -469,8 +470,8 @@ static void dmi_system_uuid(const char *attr, const u8 *p, u16 ver)
|
||||
*/
|
||||
if (ver >= 0x0206)
|
||||
{
|
||||
- if (attr)
|
||||
- pr_attr(attr,
|
||||
+ if (print_cb)
|
||||
+ print_cb(attr,
|
||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
|
||||
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
|
||||
@@ -481,8 +482,8 @@ static void dmi_system_uuid(const char *attr, const u8 *p, u16 ver)
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (attr)
|
||||
- pr_attr(attr,
|
||||
+ if (print_cb)
|
||||
+ print_cb(attr,
|
||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
|
||||
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
|
||||
@@ -3655,7 +3656,7 @@ static const char *dmi_address_decode(u8 *data, char *storage, u8 addrtype)
|
||||
/*
|
||||
* DSP0270: 8.5: Parse the protocol record format
|
||||
*/
|
||||
-static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
+static void dmi_parse_protocol_record(u8 *rec)
|
||||
{
|
||||
u8 rid;
|
||||
u8 rlen;
|
||||
@@ -3666,6 +3667,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
u8 hlen;
|
||||
const char *addrstr;
|
||||
const char *hname;
|
||||
+ char attr[38];
|
||||
|
||||
/* DSP0270: 8.5: Protocol Identifier */
|
||||
rid = rec[0x0];
|
||||
@@ -3674,7 +3676,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
/* DSP0270: 8.5: Protocol Record Data */
|
||||
rdata = &rec[0x2];
|
||||
|
||||
- printf("%sProtocol ID: %02x (%s)\n", prefix, rid,
|
||||
+ pr_attr("Protocol ID", "%02x (%s)", rid,
|
||||
dmi_protocol_record_type(rid));
|
||||
|
||||
/*
|
||||
@@ -3704,8 +3706,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
* endianess of the field is always little after version 2.6.0
|
||||
* we can just pick a sufficiently recent version here.
|
||||
*/
|
||||
- printf("%s\tService UUID: ", prefix);
|
||||
- dmi_system_uuid(NULL, &rdata[0], 0x311); /* FIXME */
|
||||
+ dmi_system_uuid(pr_subattr, "Service UUID", &rdata[0], 0x311);
|
||||
|
||||
/*
|
||||
* DSP0270: 8.6: Redfish Over IP Host IP Assignment Type
|
||||
@@ -3713,13 +3714,13 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
* uses decimal, so as to make it more comparable
|
||||
*/
|
||||
assign_val = rdata[16];
|
||||
- printf("%s\tHost IP Assignment Type: %s\n", prefix,
|
||||
+ pr_subattr("Host IP Assignment Type", "%s",
|
||||
dmi_protocol_assignment_type(assign_val));
|
||||
|
||||
/* DSP0270: 8.6: Redfish Over IP Host Address format */
|
||||
addrtype = rdata[17];
|
||||
addrstr = dmi_address_type(addrtype);
|
||||
- printf("%s\tHost IP Address Format: %s\n", prefix,
|
||||
+ pr_subattr("Host IP Address Format", "%s",
|
||||
addrstr);
|
||||
|
||||
/* DSP0270: 8.6 IP Assignment types */
|
||||
@@ -3727,24 +3728,26 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
if (assign_val == 0x1 || assign_val == 0x3)
|
||||
{
|
||||
/* DSP0270: 8.6: the Host IPv[4|6] Address */
|
||||
- printf("%s\t%s Address: %s\n", prefix, addrstr,
|
||||
+ sprintf(attr, "%s Address", addrstr);
|
||||
+ pr_subattr(attr, "%s",
|
||||
dmi_address_decode(&rdata[18], buf, addrtype));
|
||||
|
||||
/* DSP0270: 8.6: Prints the Host IPv[4|6] Mask */
|
||||
- printf("%s\t%s Mask: %s\n", prefix, addrstr,
|
||||
+ sprintf(attr, "%s Mask", addrstr);
|
||||
+ pr_subattr(attr, "%s",
|
||||
dmi_address_decode(&rdata[34], buf, addrtype));
|
||||
}
|
||||
|
||||
/* DSP0270: 8.6: Get the Redfish Service IP Discovery Type */
|
||||
assign_val = rdata[50];
|
||||
/* Redfish Service IP Discovery type mirrors Host IP Assignment type */
|
||||
- printf("%s\tRedfish Service IP Discovery Type: %s\n", prefix,
|
||||
+ pr_subattr("Redfish Service IP Discovery Type", "%s",
|
||||
dmi_protocol_assignment_type(assign_val));
|
||||
|
||||
/* DSP0270: 8.6: Get the Redfish Service IP Address Format */
|
||||
addrtype = rdata[51];
|
||||
addrstr = dmi_address_type(addrtype);
|
||||
- printf("%s\tRedfish Service IP Address Format: %s\n", prefix,
|
||||
+ pr_subattr("Redfish Service IP Address Format", "%s",
|
||||
addrstr);
|
||||
|
||||
if (assign_val == 0x1 || assign_val == 0x3)
|
||||
@@ -3753,20 +3756,22 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
u32 vlan;
|
||||
|
||||
/* DSP0270: 8.6: Prints the Redfish IPv[4|6] Service Address */
|
||||
- printf("%s\t%s Redfish Service Address: %s\n", prefix,
|
||||
- addrstr, dmi_address_decode(&rdata[52], buf,
|
||||
+ sprintf(attr, "%s Redfish Service Address", addrstr);
|
||||
+ pr_subattr(attr, "%s",
|
||||
+ dmi_address_decode(&rdata[52], buf,
|
||||
addrtype));
|
||||
|
||||
/* DSP0270: 8.6: Prints the Redfish IPv[4|6] Service Mask */
|
||||
- printf("%s\t%s Redfish Service Mask: %s\n", prefix,
|
||||
- addrstr, dmi_address_decode(&rdata[68], buf,
|
||||
+ sprintf(attr, "%s Redfish Service Mask", addrstr);
|
||||
+ pr_subattr(attr, "%s",
|
||||
+ dmi_address_decode(&rdata[68], buf,
|
||||
addrtype));
|
||||
|
||||
/* DSP0270: 8.6: Redfish vlan and port info */
|
||||
port = WORD(&rdata[84]);
|
||||
vlan = DWORD(&rdata[86]);
|
||||
- printf("%s\tRedfish Service Port: %hu\n", prefix, port);
|
||||
- printf("%s\tRedfish Service Vlan: %u\n", prefix, vlan);
|
||||
+ pr_subattr("Redfish Service Port", "%hu", port);
|
||||
+ pr_subattr("Redfish Service Vlan", "%u", vlan);
|
||||
}
|
||||
|
||||
/* DSP0270: 8.6: Redfish host length and name */
|
||||
@@ -3783,7 +3788,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
|
||||
hname = out_of_spec;
|
||||
hlen = strlen(out_of_spec);
|
||||
}
|
||||
- printf("%s\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname);
|
||||
+ pr_subattr("Redfish Service Hostname", "%.*s", hlen, hname);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3803,8 +3808,7 @@ static const char *dmi_parse_device_type(u8 type)
|
||||
return out_of_spec;
|
||||
}
|
||||
|
||||
-static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
- const char *prefix)
|
||||
+static void dmi_parse_controller_structure(const struct dmi_header *h)
|
||||
{
|
||||
int i;
|
||||
u8 *data = h->data;
|
||||
@@ -3936,7 +3940,7 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
|
||||
return;
|
||||
}
|
||||
|
||||
- dmi_parse_protocol_record(prefix, rec);
|
||||
+ dmi_parse_protocol_record(rec);
|
||||
|
||||
/*
|
||||
* DSP0270: 8.6
|
||||
@@ -4062,7 +4066,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
pr_attr("Serial Number", "%s",
|
||||
dmi_string(h, data[0x07]));
|
||||
if (h->length < 0x19) break;
|
||||
- dmi_system_uuid("UUID", data + 0x08, ver);
|
||||
+ dmi_system_uuid(pr_attr, "UUID", data + 0x08, ver);
|
||||
pr_attr("Wake-up Type", "%s",
|
||||
dmi_system_wake_up_type(data[0x18]));
|
||||
if (h->length < 0x1B) break;
|
||||
@@ -5002,7 +5006,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
}
|
||||
}
|
||||
else
|
||||
- dmi_parse_controller_structure(h, "\t");
|
||||
+ dmi_parse_controller_structure(h);
|
||||
break;
|
||||
|
||||
case 43: /* 7.44 TPM Device */
|
||||
@@ -5104,7 +5108,7 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
|
||||
printf("%u.%u\n", data[key - 1], data[key]);
|
||||
break;
|
||||
case 0x108:
|
||||
- dmi_system_uuid(NULL, data + offset, ver);
|
||||
+ dmi_system_uuid(NULL, NULL, data + offset, ver);
|
||||
break;
|
||||
case 0x305:
|
||||
printf("%s\n", dmi_chassis_type(data[offset]));
|
||||
diff --git a/dmioem.c b/dmioem.c
|
||||
index 873ec1068c16..9d6ec7520287 100644
|
||||
--- a/dmioem.c
|
||||
+++ b/dmioem.c
|
||||
@@ -97,10 +97,10 @@ static int dmi_decode_acer(const struct dmi_header *h)
|
||||
if (h->length < 0x0F) break;
|
||||
cap = WORD(data + 0x04);
|
||||
pr_attr("Function bitmap for Communication Button", "0x%04hx", cap);
|
||||
- printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No");
|
||||
- printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No");
|
||||
- printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No");
|
||||
- printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : "No");
|
||||
+ pr_subattr("WiFi", "%s", cap & 0x0001 ? "Yes" : "No");
|
||||
+ pr_subattr("3G", "%s", cap & 0x0040 ? "Yes" : "No");
|
||||
+ pr_subattr("WiMAX", "%s", cap & 0x0080 ? "Yes" : "No");
|
||||
+ pr_subattr("Bluetooth", "%s", cap & 0x0800 ? "Yes" : "No");
|
||||
pr_attr("Function bitmap for Application Button", "0x%04hx", WORD(data + 0x06));
|
||||
pr_attr("Function bitmap for Media Button", "0x%04hx", WORD(data + 0x08));
|
||||
pr_attr("Function bitmap for Display Button", "0x%04hx", WORD(data + 0x0A));
|
||||
@@ -278,8 +278,8 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
if (h->length < 0x14) break;
|
||||
feat = DWORD(data + 0x10);
|
||||
pr_attr("Misc. Features", "0x%08x", feat);
|
||||
- printf("\t\tiCRU: %s\n", feat & 0x0001 ? "Yes" : "No");
|
||||
- printf("\t\tUEFI: %s\n", feat & 0x1400 ? "Yes" : "No");
|
||||
+ pr_subattr("iCRU", "%s", feat & 0x0001 ? "Yes" : "No");
|
||||
+ pr_subattr("UEFI", "%s", feat & 0x1400 ? "Yes" : "No");
|
||||
break;
|
||||
|
||||
default:
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index 4c8a32a3569a..da04450494f7 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -72,6 +72,18 @@ void pr_attr(const char *name, const char *format, ...)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
+void pr_subattr(const char *name, const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ printf("\t\t%s: ", name);
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ printf("\n");
|
||||
+}
|
||||
+
|
||||
void pr_list_start(const char *name, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index 33f09c4452bb..58ca5a854a79 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -26,6 +26,7 @@ void pr_info(const char *format, ...);
|
||||
void pr_handle(const struct dmi_header *h);
|
||||
void pr_handle_name(const char *format, ...);
|
||||
void pr_attr(const char *name, const char *format, ...);
|
||||
+void pr_subattr(const char *name, const char *format, ...);
|
||||
void pr_list_start(const char *name, const char *format, ...);
|
||||
void pr_list_item(const char *format, ...);
|
||||
void pr_list_end(void);
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,95 @@
|
||||
From da06888d08b9f1108fe89560c06d39675c10cd95 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 10:00:30 +0200
|
||||
Subject: [PATCH 17/23] dmidecode: Use the print helpers in dump mode too
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 30 ++++++++++++++++++------------
|
||||
1 file changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 3d1da955bab8..5e9b9899ec1f 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -220,43 +220,49 @@ static int dmi_bcd_range(u8 value, u8 low, u8 high)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static void dmi_dump(const struct dmi_header *h, const char *prefix)
|
||||
+static void dmi_dump(const struct dmi_header *h)
|
||||
{
|
||||
+ static char raw_data[48];
|
||||
int row, i;
|
||||
+ unsigned int off;
|
||||
char *s;
|
||||
|
||||
- printf("%sHeader and Data:\n", prefix);
|
||||
+ pr_list_start("Header and Data", NULL);
|
||||
for (row = 0; row < ((h->length - 1) >> 4) + 1; row++)
|
||||
{
|
||||
- printf("%s\t", prefix);
|
||||
+ off = 0;
|
||||
for (i = 0; i < 16 && i < h->length - (row << 4); i++)
|
||||
- printf("%s%02X", i ? " " : "",
|
||||
+ off += sprintf(raw_data + off, i ? " %02X" : "%02X",
|
||||
(h->data)[(row << 4) + i]);
|
||||
- printf("\n");
|
||||
+ pr_list_item(raw_data);
|
||||
}
|
||||
+ pr_list_end();
|
||||
|
||||
if ((h->data)[h->length] || (h->data)[h->length + 1])
|
||||
{
|
||||
- printf("%sStrings:\n", prefix);
|
||||
+ pr_list_start("Strings", NULL);
|
||||
i = 1;
|
||||
while ((s = _dmi_string(h, i++, !(opt.flags & FLAG_DUMP))))
|
||||
{
|
||||
if (opt.flags & FLAG_DUMP)
|
||||
{
|
||||
int j, l = strlen(s) + 1;
|
||||
+
|
||||
+ off = 0;
|
||||
for (row = 0; row < ((l - 1) >> 4) + 1; row++)
|
||||
{
|
||||
- printf("%s\t", prefix);
|
||||
for (j = 0; j < 16 && j < l - (row << 4); j++)
|
||||
- printf("%s%02X", j ? " " : "",
|
||||
+ off += sprintf(raw_data + off,
|
||||
+ j ? " %02X" : "%02X",
|
||||
(unsigned char)s[(row << 4) + j]);
|
||||
- printf("\n");
|
||||
+ pr_list_item(raw_data);
|
||||
}
|
||||
/* String isn't filtered yet so do it now */
|
||||
ascii_filter(s, l - 1);
|
||||
}
|
||||
- printf("%s\t%s\n", prefix, s);
|
||||
+ pr_list_item("%s", s);
|
||||
}
|
||||
+ pr_list_end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5060,7 +5066,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
return;
|
||||
pr_handle_name("%s Type",
|
||||
h->type >= 128 ? "OEM-specific" : "Unknown");
|
||||
- dmi_dump(h, "\t");
|
||||
+ dmi_dump(h);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
@@ -5206,7 +5212,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
|
||||
{
|
||||
if (opt.flags & FLAG_DUMP)
|
||||
{
|
||||
- dmi_dump(&h, "\t");
|
||||
+ dmi_dump(&h);
|
||||
printf("\n");
|
||||
}
|
||||
else
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,80 @@
|
||||
From 9c7db76f373a1d25e52177b81e97bb9e0f9c32b5 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 10:00:33 +0200
|
||||
Subject: [PATCH 18/23] dmidecode: Add helper function for separators
|
||||
|
||||
A simple helper function to print a blank line between records.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 9 +++++----
|
||||
dmioutput.c | 5 +++++
|
||||
dmioutput.h | 1 +
|
||||
3 files changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 5e9b9899ec1f..3551637e7b16 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -5068,7 +5068,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
||||
h->type >= 128 ? "OEM-specific" : "Unknown");
|
||||
dmi_dump(h);
|
||||
}
|
||||
- printf("\n");
|
||||
+ pr_sep();
|
||||
}
|
||||
|
||||
static void to_dmi_header(struct dmi_header *h, u8 *data)
|
||||
@@ -5195,7 +5195,8 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
|
||||
if ((unsigned long)(next - buf) > len)
|
||||
{
|
||||
if (display && !(opt.flags & FLAG_QUIET))
|
||||
- printf("\t<TRUNCATED>\n\n");
|
||||
+ printf("\t<TRUNCATED>\n");
|
||||
+ pr_sep();
|
||||
data = next;
|
||||
break;
|
||||
}
|
||||
@@ -5213,7 +5214,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
|
||||
if (opt.flags & FLAG_DUMP)
|
||||
{
|
||||
dmi_dump(&h);
|
||||
- printf("\n");
|
||||
+ pr_sep();
|
||||
}
|
||||
else
|
||||
dmi_decode(&h, ver);
|
||||
@@ -5271,7 +5272,7 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
|
||||
pr_info("Table at 0x%08llX.",
|
||||
(unsigned long long)base);
|
||||
}
|
||||
- printf("\n");
|
||||
+ pr_sep();
|
||||
}
|
||||
|
||||
if ((flags & FLAG_NO_FILE_OFFSET) || (opt.flags & FLAG_FROM_DUMP))
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index da04450494f7..ef1c41b2f94e 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -118,3 +118,8 @@ void pr_list_end(void)
|
||||
{
|
||||
/* a no-op for text output */
|
||||
}
|
||||
+
|
||||
+void pr_sep(void)
|
||||
+{
|
||||
+ printf("\n");
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index 58ca5a854a79..6b5f0e0e92c5 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -30,3 +30,4 @@ void pr_subattr(const char *name, const char *format, ...);
|
||||
void pr_list_start(const char *name, const char *format, ...);
|
||||
void pr_list_item(const char *format, ...);
|
||||
void pr_list_end(void);
|
||||
+void pr_sep(void);
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 25e63d7757f77a15704175c00193753be4176797 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 10:00:36 +0200
|
||||
Subject: [PATCH 19/23] dmidecode: Add helper function for structure errors
|
||||
|
||||
Add a helper function to print structure errors, specifically for
|
||||
structures which do not fit in the table.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
dmidecode.c | 2 +-
|
||||
dmioutput.c | 12 ++++++++++++
|
||||
dmioutput.h | 1 +
|
||||
3 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 3551637e7b16..59f4fe09e642 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -5195,7 +5195,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
|
||||
if ((unsigned long)(next - buf) > len)
|
||||
{
|
||||
if (display && !(opt.flags & FLAG_QUIET))
|
||||
- printf("\t<TRUNCATED>\n");
|
||||
+ pr_struct_err("<TRUNCATED>");
|
||||
pr_sep();
|
||||
data = next;
|
||||
break;
|
||||
diff --git a/dmioutput.c b/dmioutput.c
|
||||
index ef1c41b2f94e..42f8d3218c43 100644
|
||||
--- a/dmioutput.c
|
||||
+++ b/dmioutput.c
|
||||
@@ -123,3 +123,15 @@ void pr_sep(void)
|
||||
{
|
||||
printf("\n");
|
||||
}
|
||||
+
|
||||
+void pr_struct_err(const char *format, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ printf("\t");
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ vprintf(format, args);
|
||||
+ va_end(args);
|
||||
+ printf("\n");
|
||||
+}
|
||||
diff --git a/dmioutput.h b/dmioutput.h
|
||||
index 6b5f0e0e92c5..a492ec0eb4e7 100644
|
||||
--- a/dmioutput.h
|
||||
+++ b/dmioutput.h
|
||||
@@ -31,3 +31,4 @@ void pr_list_start(const char *name, const char *format, ...);
|
||||
void pr_list_item(const char *format, ...);
|
||||
void pr_list_end(void);
|
||||
void pr_sep(void);
|
||||
+void pr_struct_err(const char *format, ...);
|
||||
--
|
||||
2.17.1
|
||||
|
34
SOURCES/0020-dmidecode-White-space-fixes.patch
Normal file
34
SOURCES/0020-dmidecode-White-space-fixes.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From e0d05fdeb0cd9b6be47fb7e9c11ae6b5794f3df3 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 10:02:04 +0200
|
||||
Subject: [PATCH 20/23] dmidecode: White space fixes
|
||||
|
||||
---
|
||||
dmidecode.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index 59f4fe09e642..d0dc98467bdc 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -3312,7 +3312,7 @@ static void dmi_fixup_type_34(struct dmi_header *h, int display)
|
||||
{
|
||||
u8 *p = h->data;
|
||||
|
||||
- /* Make sure the hidden data is ASCII only */
|
||||
+ /* Make sure the hidden data is ASCII only */
|
||||
if (h->length == 0x10
|
||||
&& is_printable(p + 0x0B, 0x10 - 0x0B))
|
||||
{
|
||||
@@ -3603,7 +3603,7 @@ static const char *dmi_protocol_record_type(u8 type)
|
||||
"Reserved",
|
||||
"IPMI",
|
||||
"MCTP",
|
||||
- "Redfish over IP", /* 0x4 */
|
||||
+ "Redfish over IP", /* 0x4 */
|
||||
};
|
||||
|
||||
if (type <= 0x4)
|
||||
--
|
||||
2.17.1
|
||||
|
67
SOURCES/0021-dmidecode-Update-copyright-year.patch
Normal file
67
SOURCES/0021-dmidecode-Update-copyright-year.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From fd4a87bffcf55db6c9c9d460b1b0b5e6fe9a0f03 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Wed, 1 Apr 2020 10:04:27 +0200
|
||||
Subject: [PATCH 21/23] dmidecode: Update copyright year
|
||||
|
||||
---
|
||||
Makefile | 2 +-
|
||||
dmidecode.c | 2 +-
|
||||
dmidecode.h | 2 +-
|
||||
dmioem.c | 2 +-
|
||||
4 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 5d58266ef2de..97a1782fde3f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -4,7 +4,7 @@
|
||||
# VPD Decode
|
||||
#
|
||||
# Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
|
||||
-# Copyright (C) 2002-2015 Jean Delvare <jdelvare@suse.de>
|
||||
+# Copyright (C) 2002-2020 Jean Delvare <jdelvare@suse.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
diff --git a/dmidecode.c b/dmidecode.c
|
||||
index d0dc98467bdc..981fe9697458 100644
|
||||
--- a/dmidecode.c
|
||||
+++ b/dmidecode.c
|
||||
@@ -2,7 +2,7 @@
|
||||
* DMI Decode
|
||||
*
|
||||
* Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
|
||||
- * Copyright (C) 2002-2019 Jean Delvare <jdelvare@suse.de>
|
||||
+ * Copyright (C) 2002-2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
diff --git a/dmidecode.h b/dmidecode.h
|
||||
index 9ecc1791702d..1dc59a7e5536 100644
|
||||
--- a/dmidecode.h
|
||||
+++ b/dmidecode.h
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of the dmidecode project.
|
||||
*
|
||||
- * Copyright (C) 2005-2008 Jean Delvare <jdelvare@suse.de>
|
||||
+ * Copyright (C) 2005-2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
diff --git a/dmioem.c b/dmioem.c
|
||||
index 9d6ec7520287..60b667416563 100644
|
||||
--- a/dmioem.c
|
||||
+++ b/dmioem.c
|
||||
@@ -2,7 +2,7 @@
|
||||
* Decoding of OEM-specific entries
|
||||
* This file is part of the dmidecode project.
|
||||
*
|
||||
- * Copyright (C) 2007-2008 Jean Delvare <jdelvare@suse.de>
|
||||
+ * Copyright (C) 2007-2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 51bfbe2d5e8728e47f38eb44464f58ad674c4289 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Tue, 7 Apr 2020 11:55:41 +0200
|
||||
Subject: [PATCH 22/23] dmidecode: Add missing build dependencies on
|
||||
dmioutput.h
|
||||
|
||||
dmidecode.c and dmioem.c both include dmioutput.h so they must be
|
||||
rebuilt if that header file changes.
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 97a1782fde3f..194a523bdb46 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -78,13 +78,13 @@ vpddecode : vpddecode.o vpdopt.o util.o
|
||||
#
|
||||
|
||||
dmidecode.o : dmidecode.c version.h types.h util.h config.h dmidecode.h \
|
||||
- dmiopt.h dmioem.h
|
||||
+ dmiopt.h dmioem.h dmioutput.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
dmiopt.o : dmiopt.c config.h types.h util.h dmidecode.h dmiopt.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
-dmioem.o : dmioem.c types.h dmidecode.h dmioem.h
|
||||
+dmioem.o : dmioem.c types.h dmidecode.h dmioem.h dmioutput.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
dmioutput.o : dmioutput.c types.h dmioutput.h
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,55 @@
|
||||
From 5b3c8e9950262fc941bb5b3b3a1275720d47d62d Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Fri, 17 Apr 2020 17:14:15 +0200
|
||||
Subject: [PATCH 23/23] Allow overriding build settings from the environment
|
||||
|
||||
Let packagers pass their own CC, CFLAGS and LDFLAGS settings. The
|
||||
settings which are specific to dmidecode are appended later so that
|
||||
they are applied no matter what.
|
||||
|
||||
This should fix bug #55805:
|
||||
https://savannah.nongnu.org/bugs/?55805
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
Makefile | 17 +++++++++--------
|
||||
1 file changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 194a523bdb46..7aa729d8ca01 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -12,8 +12,13 @@
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
-CC = gcc
|
||||
-CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
|
||||
+CC ?= gcc
|
||||
+# Base CFLAGS can be overridden by environment
|
||||
+CFLAGS ?= -O2
|
||||
+# When debugging, disable -O2 and enable -g
|
||||
+#CFLAGS ?= -g
|
||||
+
|
||||
+CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
|
||||
-Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
|
||||
|
||||
# Let lseek and mmap support 64-bit wide offsets
|
||||
@@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
#CFLAGS += -DBIGENDIAN
|
||||
#CFLAGS += -DALIGNMENT_WORKAROUND
|
||||
|
||||
-# When debugging, disable -O2 and enable -g.
|
||||
-CFLAGS += -O2
|
||||
-#CFLAGS += -g
|
||||
-
|
||||
-# Pass linker flags here
|
||||
-LDFLAGS =
|
||||
+# Pass linker flags here (can be set from environment too)
|
||||
+LDFLAGS ?=
|
||||
|
||||
DESTDIR =
|
||||
prefix = /usr/local
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Tool to analyse BIOS DMI data
|
||||
Name: dmidecode
|
||||
Version: 3.2
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
|
||||
@ -25,6 +25,29 @@ Patch14: 0010-dmidecode-Fix-System-Slot-Information-for-PCIe-SSD.patch
|
||||
Patch15: 0011-Typo.patch
|
||||
Patch16: 0001-dmidecode-Add-enumerated-values-from-SMBIOS-3.3.0.patch
|
||||
Patch17: 0002-dmidecode-Decode-system-slot-base-bus-width-and-peer.patch
|
||||
Patch18: 0001-dmidecode-Print-type-33-name-unconditionally.patch
|
||||
Patch19: 0002-dmidecode-Don-t-choke-on-invalid-processor-voltage.patch
|
||||
Patch20: 0003-dmidecode-Simplify-the-formatting-of-memory-error-st.patch
|
||||
Patch21: 0004-dmidecode-Fix-the-alignment-of-type-25-name.patch
|
||||
Patch22: 0005-dmidecode-Code-indentation-fixes.patch
|
||||
Patch23: 0006-dmidecode-Reduce-the-indentation-of-type-42-structur.patch
|
||||
Patch24: 0007-dmidecode-Move-type-42-warning-messages-to-stderr.patch
|
||||
Patch25: 0008-dmidecode-Refactor-ASCII-filtering-of-DMI-strings.patch
|
||||
Patch26: 0009-dmidecode-Add-helper-function-pr_comment.patch
|
||||
Patch27: 0010-dmidecode-Add-helper-function-pr_info.patch
|
||||
Patch28: 0011-dmidecode-Protect-dmidecode.h-against-double-inclusi.patch
|
||||
Patch29: 0012-dmidecode-Add-helper-function-pr_handle.patch
|
||||
Patch30: 0013-dmidecode-Add-helper-function-pr_handle_name.patch
|
||||
Patch31: 0014-dmidecode-Add-helper-function-pr_attr.patch
|
||||
Patch32: 0015-dmidecode-Add-helper-functions-pr_list_start-item-en.patch
|
||||
Patch33: 0016-dmidecode-Add-helper-function-pr_subattr.patch
|
||||
Patch34: 0017-dmidecode-Use-the-print-helpers-in-dump-mode-too.patch
|
||||
Patch35: 0018-dmidecode-Add-helper-function-for-separators.patch
|
||||
Patch36: 0019-dmidecode-Add-helper-function-for-structure-errors.patch
|
||||
Patch37: 0020-dmidecode-White-space-fixes.patch
|
||||
Patch38: 0021-dmidecode-Update-copyright-year.patch
|
||||
Patch39: 0022-dmidecode-Add-missing-build-dependencies-on-dmioutpu.patch
|
||||
Patch40: 0023-Allow-overriding-build-settings-from-the-environment.patch
|
||||
|
||||
BuildRequires: gcc make
|
||||
ExclusiveArch: %{ix86} x86_64 ia64 aarch64
|
||||
@ -60,6 +83,29 @@ I/O ports (e.g. serial, parallel, USB).
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch36 -p1
|
||||
%patch37 -p1
|
||||
%patch38 -p1
|
||||
%patch39 -p1
|
||||
%patch40 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}"
|
||||
@ -80,6 +126,11 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Wed May 20 2020 Lianbo Jiang <lijiang@redhat.com> - 1:3.2-6
|
||||
- Updated to the latest upstream(5b3c8e995026 ("Allow overriding
|
||||
build settings from the environment"))
|
||||
- Resolves: rhbz#1796581
|
||||
|
||||
* Sun Oct 27 2019 Lianbo Jiang <lijiang@redhat.com> - 1:3.2-5
|
||||
- Fix the "OUT OF SPEC" for type 9
|
||||
- Resolves: rhbz#1763678
|
||||
|
Loading…
Reference in New Issue
Block a user