From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id A9C99D80248 for ; Mon, 8 Jul 2024 21:39:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=wRGSSO7TL4GS/OiAgV+vybr0fl7EEQY/EVOG6/r4daw=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1720474790; v=1; b=t1qNHf/o423bCSLCyDJ5h3J6l0LAQCMawzdnCcsUjVy+qBWzZhNQAn2ocmz56KeizUCqB0Un qJee6JXUc7qd4bhsyjwwOISt+5tFD4+N+AOIhKJMnre1CcRJ/DtIIzM7B+krP0azwTdC63H7Y2o w4yN3sU15APWxS2/BueRriZhsROriK+kTg49wlbkQivPKHfyZpSqcr/WlZ8po5WRMkKrxQTebxK 4QQkoeH5toxjrb9cEXGCCl8IC35erYZ/fy66DZdi1Dm92EBX5o0CaOC6IZgLYplbjG4HxEnS5vT 8tCxJwm099SKiO4XNvT41tciq3gwMaB4l8m/hl3zxnUnw== X-Received: by 127.0.0.2 with SMTP id 7fCFYY7687511xAVjiPALEAA; Mon, 08 Jul 2024 14:39:49 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5759.1720474788641000199 for ; Mon, 08 Jul 2024 14:39:48 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5B3C8139F; Mon, 8 Jul 2024 14:40:13 -0700 (PDT) X-Received: from usa.arm.com (iss-desktop03.cambridge.arm.com [10.1.196.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 57E043F641; Mon, 8 Jul 2024 14:39:47 -0700 (PDT) From: "Rohit Mathew" To: devel@edk2.groups.io Cc: James Morse , Sami Mujawar , Thomas Abraham , Zhichao Gao Subject: [edk2-devel] [PATCH V6 5/6] ShellPkg: acpiview: Add routines to print reserved fields Date: Mon, 8 Jul 2024 22:39:43 +0100 Message-Id: <20240708213943.41549-1-rohit.mathew@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 08 Jul 2024 14:39:48 -0700 Resent-From: rohit.mathew@arm.com Reply-To: devel@edk2.groups.io,rohit.mathew@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 8ESsckmcg0elzc6GJJvzFLWdx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="t1qNHf/o"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none) From: Rohit Mathew Most of the ACPI tables have fields that are marked reserved. Implement functions "DumpReserved" and "DumpReservedBits" aligning with the print-formatter prototype to print out reserved fields. Signed-off-by: Rohit Mathew Cc: James Morse Cc: Sami Mujawar Cc: Thomas Abraham Cc: Zhichao Gao Reviewed-by: Sami Mujawar --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 126 ++++++++= ++++++++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 38 ++++++ 2 files changed, 164 insertions(+) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/= ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 5fd7fd7a3d..728d8b523a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -498,6 +498,132 @@ Dump16Chars ( ); } =20 +/** + This function traces reserved fields up to 8 bytes in length. + + Format string is ignored by this function as the reserved field is pri= nted + byte by byte with intermittent spacing . Use DumpxChars f= or any + other use case. + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the field. +**/ +VOID +EFIAPI +DumpReserved ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr, + IN UINT32 Length + ) +{ + switch (Length) { + case 8: + Print ( + L"%u %u %u %u %u %u %u %u", + Ptr[0], + Ptr[1], + Ptr[2], + Ptr[3], + Ptr[4], + Ptr[5], + Ptr[6], + Ptr[7] + ); + break; + case 7: + Print ( + L"%u %u %u %u %u %u %u", + Ptr[0], + Ptr[1], + Ptr[2], + Ptr[3], + Ptr[4], + Ptr[5], + Ptr[6] + ); + break; + case 6: + Print ( + L"%u %u %u %u %u %u", + Ptr[0], + Ptr[1], + Ptr[2], + Ptr[3], + Ptr[4], + Ptr[5] + ); + break; + case 5: + Print ( + L"%u %u %u %u %u", + Ptr[0], + Ptr[1], + Ptr[2], + Ptr[3], + Ptr[4] + ); + break; + case 4: + Print ( + L"%u %u %u %u", + Ptr[0], + Ptr[1], + Ptr[2], + Ptr[3] + ); + break; + case 3: + Print ( + L"%u %u %u", + Ptr[0], + Ptr[1], + Ptr[2] + ); + break; + case 2: + Print ( + L"%u %u", + Ptr[0], + Ptr[1] + ); + break; + case 1: + Print ( + L"%u", + Ptr[0] + ); + break; + default: + return; + } +} + +/** + This function traces reserved fields up to 64 bits in length. + + Format string is ignored by this function as the reserved field is pri= nted + byte by byte with intermittent spacing. eg: <0 0 0 0>. When the field = length + isn't a multiple of 8, the number of bytes are "ceil"-ed by one. eg fo= r 27 + bits <0 0 0 0> + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the field as number of bits. +**/ +VOID +EFIAPI +DumpReservedBits ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr, + IN UINT32 Length + ) +{ + UINT32 ByteLength; + + ByteLength =3D (Length + 7) >> 3; + DumpReserved (Format, Ptr, ByteLength); +} + /** This function indents and prints the ACPI table Field Name. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/= ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index e1ed543468..414b356fc0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -230,6 +230,44 @@ Dump16Chars ( IN UINT32 Length ); =20 +/** + This function traces reserved fields up to 8 bytes in length. + + Format string is ignored by this function as the reserved field is pri= nted + byte by byte with intermittent spacing . Use DumpxChars f= or any + other use case. + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the field. +**/ +VOID +EFIAPI +DumpReserved ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr, + IN UINT32 Length + ); + +/** + This function traces reserved fields up to 64 bits in length. + + Format string is ignored by this function as the reserved field is pri= nted + byte by byte with intermittent spacing. eg: <0 0 0 0>. When the field = length + isn't a multiple of 8, the number of bytes are "ceil"-ed by one. eg fo= r 27 + bits <0 0 0 0> + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the field as number of bits. +**/ +VOID +EFIAPI +DumpReservedBits ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr, + IN UINT32 Length + ); + /** This function indents and prints the ACPI table Field Name. =20 --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119821): https://edk2.groups.io/g/devel/message/119821 Mute This Topic: https://groups.io/mt/107112190/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-