xref: /linux/arch/mips/sgi-ip27/ip27-reset.c (revision dd6e2db13fdf7084779a4737cb8934550438954c)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * This file is subject to the terms and conditions of the GNU General Public
31da177e4SLinus Torvalds  * License.  See the file "COPYING" in the main directory of this archive
41da177e4SLinus Torvalds  * for more details.
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  * Reset an IP27.
71da177e4SLinus Torvalds  *
8fcdb27adSRalf Baechle  * Copyright (C) 1997, 1998, 1999, 2000, 06 by Ralf Baechle
91da177e4SLinus Torvalds  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
101da177e4SLinus Torvalds  */
11*dd6e2db1SRalf Baechle #include <linux/compiler.h>
121da177e4SLinus Torvalds #include <linux/kernel.h>
131da177e4SLinus Torvalds #include <linux/sched.h>
141da177e4SLinus Torvalds #include <linux/timer.h>
151da177e4SLinus Torvalds #include <linux/smp.h>
161da177e4SLinus Torvalds #include <linux/mmzone.h>
171da177e4SLinus Torvalds #include <linux/nodemask.h>
18fcdb27adSRalf Baechle #include <linux/pm.h>
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds #include <asm/io.h>
211da177e4SLinus Torvalds #include <asm/irq.h>
221da177e4SLinus Torvalds #include <asm/reboot.h>
231da177e4SLinus Torvalds #include <asm/sgialib.h>
241da177e4SLinus Torvalds #include <asm/sn/addrs.h>
251da177e4SLinus Torvalds #include <asm/sn/arch.h>
261da177e4SLinus Torvalds #include <asm/sn/gda.h>
271da177e4SLinus Torvalds #include <asm/sn/sn0/hub.h>
281da177e4SLinus Torvalds 
29*dd6e2db1SRalf Baechle void machine_restart(char *command) __noreturn;
30*dd6e2db1SRalf Baechle void machine_halt(void) __noreturn;
31*dd6e2db1SRalf Baechle void machine_power_off(void) __noreturn;
321da177e4SLinus Torvalds 
331da177e4SLinus Torvalds #define noreturn while(1);				/* Silence gcc.	 */
341da177e4SLinus Torvalds 
351da177e4SLinus Torvalds /* XXX How to pass the reboot command to the firmware??? */
361da177e4SLinus Torvalds static void ip27_machine_restart(char *command)
371da177e4SLinus Torvalds {
381da177e4SLinus Torvalds #if 0
391da177e4SLinus Torvalds 	int i;
401da177e4SLinus Torvalds #endif
411da177e4SLinus Torvalds 
421da177e4SLinus Torvalds 	printk("Reboot started from CPU %d\n", smp_processor_id());
431da177e4SLinus Torvalds #ifdef CONFIG_SMP
441da177e4SLinus Torvalds 	smp_send_stop();
451da177e4SLinus Torvalds #endif
461da177e4SLinus Torvalds #if 0
471da177e4SLinus Torvalds 	for_each_online_node(i)
481da177e4SLinus Torvalds 		REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
491da177e4SLinus Torvalds 							PROMOP_REBOOT);
501da177e4SLinus Torvalds #else
511da177e4SLinus Torvalds 	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
521da177e4SLinus Torvalds #endif
531da177e4SLinus Torvalds 	noreturn;
541da177e4SLinus Torvalds }
551da177e4SLinus Torvalds 
561da177e4SLinus Torvalds static void ip27_machine_halt(void)
571da177e4SLinus Torvalds {
581da177e4SLinus Torvalds 	int i;
591da177e4SLinus Torvalds 
601da177e4SLinus Torvalds #ifdef CONFIG_SMP
611da177e4SLinus Torvalds 	smp_send_stop();
621da177e4SLinus Torvalds #endif
631da177e4SLinus Torvalds 	for_each_online_node(i)
641da177e4SLinus Torvalds 		REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
651da177e4SLinus Torvalds 							PROMOP_RESTART);
661da177e4SLinus Torvalds 	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
671da177e4SLinus Torvalds 	noreturn;
681da177e4SLinus Torvalds }
691da177e4SLinus Torvalds 
701da177e4SLinus Torvalds static void ip27_machine_power_off(void)
711da177e4SLinus Torvalds {
721da177e4SLinus Torvalds 	/* To do ...  */
731da177e4SLinus Torvalds 	noreturn;
741da177e4SLinus Torvalds }
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds void ip27_reboot_setup(void)
771da177e4SLinus Torvalds {
781da177e4SLinus Torvalds 	_machine_restart = ip27_machine_restart;
791da177e4SLinus Torvalds 	_machine_halt = ip27_machine_halt;
80fcdb27adSRalf Baechle 	pm_power_off = ip27_machine_power_off;
811da177e4SLinus Torvalds }
82