From nobody Sun May 12 14:36:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93435+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662563731973643.6577128470485; Wed, 7 Sep 2022 08:15:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zivSYY1788612xFeW1ZnL0Wn; Wed, 07 Sep 2022 08:15:31 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.55]) by mx.groups.io with SMTP id smtpd.web09.8990.1662563730832967701 for ; Wed, 07 Sep 2022 08:15:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GGgpRO75B8Cgg0cIyxwYlSAFQN9eLIuYTC+ga1jThBzDEHfdE34s9eA/lYO/I/iv9pqxQSz6ISkWTSznvuFPsEWWrnHmy/sxFnD7XIhf7/AABYDA3OmnO6Ws49acDzjvleD4tGq7QgOU0vq8fyjDRBFjUOl/UDuVlIaJmRZU0FUyzfauQDHHfwIpubAJcZBDlLT6NQqzQMCJXUkaYkNwI5HnzVuxCI0ArGH0S2MT076Z0xGz88bn1v54NlQl2kWUvT3GmiD/GS9Oyin7PVF85al0p4DzFhV3fOpQiFALyAPZ4/26mXnZfe/iWNYvFPbdXBQKNTrFeCXRZkJI/0My1Q== 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=FiKbWUvEYb8/OuRXcvbx1OtDVY5ma6tfl/PTJBISik0=; b=I6bYhJDYoRvfIQYOo42IF5BrXWYKHJ4tIiVHwQUyeMI0prOK8KjDw7XA1Lsdl0m472CQvffSS7o2kszh/X+7e6Pz6FTpZHwpMlZc+YU9ndD+6q27gbKwegSH+dnriG9DnDR3/IxlOtmBoFC9U5Q5pEC6+6S0Loh0A5TuLxDFQFhXT9XSOUfGh4OJSKgn6lroNKp5WwTDDypz/sL54zQ1OcvRzl7Hq7nJiuDfyMR+Agzza+0hvdVSKJ5YRXZZhg9uPWbp88gpYX6Xj6N4gwQo3KkFtgjsy/Dsiq9OfxEHcA/OrDx+hQ5AOqfoHcs5I5YMrz01MycxqqFV4NGO25a47A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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 X-Received: from MW4PR03CA0247.namprd03.prod.outlook.com (2603:10b6:303:b4::12) by MW6PR12MB7069.namprd12.prod.outlook.com (2603:10b6:303:238::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.17; Wed, 7 Sep 2022 15:15:27 +0000 X-Received: from CO1NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b4:cafe::5) by MW4PR03CA0247.outlook.office365.com (2603:10b6:303:b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12 via Frontend Transport; Wed, 7 Sep 2022 15:15:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93435+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT048.mail.protection.outlook.com (10.13.175.148) 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 X-Received: from drhqmail202.nvidia.com (10.126.190.181) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Wed, 7 Sep 2022 15:15:26 +0000 X-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:25 -0700 X-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:25 -0700 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen Subject: [edk2-devel] [PATCH 1/3] DynamicTablesPkg: Add CM_ARM_CPC_INFO object Date: Wed, 7 Sep 2022 09:15:17 -0600 Message-ID: <99283b0ac5e1a9306e28afd2a76059803e2e7376.1662563529.git.jbrasen@nvidia.com> In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT048:EE_|MW6PR12MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: 71d55099-8b31-425c-d438-08da90e3cb77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: NNsuVsQ7kcm/LFfEuSXHh6hv7NNzLj8CtTPvJhnjq2UxdnpyNwgaZqTJeWhfF50VS1kQTAwuG7ux429cWnR98WEbuZU2Nn7HHCCQUIvJcixMwaNt41aUjvij5o7eynOfHgKYuCZosgEmNxaElRCYNWA3LTosQ0I8ebyJHV/6VoM+jqVUewgXaxjL33uiPp0be0KMxUKQB+TqjCaD4ibRDLTX70ujb/oh1blwDRPM2SGOVKNl70ZNgBvjaNvLg6f8qyB8KZCicbVXh2UR/Y8em7JnOleVzTWHPqiU+AOoPUk+GX8rdpufCLAQ04AIFN3yShVTRYwmBBZDcoilkJd5u9lZwF+yLY7JQtYFyvDeT5z30zWys18H7pr0Wmt6g3xyVs8cECAwA2irY9w743axkD/5DMk3rRpEjXdymomQyi+czP97gt+QvPoRkhTReEtPshzFVLolVnX5A0iM01+wKJ1mBf1kTxMRkJtp5r1/O/uSSkrGmprod36CGvS6buYLzOoGKfnm8vqsUtXcSVML8QoPEmvsN7ch3j63pNtNSUhZVRhTp2heglAj8Y9jsvpw0ULgdwlA1ixXemYyHmR6ctO04z+aRJAV783vd+xS4dcKJvQewN8FaGCdhoLnpEwUymLB5EMllcQa0K0ZHoZ+MDknjsROjYbk1W8ZKgdsAZtEDk9eRgh28Tw1DzYmTSh2AhYl7ZgWl/L11DGZ5hV2FYCIollr8GO1ywZbIoElxP9ikog8sX2wanNj1NVxz/jzJ2Iit5Io2bS/KLmkr3SOhsKBx2PSBaWrzIYGwexTtO/V42XUXfRJA71qE6OadyoS X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 15:15:27.1012 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71d55099-8b31-425c-d438-08da90e3cb77 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.234];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7069 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com X-Gm-Message-State: v6mwZHzcbfUTHuP5qYhw6nTvx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662563731; bh=whSkta0n//1Yu1MaZYvh+7Vhha4b1vWP8zpVcpNfomw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=osbEn82zaJqII+69b/MgaRaitWd5rYxo3B0qCeH+DyMStcW5ZBsIxApIZPSOBj7BM8p Mpf84UMjEmozGvHoednwPjGL+Rn4SdnijUVaxIeVlERRD0vRHxaNiP2d5y0G/U94IRDYg MGGcjmshbf/hMYdzKX/i3xE/Ilef0klJA6s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662563733540100002 Content-Type: text/plain; charset="utf-8" Introduce the CM_ARM_CPC_INFO CmObj in the ArmNameSpaceObjects. This allows to describe CPC information, as described in ACPI 6.4, s8.4.7.1 "_CPC (Continuous Performance Control)". Signed-off-by: Jeff Brasen --- .../Include/ArmNameSpaceObjects.h | 146 ++++++++++++++++-- .../ConfigurationManagerObjectParser.c | 79 ++++++++++ 2 files changed, 208 insertions(+), 17 deletions(-) diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index 102e0f96be..4d3f9ae534 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -63,6 +63,7 @@ typedef enum ArmObjectID { EArmObjPciInterruptMapInfo, ///< 39 - Pci Interrupt Map Info EArmObjRmr, ///< 40 - Reserved Memory Range Node EArmObjMemoryRangeDescriptor, ///< 41 - Memory Range Descriptor + EArmObjCpcInfo, ///< 42 - Continuous Performance Co= ntrol Info EArmObjMax } EARM_OBJECT_ID; =20 @@ -97,99 +98,105 @@ typedef struct CmArmPowerManagementProfileInfo { */ typedef struct CmArmGicCInfo { /// The GIC CPU Interface number. - UINT32 CPUInterfaceNumber; + UINT32 CPUInterfaceNumber; =20 /** The ACPI Processor UID. This must match the _UID of the CPU Device object information described in the DSDT/SSDT for the CPU. */ - UINT32 AcpiProcessorUid; + UINT32 AcpiProcessorUid; =20 /** The flags field as described by the GICC structure in the ACPI Specification. */ - UINT32 Flags; + UINT32 Flags; =20 /** The parking protocol version field as described by the GICC structure in the ACPI Specification. */ - UINT32 ParkingProtocolVersion; + UINT32 ParkingProtocolVersion; =20 /** The Performance Interrupt field as described by the GICC structure in the ACPI Specification. */ - UINT32 PerformanceInterruptGsiv; + UINT32 PerformanceInterruptGsiv; =20 /** The CPU Parked address field as described by the GICC structure in the ACPI Specification. */ - UINT64 ParkedAddress; + UINT64 ParkedAddress; =20 /** The base address for the GIC CPU Interface as described by the GICC structure in the ACPI Specification. */ - UINT64 PhysicalBaseAddress; + UINT64 PhysicalBaseAddress; =20 /** The base address for GICV interface as described by the GICC structure in the ACPI Specification. */ - UINT64 GICV; + UINT64 GICV; =20 /** The base address for GICH interface as described by the GICC structure in the ACPI Specification. */ - UINT64 GICH; + UINT64 GICH; =20 /** The GICV maintenance interrupt as described by the GICC structure in the ACPI Specification. */ - UINT32 VGICMaintenanceInterrupt; + UINT32 VGICMaintenanceInterrupt; =20 /** The base address for GICR interface as described by the GICC structure in the ACPI Specification. */ - UINT64 GICRBaseAddress; + UINT64 GICRBaseAddress; =20 /** The MPIDR for the CPU as described by the GICC structure in the ACPI Specification. */ - UINT64 MPIDR; + UINT64 MPIDR; =20 /** The Processor Power Efficiency class as described by the GICC structure in the ACPI Specification. */ - UINT8 ProcessorPowerEfficiencyClass; + UINT8 ProcessorPowerEfficiencyClass; =20 /** Statistical Profiling Extension buffer overflow GSIV. Zero if unsupported by this processor. This field was introduced in ACPI 6.3 (MADT revision 5) and is therefore ignored when generating MADT revision 4 or lower. */ - UINT16 SpeOverflowInterrupt; + UINT16 SpeOverflowInterrupt; =20 /** The proximity domain to which the logical processor belongs. This field is used to populate the GICC affinity structure in the SRAT table. */ - UINT32 ProximityDomain; + UINT32 ProximityDomain; =20 /** The clock domain to which the logical processor belongs. This field is used to populate the GICC affinity structure in the SRAT table. */ - UINT32 ClockDomain; + UINT32 ClockDomain; =20 /** The GICC Affinity flags field as described by the GICC Affinity stru= cture in the SRAT table. */ - UINT32 AffinityFlags; + UINT32 AffinityFlags; + + /** Optional field: Reference Token for the Cpc info of this processor. + Token identifying a CM_ARM_OBJ_REF structure, itself referencing + CM_ARM_CPC_INFO objects. + */ + CM_OBJECT_TOKEN CpcToken; } CM_ARM_GICC_INFO; =20 /** A structure that describes the @@ -1070,6 +1077,111 @@ typedef struct CmArmRmrDescriptor { UINT64 Length; } CM_ARM_MEMORY_RANGE_DESCRIPTOR; =20 +/** A structure that describes the Cpc information. + + Continuous Performance Control is described in DSDT/SSDT and associated + to cpus/clusters in the cpu topology. + + Unsupported Optional registers should be encoded with NULL resource + Register {(SystemMemory, 0, 0, 0, 0)} + + For values that support Integer or Buffer, integer will be used + if buffer is NULL resource. + If resource is not NULL then Integer must be 0 + + Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control) + + ID: EArmObjCpcInfo +*/ +typedef struct CmArmCpcInfo { + /// Indicates the highest level of performance the processor + /// is theoretically capable of achieving. + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE HighestPerformanceBuffer; + UINT32 HighestPerformanceInteger; + + /// Indicates the highest sustained performance level of the processor. + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE NominalPerformanceBuffer; + UINT32 NominalPerformanceInteger; + + /// Indicates the lowest performance level of the processor with non-lin= ear power savings. + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE LowestNonlinearPerformanceBuff= er; + UINT32 LowestNonlinearPerformanceInte= ger; + + /// Indicates the lowest performance level of the processor.. + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE LowestPerformanceBuffer; + UINT32 LowestPerformanceInteger; + + /// Guaranteed Performance Register Buffer. + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE GuaranteedPerformanceRegister; + + /// Desired Performance Register Buffer. + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE DesiredPerformanceRegister; + + /// Minimum Performance Register Buffer. + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE MinimumPerformanceRegister; + + /// Maximum Performance Register Buffer. + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE MaximumPerformanceRegister; + + /// Performance Reduction Tolerance Register. + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE PerformanceReductionToleranceR= egister; + + /// Time Window Register. + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE TimeWindowRegister; + + /// Counter Wraparound Time + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE CounterWraparoundTimeBuffer; + UINT32 CounterWraparoundTimeInteger; + + /// Reference Performance Counter Register + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ReferencePerformanceCounterReg= ister; + + /// Delivered Performance Counter Register + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE DeliveredPerformanceCounterReg= ister; + + /// Performance Limited Register + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE PerformanceLimitedRegister; + + /// CPPC EnableRegister + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE CPPCEnableRegister; + + /// Autonomous Selection Enable + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE AutonomousSelectionEnableBuffe= r; + UINT32 AutonomousSelectionEnableInteg= er; + + /// AutonomousActivity-WindowRegister + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE AutonomousActivityWindowRegist= er; + + /// EnergyPerformance-PreferenceRegister + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE EnergyPerformancePreferenceReg= ister; + + /// Reference Performance + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ReferencePerformanceBuffer; + UINT32 ReferencePerformanceInteger; + + /// Lowest Frequency + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE LowestFrequencyBuffer; + UINT32 LowestFrequencyInteger; + + /// Nominal Frequency + /// Optional + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE NominalFrequencyBuffer; + UINT32 NominalFrequencyInteger; +} CM_ARM_CPC_INFO; + #pragma pack() =20 #endif // ARM_NAMESPACE_OBJECTS_H_ diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationMa= nagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Config= urationManagerObjectParser.c index c1b21d24a4..e2c608443b 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c @@ -423,6 +423,83 @@ STATIC CONST CM_OBJ_PARSER CmPciInterruptMapInfoParse= r[] =3D { ARRAY_SIZE (CmArmGenericInterruptParser) }, }; =20 +/** A parser for EArmObjCpcInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmArmCpcInfoParser[] =3D { + { "HighestPerformanceBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "HighestPerformanceInteger", 4, = "0x%llx", NULL }, + { "NominalPerformanceBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "NominalPerformanceInteger", 4, = "0x%llx", NULL }, + { "LowestNonlinearPerformanceBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "LowestNonlinearPerformanceInteger", 4, = "0x%llx", NULL }, + { "LowestPerformanceBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "LowestPerformanceInteger", 4, = "0x%llx", NULL }, + { "GuaranteedPerformanceRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "DesiredPerformanceRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "MinimumPerformanceRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "MaximumPerformanceRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "PerformanceReductionToleranceRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "TimeWindowRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "CounterWraparoundTimeBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "CounterWraparoundTimeInteger", 4, = "0x%llx", NULL }, + { "ReferencePerformanceCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "DeliveredPerformanceCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "PerformanceLimitedRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "CPPCEnableRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "AutonomousSelectionEnableBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "AutonomousSelectionEnableInteger", 4, = "0x%llx", NULL }, + { "AutonomousActivityWindowRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "EnergyPerformancePreferenceRegister", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "ReferencePerformanceBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "ReferencePerformanceInteger", 4, = "0x%llx", NULL }, + { "LowestFrequencyBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "LowestFrequencyInteger", 4, = "0x%llx", NULL }, + { "NominalFrequencyBuffer", sizeof (EFI_ACPI_6_3_GENERIC_= ADDRESS_STRUCTURE), + NULL, NULL, AcpiGenericAddressParser, + ARRAY_SIZE (AcpiGenericAddressParser) }, + { "NominalFrequencyInteger", 4, = "0x%llx", NULL }, +}; + /** A parser for Arm namespace objects. */ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] =3D { @@ -501,6 +578,8 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectPar= ser[] =3D { ARRAY_SIZE (CmArmPciAddressMapInfoParser) }, { "EArmObjPciInterruptMapInfo", CmPciInterruptMapInfoParser, ARRAY_SIZE (CmPciInterruptMapInfoParser) }, + { "EArmObjCpcInfo", CmArmCpcInfoParser, + ARRAY_SIZE (CmArmCpcInfoParser) }, { "EArmObjMax", NULL, = 0 }, }; =20 --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93435): https://edk2.groups.io/g/devel/message/93435 Mute This Topic: https://groups.io/mt/93527133/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 12 14:36:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93437+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662563732809878.0089374764077; Wed, 7 Sep 2022 08:15:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id b1BqYY1788612xuRae1uth45; Wed, 07 Sep 2022 08:15:32 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.83]) by mx.groups.io with SMTP id smtpd.web10.8932.1662563731270131010 for ; Wed, 07 Sep 2022 08:15:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RjDYWS3yVTPczdEX0vBOwvGeXmI5eVsCt7lkebGF9u0LyKgUyhxyLwjEROr3ms//KnOW7SNSpFX+BGKbjI6u4ZR4CuufhvSZebjCUZ2Uz+vNnSkYJWrEnk1GvWWIzptN1rx5c+z9nuqNpZyiXhzzKMTpuP6WWzh5NMvsxqo2H1MUBcuW3Gducsr5z7RQdfLt8buGL2sHBT8xUmTPyVb4ZRda4O2T1PX3IVc+KrgX3dbop6HU/1QvHkgBFpg0/UZhYmdpemauGHzrJ4f95apFq0vul9hXKmt9MKO+XovZjIsL0u1GuaFr/8t2hvaHfuxThOhE2kOJGowpr8j7VcM8jQ== 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=pEFR6w+2xz8qyz1TpIiYk92g6tJhecy9IKOFw/Bv6uw=; b=oKgumQ+h2sP0VFLG4vjOQaxMmjgJ8BfHstOLOnn5U0dWTbAeHi7wJdTf3yAssx0S8UTT/Q2y/eU9puSeQJaisknwBxHlzyA3b7oAdNy1Sc3wKtotziWaSN3gbw0k+TJE5Jn6QF11gIqOtsh0jT+jrtrEZgNsTyKRlkEsY+eFTzat+Gh7oNLV6fouckleDY3WCAHoaidwGOVZQixx77+z2BrCzlxTZ5nJNSAa/9ubaglvwIInA3l0zYw1Bp11X07E8+AlVHuW2Vjua9o5rTfQxGTT4oHfLZ8gYeqG2vdq7zhtSwvkiKP9xe1lCAVmHjTKCWtiIutLEIxzvZTLozTESQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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 X-Received: from DS7PR03CA0067.namprd03.prod.outlook.com (2603:10b6:5:3bb::12) by SJ1PR12MB6170.namprd12.prod.outlook.com (2603:10b6:a03:45b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.18; Wed, 7 Sep 2022 15:15:27 +0000 X-Received: from DM6NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::a9) by DS7PR03CA0067.outlook.office365.com (2603:10b6:5:3bb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14 via Frontend Transport; Wed, 7 Sep 2022 15:15:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93437+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT036.mail.protection.outlook.com (10.13.172.64) 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 X-Received: from drhqmail202.nvidia.com (10.126.190.181) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Wed, 7 Sep 2022 15:15:26 +0000 X-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 X-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 via groups.io" To: CC: , , , Jeff Brasen Subject: [edk2-devel] [PATCH 2/3] DynamicTablesPkg: AML Code generation to add _CPC entries Date: Wed, 7 Sep 2022 09:15:18 -0600 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT036:EE_|SJ1PR12MB6170:EE_ X-MS-Office365-Filtering-Correlation-Id: cc220bbf-49a0-4f43-7254-08da90e3cb86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: niyo1ljKvMQZyewaI1ZMyeX3E7HxVTxmpxan+mP3SVms1vDVaKUgJCYkg3OuRfznlR+4Wi7wWrLLZxN0HhaoY0ARpb/B5oHI8FDk2O2BvTZrlQcu7VH4+VDMXzSCvv/FJMklVd8566JZb2I1E+dx74GoT1r5s61HwhfYvc53ix/tLCFFZL5ujspxSt6rHRVexN2l8p37fpzA+f2E71s14+LiZc/oRVTIBDWYKfDTgNOmvLhtSqlynBfesACUOQrKxus/KlfJmrHgs/gKD50QyF5vdOGXiJxxBuVot6H691qN0++y/vctEB6umxSz59pk/YVncV5GKkI28e8LoGqoW7PvOq4lyuK+D2JZ3CuKVcmZsmr0T/9KNyQsu36E2TlMaUUqsMnamTB6y032I0/+CptZXS3lTHXcsV+RUVywMZ4okeNF7SP2OUjhEjkbjUIrEDGpFop6g6VJ/FY++VewMqE2IOi/5Hp1RO2x6g1QuVALV36X8I0juHXl9MaKuwweOntLqssW9jqYpGKkghVTHweU4n0qDWytjPe9FDJaQDrGOJKxYO9pRRBofwgXjOnp7IBxmOYd8VHiw6jEJDArwlnED5e7zmitkGq801r/u9chQHKU/KZgdEaV7MDDC65qrVc/C8pRXlKG7mV0QgmtgMdO1WQorYLgOrBOo4LIiDaW3MrpdH4sB/Vtq4QVMynuX72BpA3hyETrYL6+FgjCERT1cfvqxv9k30esethyzMIaohAKxw1QGHn/6E4N7Jjv9aolhXZA58gQ99m4OP5SfnsGKekbEcsd9+DmuhERu86Rlcg5vq+s93My36MutS4X X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 15:15:27.1189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc220bbf-49a0-4f43-7254-08da90e3cb86 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.236];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6170 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com X-Gm-Message-State: gAiLZtmhkx4w68KiCKx2ZFUnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662563732; bh=lY4seG/c8D4S+gWSSBnzeL6OPhAY1BogECpn2wppgt4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=TlvNI8mIFiSqcJzRRYKtUhYTmeSX3bDEP60EE/EIaYFYkNWzUAsXAufs0rwGzIoofgU o0Ij/Cx2rD7OFzTIqtkX6dtZBxRmnE6cxChIRBzoyhcAacQ2WV6lln3CN+FsdxKy3z3HD DKMD5ucIi2zV742QwKOpc2sxLGcJmCmBgvY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662563733552100003 Content-Type: text/plain; charset="utf-8" _CPC entries can describe CPU performance information. The object is described in ACPI 6.4 s8.4.7.1. "_CPC (Continuous Performance Control)". Add AmlCreateCpcNode() helper function to add _CPC entries to an existing CPU object. Signed-off-by: Jeff Brasen --- .../Include/Library/AmlLib/AmlLib.h | 155 +++++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 549 ++++++++++++++++++ 2 files changed, 704 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 39968660f2..65f6cd7583 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1336,6 +1336,161 @@ AmlAddNameIntegerPackage ( IN AML_OBJECT_NODE_HANDLE PackageNode ); =20 +/** Create a _CPC node. + + Creates and optionally adds the following node + Name(_CPC, Package() + { + NumEntries, // Integer + Revision, // Integer + HighestPerformance, // Integer or Buffer (Resourc= e Descriptor) + NominalPerformance, // Integer or Buffer (Resourc= e Descriptor) + LowestNonlinearPerformance, // Integer or Buffer (Resourc= e Descriptor) + LowestPerformance, // Integer or Buffer (Resourc= e Descriptor) + GuaranteedPerformanceRegister, // Buffer (Resource Descripto= r) + DesiredPerformanceRegister , // Buffer (Resource Descripto= r) + MinimumPerformanceRegister , // Buffer (Resource Descripto= r) + MaximumPerformanceRegister , // Buffer (Resource Descripto= r) + PerformanceReductionToleranceRegister, // Buffer (Resource Descripto= r) + TimeWindowRegister, // Buffer (Resource Descripto= r) + CounterWraparoundTime, // Integer or Buffer (Resourc= e Descriptor) + ReferencePerformanceCounterRegister, // Buffer (Resource Descripto= r) + DeliveredPerformanceCounterRegister, // Buffer (Resource Descripto= r) + PerformanceLimitedRegister, // Buffer (Resource Descripto= r) + CPPCEnableRegister // Buffer (Resource Descripto= r) + AutonomousSelectionEnable, // Integer or Buffer (Resourc= e Descriptor) + AutonomousActivityWindowRegister, // Buffer (Resource Descripto= r) + EnergyPerformancePreferenceRegister, // Buffer (Resource Descripto= r) + ReferencePerformance // Integer or Buffer (Resourc= e Descriptor) + LowestFrequency, // Integer or Buffer (Resourc= e Descriptor) + NominalFrequency // Integer or Buffer (Resourc= e Descriptor) + }) + + If resource buffer is NULL then integer will be used. + + Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control) + + @ingroup CodeGenApis + + @param [in] HighestPerformanceBuffer If provided, buffer = that indicates the highest level + of performance the p= rocessor. + @param [in] HighestPerformanceInteger Indicates the highes= t level of performance the processor, + used if buffer is NU= LL. + @param [in] NominalPerformanceBuffer If provided buffer t= hat indicates the highest sustained + performance level of= the processor. + @param [in] NominalPerformanceInteger Indicates the highes= t sustained performance level + of the processor, us= ed if buffer is NULL. + @param [in] LowestNonlinearPerformanceBuffer If provided, buffer = that indicates the lowest performance level + of the processor wit= h non-linear power savings. + @param [in] LowestNonlinearPerformanceInteger Indicates the lowest= performance level of the processor with + non-linear power sav= ings, used if buffer is NULL. + @param [in] LowestPerformanceBuffer If provided, buffer = that indicates the + lowest performance l= evel of the processor. + @param [in] LowestPerformanceInteger Indicates the lowest= performance level of the processor, + used if buffer is NU= LL. + @param [in] GuaranteedPerformanceRegister If provided, Guarant= eed Performance Register Buffer. + @param [in] DesiredPerformanceRegister If provided, Desired= Performance Register Buffer. + @param [in] MinimumPerformanceRegister If provided, Minimum= Performance Register Buffer. + @param [in] MaximumPerformanceRegister If provided, Maximum= Performance Register Buffer. + @param [in] PerformanceReductionToleranceRegister If provided, Perform= ance Reduction Tolerance Register. + @param [in] TimeWindowRegister If provided, Time Wi= ndow Register. + @param [in] CounterWraparoundTimeBuffer If provided, Counter= Wraparound Time buffer. + @param [in] CounterWraparoundTimeInteger Counter Wraparound T= ime, used if buffer is NULL. + @param [in] ReferencePerformanceCounterRegister Reference Performanc= e Counter Register. + @param [in] DeliveredPerformanceCounterRegister Delivered Performanc= e Counter Register. + @param [in] PerformanceLimitedRegister Performance Limited = Register. + @param [in] CPPCEnableRegister If provided, CPPC En= ableRegister. + @param [in] AutonomousSelectionEnableBuffer If provided, Autonom= ous Selection Enable buffer. + @param [in] AutonomousSelectionEnableInteger Autonomous Selection= Enable, used if buffer is NULL. + @param [in] AutonomousActivityWindowRegister If provided, Autonom= ousActivity-WindowRegister. + @param [in] EnergyPerformancePreferenceRegister If provided, EnergyP= erformance-PreferenceRegister. + @param [in] ReferencePerformanceBuffer If provided, Referen= ce Performance buffer. + @param [in] ReferencePerformanceInteger Reference Performanc= e, used if buffer is NULL. + @param [in] LowestFrequencyBuffer If provided, Lowest = Frequency buffer. + @param [in] LowestFrequencyInteger Lowest Frequency, us= ed if buffer is NULL. + @param [in] NominalFrequencyBuffer If provided, Nominal= FrequencyBuffer buffer. + @param [in] NominalFrequencyInteger NominalFrequencyBuff= er, used if buffer is NULL. + @param [in] ParentNode If provided, set Par= entNode as the parent + of the node created. + @param [out] NewCpcNode If success and provi= ded, contains the created node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCreateCpcNode ( + /// Indicates the highest level of performance the processor + /// is theoretically capable of achieving. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *HighestPerformanceBuffer OPT= IONAL, + IN UINT32 HighestPerformanceInteger, + /// Indicates the highest sustained performance level of the processor. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *NominalPerformanceBuffer OPT= IONAL, + IN UINT32 NominalPerformanceInteger, + /// Indicates the lowest performance level of the processor with non-lin= ear power savings. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *LowestNonlinearPerformanceBu= ffer OPTIONAL, + IN UINT32 LowestNonlinearPerformanceInt= eger, + /// Indicates the lowest performance level of the processor.. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *LowestPerformanceBuffer OPTI= ONAL, + IN UINT32 LowestPerformanceInteger, + /// Guaranteed Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GuaranteedPerformanceRegiste= r OPTIONAL, + /// Desired Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *DesiredPerformanceRegister O= PTIONAL, + /// Minimum Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *MinimumPerformanceRegister O= PTIONAL, + /// Maximum Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *MaximumPerformanceRegister O= PTIONAL, + /// Performance Reduction Tolerance Register. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *PerformanceReductionToleranc= eRegister OPTIONAL, + /// Time Window Register. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *TimeWindowRegister OPTIONAL, + /// Counter Wraparound Time + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *CounterWraparoundTimeBuffer = OPTIONAL, + IN UINT32 CounterWraparoundTimeInteger, + /// Reference Performance Counter Register + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceCounterR= egister, + /// Delivered Performance Counter Register + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *DeliveredPerformanceCounterR= egister, + /// Performance Limited Register + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *PerformanceLimitedRegister, + /// CPPC EnableRegister + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *CPPCEnableRegister OPTIONAL, + /// Autonomous Selection Enable + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *AutonomousSelectionEnableBuf= fer OPTIONAL, + IN UINT32 AutonomousSelectionEnableInte= ger, + /// AutonomousActivity-WindowRegister + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *AutonomousActivityWindowRegi= ster OPTIONAL, + /// EnergyPerformance-PreferenceRegister + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *EnergyPerformancePreferenceR= egister OPTIONAL, + /// Reference Performance + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceBuffer O= PTIONAL, + IN UINT32 ReferencePerformanceInteger, + /// Lowest Frequency + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *LowestFrequencyBuffer OPTION= AL, + IN UINT32 LowestFrequencyInteger, + /// Nominal Frequency + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *NominalFrequencyBuffer OPTIO= NAL, + IN UINT32 NominalFrequencyInteger, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL + ); + // DEPRECATED APIS #ifndef DISABLE_NEW_DEPRECATED_INTERFACES =20 diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 5fb39d077b..dfc3015baf 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -2850,3 +2850,552 @@ error_handler: =20 return Status; } + +/** Adds a register to the package + + @ingroup CodeGenApis + + @param [in] Register If provided, register that will be added to pa= ckage. + otherwise NULL register will be added + @param [in] PackageNode Package to add value to + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +AmlAddRegisterToPackage ( + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *Register OPTIONAL, + IN AML_OBJECT_NODE_HANDLE PackageNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE_HANDLE RdNode; + AML_OBJECT_NODE_HANDLE ResourceTemplateNode; + + RdNode =3D NULL; + ResourceTemplateNode =3D NULL; + + Status =3D AmlCodeGenResourceTemplate (&ResourceTemplateNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + if (Register !=3D NULL) { + Status =3D AmlCodeGenRdRegister ( + Register->AddressSpaceId, + Register->RegisterBitWidth, + Register->RegisterBitOffset, + Register->Address, + Register->AccessSize, + NULL, + &RdNode + ); + } else { + Status =3D AmlCodeGenRdRegister ( + EFI_ACPI_6_4_SYSTEM_MEMORY, + 0, + 0, + 0, + 0, + NULL, + &RdNode + ); + } + + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAppendRdNode (ResourceTemplateNode, RdNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + RdNode =3D NULL; + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)ResourceTemplateNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + ResourceTemplateNode =3D NULL; + + return Status; + +error_handler: + if (RdNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)RdNode); + } + + if (ResourceTemplateNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode); + } + + return Status; +} + +/** Adds an integer or register to the package + + @ingroup CodeGenApis + + @param [in] Register If provided, register that will be added to pa= ckage + @param [in] Integer If Register is NULL, integer that will be adde= d to the package + @param [in] PackageNode Package to add value to + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +AmlAddRegisterOrIntegerToPackage ( + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *Register OPTIONAL, + IN UINT32 Integer, + IN AML_OBJECT_NODE_HANDLE PackageNode + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE_HANDLE IntegerNode; + + IntegerNode =3D NULL; + + if (Register !=3D NULL) { + Status =3D AmlAddRegisterToPackage (Register, PackageNode); + } else { + Status =3D AmlCodeGenInteger (Integer, &IntegerNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)IntegerNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + IntegerNode =3D NULL; + } + + return Status; + +error_handler: + if (IntegerNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode); + } + + return Status; +} + +/** Create a _CPC node. + + Creates and optionally adds the following node + Name(_CPC, Package() + { + NumEntries, // Integer + Revision, // Integer + HighestPerformance, // Integer or Buffer (Resourc= e Descriptor) + NominalPerformance, // Integer or Buffer (Resourc= e Descriptor) + LowestNonlinearPerformance, // Integer or Buffer (Resourc= e Descriptor) + LowestPerformance, // Integer or Buffer (Resourc= e Descriptor) + GuaranteedPerformanceRegister, // Buffer (Resource Descripto= r) + DesiredPerformanceRegister , // Buffer (Resource Descripto= r) + MinimumPerformanceRegister , // Buffer (Resource Descripto= r) + MaximumPerformanceRegister , // Buffer (Resource Descripto= r) + PerformanceReductionToleranceRegister, // Buffer (Resource Descripto= r) + TimeWindowRegister, // Buffer (Resource Descripto= r) + CounterWraparoundTime, // Integer or Buffer (Resourc= e Descriptor) + ReferencePerformanceCounterRegister, // Buffer (Resource Descripto= r) + DeliveredPerformanceCounterRegister, // Buffer (Resource Descripto= r) + PerformanceLimitedRegister, // Buffer (Resource Descripto= r) + CPPCEnableRegister // Buffer (Resource Descripto= r) + AutonomousSelectionEnable, // Integer or Buffer (Resourc= e Descriptor) + AutonomousActivityWindowRegister, // Buffer (Resource Descripto= r) + EnergyPerformancePreferenceRegister, // Buffer (Resource Descripto= r) + ReferencePerformance // Integer or Buffer (Resourc= e Descriptor) + LowestFrequency, // Integer or Buffer (Resourc= e Descriptor) + NominalFrequency // Integer or Buffer (Resourc= e Descriptor) + }) + + If resource buffer is NULL then integer will be used. + + Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control) + + @ingroup CodeGenApis + + @param [in] HighestPerformanceBuffer If provided, buffer = that indicates the highest level + of performance the p= rocessor. + @param [in] HighestPerformanceInteger Indicates the highes= t level of performance the processor, + used if buffer is NU= LL. + @param [in] NominalPerformanceBuffer If provided buffer t= hat indicates the highest sustained + performance level of= the processor. + @param [in] NominalPerformanceInteger Indicates the highes= t sustained performance level + of the processor, us= ed if buffer is NULL. + @param [in] LowestNonlinearPerformanceBuffer If provided, buffer = that indicates the lowest performance level + of the processor wit= h non-linear power savings. + @param [in] LowestNonlinearPerformanceInteger Indicates the lowest= performance level of the processor with + non-linear power sav= ings, used if buffer is NULL. + @param [in] LowestPerformanceBuffer If provided, buffer = that indicates the + lowest performance l= evel of the processor. + @param [in] LowestPerformanceInteger Indicates the lowest= performance level of the processor, + used if buffer is NU= LL. + @param [in] GuaranteedPerformanceRegister If provided, Guarant= eed Performance Register Buffer. + @param [in] DesiredPerformanceRegister If provided, Desired= Performance Register Buffer. + @param [in] MinimumPerformanceRegister If provided, Minimum= Performance Register Buffer. + @param [in] MaximumPerformanceRegister If provided, Maximum= Performance Register Buffer. + @param [in] PerformanceReductionToleranceRegister If provided, Perform= ance Reduction Tolerance Register. + @param [in] TimeWindowRegister If provided, Time Wi= ndow Register. + @param [in] CounterWraparoundTimeBuffer If provided, Counter= Wraparound Time buffer. + @param [in] CounterWraparoundTimeInteger Counter Wraparound T= ime, used if buffer is NULL. + @param [in] ReferencePerformanceCounterRegister Reference Performanc= e Counter Register. + @param [in] DeliveredPerformanceCounterRegister Delivered Performanc= e Counter Register. + @param [in] PerformanceLimitedRegister Performance Limited = Register. + @param [in] CPPCEnableRegister If provided, CPPC En= ableRegister. + @param [in] AutonomousSelectionEnableBuffer If provided, Autonom= ous Selection Enable buffer. + @param [in] AutonomousSelectionEnableInteger Autonomous Selection= Enable, used if buffer is NULL. + @param [in] AutonomousActivityWindowRegister If provided, Autonom= ousActivity-WindowRegister. + @param [in] EnergyPerformancePreferenceRegister If provided, EnergyP= erformance-PreferenceRegister. + @param [in] ReferencePerformanceBuffer If provided, Referen= ce Performance buffer. + @param [in] ReferencePerformanceInteger Reference Performanc= e, used if buffer is NULL. + @param [in] LowestFrequencyBuffer If provided, Lowest = Frequency buffer. + @param [in] LowestFrequencyInteger Lowest Frequency, us= ed if buffer is NULL. + @param [in] NominalFrequencyBuffer If provided, Nominal= FrequencyBuffer buffer. + @param [in] NominalFrequencyInteger NominalFrequencyBuff= er, used if buffer is NULL. + @param [in] ParentNode If provided, set Par= entNode as the parent + of the node created. + @param [out] NewCpcNode If success and provi= ded, contains the created node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCreateCpcNode ( + /// Indicates the highest level of performance the processor + /// is theoretically capable of achieving. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *HighestPerformanceBuffer OPT= IONAL, + IN UINT32 HighestPerformanceInteger, + /// Indicates the highest sustained performance level of the processor. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *NominalPerformanceBuffer OPT= IONAL, + IN UINT32 NominalPerformanceInteger, + /// Indicates the lowest performance level of the processor with non-lin= ear power savings. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *LowestNonlinearPerformanceBu= ffer OPTIONAL, + IN UINT32 LowestNonlinearPerformanceInt= eger, + /// Indicates the lowest performance level of the processor.. + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *LowestPerformanceBuffer OPTI= ONAL, + IN UINT32 LowestPerformanceInteger, + /// Guaranteed Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GuaranteedPerformanceRegiste= r OPTIONAL, + /// Desired Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *DesiredPerformanceRegister O= PTIONAL, + /// Minimum Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *MinimumPerformanceRegister O= PTIONAL, + /// Maximum Performance Register Buffer. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *MaximumPerformanceRegister O= PTIONAL, + /// Performance Reduction Tolerance Register. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *PerformanceReductionToleranc= eRegister OPTIONAL, + /// Time Window Register. + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *TimeWindowRegister OPTIONAL, + /// Counter Wraparound Time + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *CounterWraparoundTimeBuffer = OPTIONAL, + IN UINT32 CounterWraparoundTimeInteger, + /// Reference Performance Counter Register + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceCounterR= egister, + /// Delivered Performance Counter Register + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *DeliveredPerformanceCounterR= egister, + /// Performance Limited Register + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *PerformanceLimitedRegister, + /// CPPC EnableRegister + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *CPPCEnableRegister OPTIONAL, + /// Autonomous Selection Enable + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *AutonomousSelectionEnableBuf= fer OPTIONAL, + IN UINT32 AutonomousSelectionEnableInte= ger, + /// AutonomousActivity-WindowRegister + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *AutonomousActivityWindowRegi= ster OPTIONAL, + /// EnergyPerformance-PreferenceRegister + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *EnergyPerformancePreferenceR= egister OPTIONAL, + /// Reference Performance + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceBuffer O= PTIONAL, + IN UINT32 ReferencePerformanceInteger, + /// Lowest Frequency + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *LowestFrequencyBuffer OPTION= AL, + IN UINT32 LowestFrequencyInteger, + /// Nominal Frequency + /// Optional + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *NominalFrequencyBuffer OPTIO= NAL, + IN UINT32 NominalFrequencyInteger, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE_HANDLE CpcNode; + AML_OBJECT_NODE_HANDLE CpcPackage; + + if ((ReferencePerformanceCounterRegister =3D=3D NULL) || + (PerformanceLimitedRegister =3D=3D NULL) || + ((ParentNode =3D=3D NULL) && (NewCpcNode =3D=3D NULL))) + { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + CpcNode =3D NULL; + CpcPackage =3D NULL; + + Status =3D AmlCodeGenNamePackage ("_CPC", NULL, &CpcNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + // Get the Package object node of the _CPC node, + // which is the 2nd fixed argument (i.e. index 1). + CpcPackage =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + CpcNode, + EAmlParseIndexTerm1 + ); + if ((CpcPackage =3D=3D NULL) = || + (AmlGetNodeType ((AML_NODE_HANDLE)CpcPackage) !=3D EAmlNodeObject) = || + (!AmlNodeHasOpCode (CpcPackage, AML_PACKAGE_OP, 0))) + { + ASSERT (0); + goto error_handler; + } + + // NumEntries 23 per ACPI 6.4 specification + Status =3D AmlAddRegisterOrIntegerToPackage ( + NULL, + 23, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + // Revision 3 per ACPI 6.4 specification + Status =3D AmlAddRegisterOrIntegerToPackage ( + NULL, + 3, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + HighestPerformanceBuffer, + HighestPerformanceInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + NominalPerformanceBuffer, + NominalPerformanceInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + LowestNonlinearPerformanceBuffer, + LowestNonlinearPerformanceInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + LowestPerformanceBuffer, + LowestPerformanceInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (GuaranteedPerformanceRegister, CpcPa= ckage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (DesiredPerformanceRegister, CpcPacka= ge); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (MinimumPerformanceRegister, CpcPacka= ge); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (MaximumPerformanceRegister, CpcPacka= ge); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (PerformanceReductionToleranceRegiste= r, CpcPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (TimeWindowRegister, CpcPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + CounterWraparoundTimeBuffer, + CounterWraparoundTimeInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (ReferencePerformanceCounterRegister,= CpcPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (DeliveredPerformanceCounterRegister,= CpcPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (PerformanceLimitedRegister, CpcPacka= ge); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (CPPCEnableRegister, CpcPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + AutonomousSelectionEnableBuffer, + AutonomousSelectionEnableInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (AutonomousActivityWindowRegister, Cp= cPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterToPackage (EnergyPerformancePreferenceRegister,= CpcPackage); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + ReferencePerformanceBuffer, + ReferencePerformanceInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + LowestFrequencyBuffer, + LowestFrequencyInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + Status =3D AmlAddRegisterOrIntegerToPackage ( + NominalFrequencyBuffer, + NominalFrequencyInteger, + CpcPackage + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + + if (ParentNode !=3D NULL) { + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)ParentNode, + (AML_NODE_HANDLE)CpcNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler; + } + } + + if (NewCpcNode !=3D NULL) { + *NewCpcNode =3D CpcNode; + } + + return Status; + +error_handler: + if (CpcNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); + } + + return Status; +} --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93437): https://edk2.groups.io/g/devel/message/93437 Mute This Topic: https://groups.io/mt/93527136/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 12 14:36:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93436+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662563732349940.4950404069872; Wed, 7 Sep 2022 08:15:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oMggYY1788612xaib1UpvoiQ; Wed, 07 Sep 2022 08:15:32 -0700 X-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 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 X-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 X-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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93436+1787277+3901457@groups.io; helo=mail02.groups.io; 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 X-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 X-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 X-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 X-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 via groups.io" To: CC: , , , Jeff Brasen Subject: [edk2-devel] [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> In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public 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-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-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 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com X-Gm-Message-State: 8ESq4xq1jp2Mr7miyrQ95utEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662563732; bh=9B9AkJqxWj0I13S2CxRbRY5tC7duv+opYBM0X+GiFPc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=UYUhDwc9QdhTFF1L9RFm2BMEKirfnc+zwSFjz6gXbztJtvAIcgG1Hhrswx+L4ejrKgp 09jlsmqIf3Z0QVfFG3z7RVHIvphwLpjOzvLyRGmEtXc31WtLy7tlv/jF1BjfdV1lSMGxC /vdgTzPRORIYmwGoEx5rgYBjJU3RtBdihYk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662563733515100001 Content-Type: text/plain; charset="utf-8" Add code to use a token attached to GICC to generate _CPC object on cpus. Signed-off-by: Jeff Brasen --- .../SsdtCpuTopologyGenerator.c | 211 +++++++++++++++++- 1 file changed, 206 insertions(+), 5 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTop= ologyLibArm/SsdtCpuTopologyGenerator.c index 8561f48e1f..ba1f1bd436 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c @@ -76,6 +76,16 @@ GET_OBJECT_LIST ( CM_ARM_LPI_INFO ); =20 +/** + This macro expands to a function that retrieves the CPC + information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceArm, + EArmObjCpcInfo, + CM_ARM_CPC_INFO + ); + /** Initialize the TokenTable. =20 One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO @@ -229,6 +239,182 @@ WriteAslName ( return EFI_SUCCESS; } =20 +/** Utility function to check if generic address points to NULL + + @param [in] Address Pointer to the Generic address + + @retval TRUE Address is system memory with an Address of 0. + @retval FALSE Address does not point to NULL. +**/ +STATIC +BOOLEAN +EFIAPI +IsNullGenericAddress ( + IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *Address + ) +{ + if ((Address =3D=3D NULL) || + ((Address->AddressSpaceId =3D=3D EFI_ACPI_6_3_SYSTEM_MEMORY) && + (Address->Address =3D=3D 0x0))) + { + return TRUE; + } + + return FALSE; +} + +/** Create and add an _CPC Node to Cpu Node. + + For instance, transform an AML node from: + Device (C002) + { + Name (_UID, 2) + Name (_HID, "ACPI0007") + } + + To: + Device (C002) + { + Name (_UID, 2) + Name (_HID, "ACPI0007") + Name(_CPC, Package() + { + NumEntries, // Integer + Revision, // Integer + HighestPerformance, // Integer or Buffer (Res= ource Descriptor) + NominalPerformance, // Integer or Buffer (Res= ource Descriptor) + LowestNonlinearPerformance, // Integer or Buffer (Res= ource Descriptor) + LowestPerformance, // Integer or Buffer (Res= ource Descriptor) + GuaranteedPerformanceRegister, // Buffer (Resource Descr= iptor) + DesiredPerformanceRegister , // Buffer (Resource Descr= iptor) + MinimumPerformanceRegister , // Buffer (Resource Descr= iptor) + MaximumPerformanceRegister , // Buffer (Resource Descr= iptor) + PerformanceReductionToleranceRegister, // Buffer (Resource Descr= iptor) + TimeWindowRegister, // Buffer (Resource Descr= iptor) + CounterWraparoundTime, // Integer or Buffer (Res= ource Descriptor) + ReferencePerformanceCounterRegister, // Buffer (Resource Descr= iptor) + DeliveredPerformanceCounterRegister, // Buffer (Resource Descr= iptor) + PerformanceLimitedRegister, // Buffer (Resource Descr= iptor) + CPPCEnableRegister // Buffer (Resource Descr= iptor) + AutonomousSelectionEnable, // Integer or Buffer (Res= ource Descriptor) + AutonomousActivityWindowRegister, // Buffer (Resource Descr= iptor) + EnergyPerformancePreferenceRegister, // Buffer (Resource Descr= iptor) + ReferencePerformance // Integer or Buffer (Res= ource Descriptor) + LowestFrequency, // Integer or Buffer (Res= ource Descriptor) + NominalFrequency // Integer or Buffer (Res= ource Descriptor) + }) + } + + @param [in] Generator The SSDT Cpu Topology generator. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO describing + the Cpu. + @param [in] Node CPU Node to which the _CPC node is + attached. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +CreateAmlCpcNode ( + IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN CM_ARM_GICC_INFO *GicCInfo, + IN AML_OBJECT_NODE_HANDLE *Node + ) +{ + EFI_STATUS Status; + CM_ARM_CPC_INFO *CpcInfo; + + Status =3D GetEArmObjCpcInfo ( + CfgMgrProtocol, + GicCInfo->CpcToken, + &CpcInfo, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status =3D AmlCreateCpcNode ( + IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) ? + NULL : + &CpcInfo->HighestPerformanceBuffer, + CpcInfo->HighestPerformanceInteger, + IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) ? + NULL : + &CpcInfo->NominalPerformanceBuffer, + CpcInfo->NominalPerformanceInteger, + IsNullGenericAddress (&CpcInfo->LowestNonlinearPerformanceBuf= fer) ? + NULL : + &CpcInfo->LowestNonlinearPerformanceBuffer, + CpcInfo->LowestNonlinearPerformanceInteger, + IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) ? + NULL : + &CpcInfo->LowestPerformanceBuffer, + CpcInfo->LowestPerformanceInteger, + IsNullGenericAddress (&CpcInfo->GuaranteedPerformanceRegister= ) ? + NULL : + &CpcInfo->GuaranteedPerformanceRegister, + IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) ? + NULL : + &CpcInfo->DesiredPerformanceRegister, + IsNullGenericAddress (&CpcInfo->MinimumPerformanceRegister) ? + NULL : + &CpcInfo->MinimumPerformanceRegister, + IsNullGenericAddress (&CpcInfo->MaximumPerformanceRegister) ? + NULL : + &CpcInfo->MaximumPerformanceRegister, + IsNullGenericAddress (&CpcInfo->PerformanceReductionTolerance= Register) ? + NULL : + &CpcInfo->PerformanceReductionToleranceRegister, + IsNullGenericAddress (&CpcInfo->TimeWindowRegister) ? + NULL : + &CpcInfo->TimeWindowRegister, + IsNullGenericAddress (&CpcInfo->CounterWraparoundTimeBuffer) ? + NULL : + &CpcInfo->CounterWraparoundTimeBuffer, + CpcInfo->CounterWraparoundTimeInteger, + &CpcInfo->ReferencePerformanceCounterRegister, + &CpcInfo->DeliveredPerformanceCounterRegister, + &CpcInfo->PerformanceLimitedRegister, + IsNullGenericAddress (&CpcInfo->CPPCEnableRegister) ? + NULL : + &CpcInfo->CPPCEnableRegister, + IsNullGenericAddress (&CpcInfo->AutonomousSelectionEnableBuff= er) ? + NULL : + &CpcInfo->AutonomousSelectionEnableBuffer, + CpcInfo->AutonomousSelectionEnableInteger, + IsNullGenericAddress (&CpcInfo->AutonomousActivityWindowRegis= ter) ? + NULL : + &CpcInfo->AutonomousActivityWindowRegister, + IsNullGenericAddress (&CpcInfo->EnergyPerformancePreferenceRe= gister) ? + NULL : + &CpcInfo->EnergyPerformancePreferenceRegister, + IsNullGenericAddress (&CpcInfo->ReferencePerformanceBuffer) ? + NULL : + &CpcInfo->ReferencePerformanceBuffer, + CpcInfo->ReferencePerformanceInteger, + IsNullGenericAddress (&CpcInfo->LowestFrequencyBuffer) ? + NULL : + &CpcInfo->LowestFrequencyBuffer, + CpcInfo->LowestFrequencyInteger, + IsNullGenericAddress (&CpcInfo->NominalFrequencyBuffer) ? + NULL : + &CpcInfo->NominalFrequencyBuffer, + CpcInfo->NominalFrequencyInteger, + Node, + NULL + ); + ASSERT_EFI_ERROR (Status); + return Status; +} + /** Create and add an _LPI method to Cpu/Cluster Node. =20 For instance, transform an AML node from: @@ -584,6 +770,13 @@ CreateAmlCpuFromProcHierarchy ( ASSERT_EFI_ERROR (Status); } =20 + // If a CPC info is associated with the + // GicCinfo, create an _CPC method returning them. + if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) { + Status =3D CreateAmlCpcNode (Generator, CfgMgrProtocol, GicCInfo, CpuN= ode); + ASSERT_EFI_ERROR (Status); + } + return Status; } =20 @@ -934,10 +1127,11 @@ CreateTopologyFromGicC ( IN AML_OBJECT_NODE_HANDLE ScopeNode ) { - EFI_STATUS Status; - CM_ARM_GICC_INFO *GicCInfo; - UINT32 GicCInfoCount; - UINT32 Index; + EFI_STATUS Status; + CM_ARM_GICC_INFO *GicCInfo; + UINT32 GicCInfoCount; + UINT32 Index; + AML_OBJECT_NODE_HANDLE CpuNode; =20 ASSERT (Generator !=3D NULL); ASSERT (CfgMgrProtocol !=3D NULL); @@ -961,12 +1155,19 @@ CreateTopologyFromGicC ( ScopeNode, &GicCInfo[Index], Index, - NULL + &CpuNode ); if (EFI_ERROR (Status)) { ASSERT (0); break; } + + // If a CPC info is associated with the + // GicCinfo, create an _CPC method returning them. + if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) { + Status =3D CreateAmlCpcNode (Generator, CfgMgrProtocol, &GicCInfo[In= dex], CpuNode); + ASSERT_EFI_ERROR (Status); + } } // for =20 return Status; --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93436): https://edk2.groups.io/g/devel/message/93436 Mute This Topic: https://groups.io/mt/93527135/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-