TianoCore EDK2 master
Loading...
Searching...
No Matches
XsdtParser.c
Go to the documentation of this file.
1
12#include <Library/UefiLib.h>
13#include <Library/PrintLib.h>
14#include "AcpiParser.h"
15#include "AcpiTableParser.h"
16
17// Local variables
19
23 PARSE_ACPI_HEADER (&AcpiHdrInfo)
24};
25
30EFIAPI
32 VOID
33 )
34{
35 return &AcpiHdrInfo;
36}
37
48VOID
49EFIAPI
51 IN BOOLEAN Trace,
52 IN UINT8 *Ptr,
53 IN UINT32 AcpiTableLength,
54 IN UINT8 AcpiTableRevision
55 )
56{
57 UINT32 Offset;
58 UINT32 TableOffset;
59 UINT64 *TablePointer;
60 UINTN EntryIndex;
61 CHAR16 Buffer[32];
62
63 Offset = ParseAcpi (
64 Trace,
65 0,
66 "XSDT",
67 Ptr,
68 AcpiTableLength,
70 );
71
72 TableOffset = Offset;
73
74 if (Trace) {
75 EntryIndex = 0;
76 TablePointer = (UINT64 *)(Ptr + TableOffset);
77 while (Offset < AcpiTableLength) {
78 CONST UINT32 *Signature;
79 CONST UINT32 *Length;
80 CONST UINT8 *Revision;
81
82 if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
83 UINT8 *SignaturePtr;
84
86 (UINT8 *)(UINTN)(*TablePointer),
87 &Signature,
88 &Length,
89 &Revision
90 );
91
92 SignaturePtr = (UINT8 *)Signature;
93
95 Buffer,
96 sizeof (Buffer),
97 L"Entry[%d] - %c%c%c%c",
98 EntryIndex++,
99 SignaturePtr[0],
100 SignaturePtr[1],
101 SignaturePtr[2],
102 SignaturePtr[3]
103 );
104 } else {
106 Buffer,
107 sizeof (Buffer),
108 L"Entry[%d]",
109 EntryIndex++
110 );
111 }
112
113 PrintFieldName (2, Buffer);
114 Print (L"0x%lx\n", *TablePointer);
115
116 // Validate the table pointers are not NULL
117 if ((UINT64 *)(UINTN)(*TablePointer) == NULL) {
119 Print (
120 L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
121 TablePointer,
122 *TablePointer
123 );
124 }
125
126 Offset += sizeof (UINT64);
127 TablePointer++;
128 } // while
129 }
130
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));
137 }
138
139 Offset += sizeof (UINT64);
140 TablePointer++;
141 } // while
142}
UINT64 UINTN
UINT32 EFIAPI ParseAcpiHeader(IN UINT8 *Ptr, OUT CONST UINT32 **Signature, OUT CONST UINT32 **Length, OUT CONST UINT8 **Revision)
Definition: AcpiParser.c:914
VOID EFIAPI PrintFieldName(IN UINT32 Indent, IN CONST CHAR16 *FieldName)
Definition: AcpiParser.c:641
VOID EFIAPI IncrementErrorCount(VOID)
Definition: AcpiParser.c:83
UINT32 EFIAPI ParseAcpi(IN BOOLEAN Trace, IN UINT32 Indent, IN CONST CHAR8 *AsciiName OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length, IN CONST ACPI_PARSER *Parser, IN UINT32 ParserItems)
Definition: AcpiParser.c:683
#define PARSER_PARAMS(Parser)
Definition: AcpiParser.h:494
#define PARSE_ACPI_HEADER(Info)
Definition: AcpiParser.h:501
VOID EFIAPI ProcessAcpiTable(IN UINT8 *Ptr)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define IN
Definition: Base.h:279
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113
VOID EFIAPI ParseAcpiXsdt(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
Definition: XsdtParser.c:50
CONST ACPI_DESCRIPTION_HEADER_INFO *EFIAPI GetAcpiXsdtHeaderInfo(VOID)
Definition: XsdtParser.c:31
STATIC CONST ACPI_PARSER XsdtParser[]
Definition: XsdtParser.c:22