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
)
33 Get the ACPI XSDT header info.
35 CONST ACPI_DESCRIPTION_HEADER_INFO
* CONST
37 GetAcpiXsdtHeaderInfo (
45 This function parses the ACPI XSDT table and optionally traces the ACPI table fields.
47 This function also performs validation of the XSDT table.
49 @param [in] Trace If TRUE, trace the ACPI fields.
50 @param [in] Ptr Pointer to the start of the buffer.
51 @param [in] AcpiTableLength Length of the ACPI table.
52 @param [in] AcpiTableRevision Revision of the ACPI table.
59 IN UINT32 AcpiTableLength
,
60 IN UINT8 AcpiTableRevision
69 // Parse the ACPI header to get the length
75 ACPI_DESCRIPTION_HEADER_LENGTH
,
76 PARSER_PARAMS (XsdtParser
)
85 PARSER_PARAMS (XsdtParser
)
92 TablePointer
= (UINT64
*)(Ptr
+ TableOffset
);
93 while (Offset
< (*AcpiHdrInfo
.Length
)) {
94 CONST UINT32
* Signature
;
96 CONST UINT8
* Revision
;
98 if ((UINT64
*)(UINTN
)(*TablePointer
) != NULL
) {
102 (UINT8
*)(UINTN
)(*TablePointer
),
108 Ptr
= (UINT8
*)Signature
;
113 L
"Entry[%d] - %c%c%c%c",
129 PrintFieldName (2, Buffer
);
130 Print (L
"0x%lx\n", *TablePointer
);
132 // Validate the table pointers are not NULL
133 if ((UINT64
*)(UINTN
)(*TablePointer
) == NULL
) {
134 IncrementErrorCount ();
136 L
"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
141 Offset
+= sizeof (UINT64
);
146 // Process the tables
147 Offset
= TableOffset
;
148 TablePointer
= (UINT64
*)(Ptr
+ TableOffset
);
149 while (Offset
< (*AcpiHdrInfo
.Length
)) {
150 if ((UINT64
*)(UINTN
)(*TablePointer
) != NULL
) {
151 ProcessAcpiTable ((UINT8
*)(UINTN
)(*TablePointer
));
153 Offset
+= sizeof (UINT64
);