Add decode of pcie device class

This commit makes two major changes.  First, the device class tables
were being decoded incorrectly as LSB-first. This changes them to
MSB-first.

Second, once this value is correct decode the tables to a string name
making it much easier for users to identify a specific device that
caused a PCIe error.

Note: The majority of the mode lookup table was created by LLM.  The
entries have been manually reviewed for correctness and completeness.

Change-Id: I61bc813dbab39ca6116046e302dafca9fbbb0893
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/cper-utils.c b/cper-utils.c
index 01c1f7e..b1ae557 100644
--- a/cper-utils.c
+++ b/cper-utils.c
@@ -498,6 +498,40 @@
 			       json_object_new_uint64(value));
 }
 
+static void add_int_hex_common(json_object *register_ir, const char *field_name,
+			       UINT64 value, int len)
+{
+	char hexstring_buf[EFI_UINT64_HEX_STRING_LEN];
+	snprintf(hexstring_buf, EFI_UINT64_HEX_STRING_LEN, "0x%0*llX", len,
+		 value);
+	json_object_object_add(register_ir, field_name,
+			       json_object_new_string(hexstring_buf));
+}
+
+void add_int_hex_8(json_object *register_ir, const char *field_name,
+		   UINT8 value)
+{
+	add_int_hex_common(register_ir, field_name, value, 2);
+}
+
+void add_int_hex_16(json_object *register_ir, const char *field_name,
+		    UINT16 value)
+{
+	add_int_hex_common(register_ir, field_name, value, 4);
+}
+
+void add_int_hex_24(json_object *register_ir, const char *field_name,
+		    UINT64 value)
+{
+	add_int_hex_common(register_ir, field_name, value, 6);
+}
+
+void add_int_hex_64(json_object *register_ir, const char *field_name,
+		    UINT64 value)
+{
+	add_int_hex_common(register_ir, field_name, value, 8);
+}
+
 void add_bool(json_object *register_ir, const char *field_name, UINT64 value)
 {
 	json_object_object_add(register_ir, field_name,