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
;
24 /** This function validates the RSDT Address.
26 @param [in] Ptr Pointer to the start of the field data.
27 @param [in] Context Pointer to context specific information e.g. this
28 could be a pointer to the ACPI table header.
38 /** This function validates the XSDT Address.
40 @param [in] Ptr Pointer to the start of the field data.
41 @param [in] Context Pointer to context specific information e.g. this
42 could be a pointer to the ACPI table header.
52 /** An array describing the ACPI RSDP Table.
54 STATIC CONST ACPI_PARSER RsdpParser
[] = {
55 {L
"Signature", 8, 0, NULL
, Dump8Chars
, NULL
, NULL
, NULL
},
56 {L
"Checksum", 1, 8, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
57 {L
"Oem ID", 6, 9, NULL
, Dump6Chars
, NULL
, NULL
, NULL
},
58 {L
"Revision", 1, 15, L
"%d", NULL
, NULL
, NULL
, NULL
},
59 {L
"RSDT Address", 4, 16, L
"0x%x", NULL
, NULL
, ValidateRsdtAddress
, NULL
},
60 {L
"Length", 4, 20, L
"%d", NULL
, NULL
, NULL
, NULL
},
61 {L
"XSDT Address", 8, 24, L
"0x%lx", NULL
, (VOID
**)&XsdtAddress
,
62 ValidateXsdtAddress
, NULL
},
63 {L
"Extended Checksum", 1, 32, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
64 {L
"Reserved", 3, 33, L
"%x %x %x", Dump3Chars
, NULL
, NULL
, NULL
}
67 /** This function validates the RSDT Address.
69 @param [in] Ptr Pointer to the start of the field data.
70 @param [in] Context Pointer to context specific information e.g. this
71 could be a pointer to the ACPI table header.
81 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
82 // Reference: Server Base Boot Requirements System Software on ARM Platforms
83 // Section: 4.2.1.1 RSDP
84 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
85 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
86 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
87 UINT32 RsdtAddr
= *(UINT32
*)Ptr
;
89 IncrementErrorCount ();
91 L
"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.",
98 /** This function validates the XSDT Address.
100 @param [in] Ptr Pointer to the start of the field data.
101 @param [in] Context Pointer to context specific information e.g. this
102 could be a pointer to the ACPI table header.
107 ValidateXsdtAddress (
112 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
113 // Reference: Server Base Boot Requirements System Software on ARM Platforms
114 // Section: 4.2.1.1 RSDP
115 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
116 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
117 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
118 UINT64 XsdtAddr
= *(UINT64
*)Ptr
;
120 IncrementErrorCount ();
122 L
"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
129 /** This function parses the ACPI RSDP table.
131 This function invokes the parser for the XSDT table.
132 * Note - This function does not support parsing of RSDT table.
134 This function also performs a RAW dump of the ACPI table and
135 validates the checksum.
137 @param [in] Trace If TRUE, trace the ACPI fields.
138 @param [in] Ptr Pointer to the start of the buffer.
139 @param [in] AcpiTableLength Length of the ACPI table.
140 @param [in] AcpiTableRevision Revision of the ACPI table.
147 IN UINT32 AcpiTableLength
,
148 IN UINT8 AcpiTableRevision
152 DumpRaw (Ptr
, AcpiTableLength
);
153 VerifyChecksum (TRUE
, Ptr
, AcpiTableLength
);
156 ParseAcpi (Trace
, 0, "RSDP", Ptr
, AcpiTableLength
, PARSER_PARAMS (RsdpParser
));
158 // This code currently supports parsing of XSDT table only
159 // and does not parse the RSDT table. Platforms provide the
160 // RSDT to enable compatibility with ACPI 1.0 operating systems.
161 // Therefore the RSDT should not be used on ARM platforms.
162 if ((*XsdtAddress
) == 0) {
163 IncrementErrorCount ();
164 Print (L
"ERROR: XSDT Pointer is not set.\n");
168 ProcessAcpiTable ((UINT8
*)(UINTN
)(*XsdtAddress
));