grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures


From: David Michael
Subject: Re: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures
Date: Wed, 26 Aug 2015 12:51:12 -0400

On Mon, Aug 17, 2015 at 3:31 PM, Leif Lindholm <address@hidden> 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]