]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c
ShellPkg: acpiview: Add support for parsing FACS
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / Parsers / Facs / FacsParser.c
1 /** @file
2 FACS table parser
3
4 Copyright (c) 2019, ARM Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 @par Reference(s):
8 - ACPI 6.3 Specification - January 2019
9 **/
10
11 #include <IndustryStandard/Acpi.h>
12 #include <Library/UefiLib.h>
13 #include "AcpiParser.h"
14 #include "AcpiTableParser.h"
15
16 /**
17 An ACPI_PARSER array describing the ACPI FACS Table.
18 **/
19 STATIC CONST ACPI_PARSER FacsParser[] = {
20 {L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL},
21 {L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
22 {L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
23 {L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
24 {L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
25 {L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
26 {L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
27 {L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL},
28 {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
29 {L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
30 {L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
31 NULL},
32 {L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
33 NULL},
34 {L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
35 NULL}
36 };
37
38 /**
39 This function parses the ACPI FACS table.
40 When trace is enabled this function parses the FACS table and
41 traces the ACPI table fields.
42
43 This function also performs validation of the ACPI table fields.
44
45 @param [in] Trace If TRUE, trace the ACPI fields.
46 @param [in] Ptr Pointer to the start of the buffer.
47 @param [in] AcpiTableLength Length of the ACPI table.
48 @param [in] AcpiTableRevision Revision of the ACPI table.
49 **/
50 VOID
51 EFIAPI
52 ParseAcpiFacs (
53 IN BOOLEAN Trace,
54 IN UINT8* Ptr,
55 IN UINT32 AcpiTableLength,
56 IN UINT8 AcpiTableRevision
57 )
58 {
59 if (!Trace) {
60 return;
61 }
62
63 ParseAcpi (
64 Trace,
65 0,
66 "FACS",
67 Ptr,
68 AcpiTableLength,
69 PARSER_PARAMS (FacsParser)
70 );
71 }