summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohit Mathew <Rohit.Mathew@arm.com>2023-09-28 16:48:28 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-08-01 17:20:10 +0000
commit3c8133ba870b89f2b8d1cee05942e954a4fbb866 (patch)
tree6d5d08964cc24aa3ccbedcaf59c21c02a16f7f4f
parent8a036c89132e124ebb6852d3468e575ac289e26b (diff)
downloadedk2-3c8133ba870b89f2b8d1cee05942e954a4fbb866.tar.gz
ShellPkg: acpiview: Add routines to print reserved fields
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> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c126
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h38
2 files changed, 164 insertions, 0 deletions
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
@@ -499,6 +499,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 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.
@param [in] Indent Number of spaces to add to the global table indent.
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
index 4c616cc6ed..1baf615415 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -231,6 +231,44 @@ 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
+ );
+
+/**
+ 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 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.
@param [in] Indent Number of spaces to add to the global table