From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.155685.1673830733587030818 for ; Sun, 15 Jan 2023 16:58:53 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=arhTeX6b; spf=pass (domain: intel.com, ip: 192.55.52.43, 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=1673830733; x=1705366733; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=2QvPhWsduSzt4nty5znvf9lQKcvt/dCf5iT3FH9oUr8=; b=arhTeX6bfo8OGGblMR3SYZr5Nndj/JxzF3HL8/wXYa64QR7uUM9kFzDm zBvt6m1UFWQzuErwgg5ACpqJQWbuOJCpUePE891WdE5CNQcKA5fJhyHkn 5CDwDvWggEpc6QhQbwJUw9W4mWlOy/DV03JQQeRKLq09bpnhN3pWDonzo 6mKHjmX8WOoZpbPJpRUY37wnlRSuCdsoVYclw7nrHJU7nCS5UyfGAVTZ/ +tWNOcD8OyMSSON0eKwCH999rnYGVGde6y9NkGIKF3yczRT/9/HU5fZYi ciyhrQHu8iiyfOejkmMpDm8Z1y8ZtNEHZD+urZfuj3SpTjAtPrD6QQfrX Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="410604703" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="410604703" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2023 16:58:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10591"; a="987624777" X-IronPort-AV: E=Sophos;i="5.97,219,1669104000"; d="scan'208";a="987624777" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP; 15 Jan 2023 16:58:53 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 15 Jan 2023 16:58:52 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Sun, 15 Jan 2023 16:58:52 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.109) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Sun, 15 Jan 2023 16:58:51 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eCuPwme1vzJMpXEmaSy45Sqsl1jDwlf+R2GHav8PFw9XLAsUgVPE7W/JBJJbWGhtJCOdfPrT4qkyeaSQJ3PW6MlMf4svd5/vvyU8ZBkNCR3vSyvA7KI9lC/rEXUiDJRcp/OhS90GSJY2QBZwEdo/dwyIEdJNEz+a4ByuK6D5aZlX7EIXIZ3FAyqWg4BLO7WC8/8rpcK7d+hzjTXBUSZFaFh5bbnPAcp4afYrPVHhsE6UxzeEgJcri12aqHitq+qj1Py7vbza0u2IToxLUlHQYDh84GeXAVK0RRSq/FsN+xSMqqzQsIFxCielB4qzFpyh3wY2Adik8IbZIyDb/w7eoQ== 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=utzjek89R46urCeLgG7swQxr6ADqSUSOtVM5kX6g/fo=; b=WzIa+g6rszdGp9tAqBQl3nIXXga/QHkt3D+bt3of8f4f4KWk9o0AuZM2x6x+jFFG888MvjU4jAwMwIW5VmWyt72uvrvp3dfyHaFSdlj2o3SBk8PfhspOGHSnJx60HwdnB8of+LkaZJot5yNQRvcqzZppSievqMa1FQH0q3g/ziOzBeZr0dKpZnQ6dRHVXs7nvHgq6irL15Jk8krdk1r2Y9OONi8g7OFfGpDZQ9iiISxJLXyqHJT7VIohZADfmUPmHG+CCNSsEDZyGd5UDgEhggNfXvsGvhZlZVYsMa1I0tqv49KB5RWYZICKcYqpa6khO1a2MK1bht4cKj8zZvf22Q== 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 PH7PR11MB6377.namprd11.prod.outlook.com (2603:10b6:510:1fb::13) by SN7PR11MB6678.namprd11.prod.outlook.com (2603:10b6:806:26a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Mon, 16 Jan 2023 00:58:49 +0000 Received: from PH7PR11MB6377.namprd11.prod.outlook.com ([fe80::5f27:d428:eb21:fbeb]) by PH7PR11MB6377.namprd11.prod.outlook.com ([fe80::5f27:d428:eb21:fbeb%8]) with mapi id 15.20.5986.022; Mon, 16 Jan 2023 00:58:49 +0000 From: "Gao, Zhichao" To: Jeshua Smith , "devel@edk2.groups.io" CC: "Ni, Ray" Subject: Re: [PATCH] ShellPkg/AcpiView: ERST Parser Thread-Topic: [PATCH] ShellPkg/AcpiView: ERST Parser Thread-Index: AQHZBOoiSrp8Q6JeHU+4+NIsTgkCj66ggWcg Date: Mon, 16 Jan 2023 00:58:49 +0000 Message-ID: References: <998e19f8df9167c20b4b7bfe5e9ecac0093fc132.1669832339.git.jeshuas@nvidia.com> In-Reply-To: <998e19f8df9167c20b4b7bfe5e9ecac0093fc132.1669832339.git.jeshuas@nvidia.com> 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: PH7PR11MB6377:EE_|SN7PR11MB6678:EE_ x-ms-office365-filtering-correlation-id: 6287f4f9-b95c-4cbf-5d5a-08daf75cd412 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0wlGU1f+OdfDaCil5iZZjj702ynTSkrDgT6ulUHzwIsT0J4iUAsCwBCLbN9EzA4ZFUpzqS6ict9EfNxNtOdYDUiUwqKcrbAK5d7JlKYc3iqykIVRMc4CJjd7UKIjO4z3zSSLDhK961VsZLohxEq/hT7SwCptFsUvtwxhXeo3iEqPfOlBNzDfuexjaeMCvTJPkCnozySg2g0ioxwxLfMb9tTPuv33IAJOujabDtCgzTkLnqWy4hwQx79UbPMeY8hfs/aQ8vLTGDb0QOeHG3C9dXeF/gPsqGNoLGFNIwh5JmDTtyiR2M11ca57jJwWTKbinn7q22n2U1UR3m7YVHmWtO6ePJ933PZuki14g3umjdtvqAGPGxQHAbWJ+K/+IlIHU1G7pMlE+o8takYQ29XVelKsOjPwSuQhjQn+UQxehLWsFZ7q0ZZJ+zgOAI8QT33fcVxVQNhyeNanC3cxo6L7unzz74j0gfJLHCcILDpJysMyKhnQt5yhslB9S8xNh4UlYZefgv5jlZFvjOY04Jq/ktWptmXG6OOgClYmZadRTFDHQTo4QGlXBFvTxxdQiDjEK6mTzf2K9QFw4izRezWC4xkOAlFm5cB6icVz9sZHlugQF4qddXsCFTU14XvKRtDxm4+pcQJVrUX/Hyd7rTJQg2dkf/SbG+koCELWJOPJ/tUA/1yyQGvUvKvvh9ytj+eHNUACF5A2cw+WZOONPd0ALw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB6377.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(366004)(346002)(136003)(396003)(39860400002)(451199015)(86362001)(33656002)(186003)(26005)(9686003)(4326008)(8676002)(64756008)(53546011)(66446008)(66946007)(76116006)(66556008)(41300700001)(66476007)(55016003)(6506007)(316002)(7696005)(71200400001)(19627235002)(110136005)(107886003)(478600001)(122000001)(30864003)(38100700002)(38070700005)(2906002)(82960400001)(52536014)(83380400001)(5660300002)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cODGnI65q0ilXbAx6P05pwVMkLBMNoyVQX9676Ot2qVf84jD59IMKmTs4Hix?= =?us-ascii?Q?d1/Hf9R2psxzc8W1w2upJS0BUck9WxMLKoJ/yjO84tANnAsrXc5yTTDScgIZ?= =?us-ascii?Q?kbkvJWNGVTksI0Hnc55jRSmNtmkQUPR/+8oWBsLHYBNEO9eB1CqjZtfb0Gom?= =?us-ascii?Q?3NuR6vhGJFOCoxcg4SA7Bb38s/+mI+lBLUHl51zU+KAh3G5sSIL+2riISxUY?= =?us-ascii?Q?5ye+hmej2Lx/YiJQOqKWRdPiIH1HLLOg4d6/q1VoPHeq634oXBTN9XJuztQA?= =?us-ascii?Q?tp8sRsov4o1uFugGA/utZFqqptqfy5tMOKmHa5giqwdh1dUGK94Bc/fm26xi?= =?us-ascii?Q?rMD5FH0xIiFIcA+tiOU2/uhlJQOE5zpiHrfzkSRX2mv9fKTBonyOT1NZgkjR?= =?us-ascii?Q?gXS6/RvA5hM/2Vzi56aFsAmdvELRtHmv7hMEOMZN7Qjc2H0zmh6aTJ8qlV7y?= =?us-ascii?Q?Rl04/pnBmeNvLFbuFQLP0YtT1WZe+W7dTUWBUgHWRADYDCc9yXiixfcWy0pA?= =?us-ascii?Q?va/y2g9fD8bZE7bzT4rZCMXqUFvB1+lrjdsPSQGnkmymW89I1iOEYGCh74lQ?= =?us-ascii?Q?euTRVcrDHyEyOviEX4uMb4XJYlh3FVgbDqE2cGvgRP0THk0jrVHEDuxfjib+?= =?us-ascii?Q?9RjYNIBYz54VDx+52KibY+nhcIBu/Utf3NFc94kLHPt5+QUBdyERL/VvtjBh?= =?us-ascii?Q?TUPiquWNYTUTQGJsZ9SEj3lQJCmaeTuL4XCd4t4/tgh2uOTYsPWqv5AYL7a7?= =?us-ascii?Q?Ob2RkuDxz8AXqcK5k14d/FypkU4lcpPTZmBoKEuGbrK7ZGCdgY791b1KkMM0?= =?us-ascii?Q?V+rbWBC4fJ3CkavFCy30bEE5hdyIq+2szvBkhySXtH/OMLfO9K/VP6djJjUy?= =?us-ascii?Q?KEWnLgVijc1SFeDgnW+80Q5peW5l114a1uHO4e/YDbtY/mFe51iZk5/6eAnS?= =?us-ascii?Q?UG+6m9oplnQLFqaOewlt5ydyE9LGd3ugncPybs1J7jqXSWbCH5U2teLf7qw+?= =?us-ascii?Q?JhsQhgA86Kx6lBRXFnXFOSfI6qrEt6bl372D0mI/e51cvwb1M7P9QHkoTNXY?= =?us-ascii?Q?mDIV7MgCmHjBFxPI2oaklK9BdHvZmhjNnrMAchi2MaPeQyMWwnussDqeSyn2?= =?us-ascii?Q?HgdF1PHFupSYcXqYE83Lg9FOMGaa2nRFm7wnlkekp7yfXF3OklKN+bLV1bPp?= =?us-ascii?Q?V3xFpIOyjysJQ/pMe1sX3FlXK52qaT6OMof4lAI0SQViLdzAFDIwGHtccIRz?= =?us-ascii?Q?SD/6M6Kp7e8l3ZWU0p/h/gGNLyqS3eAyST7O1EpYo1DE5pZ0L4yVeNZnMXyS?= =?us-ascii?Q?CzAJ/QOMaHSikVE8+m1gabSGWqsb2Pc/++Ymy991AE4JNMl2xXGiPkyGfS17?= =?us-ascii?Q?lxmrL4ncPRCGIBlhLDgrC/2r7J0sAgCDRbWUxNxFvmonaaa/mAcHrwFfSZfY?= =?us-ascii?Q?Qn+rX7VyZwXtViTKEUt+syvk33p1sWCMlmn9YNAgI27FmcB8dMuvQ1lLBF0a?= =?us-ascii?Q?+43Q2ymv5VT+8SPwhMct6cz6KHZsf4b7GSS20A5YIkyL3eiWjMw9htOaE2Ju?= =?us-ascii?Q?5ylfYhU/tBi87ekWA2VUPP8lb4BcJa9by6B9i1rR?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6377.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6287f4f9-b95c-4cbf-5d5a-08daf75cd412 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2023 00:58:49.2746 (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: PzVHLEPgR3uFPmoUAUN97qGBAJS+BnoyBCYrUXWSJaNLhXmwbtzdWsfxKxgAIsfJWgBDoFStxegiKljp9umARw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6678 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 Reviewed-by: Zhichao Gao Thanks, Zhichao > -----Original Message----- > From: Jeshua Smith > Sent: Thursday, December 1, 2022 2:31 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Gao, Zhichao ; > Jeshua Smith > Subject: [PATCH] ShellPkg/AcpiView: ERST Parser >=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)*(*InstructionEnt > ryCount) !=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/UefiShellAcpiViewComma > ndLib.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma > ndLib.c >=20 > index 09bdddb56e..d37ad7cacc 100644 >=20 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma > ndLib.c >=20 > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma > ndLib.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_SIGNATURE, >=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/UefiShellAcpiViewComma > ndLib.inf > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma > ndLib.inf >=20 > index 63fc5a1281..904fea83de 100644 >=20 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma > ndLib.inf >=20 > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma > ndLib.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