From 50e63f11762348bcd95d809af248f620f03d9ce4 Mon Sep 17 00:00:00 2001
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Date: Fri, 11 Feb 2022 18:16:54 +0000
Subject: [PATCH 3/4] tc0: rename platform variant to platform feature set

THe PLATFORM_VARIANT flag was added to differentiate the software
features enabled in SCP firmware. But this flag misleads to a new
variant of same platform. This commits renames PLATFORM_VARIANT to
PLATFORM_FEATURE_SET

Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I93c0bc3e11fe18192bb8246df851345bdc473974
Upstream-Status: Pending [Not submitted to upstream yet]
---
 product/tc0/doc/{variants.md => features.md} | 28 +++++++++-----------
 product/tc0/scp_ramfw/CMakeLists.txt         | 26 +++---------------
 product/tc0/scp_ramfw/Firmware.cmake         |  2 +-
 product/tc0/scp_ramfw/config_scmi_perf.c     |  8 +++---
 product/tc0/scp_romfw/CMakeLists.txt         |  6 ++---
 product/tc0/scp_romfw/Firmware.cmake         |  2 +-
 6 files changed, 25 insertions(+), 47 deletions(-)
 rename product/tc0/doc/{variants.md => features.md} (77%)

diff --git a/product/tc0/doc/variants.md b/product/tc0/doc/features.md
similarity index 77%
rename from product/tc0/doc/variants.md
rename to product/tc0/doc/features.md
index fbf616db..3ef520e2 100644
--- a/product/tc0/doc/variants.md
+++ b/product/tc0/doc/features.md
@@ -1,4 +1,4 @@
-# TC0 Platform Variants
+# TC0 Platform Features
 
 Copyright (c) 2022, Arm Limited. All rights reserved.
 
@@ -7,30 +7,27 @@ Copyright (c) 2022, Arm Limited. All rights reserved.
 
 Documentation for TC0 platform can be found at [1].
 
+### Standard
+
+The standard build provides all the features described in [1].
+For this default features, it's not required to provide any extra parameters in
+the build commands.
+
+### MPMM/Power/Performance (Experimental)
+
 For the purpose of experimenting some of the software features that have been
-introduced in SCP-firmware a new variant of TC0 has been created.
-The variant(s) can be chosen at build time by adding:
+introduced in SCP-firmware of TC0. This can be enabled at build time, by adding:
 
 ```sh
 
 make -f Makefile.cmake \
     PRODUCT=tc0 \
     MODE=<debug,release> \
-    EXTRA_CONFIG_ARGS+=-DSCP_PLATFORM_VARIANT=<0,1>
+    EXTRA_CONFIG_ARGS+=-DSCP_PLATFORM_FEATURE_SET=1
 
 ```
 
-
-### Variant 0 (Standard build)
-
-The standard build provides all the features described in [1].
-For this default variant, it's not required to provide any extra parameters in
-the build commands.
-
-
-### Variant 1 (Power/Performance testing)
-
-This variant adds support for the following software features:
+This adds support for the following software features:
 - Traffic Cop
 - MPMM (Maximum Power Mitigation Mechanism)
 - Thermal Management
@@ -63,7 +60,6 @@ Once built, the features above will act as:
 
 ## Limitations
 
-- The "variant" option is available only with the CMake build.
 - The Thermal functionality is limited at this time cause the constant
   temperature being sampled.
 
diff --git a/product/tc0/scp_ramfw/CMakeLists.txt b/product/tc0/scp_ramfw/CMakeLists.txt
index 96310320..ce3178ee 100644
--- a/product/tc0/scp_ramfw/CMakeLists.txt
+++ b/product/tc0/scp_ramfw/CMakeLists.txt
@@ -11,25 +11,13 @@
 
 add_executable(tc0-bl2)
 
+set(SCP_PLATFORM_FEATURE_SET ${SCP_PLATFORM_FEATURE_SET_INIT} CACHE STRING "1")
 
-# SCP_PLATFORM_VARIANT options:
-# - 'TC0_VARIANT_STD' for TC0 standard build
-# - 'TC0_VAR_EXPERIMENT_POWER' for TC0 with power/performance plugins used for
-#   evaluation purposes
-
-
-target_compile_definitions(tc0-bl2 PUBLIC -DTC0_VARIANT_STD=0)
-target_compile_definitions(tc0-bl2 PUBLIC -DTC0_VAR_EXPERIMENT_POWER=1)
-
-
-set(SCP_PLATFORM_VARIANT ${SCP_PLATFORM_VARIANT_INIT} CACHE STRING "1")
-
-
-if (SCP_PLATFORM_VARIANT STREQUAL "1")
-    message(NOTICE "SCP_PLATFORM_VARIANT set to EXPERIMENT_POWER (tc0-bl2)\n")
+if (SCP_PLATFORM_FEATURE_SET STREQUAL "1")
+    message(NOTICE "TC0 platform features MPMM/POWER/PERFORMANCE is experimental (tc0-bl2)\n")
 
     target_compile_definitions(tc0-bl2
-        PUBLIC -DPLATFORM_VARIANT=TC0_VAR_EXPERIMENT_POWER)
+	PUBLIC -DTC0_FEATURES_MPMM_POWER_PERF)
 
     set(SCP_ENABLE_PLUGIN_HANDLER TRUE PARENT_SCOPE)
     set(SCP_ENABLE_FAST_CHANNELS TRUE PARENT_SCOPE)
@@ -56,12 +44,6 @@ if (SCP_PLATFORM_VARIANT STREQUAL "1")
     list(PREPEND SCP_MODULE_PATHS
         "${CMAKE_CURRENT_LIST_DIR}/../module/tc0_power_model")
     target_sources(tc0-bl2 PRIVATE "config_tc0_power_model.c")
-
-else()
-    message(NOTICE "SCP_PLATFORM_VARIANT set to STANDARD (tc0-bl2)\n")
-
-    target_compile_definitions(tc0-bl2
-        PUBLIC -DPLATFORM_VARIANT=TC0_VARIANT_STD)
 endif()
 
 
diff --git a/product/tc0/scp_ramfw/Firmware.cmake b/product/tc0/scp_ramfw/Firmware.cmake
index 11d8eaab..4a555296 100644
--- a/product/tc0/scp_ramfw/Firmware.cmake
+++ b/product/tc0/scp_ramfw/Firmware.cmake
@@ -27,7 +27,7 @@ set(SCP_ENABLE_FAST_CHANNELS_INIT FALSE)
 
 set(SCP_ENABLE_PLUGIN_HANDLER_INIT FALSE)
 
-set(SCP_PLATFORM_VARIANT_INIT 0)
+set(SCP_PLATFORM_FEATURE_SET_INIT 0)
 
 set(SCP_ARCHITECTURE "armv7-m")
 
diff --git a/product/tc0/scp_ramfw/config_scmi_perf.c b/product/tc0/scp_ramfw/config_scmi_perf.c
index a4a47b3a..3e91939a 100644
--- a/product/tc0/scp_ramfw/config_scmi_perf.c
+++ b/product/tc0/scp_ramfw/config_scmi_perf.c
@@ -129,7 +129,7 @@ static const struct mod_scmi_perf_domain_config domains[] = {
     },
 };
 
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VAR_EXPERIMENT_POWER)
+#ifdef TC0_FEATURES_MPMM_POWER_PERF
 static const struct mod_scmi_plugin_config plugins_table[] = {
     [0] = {
         .id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_TRAFFIC_COP),
@@ -156,9 +156,9 @@ const struct fwk_module_config config_scmi_perf = {
 #else
         .fast_channels_alarm_id = FWK_ID_NONE_INIT,
 #endif
-#if defined(PLATFORM_VARIANT) && (PLATFORM_VARIANT == TC0_VAR_EXPERIMENT_POWER)
-        .plugins = plugins_table,
-        .plugins_count = FWK_ARRAY_SIZE(plugins_table),
+#ifdef TC0_FEATURES_MPMM_POWER_PERF
+	.plugins = plugins_table,
+	.plugins_count = FWK_ARRAY_SIZE(plugins_table),
 #endif
     })
 };
diff --git a/product/tc0/scp_romfw/CMakeLists.txt b/product/tc0/scp_romfw/CMakeLists.txt
index f9f40ad3..09cd2f5d 100644
--- a/product/tc0/scp_romfw/CMakeLists.txt
+++ b/product/tc0/scp_romfw/CMakeLists.txt
@@ -48,6 +48,6 @@ target_include_directories(tc0-bl1
     PUBLIC $<TARGET_PROPERTY:cmsis::core-m,INTERFACE_INCLUDE_DIRECTORIES>)
 
 cmake_dependent_option(
-    SCP_PLATFORM_VARIANT "Choose platform software variant?"
-    "${SCP_PLATFORM_VARIANT_INIT}" "DEFINED SCP_PLATFORM_VARIANT_INIT"
-    "${SCP_PLATFORM_VARIANT}")
+    SCP_PLATFORM_FEATURE_SET "Choose platform software features?"
+    "${SCP_PLATFORM_FEATURE_SET_INIT}" "DEFINED SCP_PLATFORM_FEATURE_SET_INIT"
+    "${SCP_PLATFORM_FEATURE_SET}")
diff --git a/product/tc0/scp_romfw/Firmware.cmake b/product/tc0/scp_romfw/Firmware.cmake
index ab4468be..e1360159 100644
--- a/product/tc0/scp_romfw/Firmware.cmake
+++ b/product/tc0/scp_romfw/Firmware.cmake
@@ -21,7 +21,7 @@ set(SCP_ENABLE_NOTIFICATIONS_INIT TRUE)
 
 set(SCP_ENABLE_IPO_INIT FALSE)
 
-set(SCP_PLATFORM_VARIANT_INIT 0)
+set(SCP_PLATFORM_FEATURE_SET_INIT 0)
 
 set(SCP_ARCHITECTURE "armv7-m")
 
-- 
2.30.2

