4 Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 - ACPI 6.2 Specification - Errata A, September 2017
11 #include <Library/UefiLib.h>
12 #include "AcpiParser.h"
13 #include "AcpiTableParser.h"
16 STATIC CONST UINT64
* XsdtAddress
;
19 This function validates the RSDT Address.
21 @param [in] Ptr Pointer to the start of the field data.
22 @param [in] Context Pointer to context specific information e.g. this
23 could be a pointer to the ACPI table header.
33 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
34 // Reference: Server Base Boot Requirements System Software on ARM Platforms
35 // Section: 4.2.1.1 RSDP
36 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
37 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
38 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
41 RsdtAddr
= *(UINT32
*)Ptr
;
44 IncrementErrorCount ();
46 L
"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.",
54 This function validates the XSDT Address.
56 @param [in] Ptr Pointer to the start of the field data.
57 @param [in] Context Pointer to context specific information e.g. this
58 could be a pointer to the ACPI table header.
68 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
69 // Reference: Server Base Boot Requirements System Software on ARM Platforms
70 // Section: 4.2.1.1 RSDP
71 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
72 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
73 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
76 XsdtAddr
= *(UINT64
*)Ptr
;
79 IncrementErrorCount ();
81 L
"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
89 An array describing the ACPI RSDP Table.
91 STATIC CONST ACPI_PARSER RsdpParser
[] = {
92 {L
"Signature", 8, 0, NULL
, Dump8Chars
, NULL
, NULL
, NULL
},
93 {L
"Checksum", 1, 8, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
94 {L
"Oem ID", 6, 9, NULL
, Dump6Chars
, NULL
, NULL
, NULL
},
95 {L
"Revision", 1, 15, L
"%d", NULL
, NULL
, NULL
, NULL
},
96 {L
"RSDT Address", 4, 16, L
"0x%x", NULL
, NULL
, ValidateRsdtAddress
, NULL
},
97 {L
"Length", 4, 20, L
"%d", NULL
, NULL
, NULL
, NULL
},
98 {L
"XSDT Address", 8, 24, L
"0x%lx", NULL
, (VOID
**)&XsdtAddress
,
99 ValidateXsdtAddress
, NULL
},
100 {L
"Extended Checksum", 1, 32, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
101 {L
"Reserved", 3, 33, L
"%x %x %x", Dump3Chars
, NULL
, NULL
, NULL
}
105 This function parses the ACPI RSDP table.
107 This function invokes the parser for the XSDT table.
108 * Note - This function does not support parsing of RSDT table.
110 This function also performs a RAW dump of the ACPI table and
111 validates the checksum.
113 @param [in] Trace If TRUE, trace the ACPI fields.
114 @param [in] Ptr Pointer to the start of the buffer.
115 @param [in] AcpiTableLength Length of the ACPI table.
116 @param [in] AcpiTableRevision Revision of the ACPI table.
123 IN UINT32 AcpiTableLength
,
124 IN UINT8 AcpiTableRevision
128 DumpRaw (Ptr
, AcpiTableLength
);
129 VerifyChecksum (TRUE
, Ptr
, AcpiTableLength
);
138 PARSER_PARAMS (RsdpParser
)
141 // Check if the values used to control the parsing logic have been
142 // successfully read.
143 if (XsdtAddress
== NULL
) {
144 IncrementErrorCount ();
146 L
"ERROR: Insufficient table length. AcpiTableLength = %d." \
147 L
"RSDP parsing aborted.\n",
153 // This code currently supports parsing of XSDT table only
154 // and does not parse the RSDT table. Platforms provide the
155 // RSDT to enable compatibility with ACPI 1.0 operating systems.
156 // Therefore the RSDT should not be used on ARM platforms.
157 if ((*XsdtAddress
) == 0) {
158 IncrementErrorCount ();
159 Print (L
"ERROR: XSDT Pointer is not set. RSDP parsing aborted.\n");
163 ProcessAcpiTable ((UINT8
*)(UINTN
)(*XsdtAddress
));