* [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
@ 2015-08-16 2:26 David Michael
2015-08-17 19:31 ` Leif Lindholm
2015-08-21 12:12 ` Andrei Borzenkov
0 siblings, 2 replies; 6+ messages in thread
From: David Michael @ 2015-08-16 2:26 UTC (permalink / raw)
To: grub-devel; +Cc: arvidjaar, phcoder
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
2015-08-16 2:26 [PATCH v4 1/2] Add support for SMBIOS3 entry point structures David Michael
@ 2015-08-17 19:31 ` Leif Lindholm
2015-08-26 16:51 ` David Michael
2015-08-21 12:12 ` Andrei Borzenkov
1 sibling, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2015-08-17 19:31 UTC (permalink / raw)
To: David Michael; +Cc: grub-devel
Hi David,
Splendid timing. SMBIOS 3.0 support, as well as SMBIOS support for
ARM* platforms is just about to go into upstream QEMU.
I can confirm that with these patches, and a recent EDK2 build of
"ArmVirtPkg" for arm64, your example command line works:
grub> smbios --type 1 --get-string 4
QEMU
grub>
GRUB also finds both the SMBIOS and SMBIOS3 entry points.
For someone who would like to try this out themselves, I've taken the
two remaining patches from Wei Huang and stuck them on top of current
QEMU HEAD in a branch at:
https://git.linaro.org/people/leif.lindholm/qemu.git/shortlog/refs/heads/virt-smbios
Build it with
./configure --prefix=/usr/local --target-list=aarch64-softmmu
make -j8
sudo make install
Then grab
http://snapshots.linaro.org/components/kernel/linaro-edk2-prep/GCC49/13/release/qemu64/QEMU_EFI.fd
And launch QEMU with
qemu-system-aarch64 -nographic -M virt -cpu cortex-a57 -hda fat:<directory> -bios QEMU_EFI.fd
where you have a suitable grub binary (I use grub-mkstandalone) in
<directory>.
/
Leif
On Sat, Aug 15, 2015 at 10:26:56PM -0400, David Michael wrote:
> 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
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
2015-08-17 19:31 ` Leif Lindholm
@ 2015-08-26 16:51 ` David Michael
0 siblings, 0 replies; 6+ messages in thread
From: David Michael @ 2015-08-26 16:51 UTC (permalink / raw)
To: Leif Lindholm; +Cc: The development of GNU GRUB
On Mon, Aug 17, 2015 at 3:31 PM, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> I can confirm that with these patches, and a recent EDK2 build of
> "ArmVirtPkg" for arm64, your example command line works:
> grub> smbios --type 1 --get-string 4
> QEMU
> grub>
>
> GRUB also finds both the SMBIOS and SMBIOS3 entry points.
Thanks for testing this on ARM. I've added an SMBIOS3 EPS to SeaBIOS
to test it on non-EFI platforms, which seems to work. I think that
covers all the platforms that build the module now.
The SeaBIOS patch for testing is pasted below.
David
--- src/fw/biostables.c
+++ src/fw/biostables.c
@@ -268,6 +268,31 @@
return prev;
}
+static void
+copy_smbios_to_smbios3(struct smbios_entry_point *ep)
+{
+ struct smbios3_entry_point ep3;
+ memset(&ep3, 0, sizeof(ep3));
+ memcpy(ep3.signature, "_SM3_", 5);
+ ep3.length = 0x18;
+ ep3.entry_point_revision = 1;
+
+ ep3.smbios_major_version = ep->smbios_major_version;
+ ep3.smbios_minor_version = ep->smbios_minor_version;
+ ep3.structure_table_maximum_size = (u32)ep->structure_table_length;
+ ep3.structure_table_address = (u64)ep->structure_table_address;
+
+ ep3.checksum -= checksum(&ep3, ep3.length);
+
+ struct smbios3_entry_point *newep3 = malloc_fseg(ep3.length);
+ if (!newep3) {
+ warn_noalloc();
+ return;
+ }
+ dprintf(1, "Building SMBIOS3 entry point from %p to %p\n", ep, newep3);
+ memcpy(newep3, &ep, ep3.length);
+}
+
struct smbios_entry_point *SMBiosAddr;
void
@@ -291,6 +316,7 @@
}
dprintf(1, "Copying SMBIOS entry point from %p to %p\n", pos, newpos);
memcpy(newpos, pos, p->length);
+ copy_smbios_to_smbios3(newpos);
SMBiosAddr = newpos;
}
--- src/std/smbios.h
+++ src/std/smbios.h
@@ -25,6 +25,19 @@
u8 smbios_bcd_revision;
} PACKED;
+struct smbios3_entry_point {
+ u8 signature[5]; // "_SM3_"
+ u8 checksum;
+ u8 length;
+ u8 smbios_major_version;
+ u8 smbios_minor_version;
+ u8 smbios_docrev;
+ u8 entry_point_revision;
+ u8 reserved;
+ u32 structure_table_maximum_size;
+ u64 structure_table_address;
+} PACKED;
+
/* This goes at the beginning of every SMBIOS structure. */
struct smbios_structure_header {
u8 type;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
2015-08-16 2:26 [PATCH v4 1/2] Add support for SMBIOS3 entry point structures David Michael
2015-08-17 19:31 ` Leif Lindholm
@ 2015-08-21 12:12 ` Andrei Borzenkov
2015-08-26 17:01 ` David Michael
1 sibling, 1 reply; 6+ messages in thread
From: Andrei Borzenkov @ 2015-08-21 12:12 UTC (permalink / raw)
To: David Michael; +Cc: The development of GNU GRUB, Vladimir Serbinenko
On Sun, Aug 16, 2015 at 5:26 AM, David Michael <fedora.dm0@gmail.com> wrote:
> 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 ++++++++++++++---
I am not sure we want to touch it. From what I could gather it had
been used as workaround for lack of proper EFI support in Linux kernel
long ago and it is unlikely any system that required it would have
SMBIOS v3.
> grub-core/commands/efi/lsefisystab.c | 1 +
> grub-core/efiemu/i386/pc/cfgtables.c | 38 ++++++++++++++++++++++++++----------
More or less the same. efiemu is used for (assuming it is still used
by anyone) for Apple systems only, so unless Apple actually supports
SMBIOS v3 it is probably better to leave it.
lsefisystab is always good of course :)
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
2015-08-21 12:12 ` Andrei Borzenkov
@ 2015-08-26 17:01 ` David Michael
2015-09-20 4:48 ` Andrei Borzenkov
0 siblings, 1 reply; 6+ messages in thread
From: David Michael @ 2015-08-26 17:01 UTC (permalink / raw)
To: Andrei Borzenkov; +Cc: The development of GNU GRUB, Vladimir Serbinenko
On Fri, Aug 21, 2015 at 8:12 AM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> On Sun, Aug 16, 2015 at 5:26 AM, David Michael <fedora.dm0@gmail.com> wrote:
>> grub-core/commands/efi/loadbios.c | 18 ++++++++++++++---
>
> I am not sure we want to touch it. From what I could gather it had
> been used as workaround for lack of proper EFI support in Linux kernel
> long ago and it is unlikely any system that required it would have
> SMBIOS v3.
>
>> grub-core/commands/efi/lsefisystab.c | 1 +
>> grub-core/efiemu/i386/pc/cfgtables.c | 38 ++++++++++++++++++++++++++----------
>
> More or less the same. efiemu is used for (assuming it is still used
> by anyone) for Apple systems only, so unless Apple actually supports
> SMBIOS v3 it is probably better to leave it.
I haven't tried any recent Apple systems, but in my quest to find v3
hardware, I looked at a MacBook Air from a generation or two ago. It
only supported v2.4.
Do you want an updated patch, or is this usable with those files'
changes deleted?
Thanks.
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
2015-08-26 17:01 ` David Michael
@ 2015-09-20 4:48 ` Andrei Borzenkov
0 siblings, 0 replies; 6+ messages in thread
From: Andrei Borzenkov @ 2015-09-20 4:48 UTC (permalink / raw)
To: David Michael; +Cc: The development of GNU GRUB, Vladimir Serbinenko
26.08.2015 20:01, David Michael пишет:
> On Fri, Aug 21, 2015 at 8:12 AM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>> On Sun, Aug 16, 2015 at 5:26 AM, David Michael <fedora.dm0@gmail.com> wrote:
>>> grub-core/commands/efi/loadbios.c | 18 ++++++++++++++---
>>
>> I am not sure we want to touch it. From what I could gather it had
>> been used as workaround for lack of proper EFI support in Linux kernel
>> long ago and it is unlikely any system that required it would have
>> SMBIOS v3.
>>
>>> grub-core/commands/efi/lsefisystab.c | 1 +
>>> grub-core/efiemu/i386/pc/cfgtables.c | 38 ++++++++++++++++++++++++++----------
>>
>> More or less the same. efiemu is used for (assuming it is still used
>> by anyone) for Apple systems only, so unless Apple actually supports
>> SMBIOS v3 it is probably better to leave it.
>
> I haven't tried any recent Apple systems, but in my quest to find v3
> hardware, I looked at a MacBook Air from a generation or two ago. It
> only supported v2.4.
>
> Do you want an updated patch, or is this usable with those files'
> changes deleted?
>
Update patch would be nice. Thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-20 4:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-16 2:26 [PATCH v4 1/2] Add support for SMBIOS3 entry point structures David Michael
2015-08-17 19:31 ` 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
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).