TianoCore EDK2 master
Loading...
Searching...
No Matches
HpetParser.c
Go to the documentation of this file.
1
12#include <Library/UefiLib.h>
13#include "AcpiParser.h"
14
16
24VOID
25EFIAPI
27 IN CONST CHAR16 *Format OPTIONAL,
28 IN UINT8 *Ptr,
29 IN UINT32 Length
30 )
31{
32 if (Format != NULL) {
33 Print (Format, *(UINT8 *)Ptr);
34 return;
35 }
36
37 Print (L"0x%X ", *(UINT8 *)Ptr);
38 switch (*Ptr) {
39 case 0:
40 Print (L"(no guarantee for page protection)");
41 break;
42 case 1:
43 Print (L"(4K page protection)");
44 break;
45 case 2:
46 Print (L"(64K page protection)");
47 break;
48 default:
50 Print (L"(OEM Reserved)");
51 break;
52 }
53
54 return;
55}
56
61 { L"Page Protection Flag", 4, 0, NULL, DumpHpetPageProtectionFlag, NULL, NULL, NULL },
62 { L"OEM Attributes", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }
63};
64
72VOID
73EFIAPI
75 IN CONST CHAR16 *Format OPTIONAL,
76 IN UINT8 *Ptr,
77 IN UINT32 Length
78 )
79{
80 if (Format != NULL) {
81 Print (Format, *(UINT8 *)Ptr);
82 return;
83 }
84
85 Print (L"0x%X\n", *(UINT8 *)Ptr);
87 TRUE,
88 2,
89 NULL,
90 Ptr,
91 4,
93 );
94}
95
103VOID
104EFIAPI
106 IN CONST CHAR16 *Format OPTIONAL,
107 IN UINT8 *Ptr,
108 IN UINT32 Length
109 )
110{
111 if (Format != NULL) {
112 Print (Format, *(UINT32 *)Ptr);
113 return;
114 }
115
116 Print (L"0x%X ", *(UINT32 *)Ptr);
117 if (*Ptr == 0) {
118 Print (L"(Max 32-bit counter size)");
119 } else {
120 Print (L"(Max 64-bit counter size)");
121 }
122}
123
132STATIC
133VOID
134EFIAPI
136 IN UINT8 *Ptr,
137 IN UINT32 Length,
138 IN VOID *Context
139 )
140{
141 if ((*(UINT8 *)Ptr) == 0) {
143 Print (
144 L"\nERROR: HPET Hardware Rev ID must be set."
145 );
146 }
147}
148
153 { L"Hardware Rev ID", 8, 0, L"0x%x", NULL, NULL, ValidateHpetRevId, NULL },
154 { L"Comparators in 1st Timer Block", 5, 8, L"0x%x", NULL, NULL, NULL, NULL },
155 { L"Counter max size", 1, 13, NULL, DumpCounterSize, NULL, NULL, NULL },
156 { L"Reserved", 1, 14, L"%d", NULL, NULL, NULL, NULL },
157 { L"LegacyReplacement IRQ Routing", 1, 15, L"%d", NULL, NULL, NULL, NULL },
158 { L"PCI Vendor ID of 1st Timer Block", 16, 16, L"0x%x", NULL, NULL, NULL, NULL }
159};
160
168VOID
169EFIAPI
171 IN CONST CHAR16 *Format OPTIONAL,
172 IN UINT8 *Ptr,
173 IN UINT32 Length
174 )
175{
176 if (Format != NULL) {
177 Print (Format, *(UINT32 *)Ptr);
178 return;
179 }
180
181 Print (L"0x%X\n", *(UINT32 *)Ptr);
183 TRUE,
184 2,
185 NULL,
186 Ptr,
187 4,
189 );
190}
191
196 PARSE_ACPI_HEADER (&AcpiHdrInfo),
197 { L"Event Timer Block ID", 4, 36, NULL, DumpHpetEventTimerBlockId, NULL, NULL, NULL },
198 { L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL },
199 { L"HPET Number", 1, 52, L"0x%x", NULL, NULL, NULL, NULL },
200 { L"Minimum Clock Ticks", 2, 53, L"0x%x", NULL, NULL, NULL, NULL },
201 { L"Page Protection and OEM Attributes",1, 55, NULL, DumpHpetFlag, NULL, NULL, NULL }
202};
203
212VOID
213EFIAPI
215 IN BOOLEAN Trace,
216 IN UINT8 *Ptr,
217 IN UINT32 AcpiTableLength,
218 IN UINT8 AcpiTableRevision
219 )
220{
221 ParseAcpi (
222 Trace,
223 0,
224 "HPET",
225 Ptr,
226 AcpiTableLength,
228 );
229}
VOID EFIAPI DumpGas(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:867
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
UINT32 EFIAPI ParseAcpiBitFields(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:968
#define PARSER_PARAMS(Parser)
Definition: AcpiParser.h:494
#define PARSE_ACPI_HEADER(Info)
Definition: AcpiParser.h:501
VOID EFIAPI DumpHpetPageProtectionFlag(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: HpetParser.c:26
STATIC CONST ACPI_PARSER DumpHpetFlagParser[]
Definition: HpetParser.c:60
VOID EFIAPI DumpCounterSize(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: HpetParser.c:105
VOID EFIAPI DumpHpetFlag(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: HpetParser.c:74
VOID EFIAPI DumpHpetEventTimerBlockId(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: HpetParser.c:170
STATIC VOID EFIAPI ValidateHpetRevId(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: HpetParser.c:135
STATIC CONST ACPI_PARSER HpetParser[]
Definition: HpetParser.c:195
STATIC CONST ACPI_PARSER HpetEventTimerBlockIdFlagParser[]
Definition: HpetParser.c:152
VOID EFIAPI ParseAcpiHpet(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
Definition: HpetParser.c:214
#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
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113