@@ -25,6 +25,7 @@
#include <linux/sched.h>
#include <linux/sched/clock.h>
#include <linux/start_kernel.h>
+#include <linux/reboot.h>
#include <asm/cacheflush.h>
#include <asm/processor.h>
@@ -235,6 +236,13 @@ static int __init parisc_init_resources(void)
return 0;
}
+static int qemu_power_off(struct sys_off_data *data)
+{
+ /* call qemu artificial "system halt" instruction */
+ asm volatile(".word 0xfffdead0": : :"memory");
+ return NOTIFY_DONE;
+}
+
static int __init parisc_init(void)
{
u32 osid = (OS_ID_LINUX << 16);
@@ -242,6 +250,11 @@ static int __init parisc_init(void)
parisc_init_resources();
do_device_inventory(); /* probe for hardware */
+ /* register QEMU power off function */
+ if (running_on_qemu)
+ register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+ SYS_OFF_PRIO_DEFAULT, qemu_power_off, NULL);
+
parisc_pdc_chassis_init();
/* set up a new led state on systems shipped LED State panel */
When running on qemu, use the artificial "system halt" instruction to power the system off. Signed-off-by: Helge Deller <deller@gmx.de>