From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.9763.1620719254997103132 for ; Tue, 11 May 2021 00:47:35 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pranav.madhu@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8BDEB1691; Tue, 11 May 2021 00:47:34 -0700 (PDT) Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5FCEC3F73B; Tue, 11 May 2021 00:47:33 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-platforms][PATCH V2 06/11] Platform/Sgi: Macro definitions for ACPI CPPC Date: Tue, 11 May 2021 13:17:09 +0530 Message-Id: <20210511074714.1894-7-pranav.madhu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210511074714.1894-1-pranav.madhu@arm.com> References: <20210511074714.1894-1-pranav.madhu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add helper macros required for use with ACPI collaborative processor performance control (CPPC). This patch adds macros for initializing ACPI _CPC and _PSD control method. The CPC initializer macro initializes _CPC control method with revision 3 as specified in Arm FFH specification 1.1. The CPC initilizer exposes the reference performance counter and delivered perfrmance counter (AMU registers) as FFixedHW registers. The initilizer also expose the fastchannel memories for performance level set performance limit set protocols as desired performance register and performance limited register respectively. Signed-off-by: Pranav Madhu --- Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h | 74 ++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h b/Platform/ARM/S= giPkg/Include/SgiAcpiHeader.h index c23938fe3d4f..7b8c16b172c0 100644 --- a/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h +++ b/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h @@ -432,4 +432,78 @@ typedef struct { LineSize /* Line size in by= tes */ \ } =20 +/** Helper macro for CPPC _CPC object initialization. Use of this macro = is + restricted to ASL file and not to TDL file. + + @param [in] DesiredPerfReg Fastchannel address for desired perf= ormance + register. + @param [in] PerfLimitedReg Fastchannel address for performance = limited + register. + @param [in] GranularityMHz Granularity of the performance scale= . + @param [in] HighestPerf Highest performance in linear scale. + @param [in] NominalPerf Nominal performance in linear scale. + @param [in] LowestNonlinearPerf Lowest non-linear performnce in line= ar + scale. + @param [in] LowestPerf Lowest performance in linear scale. + @param [in] RefPerf Reference performance in linear scal= e. +**/ +#define CPPC_PACKAGE_INIT(DesiredPerfReg, PerfLimitedReg, GranularityMHz= , \ + HighestPerf, NominalPerf, LowestNonlinearPerf, LowestPerf, RefPerf) = \ + { = \ + 23, /* NumEntries */ = \ + 3, /* Revision */ = \ + HighestPerf, /* Highest Performance */ = \ + NominalPerf, /* Nominal Performance */ = \ + LowestNonlinearPerf, /* Lowest Nonlinear Performance = */ \ + LowestPerf, /* Lowest Performance */ = \ + /* Guaranteed Performance Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Desired Performance Register */ = \ + ResourceTemplate () { Register (SystemMemory, 32, 0, DesiredPerfReg,= 3) }, \ + /* Minimum Performance Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Maximum Performance Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Performance Reduction Tolerance Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Time Window Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Counter Wraparound Time */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Reference Performance Counter Register */ = \ + ResourceTemplate () { Register (FFixedHW, 64, 0, 1, 4) }, = \ + /* Delivered Performance Counter Register */ = \ + ResourceTemplate () { Register (FFixedHW, 64, 0, 0, 4) }, = \ + /* Performance Limited Register */ = \ + ResourceTemplate () { Register (SystemMemory, 32, 0, PerfLimitedReg,= 3) }, \ + /* CPPC Enable Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Autonomous Selection Enable Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Autonomous Activity Window Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + /* Energy Performance Preference Register */ = \ + ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, = \ + RefPerf, /* Reference Performance */ = \ + (LowestPerf * GranularityMHz), /* Lowest Frequency */ = \ + (NominalPerf * GranularityMHz), /* Nominal Frequency */ = \ + } + +// Power state dependancy (_PSD) for CPPC + +/** Helper macro to initialize Power state dependancy (_PSD) object requ= ired + for CPPC. Use of this macro is restricted to ASL file and not to TDL= file. + + @param [in] Domain The dependency domain number to whic= h this + P-state entry belongs. +**/ +#define PSD_INIT(Domain) = \ + { = \ + 5, /* Entries */ = \ + 0, /* Revision */ = \ + Domain, /* Domain */ = \ + 0xFD, /* Coord Type- SW_ANY */ = \ + 1 /* Processors */ = \ + } + #endif /* __SGI_ACPI_HEADER__ */ --=20 2.17.1