public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] ShellPkg: UefiShellAcpiViewCommandLib: Add support for parsing Local APIC NMI structure
@ 2023-05-03 21:50 Rebecca Cran
  2023-05-03 21:50 ` [PATCH 1/2] ShellPkg: acpiview: add support for parsing the " Rebecca Cran
  2023-05-03 21:50 ` [PATCH 2/2] ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c Rebecca Cran
  0 siblings, 2 replies; 4+ messages in thread
From: Rebecca Cran @ 2023-05-03 21:50 UTC (permalink / raw)
  To: devel, Ray Ni, Zhichao Gao; +Cc: Rebecca Cran

Add support to acpiview for parsing the Local APIC NMI structure.

Fix a typo of 'Controller' in MadtParser.c.

The function to dump MPS INTI flags is almost a duplicate of the
function above it, but I wasn't sure how to avoid it.

Rebecca Cran (2):
  ShellPkg: acpiview: add support for parsing the Local APIC NMI
    structure
  ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 90 ++++++++++++++++----
 1 file changed, 75 insertions(+), 15 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ShellPkg: acpiview: add support for parsing the Local APIC NMI structure
  2023-05-03 21:50 [PATCH 0/2] ShellPkg: UefiShellAcpiViewCommandLib: Add support for parsing Local APIC NMI structure Rebecca Cran
@ 2023-05-03 21:50 ` Rebecca Cran
  2023-05-03 21:50 ` [PATCH 2/2] ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c Rebecca Cran
  1 sibling, 0 replies; 4+ messages in thread
From: Rebecca Cran @ 2023-05-03 21:50 UTC (permalink / raw)
  To: devel, Ray Ni, Zhichao Gao; +Cc: Rebecca Cran

Add support to acpiview for parsing the Local APIC NMI structure.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 60 ++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index 41edcb9ffd1d..9d33ad2606e8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -213,6 +213,12 @@ STATIC CONST ACPI_PARSER  LocalApicFlags[] = {
   { L"Reserved",       30, 2, L"%d", NULL, NULL, NULL, NULL }
 };
 
+STATIC CONST ACPI_PARSER  MpsIntiFlags[] = {
+  { L"Polarity",       2,  0, L"%d", NULL, NULL, NULL, NULL },
+  { L"Trigger Mode",   2,  2, L"%d", NULL, NULL, NULL, NULL },
+  { L"Reserved",       12, 4, L"%d", NULL, NULL, NULL, NULL }
+};
+
 /**
   This function traces Bit Flags fields.
   If no format string is specified the Format must be NULL.
@@ -243,6 +249,36 @@ DumpLocalApicBitFlags (
     );
 }
 
+/**
+  This function traces Bit Flags fields.
+  If no format string is specified the Format must be NULL.
+
+  @param [in] Format  Optional format string for tracing the data.
+  @param [in] Ptr     Pointer to the start of the buffer.
+**/
+VOID
+EFIAPI
+DumpMpsIntiBitFlags (
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
+  )
+{
+  if (Format != NULL) {
+    Print (Format, *(UINT32 *)Ptr);
+    return;
+  }
+
+  Print (L"0x%X\n", *(UINT32 *)Ptr);
+  ParseAcpiBitFields (
+    TRUE,
+    2,
+    NULL,
+    Ptr,
+    4,
+    PARSER_PARAMS (MpsIntiFlags)
+    );
+}
+
 /**
    An ACPI_PARSER array describing the Processor Local APIC Structure.
  **/
@@ -255,6 +291,18 @@ STATIC CONST ACPI_PARSER  ProcessorLocalApic[] = {
   { L"Flags",              4, 4, NULL,    DumpLocalApicBitFlags, NULL, NULL, NULL }
 };
 
+/**
+   An ACPI_PARSER array describing the Local APIC NMI Structure.
+ **/
+STATIC CONST ACPI_PARSER  LocalApicNmi[] = {
+  { L"Type",               1, 0, L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Length",             1, 1, L"%d",   NULL,                  NULL, NULL, NULL },
+
+  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Flags",              2, 3, NULL,    DumpMpsIntiBitFlags,   NULL, NULL, NULL },
+  { L"Local APIC LINT#",   1, 5, L"%d",   NULL,                  NULL, NULL, NULL }
+};
+
 /**
   An ACPI_PARSER array describing the Processor Local x2APIC Structure.
 **/
@@ -502,6 +550,18 @@ ParseAcpiMadt (
           );
         break;
       }
+      case EFI_ACPI_6_3_LOCAL_APIC_NMI:
+      {
+        ParseAcpi (
+          TRUE,
+          2,
+          "LOCAL APIC NMI",
+          InterruptContollerPtr,
+          *MadtInterruptControllerLength,
+          PARSER_PARAMS (LocalApicNmi)
+          );
+          break;
+      }
       case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
       {
         ParseAcpi (
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c
  2023-05-03 21:50 [PATCH 0/2] ShellPkg: UefiShellAcpiViewCommandLib: Add support for parsing Local APIC NMI structure Rebecca Cran
  2023-05-03 21:50 ` [PATCH 1/2] ShellPkg: acpiview: add support for parsing the " Rebecca Cran
@ 2023-05-03 21:50 ` Rebecca Cran
  2023-05-04  3:44   ` Rebecca Cran
  1 sibling, 1 reply; 4+ messages in thread
From: Rebecca Cran @ 2023-05-03 21:50 UTC (permalink / raw)
  To: devel, Ray Ni, Zhichao Gao; +Cc: Rebecca Cran

Fix typos of 'Controller' in acpiview MadtParser.c.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 50 ++++++++++----------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index 9d33ad2606e8..0197b4bd9a66 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -214,9 +214,9 @@ STATIC CONST ACPI_PARSER  LocalApicFlags[] = {
 };
 
 STATIC CONST ACPI_PARSER  MpsIntiFlags[] = {
-  { L"Polarity",       2,  0, L"%d", NULL, NULL, NULL, NULL },
-  { L"Trigger Mode",   2,  2, L"%d", NULL, NULL, NULL, NULL },
-  { L"Reserved",       12, 4, L"%d", NULL, NULL, NULL, NULL }
+  { L"Polarity",     2,  0, L"%d", NULL, NULL, NULL, NULL },
+  { L"Trigger Mode", 2,  2, L"%d", NULL, NULL, NULL, NULL },
+  { L"Reserved",     12, 4, L"%d", NULL, NULL, NULL, NULL }
 };
 
 /**
@@ -295,12 +295,12 @@ STATIC CONST ACPI_PARSER  ProcessorLocalApic[] = {
    An ACPI_PARSER array describing the Local APIC NMI Structure.
  **/
 STATIC CONST ACPI_PARSER  LocalApicNmi[] = {
-  { L"Type",               1, 0, L"0x%x", NULL,                  NULL, NULL, NULL },
-  { L"Length",             1, 1, L"%d",   NULL,                  NULL, NULL, NULL },
+  { L"Type",               1, 0, L"0x%x", NULL,                NULL, NULL, NULL },
+  { L"Length",             1, 1, L"%d",   NULL,                NULL, NULL, NULL },
 
-  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                  NULL, NULL, NULL },
-  { L"Flags",              2, 3, NULL,    DumpMpsIntiBitFlags,   NULL, NULL, NULL },
-  { L"Local APIC LINT#",   1, 5, L"%d",   NULL,                  NULL, NULL, NULL }
+  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                NULL, NULL, NULL },
+  { L"Flags",              2, 3, NULL,    DumpMpsIntiBitFlags, NULL, NULL, NULL },
+  { L"Local APIC LINT#",   1, 5, L"%d",   NULL,                NULL, NULL, NULL }
 };
 
 /**
@@ -379,7 +379,7 @@ ParseAcpiMadt (
   )
 {
   UINT32  Offset;
-  UINT8   *InterruptContollerPtr;
+  UINT8   *InterruptControllerPtr;
   UINT32  GICDCount;
 
   GICDCount = 0;
@@ -396,7 +396,7 @@ ParseAcpiMadt (
              AcpiTableLength,
              PARSER_PARAMS (MadtParser)
              );
-  InterruptContollerPtr = Ptr + Offset;
+  InterruptControllerPtr = Ptr + Offset;
 
   while (Offset < AcpiTableLength) {
     // Parse Interrupt Controller Structure to obtain Length.
@@ -404,7 +404,7 @@ ParseAcpiMadt (
       FALSE,
       0,
       NULL,
-      InterruptContollerPtr,
+      InterruptControllerPtr,
       AcpiTableLength - Offset,
       PARSER_PARAMS (MadtInterruptControllerHeaderParser)
       );
@@ -445,7 +445,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "GICC",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (GicCParser)
           );
@@ -467,7 +467,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "GICD",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (GicDParser)
           );
@@ -480,7 +480,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "GIC MSI Frame",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (GicMSIFrameParser)
           );
@@ -493,7 +493,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "GICR",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (GicRParser)
           );
@@ -506,7 +506,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "GIC ITS",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (GicITSParser)
           );
@@ -519,7 +519,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "IO APIC",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (IoApic)
           );
@@ -532,7 +532,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "INTERRUPT SOURCE OVERRIDE",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (InterruptSourceOverride)
           );
@@ -544,7 +544,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "PROCESSOR LOCAL APIC",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (ProcessorLocalApic)
           );
@@ -556,11 +556,11 @@ ParseAcpiMadt (
           TRUE,
           2,
           "LOCAL APIC NMI",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (LocalApicNmi)
           );
-          break;
+        break;
       }
       case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
       {
@@ -568,7 +568,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "PROCESSOR LOCAL X2APIC",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (ProcessorLocalX2Apic)
           );
@@ -581,7 +581,7 @@ ParseAcpiMadt (
           TRUE,
           2,
           "LOCAL x2APIC NMI",
-          InterruptContollerPtr,
+          InterruptControllerPtr,
           *MadtInterruptControllerLength,
           PARSER_PARAMS (LocalX2ApicNmi)
           );
@@ -600,7 +600,7 @@ ParseAcpiMadt (
       }
     } // switch
 
-    InterruptContollerPtr += *MadtInterruptControllerLength;
-    Offset                += *MadtInterruptControllerLength;
+    InterruptControllerPtr += *MadtInterruptControllerLength;
+    Offset                 += *MadtInterruptControllerLength;
   } // while
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c
  2023-05-03 21:50 ` [PATCH 2/2] ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c Rebecca Cran
@ 2023-05-04  3:44   ` Rebecca Cran
  0 siblings, 0 replies; 4+ messages in thread
From: Rebecca Cran @ 2023-05-04  3:44 UTC (permalink / raw)
  To: devel, Ray Ni, Zhichao Gao

Sorry, I made Uncrustify fixes in the wrong commit. I'll send out a v2.


On 5/3/23 15:50, Rebecca Cran wrote:
> Fix typos of 'Controller' in acpiview MadtParser.c.
>
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>   ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 50 ++++++++++----------
>   1 file changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
> index 9d33ad2606e8..0197b4bd9a66 100644
> --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
> +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
> @@ -214,9 +214,9 @@ STATIC CONST ACPI_PARSER  LocalApicFlags[] = {
>   };
>   
>   STATIC CONST ACPI_PARSER  MpsIntiFlags[] = {
> -  { L"Polarity",       2,  0, L"%d", NULL, NULL, NULL, NULL },
> -  { L"Trigger Mode",   2,  2, L"%d", NULL, NULL, NULL, NULL },
> -  { L"Reserved",       12, 4, L"%d", NULL, NULL, NULL, NULL }
> +  { L"Polarity",     2,  0, L"%d", NULL, NULL, NULL, NULL },
> +  { L"Trigger Mode", 2,  2, L"%d", NULL, NULL, NULL, NULL },
> +  { L"Reserved",     12, 4, L"%d", NULL, NULL, NULL, NULL }
>   };
>   
>   /**
> @@ -295,12 +295,12 @@ STATIC CONST ACPI_PARSER  ProcessorLocalApic[] = {
>      An ACPI_PARSER array describing the Local APIC NMI Structure.
>    **/
>   STATIC CONST ACPI_PARSER  LocalApicNmi[] = {
> -  { L"Type",               1, 0, L"0x%x", NULL,                  NULL, NULL, NULL },
> -  { L"Length",             1, 1, L"%d",   NULL,                  NULL, NULL, NULL },
> +  { L"Type",               1, 0, L"0x%x", NULL,                NULL, NULL, NULL },
> +  { L"Length",             1, 1, L"%d",   NULL,                NULL, NULL, NULL },
>   
> -  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                  NULL, NULL, NULL },
> -  { L"Flags",              2, 3, NULL,    DumpMpsIntiBitFlags,   NULL, NULL, NULL },
> -  { L"Local APIC LINT#",   1, 5, L"%d",   NULL,                  NULL, NULL, NULL }
> +  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                NULL, NULL, NULL },
> +  { L"Flags",              2, 3, NULL,    DumpMpsIntiBitFlags, NULL, NULL, NULL },
> +  { L"Local APIC LINT#",   1, 5, L"%d",   NULL,                NULL, NULL, NULL }
>   };
>   
>   /**
> @@ -379,7 +379,7 @@ ParseAcpiMadt (
>     )
>   {
>     UINT32  Offset;
> -  UINT8   *InterruptContollerPtr;
> +  UINT8   *InterruptControllerPtr;
>     UINT32  GICDCount;
>   
>     GICDCount = 0;
> @@ -396,7 +396,7 @@ ParseAcpiMadt (
>                AcpiTableLength,
>                PARSER_PARAMS (MadtParser)
>                );
> -  InterruptContollerPtr = Ptr + Offset;
> +  InterruptControllerPtr = Ptr + Offset;
>   
>     while (Offset < AcpiTableLength) {
>       // Parse Interrupt Controller Structure to obtain Length.
> @@ -404,7 +404,7 @@ ParseAcpiMadt (
>         FALSE,
>         0,
>         NULL,
> -      InterruptContollerPtr,
> +      InterruptControllerPtr,
>         AcpiTableLength - Offset,
>         PARSER_PARAMS (MadtInterruptControllerHeaderParser)
>         );
> @@ -445,7 +445,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "GICC",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (GicCParser)
>             );
> @@ -467,7 +467,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "GICD",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (GicDParser)
>             );
> @@ -480,7 +480,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "GIC MSI Frame",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (GicMSIFrameParser)
>             );
> @@ -493,7 +493,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "GICR",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (GicRParser)
>             );
> @@ -506,7 +506,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "GIC ITS",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (GicITSParser)
>             );
> @@ -519,7 +519,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "IO APIC",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (IoApic)
>             );
> @@ -532,7 +532,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "INTERRUPT SOURCE OVERRIDE",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (InterruptSourceOverride)
>             );
> @@ -544,7 +544,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "PROCESSOR LOCAL APIC",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (ProcessorLocalApic)
>             );
> @@ -556,11 +556,11 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "LOCAL APIC NMI",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (LocalApicNmi)
>             );
> -          break;
> +        break;
>         }
>         case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
>         {
> @@ -568,7 +568,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "PROCESSOR LOCAL X2APIC",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (ProcessorLocalX2Apic)
>             );
> @@ -581,7 +581,7 @@ ParseAcpiMadt (
>             TRUE,
>             2,
>             "LOCAL x2APIC NMI",
> -          InterruptContollerPtr,
> +          InterruptControllerPtr,
>             *MadtInterruptControllerLength,
>             PARSER_PARAMS (LocalX2ApicNmi)
>             );
> @@ -600,7 +600,7 @@ ParseAcpiMadt (
>         }
>       } // switch
>   
> -    InterruptContollerPtr += *MadtInterruptControllerLength;
> -    Offset                += *MadtInterruptControllerLength;
> +    InterruptControllerPtr += *MadtInterruptControllerLength;
> +    Offset                 += *MadtInterruptControllerLength;
>     } // while
>   }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-04  3:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-03 21:50 [PATCH 0/2] ShellPkg: UefiShellAcpiViewCommandLib: Add support for parsing Local APIC NMI structure Rebecca Cran
2023-05-03 21:50 ` [PATCH 1/2] ShellPkg: acpiview: add support for parsing the " Rebecca Cran
2023-05-03 21:50 ` [PATCH 2/2] ShellPkg: Fix typo of 'Controller' in acpiview MadtParser.c Rebecca Cran
2023-05-04  3:44   ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox