refactor: panic after calling psci_power_down_wfi()

This function doesn't return and its callers that don't return either
rely on this. Drop the dead attribute and add a panic() after it to make
this expectation explicit. Calling `wfi` in the powerdown sequence is
terminal so even if the function was made to return, there would be no
functional change.

This is useful for a following patch that makes psci_power_down_wfi()
return.

Change-Id: I62ca1ee058b1eaeb046966c795081e01bf45a2eb
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
diff --git a/include/lib/psci/psci.h b/include/lib/psci/psci.h
index f12a4d6..8ea4c27 100644
--- a/include/lib/psci/psci.h
+++ b/include/lib/psci/psci.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2019, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
  * Copyright (c) 2023, NVIDIA Corporation. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
@@ -376,7 +376,7 @@
 #if PSCI_OS_INIT_MODE
 int psci_set_suspend_mode(unsigned int mode);
 #endif
-void __dead2 psci_power_down_wfi(void);
+void psci_power_down_wfi(void);
 void psci_arch_setup(void);
 
 #endif /*__ASSEMBLER__*/
diff --git a/plat/allwinner/common/sunxi_native_pm.c b/plat/allwinner/common/sunxi_native_pm.c
index 148f50e..558b0bb 100644
--- a/plat/allwinner/common/sunxi_native_pm.c
+++ b/plat/allwinner/common/sunxi_native_pm.c
@@ -49,6 +49,8 @@
 	sunxi_cpu_power_off_others();
 	sunxi_cpu_power_off_self();
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 static void __dead2 sunxi_system_reset(void)
diff --git a/plat/allwinner/common/sunxi_scpi_pm.c b/plat/allwinner/common/sunxi_scpi_pm.c
index 6a0e967..8870a71 100644
--- a/plat/allwinner/common/sunxi_scpi_pm.c
+++ b/plat/allwinner/common/sunxi_scpi_pm.c
@@ -108,6 +108,8 @@
 	}
 
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 static void __dead2 sunxi_system_reset(void)
@@ -123,6 +125,8 @@
 	}
 
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 static int sunxi_system_reset2(int is_vendor, int reset_type, u_register_t cookie)
@@ -142,6 +146,8 @@
 	}
 
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 
 	/*
 	 * Should not reach here.
diff --git a/plat/mediatek/include/lib/pm/mtk_pm.h b/plat/mediatek/include/lib/pm/mtk_pm.h
index 14d005d..05293e9 100644
--- a/plat/mediatek/include/lib/pm/mtk_pm.h
+++ b/plat/mediatek/include/lib/pm/mtk_pm.h
@@ -78,7 +78,7 @@
 				    psci_power_state_t *req_state);
 	void (*get_sys_suspend_power_state)(
 				    psci_power_state_t *req_state);
-	__dead2 void (*pwr_domain_pwr_down_wfi)(
+	void (*pwr_domain_pwr_down_wfi)(
 				const psci_power_state_t *req_state);
 };
 
diff --git a/plat/mediatek/lib/pm/armv9_0/pwr_ctrl.c b/plat/mediatek/lib/pm/armv9_0/pwr_ctrl.c
index 73b1f68..fbaa3f4 100644
--- a/plat/mediatek/lib/pm/armv9_0/pwr_ctrl.c
+++ b/plat/mediatek/lib/pm/armv9_0/pwr_ctrl.c
@@ -371,7 +371,7 @@
 }
 #endif
 
-static void __dead2 pwr_domain_pwr_down_wfi(const psci_power_state_t *req_state)
+static void pwr_domain_pwr_down_wfi(const psci_power_state_t *req_state)
 {
 	unsigned int cpu = plat_my_core_pos();
 	int ret = MTK_CPUPM_E_NOT_SUPPORT;
@@ -382,6 +382,8 @@
 		plat_panic_handler();
 	else
 		psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 static void pm_smp_init(unsigned int cpu_id, uintptr_t entry_point)
diff --git a/plat/qti/common/src/qti_pm.c b/plat/qti/common/src/qti_pm.c
index 1113efc..4400e40 100644
--- a/plat/qti/common/src/qti_pm.c
+++ b/plat/qti/common/src/qti_pm.c
@@ -217,6 +217,7 @@
 	/* For now just do WFI - add any target specific handling if needed */
 	psci_power_down_wfi();
 	/* We should never reach here */
+	panic();
 }
 
 static __dead2 void assert_ps_hold(void)
diff --git a/plat/rockchip/common/plat_pm.c b/plat/rockchip/common/plat_pm.c
index 6926887..c3dc234 100644
--- a/plat/rockchip/common/plat_pm.c
+++ b/plat/rockchip/common/plat_pm.c
@@ -118,11 +118,15 @@
 				const psci_power_state_t *target_state)
 {
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
 {
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 /*******************************************************************************
diff --git a/plat/rockchip/px30/drivers/pmu/pmu.c b/plat/rockchip/px30/drivers/pmu/pmu.c
index 0d8e8b6..6200cac 100644
--- a/plat/rockchip/px30/drivers/pmu/pmu.c
+++ b/plat/rockchip/px30/drivers/pmu/pmu.c
@@ -1000,6 +1000,8 @@
 	 * so we do not hope the core to execute valid codes.
 	 */
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 void __dead2 rockchip_soc_system_off(void)
@@ -1025,6 +1027,8 @@
 	 * so we do not hope the core to execute valid codes.
 	 */
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 void rockchip_plat_mmu_el3(void)
diff --git a/plat/rockchip/rk3328/drivers/pmu/pmu.c b/plat/rockchip/rk3328/drivers/pmu/pmu.c
index 597db97..41660e2 100644
--- a/plat/rockchip/rk3328/drivers/pmu/pmu.c
+++ b/plat/rockchip/rk3328/drivers/pmu/pmu.c
@@ -619,6 +619,8 @@
 
 	/* should never reach here */
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 int rockchip_soc_sys_pwr_dm_suspend(void)
diff --git a/plat/rockchip/rk3588/drivers/pmu/pmu.c b/plat/rockchip/rk3588/drivers/pmu/pmu.c
index a4128b2..16436dd 100644
--- a/plat/rockchip/rk3588/drivers/pmu/pmu.c
+++ b/plat/rockchip/rk3588/drivers/pmu/pmu.c
@@ -1319,12 +1319,16 @@
 					psci_power_state_t *target_state)
 {
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void)
 {
 	cpus_pd_req_enter_wfi();
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 void __dead2 rockchip_soc_soft_reset(void)
@@ -1352,6 +1356,8 @@
 	 * so we do not hope the core to execute valid codes.
 	 */
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 void __dead2 rockchip_soc_system_off(void)
@@ -1373,6 +1379,8 @@
 	 * so we do not hope the core to execute valid codes.
 	 */
 	psci_power_down_wfi();
+	/* should never reach here */
+	panic();
 }
 
 static void rockchip_pmu_pd_init(void)