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

Signed-off-by: Rebecca Cran <rebe...@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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103923): https://edk2.groups.io/g/devel/message/103923
Mute This Topic: https://groups.io/mt/98672297/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to