TianoCore EDK2 master
Loading...
Searching...
No Matches
RsdpParser.c
Go to the documentation of this file.
1
11#include <Library/UefiLib.h>
12#include "AcpiParser.h"
13#include "AcpiTableParser.h"
14
15// Local Variables
16STATIC CONST UINT64 *XsdtAddress;
17
27VOID
28EFIAPI
30 IN UINT8 *Ptr,
31 IN UINT32 Length,
32 IN VOID *Context
33 )
34{
35 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
36 // Reference: Server Base Boot Requirements System Software on ARM Platforms
37 // Section: 4.2.1.1 RSDP
38 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
39 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
40 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
41 UINT32 RsdtAddr;
42
43 RsdtAddr = *(UINT32 *)Ptr;
44
45 if (RsdtAddr != 0) {
47 Print (
48 L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.",
49 RsdtAddr
50 );
51 }
52
53 #endif
54}
55
65VOID
66EFIAPI
68 IN UINT8 *Ptr,
69 IN UINT32 Length,
70 IN VOID *Context
71 )
72{
73 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
74 // Reference: Server Base Boot Requirements System Software on ARM Platforms
75 // Section: 4.2.1.1 RSDP
76 // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
77 // - Within the RSDP, the RsdtAddress field must be null (zero) and the
78 // XsdtAddresss MUST be a valid, non-null, 64-bit value.
79 UINT64 XsdtAddr;
80
81 XsdtAddr = *(UINT64 *)Ptr;
82
83 if (XsdtAddr == 0) {
85 Print (
86 L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
87 XsdtAddr
88 );
89 }
90
91 #endif
92}
93
98 { L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL },
99 { L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
100 { L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL },
101 { L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL },
102 { L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL },
103 { L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL },
104 { L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID **)&XsdtAddress,
106 { L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL },
107 { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
108};
109
124VOID
125EFIAPI
127 IN BOOLEAN Trace,
128 IN UINT8 *Ptr,
129 IN UINT32 AcpiTableLength,
130 IN UINT8 AcpiTableRevision
131 )
132{
133 if (Trace) {
134 DumpRaw (Ptr, AcpiTableLength);
135 VerifyChecksum (TRUE, Ptr, AcpiTableLength);
136 }
137
138 ParseAcpi (
139 Trace,
140 0,
141 "RSDP",
142 Ptr,
143 AcpiTableLength,
145 );
146
147 // Check if the values used to control the parsing logic have been
148 // successfully read.
149 if (XsdtAddress == NULL) {
151 Print (
152 L"ERROR: Insufficient table length. AcpiTableLength = %d." \
153 L"RSDP parsing aborted.\n",
154 AcpiTableLength
155 );
156 return;
157 }
158
159 // This code currently supports parsing of XSDT table only
160 // and does not parse the RSDT table. Platforms provide the
161 // RSDT to enable compatibility with ACPI 1.0 operating systems.
162 // Therefore the RSDT should not be used on ARM platforms.
163 if ((*XsdtAddress) == 0) {
165 Print (L"ERROR: XSDT Pointer is not set. RSDP parsing aborted.\n");
166 return;
167 }
168
169 ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress));
170}
UINT64 UINTN
BOOLEAN EFIAPI VerifyChecksum(IN BOOLEAN Log, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:117
VOID EFIAPI Dump8Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:408
VOID EFIAPI Dump3Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:326
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
VOID EFIAPI Dump6Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:379
VOID EFIAPI DumpRaw(IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:184
#define PARSER_PARAMS(Parser)
Definition: AcpiParser.h:494
VOID EFIAPI ProcessAcpiTable(IN UINT8 *Ptr)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define IN
Definition: Base.h:279
VOID EFIAPI ParseAcpiRsdp(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
Definition: RsdpParser.c:126
STATIC VOID EFIAPI ValidateRsdtAddress(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: RsdpParser.c:29
STATIC CONST ACPI_PARSER RsdpParser[]
Definition: RsdpParser.c:97
STATIC VOID EFIAPI ValidateXsdtAddress(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: RsdpParser.c:67
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113