From ad27f4b5d918bbd1feb9a2deed3cb0e2ae39616e Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Wed, 29 Mar 2023 12:05:19 +0100 Subject: [PATCH] fix(psci): remove unreachable switch/case blocks The PSCI function dispatcher switch/case is split up between 32-bit and 64-bit function IDs, based on bit 30 of the encoding. This bit just encodes the maximum size of the arguments, not necessarily whether they are used from AArch64 or AArch32. So while some functions exist in both worlds (CPU_ON, for instance), some functions take no or only 32-bit arguments (CPU_OFF, PSCI_FEATURES), so they only exist as a 32-bit function call. Commit b88a4416b5e5 ("feat(psci): add support for PSCI_SET_SUSPEND_MODE" , gerrit ID Iebf65f5f7846aef6b8643ad6082db99b4dcc4bef) and commit 9a70e69e0598 ("feat(psci): update PSCI_FEATURES", gerrit ID I5da8a989b53419ad2ab55b73ddeee6e882c25554) introduced two "case" sections for 32-bit function IDs in the 64-bit branch, which will never trigger. The one small extra case caused the sun50i_a64 DEBUG build to go beyond its RAM limit. Removed the redundant switch/case blocks, to make sun50i_a64 build again. Change-Id: Ic65b7403d128837296a0c3af42c6f23f9f57778e Signed-off-by: Andre Przywara --- lib/psci/psci_main.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/psci/psci_main.c b/lib/psci/psci_main.c index 276c3a59f..326f125b6 100644 --- a/lib/psci/psci_main.c +++ b/lib/psci/psci_main.c @@ -567,10 +567,6 @@ u_register_t psci_smc_handler(uint32_t smc_fid, ret = psci_migrate_info_up_cpu(); break; - case PSCI_FEATURES: - ret = (u_register_t)psci_features(x1); - break; - case PSCI_NODE_HW_STATE_AARCH64: ret = (u_register_t)psci_node_hw_state( x1, (unsigned int) x2); @@ -580,12 +576,6 @@ u_register_t psci_smc_handler(uint32_t smc_fid, ret = (u_register_t)psci_system_suspend(x1, x2); break; -#if PSCI_OS_INIT_MODE - case PSCI_SET_SUSPEND_MODE: - ret = (u_register_t)psci_set_suspend_mode(x1); - break; -#endif - #if ENABLE_PSCI_STAT case PSCI_STAT_RESIDENCY_AARCH64: ret = psci_stat_residency(x1, (unsigned int) x2); -- 2.39.5