From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.7568.1672983172536235791 for ; Thu, 05 Jan 2023 21:32:52 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=VRxrLVPf; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: zhichao.gao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672983172; x=1704519172; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=z5kDNK/1ziVJnqKqWh6ctR2SmktU3RhY9eMcE28SvSQ=; b=VRxrLVPfVgM/5rBVUZydSdCjEzyhoviFs9Br+2XPVq3I+SyU1+vZFATK O67AkL+6XEMLsSWqnTEaFc3bddEciVof7ArL4cLBqYbSp+0MyI387Xik6 EsitYMbiVcv3U6G6l6xkP3XCzoMtXsTnwnl7cZAEnIsSfMjnCfmo5+uZz 3+83dO6O3k6m/U4k06MUeClF/WPcTWfBmhN0rOfm65LvydwaT7K+Kio1G XukZn7SAjSTVxM2LlHlyH7X4wTmcHbAEM/vt81qRzJuXanAFYRgEcKJAv 4MDSF/quPk831gSvW8oLgAXXzMkXIYZsOhwa2CNfH649UH1NXkZDUZ3H0 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10581"; a="310200639" X-IronPort-AV: E=Sophos;i="5.96,304,1665471600"; d="scan'208";a="310200639" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 21:32:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10581"; a="719082206" X-IronPort-AV: E=Sophos;i="5.96,304,1665471600"; d="scan'208";a="719082206" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 05 Jan 2023 21:32:51 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 5 Jan 2023 21:32:51 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 5 Jan 2023 21:32:51 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 5 Jan 2023 21:32:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FtwnsZIfNOA6mvGYC0nUIa7ylcpeZD5+wGk54/RQZg2izZ0Q9xN+W9FPrRhUwQ1KfGx8nVVRwhiA6V22O3XQVudXag7YbIX0rY37B/JrIDMMTcdeonFhBGuIre/gPeEoGzZoPzv8T8z5J8SdFPGMXrdCQ/SLBlwJrRb0+3jyUvqRVc7GTUv2WeNdZAr9vpvAzJY6lMn31dWMtjepB3GQOXdJBhVVlzRs7oPaUKzE/Zp93zdVP+aWF9YmQ5IQhgbYZ81rtIhrQR6BHZkNJy5mVv9yeFUri+qNIY2G5ggTYD2SExudh/OUdScGaEzYsQXL0PQR2dqJlTEk1gLNO1FQpw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=01/FohdrFwoTzKBsigLjyuZJf3ex2kU5JvJrgNfQEHY=; b=S0UJbaiUhmJdWzSkN9DSvkD068PZT9d9Xq3m3FqxyV+R7zYlwg6FRCeoZ18qMiskoalHWMv92f6YlIe3NeuSiyQjIAGKIVJ9YDSebxPyQ97wnkXdCWxjkYy4pWKIa+Y3ubedLmb9Mt3EccKdlY5GKeOuC3Od8IvFlxC+dgLQtnRG+DETQ5Q4mnVrw0+oMD6prv2DfKm/iLKG89CoG8Hs4HBaeCTtHpWdecRv2k18Y161XMgOuOzpXPnSA6kzDK24spz3cryvIkvmZrRCUcTxnIBHg/8s7VQKIBD9syAeDOeLRWiAKOJ3ZoHMMdrYBRtYSv2Ku5ufFePEarfHHO16CA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from IA1PR11MB6370.namprd11.prod.outlook.com (2603:10b6:208:3ae::8) by IA1PR11MB7245.namprd11.prod.outlook.com (2603:10b6:208:42f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 6 Jan 2023 05:32:48 +0000 Received: from IA1PR11MB6370.namprd11.prod.outlook.com ([fe80::4552:f0a7:9296:7928]) by IA1PR11MB6370.namprd11.prod.outlook.com ([fe80::4552:f0a7:9296:7928%2]) with mapi id 15.20.5944.019; Fri, 6 Jan 2023 05:32:48 +0000 From: "Gao, Zhichao" To: "devel@edk2.groups.io" , "jeshuas@nvidia.com" CC: "Ni, Ray" Subject: Re: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser Thread-Topic: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser Thread-Index: AQHZBOpXB9a9spZ9q0OLc05Xoh3we65tl+4AgCKn4CCAANa6gA== Date: Fri, 6 Jan 2023 05:32:48 +0000 Message-ID: References: <172C707E2AD4FEF1.1705@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: IA1PR11MB6370:EE_|IA1PR11MB7245:EE_ x-ms-office365-filtering-correlation-id: 3e8a8f86-774d-4e0c-56f2-08daefa77261 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ht7emfHCYJcnpOb9FxLkyX542kMD+QeRqpYZM1Ij8XPH+0Dlc+Fn9uG17kUEINeChtn0h3H6EIteMeqHs8L88kptwH/4TfmzYtjpT/VMQQeFmWZ6Q0Yq8yNI7YxPStzS7LxlrUC0DJtYMPLo0iq0+bpg9ZrktO1rRozbGRAhT9WaZuCcQ+mj7dvDPVe1ajhJIsdNzEMAEB9be3krlNIzb+e8C/cMtKA8kEtWGg2Gy1G8QpjVOmNlOrGx5YVk2APH91tMv+p5enIJsNzE6uU4sT8JXa24zlrZYOTcuGyzxflvyuEanrsMbIXt86xLcco5fOmhS4cdUyrfMoDFzBFUp5vGBhu8hgbuECAopHODoYN6SVeAcze5KTn6PnbMW1gDEN+7IsR1dvZn0HbIdwaWAPKS1kvaD1iKQFHLH5vrHbQ9fVrhA9uKUc8kjxhvgeRDRhqTaJy7qWPqeMhKX87D84mvHInH9GEgdVSItbXGqINTrDVRWWg1XqTbldw8gK4rx3x8B4i5lF+DBBam49nYnYUdpTG7GDjc3UgVfgYbJ6k2Jshz54teIJpFRP4Ep73EI9bSy3Af9Fq0EULIrrSDYtRclOhnz4W8SlnxpqcThLa6UF73uScVlfcxzskgK1tfYnlf0kI8ryavnyXueBfaAk0QyxHJjIF8K7QjP/6L2cXXIpmtrkIqC3nWNOVaHNaC6Wq9Adwk1Kl/dI3m1o+yBSdQSd+prNytzCRU9okamaB/IKTBG4lxMc5abs9jww7OYo9Kiuo2BYV9bo7RBj6AnQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR11MB6370.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(136003)(39860400002)(376002)(366004)(396003)(451199015)(33656002)(5660300002)(26005)(83380400001)(186003)(107886003)(66899015)(9686003)(55016003)(71200400001)(41300700001)(30864003)(2906002)(52536014)(7696005)(66556008)(64756008)(66946007)(86362001)(76116006)(66476007)(4326008)(66446008)(8676002)(122000001)(38100700002)(8936002)(110136005)(82960400001)(6506007)(53546011)(316002)(966005)(38070700005)(478600001)(19627235002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8q3iOImtjasEBe2MHcLOwUM3lipCn4e0iSLDlV5441ATm334kmmtzCFrzJmK?= =?us-ascii?Q?/EBEkpqykpf02bnRXHqmFPkyaxaC0LiUFiKn0tQXZPv8a3ccJjMVkL8Oyd9e?= =?us-ascii?Q?KfWWux8WQhdKagsL57hC8Vr1F3UIe9PGgNjY58YTzbrJ7kegCDaqTNUeMNOk?= =?us-ascii?Q?9175nIq6K3biZMvEQS4vqOklDYrKrc2j8KDJ68WcO9AGsTSN97Pw+7VSxiPr?= =?us-ascii?Q?GEMxbVvrxJhoJvpiXUH9yTccDf8l+NkEiSJT6IBJSasbYnfo1P1F7Kvy5OEM?= =?us-ascii?Q?I5QxFGCIXAEbJp2GkVknIStUedvL+YoAMCaftSwlRMM24QB5+GjMeNCbW4fv?= =?us-ascii?Q?rcCPoFkjmTfOQZLBwh96ML0/IYylyfT2RjUMm6EfaoR0Y/0QR3IiL0xrwKt5?= =?us-ascii?Q?pkIzkdqK+gBprudmZa/wE2B/pry4WmQEheDO7SR9KdIALSCbbZPXG44upBj1?= =?us-ascii?Q?1ZtjNr22TZVdyJsct6K+UiUgQU8bOOUOOSe2lJ4Wjm4cbu2obbN0SS7hmCNP?= =?us-ascii?Q?yrdJy3HDxdMwjEv31ZtZ61GJjIxILgncm+/opOr11wALFfAOTe6H6GvB79CW?= =?us-ascii?Q?MPUkDMhnLeWqoEqI+iKz2c+N0iUWTfcCIIcqGymdIaY61sEJiax3Ejy2rBtw?= =?us-ascii?Q?B4DcGnbRH0WRywvd9EVKFTowqJpOcleFFzUs8HGli5DalEAACfMbUjxreEOp?= =?us-ascii?Q?TiKC9UbnQBn+rkXohey5BvKrH0pXdAzwN72amsFGluGui0GVzmKls6yqrNlF?= =?us-ascii?Q?MC//qL19iZ+eRG1gu99NTnw5d+HSWeCsTaM8lOd49b6Kc69qPQghqRS+DTjT?= =?us-ascii?Q?AxL5v3IuNwwHdwDpix20/UeEDZwXBSGSxLDRN1QwBSj+iR7JAjttndX5/WdE?= =?us-ascii?Q?d+Ut5qZ8Hc2734RUHHtg6KBVARqz/QiarACanY9+2ta8fnmb0mI1mSjx5sr7?= =?us-ascii?Q?1qsoJB12eWXJZH5BeDoTVl+3p2nD57BCFC6vBDXaTUvVQZI3o7/DzMXQVDyb?= =?us-ascii?Q?QDCVVEuP5TWnjmBDbjPZuqdd77JVaDRjOA6eeYTOZhEfHF1DtBoovlkZPEYO?= =?us-ascii?Q?3VqmT+s5twCl8yPbs266uxwrE0rz7mqNVeOP3uCU006H/zvihHgq1qjGMjjW?= =?us-ascii?Q?Qk/5DQkgm+Tl9j03xHX9KDBvsnYyyrMdjjc5enRcxZYzyBPGYizpRgV1A5g1?= =?us-ascii?Q?LaPodXNhbsBfiUFozyV/uO8XEGueHLSHiTOhJs/bQnkIOj+TKKwGDxxOfheO?= =?us-ascii?Q?vIU7MNGk03BgQxP5UTRmNPCOT9Q8NxYnReiDpFqZMB60qE6K9TTYfH0olHk1?= =?us-ascii?Q?UOz0c8wfYSp2x0ogo8U5gqIuCwn14C5RungQea9UKf50uYIjkPiKMgIO30z6?= =?us-ascii?Q?rCbnhGvkvCWjItR0o9SYtqWsiEuav2e3EfgIjQkF43cFIBhFMOnohVTC1SEL?= =?us-ascii?Q?Kqoee1JfqaHs7JV84kb4/gvYhIIpAlEaatL9vy03l75/iguHs9sUXGqQ2xx5?= =?us-ascii?Q?nrC50/4Td6DjeLKYnJ7xNp7alNZv+wltjM/7jmBljO3S2i8EkgcFq29Be8N9?= =?us-ascii?Q?ZwaGy/twtHCzkHPRzLqSkj8zlfJCtRefiQ1CNNQm?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB6370.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e8a8f86-774d-4e0c-56f2-08daefa77261 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2023 05:32:48.3749 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KRUoJrD5srg5Lh1jOei7VJxqtugLfp0tXwe3a41HjjzcTIj5gxRBsgG6XCVxOUakNAgJ1wJMBVnICqn2/8oExQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7245 Return-Path: zhichao.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Sorry, just back from personal affairs. I would review the patch in next we= ek. Thanks, Zhichao > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Jeshua > Smith via groups.io > Sent: Friday, January 6, 2023 12:48 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Gao, Zhichao > Subject: Re: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser >=20 > Resending after the holidays. >=20 > -----Original Message----- > From: Jeshua Smith > Sent: Wednesday, December 14, 2022 8:30 AM > To: devel@edk2.groups.io; Jeshua Smith > Cc: ray.ni@intel.com; zhichao.gao@intel.com > Subject: RE: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser >=20 > Is there anything holding this up from getting reviewed? >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Jeshua > Smith via groups.io > Sent: Wednesday, November 30, 2022 11:31 AM > To: devel@edk2.groups.io > Cc: ray.ni@intel.com; zhichao.gao@intel.com; Jeshua Smith > > Subject: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser >=20 > External email: Use caution opening links or attachments >=20 >=20 > Add a new parser for the Error Record Serialization Table. >=20 > The ERST table describes how an OS can save and retrieve >=20 > hardware error information to and from a persistent store. >=20 >=20 >=20 > Signed-off-by: Jeshua Smith >=20 > --- >=20 > .../UefiShellAcpiViewCommandLib/AcpiParser.h | 22 ++ >=20 > .../Parsers/Erst/ErstParser.c | 278 ++++++++++++++++++ >=20 > .../UefiShellAcpiViewCommandLib.c | 2 + >=20 > .../UefiShellAcpiViewCommandLib.inf | 2 + >=20 > 4 files changed, 304 insertions(+) >=20 > create mode 100644 > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c >=20 >=20 >=20 > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h >=20 > index db8c88f6df..66c992c55c 100644 >=20 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h >=20 > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h >=20 > @@ -1,6 +1,7 @@ >=20 > /** @file >=20 > Header file for ACPI parser >=20 >=20 >=20 > + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. >=20 > Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. >=20 > Copyright (c) 2022, AMD Incorporated. All rights reserved. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -594,6 +595,27 @@ ParseAcpiDsdt ( >=20 > IN UINT8 AcpiTableRevision >=20 > ); >=20 >=20 >=20 > +/** >=20 > + This function parses the ACPI ERST table. >=20 > + When trace is enabled this function parses the ERST table and >=20 > + traces the ACPI table fields. >=20 > + >=20 > + This function also performs validation of the ACPI table fields. >=20 > + >=20 > + @param [in] Trace If TRUE, trace the ACPI fields. >=20 > + @param [in] Ptr Pointer to the start of the buffer. >=20 > + @param [in] AcpiTableLength Length of the ACPI table. >=20 > + @param [in] AcpiTableRevision Revision of the ACPI table. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +ParseAcpiErst ( >=20 > + IN BOOLEAN Trace, >=20 > + IN UINT8 *Ptr, >=20 > + IN UINT32 AcpiTableLength, >=20 > + IN UINT8 AcpiTableRevision >=20 > + ); >=20 > + >=20 > /** >=20 > This function parses the ACPI FACS table. >=20 > When trace is enabled this function parses the FACS table and >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c >=20 > new file mode 100644 >=20 > index 0000000000..e2af0c44b4 >=20 > --- /dev/null >=20 > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c >=20 > @@ -0,0 +1,278 @@ >=20 > +/** @file >=20 > + ERST table parser >=20 > + >=20 > + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. >=20 > + Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. >=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > + @par Reference(s): >=20 > + - ACPI 6.5 Specification - August 2022 >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include "AcpiParser.h" >=20 > +#include "AcpiTableParser.h" >=20 > + >=20 > +// Local variables >=20 > +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; >=20 > +STATIC UINT32 *InstructionEntryCount; >=20 > + >=20 > +/** >=20 > + An array of strings describing the Erst actions >=20 > +**/ >=20 > +STATIC CONST CHAR16 *ErstActionTable[] =3D { >=20 > + L"BEGIN_WRITE_OPERATION", >=20 > + L"BEGIN_READ_OPERATION", >=20 > + L"BEGIN_CLEAR_OPERATION", >=20 > + L"END_OPERATION", >=20 > + L"SET_RECORD_OFFSET", >=20 > + L"EXECUTE_OPERATION", >=20 > + L"CHECK_BUSY_STATUS", >=20 > + L"GET_COMMAND_STATUS", >=20 > + L"GET_RECORD_IDENTIFIER", >=20 > + L"SET_RECORD_IDENTIFIER", >=20 > + L"GET_RECORD_COUNT", >=20 > + L"BEGIN_DUMMY_WRITE_OPERATION", >=20 > + L"RESERVED", >=20 > + L"GET_ERROR_LOG_ADDRESS_RANGE", >=20 > + L"GET_ERROR_LOG_ADDRESS_RANGE_LENGTH", >=20 > + L"GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES", >=20 > + L"GET_EXECUTE_OPERATION_TIMINGS" >=20 > +}; >=20 > + >=20 > +/** >=20 > + An array of strings describing the Erst instructions >=20 > +**/ >=20 > +STATIC CONST CHAR16 *ErstInstructionTable[] =3D { >=20 > + L"READ_REGISTER", >=20 > + L"READ_REGISTER_VALUE", >=20 > + L"WRITE_REGISTER", >=20 > + L"WRITE_REGISTER_VALUE", >=20 > + L"NOOP", >=20 > + L"LOAD_VAR1", >=20 > + L"LOAD_VAR2", >=20 > + L"STORE_VAR1", >=20 > + L"ADD", >=20 > + L"SUBTRACT", >=20 > + L"ADD_VALUE", >=20 > + L"SUBTRACT_VALUE", >=20 > + L"STALL", >=20 > + L"STALL_WHILE_TRUE", >=20 > + L"SKIP_NEXT_INSTRUCTION_IF_TRUE", >=20 > + L"GOTO", >=20 > + L"SET_SRC_ADDRESS_BASE", >=20 > + L"SET_DST_ADDRESS_BASE", >=20 > + L"MOVE_DATA" >=20 > +}; >=20 > + >=20 > +/** >=20 > + Validate Erst action. >=20 > + >=20 > + @param [in] Ptr Pointer to the start of the field data. >=20 > + @param [in] Context Pointer to context specific information e.g. thi= s >=20 > + could be a pointer to the ACPI table header. >=20 > +**/ >=20 > +STATIC >=20 > +VOID >=20 > +EFIAPI >=20 > +ValidateErstAction ( >=20 > + IN UINT8 *Ptr, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + if (*Ptr > EFI_ACPI_6_4_ERST_GET_EXECUTE_OPERATION_TIMINGS) { >=20 > + IncrementErrorCount (); >=20 > + Print (L"\nError: 0x%02x is not a valid action encoding", *Ptr); >=20 > + } >=20 > +} >=20 > + >=20 > +/** >=20 > + Validate Erst instruction. >=20 > + >=20 > + @param [in] Ptr Pointer to the start of the field data. >=20 > + @param [in] Context Pointer to context specific information e.g. thi= s >=20 > + could be a pointer to the ACPI table header. >=20 > +**/ >=20 > +STATIC >=20 > +VOID >=20 > +EFIAPI >=20 > +ValidateErstInstruction ( >=20 > + IN UINT8 *Ptr, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + if (*Ptr > EFI_ACPI_6_4_ERST_MOVE_DATA) { >=20 > + IncrementErrorCount (); >=20 > + Print (L"\nError: 0x%02x is not a valid instruction encoding", *Ptr)= ; >=20 > + } >=20 > +} >=20 > + >=20 > +/** >=20 > + Validate Erst flags. >=20 > + >=20 > + @param [in] Ptr Pointer to the start of the field data. >=20 > + @param [in] Context Pointer to context specific information e.g. thi= s >=20 > + could be a pointer to the ACPI table header. >=20 > +**/ >=20 > +STATIC >=20 > +VOID >=20 > +EFIAPI >=20 > +ValidateErstFlags ( >=20 > + IN UINT8 *Ptr, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + if ((*Ptr & 0xfe) !=3D 0) { >=20 > + IncrementErrorCount (); >=20 > + Print (L"\nError: Reserved Flag bits not set to 0"); >=20 > + } >=20 > +} >=20 > + >=20 > +/** >=20 > + Looks up and prints the string corresponding to the index >=20 > + >=20 > + @param [in] Table Lookup table >=20 > + @param [in] Index Entry to print >=20 > + @param [in] NumEntries Number of valid entries in the table >=20 > +**/ >=20 > +STATIC >=20 > +VOID >=20 > +EFIAPI >=20 > +FormatByte ( >=20 > + IN CONST CHAR16 *Table[], >=20 > + IN UINT8 Index, >=20 > + IN UINT8 NumEntries >=20 > + ) >=20 > +{ >=20 > + CONST CHAR16 *String; >=20 > + >=20 > + if (Index < NumEntries) { >=20 > + String =3D Table[Index]; >=20 > + } else { >=20 > + String =3D L"**INVALID**"; >=20 > + } >=20 > + >=20 > + Print ( >=20 > + L"0x%02x (%s)", >=20 > + Index, >=20 > + String >=20 > + ); >=20 > +} >=20 > + >=20 > +/** >=20 > + Prints the Erst Action >=20 > + >=20 > + @param [in] Format Optional format string for tracing the data. >=20 > + @param [in] Ptr Pointer to the Action byte >=20 > +**/ >=20 > +STATIC >=20 > +VOID >=20 > +EFIAPI >=20 > +DumpErstAction ( >=20 > + IN CONST CHAR16 *Format OPTIONAL, >=20 > + IN UINT8 *Ptr >=20 > + ) >=20 > +{ >=20 > + FormatByte (ErstActionTable, *Ptr, ARRAY_SIZE (ErstActionTable)); >=20 > +} >=20 > + >=20 > +/** >=20 > + Prints the Erst Instruction >=20 > + >=20 > + @param [in] Format Optional format string for tracing the data. >=20 > + @param [in] Ptr Pointer to the Instruction byte >=20 > +**/ >=20 > +STATIC >=20 > +VOID >=20 > +EFIAPI >=20 > +DumpErstInstruction ( >=20 > + IN CONST CHAR16 *Format OPTIONAL, >=20 > + IN UINT8 *Ptr >=20 > + ) >=20 > +{ >=20 > + FormatByte (ErstInstructionTable, *Ptr, ARRAY_SIZE (ErstInstructionTab= le)); >=20 > +} >=20 > + >=20 > +/** >=20 > + An ACPI_PARSER array describing the ACPI ERST Table. >=20 > +**/ >=20 > +STATIC CONST ACPI_PARSER ErstParser[] =3D { >=20 > + PARSE_ACPI_HEADER (&AcpiHdrInfo), >=20 > + { L"Serialization Header Size", 4, 36, L"0x%x", NULL, NULL, > NULL, NULL }, >=20 > + { L"Reserved", 4, 40, L"0x%x", NULL, NULL, = NULL, > NULL }, >=20 > + { L"Instruction Entry Count", 4, 44, L"0x%x", NULL, (VOID > **)&InstructionEntryCount, NULL, NULL } >=20 > +}; >=20 > + >=20 > +/** >=20 > + An ACPI_PARSER array describing the Serialization Instruction Entry > structure. >=20 > +**/ >=20 > +STATIC CONST ACPI_PARSER SerializationInstructionEntryParser[] =3D { >=20 > + { L"Serialization Action", 1, 0, L"0x%x", DumpErstAction, NUL= L, > ValidateErstAction, NULL }, >=20 > + { L"Instruction", 1, 1, L"0x%x", DumpErstInstruction, NUL= L, > ValidateErstInstruction, NULL }, >=20 > + { L"Flags", 1, 2, L"0x%x", NULL, NUL= L, ValidateErstFlags, > NULL }, >=20 > + { L"Reserved", 1, 3, L"0x%x", NULL, NUL= L, NULL, > NULL }, >=20 > + { L"Register Region", 12, 4, NULL, DumpGas, NUL= L, NULL, > NULL }, >=20 > + { L"Value", 8, 16, L"0x%llx", NULL, NUL= L, NULL, > NULL }, >=20 > + { L"Mask", 8, 24, L"0x%llx", NULL, NUL= L, NULL, > NULL } >=20 > +}; >=20 > + >=20 > +/** >=20 > + This function parses the ACPI ERST table. >=20 > + When trace is enabled this function parses the ERST table and >=20 > + traces the ACPI table fields. >=20 > + >=20 > + This function also performs validation of the ACPI table fields. >=20 > + >=20 > + @param [in] Trace If TRUE, trace the ACPI fields. >=20 > + @param [in] Ptr Pointer to the start of the buffer. >=20 > + @param [in] AcpiTableLength Length of the ACPI table. >=20 > + @param [in] AcpiTableRevision Revision of the ACPI table. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +ParseAcpiErst ( >=20 > + IN BOOLEAN Trace, >=20 > + IN UINT8 *Ptr, >=20 > + IN UINT32 AcpiTableLength, >=20 > + IN UINT8 AcpiTableRevision >=20 > + ) >=20 > +{ >=20 > + UINT32 Offset; >=20 > + >=20 > + if (!Trace) { >=20 > + return; >=20 > + } >=20 > + >=20 > + Offset =3D ParseAcpi ( >=20 > + Trace, >=20 > + 0, >=20 > + "ERST", >=20 > + Ptr, >=20 > + AcpiTableLength, >=20 > + PARSER_PARAMS (ErstParser) >=20 > + ); >=20 > + >=20 > + if (sizeof > (EFI_ACPI_6_4_ERST_SERIALIZATION_INSTRUCTION_ENTRY)*(*InstructionE > ntryCount) !=3D (AcpiTableLength - Offset)) { >=20 > + IncrementErrorCount (); >=20 > + Print ( >=20 > + L"ERROR: Invalid InstructionEntryCount. " \ >=20 > + L"Count =3D %d. Offset =3D %d. AcpiTableLength =3D %d.\n", >=20 > + *InstructionEntryCount, >=20 > + Offset, >=20 > + AcpiTableLength >=20 > + ); >=20 > + return; >=20 > + } >=20 > + >=20 > + while (Offset < AcpiTableLength) { >=20 > + Offset +=3D ParseAcpi ( >=20 > + Trace, >=20 > + 2, >=20 > + "Serialization Action", >=20 > + Ptr + Offset, >=20 > + (AcpiTableLength - Offset), >=20 > + PARSER_PARAMS (SerializationInstructionEntryParser) >=20 > + ); >=20 > + } >=20 > +} >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.c >=20 > index 09bdddb56e..d37ad7cacc 100644 >=20 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.c >=20 > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.c >=20 > @@ -1,6 +1,7 @@ >=20 > /** @file >=20 > Main file for 'acpiview' Shell command function. >=20 >=20 >=20 > + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. >=20 > Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > @@ -52,6 +53,7 @@ ACPI_TABLE_PARSER ParserList[] =3D { >=20 > { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, > ParseAcpiDbg2 }, >=20 >=20 > { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATUR > E, >=20 > ParseAcpiDsdt }, >=20 > + { EFI_ACPI_6_4_ERROR_RECORD_SERIALIZATION_TABLE_SIGNATURE, > ParseAcpiErst }, >=20 > { EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, > ParseAcpiFacs }, >=20 > { EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, > ParseAcpiFadt }, >=20 > { EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, > ParseAcpiGtdt }, >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.inf > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.inf >=20 > index 63fc5a1281..904fea83de 100644 >=20 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.inf >=20 > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm > andLib.inf >=20 > @@ -1,6 +1,7 @@ >=20 > ## @file >=20 > # Provides Shell 'acpiview' command functions >=20 > # >=20 > +# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. >=20 > # Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
>=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -31,6 +32,7 @@ >=20 > Parsers/Bgrt/BgrtParser.c >=20 > Parsers/Dbg2/Dbg2Parser.c >=20 > Parsers/Dsdt/DsdtParser.c >=20 > + Parsers/Erst/ErstParser.c >=20 > Parsers/Facs/FacsParser.c >=20 > Parsers/Fadt/FadtParser.c >=20 > Parsers/Gtdt/GtdtParser.c >=20 > -- >=20 > 2.25.1 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20