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 <IndustryStandard/Acpi.h>
18 #include <Library/UefiLib.h>
19 #include <Library/PrintLib.h>
20 #include "AcpiParser.h"
21 #include "AcpiTableParser.h"
24 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
;
26 /** An ACPI_PARSER array describing the ACPI XSDT table.
28 STATIC CONST ACPI_PARSER XsdtParser
[] = {
29 PARSE_ACPI_HEADER (&AcpiHdrInfo
)
32 CONST ACPI_DESCRIPTION_HEADER_INFO
* CONST
34 GetAcpiXsdtHeaderInfo (
41 /** This function parses the ACPI XSDT table
42 and optionally traces the ACPI table fields.
44 This function also performs validation of the XSDT table.
46 @param [in] Trace If TRUE, trace the ACPI fields.
47 @param [in] Ptr Pointer to the start of the buffer.
48 @param [in] AcpiTableLength Length of the ACPI table.
49 @param [in] AcpiTableRevision Revision of the ACPI table.
56 IN UINT32 AcpiTableLength
,
57 IN UINT8 AcpiTableRevision
66 // Parse the ACPI header to get the length
72 ACPI_DESCRIPTION_HEADER_LENGTH
,
73 PARSER_PARAMS (XsdtParser
)
82 PARSER_PARAMS (XsdtParser
)
89 TablePointer
= (UINT64
*)(Ptr
+ TableOffset
);
90 while (Offset
< (*AcpiHdrInfo
.Length
)) {
91 CONST UINT32
* Signature
;
93 CONST UINT8
* Revision
;
95 if ((UINT64
*)(UINTN
)(*TablePointer
) != NULL
) {
99 (UINT8
*)(UINTN
)(*TablePointer
),
105 Ptr
= (UINT8
*)Signature
;
110 L
"Entry[%d] - %c%c%c%c",
126 PrintFieldName (2, Buffer
);
127 Print (L
"0x%lx\n", *TablePointer
);
129 // Validate the table pointers are not NULL
130 if ((UINT64
*)(UINTN
)(*TablePointer
) == NULL
) {
131 IncrementErrorCount ();
133 L
"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
138 Offset
+= sizeof (UINT64
);
143 // Process the tables
144 Offset
= TableOffset
;
145 TablePointer
= (UINT64
*)(Ptr
+ TableOffset
);
146 while (Offset
< (*AcpiHdrInfo
.Length
)) {
147 if ((UINT64
*)(UINTN
)(*TablePointer
) != NULL
) {
148 ProcessAcpiTable ((UINT8
*)(UINTN
)(*TablePointer
));
150 Offset
+= sizeof (UINT64
);