git: 5f7312a0d70c - main - syscon_power: do reboot after shutdown_panic is executed

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sun, 18 Feb 2024 14:38:49 UTC
The branch main has been updated by avg:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f7312a0d70c607afa9ce24ccd757321d043e02c

commit 5f7312a0d70c607afa9ce24ccd757321d043e02c
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-07-09 15:00:21 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-18 14:38:27 +0000

    syscon_power: do reboot after shutdown_panic is executed
    
    A syscon_power instance can handle either poweroff or reboot, but not
    both.  If the instance handles reboot then set its priority to be after
    shutdown_panic.
    
    This is to provide uniform experience with other platforms.
    
    MFC after:      3 weeks
---
 sys/dev/syscon/syscon_power.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/syscon/syscon_power.c b/sys/dev/syscon/syscon_power.c
index 365dc0252417..6897cf3df422 100644
--- a/sys/dev/syscon/syscon_power.c
+++ b/sys/dev/syscon/syscon_power.c
@@ -161,9 +161,11 @@ syscon_power_attach(device_t dev)
 		OF_getencprop(node, "value", &sc->value, sizeof(sc->value));
 	}
 
+	/* Handle reboot after shutdown_panic. */
 	sc->reboot = ofw_bus_is_compatible(dev, "syscon-reboot");
 	sc->shutdown_tag = EVENTHANDLER_REGISTER(shutdown_final,
-	    syscon_power_shutdown_final, dev, SHUTDOWN_PRI_LAST);
+	    syscon_power_shutdown_final, dev,
+	    sc->reboot ? SHUTDOWN_PRI_LAST + 150 : SHUTDOWN_PRI_LAST);
 
 	return (0);
 }