Pushed as 77db115601fb..e8015f2facff -----Original Message----- From: Sami Mujawar Sent: 11 June 2019 09:55 AM To: devel@edk2.groups.io Cc: nd <n...@arm.com> Subject: RE: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3
Reviewed-by: Sami Mujawar <sami.muja...@arm.com> -----Original Message----- From: PierreGondois <pierre.gond...@arm.com> Sent: 06 June 2019 10:21 AM To: devel@edk2.groups.io Cc: Sami Mujawar <sami.muja...@arm.com>; Alexei Fedorov <alexei.fedo...@arm.com>; Matteo Carlini <matteo.carl...@arm.com>; Stephanie Hughes-Fitt <stephanie.hughes-f...@arm.com>; Pierre Gondois <pierre.gond...@arm.com>; nd <n...@arm.com> Subject: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3 From: Pierre Gondois <pierre.gond...@arm.com> The ACPI 6.3 specification adds support for describing ARMv8.1 EL2 virtual timers. Update GTDTGenerator to extend this support. Signed-off-by: Pierre Gondois <pierre.gond...@arm.com> --- The changes can be seen at: https://github.com/PierreARM/edk2/tree/381_dynamicTables_gtdt_acpi6_3_update_v1 Notes: v1: - Add support for describing ARMv8.1 EL2 virtual timers and update GTDTGenerator to extend this support. [Pierre] DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 6 ++ DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 69 +++++++++++--------- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h index bf70dc76cea044b9a8e8eb529d2ddbf892bafd58..0b00c8669729138e910d1fa09870f12dbc2a02a6 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -290,6 +290,12 @@ typedef struct CmArmGenericTimerInfo { /// The non-secure PL2 timer flags UINT32 NonSecurePL2TimerFlags; + + /// GSIV for the virtual EL2 timer + UINT32 VirtualPL2TimerGSIV; + + /// Flags for the virtual EL2 timer + UINT32 VirtualPL2TimerFlags; } CM_ARM_GENERIC_TIMER_INFO; /** A structure that describes the diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c index 8d9ddcf9244b9f8b795edf7a53dd8a071bb121bc..adc91c073efcac8e06997658b20096ae0b7d7b86 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c @@ -5,7 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 + - ACPI 6.3 Specification - January 2019 **/ @@ -77,7 +77,7 @@ GET_OBJECT_LIST ( Protocol Interface. @param [in] Gtdt Pointer to the GTDT Table. @param [in] PlatformTimerCount Platform timer count. - + @param [in] AcpiTableRevision Acpi Revision targeted by the platform. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND The required object was not found. @@ -90,8 +90,9 @@ EFI_STATUS EFIAPI AddGenericTimerInfo ( IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, - IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, - IN CONST UINT32 PlatformTimerCount + IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, + IN CONST UINT32 PlatformTimerCount, + IN CONST UINT32 AcpiTableRevision ) { EFI_STATUS Status; @@ -131,9 +132,14 @@ AddGenericTimerInfo ( GenericTimerInfo->CounterReadBaseAddress; Gtdt->PlatformTimerCount = PlatformTimerCount; Gtdt->PlatformTimerOffset = (PlatformTimerCount == 0) ? 0 : - sizeof (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE); + sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE); - return EFI_SUCCESS; + if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) { + Gtdt->VirtualPL2TimerGSIV = GenericTimerInfo->VirtualPL2TimerGSIV; + Gtdt->VirtualPL2TimerFlags = + GenericTimerInfo->VirtualPL2TimerFlags; + } + + return Status; } /** Add the SBSA Generic Watchdog Timers to the GTDT table. @@ -147,26 +153,26 @@ AddGenericTimerInfo ( STATIC VOID AddGenericWatchdogList ( - IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, + IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN CONST UINT32 WatchdogOffset, IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList, IN UINT32 WatchdogCount ) { - EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog; + EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog; ASSERT (Gtdt != NULL); ASSERT (WatchdogInfoList != NULL); - Watchdog = (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *) + Watchdog = (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *) ((UINT8*)Gtdt + WatchdogOffset); while (WatchdogCount-- != 0) { // Add watchdog entry DEBUG ((DEBUG_INFO, "GTDT: Watchdog = 0x%p\n", Watchdog)); - Watchdog->Type = EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG; + Watchdog->Type = EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG; Watchdog->Length = - sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE); + sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE); Watchdog->Reserved = EFI_ACPI_RESERVED_BYTE; Watchdog->RefreshFramePhysicalAddress = WatchdogInfoList->RefreshFrameAddress; @@ -193,7 +199,7 @@ AddGenericWatchdogList ( STATIC EFI_STATUS AddGTBlockTimerFrames ( - IN EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame, + IN EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame, IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList, IN UINT32 GTBlockFrameCount ) @@ -261,22 +267,22 @@ STATIC EFI_STATUS AddGTBlockList ( IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, - IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, + IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN CONST UINT32 GTBlockOffset, IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo, IN UINT32 BlockTimerCount ) { EFI_STATUS Status; - EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE * GTBlock; - EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame; + EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE * GTBlock; + EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame; CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList; UINT32 GTBlockTimerFrameCount; ASSERT (Gtdt != NULL); ASSERT (GTBlockInfo != NULL); - GTBlock = (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt + + GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt + GTBlockOffset); while (BlockTimerCount-- != 0) { @@ -298,18 +304,18 @@ AddGTBlockList ( return Status; } - GTBlock->Type = EFI_ACPI_6_2_GTDT_GT_BLOCK; - GTBlock->Length = sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE) + - (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE) * + GTBlock->Type = EFI_ACPI_6_3_GTDT_GT_BLOCK; + GTBlock->Length = sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) + + (sizeof + (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) * GTBlockInfo->GTBlockTimerFrameCount); GTBlock->Reserved = EFI_ACPI_RESERVED_BYTE; GTBlock->CntCtlBase = GTBlockInfo->GTBlockPhysicalAddress; GTBlock->GTBlockTimerCount = GTBlockInfo->GTBlockTimerFrameCount; GTBlock->GTBlockTimerOffset = - sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE); + sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE); - GtBlockFrame = (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE*) + GtBlockFrame = (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE*) ((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset); // Add GT Block Timer frames @@ -328,7 +334,7 @@ AddGTBlockList ( } // Next GTBlock - GTBlock = (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock + + GTBlock = (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock + + GTBlock->Length); GTBlockInfo++; }// for @@ -375,7 +381,7 @@ BuildGtdtTable ( UINT32 BlockTimerCount; CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList; CM_ARM_GTBLOCK_INFO * GTBlockInfo; - EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt; + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt; UINT32 Idx; UINT32 GTBlockOffset; UINT32 WatchdogOffset; @@ -442,11 +448,11 @@ BuildGtdtTable ( // Calculate the GTDT Table Size PlatformTimerCount = 0; - TableSize = sizeof (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE); + TableSize = sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE); if (BlockTimerCount != 0) { GTBlockOffset = TableSize; PlatformTimerCount += BlockTimerCount; - TableSize += (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE) * + TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) * BlockTimerCount); for (Idx = 0; Idx < BlockTimerCount; Idx++) { @@ -461,7 +467,7 @@ BuildGtdtTable ( )); goto error_handler; } - TableSize += (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE) * + TableSize += (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) + * GTBlockInfo[Idx].GTBlockTimerFrameCount); } @@ -477,7 +483,7 @@ BuildGtdtTable ( if (WatchdogCount != 0) { WatchdogOffset = TableSize; PlatformTimerCount += WatchdogCount; - TableSize += (sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) * + TableSize += (sizeof + (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) * WatchdogCount); DEBUG (( DEBUG_INFO, @@ -500,7 +506,7 @@ BuildGtdtTable ( goto error_handler; } - Gtdt = (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table; + Gtdt = (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table; DEBUG (( DEBUG_INFO, "GTDT: Gtdt = 0x%p TableSize = 0x%x\n", @@ -527,7 +533,8 @@ BuildGtdtTable ( Status = AddGenericTimerInfo ( CfgMgrProtocol, Gtdt, - PlatformTimerCount + PlatformTimerCount, + AcpiTableInfo->AcpiTableRevision ); if (EFI_ERROR (Status)) { DEBUG (( @@ -626,9 +633,9 @@ ACPI_TABLE_GENERATOR GtdtGenerator = { // Generator Description L"ACPI.STD.GTDT.GENERATOR", // ACPI Table Signature - EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, // ACPI Table Revision supported by this Generator - EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, // Minimum ACPI Table Revision supported by this Generator EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, // Creator ID -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42202): https://edk2.groups.io/g/devel/message/42202 Mute This Topic: https://groups.io/mt/31949890/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-