xref: /linux/arch/mips/sgi-ip27/ip27-reset.c (revision 8dd06ef34b6e2f41b29fbf5fc1663780f2524285)
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  */
11dd6e2db1SRalf 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>
25*b78e9d63SThomas Bogendoerfer #include <asm/sn/agent.h>
261da177e4SLinus Torvalds #include <asm/sn/arch.h>
271da177e4SLinus Torvalds #include <asm/sn/gda.h>
281da177e4SLinus Torvalds 
29249be563SThomas Bogendoerfer #include "ip27-common.h"
30249be563SThomas Bogendoerfer 
31dd6e2db1SRalf Baechle void machine_restart(char *command) __noreturn;
32dd6e2db1SRalf Baechle void machine_halt(void) __noreturn;
33dd6e2db1SRalf Baechle void machine_power_off(void) __noreturn;
341da177e4SLinus Torvalds 
351da177e4SLinus Torvalds #define noreturn while(1);				/* Silence gcc.	 */
361da177e4SLinus Torvalds 
371da177e4SLinus Torvalds /* XXX How to pass the reboot command to the firmware??? */
ip27_machine_restart(char * command)381da177e4SLinus Torvalds static void ip27_machine_restart(char *command)
391da177e4SLinus Torvalds {
401da177e4SLinus Torvalds #if 0
411da177e4SLinus Torvalds 	int i;
421da177e4SLinus Torvalds #endif
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds 	printk("Reboot started from CPU %d\n", smp_processor_id());
451da177e4SLinus Torvalds #ifdef CONFIG_SMP
461da177e4SLinus Torvalds 	smp_send_stop();
471da177e4SLinus Torvalds #endif
481da177e4SLinus Torvalds #if 0
491da177e4SLinus Torvalds 	for_each_online_node(i)
504bf841ebSThomas Bogendoerfer 		REMOTE_HUB_S(i, PROMOP_REG, PROMOP_REBOOT);
511da177e4SLinus Torvalds #else
521da177e4SLinus Torvalds 	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
531da177e4SLinus Torvalds #endif
541da177e4SLinus Torvalds 	noreturn;
551da177e4SLinus Torvalds }
561da177e4SLinus Torvalds 
ip27_machine_halt(void)571da177e4SLinus Torvalds static void ip27_machine_halt(void)
581da177e4SLinus Torvalds {
591da177e4SLinus Torvalds 	int i;
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds #ifdef CONFIG_SMP
621da177e4SLinus Torvalds 	smp_send_stop();
631da177e4SLinus Torvalds #endif
641da177e4SLinus Torvalds 	for_each_online_node(i)
654bf841ebSThomas Bogendoerfer 		REMOTE_HUB_S(i, PROMOP_REG, PROMOP_RESTART);
661da177e4SLinus Torvalds 	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
671da177e4SLinus Torvalds 	noreturn;
681da177e4SLinus Torvalds }
691da177e4SLinus Torvalds 
ip27_machine_power_off(void)701da177e4SLinus Torvalds static void ip27_machine_power_off(void)
711da177e4SLinus Torvalds {
721da177e4SLinus Torvalds 	/* To do ...  */
731da177e4SLinus Torvalds 	noreturn;
741da177e4SLinus Torvalds }
751da177e4SLinus Torvalds 
ip27_reboot_setup(void)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