]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
ShellPkg: Display VENDOR_ID in ASCII when parsing PPTT
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / AcpiParser.c
CommitLineData
a6eaba4d 1/** @file\r
ee4dc24f
RN
2 ACPI parser\r
3\r
4 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.\r
56ba3746 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
ee4dc24f
RN
6**/\r
7\r
8#include <Uefi.h>\r
9#include <Library/UefiLib.h>\r
10#include <Library/UefiBootServicesTableLib.h>\r
11#include "AcpiParser.h"\r
12#include "AcpiView.h"\r
13\r
14STATIC UINT32 gIndent;\r
15STATIC UINT32 mTableErrorCount;\r
16STATIC UINT32 mTableWarningCount;\r
17\r
f75c7478
DB
18STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;\r
19\r
20/**\r
21 An ACPI_PARSER array describing the ACPI header.\r
22**/\r
23STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {\r
24 PARSE_ACPI_HEADER (&AcpiHdrInfo)\r
25};\r
26\r
a6eaba4d
DB
27/**\r
28 This function resets the ACPI table error counter to Zero.\r
29**/\r
ee4dc24f
RN
30VOID\r
31ResetErrorCount (\r
32 VOID\r
33 )\r
34{\r
35 mTableErrorCount = 0;\r
36}\r
37\r
a6eaba4d
DB
38/**\r
39 This function returns the ACPI table error count.\r
ee4dc24f
RN
40\r
41 @retval Returns the count of errors detected in the ACPI tables.\r
a6eaba4d 42**/\r
ee4dc24f
RN
43UINT32\r
44GetErrorCount (\r
45 VOID\r
46 )\r
47{\r
48 return mTableErrorCount;\r
49}\r
50\r
a6eaba4d
DB
51/**\r
52 This function resets the ACPI table warning counter to Zero.\r
53**/\r
ee4dc24f
RN
54VOID\r
55ResetWarningCount (\r
56 VOID\r
57 )\r
58{\r
59 mTableWarningCount = 0;\r
60}\r
61\r
a6eaba4d
DB
62/**\r
63 This function returns the ACPI table warning count.\r
ee4dc24f
RN
64\r
65 @retval Returns the count of warning detected in the ACPI tables.\r
a6eaba4d 66**/\r
ee4dc24f
RN
67UINT32\r
68GetWarningCount (\r
69 VOID\r
70 )\r
71{\r
72 return mTableWarningCount;\r
73}\r
74\r
a6eaba4d
DB
75/**\r
76 This function increments the ACPI table error counter.\r
77**/\r
ee4dc24f
RN
78VOID\r
79EFIAPI\r
80IncrementErrorCount (\r
81 VOID\r
82 )\r
83{\r
84 mTableErrorCount++;\r
85}\r
86\r
a6eaba4d
DB
87/**\r
88 This function increments the ACPI table warning counter.\r
89**/\r
ee4dc24f
RN
90VOID\r
91EFIAPI\r
92IncrementWarningCount (\r
93 VOID\r
94 )\r
95{\r
96 mTableWarningCount++;\r
97}\r
98\r
a6eaba4d
DB
99/**\r
100 This function verifies the ACPI table checksum.\r
ee4dc24f
RN
101\r
102 This function verifies the checksum for the ACPI table and optionally\r
103 prints the status.\r
104\r
105 @param [in] Log If TRUE log the status of the checksum.\r
106 @param [in] Ptr Pointer to the start of the table buffer.\r
107 @param [in] Length The length of the buffer.\r
108\r
109 @retval TRUE The checksum is OK.\r
110 @retval FALSE The checksum failed.\r
a6eaba4d 111**/\r
ee4dc24f
RN
112BOOLEAN\r
113EFIAPI\r
114VerifyChecksum (\r
115 IN BOOLEAN Log,\r
116 IN UINT8* Ptr,\r
117 IN UINT32 Length\r
118 )\r
119{\r
f75c7478
DB
120 UINTN ByteCount;\r
121 UINT8 Checksum;\r
ee4dc24f
RN
122 UINTN OriginalAttribute;\r
123\r
f75c7478
DB
124 ByteCount = 0;\r
125 Checksum = 0;\r
126\r
ee4dc24f
RN
127 while (ByteCount < Length) {\r
128 Checksum += *(Ptr++);\r
129 ByteCount++;\r
130 }\r
131\r
132 if (Log) {\r
133 OriginalAttribute = gST->ConOut->Mode->Attribute;\r
134 if (Checksum == 0) {\r
135 if (GetColourHighlighting ()) {\r
136 gST->ConOut->SetAttribute (\r
137 gST->ConOut,\r
138 EFI_TEXT_ATTR (EFI_GREEN,\r
139 ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))\r
140 );\r
141 }\r
142 Print (L"\n\nTable Checksum : OK\n\n");\r
143 } else {\r
144 IncrementErrorCount ();\r
145 if (GetColourHighlighting ()) {\r
146 gST->ConOut->SetAttribute (\r
147 gST->ConOut,\r
148 EFI_TEXT_ATTR (EFI_RED,\r
149 ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))\r
150 );\r
151 }\r
152 Print (L"\n\nTable Checksum : FAILED (0x%X)\n\n", Checksum);\r
153 }\r
154 if (GetColourHighlighting ()) {\r
155 gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);\r
156 }\r
157 }\r
158\r
159 return (Checksum == 0);\r
160}\r
161\r
a6eaba4d
DB
162/**\r
163 This function performs a raw data dump of the ACPI table.\r
ee4dc24f
RN
164\r
165 @param [in] Ptr Pointer to the start of the table buffer.\r
166 @param [in] Length The length of the buffer.\r
a6eaba4d 167**/\r
ee4dc24f
RN
168VOID\r
169EFIAPI\r
170DumpRaw (\r
171 IN UINT8* Ptr,\r
172 IN UINT32 Length\r
173 )\r
174{\r
f75c7478 175 UINTN ByteCount;\r
ee4dc24f 176 UINTN PartLineChars;\r
f75c7478 177 UINTN AsciiBufferIndex;\r
ee4dc24f
RN
178 CHAR8 AsciiBuffer[17];\r
179\r
f75c7478
DB
180 ByteCount = 0;\r
181 AsciiBufferIndex = 0;\r
182\r
ee4dc24f
RN
183 Print (L"Address : 0x%p\n", Ptr);\r
184 Print (L"Length : %d\n", Length);\r
185\r
186 while (ByteCount < Length) {\r
187 if ((ByteCount & 0x0F) == 0) {\r
188 AsciiBuffer[AsciiBufferIndex] = '\0';\r
189 Print (L" %a\n%08X : ", AsciiBuffer, ByteCount);\r
190 AsciiBufferIndex = 0;\r
191 } else if ((ByteCount & 0x07) == 0) {\r
192 Print (L"- ");\r
193 }\r
194\r
195 if ((*Ptr >= ' ') && (*Ptr < 0x7F)) {\r
196 AsciiBuffer[AsciiBufferIndex++] = *Ptr;\r
197 } else {\r
198 AsciiBuffer[AsciiBufferIndex++] = '.';\r
199 }\r
200\r
201 Print (L"%02X ", *Ptr++);\r
202\r
203 ByteCount++;\r
204 }\r
205\r
206 // Justify the final line using spaces before printing\r
207 // the ASCII data.\r
208 PartLineChars = (Length & 0x0F);\r
209 if (PartLineChars != 0) {\r
210 PartLineChars = 48 - (PartLineChars * 3);\r
211 if ((Length & 0x0F) <= 8) {\r
212 PartLineChars += 2;\r
213 }\r
214 while (PartLineChars > 0) {\r
215 Print (L" ");\r
216 PartLineChars--;\r
217 }\r
218 }\r
219\r
220 // Print ASCII data for the final line.\r
221 AsciiBuffer[AsciiBufferIndex] = '\0';\r
222 Print (L" %a", AsciiBuffer);\r
223}\r
224\r
a6eaba4d
DB
225/**\r
226 This function traces 1 byte of data as specified in the format string.\r
ee4dc24f
RN
227\r
228 @param [in] Format The format string for tracing the data.\r
229 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 230**/\r
ee4dc24f
RN
231VOID\r
232EFIAPI\r
233DumpUint8 (\r
234 IN CONST CHAR16* Format,\r
235 IN UINT8* Ptr\r
236 )\r
237{\r
238 Print (Format, *Ptr);\r
239}\r
240\r
a6eaba4d
DB
241/**\r
242 This function traces 2 bytes of data as specified in the format string.\r
ee4dc24f
RN
243\r
244 @param [in] Format The format string for tracing the data.\r
245 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 246**/\r
ee4dc24f
RN
247VOID\r
248EFIAPI\r
249DumpUint16 (\r
250 IN CONST CHAR16* Format,\r
251 IN UINT8* Ptr\r
252 )\r
253{\r
254 Print (Format, *(UINT16*)Ptr);\r
255}\r
256\r
a6eaba4d
DB
257/**\r
258 This function traces 4 bytes of data as specified in the format string.\r
ee4dc24f
RN
259\r
260 @param [in] Format The format string for tracing the data.\r
261 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 262**/\r
ee4dc24f
RN
263VOID\r
264EFIAPI\r
265DumpUint32 (\r
266 IN CONST CHAR16* Format,\r
267 IN UINT8* Ptr\r
268 )\r
269{\r
270 Print (Format, *(UINT32*)Ptr);\r
271}\r
272\r
a6eaba4d
DB
273/**\r
274 This function traces 8 bytes of data as specified by the format string.\r
ee4dc24f
RN
275\r
276 @param [in] Format The format string for tracing the data.\r
277 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 278**/\r
ee4dc24f
RN
279VOID\r
280EFIAPI\r
281DumpUint64 (\r
282 IN CONST CHAR16* Format,\r
283 IN UINT8* Ptr\r
284 )\r
285{\r
286 // Some fields are not aligned and this causes alignment faults\r
287 // on ARM platforms if the compiler generates LDRD instructions.\r
288 // Perform word access so that LDRD instructions are not generated.\r
f75c7478
DB
289 UINT64 Val;\r
290\r
291 Val = *(UINT32*)(Ptr + sizeof (UINT32));\r
292\r
ee4dc24f 293 Val <<= 32;\r
81038d50 294 Val |= (UINT64)*(UINT32*)Ptr;\r
ee4dc24f
RN
295\r
296 Print (Format, Val);\r
297}\r
298\r
a6eaba4d
DB
299/**\r
300 This function traces 3 characters which can be optionally\r
301 formated using the format string if specified.\r
ee4dc24f
RN
302\r
303 If no format string is specified the Format must be NULL.\r
304\r
305 @param [in] Format Optional format string for tracing the data.\r
306 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 307**/\r
ee4dc24f
RN
308VOID\r
309EFIAPI\r
310Dump3Chars (\r
311 IN CONST CHAR16* Format OPTIONAL,\r
312 IN UINT8* Ptr\r
313 )\r
314{\r
315 Print (\r
316 (Format != NULL) ? Format : L"%c%c%c",\r
317 Ptr[0],\r
318 Ptr[1],\r
319 Ptr[2]\r
320 );\r
321}\r
322\r
a6eaba4d
DB
323/**\r
324 This function traces 4 characters which can be optionally\r
325 formated using the format string if specified.\r
ee4dc24f
RN
326\r
327 If no format string is specified the Format must be NULL.\r
328\r
329 @param [in] Format Optional format string for tracing the data.\r
330 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 331**/\r
ee4dc24f
RN
332VOID\r
333EFIAPI\r
334Dump4Chars (\r
335 IN CONST CHAR16* Format OPTIONAL,\r
336 IN UINT8* Ptr\r
337 )\r
338{\r
339 Print (\r
340 (Format != NULL) ? Format : L"%c%c%c%c",\r
341 Ptr[0],\r
342 Ptr[1],\r
343 Ptr[2],\r
344 Ptr[3]\r
345 );\r
346}\r
347\r
a6eaba4d
DB
348/**\r
349 This function traces 6 characters which can be optionally\r
350 formated using the format string if specified.\r
ee4dc24f
RN
351\r
352 If no format string is specified the Format must be NULL.\r
353\r
354 @param [in] Format Optional format string for tracing the data.\r
355 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 356**/\r
ee4dc24f
RN
357VOID\r
358EFIAPI\r
359Dump6Chars (\r
360 IN CONST CHAR16* Format OPTIONAL,\r
361 IN UINT8* Ptr\r
362 )\r
363{\r
364 Print (\r
365 (Format != NULL) ? Format : L"%c%c%c%c%c%c",\r
366 Ptr[0],\r
367 Ptr[1],\r
368 Ptr[2],\r
369 Ptr[3],\r
370 Ptr[4],\r
371 Ptr[5]\r
372 );\r
373}\r
374\r
a6eaba4d
DB
375/**\r
376 This function traces 8 characters which can be optionally\r
377 formated using the format string if specified.\r
ee4dc24f
RN
378\r
379 If no format string is specified the Format must be NULL.\r
380\r
381 @param [in] Format Optional format string for tracing the data.\r
382 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 383**/\r
ee4dc24f
RN
384VOID\r
385EFIAPI\r
386Dump8Chars (\r
387 IN CONST CHAR16* Format OPTIONAL,\r
388 IN UINT8* Ptr\r
389 )\r
390{\r
391 Print (\r
392 (Format != NULL) ? Format : L"%c%c%c%c%c%c%c%c",\r
393 Ptr[0],\r
394 Ptr[1],\r
395 Ptr[2],\r
396 Ptr[3],\r
397 Ptr[4],\r
398 Ptr[5],\r
399 Ptr[6],\r
400 Ptr[7]\r
401 );\r
402}\r
403\r
a6eaba4d
DB
404/**\r
405 This function indents and prints the ACPI table Field Name.\r
ee4dc24f
RN
406\r
407 @param [in] Indent Number of spaces to add to the global table indent.\r
408 The global table indent is 0 by default; however\r
409 this value is updated on entry to the ParseAcpi()\r
410 by adding the indent value provided to ParseAcpi()\r
411 and restored back on exit.\r
412 Therefore the total indent in the output is\r
413 dependent on from where this function is called.\r
414 @param [in] FieldName Pointer to the Field Name.\r
a6eaba4d 415**/\r
ee4dc24f
RN
416VOID\r
417EFIAPI\r
418PrintFieldName (\r
419 IN UINT32 Indent,\r
420 IN CONST CHAR16* FieldName\r
421)\r
422{\r
423 Print (\r
424 L"%*a%-*s : ",\r
425 gIndent + Indent,\r
426 "",\r
427 (OUTPUT_FIELD_COLUMN_WIDTH - gIndent - Indent),\r
428 FieldName\r
429 );\r
430}\r
431\r
a6eaba4d
DB
432/**\r
433 This function is used to parse an ACPI table buffer.\r
ee4dc24f
RN
434\r
435 The ACPI table buffer is parsed using the ACPI table parser information\r
436 specified by a pointer to an array of ACPI_PARSER elements. This parser\r
437 function iterates through each item on the ACPI_PARSER array and logs the\r
438 ACPI table fields.\r
439\r
440 This function can optionally be used to parse ACPI tables and fetch specific\r
441 field values. The ItemPtr member of the ACPI_PARSER structure (where used)\r
442 is updated by this parser function to point to the selected field data\r
443 (e.g. useful for variable length nested fields).\r
444\r
445 @param [in] Trace Trace the ACPI fields TRUE else only parse the\r
446 table.\r
447 @param [in] Indent Number of spaces to indent the output.\r
448 @param [in] AsciiName Optional pointer to an ASCII string that describes\r
449 the table being parsed.\r
450 @param [in] Ptr Pointer to the start of the buffer.\r
451 @param [in] Length Length of the buffer pointed by Ptr.\r
452 @param [in] Parser Pointer to an array of ACPI_PARSER structure that\r
453 describes the table being parsed.\r
454 @param [in] ParserItems Number of items in the ACPI_PARSER array.\r
455\r
456 @retval Number of bytes parsed.\r
a6eaba4d 457**/\r
ee4dc24f
RN
458UINT32\r
459EFIAPI\r
460ParseAcpi (\r
461 IN BOOLEAN Trace,\r
462 IN UINT32 Indent,\r
463 IN CONST CHAR8* AsciiName OPTIONAL,\r
464 IN UINT8* Ptr,\r
465 IN UINT32 Length,\r
466 IN CONST ACPI_PARSER* Parser,\r
467 IN UINT32 ParserItems\r
468)\r
469{\r
470 UINT32 Index;\r
f75c7478
DB
471 UINT32 Offset;\r
472 BOOLEAN HighLight;\r
ed874680 473 UINTN OriginalAttribute;\r
f75c7478
DB
474\r
475 Offset = 0;\r
ee4dc24f
RN
476\r
477 // Increment the Indent\r
478 gIndent += Indent;\r
479\r
480 if (Trace && (AsciiName != NULL)){\r
f75c7478 481 HighLight = GetColourHighlighting ();\r
ee4dc24f
RN
482\r
483 if (HighLight) {\r
484 OriginalAttribute = gST->ConOut->Mode->Attribute;\r
485 gST->ConOut->SetAttribute (\r
486 gST->ConOut,\r
487 EFI_TEXT_ATTR(EFI_YELLOW,\r
488 ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))\r
489 );\r
490 }\r
491 Print (\r
492 L"%*a%-*a :\n",\r
493 gIndent,\r
494 "",\r
495 (OUTPUT_FIELD_COLUMN_WIDTH - gIndent),\r
496 AsciiName\r
497 );\r
498 if (HighLight) {\r
499 gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);\r
500 }\r
501 }\r
502\r
503 for (Index = 0; Index < ParserItems; Index++) {\r
504 if ((Offset + Parser[Index].Length) > Length) {\r
505 // We don't parse past the end of the max length specified\r
506 break;\r
507 }\r
508\r
509 if (Offset != Parser[Index].Offset) {\r
510 IncrementErrorCount ();\r
511 Print (\r
512 L"\nERROR: %a: Offset Mismatch for %s\n"\r
e6f958d1 513 L"CurrentOffset = %d FieldOffset = %d\n",\r
ee4dc24f
RN
514 AsciiName,\r
515 Parser[Index].NameStr,\r
516 Offset,\r
517 Parser[Index].Offset\r
518 );\r
519 }\r
520\r
521 if (Trace) {\r
522 // if there is a Formatter function let the function handle\r
523 // the printing else if a Format is specified in the table use\r
524 // the Format for printing\r
525 PrintFieldName (2, Parser[Index].NameStr);\r
526 if (Parser[Index].PrintFormatter != NULL) {\r
527 Parser[Index].PrintFormatter (Parser[Index].Format, Ptr);\r
528 } else if (Parser[Index].Format != NULL) {\r
529 switch (Parser[Index].Length) {\r
530 case 1:\r
531 DumpUint8 (Parser[Index].Format, Ptr);\r
532 break;\r
533 case 2:\r
534 DumpUint16 (Parser[Index].Format, Ptr);\r
535 break;\r
536 case 4:\r
537 DumpUint32 (Parser[Index].Format, Ptr);\r
538 break;\r
539 case 8:\r
540 DumpUint64 (Parser[Index].Format, Ptr);\r
541 break;\r
542 default:\r
543 Print (\r
544 L"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",\r
545 AsciiName,\r
546 Parser[Index].Length\r
547 );\r
548 } // switch\r
549\r
550 // Validating only makes sense if we are tracing\r
551 // the parsed table entries, to report by table name.\r
552 if (Parser[Index].FieldValidator != NULL) {\r
553 Parser[Index].FieldValidator (Ptr, Parser[Index].Context);\r
554 }\r
555 }\r
556 Print (L"\n");\r
557 } // if (Trace)\r
558\r
559 if (Parser[Index].ItemPtr != NULL) {\r
560 *Parser[Index].ItemPtr = (VOID*)Ptr;\r
561 }\r
562\r
563 Ptr += Parser[Index].Length;\r
564 Offset += Parser[Index].Length;\r
565 } // for\r
566\r
567 // Decrement the Indent\r
568 gIndent -= Indent;\r
569 return Offset;\r
570}\r
571\r
a6eaba4d
DB
572/**\r
573 An array describing the ACPI Generic Address Structure.\r
ee4dc24f
RN
574 The GasParser array is used by the ParseAcpi function to parse and/or trace\r
575 the GAS structure.\r
a6eaba4d 576**/\r
ee4dc24f
RN
577STATIC CONST ACPI_PARSER GasParser[] = {\r
578 {L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},\r
579 {L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},\r
580 {L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},\r
581 {L"Address Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},\r
582 {L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}\r
583};\r
584\r
a6eaba4d
DB
585/**\r
586 This function indents and traces the GAS structure as described by the GasParser.\r
ee4dc24f
RN
587\r
588 @param [in] Ptr Pointer to the start of the buffer.\r
589 @param [in] Indent Number of spaces to indent the output.\r
a6eaba4d 590**/\r
ee4dc24f
RN
591VOID\r
592EFIAPI\r
593DumpGasStruct (\r
594 IN UINT8* Ptr,\r
595 IN UINT32 Indent\r
596 )\r
597{\r
598 Print (L"\n");\r
599 ParseAcpi (\r
600 TRUE,\r
601 Indent,\r
602 NULL,\r
603 Ptr,\r
604 GAS_LENGTH,\r
605 PARSER_PARAMS (GasParser)\r
606 );\r
607}\r
608\r
a6eaba4d
DB
609/**\r
610 This function traces the GAS structure as described by the GasParser.\r
ee4dc24f
RN
611\r
612 @param [in] Format Optional format string for tracing the data.\r
613 @param [in] Ptr Pointer to the start of the buffer.\r
a6eaba4d 614**/\r
ee4dc24f
RN
615VOID\r
616EFIAPI\r
617DumpGas (\r
618 IN CONST CHAR16* Format OPTIONAL,\r
619 IN UINT8* Ptr\r
620 )\r
621{\r
622 DumpGasStruct (Ptr, 2);\r
623}\r
624\r
a6eaba4d
DB
625/**\r
626 This function traces the ACPI header as described by the AcpiHeaderParser.\r
ee4dc24f
RN
627\r
628 @param [in] Ptr Pointer to the start of the buffer.\r
629\r
630 @retval Number of bytes parsed.\r
a6eaba4d 631**/\r
ee4dc24f
RN
632UINT32\r
633EFIAPI\r
634DumpAcpiHeader (\r
635 IN UINT8* Ptr\r
636 )\r
637{\r
ee4dc24f
RN
638 return ParseAcpi (\r
639 TRUE,\r
640 0,\r
641 "ACPI Table Header",\r
642 Ptr,\r
643 ACPI_DESCRIPTION_HEADER_LENGTH,\r
644 PARSER_PARAMS (AcpiHeaderParser)\r
645 );\r
646}\r
647\r
a6eaba4d
DB
648/**\r
649 This function parses the ACPI header as described by the AcpiHeaderParser.\r
ee4dc24f
RN
650\r
651 This function optionally returns the signature, length and revision of the\r
652 ACPI table.\r
653\r
654 @param [in] Ptr Pointer to the start of the buffer.\r
655 @param [out] Signature Gets location of the ACPI table signature.\r
656 @param [out] Length Gets location of the length of the ACPI table.\r
657 @param [out] Revision Gets location of the revision of the ACPI table.\r
658\r
659 @retval Number of bytes parsed.\r
a6eaba4d 660**/\r
ee4dc24f
RN
661UINT32\r
662EFIAPI\r
663ParseAcpiHeader (\r
664 IN UINT8* Ptr,\r
665 OUT CONST UINT32** Signature,\r
666 OUT CONST UINT32** Length,\r
667 OUT CONST UINT8** Revision\r
668 )\r
669{\r
670 UINT32 BytesParsed;\r
ee4dc24f
RN
671\r
672 BytesParsed = ParseAcpi (\r
673 FALSE,\r
674 0,\r
675 NULL,\r
676 Ptr,\r
677 ACPI_DESCRIPTION_HEADER_LENGTH,\r
678 PARSER_PARAMS (AcpiHeaderParser)\r
679 );\r
680\r
681 *Signature = AcpiHdrInfo.Signature;\r
682 *Length = AcpiHdrInfo.Length;\r
683 *Revision = AcpiHdrInfo.Revision;\r
684\r
685 return BytesParsed;\r
686}\r