mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-24 18:38:38 +00:00
a12c53f4fa
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
/*
|
|
* 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>
|
|
#include <linux/reboot.h>
|
|
#include <asm/atomic.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/sigp.h>
|
|
#include <asm/smp.h>
|
|
|
|
#include "sclp.h"
|
|
|
|
/* Shutdown handler. Signal completion of shutdown by loading special PSW. */
|
|
static void
|
|
do_machine_quiesce(void)
|
|
{
|
|
psw_t quiesce_psw;
|
|
|
|
smp_send_stop();
|
|
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 = {
|
|
.receive_mask = EVTYP_SIGQUIESCE_MASK,
|
|
.receiver_fn = sclp_quiesce_handler
|
|
};
|
|
|
|
/* Initialize quiesce driver. */
|
|
static int __init
|
|
sclp_quiesce_init(void)
|
|
{
|
|
return sclp_register(&sclp_quiesce_event);
|
|
}
|
|
|
|
module_init(sclp_quiesce_init);
|