[edk2-devel] [PATCH v5 4/4] Platform/ARM: Juno: Use Pcd for _CPC generation

PierreGondois posted 4 patches 7 months, 2 weeks ago
[edk2-devel] [PATCH v5 4/4] Platform/ARM: Juno: Use Pcd for _CPC generation
Posted by PierreGondois 7 months, 2 weeks ago
From: Pierre Gondois <pierre.gondois@arm.com>

Make use of the newly added PcdDevelopmentPlatformRelaxations
to decide to try generating _CPC information.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 Platform/ARM/JunoPkg/ArmJuno.dsc                      |  5 +++++
 .../ConfigurationManagerDxe/ConfigurationManager.c    | 11 ++++++++++-
 .../ConfigurationManagerDxe.inf                       |  2 ++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc
index 1ea0aba2655f..76f85e4c0c04 100644
--- a/Platform/ARM/JunoPkg/ArmJuno.dsc
+++ b/Platform/ARM/JunoPkg/ArmJuno.dsc
@@ -202,6 +202,11 @@ [PcdsFixedAtBuild.common]
   # ACPI Table Version
   #
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20
+  #
+  # Allow some relaxation on some specific points for the platforms that desire it.
+  #   BIT0: Allow the absence of some registers in the _CPC object.
+  #
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations|0x0
 
 [PcdsPatchableInModule]
   # Console Resolution (Full HD)
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index d92a08749e87..875263f138ab 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1089,9 +1089,18 @@ InitializePlatformRepository (
   DEBUG ((DEBUG_INFO, "Juno Rev = 0x%x\n", PlatformRepo->JunoRevision));
 
   ///
+  /// 1.
   /// _CPC was only tested on Juno R2, so only enable support for this version.
   ///
-  if ((ArmJunoPlatformRepositoryInfo.JunoRevision == JUNO_REVISION_R2)) {
+  /// 2.
+  /// Some _CPC registers cannot be populated for the Juno:
+  /// - PerformanceLimitedRegister
+  /// - ReferencePerformanceCounterRegister
+  /// - DeliveredPerformanceCounterRegister
+  /// Only build _CPC objects if relaxation regarding these registers
+  /// is allowed.
+  if ((ArmJunoPlatformRepositoryInfo.JunoRevision == JUNO_REVISION_R2) &&
+      (PcdGet64(PcdDevelopmentPlatformRelaxations) & BIT0)) {
     PopulateCpcObjects ();
   }
 
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
index 53060bf56531..dea475375688 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -77,6 +77,8 @@ [FixedPcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
 
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations
+
 [Pcd]
 
 [Depex]
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114426): https://edk2.groups.io/g/devel/message/114426
Mute This Topic: https://groups.io/mt/103955623/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-