|
|
f877e3 |
From ebbe1dbe9a4413232949d97a506db6a7c00865fa Mon Sep 17 00:00:00 2001
|
|
|
f877e3 |
From: Jean Delvare <jdelvare@suse.de>
|
|
|
f877e3 |
Date: Wed, 1 Apr 2020 09:52:00 +0200
|
|
|
f877e3 |
Subject: [PATCH 13/23] dmidecode: Add helper function pr_handle_name
|
|
|
f877e3 |
|
|
|
f877e3 |
Print the name of each handle type through a helper function
|
|
|
f877e3 |
pr_handle_name.
|
|
|
f877e3 |
|
|
|
f877e3 |
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
f877e3 |
---
|
|
|
f877e3 |
dmidecode.c | 99 ++++++++++++++++++++++++++---------------------------
|
|
|
f877e3 |
dmioem.c | 25 +++++++-------
|
|
|
f877e3 |
dmioutput.c | 10 ++++++
|
|
|
f877e3 |
dmioutput.h | 1 +
|
|
|
f877e3 |
4 files changed, 73 insertions(+), 62 deletions(-)
|
|
|
f877e3 |
|
|
|
f877e3 |
diff --git a/dmidecode.c b/dmidecode.c
|
|
|
f877e3 |
index 8ba8d078614e..c226bad06638 100644
|
|
|
f877e3 |
--- a/dmidecode.c
|
|
|
f877e3 |
+++ b/dmidecode.c
|
|
|
f877e3 |
@@ -2083,11 +2083,10 @@ static void dmi_on_board_devices(const struct dmi_header *h, const char *prefix)
|
|
|
f877e3 |
for (i = 0; i < count; i++)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
if (count == 1)
|
|
|
f877e3 |
- printf("%sOn Board Device Information\n",
|
|
|
f877e3 |
- prefix);
|
|
|
f877e3 |
+ pr_handle_name("On Board Device Information");
|
|
|
f877e3 |
else
|
|
|
f877e3 |
- printf("%sOn Board Device %d Information\n",
|
|
|
f877e3 |
- prefix, i + 1);
|
|
|
f877e3 |
+ pr_handle_name("On Board Device %d Information",
|
|
|
f877e3 |
+ i + 1);
|
|
|
f877e3 |
printf("%s\tType: %s\n",
|
|
|
f877e3 |
prefix, dmi_on_board_devices_type(p[2 * i] & 0x7F));
|
|
|
f877e3 |
printf("%s\tStatus: %s\n",
|
|
|
f877e3 |
@@ -3397,7 +3396,7 @@ static void dmi_additional_info(const struct dmi_header *h, const char *prefix)
|
|
|
f877e3 |
|
|
|
f877e3 |
for (i = 0; i < count; i++)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
- printf("%sAdditional Information %d\n", prefix, i + 1);
|
|
|
f877e3 |
+ pr_handle_name("Additional Information %d", i + 1);
|
|
|
f877e3 |
|
|
|
f877e3 |
/* Check for short entries */
|
|
|
f877e3 |
if (h->length < offset + 1) break;
|
|
|
f877e3 |
@@ -3893,7 +3892,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
switch (h->type)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
case 0: /* 7.1 BIOS Information */
|
|
|
f877e3 |
- printf("BIOS Information\n");
|
|
|
f877e3 |
+ pr_handle_name("BIOS Information");
|
|
|
f877e3 |
if (h->length < 0x12) break;
|
|
|
f877e3 |
printf("\tVendor: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -3933,7 +3932,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 1: /* 7.2 System Information */
|
|
|
f877e3 |
- printf("System Information\n");
|
|
|
f877e3 |
+ pr_handle_name("System Information");
|
|
|
f877e3 |
if (h->length < 0x08) break;
|
|
|
f877e3 |
printf("\tManufacturer: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -3957,7 +3956,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 2: /* 7.3 Base Board Information */
|
|
|
f877e3 |
- printf("Base Board Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Base Board Information");
|
|
|
f877e3 |
if (h->length < 0x08) break;
|
|
|
f877e3 |
printf("\tManufacturer: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -3988,7 +3987,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 3: /* 7.4 Chassis Information */
|
|
|
f877e3 |
- printf("Chassis Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Chassis Information");
|
|
|
f877e3 |
if (h->length < 0x09) break;
|
|
|
f877e3 |
printf("\tManufacturer: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4030,7 +4029,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 4: /* 7.5 Processor Information */
|
|
|
f877e3 |
- printf("Processor Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Processor Information");
|
|
|
f877e3 |
if (h->length < 0x1A) break;
|
|
|
f877e3 |
printf("\tSocket Designation: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4100,7 +4099,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 5: /* 7.6 Memory Controller Information */
|
|
|
f877e3 |
- printf("Memory Controller Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Memory Controller Information");
|
|
|
f877e3 |
if (h->length < 0x0F) break;
|
|
|
f877e3 |
printf("\tError Detecting Method: %s\n",
|
|
|
f877e3 |
dmi_memory_controller_ed_method(data[0x04]));
|
|
|
f877e3 |
@@ -4130,7 +4129,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 6: /* 7.7 Memory Module Information */
|
|
|
f877e3 |
- printf("Memory Module Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Memory Module Information");
|
|
|
f877e3 |
if (h->length < 0x0C) break;
|
|
|
f877e3 |
printf("\tSocket Designation: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4154,7 +4153,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 7: /* 7.8 Cache Information */
|
|
|
f877e3 |
- printf("Cache Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Cache Information");
|
|
|
f877e3 |
if (h->length < 0x0F) break;
|
|
|
f877e3 |
printf("\tSocket Designation: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4197,7 +4196,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 8: /* 7.9 Port Connector Information */
|
|
|
f877e3 |
- printf("Port Connector Information\n");
|
|
|
f877e3 |
+ pr_handle_name("Port Connector Information");
|
|
|
f877e3 |
if (h->length < 0x09) break;
|
|
|
f877e3 |
printf("\tInternal Reference Designator: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4212,7 +4211,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 9: /* 7.10 System Slots */
|
|
|
f877e3 |
- printf("System Slot Information\n");
|
|
|
f877e3 |
+ pr_handle_name("System Slot Information");
|
|
|
f877e3 |
if (h->length < 0x0C) break;
|
|
|
f877e3 |
printf("\tDesignation: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4243,19 +4242,19 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 11: /* 7.12 OEM Strings */
|
|
|
f877e3 |
- printf("OEM Strings\n");
|
|
|
f877e3 |
+ pr_handle_name("OEM Strings");
|
|
|
f877e3 |
if (h->length < 0x05) break;
|
|
|
f877e3 |
dmi_oem_strings(h, "\t");
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 12: /* 7.13 System Configuration Options */
|
|
|
f877e3 |
- printf("System Configuration Options\n");
|
|
|
f877e3 |
+ pr_handle_name("System Configuration Options");
|
|
|
f877e3 |
if (h->length < 0x05) break;
|
|
|
f877e3 |
dmi_system_configuration_options(h, "\t");
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 13: /* 7.14 BIOS Language Information */
|
|
|
f877e3 |
- printf("BIOS Language Information\n");
|
|
|
f877e3 |
+ pr_handle_name("BIOS Language Information");
|
|
|
f877e3 |
if (h->length < 0x16) break;
|
|
|
f877e3 |
if (ver >= 0x0201)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
@@ -4269,7 +4268,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 14: /* 7.15 Group Associations */
|
|
|
f877e3 |
- printf("Group Associations\n");
|
|
|
f877e3 |
+ pr_handle_name("Group Associations");
|
|
|
f877e3 |
if (h->length < 0x05) break;
|
|
|
f877e3 |
printf("\tName: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4279,7 +4278,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 15: /* 7.16 System Event Log */
|
|
|
f877e3 |
- printf("System Event Log\n");
|
|
|
f877e3 |
+ pr_handle_name("System Event Log");
|
|
|
f877e3 |
if (h->length < 0x14) break;
|
|
|
f877e3 |
printf("\tArea Length: %u bytes\n",
|
|
|
f877e3 |
WORD(data + 0x04));
|
|
|
f877e3 |
@@ -4311,7 +4310,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 16: /* 7.17 Physical Memory Array */
|
|
|
f877e3 |
- printf("Physical Memory Array\n");
|
|
|
f877e3 |
+ pr_handle_name("Physical Memory Array");
|
|
|
f877e3 |
if (h->length < 0x0F) break;
|
|
|
f877e3 |
printf("\tLocation: %s\n",
|
|
|
f877e3 |
dmi_memory_array_location(data[0x04]));
|
|
|
f877e3 |
@@ -4347,7 +4346,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 17: /* 7.18 Memory Device */
|
|
|
f877e3 |
- printf("Memory Device\n");
|
|
|
f877e3 |
+ pr_handle_name("Memory Device");
|
|
|
f877e3 |
if (h->length < 0x15) break;
|
|
|
f877e3 |
if (!(opt.flags & FLAG_QUIET))
|
|
|
f877e3 |
{
|
|
|
f877e3 |
@@ -4457,7 +4456,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 18: /* 7.19 32-bit Memory Error Information */
|
|
|
f877e3 |
- printf("32-bit Memory Error Information\n");
|
|
|
f877e3 |
+ pr_handle_name("32-bit Memory Error Information");
|
|
|
f877e3 |
if (h->length < 0x17) break;
|
|
|
f877e3 |
printf("\tType: %s\n",
|
|
|
f877e3 |
dmi_memory_error_type(data[0x04]));
|
|
|
f877e3 |
@@ -4480,7 +4479,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 19: /* 7.20 Memory Array Mapped Address */
|
|
|
f877e3 |
- printf("Memory Array Mapped Address\n");
|
|
|
f877e3 |
+ pr_handle_name("Memory Array Mapped Address");
|
|
|
f877e3 |
if (h->length < 0x0F) break;
|
|
|
f877e3 |
if (h->length >= 0x1F && DWORD(data + 0x04) == 0xFFFFFFFF)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
@@ -4516,7 +4515,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 20: /* 7.21 Memory Device Mapped Address */
|
|
|
f877e3 |
- printf("Memory Device Mapped Address\n");
|
|
|
f877e3 |
+ pr_handle_name("Memory Device Mapped Address");
|
|
|
f877e3 |
if (h->length < 0x13) break;
|
|
|
f877e3 |
if (h->length >= 0x23 && DWORD(data + 0x04) == 0xFFFFFFFF)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
@@ -4559,7 +4558,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 21: /* 7.22 Built-in Pointing Device */
|
|
|
f877e3 |
- printf("Built-in Pointing Device\n");
|
|
|
f877e3 |
+ pr_handle_name("Built-in Pointing Device");
|
|
|
f877e3 |
if (h->length < 0x07) break;
|
|
|
f877e3 |
printf("\tType: %s\n",
|
|
|
f877e3 |
dmi_pointing_device_type(data[0x04]));
|
|
|
f877e3 |
@@ -4570,7 +4569,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 22: /* 7.23 Portable Battery */
|
|
|
f877e3 |
- printf("Portable Battery\n");
|
|
|
f877e3 |
+ pr_handle_name("Portable Battery");
|
|
|
f877e3 |
if (h->length < 0x10) break;
|
|
|
f877e3 |
printf("\tLocation: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4618,7 +4617,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 23: /* 7.24 System Reset */
|
|
|
f877e3 |
- printf("System Reset\n");
|
|
|
f877e3 |
+ pr_handle_name("System Reset");
|
|
|
f877e3 |
if (h->length < 0x0D) break;
|
|
|
f877e3 |
printf("\tStatus: %s\n",
|
|
|
f877e3 |
data[0x04] & (1 << 0) ? "Enabled" : "Disabled");
|
|
|
f877e3 |
@@ -4645,7 +4644,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 24: /* 7.25 Hardware Security */
|
|
|
f877e3 |
- printf("Hardware Security\n");
|
|
|
f877e3 |
+ pr_handle_name("Hardware Security");
|
|
|
f877e3 |
if (h->length < 0x05) break;
|
|
|
f877e3 |
printf("\tPower-On Password Status: %s\n",
|
|
|
f877e3 |
dmi_hardware_security_status(data[0x04] >> 6));
|
|
|
f877e3 |
@@ -4658,7 +4657,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 25: /* 7.26 System Power Controls */
|
|
|
f877e3 |
- printf("System Power Controls\n");
|
|
|
f877e3 |
+ pr_handle_name("System Power Controls");
|
|
|
f877e3 |
if (h->length < 0x09) break;
|
|
|
f877e3 |
printf("\tNext Scheduled Power-on:");
|
|
|
f877e3 |
dmi_power_controls_power_on(data + 0x04);
|
|
|
f877e3 |
@@ -4666,7 +4665,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 26: /* 7.27 Voltage Probe */
|
|
|
f877e3 |
- printf("Voltage Probe\n");
|
|
|
f877e3 |
+ pr_handle_name("Voltage Probe");
|
|
|
f877e3 |
if (h->length < 0x14) break;
|
|
|
f877e3 |
printf("\tDescription: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4698,7 +4697,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 27: /* 7.28 Cooling Device */
|
|
|
f877e3 |
- printf("Cooling Device\n");
|
|
|
f877e3 |
+ pr_handle_name("Cooling Device");
|
|
|
f877e3 |
if (h->length < 0x0C) break;
|
|
|
f877e3 |
if (!(opt.flags & FLAG_QUIET) && WORD(data + 0x04) != 0xFFFF)
|
|
|
f877e3 |
printf("\tTemperature Probe Handle: 0x%04X\n",
|
|
|
f877e3 |
@@ -4721,7 +4720,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 28: /* 7.29 Temperature Probe */
|
|
|
f877e3 |
- printf("Temperature Probe\n");
|
|
|
f877e3 |
+ pr_handle_name("Temperature Probe");
|
|
|
f877e3 |
if (h->length < 0x14) break;
|
|
|
f877e3 |
printf("\tDescription: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4753,7 +4752,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 29: /* 7.30 Electrical Current Probe */
|
|
|
f877e3 |
- printf("Electrical Current Probe\n");
|
|
|
f877e3 |
+ pr_handle_name("Electrical Current Probe");
|
|
|
f877e3 |
if (h->length < 0x14) break;
|
|
|
f877e3 |
printf("\tDescription: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4785,7 +4784,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 30: /* 7.31 Out-of-band Remote Access */
|
|
|
f877e3 |
- printf("Out-of-band Remote Access\n");
|
|
|
f877e3 |
+ pr_handle_name("Out-of-band Remote Access");
|
|
|
f877e3 |
if (h->length < 0x06) break;
|
|
|
f877e3 |
printf("\tManufacturer Name: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4796,7 +4795,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 31: /* 7.32 Boot Integrity Services Entry Point */
|
|
|
f877e3 |
- printf("Boot Integrity Services Entry Point\n");
|
|
|
f877e3 |
+ pr_handle_name("Boot Integrity Services Entry Point");
|
|
|
f877e3 |
if (h->length < 0x1C) break;
|
|
|
f877e3 |
printf("\tChecksum: %s\n",
|
|
|
f877e3 |
checksum(data, h->length) ? "OK" : "Invalid");
|
|
|
f877e3 |
@@ -4808,14 +4807,14 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 32: /* 7.33 System Boot Information */
|
|
|
f877e3 |
- printf("System Boot Information\n");
|
|
|
f877e3 |
+ pr_handle_name("System Boot Information");
|
|
|
f877e3 |
if (h->length < 0x0B) break;
|
|
|
f877e3 |
printf("\tStatus: %s\n",
|
|
|
f877e3 |
dmi_system_boot_status(data[0x0A]));
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 33: /* 7.34 64-bit Memory Error Information */
|
|
|
f877e3 |
- printf("64-bit Memory Error Information\n");
|
|
|
f877e3 |
+ pr_handle_name("64-bit Memory Error Information");
|
|
|
f877e3 |
if (h->length < 0x1F) break;
|
|
|
f877e3 |
printf("\tType: %s\n",
|
|
|
f877e3 |
dmi_memory_error_type(data[0x04]));
|
|
|
f877e3 |
@@ -4838,7 +4837,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 34: /* 7.35 Management Device */
|
|
|
f877e3 |
- printf("Management Device\n");
|
|
|
f877e3 |
+ pr_handle_name("Management Device");
|
|
|
f877e3 |
if (h->length < 0x0B) break;
|
|
|
f877e3 |
printf("\tDescription: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4851,7 +4850,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 35: /* 7.36 Management Device Component */
|
|
|
f877e3 |
- printf("Management Device Component\n");
|
|
|
f877e3 |
+ pr_handle_name("Management Device Component");
|
|
|
f877e3 |
if (h->length < 0x0B) break;
|
|
|
f877e3 |
printf("\tDescription: %s\n",
|
|
|
f877e3 |
dmi_string(h, data[0x04]));
|
|
|
f877e3 |
@@ -4868,7 +4867,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 36: /* 7.37 Management Device Threshold Data */
|
|
|
f877e3 |
- printf("Management Device Threshold Data\n");
|
|
|
f877e3 |
+ pr_handle_name("Management Device Threshold Data");
|
|
|
f877e3 |
if (h->length < 0x10) break;
|
|
|
f877e3 |
if (WORD(data + 0x04) != 0x8000)
|
|
|
f877e3 |
printf("\tLower Non-critical Threshold: %d\n",
|
|
|
f877e3 |
@@ -4891,7 +4890,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 37: /* 7.38 Memory Channel */
|
|
|
f877e3 |
- printf("Memory Channel\n");
|
|
|
f877e3 |
+ pr_handle_name("Memory Channel");
|
|
|
f877e3 |
if (h->length < 0x07) break;
|
|
|
f877e3 |
printf("\tType: %s\n",
|
|
|
f877e3 |
dmi_memory_channel_type(data[0x04]));
|
|
|
f877e3 |
@@ -4908,7 +4907,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
* We use the word "Version" instead of "Revision", conforming to
|
|
|
f877e3 |
* the IPMI specification.
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("IPMI Device Information\n");
|
|
|
f877e3 |
+ pr_handle_name("IPMI Device Information");
|
|
|
f877e3 |
if (h->length < 0x10) break;
|
|
|
f877e3 |
printf("\tInterface Type: %s\n",
|
|
|
f877e3 |
dmi_ipmi_interface_type(data[0x04]));
|
|
|
f877e3 |
@@ -4946,7 +4945,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 39: /* 7.40 System Power Supply */
|
|
|
f877e3 |
- printf("System Power Supply\n");
|
|
|
f877e3 |
+ pr_handle_name("System Power Supply");
|
|
|
f877e3 |
if (h->length < 0x10) break;
|
|
|
f877e3 |
if (data[0x04] != 0x00)
|
|
|
f877e3 |
printf("\tPower Unit Group: %u\n",
|
|
|
f877e3 |
@@ -5006,7 +5005,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 41: /* 7.42 Onboard Device Extended Information */
|
|
|
f877e3 |
- printf("Onboard Device\n");
|
|
|
f877e3 |
+ pr_handle_name("Onboard Device");
|
|
|
f877e3 |
if (h->length < 0x0B) break;
|
|
|
f877e3 |
printf("\tReference Designation: %s\n", dmi_string(h, data[0x04]));
|
|
|
f877e3 |
printf("\tType: %s\n",
|
|
|
f877e3 |
@@ -5018,7 +5017,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 42: /* 7.43 Management Controller Host Interface */
|
|
|
f877e3 |
- printf("Management Controller Host Interface\n");
|
|
|
f877e3 |
+ pr_handle_name("Management Controller Host Interface");
|
|
|
f877e3 |
if (ver < 0x0302)
|
|
|
f877e3 |
{
|
|
|
f877e3 |
if (h->length < 0x05) break;
|
|
|
f877e3 |
@@ -5043,7 +5042,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 43: /* 7.44 TPM Device */
|
|
|
f877e3 |
- printf("TPM Device\n");
|
|
|
f877e3 |
+ pr_handle_name("TPM Device");
|
|
|
f877e3 |
if (h->length < 0x1B) break;
|
|
|
f877e3 |
printf("\tVendor ID:");
|
|
|
f877e3 |
dmi_tpm_vendor_id(data + 0x04);
|
|
|
f877e3 |
@@ -5080,11 +5079,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 126: /* 7.44 Inactive */
|
|
|
f877e3 |
- printf("Inactive\n");
|
|
|
f877e3 |
+ pr_handle_name("Inactive");
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
case 127: /* 7.45 End Of Table */
|
|
|
f877e3 |
- printf("End Of Table\n");
|
|
|
f877e3 |
+ pr_handle_name("End Of Table");
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
|
|
|
f877e3 |
default:
|
|
|
f877e3 |
@@ -5092,7 +5091,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
if (opt.flags & FLAG_QUIET)
|
|
|
f877e3 |
return;
|
|
|
f877e3 |
- printf("%s Type\n",
|
|
|
f877e3 |
+ pr_handle_name("%s Type",
|
|
|
f877e3 |
h->type >= 128 ? "OEM-specific" : "Unknown");
|
|
|
f877e3 |
dmi_dump(h, "\t");
|
|
|
f877e3 |
}
|
|
|
f877e3 |
diff --git a/dmioem.c b/dmioem.c
|
|
|
f877e3 |
index 1a9bd8264fcb..c999c08c4475 100644
|
|
|
f877e3 |
--- a/dmioem.c
|
|
|
f877e3 |
+++ b/dmioem.c
|
|
|
f877e3 |
@@ -25,6 +25,7 @@
|
|
|
f877e3 |
#include "types.h"
|
|
|
f877e3 |
#include "dmidecode.h"
|
|
|
f877e3 |
#include "dmioem.h"
|
|
|
f877e3 |
+#include "dmioutput.h"
|
|
|
f877e3 |
|
|
|
f877e3 |
/*
|
|
|
f877e3 |
* Globals for vendor-specific decodes
|
|
|
f877e3 |
@@ -92,7 +93,7 @@ static int dmi_decode_acer(const struct dmi_header *h)
|
|
|
f877e3 |
* brands, including Fujitsu-Siemens, Medion, Lenovo,
|
|
|
f877e3 |
* and eMachines.
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("Acer Hotkey Function\n");
|
|
|
f877e3 |
+ pr_handle_name("Acer Hotkey Function");
|
|
|
f877e3 |
if (h->length < 0x0F) break;
|
|
|
f877e3 |
cap = WORD(data + 0x04);
|
|
|
f877e3 |
printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap);
|
|
|
f877e3 |
@@ -157,7 +158,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
|
|
f877e3 |
/*
|
|
|
f877e3 |
* Vendor Specific: HPE ProLiant System/Rack Locator
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("%s ProLiant System/Rack Locator\n", company);
|
|
|
f877e3 |
+ pr_handle_name("%s ProLiant System/Rack Locator", company);
|
|
|
f877e3 |
if (h->length < 0x0B) break;
|
|
|
f877e3 |
printf("\tRack Name: %s\n", dmi_string(h, data[0x04]));
|
|
|
f877e3 |
printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05]));
|
|
|
f877e3 |
@@ -189,10 +190,9 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
|
|
f877e3 |
*
|
|
|
f877e3 |
* Type 221: is deprecated in the latest docs
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("%s %s\n", company,
|
|
|
f877e3 |
- h->type == 221 ?
|
|
|
f877e3 |
- "BIOS iSCSI NIC PCI and MAC Information" :
|
|
|
f877e3 |
- "BIOS PXE NIC PCI and MAC Information");
|
|
|
f877e3 |
+ pr_handle_name("%s %s", company, h->type == 221 ?
|
|
|
f877e3 |
+ "BIOS iSCSI NIC PCI and MAC Information" :
|
|
|
f877e3 |
+ "BIOS PXE NIC PCI and MAC Information");
|
|
|
f877e3 |
nic = 1;
|
|
|
f877e3 |
ptr = 4;
|
|
|
f877e3 |
while (h->length >= ptr + 8)
|
|
|
f877e3 |
@@ -224,7 +224,8 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
|
|
f877e3 |
* 0x08 | MAC | 32B | MAC addr padded w/ 0s
|
|
|
f877e3 |
* 0x28 | Port No| BYTE | Each NIC maps to a Port
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("%s BIOS PXE NIC PCI and MAC Information\n", company);
|
|
|
f877e3 |
+ pr_handle_name("%s BIOS PXE NIC PCI and MAC Information",
|
|
|
f877e3 |
+ company);
|
|
|
f877e3 |
if (h->length < 0x0E) break;
|
|
|
f877e3 |
/* If the record isn't long enough, we don't have an ID
|
|
|
f877e3 |
* use 0xFF to use the internal counter.
|
|
|
f877e3 |
@@ -240,7 +241,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
|
|
f877e3 |
*
|
|
|
f877e3 |
* Source: hpwdt kernel driver
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("%s 64-bit CRU Information\n", company);
|
|
|
f877e3 |
+ pr_handle_name("%s 64-bit CRU Information", company);
|
|
|
f877e3 |
if (h->length < 0x18) break;
|
|
|
f877e3 |
printf("\tSignature: 0x%08x", DWORD(data + 0x04));
|
|
|
f877e3 |
if (is_printable(data + 0x04, 4))
|
|
|
f877e3 |
@@ -265,7 +266,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
|
|
f877e3 |
*
|
|
|
f877e3 |
* Source: hpwdt kernel driver
|
|
|
f877e3 |
*/
|
|
|
f877e3 |
- printf("%s ProLiant Information\n", company);
|
|
|
f877e3 |
+ pr_handle_name("%s ProLiant Information", company);
|
|
|
f877e3 |
if (h->length < 0x08) break;
|
|
|
f877e3 |
printf("\tPower Features: 0x%08x\n", DWORD(data + 0x04));
|
|
|
f877e3 |
if (h->length < 0x0C) break;
|
|
|
f877e3 |
@@ -318,7 +319,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
|
|
f877e3 |
|| strcmp(dmi_string(h, 1), "TVT-Enablement") != 0)
|
|
|
f877e3 |
return 0;
|
|
|
f877e3 |
|
|
|
f877e3 |
- printf("ThinkVantage Technologies\n");
|
|
|
f877e3 |
+ pr_handle_name("ThinkVantage Technologies");
|
|
|
f877e3 |
printf("\tVersion: %u\n", data[0x04]);
|
|
|
f877e3 |
printf("\tDiagnostics: %s\n",
|
|
|
f877e3 |
data[0x14] & 0x80 ? "Available" : "No");
|
|
|
f877e3 |
@@ -357,7 +358,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
|
|
f877e3 |
if (data[0x06] != 0x07 || data[0x07] != 0x03 || data[0x08] != 0x01)
|
|
|
f877e3 |
return 0;
|
|
|
f877e3 |
|
|
|
f877e3 |
- printf("ThinkPad Device Presence Detection\n");
|
|
|
f877e3 |
+ pr_handle_name("ThinkPad Device Presence Detection");
|
|
|
f877e3 |
printf("\tFingerprint Reader: %s\n",
|
|
|
f877e3 |
data[0x09] & 0x01 ? "Present" : "No");
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
@@ -390,7 +391,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
|
|
f877e3 |
if (data[0x0A] != 0x0B || data[0x0B] != 0x07 || data[0x0C] != 0x01)
|
|
|
f877e3 |
return 0;
|
|
|
f877e3 |
|
|
|
f877e3 |
- printf("ThinkPad Embedded Controller Program\n");
|
|
|
f877e3 |
+ pr_handle_name("ThinkPad Embedded Controller Program");
|
|
|
f877e3 |
printf("\tVersion ID: %s\n", dmi_string(h, 1));
|
|
|
f877e3 |
printf("\tRelease Date: %s\n", dmi_string(h, 2));
|
|
|
f877e3 |
break;
|
|
|
f877e3 |
diff --git a/dmioutput.c b/dmioutput.c
|
|
|
f877e3 |
index ad3b0398c446..ca7edab5cc69 100644
|
|
|
f877e3 |
--- a/dmioutput.c
|
|
|
f877e3 |
+++ b/dmioutput.c
|
|
|
f877e3 |
@@ -49,3 +49,13 @@ void pr_handle(const struct dmi_header *h)
|
|
|
f877e3 |
printf("Handle 0x%04X, DMI type %d, %d bytes\n",
|
|
|
f877e3 |
h->handle, h->type, h->length);
|
|
|
f877e3 |
}
|
|
|
f877e3 |
+
|
|
|
f877e3 |
+void pr_handle_name(const char *format, ...)
|
|
|
f877e3 |
+{
|
|
|
f877e3 |
+ va_list args;
|
|
|
f877e3 |
+
|
|
|
f877e3 |
+ va_start(args, format);
|
|
|
f877e3 |
+ vprintf(format, args);
|
|
|
f877e3 |
+ va_end(args);
|
|
|
f877e3 |
+ printf("\n");
|
|
|
f877e3 |
+}
|
|
|
f877e3 |
diff --git a/dmioutput.h b/dmioutput.h
|
|
|
f877e3 |
index 6ef60f0ee3cd..0acdce7658c9 100644
|
|
|
f877e3 |
--- a/dmioutput.h
|
|
|
f877e3 |
+++ b/dmioutput.h
|
|
|
f877e3 |
@@ -24,3 +24,4 @@
|
|
|
f877e3 |
void pr_comment(const char *format, ...);
|
|
|
f877e3 |
void pr_info(const char *format, ...);
|
|
|
f877e3 |
void pr_handle(const struct dmi_header *h);
|
|
|
f877e3 |
+void pr_handle_name(const char *format, ...);
|
|
|
f877e3 |
--
|
|
|
f877e3 |
2.17.1
|
|
|
f877e3 |
|