From: "Gabriel L. Somlo" <gsomlo@gmail.com>
To: qemu-devel@nongnu.org
Cc: agraf@suse.de, gsomlo@gmail.com, armbru@redhat.com,
alex.williamson@redhat.com, kevin@koconnor.net,
kraxel@redhat.com, lersek@redhat.com
Subject: [Qemu-devel] [v2 PATCH 06/13] SMBIOS: Build full tables for types 0 and 1
Date: Tue, 11 Mar 2014 11:16:22 -0400 [thread overview]
Message-ID: <1394550989-693-7-git-send-email-somlo@cmu.edu> (raw)
In-Reply-To: <1394550989-693-1-git-send-email-somlo@cmu.edu>
From: "Gabriel L. Somlo" <somlo@cmu.edu>
Build full tables for types 0 (bios information) and 1 (system
information). Type 0 is optional, and a table will only be built
if requested via the command line; the default is to leave type 0
tables up to the bios itself.
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
---
hw/i386/smbios.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
index 9679e06..1a7e2b5 100644
--- a/hw/i386/smbios.c
+++ b/hw/i386/smbios.c
@@ -352,6 +352,62 @@ static void smbios_build_type_1_fields(void)
}
}
+static void smbios_build_type_0_table(void)
+{
+ SMBIOS_BUILD_TABLE_PRE(0, 0x000, false); /* optional, leave up to BIOS */
+
+ SMBIOS_TABLE_SET_STR(0, vendor_str, type0.vendor);
+ SMBIOS_TABLE_SET_STR(0, bios_version_str, type0.version);
+
+ t->bios_starting_address_segment = 0xE800; /* hardcoded in SeaBIOS */
+
+ SMBIOS_TABLE_SET_STR(0, bios_release_date_str, type0.date);
+
+ t->bios_rom_size = 0; /* hardcoded in SeaBIOS with FIXME comment */
+
+ /* BIOS characteristics not supported */
+ memset(t->bios_characteristics, 0, 8);
+ t->bios_characteristics[0] = 0x08;
+
+ /* Enable targeted content distribution (needed for SVVP, per SeaBIOS) */
+ t->bios_characteristics_extension_bytes[0] = 0;
+ t->bios_characteristics_extension_bytes[1] = 4;
+
+ if (type0.have_major_minor) {
+ t->system_bios_major_release = type0.major;
+ t->system_bios_minor_release = type0.minor;
+ } else {
+ t->system_bios_major_release = 0;
+ t->system_bios_minor_release = 0;
+ }
+
+ /* hardcoded in SeaBIOS */
+ t->embedded_controller_major_release = 0xFF;
+ t->embedded_controller_minor_release = 0xFF;
+
+ SMBIOS_BUILD_TABLE_POST;
+}
+
+static void smbios_build_type_1_table(void)
+{
+ SMBIOS_BUILD_TABLE_PRE(1, 0x100, true); /* required */
+
+ SMBIOS_TABLE_SET_STR(1, manufacturer_str, type1.manufacturer);
+ SMBIOS_TABLE_SET_STR(1, product_name_str, type1.product);
+ SMBIOS_TABLE_SET_STR(1, version_str, type1.version);
+ SMBIOS_TABLE_SET_STR(1, serial_number_str, type1.serial);
+ if (qemu_uuid_set) {
+ memcpy(t->uuid, qemu_uuid, 16);
+ } else {
+ memset(t->uuid, 0, 16);
+ }
+ t->wake_up_type = 0x06; /* power switch */
+ SMBIOS_TABLE_SET_STR(1, sku_number_str, type1.sku);
+ SMBIOS_TABLE_SET_STR(1, family_str, type1.family);
+
+ SMBIOS_BUILD_TABLE_POST;
+}
+
static void smbios_build_type_2_table(void)
{
SMBIOS_BUILD_TABLE_PRE(2, 0x200, false); /* optional */
@@ -379,6 +435,9 @@ void smbios_set_defaults(const char *manufacturer,
const char *product, const char *version)
{
smbios_have_defaults = true;
+ SMBIOS_SET_DEFAULT(type0.vendor, manufacturer);
+ SMBIOS_SET_DEFAULT(type0.version, version);
+ SMBIOS_SET_DEFAULT(type0.date, "01/01/2014");
SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
SMBIOS_SET_DEFAULT(type1.product, product);
SMBIOS_SET_DEFAULT(type1.version, version);
@@ -390,9 +449,13 @@ void smbios_set_defaults(const char *manufacturer,
uint8_t *smbios_get_table(size_t *length)
{
if (!smbios_immutable) {
+ smbios_build_type_0_table();
+ smbios_build_type_1_table();
smbios_build_type_2_table();
+if (false) { /* shut up gcc until we remove deprecated code */
smbios_build_type_0_fields();
smbios_build_type_1_fields();
+}
smbios_validate_table();
smbios_immutable = true;
}
--
1.8.1.4
next prev parent reply other threads:[~2014-03-11 15:20 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 16:56 [Qemu-devel] SMBIOS (Set of 10 patches) Gabriel L. Somlo
2014-03-10 17:55 ` Eric Blake
2014-03-10 18:17 ` Gabriel L. Somlo
2014-03-10 18:31 ` Gabriel L. Somlo
2014-03-10 19:14 ` Eric Blake
2014-03-10 19:22 ` Eric Blake
2014-03-10 19:31 ` Eric Blake
2014-03-11 10:03 ` Gerd Hoffmann
2014-03-11 13:27 ` Kevin O'Connor
2014-03-12 8:31 ` Gerd Hoffmann
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 00/13] SMBIOS: build full tables in QEMU Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 01/13] SMBIOS: Update all table definitions to smbios spec v2.3 Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 02/13] SMBIOS: Rename smbios_set_type1_defaults() for more general use Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 03/13] SMBIOS: Use macro to set smbios defaults Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 04/13] SMBIOS: Use bitmaps to check for smbios table collisions Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 05/13] SMBIOS: Add code to build full smbios tables; build type 2 table Gabriel L. Somlo
2014-03-11 16:28 ` [Qemu-devel] [v3 " Gabriel L. Somlo
2014-03-11 15:16 ` Gabriel L. Somlo [this message]
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 07/13] SMBIOS: Remove unused code for passing individual fields to bios Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 08/13] SMBIOS: Build full type 3 table Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 09/13] SMBIOS: Build full type 4 tables Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 10/13] SMBIOS: Build full smbios v2.3 compliant type 16 and 17 tables Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 11/13] SMBIOS: Build full type 19 tables Gabriel L. Somlo
2014-03-12 8:27 ` Gerd Hoffmann
2014-03-12 13:05 ` Gabriel L. Somlo
2014-03-12 13:24 ` Gerd Hoffmann
2014-03-12 14:44 ` Gabriel L. Somlo
2014-03-12 15:51 ` Gerd Hoffmann
2014-03-12 16:45 ` Gabriel L. Somlo
2014-03-12 18:04 ` Gabriel L. Somlo
2014-03-12 18:17 ` Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 12/13] SMBIOS: Build full type 20 tables Gabriel L. Somlo
2014-03-11 15:16 ` [Qemu-devel] [v2 PATCH 13/13] SMBIOS: Build full tables for type 32 and 127 Gabriel L. Somlo
2014-03-11 15:46 ` [Qemu-devel] [v2 PATCH 00/13] SMBIOS: build full tables in QEMU Kevin O'Connor
2014-03-11 16:58 ` Gabriel L. Somlo
2014-03-12 8:20 ` Gerd Hoffmann
2014-03-12 16:39 ` [Qemu-devel] [v3 " Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 01/13] SMBIOS: Rename smbios_set_type1_defaults() for more general use Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 02/13] SMBIOS: Use macro to set smbios defaults Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 03/13] SMBIOS: Use bitmaps to check for smbios table collisions Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 04/13] SMBIOS: Add code to build full smbios tables; build type 2 table Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 05/13] SMBIOS: Build full tables for types 0 and 1 Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 06/13] SMBIOS: Remove unused code for passing individual fields to bios Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 07/13] SMBIOS: Build full type 3 table Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 08/13] SMBIOS: Build full type 4 tables Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 09/13] SMBIOS: Build full smbios type 16 and 17 tables Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 10/13] SMBIOS: Build full type 19 tables Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 11/13] SMBIOS: Build full type 20 tables Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 12/13] SMBIOS: Build full tables for type 32 and 127 Gabriel L. Somlo
2014-03-12 16:40 ` [Qemu-devel] [v3 PATCH 13/13] SMBIOS: Update all table definitions to smbios spec v2.3 Gabriel L. Somlo
2014-03-12 16:48 ` [Qemu-devel] [v3 PATCH 00/13] SMBIOS: build full tables in QEMU Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394550989-693-7-git-send-email-somlo@cmu.edu \
--to=gsomlo@gmail.com \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=kevin@koconnor.net \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).