summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2016-10-10 17:26:45 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2016-11-25 16:38:27 +0000
commitc946ed3a0338d2afe7d2f433f8b7f9051fee388e (patch)
tree201e94fc5e3470ddca4dd4840ffd8dcd5476002a
parent9a0dcf4fde72376d811c3d672ab6b639a6080ed3 (diff)
Add helper to get the deepest pstate at a given power level
This patch adds a new TFTF framework API `tftf_set_deepest_pstate_idx` which sets the pstate indices corresponding to the deepest pstate at a given power level for a platform. These indices can then be used to construct the full `power_state` parameter using `tftf_get_pstate_vars()` helper function. Change-Id: Ie5c5ad1dd056c45f69f553d5cfadc6d33b4ef945
-rw-r--r--include/plat/common/platform.h7
-rw-r--r--plat/common/plat_state_id.c17
2 files changed, 24 insertions, 0 deletions
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index 65c55e9..2e9fd78 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -138,6 +138,13 @@ void tftf_set_next_local_state_id_idx(unsigned int power_level,
unsigned int pstate_id_idx[]);
/*
+ * This function sets the index corresponding to the deepest power state at
+ * a given power level.
+ */
+void tftf_set_deepest_pstate_idx(unsigned int power_level,
+ unsigned int pstate_id_idx[]);
+
+/*
* Helper function to get the state ID, state type, power level in power_state
* parameter of CPU_SUSPEND. The generated values are based on the
* pstate_id_idx values of a core.
diff --git a/plat/common/plat_state_id.c b/plat/common/plat_state_id.c
index 6128510..50609c6 100644
--- a/plat/common/plat_state_id.c
+++ b/plat/common/plat_state_id.c
@@ -119,6 +119,23 @@ void tftf_set_next_state_id_idx(unsigned int power_level,
}
}
+void tftf_set_deepest_pstate_idx(unsigned int power_level,
+ unsigned int pstate_id_idx[])
+{
+ int i;
+
+ /* Verify that this is a valid power level. */
+ assert(power_level <= PLAT_MAX_PWR_LEVEL);
+
+ /*
+ * Assign the highest pstate_id_idx starting from the lowest power
+ * level
+ */
+ for (i = 0; i <= power_level; i++)
+ pstate_id_idx[i] = power_states_per_level[i] - 1;
+}
+
+
int tftf_get_pstate_vars(unsigned int *test_power_level,
unsigned int *test_suspend_type,
unsigned int *suspend_state_id,