From: David Michael <fedora.dm0@gmail.com>
To: grub-devel@gnu.org
Cc: arvidjaar@gmail.com, phcoder@gmail.com
Subject: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
Date: Sat, 15 Aug 2015 22:26:56 -0400 [thread overview]
Message-ID: <87a8tsnf2n.fsf@gmail.com> (raw)
If both SMBIOS v2 and v3 entry point structures are found, both are
registered instead of preferring one version since they can point
to different tables at different memory locations.
This also modifies the fakebios command so that the entire SMBIOS
(v2) EPS is copied instead of just the intermediate DMI structure.
---
Hi,
Sorry for the long delay with the SMBIOS update.
This patch adds the SMBIOS v3 entry points to the other locations where
v2 is supported, so in case the patch with the new command needs more
work, maybe this can still be applied to add the new table definition.
I haven't actually been able to locate any machines supporting the
SMBIOS v3.0.0 specification. The best I managed was building and
running a virtual EFI firmware image that supported SMBIOS3_TABLE_GUID,
but this is untested other than that.
David
grub-core/commands/efi/loadbios.c | 18 ++++++++++++++---
grub-core/commands/efi/lsefisystab.c | 1 +
grub-core/efiemu/i386/pc/cfgtables.c | 38 ++++++++++++++++++++++++++----------
include/grub/efi/api.h | 5 +++++
4 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/grub-core/commands/efi/loadbios.c b/grub-core/commands/efi/loadbios.c
index 132cadb..b34cf15 100644
--- a/grub-core/commands/efi/loadbios.c
+++ b/grub-core/commands/efi/loadbios.c
@@ -30,6 +30,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
+static grub_efi_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
#define EBDA_SEG_ADDR 0x40e
#define LOW_MEM_ADDR 0x413
@@ -93,7 +94,7 @@ static void
fake_bios_data (int use_rom)
{
unsigned i;
- void *acpi, *smbios;
+ void *acpi, *smbios, *smbios3;
grub_uint16_t *ebda_seg_ptr, *low_mem_ptr;
ebda_seg_ptr = (grub_uint16_t *) EBDA_SEG_ADDR;
@@ -103,6 +104,7 @@ fake_bios_data (int use_rom)
acpi = 0;
smbios = 0;
+ smbios3 = 0;
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
{
grub_efi_packed_guid_t *guid =
@@ -127,6 +129,11 @@ fake_bios_data (int use_rom)
smbios = grub_efi_system_table->configuration_table[i].vendor_table;
grub_dprintf ("efi", "SMBIOS: %p\n", smbios);
}
+ else if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_efi_guid_t)))
+ {
+ smbios3 = grub_efi_system_table->configuration_table[i].vendor_table;
+ grub_dprintf ("efi", "SMBIOS3: %p\n", smbios3);
+ }
}
*ebda_seg_ptr = FAKE_EBDA_SEG;
@@ -137,8 +144,13 @@ fake_bios_data (int use_rom)
if (acpi)
grub_memcpy ((char *) ((FAKE_EBDA_SEG << 4) + 16), acpi, 1024 - 16);
- if ((use_rom) && (smbios))
- grub_memcpy ((char *) SBIOS_ADDR, (char *) smbios + 16, 16);
+ if (use_rom)
+ {
+ if (smbios)
+ grub_memcpy ((char *) SBIOS_ADDR, (char *) smbios, 31);
+ if (smbios3)
+ grub_memcpy ((char *) SBIOS_ADDR + 32, (char *) smbios3, 24);
+ }
}
static grub_err_t
diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c
index 8717db9..256af43 100644
--- a/grub-core/commands/efi/lsefisystab.c
+++ b/grub-core/commands/efi/lsefisystab.c
@@ -39,6 +39,7 @@ static const struct guid_mapping guid_mappings[] =
{ GRUB_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"},
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
+ { GRUB_EFI_SMBIOS3_TABLE_GUID, "SMBIOS3"},
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"}
};
diff --git a/grub-core/efiemu/i386/pc/cfgtables.c b/grub-core/efiemu/i386/pc/cfgtables.c
index 492c07c..ff4e10e 100644
--- a/grub-core/efiemu/i386/pc/cfgtables.c
+++ b/grub-core/efiemu/i386/pc/cfgtables.c
@@ -30,12 +30,17 @@ grub_machine_efiemu_init_tables (void)
void *table;
grub_err_t err;
grub_efi_guid_t smbios = GRUB_EFI_SMBIOS_TABLE_GUID;
+ grub_efi_guid_t smbios3 = GRUB_EFI_SMBIOS3_TABLE_GUID;
grub_efi_guid_t acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
grub_efi_guid_t acpi = GRUB_EFI_ACPI_TABLE_GUID;
+ grub_uint8_t found_smbios = 0;
err = grub_efiemu_unregister_configuration_table (smbios);
if (err)
return err;
+ err = grub_efiemu_unregister_configuration_table (smbios3);
+ if (err)
+ return err;
err = grub_efiemu_unregister_configuration_table (acpi);
if (err)
return err;
@@ -60,17 +65,30 @@ grub_machine_efiemu_init_tables (void)
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)
- if (grub_memcmp (ptr, "_SM_", 4) == 0
+ if (found_smbios != 2
+ && grub_memcmp (ptr, "_SM_", 4) == 0
&& grub_byte_checksum (ptr, *(ptr + 5)) == 0)
- break;
-
- if (ptr < (grub_uint8_t *) 0x100000)
- {
- grub_dprintf ("efiemu", "Registering SMBIOS\n");
- err = grub_efiemu_register_configuration_table (smbios, 0, 0, ptr);
- if (err)
- return err;
- }
+ {
+ grub_dprintf ("efiemu", "Registering SMBIOS\n");
+ err = grub_efiemu_register_configuration_table (smbios, 0, 0, ptr);
+ if (err)
+ return err;
+ if (found_smbios == 3)
+ break;
+ found_smbios = 2;
+ }
+ else if (found_smbios != 3
+ && grub_memcmp (ptr, "_SM3_", 5) == 0
+ && grub_byte_checksum (ptr, *(ptr + 6)) == 0)
+ {
+ grub_dprintf ("efiemu", "Registering SMBIOS3\n");
+ err = grub_efiemu_register_configuration_table (smbios3, 0, 0, ptr);
+ if (err)
+ return err;
+ if (found_smbios == 2)
+ break;
+ found_smbios = 3;
+ }
return GRUB_ERR_NONE;
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 1a5e38c..b96059d 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -266,6 +266,11 @@
{ 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
+#define GRUB_EFI_SMBIOS3_TABLE_GUID \
+ { 0xf2fd1544, 0x9794, 0x4a2c, \
+ { 0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94 } \
+ }
+
#define GRUB_EFI_SAL_TABLE_GUID \
{ 0xeb9d2d32, 0x2d88, 0x11d3, \
{ 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
--
2.1.0
next reply other threads:[~2015-08-16 2:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-16 2:26 David Michael [this message]
2015-08-17 19:31 ` [PATCH v4 1/2] Add support for SMBIOS3 entry point structures Leif Lindholm
2015-08-26 16:51 ` David Michael
2015-08-21 12:12 ` Andrei Borzenkov
2015-08-26 17:01 ` David Michael
2015-09-20 4:48 ` Andrei Borzenkov
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=87a8tsnf2n.fsf@gmail.com \
--to=fedora.dm0@gmail.com \
--cc=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.com \
/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).