From 8c32bc26e7bc58f028c1b31dd226610d3d388237 Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Thu, 12 Feb 2015 14:45:02 +0000 Subject: Export maximum affinity using PLATFORM_MAX_AFFLVL macro This patch removes the plat_get_max_afflvl() platform API and instead replaces it with a platform macro PLATFORM_MAX_AFFLVL. This is done because the maximum affinity level for a platform is a static value and it is more efficient for it to be defined as a platform macro. NOTE: PLATFORM PORTS NEED TO BE UPDATED ON MERGE OF THIS COMMIT Fixes ARM-Software/tf-issues#265 Change-Id: I31d89b30c2ccda30d28271154d869060d50df7bf --- services/std_svc/psci/psci_common.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'services/std_svc/psci/psci_common.c') diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index a31643e4..7ab607db 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -61,6 +61,13 @@ __attribute__ ((section("tzfw_coherent_mem"))) ******************************************************************************/ const plat_pm_ops_t *psci_plat_pm_ops; +/******************************************************************************* + * Check that the maximum affinity level supported by the platform makes sense + * ****************************************************************************/ +CASSERT(PLATFORM_MAX_AFFLVL <= MPIDR_MAX_AFFLVL && \ + PLATFORM_MAX_AFFLVL >= MPIDR_AFFLVL0, \ + assert_platform_max_afflvl_check); + /******************************************************************************* * This function is passed an array of pointers to affinity level nodes in the * topology tree for an mpidr. It iterates through the nodes to find the highest @@ -150,29 +157,15 @@ int get_power_on_target_afflvl() /* * Assume that this cpu was suspended and retrieve its target affinity * level. If it is invalid then it could only have been turned off - * earlier. get_max_afflvl() will return the highest affinity level a + * earlier. PLATFORM_MAX_AFFLVL will be the highest affinity level a * cpu can be turned off to. */ afflvl = psci_get_suspend_afflvl(); if (afflvl == PSCI_INVALID_DATA) - afflvl = get_max_afflvl(); + afflvl = PLATFORM_MAX_AFFLVL; return afflvl; } -/******************************************************************************* - * Simple routine to retrieve the maximum affinity level supported by the - * platform and check that it makes sense. - ******************************************************************************/ -int get_max_afflvl(void) -{ - int aff_lvl; - - aff_lvl = plat_get_max_afflvl(); - assert(aff_lvl <= MPIDR_MAX_AFFLVL && aff_lvl >= MPIDR_AFFLVL0); - - return aff_lvl; -} - /******************************************************************************* * Simple routine to set the id of an affinity instance at a given level in the * mpidr. @@ -204,7 +197,7 @@ unsigned long mpidr_set_aff_inst(unsigned long mpidr, int psci_check_afflvl_range(int start_afflvl, int end_afflvl) { /* Sanity check the parameters passed */ - if (end_afflvl > get_max_afflvl()) + if (end_afflvl > PLATFORM_MAX_AFFLVL) return PSCI_E_INVALID_PARAMS; if (start_afflvl < MPIDR_AFFLVL0) -- cgit