From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.51]) by mx.groups.io with SMTP id smtpd.web11.17913.1672937263258294208 for ; Thu, 05 Jan 2023 08:47:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=Uj3JgUS1; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.93.51, mailfrom: jeshuas@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R9Z7g6C4wQo6Z7BagvhhoyhodUizTFeyRJNbM0eeElCkuqNz9R8SZya6q0lHDHEx89bJLlqyTonmlmGSWRl8FABcZHRHgpTOxbyqFyH87+JPzrgH3BIZVGj2OgEQ5L2X1F15kP/7fGmxRo3FwZY3rXh/rvC6Gmt13hbqQDISsmTKqnLaR2941t3sRRadvD7hISmtJVVWeS8gh5Rzkg9x8RizhzhBJOEJlSbxFCY50phH2F6DBsG0x6aIk+zF/hD0Td0NXpNfg80scm+l4hA6F0n/Kl7OFTefF3BpYfqYy0scGu3ZWLPm/kN7Hq+bsEzH67T6WeNXvblzWc2R0JPh0A== 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=hMf1FrLsdUpCxAk9xqlMubjXRH+eIMJUXkccXopdy10=; b=WV+N3YTfkBYRYkFZR1dQX46UO8Yvc78R2bVsM7nta4LtWRT2WRzsCJSsY1vyG5g6tzuSZp/q5VUoq+YAl+S6TL1sFaF3klc1Rw7EnBts93GLoQzyN/K2gmxv4dBV9AQV9L9FpukQdaKN5IMrijmcJTnxKOvTYMboPWavaKIzbpsHWhA5IN7kF1FqLoqa4iThuofztiLJNJuDkP/jliODTlVkQ7yHeB1DbPseWx75T9h6WQ6JJDqylzQsRSdTpYYYkD+1dgF+bP9Pn27vZxam8yFF1YwegW2Ddg5AzwQ2MKBEbfA7a1JQDO5I2tLtgCdBUG9caCnqxAuZy2dH6ypeeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hMf1FrLsdUpCxAk9xqlMubjXRH+eIMJUXkccXopdy10=; b=Uj3JgUS13gJwMu47QHtks3rhoKsnG7DM4RQVx9BzEQQXrenjX0OEnijXSRhG+N/0xmV4gDx5hOfaBZ2lwFCADeowAG0tsedDVZcLEI/zRa1kho4vKygxbaDy+UHa++XiW7mzhK7cY1oie6wFrTQTIh+lLye62JQ2NoGrR07AkmYkVuekE05gOYMSdcdeELzM0uEiNvOFx2Cf1frUOlCNLAiW/y35yswZe7tUpQo+WCPpuywO9RaqcvyrOIGLTv6KCgx1FEIgNsXAeNHkRTUWHULyMlv1NhXw05Gybk7VuC7a0KFwqGkN38Md4Fkiy1ZIF7Ck/RWBnpKTvj9y2laLtw== Received: from DM6PR12MB3371.namprd12.prod.outlook.com (2603:10b6:5:116::27) by DM4PR12MB6277.namprd12.prod.outlook.com (2603:10b6:8:a5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 16:47:41 +0000 Received: from DM6PR12MB3371.namprd12.prod.outlook.com ([fe80::d52b:f6aa:20c9:6cbf]) by DM6PR12MB3371.namprd12.prod.outlook.com ([fe80::d52b:f6aa:20c9:6cbf%7]) with mapi id 15.20.5944.019; Thu, 5 Jan 2023 16:47:41 +0000 From: "Jeshua Smith" To: "devel@edk2.groups.io" CC: "ray.ni@intel.com" , "zhichao.gao@intel.com" Subject: Re: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser Thread-Topic: [edk2-devel] [PATCH] ShellPkg/AcpiView: ERST Parser Thread-Index: AQHZBOpXB9a9spZ9q0OLc05Xoh3we65tl+4AgCKn4CA= Date: Thu, 5 Jan 2023 16:47:41 +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=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR12MB3371:EE_|DM4PR12MB6277:EE_ x-ms-office365-filtering-correlation-id: ece3d0d3-a4bc-4ee9-2fdc-08daef3c8f98 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Zu27Dzn+z5s7ErZYQ2TJh8ksOICGudtwVuqq+ClhMzKNjtTG2Dl8nQxarAxRCKdgQn8pOAFMVx8ALcoOaiABYxh6vmp9jjkPQyEBNrubL9Vht/LWIT6CWcV4BWWTK0rtfvi5Q1mrHLJx5me6ZCKlXkh9K/3A5GqhlpyCLoW/JGXJ7fWYB/bplV+MSL206sQ/vo+X/lTLIIVW53gycxVgK+5mQWNWJgjJRwA77f0MbUVlZeIbUYhdd7i2QYHYFxmsS36mj73/k2dhTW0tzDV31w1jYBNk4JkGzbxFWRwrc/X4jUfUGfmrCEXwFNz6k+gw171mEAQ3UOXNoYMJusOh4Dci+mhLBpwY3nlLVc7gG9A/NNUM0D2NAILdeNZFaHtNMeADYzNEadZ3nxfy654KFfL+GB/5mjcQ+/06aVNDuvLZoD1dyTUTSKEfhicB2ZmfQNcuTnH5BOwOXj7JRScBQiLACB5RALwTCLkqYUh19huSRpgeYALBOo+kRO2Ykw0htoc6c7eCFRHGYAtT0SKaE+jF7JCTuHQMuYSn5jqa4vbD+nn9EQk+hQOUTSM+p4CP/saz6Xeq/wHRrODQVYPFrSdl2E3UL3Xort93ojnOH9hoXDgzNdNGocq2tdJ21J4slCe18UY3otApYQ305/jEokWPWQvg/kSUNgh5zSE0KQ3renkvKV0rwqR+UqQS6V71kip5J5rHUItwud/wKgHsWpdbjGmxYdoiHllih0/pGiw= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3371.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(346002)(136003)(366004)(376002)(451199015)(55016003)(83380400001)(7696005)(186003)(6506007)(9686003)(33656002)(38070700005)(86362001)(122000001)(53546011)(38100700002)(8676002)(4326008)(8936002)(52536014)(66899015)(41300700001)(5660300002)(2906002)(30864003)(966005)(478600001)(71200400001)(54906003)(316002)(76116006)(66446008)(19627235002)(66476007)(64756008)(66946007)(6916009)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?yFMQmYfOZpsAEaGsuy2LLtx2edhlUzQgksZgOvOXRirvPMzxGOOMFeL4H354?= =?us-ascii?Q?nxNl8LSfmhY9INorNs6pWcip1oQJCA5LOo+fP6wEXGPTJeetQT2bL+H9NesY?= =?us-ascii?Q?YF8ofAdaTP6/4cA08CVza78P+feSkkn1secnPxaTkYgpNTM09gdFz/lGcz7M?= =?us-ascii?Q?ue/Dndmuo7TImcMu8kaEKEyoA/1k/ihYhAKNNqiOyso2IEpmgdS8TRZYIyFu?= =?us-ascii?Q?lxK1hN1oX+aGP4+CqAXiaIt7AYPovJ/CebbkKbnZ7OJLLeLUFluk5Wk2Rm/b?= =?us-ascii?Q?3IpRkWGMnPoejINxod5Pyg4PSb888ub5+QfUR5wkDAI6CxZFDpndGJAkkaJC?= =?us-ascii?Q?969UoyVCxWG2ad4s+AWMY2ARIkvHT7gIF2pInsPDfTUwum5YMeFQh/wVJv/4?= =?us-ascii?Q?S+cth+XJMeQYiyvtpc4dRK2V8RZXk0gijQGrWOK/k8il49C88lcork3NASvD?= =?us-ascii?Q?xxGXUlLW1STHimsBFNx8xRJlJ6xaZBYq9FICCd2kbPRaywKLJp7Na9Gx+vBj?= =?us-ascii?Q?ghlK9TI31cLU6LE8p0yMsa19+0GZ8mwhCPggATHZc1L1hmrueSgiP3JaVm5K?= =?us-ascii?Q?4dbzt/+kKV5f9dPpaNTHyBDoiCdc5Ka2TL71zRunPkeIcHlA1PfI2V6uAjXn?= =?us-ascii?Q?Loq/tYMAxr5VIk8CcOf6vwt5XT6RimV0cPlyEYDb85lW25vJYvPwFjkBU51V?= =?us-ascii?Q?50ECSL9uROABx5tsMQOzrgbvRm0BNtlKnu7ljLUkCrglljQq3z6YZOIPN4oB?= =?us-ascii?Q?/yn79UqYfgFHYXblKOY9mQK8i1gyDEy0Sf37QIJB5wrmSJ/vEAtDBtz2VhRL?= =?us-ascii?Q?NmkSJcSrk/a+avRqO6NPSbjNVA5ETRGOznfE4DZPqmgDt1X6dBdyi28LH4oK?= =?us-ascii?Q?40KOpC10uS1jdqF4z1PbWzd3J4/5zCXtYb/PK1lhn9qqkRALNVSKnWyn5zJf?= =?us-ascii?Q?8GNv7MwOJhW0P36VyWHQIglzt+600wUXn3+knh56B/CkdpqqpJ0UYvxL+zdX?= =?us-ascii?Q?JUYFbMoJFQHWGtmu3cQrCVGL2CrwOC7F0jT7htEizHzX5vJQaOA3nLETo1ic?= =?us-ascii?Q?PWVJ+wdBJD6OEHiFSiR8Uj2kU0zp1eMPKfNjW8bqN9OPFrTn8bEzP4JIWKNL?= =?us-ascii?Q?8eN0cBexbAIkH8mgvsMH9TRbGes0LxEYB6+E3GRCcwTzcpo9uwbLezjALEZ4?= =?us-ascii?Q?ox9uljeMZLlNMwkzSOEzWBAsmbWVRkBGeOV/wLhhPtHokOEnhu0HuslT8TEc?= =?us-ascii?Q?UyUAzcxtsE7ee3sFIVJT2NWJygqROp5q1cYG1NY3+Su3Cq0fI9Ge7EPPnO+l?= =?us-ascii?Q?zlTqs96R2Iytvc5SwDF76BXvCK11ciMCVeKvHNxxI2R1dFEyUY7Sorq53Jt9?= =?us-ascii?Q?yDDj2mbEOQKTcCpx/vn9+6lAB7HOZYRpfz9Z9wdO1/MvQNWyBsmmTQwLluTC?= =?us-ascii?Q?2g63YX4fniozNQ95vFPpCxLGBjJbg53Ogr3mOZrEBpKnpVXPivdulqr4NBH9?= =?us-ascii?Q?nNDeUiLO44rrjWt+O5ohAZ7geXSv/HeRgPEsmH+k90wTYo1HVd14nt/I0UD1?= =?us-ascii?Q?duviLX5Ed4hF5CCbxeLHRTaa994bVzZUYUdpNSjLlPQV+364dC/bfL9+067H?= =?us-ascii?Q?NXOi+p8A5lpDXkUxEW/l95CLJwtjUS43KL7ix495Rdbc?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3371.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ece3d0d3-a4bc-4ee9-2fdc-08daef3c8f98 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2023 16:47:41.1913 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: d+51H/Q2IEMDeFUNUSG+1pr6QNGO1IvQhv5cNYzPWcVpL4YBldXygpfPrkhiTuvKhiwKhk5nslT2OZhXAcLNzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6277 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Resending after the holidays. -----Original Message----- From: Jeshua Smith=20 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 Is there anything holding this up from getting reviewed? -----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 External email: Use caution opening links or attachments Add a new parser for the Error Record Serialization Table. The ERST table describes how an OS can save and retrieve hardware error information to and from a persistent store. Signed-off-by: Jeshua Smith --- .../UefiShellAcpiViewCommandLib/AcpiParser.h | 22 ++ .../Parsers/Erst/ErstParser.c | 278 ++++++++++++++++++ .../UefiShellAcpiViewCommandLib.c | 2 + .../UefiShellAcpiViewCommandLib.inf | 2 + 4 files changed, 304 insertions(+) create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Er= st/ErstParser.c diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index db8c88f6df..66c992c55c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -1,6 +1,7 @@ /** @file Header file for ACPI parser + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. Copyright (c) 2022, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -594,6 +595,27 @@ ParseAcpiDsdt ( IN UINT8 AcpiTableRevision ); +/** + This function parses the ACPI ERST table. + When trace is enabled this function parses the ERST 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 +ParseAcpiErst ( + IN BOOLEAN Trace, + IN UINT8 *Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ); + /** This function parses the ACPI FACS table. When trace is enabled this function parses the FACS table and diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/Erst= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstPa= rser.c new file mode 100644 index 0000000000..e2af0c44b4 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.= c @@ -0,0 +1,278 @@ +/** @file + ERST table parser + + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. + Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - ACPI 6.5 Specification - August 2022 +**/ + +#include +#include +#include "AcpiParser.h" +#include "AcpiTableParser.h" + +// Local variables +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; +STATIC UINT32 *InstructionEntryCount; + +/** + An array of strings describing the Erst actions +**/ +STATIC CONST CHAR16 *ErstActionTable[] =3D { + L"BEGIN_WRITE_OPERATION", + L"BEGIN_READ_OPERATION", + L"BEGIN_CLEAR_OPERATION", + L"END_OPERATION", + L"SET_RECORD_OFFSET", + L"EXECUTE_OPERATION", + L"CHECK_BUSY_STATUS", + L"GET_COMMAND_STATUS", + L"GET_RECORD_IDENTIFIER", + L"SET_RECORD_IDENTIFIER", + L"GET_RECORD_COUNT", + L"BEGIN_DUMMY_WRITE_OPERATION", + L"RESERVED", + L"GET_ERROR_LOG_ADDRESS_RANGE", + L"GET_ERROR_LOG_ADDRESS_RANGE_LENGTH", + L"GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES", + L"GET_EXECUTE_OPERATION_TIMINGS" +}; + +/** + An array of strings describing the Erst instructions +**/ +STATIC CONST CHAR16 *ErstInstructionTable[] =3D { + L"READ_REGISTER", + L"READ_REGISTER_VALUE", + L"WRITE_REGISTER", + L"WRITE_REGISTER_VALUE", + L"NOOP", + L"LOAD_VAR1", + L"LOAD_VAR2", + L"STORE_VAR1", + L"ADD", + L"SUBTRACT", + L"ADD_VALUE", + L"SUBTRACT_VALUE", + L"STALL", + L"STALL_WHILE_TRUE", + L"SKIP_NEXT_INSTRUCTION_IF_TRUE", + L"GOTO", + L"SET_SRC_ADDRESS_BASE", + L"SET_DST_ADDRESS_BASE", + L"MOVE_DATA" +}; + +/** + Validate Erst action. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateErstAction ( + IN UINT8 *Ptr, + IN VOID *Context + ) +{ + if (*Ptr > EFI_ACPI_6_4_ERST_GET_EXECUTE_OPERATION_TIMINGS) { + IncrementErrorCount (); + Print (L"\nError: 0x%02x is not a valid action encoding", *Ptr); + } +} + +/** + Validate Erst instruction. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateErstInstruction ( + IN UINT8 *Ptr, + IN VOID *Context + ) +{ + if (*Ptr > EFI_ACPI_6_4_ERST_MOVE_DATA) { + IncrementErrorCount (); + Print (L"\nError: 0x%02x is not a valid instruction encoding", *Ptr); + } +} + +/** + Validate Erst flags. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateErstFlags ( + IN UINT8 *Ptr, + IN VOID *Context + ) +{ + if ((*Ptr & 0xfe) !=3D 0) { + IncrementErrorCount (); + Print (L"\nError: Reserved Flag bits not set to 0"); + } +} + +/** + Looks up and prints the string corresponding to the index + + @param [in] Table Lookup table + @param [in] Index Entry to print + @param [in] NumEntries Number of valid entries in the table +**/ +STATIC +VOID +EFIAPI +FormatByte ( + IN CONST CHAR16 *Table[], + IN UINT8 Index, + IN UINT8 NumEntries + ) +{ + CONST CHAR16 *String; + + if (Index < NumEntries) { + String =3D Table[Index]; + } else { + String =3D L"**INVALID**"; + } + + Print ( + L"0x%02x (%s)", + Index, + String + ); +} + +/** + Prints the Erst Action + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the Action byte +**/ +STATIC +VOID +EFIAPI +DumpErstAction ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr + ) +{ + FormatByte (ErstActionTable, *Ptr, ARRAY_SIZE (ErstActionTable)); +} + +/** + Prints the Erst Instruction + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the Instruction byte +**/ +STATIC +VOID +EFIAPI +DumpErstInstruction ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr + ) +{ + FormatByte (ErstInstructionTable, *Ptr, ARRAY_SIZE (ErstInstructionTable= )); +} + +/** + An ACPI_PARSER array describing the ACPI ERST Table. +**/ +STATIC CONST ACPI_PARSER ErstParser[] =3D { + PARSE_ACPI_HEADER (&AcpiHdrInfo), + { L"Serialization Header Size", 4, 36, L"0x%x", NULL, NULL, = NULL, NULL }, + { L"Reserved", 4, 40, L"0x%x", NULL, NULL, = NULL, NULL }, + { L"Instruction Entry Count", 4, 44, L"0x%x", NULL, (VOID **)&Instru= ctionEntryCount, NULL, NULL } +}; + +/** + An ACPI_PARSER array describing the Serialization Instruction Entry stru= cture. +**/ +STATIC CONST ACPI_PARSER SerializationInstructionEntryParser[] =3D { + { L"Serialization Action", 1, 0, L"0x%x", DumpErstAction, NULL,= ValidateErstAction, NULL }, + { L"Instruction", 1, 1, L"0x%x", DumpErstInstruction, NULL,= ValidateErstInstruction, NULL }, + { L"Flags", 1, 2, L"0x%x", NULL, NULL,= ValidateErstFlags, NULL }, + { L"Reserved", 1, 3, L"0x%x", NULL, NULL,= NULL, NULL }, + { L"Register Region", 12, 4, NULL, DumpGas, NULL,= NULL, NULL }, + { L"Value", 8, 16, L"0x%llx", NULL, NULL,= NULL, NULL }, + { L"Mask", 8, 24, L"0x%llx", NULL, NULL,= NULL, NULL } +}; + +/** + This function parses the ACPI ERST table. + When trace is enabled this function parses the ERST 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 +ParseAcpiErst ( + IN BOOLEAN Trace, + IN UINT8 *Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ) +{ + UINT32 Offset; + + if (!Trace) { + return; + } + + Offset =3D ParseAcpi ( + Trace, + 0, + "ERST", + Ptr, + AcpiTableLength, + PARSER_PARAMS (ErstParser) + ); + + if (sizeof (EFI_ACPI_6_4_ERST_SERIALIZATION_INSTRUCTION_ENTRY)*(*Instruc= tionEntryCount) !=3D (AcpiTableLength - Offset)) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid InstructionEntryCount. " \ + L"Count =3D %d. Offset =3D %d. AcpiTableLength =3D %d.\n", + *InstructionEntryCount, + Offset, + AcpiTableLength + ); + return; + } + + while (Offset < AcpiTableLength) { + Offset +=3D ParseAcpi ( + Trace, + 2, + "Serialization Action", + Ptr + Offset, + (AcpiTableLength - Offset), + PARSER_PARAMS (SerializationInstructionEntryParser) + ); + } +} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index 09bdddb56e..d37ad7cacc 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -1,6 +1,7 @@ /** @file Main file for 'acpiview' Shell command function. + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -52,6 +53,7 @@ ACPI_TABLE_PARSER ParserList[] =3D { { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, = ParseAcpiDbg2 }, { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiDsdt }, + { EFI_ACPI_6_4_ERROR_RECORD_SERIALIZATION_TABLE_SIGNATURE, = ParseAcpiErst }, { EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, = ParseAcpiFacs }, { EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, = ParseAcpiFadt }, { EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, = ParseAcpiGtdt }, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index 63fc5a1281..904fea83de 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -1,6 +1,7 @@ ## @file # Provides Shell 'acpiview' command functions # +# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -31,6 +32,7 @@ Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c Parsers/Dsdt/DsdtParser.c + Parsers/Erst/ErstParser.c Parsers/Facs/FacsParser.c Parsers/Fadt/FadtParser.c Parsers/Gtdt/GtdtParser.c -- 2.25.1