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.",
55 This function validates the XSDT Address.
57 @param [in] Ptr Pointer to the start of the field data.
58 @param [in] Context Pointer to context specific information e.g. this
59 could be a pointer to the ACPI table header.
69 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
70 // Reference: Server Base Boot Requirements System Software on ARM Platforms
71 // Section: 4.2.1.1 RSDP
72 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
73 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
74 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
77 XsdtAddr
= *(UINT64
*)Ptr
;
80 IncrementErrorCount ();
82 L
"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
91 An array describing the ACPI RSDP Table.
93 STATIC CONST ACPI_PARSER RsdpParser
[] = {
94 { L
"Signature", 8, 0, NULL
, Dump8Chars
, NULL
, NULL
, NULL
},
95 { L
"Checksum", 1, 8, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
96 { L
"Oem ID", 6, 9, NULL
, Dump6Chars
, NULL
, NULL
, NULL
},
97 { L
"Revision", 1, 15, L
"%d", NULL
, NULL
, NULL
, NULL
},
98 { L
"RSDT Address", 4, 16, L
"0x%x", NULL
, NULL
, ValidateRsdtAddress
, NULL
},
99 { L
"Length", 4, 20, L
"%d", NULL
, NULL
, NULL
, NULL
},
100 { L
"XSDT Address", 8, 24, L
"0x%lx", NULL
, (VOID
**)&XsdtAddress
,
101 ValidateXsdtAddress
, NULL
},
102 { L
"Extended Checksum", 1, 32, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
103 { L
"Reserved", 3, 33, L
"%x %x %x", Dump3Chars
, NULL
, NULL
, NULL
}
107 This function parses the ACPI RSDP table.
109 This function invokes the parser for the XSDT table.
110 * Note - This function does not support parsing of RSDT table.
112 This function also performs a RAW dump of the ACPI table and
113 validates the checksum.
115 @param [in] Trace If TRUE, trace the ACPI fields.
116 @param [in] Ptr Pointer to the start of the buffer.
117 @param [in] AcpiTableLength Length of the ACPI table.
118 @param [in] AcpiTableRevision Revision of the ACPI table.
125 IN UINT32 AcpiTableLength
,
126 IN UINT8 AcpiTableRevision
130 DumpRaw (Ptr
, AcpiTableLength
);
131 VerifyChecksum (TRUE
, Ptr
, AcpiTableLength
);
140 PARSER_PARAMS (RsdpParser
)
143 // Check if the values used to control the parsing logic have been
144 // successfully read.
145 if (XsdtAddress
== NULL
) {
146 IncrementErrorCount ();
148 L
"ERROR: Insufficient table length. AcpiTableLength = %d." \
149 L
"RSDP parsing aborted.\n",
155 // This code currently supports parsing of XSDT table only
156 // and does not parse the RSDT table. Platforms provide the
157 // RSDT to enable compatibility with ACPI 1.0 operating systems.
158 // Therefore the RSDT should not be used on ARM platforms.
159 if ((*XsdtAddress
) == 0) {
160 IncrementErrorCount ();
161 Print (L
"ERROR: XSDT Pointer is not set. RSDP parsing aborted.\n");
165 ProcessAcpiTable ((UINT8
*)(UINTN
)(*XsdtAddress
));