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