public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@bsdio.com>
To: devel@edk2.groups.io, Ray Ni <ray.ni@intel.com>,
	Zhichao Gao <zhichao.gao@intel.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Subject: [PATCH 1/2] ShellPkg: acpiview: add support for parsing the Local APIC NMI structure
Date: Wed,  3 May 2023 15:50:22 -0600	[thread overview]
Message-ID: <20230503215023.1176725-2-rebecca@bsdio.com> (raw)
In-Reply-To: <20230503215023.1176725-1-rebecca@bsdio.com>

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


  reply	other threads:[~2023-05-03 21:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20230503215023.1176725-2-rebecca@bsdio.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