From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.73]) by mx.groups.io with SMTP id smtpd.web10.1999.1641524331281151147 for ; Thu, 06 Jan 2022 18:58:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=i16gzr/M; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.101.73, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nF3ytnsadFP0LQjkxpiTxxnGr1QlMig209A6YLwI5I5XU5ggAKtIeCAZQnHCRtOUuNToOi/KrQzX6OlBKQRYxOA114UqaNJVxgMBNLQN4lJz2E2LrQ8MkJtlMtBInQWxa+GDczct0XnKxjhLzDCxa/Yw9lcJv71QXkSmKkdHdphbhL3rV0lINxiVTPB3yKjLqrZ1X+xiCTBpOC9asY/J3LdOhimn8WcZW38o2T3ZAlnR5k58a6w0KCXm+SGrcqZhlDbrihIWVzj7RbCfxk/ycj8JXfUtIYSczCic4zBgM0vma3j2EB06IXA+0YKTur5P1Izojv6fQv+WoQESNi2d6g== 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=ZHQlDJt88uJ3TGcvYC87nSTYXlFgmBtX48k3MbCRz00=; b=D7x2U9Dc1lpuugS7Ig4563Y4+q1yEcQvS0ZCEI5Oj/PSkJtg+VR2zgdt/PUaA1jK7ZmPQRivjobMeZeQs7Gku2E2arvNHxbLDFuX1zGSoD8yiRumPL2b5yzrPwaUcKyuXKllRni1f10IYFuv2x9LUOvM82BzUofVAM58Ix8TxTMkBNtMbhEw995TEGqbgYNU51idIOQnP32AALiwseu07XUnmjWGF+ejpi9+6grOJ/2atmoQXRsGf9w7MsHeyBjpqZm1MLgczDsCZvhWtJxCleuHkNRMQj4UEwskLCccF+omcovZ6AZXyvqT9zAM/zfIIxhYgF+EJ37OctM5ljP//g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZHQlDJt88uJ3TGcvYC87nSTYXlFgmBtX48k3MbCRz00=; b=i16gzr/MCIzJ5c4dDshCr9AFoYY2q43Q0hLY9QHtfy+vkYLtBOZAEmhbBannMOjWfMp0hzfmUDZ81n/yJRVoQ/XM8pN4xhotFmLPGiKI8yE+qXDElb74xQ2rlcIFoFtnHF8oN816R8xRObJ5QkPOYH9gSdmpR1HRlDT9V3dA77Y= Received: from BN9PR12MB5225.namprd12.prod.outlook.com (2603:10b6:408:11e::8) by BN9PR12MB5308.namprd12.prod.outlook.com (2603:10b6:408:105::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.13; Fri, 7 Jan 2022 02:58:49 +0000 Received: from BN9PR12MB5225.namprd12.prod.outlook.com ([fe80::60ad:57cf:dc99:2e5d]) by BN9PR12MB5225.namprd12.prod.outlook.com ([fe80::60ad:57cf:dc99:2e5d%4]) with mapi id 15.20.4867.009; Fri, 7 Jan 2022 02:58:49 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "devel@edk2.groups.io" , "Attar, AbdulLateef (Abdul Lateef)" CC: Ray Ni , Zhichao Gao , Sami Mujawar Subject: Re: [edk2-devel] [PATCH v4 1/2] ShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser Thread-Topic: [edk2-devel] [PATCH v4 1/2] ShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser Thread-Index: AQHX9Ob5QqSAwOlMVUOdbX7DHSAhTqxW+vjw Date: Fri, 7 Jan 2022 02:58:49 +0000 Message-ID: References: <20211219144437.3721-1-abdattar@amd.com> <16C22F2D003754C4.24651@groups.io> In-Reply-To: <16C22F2D003754C4.24651@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ActionId=100da70a-d292-4aa9-aac2-083f13339fde;MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=0;MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Enabled=true;MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Method=Standard;MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Name=AMD Official Use Only-AIP 2.0;MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2022-01-07T02:58:02Z;MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: adc66763-5fa0-4619-4af3-08d9d189a128 x-ms-traffictypediagnostic: BN9PR12MB5308:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DBCu6mjXHC5yQNFJfyreCYHHiUGVJdWngWTAf25MI+1X5FEAYaR02Yys86XjS51/KwMYoI+jlmZ/8z361oOHiBar5JoXnvc0MBgR1gN5jYDEbi1wTobMzRoKHAJb6D/0mojU2UX0mSjlJmBTYwD/cj7io/sicdcLhBaz3Xue0WDBkwvf20xX3M41bvsz5Da1mstaEk/ZKsiXjgoBryU2wuK+QqbZ5JyanfzOV6slTSBispNyVxGE8avKeu6hc98y7c2y9I5PLQPwIi/WJr+9CU+cUj+MYMn8ZJYC6o/n+ngi/XVN/Ll8nuk7nkP49N4Hk9ES4Sq0yN0k+r0sdAt4V+rAhy4Ge+ucbiPskPSXHfWOIdhOsoJQ6cBebULuayj6Fkjkb3LXJ41R8JfzdBo2vIkt+NQAoocgNlxvtxXUQ/v5uA0Pqjy8HUL9qqeb/PWjqtPYpzOFOcQRWq0eaba/wb5Lr+dTf3Hve5DYjaPydNDTDRddJLsM9SyLSKAqAfi1O3A2N5P43kppH4brHkhDFah/Iq3f3hM+9j1hGGcFMlTLGAqqksrLU6ilamAU3Aq3jFPVm4p+BObV0A13O0ou3ajekHjsw/bRmFZwxzN3U5v1ONJUxeJJLAljXeyebWK4QI66TfRJpLYK39T+z1Aa9xMVSvoLFUunxIF7N3OjpMYc8L1q6QfBd1bXLoeAOma+Sd038cJAh+GIeTKx+COH5uHANuLgxSCwTT4VECGZS42uT/fO8uI7JuGmWUXbiWfYkioR4FmlcGax3XN160u0ndjiK9w9dTLiNYSKWLiR48k= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR12MB5225.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(8676002)(66476007)(55016003)(122000001)(45080400002)(53546011)(66556008)(316002)(38100700002)(66446008)(2906002)(9686003)(76116006)(7696005)(66946007)(54906003)(71200400001)(26005)(64756008)(5660300002)(30864003)(33656002)(508600001)(8936002)(6506007)(83380400001)(86362001)(38070700005)(52536014)(110136005)(966005)(186003)(4326008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?HprKVRHa82R3ZjiXk5SdHktzXskdqrN8osiBaqSFCZjevfq4ScXFvSXGvKhF?= =?us-ascii?Q?6g/43BWKwZzyh3HDSDkaN4sniEjdWIgOZjGyRGbPwQXsB0VAc1EP8Dxyy3kG?= =?us-ascii?Q?LX/tjgFTxI9eutYXndu2l6xNJ5OaIxzmqBmvgpQxxBkKXSQHjh4ui0ByW+m6?= =?us-ascii?Q?4+A6YRaMeo/Jr7GI5F5rrSFlhH7Aj7y2dO8EiYHDh0viuN/PHGro1oV0Iliu?= =?us-ascii?Q?t9BsyDg9T7SM3rZleCQufjsnTNcSwHNYG3uXks8/jn8tFM2S0fDXYmpZOaoz?= =?us-ascii?Q?oNHHhpni0Hzq3b51QgtjNv7nC+Lglw1EpVqwy4YWkyKbhGwQ8iAmNIfshqA0?= =?us-ascii?Q?i7/2NN/sBv8uNS/hocMNe5aDWi0PX1imfd4FzscpsDD5iJA3YvrE0HNPjI4C?= =?us-ascii?Q?V2Y0+/vybTJVf9ycFPvShSIltuQkiAmjYrQs5YW1gyj90klpwM2hdPEmOrnL?= =?us-ascii?Q?HKFbLSJ0OjPiJNoZYUgNPplO+ezFGwmtYN31nn18nYGcvhRU2YF+RsUs8nLZ?= =?us-ascii?Q?R/MFTps7WlQkfoM2tsZEsEs86yDl4NUNulbR0nYzFCP2jpVKI1KquxQ+a+Mj?= =?us-ascii?Q?LKwgyVZ7eaOTonhy3RC3JdbM7THbjd4ebZIqf6+X3beA/yok6kfGSxJ2msmQ?= =?us-ascii?Q?J3eO2Y8GHWjhi/zkY9nS5GEbQY7WZvre7k8MMjLlGiLhsIYrNK4sLf2gF5Ho?= =?us-ascii?Q?/v1XRaB2bTSChcjjnGd7DmnNQl18NzRQlzloNG59auiHN45/KBa3jJoY1pD0?= =?us-ascii?Q?TbuDK5aIvqfoPrvOd2nVQfIMQ/eDwQA3xa9nBgYqtU97xXlHewmJyRwYOdTX?= =?us-ascii?Q?754xsLDJH9OJFyZdAM85XQOfcUuLuKGf8qSXkzPjZOFKkjliwSUed6YcnjOh?= =?us-ascii?Q?XgvpwMphAokYrWUiF5Jee6dZMavRU/TlBH6QyC78QdY6TPXo/7knCm3lV4Rj?= =?us-ascii?Q?IKdag1fklP/Olk3I+ACCrT+SG5JbcEWyiZUvC3metjx5SRXqfF/VYOZLRN/K?= =?us-ascii?Q?NfM68Iymg1ZDF4zpqnXwFVptED0X2Vwn6c0tnGI/mpUvv4CKPFOuPHsSDeUd?= =?us-ascii?Q?7xbKQzPhlTZQ/zhuW/CooSo54lMEhoAgUGsjNfqNhyJh7id015lylzvclqbj?= =?us-ascii?Q?95E2AYt+T2wDjEq+HG4viYa1TvA7QcrB9CWso5QdcDQrGfh8FPUeQK/1fcFj?= =?us-ascii?Q?rQZZgsEz7tTxEtHk8daX0cc4NeCETgw4RSyeIqQyr3VGKUeZpujA302YqOwu?= =?us-ascii?Q?NYZtQ0eHSM/aXFMHln/XBbJH26o7573Xjr+pj3G46XQLdegV4i8JjAWaBewH?= =?us-ascii?Q?vK+1+0p1puwg2IY2ommG5CrukUZLqr07hz0ac3ZBTVweGDMykJg51lNp0DD+?= =?us-ascii?Q?CX0PxUv5IA+cfmcoSd+hPA5CW6uTYuW6SED4NLaM/SOxuubvJzexSLMH1d4v?= =?us-ascii?Q?QUnA8VziI/GNDvPcu8rMRFueB7sTP5eAFqcjixz+PIw7KIRqHelLfccMrj4p?= =?us-ascii?Q?odAzCT1wwrDxehw8CeRFiwsiTriKLLpCE74XIw/iaMCW5QmRqOHQlbjEVi/1?= =?us-ascii?Q?QGMbCM+1JWx+axRsyUH3S1jUNUAVF2hFJGuH6+lgZm21ra6KgZ2HcQdtsTMJ?= =?us-ascii?Q?GA=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5225.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: adc66763-5fa0-4619-4af3-08d9d189a128 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2022 02:58:49.2278 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zfBDAh4xuJLcc7oTU8SmWf54jDUjNh2I0U5HuX5Q5jqkio1g7RbWCFiSORBVsf+OI5rPY/q7Bd/uGiuhrAbFfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5308 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only] Gentle reminder...please review and merge the changeset. -----Original Message----- From: devel@edk2.groups.io On Behalf Of Abdul Lateef= Attar via groups.io Sent: 19 December 2021 20:15 To: devel@edk2.groups.io Cc: Ray Ni ; Zhichao Gao ; Sami Mu= jawar Subject: [edk2-devel] [PATCH v4 1/2] ShellPkg/AcpiView: Adds ACPI_PARSER bi= tfield parser [CAUTION: External Email] Adds ParseAcpiBitFields() which is based on ParseAcpi() and capable of parsing the bit fields. Supports parsing of UINT8, UINT16, UINT32 and UINT64 byte data. Cc: Ray Ni Cc: Zhichao Gao Cc: Sami Mujawar Signed-off-by: Abdul Lateef Attar --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 45 +++++ She= llPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 185 ++++++++++++++= ++++++ 2 files changed, 230 insertions(+) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 5c916a4720b8..83266e8ec2d3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -2,6 +2,7 @@ Header file for ACPI parser Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. + Copyright (c) 2021, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -251,6 +252,11 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Pt= r, VOID *Context); the field data. If the field is more complex and requires additional processing for formatting and representation a print formatter function can be specified in 'PrintFormatter'. + + ParseAcpiBitFields() uses AcpiParser structure to parse the bit fields. + It considers Length as a number of bits that need to be parsed. + Also, the Offset field will be considered as starting offset of the bitf= ield. + The PrintFormatter function may choose to use the format string specified by 'Format' or use its own internal format string. @@ -264,10 +270,12 @@ typedef struct AcpiParser { /// The length of the field. /// (Byte Length column from ACPI table spec) + /// Length(in bits) of the bitfield if used with ParseAcpiBitFields(). UINT32 Length; /// The offset of the field from the start of the table. /// (Byte Offset column from ACPI table spec) + /// The Bit offset of the field if used with ParseAcpiBitFields(). UINT32 Offset; /// Optional Print() style format string for tracing the data. If not @@ -364,6 +372,43 @@ ParseAcpi ( IN UINT32 ParserItems ); +/** + This function is used to parse an ACPI table bitfield buffer. + + The ACPI table buffer is parsed using the ACPI table parser + information + specified by a pointer to an array of ACPI_PARSER elements. This + parser + function iterates through each item on the ACPI_PARSER array and logs th= e ACPI table bitfields. + + This function can optionally be used to parse ACPI tables and fetch + specific + field values. The ItemPtr member of the ACPI_PARSER structure (where + used) + is updated by this parser function to point to the selected field + data + (e.g. useful for variable length nested fields). + + @param [in] Trace Trace the ACPI fields TRUE else only parse the + table. + @param [in] Indent Number of spaces to indent the output. + @param [in] AsciiName Optional pointer to an ASCII string that descri= bes + the table being parsed. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the buffer pointed by Ptr. + @param [in] Parser Pointer to an array of ACPI_PARSER structure th= at + describes the table being parsed. + @param [in] ParserItems Number of items in the ACPI_PARSER array. + + @retval Number of bits parsed. +**/ +UINT32 +EFIAPI +ParseAcpiBitFields ( + IN BOOLEAN Trace, + IN UINT32 Indent, + IN CONST CHAR8 *AsciiName OPTIONAL, + IN UINT8 *Ptr, + IN UINT32 Length, + IN CONST ACPI_PARSER *Parser, + IN UINT32 ParserItems + ); + /** This is a helper macro to pass parameters to the Parser functions. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index cb193a5ea449..94ee26f42ab9 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -2,12 +2,14 @@ ACPI parser Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. + Copyright (c) 2021, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include #include #include +#include #include "AcpiParser.h" #include "AcpiView.h" #include "AcpiViewConfig.h" @@ -752,3 +754,186 @@ ParseAcpiHeader ( return BytesParsed; } + +/** + This function is used to parse an ACPI table bitfield buffer. + + The ACPI table buffer is parsed using the ACPI table parser + information + specified by a pointer to an array of ACPI_PARSER elements. This + parser + function iterates through each item on the ACPI_PARSER array and logs th= e ACPI table bitfields. + + This function can optionally be used to parse ACPI tables and fetch + specific + field values. The ItemPtr member of the ACPI_PARSER structure (where + used) + is updated by this parser function to point to the selected field + data + (e.g. useful for variable length nested fields). + + @param [in] Trace Trace the ACPI fields TRUE else only parse the + table. + @param [in] Indent Number of spaces to indent the output. + @param [in] AsciiName Optional pointer to an ASCII string that descri= bes + the table being parsed. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length in bytes of the buffer pointed by Ptr. + @param [in] Parser Pointer to an array of ACPI_PARSER structure th= at + describes the table being parsed. + @param [in] ParserItems Number of items in the ACPI_PARSER array. + + @retval Number of bits parsed. +**/ +UINT32 +EFIAPI +ParseAcpiBitFields ( + IN BOOLEAN Trace, + IN UINT32 Indent, + IN CONST CHAR8 *AsciiName OPTIONAL, + IN UINT8 *Ptr, + IN UINT32 Length, + IN CONST ACPI_PARSER *Parser, + IN UINT32 ParserItems + ) +{ + UINT32 Index; + UINT32 Offset; + BOOLEAN HighLight; + UINTN OriginalAttribute; + + UINT64 Data; + UINT64 BitsData; + + if ((Length =3D=3D 0) || (Length > 8)) { + IncrementErrorCount (); + Print ( + L"\nERROR: Bitfield Length(%d) is zero or exceeding the 64 bit + limit.\n", + Length + ); + return 0; + } + + // + // set local variables to suppress incorrect compiler/analyzer + warnings + // + OriginalAttribute =3D 0; + Offset =3D 0; + + // Increment the Indent + gIndent +=3D Indent; + + CopyMem ((VOID *)&BitsData, (VOID *)Ptr, Length); + if (Trace && (AsciiName !=3D NULL)) { + HighLight =3D GetColourHighlighting (); + + if (HighLight) { + OriginalAttribute =3D gST->ConOut->Mode->Attribute; + gST->ConOut->SetAttribute ( + gST->ConOut, + EFI_TEXT_ATTR ( + EFI_YELLOW, + ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4) + ) + ); + } + + Print ( + L"%*a%-*a :\n", + gIndent, + "", + (OUTPUT_FIELD_COLUMN_WIDTH - gIndent), + AsciiName + ); + if (HighLight) { + gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute); + } + } + + for (Index =3D 0; Index < ParserItems; Index++) { + if ((Offset + Parser[Index].Length) > (Length * 8)) { + // For fields outside the buffer length provided, reset any + pointers + // which were supposed to be updated by this function call + if (Parser[Index].ItemPtr !=3D NULL) { + *Parser[Index].ItemPtr =3D NULL; + } + + // We don't parse past the end of the max length specified + continue; + } + + if (Parser[Index].Length =3D=3D 0) { + // don't parse the bitfield whose length is zero + continue; + } + + if (GetConsistencyChecking () && + (Offset !=3D Parser[Index].Offset)) + { + IncrementErrorCount (); + Print ( + L"\nERROR: %a: Offset Mismatch for %s\n" + L"CurrentOffset =3D %d FieldOffset =3D %d\n", + AsciiName, + Parser[Index].NameStr, + Offset, + Parser[Index].Offset + ); + } + + // extract Bitfield data for the current item + Data =3D (BitsData >> Parser[Index].Offset) & ~(~0ULL << + Parser[Index].Length); + + if (Trace) { + // if there is a Formatter function let the function handle + // the printing else if a Format is specified in the table use + // the Format for printing + PrintFieldName (2, Parser[Index].NameStr); + if (Parser[Index].PrintFormatter !=3D NULL) { + Parser[Index].PrintFormatter (Parser[Index].Format, (UINT8 + *)&Data); + } else if (Parser[Index].Format !=3D NULL) { + // convert bit length to byte length + switch ((Parser[Index].Length + 7) >> 3) { + // print the data depends on byte size + case 1: + DumpUint8 (Parser[Index].Format, (UINT8 *)&Data); + break; + case 2: + DumpUint16 (Parser[Index].Format, (UINT8 *)&Data); + break; + case 3: + case 4: + DumpUint32 (Parser[Index].Format, (UINT8 *)&Data); + break; + case 5: + case 6: + case 7: + case 8: + DumpUint64 (Parser[Index].Format, (UINT8 *)&Data); + break; + default: + Print ( + L"\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length =3D + %d\n", + AsciiName, + Parser[Index].Length + ); + } // switch + } + + // Validating only makes sense if we are tracing + // the parsed table entries, to report by table name. + if (GetConsistencyChecking () && + (Parser[Index].FieldValidator !=3D NULL)) + { + Parser[Index].FieldValidator ((UINT8 *)&Data, + Parser[Index].Context); + } + + Print (L"\n"); + } // if (Trace) + + if (Parser[Index].ItemPtr !=3D NULL) { + *Parser[Index].ItemPtr =3D (VOID *)(UINT8 *)&Data; + } + + Offset +=3D Parser[Index].Length; + } // for + + // Decrement the Indent + gIndent -=3D Indent; + return Offset; +} -- 2.25.1