2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* drivers/s390/char/sclp_quiesce.c
|
|
|
|
* signal quiesce handler
|
|
|
|
*
|
|
|
|
* (C) Copyright IBM Corp. 1999,2004
|
|
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
|
|
* Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/cpumask.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/init.h>
|
2006-06-25 14:47:41 +02:00
|
|
|
#include <linux/reboot.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <asm/atomic.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/sigp.h>
|
2007-02-21 10:55:03 +01:00
|
|
|
#include <asm/smp.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#include "sclp.h"
|
|
|
|
|
|
|
|
/* Shutdown handler. Signal completion of shutdown by loading special PSW. */
|
|
|
|
static void
|
|
|
|
do_machine_quiesce(void)
|
|
|
|
{
|
|
|
|
psw_t quiesce_psw;
|
|
|
|
|
2006-12-04 15:40:33 +01:00
|
|
|
smp_send_stop();
|
2005-04-17 00:20:36 +02:00
|
|
|
quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT;
|
|
|
|
quiesce_psw.addr = 0xfff;
|
|
|
|
__load_psw(quiesce_psw);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handler for quiesce event. Start shutdown procedure. */
|
|
|
|
static void
|
|
|
|
sclp_quiesce_handler(struct evbuf_header *evbuf)
|
|
|
|
{
|
|
|
|
_machine_restart = (void *) do_machine_quiesce;
|
|
|
|
_machine_halt = do_machine_quiesce;
|
|
|
|
_machine_power_off = do_machine_quiesce;
|
|
|
|
ctrl_alt_del();
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct sclp_register sclp_quiesce_event = {
|
2007-04-27 16:01:53 +02:00
|
|
|
.receive_mask = EVTYP_SIGQUIESCE_MASK,
|
2005-04-17 00:20:36 +02:00
|
|
|
.receiver_fn = sclp_quiesce_handler
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Initialize quiesce driver. */
|
|
|
|
static int __init
|
|
|
|
sclp_quiesce_init(void)
|
|
|
|
{
|
2008-07-14 09:59:28 +02:00
|
|
|
return sclp_register(&sclp_quiesce_event);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(sclp_quiesce_init);
|