diff options
author | Rohit Mathew <Rohit.Mathew@arm.com> | 2023-08-22 14:32:52 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-01 17:20:10 +0000 |
commit | 9e865f9579004b772e36f85ae4e76484bb93b484 (patch) | |
tree | 4a88b81df53c8b4cd2b0afa05abf51a529c02272 | |
parent | 107d0c380009ad3b17a1730fce264eefdd027616 (diff) | |
download | edk2-9e865f9579004b772e36f85ae4e76484bb93b484.tar.gz |
ShellPkg/AcpiView: Update print-formatter prototype
As of now, the print-formatter implemented by the FNPTR_PRINT_FORMATTER
function pointer takes two parameters, the format string and the pointer
to the field. For cases where the print-formatter has to have access to
the length of the field, there is no clean way to currently do it. In
order to resolve this, update the print-formatter's prototype to take
the length of the field as a third parameter. This change should improve
the overall robustness and flexibility of AcpiView.
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>
12 files changed, 98 insertions, 36 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 2e3afbac9d..beb58c72a9 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -319,12 +319,14 @@ DumpUint64 ( @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
Dump3Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -343,12 +345,14 @@ Dump3Chars ( @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
Dump4Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -368,12 +372,14 @@ Dump4Chars ( @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
Dump6Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -395,12 +401,14 @@ Dump6Chars ( @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
Dump8Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -424,12 +432,14 @@ Dump8Chars ( @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
Dump12Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -587,7 +597,7 @@ ParseAcpi ( // the Format for printing
PrintFieldName (2, Parser[Index].NameStr);
if (Parser[Index].PrintFormatter != NULL) {
- Parser[Index].PrintFormatter (Parser[Index].Format, Ptr);
+ Parser[Index].PrintFormatter (Parser[Index].Format, Ptr, Parser[Index].Length);
} else if (Parser[Index].Format != NULL) {
switch (Parser[Index].Length) {
case 1:
@@ -685,12 +695,14 @@ DumpGasStruct ( @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
DumpGas (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
@@ -896,7 +908,7 @@ ParseAcpiBitFields ( // the Format for printing
PrintFieldName (2, Parser[Index].NameStr);
if (Parser[Index].PrintFormatter != NULL) {
- Parser[Index].PrintFormatter (Parser[Index].Format, (UINT8 *)&Data);
+ Parser[Index].PrintFormatter (Parser[Index].Format, (UINT8 *)&Data, Parser[Index].Length);
} else if (Parser[Index].Format != NULL) {
// convert bit length to byte length
switch ((Parser[Index].Length + 7) >> 3) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index b759a916f5..df63741b1c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -130,12 +130,14 @@ DumpUint64 ( @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
Dump3Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -146,12 +148,14 @@ Dump3Chars ( @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
Dump4Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -162,12 +166,14 @@ Dump4Chars ( @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
Dump6Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -178,12 +184,14 @@ Dump6Chars ( @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
Dump8Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -194,12 +202,14 @@ Dump8Chars ( @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
Dump12Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -227,8 +237,9 @@ PrintFieldName ( @param [in] Format Format string for tracing the data as specified by
the 'Format' member of ACPI_PARSER.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
-typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr);
+typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr, UINT32 Length);
/**
This function pointer is the template for validating an ACPI table field.
@@ -473,12 +484,14 @@ DumpGasStruct ( @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
DumpGas (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c index 83f9b292b0..af70c41826 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c @@ -157,12 +157,14 @@ ValidateInterruptFlags ( @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
DumpVendorSpecificData (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c index 3e3c1b0df8..d01b15ff5f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c @@ -177,13 +177,15 @@ ValidateRegisterRegion ( @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.
**/
STATIC
VOID
EFIAPI
DumpInjectionInstAction (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT8 InjectionAction;
@@ -244,13 +246,15 @@ DumpInjectionInstAction ( @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.
**/
STATIC
VOID
EFIAPI
DumpInstruction (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT8 Inst;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c index 2b19e3e1c0..e237e0e04e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c @@ -171,13 +171,15 @@ FormatByte ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the Action byte.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpErstAction (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
FormatByte (ErstActionTable, *Ptr, ARRAY_SIZE (ErstActionTable));
@@ -188,13 +190,15 @@ DumpErstAction ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the Instruction byte.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpErstInstruction (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
FormatByte (ErstInstructionTable, *Ptr, ARRAY_SIZE (ErstInstructionTable));
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index c9eac9c18e..d89fcb13a4 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -169,12 +169,14 @@ STATIC CONST ACPI_PARSER FadtFlagParser[] = { @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
DumpFadtFlags (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c index 1e9991dba2..75fc40b0ba 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c @@ -146,13 +146,15 @@ ValidateErrorNotificationType ( @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.
**/
STATIC
VOID
EFIAPI
DumpSourceFlags (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -176,13 +178,15 @@ DumpSourceFlags ( @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.
**/
STATIC
VOID
EFIAPI
DumpErrorNotificationType (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -202,13 +206,15 @@ DumpErrorNotificationType ( @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.
**/
STATIC
VOID
EFIAPI
DumpErrorNotificationCwe (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -433,13 +439,15 @@ ValidateRecordCount ( @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.
**/
STATIC
VOID
EFIAPI
DumpNotificationStructure (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT32 Offset;
@@ -466,13 +474,15 @@ DumpNotificationStructure ( from HestTable.
@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.
**/
STATIC
VOID
EFIAPI
DumpPciBus (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c index ce69a600e7..8f48927da7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c @@ -111,13 +111,15 @@ ValidateCacheAttributes ( @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.
**/
STATIC
VOID
EFIAPI
DumpCacheAttributes (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c index 9975af53fd..c8ccdd4785 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c @@ -25,7 +25,8 @@ VOID EFIAPI
DumpHpetPageProtectionFlag (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -72,7 +73,8 @@ VOID EFIAPI
DumpHpetFlag (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -102,7 +104,8 @@ VOID EFIAPI
DumpCounterSize (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -166,7 +169,8 @@ VOID EFIAPI
DumpHpetEventTimerBlockId (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index 614fa4c2f9..56ab507ef1 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -270,12 +270,14 @@ STATIC CONST ACPI_PARSER LocalApicFlags[] = { @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
DumpLocalApicBitFlags (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index d9831023ce..7bae94c076 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -81,13 +81,15 @@ ValidateSratDeviceHandleType ( @param [in] Format Format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpSratPciBdfNumber (
IN CONST CHAR16 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
@@ -169,13 +171,15 @@ STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = { @param [in] Format Format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpSratDeviceHandle (
IN CONST CHAR16 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (SratDeviceHandleType == NULL) {
@@ -212,13 +216,15 @@ DumpSratDeviceHandle ( @param [in] Format Format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpSratApicProximity (
IN CONST CHAR16 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT32 ProximityDomain;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c index 96c2706c73..4433c047a4 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c @@ -97,7 +97,8 @@ VOID EFIAPI
DumpWsmtProtectionFlag (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
|