diff mbox

[v3] SMBIOS: Update Type 4, 17 structs to v2.3 of the spec

Message ID 20140219220303.GB25087@ERROL.INI.CMU.EDU
State New
Headers show

Commit Message

Gabriel L. Somlo Feb. 19, 2014, 10:03 p.m. UTC
Add v2.3 fields to Type 4 and 17 structures, to comply with the
major/minor smbios spec version (2.4) advertised in the smbios
entry point structure.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
---

On Tue, Feb 18, 2014 at 03:02:16PM -0500, Kevin O'Connor wrote:
> Thanks for running tests.  One thing that has bitten us in the past is
> OSes re-running license checks and/or popping up "new hardware"
> notifications on bios table changes.

Completely orthogonal to Type 2 (Base Board) and to the QEMU/smbios
conversation: Since SeaBIOS sets up the SMBIOS entry point structure
like this:

    ep->smbios_major_version = 2;
    ep->smbios_minor_version = 4;

shouldn't all type structures contain all fields required by v2.4 of
the spec, which means the type 17 struct missing v2.3 fields is actually
a bug ?

I had a feeling I should have kept the patches separate :)

Along these lines, we're also missing the following fields for Type 4:

    serial_number_str,
    asset_tag_number_str,
    part_number_str

I get that a new Type 2 suddenly showing up *might* confuse some guest
OSs, but what do you think about the type 4 and type 17 v2.3 fields ?

Thanks,
  Gabriel

 src/fw/smbios.c  | 10 ++++++++++
 src/std/smbios.h | 10 ++++++++++
 2 files changed, 20 insertions(+)
diff mbox

Patch

diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index 55c662a..f0cdd5c 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c
@@ -344,6 +344,10 @@  smbios_init_type_4(void *start, unsigned int cpu_number)
     p->l2_cache_handle =  0xffff;
     p->l3_cache_handle =  0xffff;
 
+    load_str_field_or_skip(4, serial_number_str);
+    load_str_field_or_skip(4, asset_tag_number_str);
+    load_str_field_or_skip(4, part_number_str);
+
     *end = 0;
     end++;
     if (!str_index) {
@@ -417,6 +421,12 @@  smbios_init_type_17(void *start, u32 size_mb, int instance)
     set_field_with_default(17, memory_type, 0x07); /* RAM */
     set_field_with_default(17, type_detail, 0);
 
+    set_field_with_default(17, speed, 0); /* unknown */
+    load_str_field_or_skip(17, manufacturer_str);
+    load_str_field_or_skip(17, serial_number_str);
+    load_str_field_or_skip(17, asset_tag_number_str);
+    load_str_field_or_skip(17, part_number_str);
+
     *end = 0;
     end++;
     if (!str_index) {
diff --git a/src/std/smbios.h b/src/std/smbios.h
index 0513716..7ae3968 100644
--- a/src/std/smbios.h
+++ b/src/std/smbios.h
@@ -96,6 +96,10 @@  struct smbios_type_4 {
     u16 l1_cache_handle;
     u16 l2_cache_handle;
     u16 l3_cache_handle;
+    /* v2.3 fields: */
+    u8 serial_number_str;
+    u8 asset_tag_number_str;
+    u8 part_number_str;
 } PACKED;
 
 /* SMBIOS type 16 - Physical Memory Array
@@ -127,6 +131,12 @@  struct smbios_type_17 {
     u8 bank_locator_str;
     u8 memory_type;
     u16 type_detail;
+    /* v2.3 fields: */
+    u16 speed;
+    u8 manufacturer_str;
+    u8 serial_number_str;
+    u8 asset_tag_number_str;
+    u8 part_number_str;
 } PACKED;
 
 /* SMBIOS type 19 - Memory Array Mapped Address */