From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.96.67]) by mx.groups.io with SMTP id smtpd.web09.8991.1662563731035541897 for ; Wed, 07 Sep 2022 08:15:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=JiaqJikE; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.96.67, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PQTV2dhldBDyjhKXhazV5/r+21xaN4iL7hGcp8Hnm5Wcq4wSYwBEhwgxaiy0uxYiCMnV0FdMgF3atCopLu6TFxb10DjS7tcFa1DPMEsLTiQ+5RjA7dcyG2tbDWb/vHC5reF9lvlBkGCWCHIqrZ9Mx/v/nwAIpGdJPOPbdzJU5Df7c/nTsNC+MBqDF6sjhXqAQ2rU4HpiFHYBbah3xVn7wsmlLLQfZ8n6bRFtxQ8BCpqST2b/kYk4wbQzwn9zD1whF0o5N4G5tdw72H6RtizDMO0UfcybqKxX9G8dx2TK3PfYGETrt1jP9bs3tZGqfURWoOriXEKX4ea73fkNscDesA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DQhSrPt0vyZAvXKR2TuWO9+uVAl8MNaAuMc4UbKgL4M=; b=aS2kK3zDrwA4ht7uNywDPetpRGQr3HFGKZGaSulYK27obUi7mgIatcWikVgQ7dg6Fib67EyI6KkpYuIGR7pZzJ+m6cI1WAGfBj3VBGbxvx+UyfK4xwJwqFSShb3Ju3VMwyzbpYYLyyh7aHg8Yrp7ZZKmvYeOyE7Y/ObF2BNpoBFY7aZUXncL7VSnWNK58NS85lgE/Jgzr/c2WWFX5Dql7SFNcV0++7NdL5OxuAzsplZQ/moBfAYY7CyyvEP8+OihX101JOqypf3r1fKYMIEcJ6Jdb+XirUVY3GdmustpSlopxqLxmBcO8tGLLJCer+SuUJF+WmfksnVk99RCPWsVpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DQhSrPt0vyZAvXKR2TuWO9+uVAl8MNaAuMc4UbKgL4M=; b=JiaqJikE2LnrSfwNVHoP/jGL0u8gr0fBLysEbCTl68pNj5ISGub0whxor6tKtlMAmmkKPeHJQ1Dwri+ual5D9hbj00TY5yEuZTIjXrti7mWrLp4gctQZyu0jl6jj67JvcMpH5gG/Ko/uHgjQWxHrui9C6AqvihhgQjxSUvfvbprBhXZYElny0UlQ+mne0v79xeVWD/ND+xdd0jOFJewVIRM2wm8CtPLLey0uzsVNuaZMQgdJxiiG/3CBPNvX8wzVq4g1sUeiBvyJhYVdW3rHKUilMkNzcPxXQBn++Wof4f1ob3EQf8SXbuG4Zdxb750CEYtMX9otdRnv/E0kH7VJUQ== Received: from MW4PR03CA0107.namprd03.prod.outlook.com (2603:10b6:303:b7::22) by DM6PR12MB4220.namprd12.prod.outlook.com (2603:10b6:5:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.16; Wed, 7 Sep 2022 15:15:28 +0000 Received: from CO1NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::71) by MW4PR03CA0107.outlook.office365.com (2603:10b6:303:b7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12 via Frontend Transport; Wed, 7 Sep 2022 15:15:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT113.mail.protection.outlook.com (10.13.174.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5612.13 via Frontend Transport; Wed, 7 Sep 2022 15:15:27 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Wed, 7 Sep 2022 15:15:27 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 7 Sep 2022 08:15:26 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Wed, 7 Sep 2022 08:15:26 -0700 From: "Jeff Brasen" To: CC: , , , Jeff Brasen Subject: [PATCH 3/3] DynamicTablesPkg: SSDT CPU _CPC generator Date: Wed, 7 Sep 2022 09:15:19 -0600 Message-ID: <6bca55eda775212fa16aa8a45e82bb981f1ee8df.1662563529.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT113:EE_|DM6PR12MB4220:EE_ X-MS-Office365-Filtering-Correlation-Id: fad78639-986f-47bb-b468-08da90e3cbe1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XvO/PH1Q4On0XEqlCOUmyvanVqyx50pOnqI7Z2kEqMt1aXtehiBq8w0JuOO1z3ZlZDIvMA4g4wgxVbLIZEhqxHCGGgDyitOw0jzJY7JybBK+BFFd4Z4VU6Y0Teb2Hugc6shqJN9vPPJslKvNfPHUeKvM0DKp5z3iVUAS+U4ENCYBm8OfikaljGClAmYiuTbGk4BsnVRDoNIyEDRwSUpqqEkqiIkdG1JZuMW3gQJWFrESkQU/dJRZoYU7ZkszoIE/gR8p/2PLO5S0ZBF8cqiy1HF6cFpggEQtob7SVH0W8561uwJgEO4ew+j/bhTOBM1QFD5GNRBoWz2noGUr2lmetw1zoDWmWa/oCjW3ujfp0Ot5qbIw7mQf7URLIAfEiODh6xZbLUKmyrO2iTBl04wXtTx9XAo/CGFFdYGKf6DohZcP+lidNgJK93KcCJB+pBxZ+50kQ9M3B2Zi6fRdbfXlk62AqIeS4WWbb/0Uo0DgM7vDe6R99M0WqXk1mCgyQDv+/BM6EiTxkZV8IUv9uExRBsSbsYoFEbzzucjGuj6UnXKf++CStYNrvajPYVaEQqSWxkaF5K/P0XJWk/8+p9NfKCoKkvdK2rA1HPWalHXT8vtddGxeN48jl6tcTLmpunUFm1E48vMnuCOeDYRMB8QjHJQE+d70J4lCsLdA3uaqtsay+uOxckdUsjjDZ1GLAzTWfLPEtvlA4Mc5hFj7AOI5eT8m+nRChrN1uGfMa2ONOUxF2tJwbTaZj6aisFR+ogdx0DpggQl4zUM/8fkd0dlIsSoAykN2PFMzLcqVSWaxk15OMKppdFhbWvudOUmm8tb89IZA+cbRjPMY+d+6sGimoQ== X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(136003)(376002)(39860400002)(40470700004)(36840700001)(46966006)(316002)(6916009)(70206006)(70586007)(54906003)(2906002)(478600001)(36756003)(356005)(86362001)(82740400003)(81166007)(2616005)(107886003)(47076005)(4326008)(36860700001)(336012)(41300700001)(6666004)(26005)(426003)(186003)(82310400005)(8676002)(5660300002)(40480700001)(40460700003)(8936002)(83380400001)(36900700001)(44824005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 15:15:27.7795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fad78639-986f-47bb-b468-08da90e3cbe1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4220 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add code to use a token attached to GICC to generate _CPC object on cpus.=0D =0D Signed-off-by: Jeff Brasen =0D ---=0D .../SsdtCpuTopologyGenerator.c | 211 +++++++++++++++++-=0D 1 file changed, 206 insertions(+), 5 deletions(-)=0D =0D diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTop= ologyLibArm/SsdtCpuTopologyGenerator.c=0D index 8561f48e1f..ba1f1bd436 100644=0D --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c=0D +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c=0D @@ -76,6 +76,16 @@ GET_OBJECT_LIST (=0D CM_ARM_LPI_INFO=0D );=0D =0D +/**=0D + This macro expands to a function that retrieves the CPC=0D + information from the Configuration Manager.=0D +*/=0D +GET_OBJECT_LIST (=0D + EObjNameSpaceArm,=0D + EArmObjCpcInfo,=0D + CM_ARM_CPC_INFO=0D + );=0D +=0D /** Initialize the TokenTable.=0D =0D One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO=0D @@ -229,6 +239,182 @@ WriteAslName (=0D return EFI_SUCCESS;=0D }=0D =0D +/** Utility function to check if generic address points to NULL=0D +=0D + @param [in] Address Pointer to the Generic address=0D +=0D + @retval TRUE Address is system memory with an Address of 0.=0D + @retval FALSE Address does not point to NULL.=0D +**/=0D +STATIC=0D +BOOLEAN=0D +EFIAPI=0D +IsNullGenericAddress (=0D + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *Address=0D + )=0D +{=0D + if ((Address =3D=3D NULL) ||=0D + ((Address->AddressSpaceId =3D=3D EFI_ACPI_6_3_SYSTEM_MEMORY) &&=0D + (Address->Address =3D=3D 0x0)))=0D + {=0D + return TRUE;=0D + }=0D +=0D + return FALSE;=0D +}=0D +=0D +/** Create and add an _CPC Node to Cpu Node.=0D +=0D + For instance, transform an AML node from:=0D + Device (C002)=0D + {=0D + Name (_UID, 2)=0D + Name (_HID, "ACPI0007")=0D + }=0D +=0D + To:=0D + Device (C002)=0D + {=0D + Name (_UID, 2)=0D + Name (_HID, "ACPI0007")=0D + Name(_CPC, Package()=0D + {=0D + NumEntries, // Integer=0D + Revision, // Integer=0D + HighestPerformance, // Integer or Buffer (Res= ource Descriptor)=0D + NominalPerformance, // Integer or Buffer (Res= ource Descriptor)=0D + LowestNonlinearPerformance, // Integer or Buffer (Res= ource Descriptor)=0D + LowestPerformance, // Integer or Buffer (Res= ource Descriptor)=0D + GuaranteedPerformanceRegister, // Buffer (Resource Descr= iptor)=0D + DesiredPerformanceRegister , // Buffer (Resource Descr= iptor)=0D + MinimumPerformanceRegister , // Buffer (Resource Descr= iptor)=0D + MaximumPerformanceRegister , // Buffer (Resource Descr= iptor)=0D + PerformanceReductionToleranceRegister, // Buffer (Resource Descr= iptor)=0D + TimeWindowRegister, // Buffer (Resource Descr= iptor)=0D + CounterWraparoundTime, // Integer or Buffer (Res= ource Descriptor)=0D + ReferencePerformanceCounterRegister, // Buffer (Resource Descr= iptor)=0D + DeliveredPerformanceCounterRegister, // Buffer (Resource Descr= iptor)=0D + PerformanceLimitedRegister, // Buffer (Resource Descr= iptor)=0D + CPPCEnableRegister // Buffer (Resource Descr= iptor)=0D + AutonomousSelectionEnable, // Integer or Buffer (Res= ource Descriptor)=0D + AutonomousActivityWindowRegister, // Buffer (Resource Descr= iptor)=0D + EnergyPerformancePreferenceRegister, // Buffer (Resource Descr= iptor)=0D + ReferencePerformance // Integer or Buffer (Res= ource Descriptor)=0D + LowestFrequency, // Integer or Buffer (Res= ource Descriptor)=0D + NominalFrequency // Integer or Buffer (Res= ource Descriptor)=0D + })=0D + }=0D +=0D + @param [in] Generator The SSDT Cpu Topology generator.=0D + @param [in] CfgMgrProtocol Pointer to the Configuration Manager= =0D + Protocol Interface.=0D + @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO describin= g=0D + the Cpu.=0D + @param [in] Node CPU Node to which the _CPC node is=0D + attached.=0D +=0D + @retval EFI_SUCCESS The function completed successfully.=0D + @retval EFI_INVALID_PARAMETER Invalid parameter.=0D + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.=0D +**/=0D +STATIC=0D +EFI_STATUS=0D +EFIAPI=0D +CreateAmlCpcNode (=0D + IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,=0D + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,= =0D + IN CM_ARM_GICC_INFO *GicCInfo,=0D + IN AML_OBJECT_NODE_HANDLE *Node=0D + )=0D +{=0D + EFI_STATUS Status;=0D + CM_ARM_CPC_INFO *CpcInfo;=0D +=0D + Status =3D GetEArmObjCpcInfo (=0D + CfgMgrProtocol,=0D + GicCInfo->CpcToken,=0D + &CpcInfo,=0D + NULL=0D + );=0D + if (EFI_ERROR (Status)) {=0D + ASSERT (0);=0D + return Status;=0D + }=0D +=0D + Status =3D AmlCreateCpcNode (=0D + IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) ?=0D + NULL :=0D + &CpcInfo->HighestPerformanceBuffer,=0D + CpcInfo->HighestPerformanceInteger,=0D + IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) ?=0D + NULL :=0D + &CpcInfo->NominalPerformanceBuffer,=0D + CpcInfo->NominalPerformanceInteger,=0D + IsNullGenericAddress (&CpcInfo->LowestNonlinearPerformanceBuf= fer) ?=0D + NULL :=0D + &CpcInfo->LowestNonlinearPerformanceBuffer,=0D + CpcInfo->LowestNonlinearPerformanceInteger,=0D + IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) ?=0D + NULL :=0D + &CpcInfo->LowestPerformanceBuffer,=0D + CpcInfo->LowestPerformanceInteger,=0D + IsNullGenericAddress (&CpcInfo->GuaranteedPerformanceRegister= ) ?=0D + NULL :=0D + &CpcInfo->GuaranteedPerformanceRegister,=0D + IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) ?= =0D + NULL :=0D + &CpcInfo->DesiredPerformanceRegister,=0D + IsNullGenericAddress (&CpcInfo->MinimumPerformanceRegister) ?= =0D + NULL :=0D + &CpcInfo->MinimumPerformanceRegister,=0D + IsNullGenericAddress (&CpcInfo->MaximumPerformanceRegister) ?= =0D + NULL :=0D + &CpcInfo->MaximumPerformanceRegister,=0D + IsNullGenericAddress (&CpcInfo->PerformanceReductionTolerance= Register) ?=0D + NULL :=0D + &CpcInfo->PerformanceReductionToleranceRegister,=0D + IsNullGenericAddress (&CpcInfo->TimeWindowRegister) ?=0D + NULL :=0D + &CpcInfo->TimeWindowRegister,=0D + IsNullGenericAddress (&CpcInfo->CounterWraparoundTimeBuffer) = ?=0D + NULL :=0D + &CpcInfo->CounterWraparoundTimeBuffer,=0D + CpcInfo->CounterWraparoundTimeInteger,=0D + &CpcInfo->ReferencePerformanceCounterRegister,=0D + &CpcInfo->DeliveredPerformanceCounterRegister,=0D + &CpcInfo->PerformanceLimitedRegister,=0D + IsNullGenericAddress (&CpcInfo->CPPCEnableRegister) ?=0D + NULL :=0D + &CpcInfo->CPPCEnableRegister,=0D + IsNullGenericAddress (&CpcInfo->AutonomousSelectionEnableBuff= er) ?=0D + NULL :=0D + &CpcInfo->AutonomousSelectionEnableBuffer,=0D + CpcInfo->AutonomousSelectionEnableInteger,=0D + IsNullGenericAddress (&CpcInfo->AutonomousActivityWindowRegis= ter) ?=0D + NULL :=0D + &CpcInfo->AutonomousActivityWindowRegister,=0D + IsNullGenericAddress (&CpcInfo->EnergyPerformancePreferenceRe= gister) ?=0D + NULL :=0D + &CpcInfo->EnergyPerformancePreferenceRegister,=0D + IsNullGenericAddress (&CpcInfo->ReferencePerformanceBuffer) ?= =0D + NULL :=0D + &CpcInfo->ReferencePerformanceBuffer,=0D + CpcInfo->ReferencePerformanceInteger,=0D + IsNullGenericAddress (&CpcInfo->LowestFrequencyBuffer) ?=0D + NULL :=0D + &CpcInfo->LowestFrequencyBuffer,=0D + CpcInfo->LowestFrequencyInteger,=0D + IsNullGenericAddress (&CpcInfo->NominalFrequencyBuffer) ?=0D + NULL :=0D + &CpcInfo->NominalFrequencyBuffer,=0D + CpcInfo->NominalFrequencyInteger,=0D + Node,=0D + NULL=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D + return Status;=0D +}=0D +=0D /** Create and add an _LPI method to Cpu/Cluster Node.=0D =0D For instance, transform an AML node from:=0D @@ -584,6 +770,13 @@ CreateAmlCpuFromProcHierarchy (=0D ASSERT_EFI_ERROR (Status);=0D }=0D =0D + // If a CPC info is associated with the=0D + // GicCinfo, create an _CPC method returning them.=0D + if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) {=0D + Status =3D CreateAmlCpcNode (Generator, CfgMgrProtocol, GicCInfo, CpuN= ode);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D return Status;=0D }=0D =0D @@ -934,10 +1127,11 @@ CreateTopologyFromGicC (=0D IN AML_OBJECT_NODE_HANDLE ScopeNode=0D )=0D {=0D - EFI_STATUS Status;=0D - CM_ARM_GICC_INFO *GicCInfo;=0D - UINT32 GicCInfoCount;=0D - UINT32 Index;=0D + EFI_STATUS Status;=0D + CM_ARM_GICC_INFO *GicCInfo;=0D + UINT32 GicCInfoCount;=0D + UINT32 Index;=0D + AML_OBJECT_NODE_HANDLE CpuNode;=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (CfgMgrProtocol !=3D NULL);=0D @@ -961,12 +1155,19 @@ CreateTopologyFromGicC (=0D ScopeNode,=0D &GicCInfo[Index],=0D Index,=0D - NULL=0D + &CpuNode=0D );=0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D break;=0D }=0D +=0D + // If a CPC info is associated with the=0D + // GicCinfo, create an _CPC method returning them.=0D + if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) {=0D + Status =3D CreateAmlCpcNode (Generator, CfgMgrProtocol, &GicCInfo[In= dex], CpuNode);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D } // for=0D =0D return Status;=0D -- =0D 2.25.1=0D =0D