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 <IndustryStandard/Acpi.h>
12 #include <Library/UefiLib.h>
13 #include <Library/PrintLib.h>
14 #include "AcpiParser.h"
15 #include "AcpiTableParser.h"
18 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
;
20 /** An ACPI_PARSER array describing the ACPI XSDT table.
22 STATIC CONST ACPI_PARSER XsdtParser
[] = {
23 PARSE_ACPI_HEADER (&AcpiHdrInfo
)
27 Get the ACPI XSDT header info.
29 CONST ACPI_DESCRIPTION_HEADER_INFO
*
31 GetAcpiXsdtHeaderInfo (
39 This function parses the ACPI XSDT table and optionally traces the ACPI table fields.
41 This function also performs validation of the XSDT table.
43 @param [in] Trace If TRUE, trace the ACPI fields.
44 @param [in] Ptr Pointer to the start of the buffer.
45 @param [in] AcpiTableLength Length of the ACPI table.
46 @param [in] AcpiTableRevision Revision of the ACPI table.
53 IN UINT32 AcpiTableLength
,
54 IN UINT8 AcpiTableRevision
69 PARSER_PARAMS (XsdtParser
)
76 TablePointer
= (UINT64
*)(Ptr
+ TableOffset
);
77 while (Offset
< AcpiTableLength
) {
78 CONST UINT32
*Signature
;
80 CONST UINT8
*Revision
;
82 if ((UINT64
*)(UINTN
)(*TablePointer
) != NULL
) {
86 (UINT8
*)(UINTN
)(*TablePointer
),
92 SignaturePtr
= (UINT8
*)Signature
;
97 L
"Entry[%d] - %c%c%c%c",
113 PrintFieldName (2, Buffer
);
114 Print (L
"0x%lx\n", *TablePointer
);
116 // Validate the table pointers are not NULL
117 if ((UINT64
*)(UINTN
)(*TablePointer
) == NULL
) {
118 IncrementErrorCount ();
120 L
"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
126 Offset
+= sizeof (UINT64
);
131 // Process the tables
132 Offset
= TableOffset
;
133 TablePointer
= (UINT64
*)(Ptr
+ TableOffset
);
134 while (Offset
< AcpiTableLength
) {
135 if ((UINT64
*)(UINTN
)(*TablePointer
) != NULL
) {
136 ProcessAcpiTable ((UINT8
*)(UINTN
)(*TablePointer
));
139 Offset
+= sizeof (UINT64
);