public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Abdul Lateef Attar" <abdattar@amd.com>
To: <devel@edk2.groups.io>
Cc: Ray Ni <ray.ni@intel.com>, Zhichao Gao <zhichao.gao@intel.com>,
	"Sami Mujawar" <sami.mujawar@arm.com>
Subject: [edk2-devel] [PATCH v1] ShellPkg/AcpiView: PrintFormatter for FADT Flags field
Date: Fri, 12 Nov 2021 18:57:25 +0530	[thread overview]
Message-ID: <20211112132725.13810-1-abdattar@amd.com> (raw)

Adds PrintFormatter function to the FADT flags field.
Prints indivisual flag name along with flag value.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 208 +++++++++++++++++++-
 1 file changed, 207 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
index d86718bab67d..7f01412f1a9b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
@@ -2,6 +2,7 @@
   FADT table parser
 
   Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+  Copyright (c) 2021, AMD Incorporated. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
@@ -127,6 +128,211 @@ ValidateFlags (
 #endif
 }
 
+/**
+  This function traces FADT Flags field.
+
+  @param [in] Format  Optional format string for tracing the data.
+  @param [in] Ptr     Pointer to the start of the buffer.
+**/
+VOID
+EFIAPI
+DumpFadtFlags (
+  IN CONST CHAR16* Format OPTIONAL,
+  IN UINT8*        Ptr
+  )
+{
+  if (Format != NULL) {
+    Print (Format, *(UINT32*)Ptr);
+    return;
+  }
+
+  Print (L"0x%X\n", *(UINT32*)Ptr);
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+     L"WBINVD",
+    *(UINT32*)Ptr & BIT0 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"WBINVD_FLUSH",
+    *(UINT32*)Ptr & BIT1 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"PROC_C1",
+    *(UINT32*)Ptr & BIT2 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"P_LVL2_UP",
+    *(UINT32*)Ptr & BIT3 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"PWR_BUTTON",
+    *(UINT32*)Ptr & BIT4 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"SLP_BUTTON",
+    *(UINT32*)Ptr & BIT5 ? 1 : 0
+   );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"FIX_RTC",
+    *(UINT32*)Ptr & BIT6 ? 1 : 0
+   );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"RTC_S4",
+    *(UINT32*)Ptr & BIT7 ? 1 : 0
+   );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"TMR_VAL_EXT",
+    *(UINT32*)Ptr & BIT8 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"DCK_CAP",
+    *(UINT32*)Ptr & BIT9 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"RESET_REG_SUP",
+    *(UINT32*)Ptr & BIT10 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"SEALED_CASE",
+    *(UINT32*)Ptr & BIT11 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"HEADLESS",
+    *(UINT32*)Ptr & BIT12 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"CPU_SW_SLP",
+    *(UINT32*)Ptr & BIT13 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"PCI_EXP_WAK",
+    *(UINT32*)Ptr & BIT14 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"USE_PLATFORM_CLOCK",
+    *(UINT32*)Ptr & BIT15 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"S4_RTC_STS_VALID",
+    *(UINT32*)Ptr & BIT16 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"REMOTE_POWER_ON_CAPABLE",
+    *(UINT32*)Ptr & BIT17 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"FORCE_APIC_CLUSTER_MODEL",
+    *(UINT32*)Ptr & BIT18 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"FORCE_APIC_PHYSICAL_DESTINATION_MODE",
+    *(UINT32*)Ptr & BIT19 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"HW_REDUCED_ACPI",
+    *(UINT32*)Ptr & BIT20 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"LOW_POWER_S0_IDLE_CAPABLE",
+    *(UINT32*)Ptr & BIT21 ? 1 : 0
+    );
+  Print (
+    L"%*a%-*s : %d\n",
+    4,
+    "",
+    (OUTPUT_FIELD_COLUMN_WIDTH - 4),
+    L"Reserved",
+    *(UINT32*)Ptr & BIT22 ? 1 : 0
+    );
+}
+
 /**
   An ACPI_PARSER array describing the ACPI FADT Table.
 **/
@@ -170,7 +376,7 @@ STATIC CONST ACPI_PARSER FadtParser[] = {
   {L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL},
   {L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL},
   {L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL},
-  {L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL},
+  {L"Flags", 4, 112, NULL, DumpFadtFlags, (VOID**)&Flags, ValidateFlags, NULL},
   {L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL},
   {L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL},
   {L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL},
-- 
2.25.1


             reply	other threads:[~2021-11-12 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 13:27 Abdul Lateef Attar [this message]
2021-11-15  5:49 ` [edk2-devel] [PATCH v1] ShellPkg/AcpiView: PrintFormatter for FADT Flags field Gao, Zhichao
2021-11-15 17:59 ` Sami Mujawar

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=20211112132725.13810-1-abdattar@amd.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