git: b2681df2294b - stable/13 - syscon_power: do reboot after shutdown_panic is executed

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 16 Mar 2024 15:16:39 UTC
The branch stable/13 has been updated by avg:

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

commit b2681df2294b54c9a293946482843c63455f8818
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-07-09 15:00:21 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-03-16 15:14:20 +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.
    
    (cherry picked from commit 5f7312a0d70c607afa9ce24ccd757321d043e02c)
---
 sys/dev/extres/syscon/syscon_power.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/extres/syscon/syscon_power.c b/sys/dev/extres/syscon/syscon_power.c
index 792b9c43773a..2615e3a8f5dd 100644
--- a/sys/dev/extres/syscon/syscon_power.c
+++ b/sys/dev/extres/syscon/syscon_power.c
@@ -162,9 +162,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);
 }