update checkpatch.pl to version 0.05
[pv_ops_mirror.git] / drivers / s390 / char / sclp_quiesce.c
blob45ff25e787cbdad96659617eee981d6854e02700
1 /*
2 * drivers/s390/char/sclp_quiesce.c
3 * signal quiesce handler
5 * (C) Copyright IBM Corp. 1999,2004
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 * Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
8 */
10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <linux/cpumask.h>
13 #include <linux/smp.h>
14 #include <linux/init.h>
15 #include <linux/reboot.h>
16 #include <asm/atomic.h>
17 #include <asm/ptrace.h>
18 #include <asm/sigp.h>
19 #include <asm/smp.h>
21 #include "sclp.h"
23 /* Shutdown handler. Signal completion of shutdown by loading special PSW. */
24 static void
25 do_machine_quiesce(void)
27 psw_t quiesce_psw;
29 smp_send_stop();
30 quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT;
31 quiesce_psw.addr = 0xfff;
32 __load_psw(quiesce_psw);
35 /* Handler for quiesce event. Start shutdown procedure. */
36 static void
37 sclp_quiesce_handler(struct evbuf_header *evbuf)
39 _machine_restart = (void *) do_machine_quiesce;
40 _machine_halt = do_machine_quiesce;
41 _machine_power_off = do_machine_quiesce;
42 ctrl_alt_del();
45 static struct sclp_register sclp_quiesce_event = {
46 .receive_mask = EVTYP_SIGQUIESCE_MASK,
47 .receiver_fn = sclp_quiesce_handler
50 /* Initialize quiesce driver. */
51 static int __init
52 sclp_quiesce_init(void)
54 int rc;
56 rc = sclp_register(&sclp_quiesce_event);
57 if (rc)
58 printk(KERN_WARNING "sclp: could not register quiesce handler "
59 "(rc=%d)\n", rc);
60 return rc;
63 module_init(sclp_quiesce_init);