public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Rohit Mathew <Rohit.Mathew@arm.com>, devel@edk2.groups.io
Cc: James Morse <james.Morse@arm.com>,
	Thomas Abraham <thomas.abraham@arm.com>,
	Zhichao Gao <zhichao.gao@intel.com>, "nd@arm.com" <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v5 5/6] ShellPkg: acpiview: Add routines to print reserved fields
Date: Tue, 5 Dec 2023 11:48:52 +0000	[thread overview]
Message-ID: <f694bff4-5948-4642-a825-b46e0fad62af@arm.com> (raw)
In-Reply-To: <20231002171720.901538-1-Rohit.Mathew@arm.com>

Hi Rohit,

I have a minor suggestion marked inline as [SAMI].

Otherwise this patch looks good to me.

With that addressed,

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 02/10/2023 06:17 pm, Rohit Mathew wrote:
> 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<Rohit.Mathew@arm.com>
> Cc: James Morse<james.Morse@arm.com>
> Cc: Sami Mujawar<sami.mujawar@arm.com>
> Cc: Thomas Abraham<thomas.abraham@arm.com>
> Cc: Zhichao Gao<zhichao.gao@intel.com>
> ---
>   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 20d817e357..cc520d9b27 100644
> --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> @@ -498,6 +498,132 @@ Dump16Chars (
>       );
>   }
>   
> +/**
> +  This function traces reserved fields up to 8 bytes in length.
> +
> +  Format string is ignored by this function as the reserved field is printed
> +  byte by byte with intermittent spacing <eg: 0 0 0 0>. Use DumpxChars for 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 printed
> +  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 for 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.
[SAMI] I think the documentation for the Length filed should say 
something like '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 = (Length + 7) >> 3;
> +  DumpReserved (Format, Ptr, ByteLength);
> +}
> +
>   /**
>     This function indents and prints the ACPI table Field Name.
>   
> diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
> index 80bac6a584..89930fdc6d 100644
> --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
> +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
> @@ -230,6 +230,44 @@ Dump16Chars (
>     IN UINT32        Length
>     );
>   
> +/**
> +  This function traces reserved fields up to 8 bytes in length.
> +
> +  Format string is ignored by this function as the reserved field is printed
> +  byte by byte with intermittent spacing <eg: 0 0 0 0>. Use DumpxChars for 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 printed
> +  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 for 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.
[SAMI] Please see suggestion above.
> +**/
> +VOID
> +EFIAPI
> +DumpReservedBits (
> +  IN CONST CHAR16  *Format OPTIONAL,
> +  IN UINT8         *Ptr,
> +  IN UINT32        Length
> +  );
> +
>   /**
>     This function indents and prints the ACPI table Field Name.
>   


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112077): https://edk2.groups.io/g/devel/message/112077
Mute This Topic: https://groups.io/mt/101716966/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2023-12-05 11:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 17:17 [edk2-devel] [PATCH v5 5/6] ShellPkg: acpiview: Add routines to print reserved fields Rohit Mathew
2023-12-05 11:48 ` Sami Mujawar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f694bff4-5948-4642-a825-b46e0fad62af@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox