From bc0fc7563780191622146593998b355f383041a2 Mon Sep 17 00:00:00 2001 From: Abdul Lateef Attar Date: Thu, 1 Aug 2024 10:49:20 +0000 Subject: DynamicTablesPkg/AcpiFadtLib: Adds FADT X64 generator REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4781 Updates FADT X64 generator to collect below configuration information and update the table accordingly. - SCI interrupt - SCI command - PM Block - GPE Block - PM Block 64-bit - GPE Block 64-bit - Sleep block - Reset block - Miscellaneous legacy information Cc: Sami Mujawar Cc: Pierre Gondois Signed-off-by: Abdul Lateef Attar --- DynamicTablesPkg/DynamicTables.dsc.inc | 7 +- DynamicTablesPkg/Include/X64NameSpaceObjects.h | 146 +++++++- .../Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf | 2 +- .../Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c | 47 --- .../Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c | 382 +++++++++++++++++++++ .../ConfigurationManagerObjectParser.c | 119 +++++++ DynamicTablesPkg/Readme.md | 9 + 7 files changed, 662 insertions(+), 50 deletions(-) delete mode 100644 DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c create mode 100644 DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c (limited to 'DynamicTablesPkg') diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc index fa68b63ab1..3fdb3e66b2 100644 --- a/DynamicTablesPkg/DynamicTables.dsc.inc +++ b/DynamicTablesPkg/DynamicTables.dsc.inc @@ -53,7 +53,12 @@ # # Dynamic Table Factory Dxe # - DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf + DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf { + + # Generators + # Common + NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf + } [Components.ARM, Components.AARCH64] # diff --git a/DynamicTablesPkg/Include/X64NameSpaceObjects.h b/DynamicTablesPkg/Include/X64NameSpaceObjects.h index f9f131e822..2fa696b4c3 100644 --- a/DynamicTablesPkg/Include/X64NameSpaceObjects.h +++ b/DynamicTablesPkg/Include/X64NameSpaceObjects.h @@ -15,12 +15,156 @@ #ifndef X64_NAMESPACE_OBJECTS_H_ #define X64_NAMESPACE_OBJECTS_H_ +#include + /** The EX64_OBJECT_ID enum describes the Object IDs in the X64 Namespace */ typedef enum X64ObjectID { EX64ObjReserved, ///< 0 - Reserved - EX64ObjMax + EX64ObjFadtSciInterrupt, ///< 1 - FADT SCI Interrupt information + EX64ObjFadtSciCmdInfo, ///< 2 - FADT SCI CMD information + EX64ObjFadtPmBlockInfo, ///< 3 - FADT Power management block info + EX64ObjFadtGpeBlockInfo, ///< 4 - FADT GPE block info + EX64ObjFadtXpmBlockInfo, ///< 5 - FADT 64-bit Power Management block info + EX64ObjFadtXgpeBlockInfo, ///< 6 - FADT 64-bit GPE block info + EX64ObjFadtSleepBlockInfo, ///< 7 - FADT Sleep block info + EX64ObjFadtResetBlockInfo, ///< 8 - FADT Reset block info + EX64ObjFadtMiscInfo, ///< 0 - FADT Legacy fields info + EX64ObjMax ///< 10 - Maximum Object ID } EX64_OBJECT_ID; +/** A structure that describes the + SCI interrupt Information for the Platform. + + ID: EX64ObjFadtSciInterrupt +*/ +typedef struct CmX64FadtSciInterrupt { + /** This is the SCI interrupt field of the FADT Table + described in the ACPI Specification + */ + UINT16 SciInterrupt; +} CM_X64_FADT_SCI_INTERRUPT; + +/** A structure that describes the + SCI CMD Information for the Platform. + + ID: EX64ObjFadtSciCmdInfo +*/ +typedef struct CmX64FadtSciCmdInfo { + /** This is the System control interrupt command information of the FADT Table + described in the ACPI Specification + */ + UINT32 SciCmd; + UINT8 AcpiEnable; + UINT8 AcpiDisable; + UINT8 S4BiosReq; + UINT8 PstateCnt; + UINT8 CstCnt; +} CM_X64_FADT_SCI_CMD_INFO; + +/** A structure that describes the + power management block information. + + ID: EX64ObjFadtPmBlockInfo +*/ +typedef struct CmX64FadtPmBlockInfo { + /** This is the PM event block information of the FADT Table + described in the ACPI Specification + */ + UINT32 Pm1aEvtBlk; + UINT32 Pm1bEvtBlk; + UINT32 Pm1aCntBlk; + UINT32 Pm1bCntBlk; + UINT32 Pm2CntBlk; + UINT32 PmTmrBlk; + UINT8 Pm1EvtLen; + UINT8 Pm1CntLen; + UINT8 Pm2CntLen; + UINT8 PmTmrLen; +} CM_X64_FADT_PM_BLOCK_INFO; + +/** A structure that describes the + GPE block information. + + ID: EX64ObjFadtGpeBlockInfo +*/ +typedef struct CmX64FadtGpeBlockInfo { + /** This is the GPE Block information of the FADT Table + described in the ACPI Specification + */ + UINT32 Gpe0Blk; + UINT32 Gpe1Blk; + UINT8 Gpe0BlkLen; + UINT8 Gpe1BlkLen; + UINT8 Gpe1Base; +} CM_X64_FADT_GPE_BLOCK_INFO; + +/** A structure that describes the + 64bit power management block information. + + ID: EX64ObjFadtXpmBlockInfo +*/ +typedef struct CmX64FadtXpmBlockInfo { + /** This is the System control interrupt command information of the FADT Table + described in the ACPI Specification + */ + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk; +} CM_X64_FADT_X_PM_BLOCK_INFO; + +/** A structure that describes the + 64-bit GPE block information. + + ID: EX64ObjFadtXgpeBlockInfo +*/ +typedef struct CmX64FadtXgpeBlockInfo { + /** This is the GPE Block information of the FADT Table + described in the ACPI Specification + */ + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe0Blk; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE XGpe1Blk; +} CM_X64_FADT_X_GPE_BLOCK_INFO; + +/** A structure that describes the + sleep control block information. + + ID: EX64ObjFadtSleepBlockInfo +*/ +typedef struct CmX64FadtSleepBlockInfo { + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepControlReg; + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE SleepStatusReg; +} CM_X64_FADT_SLEEP_BLOCK_INFO; + +/** A structure that describes the + Reset control block information. + + ID: EX64ObjFadtResetBlockInfo +*/ +typedef struct CmX64FadtResetBlockInfo { + EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE ResetReg; + UINT8 ResetValue; +} CM_X64_FADT_RESET_BLOCK_INFO; + +/** A structure that describes the + miscellaneous FADT fields information. + + ID: EX64ObjFadtMiscInfo +*/ +typedef struct CmX64FadtFadtMiscInfo { + UINT16 PLvl2Lat; + UINT16 PLvl3Lat; + UINT16 FlushSize; + UINT16 FlushStride; + UINT8 DutyOffset; + UINT8 DutyWidth; + UINT8 DayAlrm; + UINT8 MonAlrm; + UINT8 Century; +} CM_X64_FADT_MISC_INFO; + #endif // X64_NAMESPACE_OBJECTS_H_ diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf index 67c7fdbd23..b4b899ca17 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/AcpiFadtLib.inf @@ -24,7 +24,7 @@ Arm/ArmFadtGenerator.c [Sources.IA32, Sources.X64] - FadtGeneratorNull.c + X64/X64FadtGenerator.c [Packages] MdePkg/MdePkg.dec diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c deleted file mode 100644 index 7868aae742..0000000000 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGeneratorNull.c +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - Common FADT Table Helpers - - Copyright (c) 2017 - 2023, Arm Limited. All rights reserved. - SPDX-License-Identifier: BSD-2-Clause-Patent - - @par Reference(s): - - ACPI 6.5 Specification, Aug 29, 2022 - -**/ - -#include -#include -#include - -// Module specific include files. -#include -#include -#include -#include -#include -#include "FadtGenerator.h" - -/** Updates the Architecture specific information in the FADT Table. - - @param [in] CfgMgrProtocol Pointer to the Configuration Manager - Protocol Interface. - @param [in, out] Fadt Pointer to the constructed ACPI Table. - - @retval EFI_SUCCESS Success. - @retval EFI_UNSUPPORTED Unsupported. - @retval EFI_INVALID_PARAMETER A parameter is invalid. - @retval EFI_NOT_FOUND The required object was not found. - @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration - Manager is less than the Object size for the - requested object. -**/ -EFI_STATUS -EFIAPI -FadtArchUpdate ( - IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, - IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt - ) -{ - // Not implemented. - return EFI_UNSUPPORTED; -} diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c new file mode 100644 index 0000000000..113894183d --- /dev/null +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/X64/X64FadtGenerator.c @@ -0,0 +1,382 @@ +/** @file + X64 FADT Table Helpers + + Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - ACPI 6.5 Specification, Aug 29, 2022 + +**/ + +#include +#include +#include +#include +#include + +// Module specific include files. +#include +#include +#include +#include +#include +#include "FadtGenerator.h" + +/** This macro expands to a function that retrieves the + SCI interrupt information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtSciInterrupt, + CM_X64_FADT_SCI_INTERRUPT + ); + +/** This macro expands to a function that retrieves the + SCI command information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtSciCmdInfo, + CM_X64_FADT_SCI_CMD_INFO + ); + +/** This macro expands to a function that retrieves the + legacy power management information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtPmBlockInfo, + CM_X64_FADT_PM_BLOCK_INFO + ); + +/** This macro expands to a function that retrieves the + legacy GPE block information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtGpeBlockInfo, + CM_X64_FADT_GPE_BLOCK_INFO + ); + +/** This macro expands to a function that retrieves the + legacy level2 latency, level 3 latency, RTC information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtMiscInfo, + CM_X64_FADT_MISC_INFO + ); + +/** This macro expands to a function that retrieves the + 64-bit power management information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtXpmBlockInfo, + CM_X64_FADT_X_PM_BLOCK_INFO + ); + +/** This macro expands to a function that retrieves the + 64-bit GPE block information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtXgpeBlockInfo, + CM_X64_FADT_X_GPE_BLOCK_INFO + ); + +/** This macro expands to a function that retrieves the + sleep block information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtSleepBlockInfo, + CM_X64_FADT_SLEEP_BLOCK_INFO + ); + +/** This macro expands to a function that retrieves the + reset block information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceX64, + EX64ObjFadtResetBlockInfo, + CM_X64_FADT_RESET_BLOCK_INFO + ); + +/** Updates the Architecture specific information in the FADT Table. + + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in, out] Fadt Pointer to the constructed ACPI Table. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object was not found. + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration + Manager is less than the Object size for the + requested object. +**/ +EFI_STATUS +EFIAPI +FadtArchUpdate ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN OUT EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE *Fadt + ) +{ + EFI_STATUS Status; + CM_X64_FADT_SCI_INTERRUPT *SciInterrupt; + CM_X64_FADT_SCI_CMD_INFO *SciCmdinfo; + CM_X64_FADT_PM_BLOCK_INFO *PmBlockInfo; + CM_X64_FADT_GPE_BLOCK_INFO *GpeBlockInfo; + CM_X64_FADT_X_PM_BLOCK_INFO *XpmBlockInfo; + CM_X64_FADT_X_GPE_BLOCK_INFO *XgpeBlockInfo; + CM_X64_FADT_SLEEP_BLOCK_INFO *SleepBlockInfo; + CM_X64_FADT_RESET_BLOCK_INFO *ResetBlockInfo; + CM_X64_FADT_MISC_INFO *FadtMiscInfo; + + ASSERT (CfgMgrProtocol != NULL); + ASSERT (Fadt != NULL); + + // Get the SCI interrupt from the Platform Configuration Manager + Status = GetEX64ObjFadtSciInterrupt ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &SciInterrupt, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get SCI Interrupt information." \ + " Status = %r\n", + Status + )); + } else { + Fadt->SciInt = SciInterrupt->SciInterrupt; + } + + // Get the SCI CMD information from the Platform Configuration Manager + Status = GetEX64ObjFadtSciCmdInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &SciCmdinfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get SCI CMD information." \ + " Status = %r\n", + Status + )); + } else { + Fadt->SmiCmd = SciCmdinfo->SciCmd; + Fadt->AcpiEnable = SciCmdinfo->AcpiEnable; + Fadt->AcpiDisable = SciCmdinfo->AcpiDisable; + Fadt->S4BiosReq = SciCmdinfo->S4BiosReq; + Fadt->PstateCnt = SciCmdinfo->PstateCnt; + Fadt->CstCnt = SciCmdinfo->CstCnt; + } + + // Get the SCI PM Block information from the Platform Configuration Manager + Status = GetEX64ObjFadtPmBlockInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &PmBlockInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get PM Block information." \ + " Status = %r\n", + Status + )); + } else { + Fadt->Pm1aEvtBlk = PmBlockInfo->Pm1aEvtBlk; + Fadt->Pm1bEvtBlk = PmBlockInfo->Pm1bEvtBlk; + Fadt->Pm1aCntBlk = PmBlockInfo->Pm1aCntBlk; + Fadt->Pm1bCntBlk = PmBlockInfo->Pm1bCntBlk; + Fadt->Pm2CntBlk = PmBlockInfo->Pm2CntBlk; + Fadt->PmTmrBlk = PmBlockInfo->PmTmrBlk; + Fadt->Pm1EvtLen = PmBlockInfo->Pm1EvtLen; + Fadt->Pm1CntLen = PmBlockInfo->Pm1CntLen; + Fadt->Pm2CntLen = PmBlockInfo->Pm2CntLen; + Fadt->PmTmrLen = PmBlockInfo->PmTmrLen; + } + + // Get the SCI PM Block information from the Platform Configuration Manager + Status = GetEX64ObjFadtGpeBlockInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &GpeBlockInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get PM Block information." \ + " Status = %r\n", + Status + )); + } else { + Fadt->Gpe0Blk = GpeBlockInfo->Gpe0Blk; + Fadt->Gpe1Blk = GpeBlockInfo->Gpe1Blk; + Fadt->Gpe0BlkLen = GpeBlockInfo->Gpe0BlkLen; + Fadt->Gpe1BlkLen = GpeBlockInfo->Gpe1BlkLen; + Fadt->Gpe1Base = GpeBlockInfo->Gpe1Base; + } + + // Get the 64-bit PM Block information from the Platform Configuration Manager + Status = GetEX64ObjFadtXpmBlockInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &XpmBlockInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get 64-bit PM Block information." \ + " Status = %r\n", + Status + )); + } else { + CopyMem ( + &Fadt->XPm1aCntBlk, + &XpmBlockInfo->XPm1aCntBlk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->XPm1bEvtBlk, + &XpmBlockInfo->XPm1bEvtBlk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->XPm1aCntBlk, + &XpmBlockInfo->XPm1aCntBlk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->XPm1bCntBlk, + &XpmBlockInfo->XPm1bCntBlk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->XPm2CntBlk, + &XpmBlockInfo->XPm2CntBlk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->XPmTmrBlk, + &XpmBlockInfo->XPmTmrBlk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + } + + // Get the various platform information from the Platform Configuration manager + Status = GetEX64ObjFadtMiscInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &FadtMiscInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get various platform information." \ + " Status = %r\n", + Status + )); + } else { + Fadt->PLvl2Lat = FadtMiscInfo->PLvl2Lat; + Fadt->PLvl3Lat = FadtMiscInfo->PLvl3Lat; + Fadt->FlushSize = FadtMiscInfo->FlushSize; + Fadt->FlushStride = FadtMiscInfo->FlushStride; + Fadt->DutyOffset = FadtMiscInfo->DutyOffset; + Fadt->DutyWidth = FadtMiscInfo->DutyWidth; + Fadt->DayAlrm = FadtMiscInfo->DayAlrm; + Fadt->MonAlrm = FadtMiscInfo->MonAlrm; + Fadt->Century = FadtMiscInfo->Century; + } + + // Get the 64-bit GPE Block information from the Platform Configuration Manager + Status = GetEX64ObjFadtXgpeBlockInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &XgpeBlockInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get 64-bit GPE Block information." \ + " Status = %r\n", + Status + )); + } else { + CopyMem ( + &Fadt->XGpe0Blk, + &XgpeBlockInfo->XGpe0Blk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->XGpe1Blk, + &XgpeBlockInfo->XGpe1Blk, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + } + + // Get the sleep Block information from the Platform Configuration Manager + Status = GetEX64ObjFadtSleepBlockInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &SleepBlockInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get Sleep Block information." \ + " Status = %r\n", + Status + )); + } else { + CopyMem ( + &Fadt->SleepControlReg, + &SleepBlockInfo->SleepControlReg, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + CopyMem ( + &Fadt->SleepStatusReg, + &SleepBlockInfo->SleepStatusReg, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + } + + // Get the sleep Block information from the Platform Configuration Manager + Status = GetEX64ObjFadtResetBlockInfo ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &ResetBlockInfo, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: FADT: Failed to get Reset Block information." \ + " Status = %r\n", + Status + )); + } else { + CopyMem ( + &Fadt->ResetReg, + &ResetBlockInfo->ResetReg, + sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE) + ); + Fadt->ResetValue = ResetBlockInfo->ResetValue; + } + + return Status; +} diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c index ccd681fb91..96d02821e3 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c @@ -730,10 +730,129 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = { CM_PARSER_ADD_OBJECT_RESERVED (EArmObjMax) }; +/** A parser for EX64ObjFadtSciInterrupt. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtSciInterruptParser[] = { + { "SciInterrupt", 2, "0x%x", NULL } +}; + +/** A parser for EX64ObjFadtSciCmdInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtSciCmdInfoParser[] = { + { "SciCmd", 4, "0x%x", NULL }, + { "AcpiEnable", 1, "0x%x", NULL }, + { "AcpiDisable", 1, "0x%x", NULL }, + { "S4BiosReq", 1, "0x%x", NULL }, + { "PstateCnt", 1, "0x%x", NULL }, + { "CstCnt", 1, "0x%x", NULL } +}; + +/** A parser for EX64ObjFadtPmBlockInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtPmBlockInfoParser[] = { + { "Pm1aEvtBlk", 4, "0x%x", NULL }, + { "Pm1bEvtBlk", 4, "0x%x", NULL }, + { "Pm1aCntBlk", 4, "0x%x", NULL }, + { "Pm1bCntBlk", 4, "0x%x", NULL }, + { "Pm2CntBlk", 4, "0x%x", NULL }, + { "PmTmrBlk", 4, "0x%x", NULL }, + { "Pm1EvtLen", 1, "0x%x", NULL }, + { "Pm1CntLen", 1, "0x%x", NULL }, + { "Pm2CntLen", 1, "0x%x", NULL }, + { "PmTmrLen", 1, "0x%x", NULL } +}; + +/** A parser for EX64ObjFadtGpeBlockInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtGpeBlockInfoParser[] = { + { "Gpe0Blk", 4, "0x%x", NULL }, + { "Gpe1Blk", 4, "0x%x", NULL }, + { "Gpe0BlkLen", 1, "0x%x", NULL }, + { "Gpe1BlkLen", 1, "0x%x", NULL }, + { "Gpe1Base", 1, "0x%x", NULL } +}; + +/** A parser for EX64ObjFadtXpmBlockInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtXpmBlockInfoParser[] = { + { "XPm1aEvtBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "XPm1bEvtBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "XPm1aCntBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "XPm1bCntBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "XPm2CntBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "XPmTmrBlk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) } +}; + +/** A parser for EX64ObjFadtXgpeBlockInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtXgpeBlockInfoParser[] = { + { "XGpe0Blk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "XGpe1Blk", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) } +}; + +/** A parser for EX64ObjFadtSleepBlockInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtSleepBlockInfoParser[] = { + { "SleepControlReg", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "SleepStatusReg", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) } +}; + +/** A parser for EX64ObjFadtResetBlockInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtResetBlockInfoParser[] = { + { "ResetReg", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "ResetValue", 1, "0x%x",NULL } +}; + +/** A parser for EX64ObjFadtMiscInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmX64ObjFadtMiscInfoParser[] = { + { "PLvl2Lat", 2, "0x%x", NULL }, + { "PLvl3Lat", 2, "0x%x", NULL }, + { "FlushSize", 2, "0x%x", NULL }, + { "FlushStride", 2, "0x%x", NULL }, + { "DutyOffset", 1, "0x%x", NULL }, + { "DutyWidth", 1, "0x%x", NULL }, + { "DayAlrm", 1, "0x%x", NULL }, + { "MonAlrm", 1, "0x%x", NULL }, + { "Century", 1, "0x%x", NULL } +}; + /** A parser for X64 namespace objects. */ STATIC CONST CM_OBJ_PARSER_ARRAY X64NamespaceObjectParser[] = { CM_PARSER_ADD_OBJECT_RESERVED (EX64ObjReserved), + CM_PARSER_ADD_OBJECT (EX64ObjFadtSciInterrupt, CmX64ObjFadtSciInterruptParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtSciCmdInfo, CmX64ObjFadtSciCmdInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtPmBlockInfo, CmX64ObjFadtPmBlockInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtGpeBlockInfo, CmX64ObjFadtGpeBlockInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtXpmBlockInfo, CmX64ObjFadtXpmBlockInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtXgpeBlockInfo, CmX64ObjFadtXgpeBlockInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtSleepBlockInfo,CmX64ObjFadtSleepBlockInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtResetBlockInfo,CmX64ObjFadtResetBlockInfoParser), + CM_PARSER_ADD_OBJECT (EX64ObjFadtMiscInfo, CmX64ObjFadtMiscInfoParser), CM_PARSER_ADD_OBJECT_RESERVED (EX64ObjMax) }; diff --git a/DynamicTablesPkg/Readme.md b/DynamicTablesPkg/Readme.md index eebde70046..3b64bc857b 100644 --- a/DynamicTablesPkg/Readme.md +++ b/DynamicTablesPkg/Readme.md @@ -504,4 +504,13 @@ The CM_OBJECT_ID type is used to identify the Configuration Manager | ID | Description | Comments | | ---: | :-------------------------- | :--- | | 0 | Reserved | | +| 1 | SCI Interrupt Info | | +| 2 | SCI Command Info | | +| 3 | Legacy Power Management Block Info | | +| 4 | Legacy GPE Block Info | | +| 5 | Power Management Block Info | | +| 6 | GPE Block Info | | +| 7 | Sleep Block Info | | +| 8 | Reset Block Info | | +| 9 | Miscellaneous Block Info | | | `*` | All other values are reserved. | | -- cgit v1.2.3