ShellPkg/AcpiView: PrintFormatter for FADT Flags field

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3839

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>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
This commit is contained in:
Abdul Lateef Attar 2022-03-18 20:59:00 +08:00 committed by mergify[bot]
parent 691b178667
commit 40004ff9d5
2 changed files with 113 additions and 56 deletions

View File

@ -884,7 +884,7 @@ ParseAcpiBitFields (
}
// extract Bitfield data for the current item
Data = (BitsData >> Parser[Index].Offset) & ~(~0ULL << Parser[Index].Length);
Data = RShiftU64 (BitsData, Parser[Index].Offset) & ~(LShiftU64 (~0ULL, Parser[Index].Length));
if (Trace) {
// if there is a Formatter function let the function handle

View File

@ -2,6 +2,7 @@
FADT table parser
Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
Copyright (c) 2022, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@ -130,6 +131,62 @@ ValidateFlags (
#endif
}
STATIC CONST ACPI_PARSER FadtFlagParser[] = {
{ L"WBINVD", 1, 0, L"%d", NULL, NULL, NULL, NULL },
{ L"WBINVD_FLUSH", 1, 1, L"%d", NULL, NULL, NULL, NULL },
{ L"PROC_C1", 1, 2, L"%d", NULL, NULL, NULL, NULL },
{ L"P_LVL2_UP", 1, 3, L"%d", NULL, NULL, NULL, NULL },
{ L"PWR_BUTTON", 1, 4, L"%d", NULL, NULL, NULL, NULL },
{ L"SLP_BUTTON", 1, 5, L"%d", NULL, NULL, NULL, NULL },
{ L"FIX_RTC", 1, 6, L"%d", NULL, NULL, NULL, NULL },
{ L"RTC_S4", 1, 7, L"%d", NULL, NULL, NULL, NULL },
{ L"TMR_VAL_EXT", 1, 8, L"%d", NULL, NULL, NULL, NULL },
{ L"DCK_CAP", 1, 9, L"%d", NULL, NULL, NULL, NULL },
{ L"RESET_REG_SUP", 1, 10, L"%d", NULL, NULL, NULL, NULL },
{ L"SEALED_CASE", 1, 11, L"%d", NULL, NULL, NULL, NULL },
{ L"HEADLESS", 1, 12, L"%d", NULL, NULL, NULL, NULL },
{ L"CPU_SW_SLP", 1, 13, L"%d", NULL, NULL, NULL, NULL },
{ L"PCI_EXP_WAK", 1, 14, L"%d", NULL, NULL, NULL, NULL },
{ L"USE_PLATFORM_CLOCK", 1, 15, L"%d", NULL, NULL, NULL, NULL },
{ L"S4_RTC_STS_VALID", 1, 16, L"%d", NULL, NULL, NULL, NULL },
{ L"REMOTE_POWER_ON_CAPABLE", 1, 17, L"%d", NULL, NULL, NULL, NULL },
{ L"FORCE_APIC_CLUSTER_MODEL", 1, 18, L"%d", NULL, NULL, NULL, NULL },
{ L"FORCE_APIC_PHYSICAL_DESTINATION_MODE", 1, 19, L"%d", NULL, NULL, NULL, NULL },
{ L"HW_REDUCED_ACPI", 1, 20, L"%d", NULL, NULL, NULL, NULL },
{ L"LOW_POWER_S0_IDLE_CAPABLE", 1, 21, L"%d", NULL, NULL, NULL, NULL },
{ L"Reserved", 10, 22, L"%d", NULL, NULL, NULL, NULL }
};
/**
This function traces FADT 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
DumpFadtFlags (
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 (FadtFlagParser)
);
}
/**
An ACPI_PARSER array describing the ACPI FADT Table.
**/
@ -173,7 +230,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 },