nanxiongchao / rpms / dmidecode

Forked from rpms/dmidecode 4 years ago
Clone

Blame SOURCES/0007-dmioem-Reflect-HPE-s-new-company-name.patch

5f4333
From ee07a1b4249560d620d05194eb8ff61b40d3ce23 Mon Sep 17 00:00:00 2001
5f4333
From: Jerry Hoemann <jerry.hoemann@hpe.com>
5f4333
Date: Wed, 13 Sep 2017 15:54:22 -0600
5f4333
Subject: [PATCH 07/10] dmioem: Reflect HPE's new company name
5f4333
5f4333
After Hewlett Packard Enterprise split from Hewlett-Packard, DMI OEM
5f4333
tables reflect the new company name.  Gen10 and subsequent systems will
5f4333
use HPE.  Gen9 and prior systems continue to use the old "HP" name.
5f4333
5f4333
Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
5f4333
Signed-off-by: Jean Delvare <jdelvare@suse.de>
5f4333
---
5f4333
 dmioem.c | 32 +++++++++++++++++++-------------
5f4333
 1 file changed, 19 insertions(+), 13 deletions(-)
5f4333
5f4333
diff --git a/dmioem.c b/dmioem.c
5f4333
index 034ad9f..a032344 100644
5f4333
--- a/dmioem.c
5f4333
+++ b/dmioem.c
5f4333
@@ -35,6 +35,7 @@ enum DMI_VENDORS
5f4333
 	VENDOR_UNKNOWN,
5f4333
 	VENDOR_HP,
5f4333
 	VENDOR_ACER,
5f4333
+	VENDOR_HPE,
5f4333
 };
5f4333
 
5f4333
 static enum DMI_VENDORS dmi_vendor = VENDOR_UNKNOWN;
5f4333
@@ -58,12 +59,14 @@ void dmi_set_vendor(const char *s)
5f4333
 
5f4333
 	if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0)
5f4333
 		dmi_vendor = VENDOR_HP;
5f4333
+	else if (strncmp(s, "HPE", len) == 0 || strncmp(s, "Hewlett Packard Enterprise", len) == 0)
5f4333
+		dmi_vendor = VENDOR_HPE;
5f4333
 	else if (strncmp(s, "Acer", len) == 0)
5f4333
 		dmi_vendor = VENDOR_ACER;
5f4333
 }
5f4333
 
5f4333
 /*
5f4333
- * HP-specific data structures are decoded here.
5f4333
+ * HPE-specific data structures are decoded here.
5f4333
  *
5f4333
  * Code contributed by John Cagle and Tyler Bell.
5f4333
  */
5f4333
@@ -98,14 +101,15 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 	u8 *data = h->data;
5f4333
 	int nic, ptr;
5f4333
 	u32 feat;
5f4333
+	const char *company = (dmi_vendor == VENDOR_HP) ? "HP" : "HPE";
5f4333
 
5f4333
 	switch (h->type)
5f4333
 	{
5f4333
 		case 204:
5f4333
 			/*
5f4333
-			 * Vendor Specific: HP ProLiant System/Rack Locator
5f4333
+			 * Vendor Specific: HPE ProLiant System/Rack Locator
5f4333
 			 */
5f4333
-			printf("HP ProLiant System/Rack Locator\n");
5f4333
+			printf("%s ProLiant System/Rack Locator\n", company);
5f4333
 			if (h->length < 0x0B) break;
5f4333
 			printf("\tRack Name: %s\n", dmi_string(h, data[0x04]));
5f4333
 			printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05]));
5f4333
@@ -119,7 +123,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 		case 209:
5f4333
 		case 221:
5f4333
 			/*
5f4333
-			 * Vendor Specific: HP ProLiant NIC MAC Information
5f4333
+			 * Vendor Specific: HPE ProLiant NIC MAC Information
5f4333
 			 *
5f4333
 			 * This prints the BIOS NIC number,
5f4333
 			 * PCI bus/device/function, and MAC address
5f4333
@@ -137,9 +141,10 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 			 *
5f4333
 			 * Type 221: is deprecated in the latest docs
5f4333
 			 */
5f4333
-			printf(h->type == 221 ?
5f4333
-				"HP BIOS iSCSI NIC PCI and MAC Information\n" :
5f4333
-				"HP BIOS PXE NIC PCI and MAC Information\n");
5f4333
+			printf("%s %s\n", company,
5f4333
+				h->type == 221 ?
5f4333
+					"BIOS iSCSI NIC PCI and MAC Information" :
5f4333
+					"BIOS PXE NIC PCI and MAC Information");
5f4333
 			nic = 1;
5f4333
 			ptr = 4;
5f4333
 			while (h->length >= ptr + 8)
5f4333
@@ -155,7 +160,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 
5f4333
 		case 233:
5f4333
 			/*
5f4333
-			 * Vendor Specific: HP ProLiant NIC MAC Information
5f4333
+			 * Vendor Specific: HPE ProLiant NIC MAC Information
5f4333
 			 *
5f4333
 			 * This prints the BIOS NIC number,
5f4333
 			 * PCI bus/device/function, and MAC address
5f4333
@@ -171,7 +176,7 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 			 *  0x08  |   MAC  | 32B   | MAC addr padded w/ 0s
5f4333
 			 *  0x28  | Port No| BYTE  | Each NIC maps to a Port
5f4333
 			 */
5f4333
-			printf("HP BIOS PXE NIC PCI and MAC Information\n");
5f4333
+			printf("%s BIOS PXE NIC PCI and MAC Information\n", company);
5f4333
 			if (h->length < 0x0E) break;
5f4333
 			/* If the record isn't long enough, we don't have an ID
5f4333
 			 * use 0xFF to use the internal counter.
5f4333
@@ -183,11 +188,11 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 
5f4333
 		case 212:
5f4333
 			/*
5f4333
-			 * Vendor Specific: HP 64-bit CRU Information
5f4333
+			 * Vendor Specific: HPE 64-bit CRU Information
5f4333
 			 *
5f4333
 			 * Source: hpwdt kernel driver
5f4333
 			 */
5f4333
-			printf("HP 64-bit CRU Information\n");
5f4333
+			printf("%s 64-bit CRU Information\n", company);
5f4333
 			if (h->length < 0x18) break;
5f4333
 			printf("\tSignature: 0x%08x", DWORD(data + 0x04));
5f4333
 			if (is_printable(data + 0x04, 4))
5f4333
@@ -208,11 +213,11 @@ static int dmi_decode_hp(const struct dmi_header *h)
5f4333
 
5f4333
 		case 219:
5f4333
 			/*
5f4333
-			 * Vendor Specific: HP ProLiant Information
5f4333
+			 * Vendor Specific: HPE ProLiant Information
5f4333
 			 *
5f4333
 			 * Source: hpwdt kernel driver
5f4333
 			 */
5f4333
-			printf("HP ProLiant Information\n");
5f4333
+			printf("%s ProLiant Information\n", company);
5f4333
 			if (h->length < 0x08) break;
5f4333
 			printf("\tPower Features: 0x%08x\n", DWORD(data + 0x04));
5f4333
 			if (h->length < 0x0C) break;
5f4333
@@ -281,6 +286,7 @@ int dmi_decode_oem(const struct dmi_header *h)
5f4333
 	switch (dmi_vendor)
5f4333
 	{
5f4333
 		case VENDOR_HP:
5f4333
+		case VENDOR_HPE:
5f4333
 			return dmi_decode_hp(h);
5f4333
 		case VENDOR_ACER:
5f4333
 			return dmi_decode_acer(h);
5f4333
-- 
5f4333
2.9.5
5f4333