From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZQnf4-0006Kf-OO for mharc-grub-devel@gnu.org; Sat, 15 Aug 2015 22:27:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQnf2-0006HL-DC for grub-devel@gnu.org; Sat, 15 Aug 2015 22:27:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQnf1-0004Fl-7n for grub-devel@gnu.org; Sat, 15 Aug 2015 22:27:00 -0400 Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]:34270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQnf1-0004Fh-28 for grub-devel@gnu.org; Sat, 15 Aug 2015 22:26:59 -0400 Received: by qkcs67 with SMTP id s67so37091504qkc.1 for ; Sat, 15 Aug 2015 19:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type; bh=axWADZ9l83RGZSSlup8VkQBH5BsEpJfhUNwquyQWep0=; b=o+JWhA19bPIgxTkAoCc7PEwE/fUtJanjHJ2MKucPqdjfiOms/vOWHQSBUR3mLMWZZn E6vwTaTNeAKd4FEH/3MRt00Cax+1T69TITBGr8NZTDsQgT5aqytexM9DtP2QAOdapUyD YB9slUBU9cAxu3mwb3fwXMoPkmXur6nBTkl686zVEQOZCdqD78EXo+28AeQ6rwM/qNOc XMd1QjRdOy22e/Kg1hW1e2zyN0cGG2xso5Ntg+y8ChjqwtLU4PIdo0ZwTeCV8KHwwZOh tcHXN2QqBGzuzWM2kOwuAMMy30SLHin5opk6AstXgy5+TP8uOWgLbyBvkLp1FWkPeIdR FiHQ== X-Received: by 10.55.23.16 with SMTP id i16mr2241857qkh.53.1439692018070; Sat, 15 Aug 2015 19:26:58 -0700 (PDT) Received: from callisto ([2601:47:4001:be5e:9afe:94ff:fe42:121e]) by smtp.gmail.com with ESMTPSA id g30sm5811681qge.11.2015.08.15.19.26.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Aug 2015 19:26:57 -0700 (PDT) From: David Michael To: grub-devel@gnu.org Subject: [PATCH v4 1/2] Add support for SMBIOS3 entry point structures Date: Sat, 15 Aug 2015 22:26:56 -0400 Message-ID: <87a8tsnf2n.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c09::22f Cc: arvidjaar@gmail.com, phcoder@gmail.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2015 02:27:01 -0000 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