1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License.  See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Reset an IP27.
7 *
8 * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */
11#include <linux/config.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/timer.h>
15#include <linux/smp.h>
16#include <linux/mmzone.h>
17
18#include <asm/io.h>
19#include <asm/irq.h>
20#include <asm/reboot.h>
21#include <asm/system.h>
22#include <asm/sgialib.h>
23#include <asm/sn/addrs.h>
24#include <asm/sn/arch.h>
25#include <asm/sn/gda.h>
26#include <asm/sn/sn0/hub.h>
27
28void machine_restart(char *command) __attribute__((noreturn));
29void machine_halt(void) __attribute__((noreturn));
30void machine_power_off(void) __attribute__((noreturn));
31
32#define noreturn while(1);				/* Silence gcc.  */
33
34static void ip27_machine_restart(char *command)
35{
36
37	printk("Reboot started from CPU %d\n", smp_processor_id());
38#ifdef CONFIG_SMP
39	smp_send_stop();
40#endif
41	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
42	noreturn;
43}
44
45static void ip27_machine_halt(void)
46{
47	int i;
48
49#ifdef CONFIG_SMP
50	smp_send_stop();
51#endif
52	for (i = 0; i < numnodes; i++)
53		REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
54							PROMOP_RESTART);
55	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
56	noreturn;
57}
58
59static void ip27_machine_power_off(void)
60{
61	/* To do ...  */
62	noreturn;
63}
64
65void ip27_reboot_setup(void)
66{
67	_machine_restart = ip27_machine_restart;
68	_machine_halt = ip27_machine_halt;
69	_machine_power_off = ip27_machine_power_off;
70}
71