1 /** @file
2   Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry
3   point(s) in a MB-aligned structure to the hypervisor.
4 
5   The hypervisor locates the MB-aligned structure based on the signature GUID
6   that is at offset 0 in the structure. Once the RSD PTR and SMBIOS anchor
7   address(es) are retrieved, the hypervisor may perform various ACPI and SMBIOS
8   checks.
9 
10   This feature is a development aid, for supporting ACPI and SMBIOS table unit
11   tests in hypervisors. Do not enable in production builds.
12 
13   Copyright (C) 2019, Red Hat, Inc.
14 
15   This program and the accompanying materials are licensed and made available
16   under the terms and conditions of the BSD License that accompanies this
17   distribution. The full text of the license may be found at
18   <http://opensource.org/licenses/bsd-license.php>.
19 
20   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
21   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 **/
23 
24 #ifndef BIOSTABLESTEST_H
25 #define BIOSTABLESTEST_H
26 
27 #include <Uefi/UefiBaseType.h>
28 
29 #define BIOS_TABLES_TEST_GUID                          \
30   {                                                    \
31     0x5478594e,                                        \
32     0xdfcb,                                            \
33     0x425f,                                            \
34     { 0x8e, 0x42, 0xc8, 0xaf, 0xf8, 0x8a, 0x88, 0x7a } \
35   }
36 
37 extern EFI_GUID gBiosTablesTestGuid;
38 
39 //
40 // The following structure must be allocated in Boot Services Data type memory,
41 // aligned at a 1MB boundary.
42 //
43 #pragma pack (1)
44 typedef struct {
45   //
46   // The signature GUID is written to the MB-aligned structure from
47   // gBiosTablesTestGuid, but with all bits inverted. That's the actual GUID
48   // value that the hypervisor should look for at each MB boundary, looping
49   // over all guest RAM pages with that alignment, until a match is found. The
50   // bit-flipping occurs in order not to store the actual GUID in any UEFI
51   // executable, which might confuse guest memory analysis. Note that EFI_GUID
52   // has little endian representation.
53   //
54   EFI_GUID             InverseSignatureGuid;
55   //
56   // The Rsdp10 and Rsdp20 fields may be read when the signature GUID matches.
57   // Rsdp10 is the guest-physical address of the ACPI 1.0 specification RSD PTR
58   // table, in 8-byte little endian representation. Rsdp20 is the same, for the
59   // ACPI 2.0 or later specification RSD PTR table. Each of these fields may be
60   // zero (independently of the other) if the UEFI System Table does not
61   // provide the corresponding UEFI Configuration Table.
62   //
63   EFI_PHYSICAL_ADDRESS Rsdp10;
64   EFI_PHYSICAL_ADDRESS Rsdp20;
65   //
66   // The Smbios21 and Smbios30 fields may be read when the signature GUID
67   // matches. Smbios21 is the guest-physical address of the SMBIOS 2.1 (32-bit)
68   // Entry Point Structure from the SMBIOS v3.2.0 specification, in 8-byte
69   // little endian representation. Smbios30 is the guest-physical address of
70   // the SMBIOS 3.0 (64-bit) Entry Point Structure from the same specification,
71   // in the same representation. Each of these fields may be zero
72   // (independently of the other) if the UEFI System Table does not provide the
73   // corresponding UEFI Configuration Table.
74   //
75   EFI_PHYSICAL_ADDRESS Smbios21;
76   EFI_PHYSICAL_ADDRESS Smbios30;
77 } BIOS_TABLES_TEST;
78 #pragma pack ()
79 
80 #endif /* BIOSTABLESTEST_H */
81