Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144395049
D25183.id72808.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
986 B
Referenced Files
None
Subscribers
None
D25183.id72808.diff
View Options
Index: sys/riscv/riscv/sbi.c
===================================================================
--- sys/riscv/riscv/sbi.c
+++ sys/riscv/riscv/sbi.c
@@ -29,8 +29,11 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/types.h>
+#include <sys/eventhandler.h>
+#include <sys/reboot.h>
#include <machine/md_var.h>
#include <machine/sbi.h>
@@ -80,6 +83,13 @@
return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MIMPID));
}
+static void
+sbi_shutdown_final(void *dummy __unused, int howto)
+{
+ if ((howto & RB_POWEROFF) != 0)
+ sbi_shutdown();
+}
+
void
sbi_print_version(void)
{
@@ -187,3 +197,12 @@
KASSERT(sbi_probe_extension(SBI_SHUTDOWN) != 0,
("SBI doesn't implement sbi_shutdown()"));
}
+
+static void
+sbi_late_init(void *dummy __unused)
+{
+ EVENTHANDLER_REGISTER(shutdown_final, sbi_shutdown_final, NULL,
+ SHUTDOWN_PRI_LAST);
+}
+
+SYSINIT(sbi, SI_SUB_KLD, SI_ORDER_ANY, sbi_late_init, NULL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 5:29 AM (3 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28543026
Default Alt Text
D25183.id72808.diff (986 B)
Attached To
Mode
D25183: riscv: Use SBI shutdown call to implement RB_POWEROFF
Attached
Detach File
Event Timeline
Log In to Comment