xref: /qemu/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h (revision 59c58f96b270f5edd4ad10954c3a96556cb3a728)
109a274d8SLaszlo Ersek /** @file
2b097ba37SLaszlo Ersek   Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry
3b097ba37SLaszlo Ersek   point(s) in a MB-aligned structure to the hypervisor.
409a274d8SLaszlo Ersek 
509a274d8SLaszlo Ersek   The hypervisor locates the MB-aligned structure based on the signature GUID
6b097ba37SLaszlo Ersek   that is at offset 0 in the structure. Once the RSD PTR and SMBIOS anchor
7b097ba37SLaszlo Ersek   address(es) are retrieved, the hypervisor may perform various ACPI and SMBIOS
8b097ba37SLaszlo Ersek   checks.
909a274d8SLaszlo Ersek 
10b097ba37SLaszlo Ersek   This feature is a development aid, for supporting ACPI and SMBIOS table unit
11b097ba37SLaszlo Ersek   tests in hypervisors. Do not enable in production builds.
1209a274d8SLaszlo Ersek 
1309a274d8SLaszlo Ersek   Copyright (C) 2019, Red Hat, Inc.
1409a274d8SLaszlo Ersek 
1509a274d8SLaszlo Ersek   This program and the accompanying materials are licensed and made available
1609a274d8SLaszlo Ersek   under the terms and conditions of the BSD License that accompanies this
1709a274d8SLaszlo Ersek   distribution. The full text of the license may be found at
1809a274d8SLaszlo Ersek   <http://opensource.org/licenses/bsd-license.php>.
1909a274d8SLaszlo Ersek 
2009a274d8SLaszlo Ersek   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
2109a274d8SLaszlo Ersek   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
2209a274d8SLaszlo Ersek **/
2309a274d8SLaszlo Ersek 
24*37677d7dSMarkus Armbruster #ifndef BIOSTABLESTEST_H
25*37677d7dSMarkus Armbruster #define BIOSTABLESTEST_H
2609a274d8SLaszlo Ersek 
2709a274d8SLaszlo Ersek #include <Uefi/UefiBaseType.h>
2809a274d8SLaszlo Ersek 
2909a274d8SLaszlo Ersek #define BIOS_TABLES_TEST_GUID                          \
3009a274d8SLaszlo Ersek   {                                                    \
3109a274d8SLaszlo Ersek     0x5478594e,                                        \
3209a274d8SLaszlo Ersek     0xdfcb,                                            \
3309a274d8SLaszlo Ersek     0x425f,                                            \
3409a274d8SLaszlo Ersek     { 0x8e, 0x42, 0xc8, 0xaf, 0xf8, 0x8a, 0x88, 0x7a } \
3509a274d8SLaszlo Ersek   }
3609a274d8SLaszlo Ersek 
3709a274d8SLaszlo Ersek extern EFI_GUID gBiosTablesTestGuid;
3809a274d8SLaszlo Ersek 
3909a274d8SLaszlo Ersek //
4009a274d8SLaszlo Ersek // The following structure must be allocated in Boot Services Data type memory,
4109a274d8SLaszlo Ersek // aligned at a 1MB boundary.
4209a274d8SLaszlo Ersek //
4309a274d8SLaszlo Ersek #pragma pack (1)
4409a274d8SLaszlo Ersek typedef struct {
4509a274d8SLaszlo Ersek   //
4609a274d8SLaszlo Ersek   // The signature GUID is written to the MB-aligned structure from
4709a274d8SLaszlo Ersek   // gBiosTablesTestGuid, but with all bits inverted. That's the actual GUID
4809a274d8SLaszlo Ersek   // value that the hypervisor should look for at each MB boundary, looping
4909a274d8SLaszlo Ersek   // over all guest RAM pages with that alignment, until a match is found. The
5009a274d8SLaszlo Ersek   // bit-flipping occurs in order not to store the actual GUID in any UEFI
5109a274d8SLaszlo Ersek   // executable, which might confuse guest memory analysis. Note that EFI_GUID
5209a274d8SLaszlo Ersek   // has little endian representation.
5309a274d8SLaszlo Ersek   //
5409a274d8SLaszlo Ersek   EFI_GUID             InverseSignatureGuid;
5509a274d8SLaszlo Ersek   //
5609a274d8SLaszlo Ersek   // The Rsdp10 and Rsdp20 fields may be read when the signature GUID matches.
5709a274d8SLaszlo Ersek   // Rsdp10 is the guest-physical address of the ACPI 1.0 specification RSD PTR
5809a274d8SLaszlo Ersek   // table, in 8-byte little endian representation. Rsdp20 is the same, for the
5909a274d8SLaszlo Ersek   // ACPI 2.0 or later specification RSD PTR table. Each of these fields may be
6009a274d8SLaszlo Ersek   // zero (independently of the other) if the UEFI System Table does not
6109a274d8SLaszlo Ersek   // provide the corresponding UEFI Configuration Table.
6209a274d8SLaszlo Ersek   //
6309a274d8SLaszlo Ersek   EFI_PHYSICAL_ADDRESS Rsdp10;
6409a274d8SLaszlo Ersek   EFI_PHYSICAL_ADDRESS Rsdp20;
65b097ba37SLaszlo Ersek   //
66b097ba37SLaszlo Ersek   // The Smbios21 and Smbios30 fields may be read when the signature GUID
67b097ba37SLaszlo Ersek   // matches. Smbios21 is the guest-physical address of the SMBIOS 2.1 (32-bit)
68b097ba37SLaszlo Ersek   // Entry Point Structure from the SMBIOS v3.2.0 specification, in 8-byte
69b097ba37SLaszlo Ersek   // little endian representation. Smbios30 is the guest-physical address of
70b097ba37SLaszlo Ersek   // the SMBIOS 3.0 (64-bit) Entry Point Structure from the same specification,
71b097ba37SLaszlo Ersek   // in the same representation. Each of these fields may be zero
72b097ba37SLaszlo Ersek   // (independently of the other) if the UEFI System Table does not provide the
73b097ba37SLaszlo Ersek   // corresponding UEFI Configuration Table.
74b097ba37SLaszlo Ersek   //
75b097ba37SLaszlo Ersek   EFI_PHYSICAL_ADDRESS Smbios21;
76b097ba37SLaszlo Ersek   EFI_PHYSICAL_ADDRESS Smbios30;
7709a274d8SLaszlo Ersek } BIOS_TABLES_TEST;
7809a274d8SLaszlo Ersek #pragma pack ()
7909a274d8SLaszlo Ersek 
80*37677d7dSMarkus Armbruster #endif /* BIOSTABLESTEST_H */
81