qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2, Ping] SMBIOS: Upgrade Type17 to v2.3, add Type2
@ 2014-02-17 16:09 Gabriel L. Somlo
  2014-02-17 20:33 ` Kevin O'Connor
  0 siblings, 1 reply; 35+ messages in thread
From: Gabriel L. Somlo @ 2014-02-17 16:09 UTC (permalink / raw)
  To: seabios, qemu-devel; +Cc: pbonzini, kevin, agraf

Add v2.3 fields to Type 17 (Memory Device) structure.
Add Type 2 (Baseboard) structure.

"About This Mac" on OS X guests will crash and restart the GUI if
Type 17 structures are not compliant with at least v2.3 of the
SMBIOS/DMI spec.

OS X 10.7 and 10.8 will panic during boot if a Type 2 (Baseboard)
structure is not present in the SMBIOS.

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

On Fri, Feb 07, 2014 at 04:37:58PM +0100, Paolo Bonzini wrote:
>Il 06/02/2014 14:38, Gabriel L. Somlo ha scritto:
>>On Wed, Feb 05, 2014 at 08:02:25PM -0500, Kevin O'Connor wrote:
>>> Thanks.  In general, though, it is preferred to make smbios changes at
>>> the QEMU layer.  Indeed, going forward, I'd like to see all the smbios
>>> stuff moved up to QEMU.
>>>
>>> Is there something in these two patches that can't be done in QEMU?
>>
>> But anyhow, right now QEMU seems to be making relatively minor tweaks
>> to something that's firmly at home in SeaBIOS, which is why I sent my
>> patches to the latter...
>
>Yeah, that's correct. There's really no particular hook in QEMU to do this.

Would it be OK to apply this in SeaBIOS now, so that 1. it can be
useful until whenever SMBIOS gets transferred/absorbed into QEMU,
and 2. it won't fall through the cracks when that transition happens ?

Thanks much,
   Gabriel

 src/fw/smbios.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/std/smbios.h | 22 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index 55c662a..5b76468 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c
@@ -251,6 +251,41 @@ smbios_init_type_1(void *start)
     return end;
 }
 
+/* Type 2 -- Base Board */
+static void *
+smbios_init_type_2(void *start)
+{
+    struct smbios_type_2 *p = (struct smbios_type_2 *)start;
+    char *end = (char *)start + sizeof(struct smbios_type_2);
+    size_t size;
+    int str_index = 0;
+
+    p->header.type = 2;
+    p->header.length = sizeof(struct smbios_type_2);
+    p->header.handle = 0x200;
+
+    load_str_field_with_default(2, manufacturer_str, BUILD_APPNAME);
+    load_str_field_or_skip(2, product_str);
+    load_str_field_or_skip(2, version_str);
+    load_str_field_or_skip(2, serial_number_str);
+    load_str_field_or_skip(2, asset_tag_number_str);
+    load_str_field_or_skip(2, location_str);
+
+    set_field_with_default(2, feature_flags, 0x01); /* Motherboard */
+    set_field_with_default(2, chassis_handle, 0x300); /* T3 System Enclosure */
+    set_field_with_default(2, board_type, 0x0a); /* Motherboard */
+    set_field_with_default(2, contained_element_count, 0);
+
+    *end = 0;
+    end++;
+    if (!str_index) {
+        *end = 0;
+        end++;
+    }
+
+    return end;
+}
+
 /* Type 3 -- System Enclosure */
 static void *
 smbios_init_type_3(void *start)
@@ -417,6 +452,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) {
@@ -540,6 +581,7 @@ smbios_setup(void)
 
     add_struct(0, p);
     add_struct(1, p);
+    add_struct(2, p);
     add_struct(3, p);
 
     int cpu_num;
diff --git a/src/std/smbios.h b/src/std/smbios.h
index 0513716..86a4c57 100644
--- a/src/std/smbios.h
+++ b/src/std/smbios.h
@@ -59,6 +59,22 @@ struct smbios_type_1 {
     u8 family_str;
 } PACKED;
 
+/* SMBIOS type 2 - Base Board */
+struct smbios_type_2 {
+    struct smbios_structure_header header;
+    u8 manufacturer_str;
+    u8 product_str;
+    u8 version_str;
+    u8 serial_number_str;
+    u8 asset_tag_number_str;
+    u8 feature_flags;
+    u8 location_str;
+    u16 chassis_handle;
+    u8 board_type;
+    u8 contained_element_count;
+    // contained elements follow
+} PACKED;
+
 /* SMBIOS type 3 - System Enclosure (v2.3) */
 struct smbios_type_3 {
     struct smbios_structure_header header;
@@ -127,6 +143,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 */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2014-03-09 23:44 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-17 16:09 [Qemu-devel] [PATCH v2, Ping] SMBIOS: Upgrade Type17 to v2.3, add Type2 Gabriel L. Somlo
2014-02-17 20:33 ` Kevin O'Connor
2014-02-18 10:21   ` Gerd Hoffmann
2014-02-18 19:17     ` Gabriel L. Somlo
2014-02-18 20:02       ` Kevin O'Connor
2014-02-19  9:46         ` Gerd Hoffmann
2014-02-19 22:03         ` [Qemu-devel] [PATCH v3] SMBIOS: Update Type 4, 17 structs to v2.3 of the spec Gabriel L. Somlo
2014-02-18 21:08       ` [Qemu-devel] [PATCH v2, Ping] SMBIOS: Upgrade Type17 to v2.3, add Type2 Laszlo Ersek
2014-02-18 21:28         ` Laszlo Ersek
2014-02-19  9:59       ` Gerd Hoffmann
2014-02-19 20:40         ` Gabriel L. Somlo
2014-02-19 22:20           ` Laszlo Ersek
2014-02-20 15:27           ` Gerd Hoffmann
2014-02-20 15:38             ` Gabriel L. Somlo
2014-02-20 15:42               ` Gabriel L. Somlo
2014-02-20 16:32                 ` Gabriel L. Somlo
2014-02-20 18:07               ` Laszlo Ersek
2014-03-04 19:19                 ` [Qemu-devel] [PATCH 1/2] QEMU: SMBIOS: Update all structs to v2.3; Add type 2 struct Gabriel L. Somlo
2014-03-04 19:20                 ` [Qemu-devel] [PATCH 2/2 (RFC)] QEMU: SMBIOS: Build full smbios tables Gabriel L. Somlo
2014-03-04 20:34                   ` Kevin O'Connor
2014-03-05 10:59                   ` Gerd Hoffmann
2014-03-05 14:48                     ` Gabriel L. Somlo
2014-03-06  9:03                       ` Gerd Hoffmann
2014-03-06 16:09                         ` Gabriel L. Somlo
2014-03-06 17:04                           ` Laszlo Ersek
2014-03-09  2:57                             ` [Qemu-devel] " Gabriel L. Somlo
2014-03-09 19:18                               ` Laszlo Ersek
2014-03-09 23:40                                 ` Gabriel L. Somlo
2014-03-09  3:01                             ` [Qemu-devel] [PATCH 1/7] SMBIOS: Update all table definitions to smbios spec v2.3 Gabriel L. Somlo
2014-03-09  3:01                             ` [Qemu-devel] [PATCH 2/7] SMBIOS: Rename smbios_set_type1_defaults() for more general use Gabriel L. Somlo
2014-03-09  3:02                             ` [Qemu-devel] [PATCH 3/7] SMBIOS: Streamline setting smbios defaults with macro Gabriel L. Somlo
2014-03-09  3:03                             ` [Qemu-devel] [PATCH 4/7] SMBIOS: Replace type collision check mechanism with bitmaps Gabriel L. Somlo
2014-03-09  3:04                             ` [Qemu-devel] [PATCH 5/7] SMBIOS: Add code to build full smbios tables Gabriel L. Somlo
2014-03-09  3:05                             ` [Qemu-devel] [PATCH 6/7] SMBIOS: Build full tables for types 0 and 1 Gabriel L. Somlo
2014-03-09  3:05                             ` [Qemu-devel] [PATCH 7/7] SMBIOS: Remove unused code for passing individual fields to bios Gabriel L. Somlo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).