[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] hvmloader: add fields for SMBIOS 2.4 compliance



The version of SMBIOS set in the entry point is 2.4, however several
structures are missing fields required by 2.4. Fix this by adding the
missing fields, this is based on the documents found at the DMTF site
[0].

Most fields are set to 0 (undefined/not specified), except for the
cache related handlers that need to be initialized to 0xffff in order
to signal that the information is not provided.

[0] 
https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reported by: Chris Gilbert <chris.gilbert@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Chris Gilbert <chris.gilbert@xxxxxxxxxx>
---
It seems like the code in smbios likes to initialize everything to 0,
but I don't see the value in that since the struct is already memset
to 0.
---
Changes since v1:
 - Add the contained elements array.
---
 tools/firmware/hvmloader/smbios.c       |  3 +++
 tools/firmware/hvmloader/smbios_types.h | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/tools/firmware/hvmloader/smbios.c 
b/tools/firmware/hvmloader/smbios.c
index 210c7b0d35..2c1da7b38e 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -608,6 +608,9 @@ smbios_type_4_init(
 
     p->status = 0x41; /* socket populated, CPU enabled */
     p->upgrade = 0x01; /* other */
+    p->l1_cache_handle = 0xffff; /* No cache information structure provided. */
+    p->l2_cache_handle = 0xffff; /* No cache information structure provided. */
+    p->l3_cache_handle = 0xffff; /* No cache information structure provided. */
 
     start += sizeof(struct smbios_type_4);
 
diff --git a/tools/firmware/hvmloader/smbios_types.h 
b/tools/firmware/hvmloader/smbios_types.h
index e924f819b3..acb63e2fe9 100644
--- a/tools/firmware/hvmloader/smbios_types.h
+++ b/tools/firmware/hvmloader/smbios_types.h
@@ -92,6 +92,13 @@ struct smbios_type_2 {
     uint8_t serial_number_str;
 } __attribute__ ((packed));
 
+/* System Enclosure - Contained Elements */
+struct smbios_contained_element {
+        uint8_t type;
+        uint8_t minimum;
+        uint8_t maximum;
+} __attribute__ ((packed));
+
 /* SMBIOS type 3 - System Enclosure */
 struct smbios_type_3 {
     struct smbios_structure_header header;
@@ -104,6 +111,12 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
+    uint32_t oem_specific;
+    uint8_t height;
+    uint8_t number_of_power_cords;
+    uint8_t contained_element_count;
+    uint8_t contained_element_length;
+    struct smbios_contained_element contained_elements[];
 } __attribute__ ((packed));
 
 /* SMBIOS type 4 - Processor Information */
@@ -121,6 +134,12 @@ struct smbios_type_4 {
     uint16_t current_speed;
     uint8_t status;
     uint8_t upgrade;
+    uint16_t l1_cache_handle;
+    uint16_t l2_cache_handle;
+    uint16_t l3_cache_handle;
+    uint8_t serial_number_str;
+    uint8_t asset_tag_str;
+    uint8_t part_number_str;
 } __attribute__ ((packed));
 
 /* SMBIOS type 11 - OEM Strings */
@@ -158,6 +177,11 @@ struct smbios_type_17 {
     uint8_t bank_locator_str;
     uint8_t memory_type;
     uint16_t type_detail;
+    uint16_t speed;
+    uint8_t manufacturer_str;
+    uint8_t serial_number_str;
+    uint8_t asset_tag_str;
+    uint8_t part_number_str;
 } __attribute__ ((packed));
 
 /* SMBIOS type 19 - Memory Array Mapped Address */
-- 
2.11.0 (Apple Git-81)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.