4 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 - ACPI 6.2 Specification - Errata A, September 2017
17 #include <Library/UefiLib.h>
18 #include "AcpiParser.h"
19 #include "AcpiTableParser.h"
22 STATIC CONST UINT64
* XsdtAddress
;
25 This function validates the RSDT Address.
27 @param [in] Ptr Pointer to the start of the field data.
28 @param [in] Context Pointer to context specific information e.g. this
29 could be a pointer to the ACPI table header.
40 This function validates the XSDT Address.
42 @param [in] Ptr Pointer to the start of the field data.
43 @param [in] Context Pointer to context specific information e.g. this
44 could be a pointer to the ACPI table header.
55 An array describing the ACPI RSDP Table.
57 STATIC CONST ACPI_PARSER RsdpParser
[] = {
58 {L
"Signature", 8, 0, NULL
, Dump8Chars
, NULL
, NULL
, NULL
},
59 {L
"Checksum", 1, 8, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
60 {L
"Oem ID", 6, 9, NULL
, Dump6Chars
, NULL
, NULL
, NULL
},
61 {L
"Revision", 1, 15, L
"%d", NULL
, NULL
, NULL
, NULL
},
62 {L
"RSDT Address", 4, 16, L
"0x%x", NULL
, NULL
, ValidateRsdtAddress
, NULL
},
63 {L
"Length", 4, 20, L
"%d", NULL
, NULL
, NULL
, NULL
},
64 {L
"XSDT Address", 8, 24, L
"0x%lx", NULL
, (VOID
**)&XsdtAddress
,
65 ValidateXsdtAddress
, NULL
},
66 {L
"Extended Checksum", 1, 32, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
67 {L
"Reserved", 3, 33, L
"%x %x %x", Dump3Chars
, NULL
, NULL
, NULL
}
71 This function validates the RSDT Address.
73 @param [in] Ptr Pointer to the start of the field data.
74 @param [in] Context Pointer to context specific information e.g. this
75 could be a pointer to the ACPI table header.
85 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
86 // Reference: Server Base Boot Requirements System Software on ARM Platforms
87 // Section: 4.2.1.1 RSDP
88 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
89 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
90 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
91 UINT32 RsdtAddr
= *(UINT32
*)Ptr
;
93 IncrementErrorCount ();
95 L
"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.",
103 This function validates the XSDT Address.
105 @param [in] Ptr Pointer to the start of the field data.
106 @param [in] Context Pointer to context specific information e.g. this
107 could be a pointer to the ACPI table header.
112 ValidateXsdtAddress (
117 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
118 // Reference: Server Base Boot Requirements System Software on ARM Platforms
119 // Section: 4.2.1.1 RSDP
120 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
121 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
122 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
123 UINT64 XsdtAddr
= *(UINT64
*)Ptr
;
125 IncrementErrorCount ();
127 L
"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
135 This function parses the ACPI RSDP table.
137 This function invokes the parser for the XSDT table.
138 * Note - This function does not support parsing of RSDT table.
140 This function also performs a RAW dump of the ACPI table and
141 validates the checksum.
143 @param [in] Trace If TRUE, trace the ACPI fields.
144 @param [in] Ptr Pointer to the start of the buffer.
145 @param [in] AcpiTableLength Length of the ACPI table.
146 @param [in] AcpiTableRevision Revision of the ACPI table.
153 IN UINT32 AcpiTableLength
,
154 IN UINT8 AcpiTableRevision
158 DumpRaw (Ptr
, AcpiTableLength
);
159 VerifyChecksum (TRUE
, Ptr
, AcpiTableLength
);
162 ParseAcpi (Trace
, 0, "RSDP", Ptr
, AcpiTableLength
, PARSER_PARAMS (RsdpParser
));
164 // This code currently supports parsing of XSDT table only
165 // and does not parse the RSDT table. Platforms provide the
166 // RSDT to enable compatibility with ACPI 1.0 operating systems.
167 // Therefore the RSDT should not be used on ARM platforms.
168 if ((*XsdtAddress
) == 0) {
169 IncrementErrorCount ();
170 Print (L
"ERROR: XSDT Pointer is not set.\n");
174 ProcessAcpiTable ((UINT8
*)(UINTN
)(*XsdtAddress
));