git: 0cb72c25b01a - stable/14 - psci: split off psci_reboot from psci_shutdown
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 16 Mar 2024 15:16:17 UTC
The branch stable/14 has been updated by avg:
URL: https://cgit.FreeBSD.org/src/commit/?id=0cb72c25b01aadb3c6fdd62e58e5c89cdd1b855f
commit 0cb72c25b01aadb3c6fdd62e58e5c89cdd1b855f
Author: Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-07-09 15:01:57 +0000
Commit: Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-03-16 15:14:41 +0000
psci: split off psci_reboot from psci_shutdown
Priority of psci_reboot set so that it is run after shutdown_panic is
executed. This is to provide uniform experience with other platforms.
(cherry picked from commit 0f354b2b588b60e2ef119ff2f480f7905c5db587)
---
sys/dev/psci/psci.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/sys/dev/psci/psci.c b/sys/dev/psci/psci.c
index 46d7a2f07181..4fd1cd62ed8c 100644
--- a/sys/dev/psci/psci.c
+++ b/sys/dev/psci/psci.c
@@ -124,7 +124,6 @@ static struct ofw_compat_data compat_data[] = {
#endif
static int psci_attach(device_t, psci_initfn_t, int);
-static void psci_shutdown(void *, int);
static int psci_find_callfn(psci_callfn_t *);
static int psci_def_callfn(register_t, register_t, register_t, register_t,
@@ -468,12 +467,24 @@ psci_shutdown(void *xsc, int howto)
if (psci_softc == NULL)
return;
- /* PSCI system_off and system_reset werent't supported in v0.1. */
if ((howto & RB_POWEROFF) != 0)
fn = psci_softc->psci_fnids[PSCI_FN_SYSTEM_OFF];
- else if ((howto & RB_HALT) == 0)
- fn = psci_softc->psci_fnids[PSCI_FN_SYSTEM_RESET];
+ if (fn)
+ psci_call(fn, 0, 0, 0);
+
+ /* System reset and off do not return. */
+}
+static void
+psci_reboot(void *xsc, int howto)
+{
+ uint32_t fn = 0;
+
+ if (psci_softc == NULL)
+ return;
+
+ if ((howto & RB_HALT) == 0)
+ fn = psci_softc->psci_fnids[PSCI_FN_SYSTEM_RESET];
if (fn)
psci_call(fn, 0, 0, 0);
@@ -484,7 +495,7 @@ void
psci_reset(void)
{
- psci_shutdown(NULL, 0);
+ psci_reboot(NULL, 0);
}
#ifdef FDT
@@ -582,6 +593,10 @@ psci_v0_2_init(device_t dev, int default_version)
EVENTHANDLER_REGISTER(shutdown_final, psci_shutdown, sc,
SHUTDOWN_PRI_LAST);
+ /* Handle reboot after shutdown_panic. */
+ EVENTHANDLER_REGISTER(shutdown_final, psci_reboot, sc,
+ SHUTDOWN_PRI_LAST + 150);
+
return (0);
}