public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1] ShellPkg/AcpiView: PrintFormatter for FADT Flags field
@ 2021-11-12 13:27 Abdul Lateef Attar
  2021-11-15  5:49 ` Gao, Zhichao
  2021-11-15 17:59 ` Sami Mujawar
  0 siblings, 2 replies; 3+ messages in thread
From: Abdul Lateef Attar @ 2021-11-12 13:27 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Zhichao Gao, Sami Mujawar

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


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

end of thread, other threads:[~2021-11-15 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-12 13:27 [edk2-devel] [PATCH v1] ShellPkg/AcpiView: PrintFormatter for FADT Flags field Abdul Lateef Attar
2021-11-15  5:49 ` Gao, Zhichao
2021-11-15 17:59 ` Sami Mujawar

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