From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=v+X26A0u; spf=pass (domain: arm.com, ip: 40.107.3.68, mailfrom: pierre.gondois@arm.com) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.68]) by groups.io with SMTP; Thu, 06 Jun 2019 02:21:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pSjy/FmuT6x/ysJ+LNjix9qAQPtP51IkRcvpDNNjij0=; b=v+X26A0u7W/L5lepqjt589+afFYeN+wQJ6i0XSqsQEPFYLmdZRxDiY3oqyIGfO8mIAEPaYuV3mB7G1mKBJztOKMQbHvg+D6so7Mwus4md3ZNnMumXLFspOlOjmBm51YR7eetGAqhNXjQwEoKsky6gx7qIr/EUExjEL9bp3G1DN0= Received: from VI1PR08CA0203.eurprd08.prod.outlook.com (2603:10a6:800:d2::33) by DB7PR08MB4604.eurprd08.prod.outlook.com (2603:10a6:10:34::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1943.22; Thu, 6 Jun 2019 09:21:08 +0000 Received: from AM5EUR03FT055.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::208) by VI1PR08CA0203.outlook.office365.com (2603:10a6:800:d2::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.14 via Frontend Transport; Thu, 6 Jun 2019 09:21:08 +0000 Authentication-Results: spf=temperror (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT055.mail.protection.outlook.com (10.152.17.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.1965.12 via Frontend Transport; Thu, 6 Jun 2019 09:21:07 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Thu, 6 Jun 2019 09:21:03 +0000 Received: from E119881.Arm.com (10.2.134.77) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 6 Jun 2019 09:21:03 +0000 From: pierre.gondois@arm.com To: CC: , , , , , Subject: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3 Date: Thu, 6 Jun 2019 10:20:57 +0100 Message-ID: <20190606092057.28676-1-pierre.gondois@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 Return-Path: Pierre.Gondois@arm.com MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:40.67.248.234;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(376002)(39860400002)(346002)(396003)(2980300002)(199004)(189003)(476003)(2616005)(8676002)(81156014)(126002)(68736007)(54906003)(6306002)(47776003)(486006)(426003)(63350400001)(336012)(2906002)(50226002)(8936002)(63370400001)(305945005)(86362001)(15650500001)(6916009)(81166006)(77096007)(70206006)(36756003)(26005)(316002)(16586007)(5660300002)(53936002)(4326008)(478600001)(356004)(6666004)(2351001)(72206003)(48376002)(966005)(53416004)(50466002)(1076003)(70586007)(186003)(14444005)(7696005)(51416003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB4604;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae7ef37b-f3cc-4482-84ba-08d6ea604e53 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:DB7PR08MB4604; X-MS-TrafficTypeDiagnostic: DB7PR08MB4604: X-MS-Exchange-PUrlCount: 1 NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 00603B7EEF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: G1yR2mUTQOq5nylY8MxJO0wltTnIP2rdqpyAKC4Idagj7Rtlspd8d6Ng8qNtWRrt5nCaFWAFW0CNRXhpf04Gts8ehXNaPHtpbiBVmrwieCEJElsHO4NtZJEPZbuBn/0T/xtNIXIb8jyvE3A0UW9ubAonyldBZjC25KhKgjcgAJeO9WHrTMOtcg7TCp0WfXlHhcxtwZF+61PxoDoTeWQHe7pdb4cuCDBDbdVxV54N3fdXTtlUfByf8etgDItmt5hTvN4vY9ceiQmxoyNbZrN4/uS0oMEhvioRyij0iU8GDnqzeiiqxAvgNCCTzvkFrl+uolVZwxTswR+YLUr7bjWGjBVaBK+n258/fdgej3aQoIKOZcyH6lY+MNUjKB5PsfJTKMgcnC1x9ZOuD0fw0iipK2iGOyjjMGYZqhJ0NJUqwMo= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2019 09:21:07.0919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae7ef37b-f3cc-4482-84ba-08d6ea604e53 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4604 Content-Type: text/plain From: Pierre Gondois 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 --- 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)'