"Extend uefi-test-tools to report SMBIOS location".
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJczAWHAAoJENOdpx4NSWz6lvoQAIH1k3S7SHx8NKALvmravHoG
 OVyjlURRSY4H0tdtXjyXe4LlsglKKlCKUWJxqTwExHhRqw6Ab98Je4d3euLk9V1W
 2Jgao96K8pcR8f2VdjapNToNY+Of/S+1+Cu07Hch1DlLb+SZFxYL1oO3xKQvLGfH
 J/FQZ3cxaM1bfUJsQcRfeIfsd/G7I49y1qz8ItQ5F7Wqc0BsLTHRRBiqhD+D88O3
 eQaCjQAmgu/evyxqBFClqTFAg4MS56PjTCrf/7S4FrX6DZZRiF1tGmErnKzV2Hmu
 cAbIM+34GSApNClH3jpPNLXUxtGugemlPoqUiyYQpOh5bWZu0LisURVS38noi4qz
 DUx7fBZduu/iMAlpoN3np9GoxbVh7nxZgmWDtmyedhX4zHtUbNTK7xfzX3+ZHDFP
 Iaj6v6uQjQR3C1PMDNBU2a/swBkBid2KlxhTQfkfR9yJv2LPZfBbB1pNVFTw78RO
 BlWMLjahTSpJHRB4JBG4BRy1DkJq80ZFW3xoQwU1jnQby6h4qvQpMo8lCWZ2+50w
 qg62tKP1andUyERxw/IisZ9HGOYkRtwkoZo1QAsMSAs024SPwBc5Pcij1lXI8cQI
 SP52Dcr+4VUjFR00Xagfn9Izt6SrIXxLfsi+Rx+3ytW5JiHQ3aaaMInaF8MD4WVY
 twRp4SnQGnlyp066OBOv
 =Lu/A
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/lersek/tags/smbios_lp_1821884_20190503' into staging

Fix <https://bugs.launchpad.net/qemu/+bug/1821884>:
"Extend uefi-test-tools to report SMBIOS location".

# gpg: Signature made Fri 03 May 2019 10:10:31 BST
# gpg:                using RSA key D39DA71E0D496CFA
# gpg: Good signature from "Laszlo Ersek <lersek@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: F5D9 660F 1BA5 F310 A95A  C5E0 466A EAE0 6125 3988
#      Subkey fingerprint: B3A5 5D3F 88A8 90ED 2E63  3E8D D39D A71E 0D49 6CFA

* remotes/lersek/tags/smbios_lp_1821884_20190503:
  tests/uefi-boot-images: report the SMBIOS entry point structures
  tests/uefi-test-tools: report the SMBIOS entry point structures

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-05-03 14:57:35 +01:00
commit 5b396a8c36
7 changed files with 40 additions and 10 deletions

View File

@ -14,6 +14,7 @@
#include <Guid/Acpi.h> #include <Guid/Acpi.h>
#include <Guid/BiosTablesTest.h> #include <Guid/BiosTablesTest.h>
#include <Guid/SmBios.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
@ -55,6 +56,8 @@ BiosTablesTestMain (
volatile BIOS_TABLES_TEST *BiosTablesTest; volatile BIOS_TABLES_TEST *BiosTablesTest;
CONST VOID *Rsdp10; CONST VOID *Rsdp10;
CONST VOID *Rsdp20; CONST VOID *Rsdp20;
CONST VOID *Smbios21;
CONST VOID *Smbios30;
CONST EFI_CONFIGURATION_TABLE *ConfigTable; CONST EFI_CONFIGURATION_TABLE *ConfigTable;
CONST EFI_CONFIGURATION_TABLE *ConfigTablesEnd; CONST EFI_CONFIGURATION_TABLE *ConfigTablesEnd;
volatile EFI_GUID *InverseSignature; volatile EFI_GUID *InverseSignature;
@ -77,31 +80,43 @@ BiosTablesTestMain (
} }
// //
// Locate both gEfiAcpi10TableGuid and gEfiAcpi20TableGuid config tables in // Locate all the gEfiAcpi10TableGuid, gEfiAcpi20TableGuid,
// one go. // gEfiSmbiosTableGuid, gEfiSmbios3TableGuid config tables in one go.
// //
Rsdp10 = NULL; Rsdp10 = NULL;
Rsdp20 = NULL; Rsdp20 = NULL;
Smbios21 = NULL;
Smbios30 = NULL;
ConfigTable = gST->ConfigurationTable; ConfigTable = gST->ConfigurationTable;
ConfigTablesEnd = gST->ConfigurationTable + gST->NumberOfTableEntries; ConfigTablesEnd = gST->ConfigurationTable + gST->NumberOfTableEntries;
while ((Rsdp10 == NULL || Rsdp20 == NULL) && ConfigTable < ConfigTablesEnd) { while ((Rsdp10 == NULL || Rsdp20 == NULL ||
Smbios21 == NULL || Smbios30 == NULL) &&
ConfigTable < ConfigTablesEnd) {
if (CompareGuid (&ConfigTable->VendorGuid, &gEfiAcpi10TableGuid)) { if (CompareGuid (&ConfigTable->VendorGuid, &gEfiAcpi10TableGuid)) {
Rsdp10 = ConfigTable->VendorTable; Rsdp10 = ConfigTable->VendorTable;
} else if (CompareGuid (&ConfigTable->VendorGuid, &gEfiAcpi20TableGuid)) { } else if (CompareGuid (&ConfigTable->VendorGuid, &gEfiAcpi20TableGuid)) {
Rsdp20 = ConfigTable->VendorTable; Rsdp20 = ConfigTable->VendorTable;
} else if (CompareGuid (&ConfigTable->VendorGuid, &gEfiSmbiosTableGuid)) {
Smbios21 = ConfigTable->VendorTable;
} else if (CompareGuid (&ConfigTable->VendorGuid, &gEfiSmbios3TableGuid)) {
Smbios30 = ConfigTable->VendorTable;
} }
++ConfigTable; ++ConfigTable;
} }
AsciiPrint ("%a: BiosTablesTest=%p Rsdp10=%p Rsdp20=%p\n", AsciiPrint ("%a: BiosTablesTest=%p Rsdp10=%p Rsdp20=%p\n",
gEfiCallerBaseName, Pages, Rsdp10, Rsdp20); gEfiCallerBaseName, Pages, Rsdp10, Rsdp20);
AsciiPrint ("%a: Smbios21=%p Smbios30=%p\n", gEfiCallerBaseName, Smbios21,
Smbios30);
// //
// Store the RSD PTR address(es) first, then the signature second. // Store the config table addresses first, then the signature second.
// //
BiosTablesTest = Pages; BiosTablesTest = Pages;
BiosTablesTest->Rsdp10 = (UINTN)Rsdp10; BiosTablesTest->Rsdp10 = (UINTN)Rsdp10;
BiosTablesTest->Rsdp20 = (UINTN)Rsdp20; BiosTablesTest->Rsdp20 = (UINTN)Rsdp20;
BiosTablesTest->Smbios21 = (UINTN)Smbios21;
BiosTablesTest->Smbios30 = (UINTN)Smbios30;
MemoryFence(); MemoryFence();

View File

@ -35,6 +35,8 @@
gBiosTablesTestGuid gBiosTablesTestGuid
gEfiAcpi10TableGuid gEfiAcpi10TableGuid
gEfiAcpi20TableGuid gEfiAcpi20TableGuid
gEfiSmbios3TableGuid
gEfiSmbiosTableGuid
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec

View File

@ -1,13 +1,14 @@
/** @file /** @file
Expose the address(es) of the ACPI RSD PTR table(s) in a MB-aligned structure Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry
to the hypervisor. point(s) in a MB-aligned structure to the hypervisor.
The hypervisor locates the MB-aligned structure based on the signature GUID The hypervisor locates the MB-aligned structure based on the signature GUID
that is at offset 0 in the structure. Once the RSD PTR address(es) are that is at offset 0 in the structure. Once the RSD PTR and SMBIOS anchor
retrieved, the hypervisor may perform various ACPI checks. address(es) are retrieved, the hypervisor may perform various ACPI and SMBIOS
checks.
This feature is a development aid, for supporting ACPI table unit tests in This feature is a development aid, for supporting ACPI and SMBIOS table unit
hypervisors. Do not enable in production builds. tests in hypervisors. Do not enable in production builds.
Copyright (C) 2019, Red Hat, Inc. Copyright (C) 2019, Red Hat, Inc.
@ -61,6 +62,18 @@ typedef struct {
// //
EFI_PHYSICAL_ADDRESS Rsdp10; EFI_PHYSICAL_ADDRESS Rsdp10;
EFI_PHYSICAL_ADDRESS Rsdp20; EFI_PHYSICAL_ADDRESS Rsdp20;
//
// The Smbios21 and Smbios30 fields may be read when the signature GUID
// matches. Smbios21 is the guest-physical address of the SMBIOS 2.1 (32-bit)
// Entry Point Structure from the SMBIOS v3.2.0 specification, in 8-byte
// little endian representation. Smbios30 is the guest-physical address of
// the SMBIOS 3.0 (64-bit) Entry Point Structure from the same specification,
// in the same representation. Each of these fields may be zero
// (independently of the other) if the UEFI System Table does not provide the
// corresponding UEFI Configuration Table.
//
EFI_PHYSICAL_ADDRESS Smbios21;
EFI_PHYSICAL_ADDRESS Smbios30;
} BIOS_TABLES_TEST; } BIOS_TABLES_TEST;
#pragma pack () #pragma pack ()