1 // SPDX-License-Identifier: GPL-2.0
3 * signal quiesce handler
5 * Copyright IBM Corp. 1999, 2004
10 #include <linux/types.h>
11 #include <linux/cpumask.h>
12 #include <linux/smp.h>
13 #include <linux/init.h>
14 #include <linux/reboot.h>
15 #include <linux/atomic.h>
16 #include <asm/ptrace.h>
21 /* Shutdown handler. Signal completion of shutdown by loading special PSW. */
22 static void do_machine_quiesce(void)
28 PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA | PSW_MASK_WAIT;
29 quiesce_psw.addr = 0xfff;
30 __load_psw(quiesce_psw);
33 /* Handler for quiesce event. Start shutdown procedure. */
34 static void sclp_quiesce_handler(struct evbuf_header *evbuf)
36 _machine_restart = (void *) do_machine_quiesce;
37 _machine_halt = do_machine_quiesce;
38 _machine_power_off = do_machine_quiesce;
42 static struct sclp_register sclp_quiesce_event = {
43 .receive_mask = EVTYP_SIGQUIESCE_MASK,
44 .receiver_fn = sclp_quiesce_handler,
47 /* Initialize quiesce driver. */
48 static int __init sclp_quiesce_init(void)
50 return sclp_register(&sclp_quiesce_event);
52 device_initcall(sclp_quiesce_init);