From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.59]) by mx.groups.io with SMTP id smtpd.web10.5292.1574422324750999639 for ; Fri, 22 Nov 2019 03:32:05 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=RCAEC54I; spf=pass (domain: arm.com, ip: 40.107.15.59, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DT98ZkXFcQNLk37CgV/hXCYWisGY4qFbHQd/vi4Xpwo=; b=RCAEC54I3DojW5fYLXxVcN167632VnoVm/VSTFaIvj7oeg/GzC5mj0X2/T/X0BN8KDqpKqnERRk6Obh1+S1iRLBNgPc2s4hpEHQPcFzNkKcfOndn5EK4fWx5RwrJrCEnwVhniw0hJEIAZLrqajpt2iQMSigFXY4tL8Qw/BwSR4k= Received: from AM6PR08CA0025.eurprd08.prod.outlook.com (2603:10a6:20b:c0::13) by AM6PR08MB3479.eurprd08.prod.outlook.com (2603:10a6:20b:43::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 11:32:02 +0000 Received: from AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::203) by AM6PR08CA0025.outlook.office365.com (2603:10a6:20b:c0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.16 via Frontend Transport; Fri, 22 Nov 2019 11:32:02 +0000 Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT046.mail.protection.outlook.com (10.152.16.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17 via Frontend Transport; Fri, 22 Nov 2019 11:32:02 +0000 Received: ("Tessian outbound 712c40e503a7:v33"); Fri, 22 Nov 2019 11:32:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f59aeacc706508b4 X-CR-MTA-TID: 64aa7808 Received: from 9fd4eadacb1b.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.6.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0E959362-54C1-4322-A771-F8FCAFDEAEF4.1; Fri, 22 Nov 2019 11:31:56 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02lp2052.outbound.protection.outlook.com [104.47.6.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9fd4eadacb1b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 22 Nov 2019 11:31:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DJ5BiL024ZOazy54re30Se9zkzVDsNh8kDuyBb1daxte7efMZvMCbF5NbiUaCueY597jCm667xncuLIHC5iYmlEB9U1nOPA90tcxVUMgsj01tN7rnC5HgvljkVyQaMunY9MUA2SSKuF7BL7+FIji4OBSV2ZUTEiUwqVlcnwexWGda6cnQYPXygaqIXlUUyHKfngWhp4ufYIMtnjK0K/qcU0+iGj9WvvVJ8GlEgQRRGPbdoZo91457i9UH5z84Su9mOCH8ZAcDsH25Gdwy9HMmlWVIjwUrfQmx9fK/wmrlGlTFMIiscCaHrJKFM2xyE/bzQYtwrSovSW06uMZmuFaaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DT98ZkXFcQNLk37CgV/hXCYWisGY4qFbHQd/vi4Xpwo=; b=BBggvga/FBbK/4Hnr8KOUVyqI15ydHCtLIZDjWZ6yfP4ylwFTGPy6PFF+VGwI6+DZUipePyey20tKjGIrCVHVezUmcEkGaKPVeGBwpgu7axDSV3V17sdRrfbod7v+UWadjhOTHYVNg6pjh7kXO6stl4VUii7SM7EbJ1wdWMF4XGpdU1FAEMuhAZ3rGjwvLnePsca3f7FWgOZGhy895ZJfLz2ZF+flqbkDVGNLgoWJdY3uL84hdHL3EgB2Vtlq6J5bWMvj6yDvLMzWYCAo8eQHEKDiCoyrbe9rySpgsycb/4C/DC238nnTwoD7LjH8I3sezQNaeutcDr6xMi6WsTIRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DT98ZkXFcQNLk37CgV/hXCYWisGY4qFbHQd/vi4Xpwo=; b=RCAEC54I3DojW5fYLXxVcN167632VnoVm/VSTFaIvj7oeg/GzC5mj0X2/T/X0BN8KDqpKqnERRk6Obh1+S1iRLBNgPc2s4hpEHQPcFzNkKcfOndn5EK4fWx5RwrJrCEnwVhniw0hJEIAZLrqajpt2iQMSigFXY4tL8Qw/BwSR4k= Received: from AM4PR08CA0050.eurprd08.prod.outlook.com (2603:10a6:205:2::21) by VI1PR08MB2703.eurprd08.prod.outlook.com (2603:10a6:802:25::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Fri, 22 Nov 2019 11:31:54 +0000 Received: from VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by AM4PR08CA0050.outlook.office365.com (2603:10a6:205:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.16 via Frontend Transport; Fri, 22 Nov 2019 11:31:54 +0000 Authentication-Results-Original: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT059.mail.protection.outlook.com (10.152.19.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2474.17 via Frontend Transport; Fri, 22 Nov 2019 11:31:54 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Fri, 22 Nov 2019 11:31:52 +0000 Received: from E114225.Arm.com (10.1.195.19) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 22 Nov 2019 11:31:52 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [PATCH v1 1/1] ShellPkg: acpiview: Add support for parsing FACS Date: Fri, 22 Nov 2019 11:31:45 +0000 Message-ID: <20191122113145.18088-1-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;IPV:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(136003)(396003)(346002)(39860400002)(376002)(189003)(199004)(50466002)(19627235002)(106002)(2906002)(186003)(336012)(47776003)(426003)(48376002)(356004)(2616005)(16586007)(14444005)(6666004)(51416003)(316002)(2351001)(305945005)(26005)(7696005)(54906003)(44832011)(5660300002)(50226002)(6306002)(36756003)(6916009)(70206006)(81166006)(81156014)(8676002)(8936002)(30864003)(1076003)(70586007)(53416004)(86362001)(966005)(478600001)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR08MB2703;H:nebula.arm.com;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4a40811-ac16-4b1f-3275-08d76f3f981f X-MS-TrafficTypeDiagnostic: VI1PR08MB2703:|AM6PR08MB3479: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true X-MS-Oob-TLC-OOBClassifiers: OLM:3044;OLM:3044; X-Forefront-PRVS: 02296943FF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: BurdULjVxYIgtoIDZAmBbSY3Wufo9tNrPQj8gYoLxl/4lAhnIBc3cTiTNTMK53huQkYWk8eFRRc6QzbvVrVasGxdUoeR0Bi0q9ipML3nKjg6NtBuVfKi/9n36KtuYyKW1D0LC/LPMYbw0G6XSQsuKP63YMHYAqbNMRjySjGGzG9WFcSj1WEp6OOwkJGKKfGlvXgBWJpDjMNIjFZ5Qc/6Uk4zl69+z/RDzyo0BokHOzmPJ4EPd9q4JwHAEU2KTYeuoWt2evtlSLY1oSy55M1//wMIhMWn9SB2UDXInsufQA4DxZxFG2aiW2EmzvR9uLN2fHDfTQX9rbLJsR48CVB+1ljNSfTBXevkZJFHy7H1JKSmZ5UUY5W1SJFk/J5H2GIJpZyX6D3nOQnKKeyYJu3Zt6vfnLRFHRXfJRPI0Fzic29e2/0YaFE0RJEMtcCkn4bUYdvwJbTvPddd5frrAFqlV7kh4eif3zksiCu7OYHmMn4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2703 Original-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(39860400002)(396003)(346002)(1110001)(339900001)(189003)(199004)(105606002)(2351001)(50466002)(47776003)(48376002)(22756006)(53416004)(70586007)(26826003)(70206006)(966005)(19627235002)(36906005)(76130400001)(5660300002)(1076003)(4326008)(478600001)(305945005)(316002)(44832011)(30864003)(14444005)(81166006)(81156014)(8936002)(50226002)(336012)(86362001)(54906003)(2906002)(7696005)(36756003)(2616005)(6916009)(8676002)(51416003)(426003)(16586007)(26005)(186003)(6306002)(6666004);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB3479;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:Fail;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;MX:1;A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 7bddc8be-d7fb-45e2-bbf7-08d76f3f9377 NoDisclaimer: True X-Forefront-PRVS: 02296943FF X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zeFm8D7MWP3WiasT2h7WI4pgqMmHkWbwUaG7QAH8iNesU1PX1VxTHi9Sr2xUyxz0v7J2kv04yFYyQYBQcOAxOFbfGwc46osMjDGbxbty9pb72/z2pmBBnXQgXWKzzF3sH0yyKT6l+PH+JkKVIPiKTkV2tLvS3aOnTqfMoHTIbkEMmvomtjDb4xRQHgOsUoEZ/C5jFmUjM3Lap7ospd5WbRxPIpJ+eQaNRaPk6k/iPkHqxVhm7aaeDUMFXeXGNpB2karVzpqTWsvQvNI9ZBBqvCHS91z0VA1IocVp9bAs1umnJiabANbrFM5v3G/gfrOTO/xUsfJADWtM7Szex0wPnQkbusKJpzlPaYaieITkTlPzL9cO0qB6J6SSFevlV/T9A2jXiIjeSmiSU4smH+OoiDC2Z0h1I5e0qsba6sEPP+ah1pvCerOb1P1FLyb346y5ojRKo0p5tWqNNcggxxuHg0kIr1Cwi2N2GMoaLTVs854= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2019 11:32:02.1198 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4a40811-ac16-4b1f-3275-08d76f3f981f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3479 Content-Type: text/plain Add support for parsing the ACPI FACS table. The FADT parser has also been updated as it links the FACS table using the FIRMWARE_CTRL or X_FIRMWARE_CTRL fields. Since the FACS table does not follow the standard ACPI header, the FADT parser extracts the FACS signature, length and version fields before invoking the FACS parser. CC: Ray Ni CC: Zhichao Gao Signed-off-by: Sami Mujawar --- The changes can be seen at: https://github.com/samimujawar/edk2/tree/656_acpiview_facs_parser_v1 Notes: v1: - Add support for parsing FACS table [SAMI] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 21 +++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c | 71 +++++++++++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 90 ++++++++++++++++++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf | 1 + 5 files changed, 179 insertions(+), 5 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 20ca358bddfa5953bfb1d1bebaebbf3079eaba01..f374f8ebfe313954c05b2a432816cf7ad3af9e32 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -528,6 +528,27 @@ ParseAcpiDsdt ( IN UINT8 AcpiTableRevision ); +/** + This function parses the ACPI FACS table. + When trace is enabled this function parses the FACS table and + traces the ACPI table fields. + + This function also performs validation of the ACPI table fields. + + @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] AcpiTableLength Length of the ACPI table. + @param [in] AcpiTableRevision Revision of the ACPI table. +**/ +VOID +EFIAPI +ParseAcpiFacs ( + IN BOOLEAN Trace, + IN UINT8* Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ); + /** This function parses the ACPI FADT table. This function parses the FADT table and optionally traces the ACPI diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c new file mode 100644 index 0000000000000000000000000000000000000000..d6bea86bdbaa79aa35b86840c809394b3c7a3bf6 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c @@ -0,0 +1,71 @@ +/** @file + FACS table parser + + Copyright (c) 2019, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - ACPI 6.3 Specification - January 2019 +**/ + +#include +#include +#include "AcpiParser.h" +#include "AcpiTableParser.h" + +/** + An ACPI_PARSER array describing the ACPI FACS Table. +**/ +STATIC CONST ACPI_PARSER FacsParser[] = { + {L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL}, + {L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL}, + {L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, + {L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL}, + {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, + {L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL, + NULL}, + {L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL, + NULL}, + {L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL, + NULL} +}; + +/** + This function parses the ACPI FACS table. + When trace is enabled this function parses the FACS table and + traces the ACPI table fields. + + This function also performs validation of the ACPI table fields. + + @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] AcpiTableLength Length of the ACPI table. + @param [in] AcpiTableRevision Revision of the ACPI table. +**/ +VOID +EFIAPI +ParseAcpiFacs ( + IN BOOLEAN Trace, + IN UINT8* Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ) +{ + if (!Trace) { + return; + } + + ParseAcpi ( + Trace, + 0, + "FACS", + Ptr, + AcpiTableLength, + PARSER_PARAMS (FacsParser) + ); +} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index e40c9ef8ee4b3285faf8c6edf3cb6236ee367397..5b8cc174f16afb3d4feb6a518952e60c6564ee34 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -5,17 +5,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 + - ACPI 6.3 Specification - January 2019 **/ #include #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" // Local variables STATIC CONST UINT32* DsdtAddress; STATIC CONST UINT64* X_DsdtAddress; +STATIC CONST UINT32* Flags; +STATIC CONST UINT32* FirmwareCtrl; +STATIC CONST UINT64* X_FirmwareCtrl; STATIC CONST UINT8* FadtMinorRevision; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @@ -24,6 +28,21 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; **/ #define HW_REDUCED_ACPI BIT20 +/** + Offset to the FACS signature from the start of the FACS. +**/ +#define FACS_SIGNATURE_OFFSET 0 + +/** + Offset to the FACS revision from the start of the FACS. +**/ +#define FACS_VERSION_OFFSET 32 + +/** + Offset to the FACS length from the start of the FACS. +**/ +#define FACS_LENGTH_OFFSET 4 + /** Get the ACPI XSDT header info. **/ @@ -113,7 +132,8 @@ ValidateFlags ( **/ STATIC CONST ACPI_PARSER FadtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), - {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, NULL, ValidateFirmwareCtrl, NULL}, + {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID**)&FirmwareCtrl, + ValidateFirmwareCtrl, NULL}, {L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL}, {L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL}, {L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL}, @@ -150,13 +170,13 @@ STATIC CONST ACPI_PARSER FadtParser[] = { {L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL}, {L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Flags", 4, 112, L"0x%x", NULL, NULL, ValidateFlags, NULL}, + {L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL}, {L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL}, {L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL}, {L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL}, {L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision, NULL, NULL}, - {L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, NULL, + {L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID**)&X_FirmwareCtrl, ValidateXFirmwareCtrl, NULL}, {L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL}, {L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL}, @@ -192,7 +212,13 @@ ParseAcpiFadt ( IN UINT8 AcpiTableRevision ) { - UINT8* DsdtPtr; + EFI_STATUS Status; + UINT8* DsdtPtr; + UINT8* FirmwareCtrlPtr; + UINT32 FacsSignature; + UINT32 FacsLength; + UINT8 FacsRevision; + PARSE_ACPI_TABLE_PROC FacsParserProc; ParseAcpi ( Trace, @@ -214,6 +240,60 @@ ParseAcpiFadt ( } } + // If X_FIRMWARE_CTRL is not zero then use X_FIRMWARE_CTRL and ignore + // FIRMWARE_CTRL, else use FIRMWARE_CTRL. + if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) { + FirmwareCtrlPtr = (UINT8*)(UINTN)(*X_FirmwareCtrl); + } else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) { + FirmwareCtrlPtr = (UINT8*)(UINTN)(*FirmwareCtrl); + } else { + FirmwareCtrlPtr = NULL; + // if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and + // X_FIRMWARE_CTRL cannot be zero, and the FACS Table must be + // present. + if ((Trace) && + (Flags != NULL) && + ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != 0)) { + IncrementErrorCount (); + Print (L"ERROR: No FACS table found, " + L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n"); + } + } + + if (FirmwareCtrlPtr != NULL) { + // The FACS table does not have a standard ACPI table header. Therefore, + // the signature, length and version needs to be initially parsed. + // The FACS signature is 4 bytes starting at offset 0. + FacsSignature = *(UINT32*)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET); + + // The FACS length is 4 bytes starting at offset 4. + FacsLength = *(UINT32*)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET); + + // The FACS version is 1 byte starting at offset 32. + FacsRevision = *(UINT8*)(FirmwareCtrlPtr + FACS_VERSION_OFFSET); + + Trace = ProcessTableReportOptions ( + FacsSignature, + FirmwareCtrlPtr, + FacsLength + ); + + Status = GetParser (FacsSignature, &FacsParserProc); + if (EFI_ERROR (Status)) { + Print ( + L"ERROR: No registered parser found for FACS.\n" + ); + return; + } + + FacsParserProc ( + Trace, + FirmwareCtrlPtr, + FacsLength, + FacsRevision + ); + } + // If X_DSDT is not zero then use X_DSDT and ignore DSDT, // else use DSDT. if (*X_DsdtAddress != 0) { diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index 3ee0f0fe421c6acdde33becca80d8efcbeda0fde..e0d5a81085525a91110d9a25279adf3376286342 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -29,6 +29,7 @@ ACPI_TABLE_PARSER ParserList[] = { {EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2}, {EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiDsdt}, + {EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs}, {EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt}, {EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt}, {EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort}, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf index 1e2fa52b00a37f73d789ba4049c531f5bc29fb5b..ea504c934aeebaa452a380e6ea169586e467642a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf @@ -31,6 +31,7 @@ [Sources.common] Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c Parsers/Dsdt/DsdtParser.c + Parsers/Facs/FacsParser.c Parsers/Fadt/FadtParser.c Parsers/Gtdt/GtdtParser.c Parsers/Iort/IortParser.c -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'