Skip to contentSkip to conversation

Add support for SMBIOS3 entry point structures

PATCH In review David Michael 3 participants 6 messages Aug 16, 2015 – Sep 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 Add support for SMBIOS3 entry point structures

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(-)
grub-core/commands/efi/loadbios.c +15 -3
index 132cadb..b34cf15 100644
@@ -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
grub-core/commands/efi/lsefisystab.c +1 -0
index 8717db9..256af43 100644
@@ -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"}
   };
grub-core/efiemu/i386/pc/cfgtables.c +28 -10
index 492c07c..ff4e10e 100644
@@ -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;
 }
include/grub/efi/api.h +5 -0
index 1a5e38c..b96059d 100644
@@ -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 } \
Signature · 1 line
2.1.0
#1 lore raw

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

Quoted 185 lines · David Michael

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(-)
grub-core/commands/efi/loadbios.c +15 -3
index 132cadb..b34cf15 100644
@@ -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
grub-core/commands/efi/lsefisystab.c +1 -0
index 8717db9..256af43 100644
@@ -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"}
   };
grub-core/efiemu/i386/pc/cfgtables.c +28 -10
index 492c07c..ff4e10e 100644
@@ -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;
 }
include/grub/efi/api.h +5 -0
index 1a5e38c..b96059d 100644
@@ -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 } \
Signature · 7 lines
2.1.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw
Quoted 7 lines · Leif Lindholm

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

fw/biostables.c +26 -0
@@ -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;
 }
 
std/smbios.h +13 -0
@@ -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;
#3 lore raw
In reply to David Michael
Quoted 16 lines · David Michael

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.

Quoted 8 lines

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.

Quoted 2 lines
 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 :)

Quoted 154 lines
 include/grub/efi/api.h               |  5 +++++
 4 files changed, 49 insertions(+), 13 deletions(-)
grub-core/commands/efi/loadbios.c +15 -3
index 132cadb..b34cf15 100644
@@ -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
grub-core/commands/efi/lsefisystab.c +1 -0
index 8717db9..256af43 100644
@@ -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"}
   };
grub-core/efiemu/i386/pc/cfgtables.c +28 -10
index 492c07c..ff4e10e 100644
@@ -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;
 }
include/grub/efi/api.h +5 -1
index 1a5e38c..b96059d 100644
@@ -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

#4 lore raw
Quoted 8 lines · Andrei Borzenkov
Quoted 1 line · David Michael
 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.

Quoted 6 lines
Quoted 2 lines
 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

#5 lore raw

26.08.2015 20:01, David Michael пишет:

Quoted 16 lines · Andrei Borzenkov
Quoted 8 lines · David Michael
Quoted 1 line
  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.

Quoted 6 lines
Quoted 2 lines
  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.

Quoted 7 lines

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!