Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Reset an IP27.
0007  *
0008  * Copyright (C) 1997, 1998, 1999, 2000, 06 by Ralf Baechle
0009  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
0010  */
0011 #include <linux/compiler.h>
0012 #include <linux/kernel.h>
0013 #include <linux/sched.h>
0014 #include <linux/timer.h>
0015 #include <linux/smp.h>
0016 #include <linux/mmzone.h>
0017 #include <linux/nodemask.h>
0018 #include <linux/pm.h>
0019 
0020 #include <asm/io.h>
0021 #include <asm/irq.h>
0022 #include <asm/reboot.h>
0023 #include <asm/sgialib.h>
0024 #include <asm/sn/addrs.h>
0025 #include <asm/sn/agent.h>
0026 #include <asm/sn/arch.h>
0027 #include <asm/sn/gda.h>
0028 
0029 #include "ip27-common.h"
0030 
0031 void machine_restart(char *command) __noreturn;
0032 void machine_halt(void) __noreturn;
0033 void machine_power_off(void) __noreturn;
0034 
0035 #define noreturn while(1);              /* Silence gcc.  */
0036 
0037 /* XXX How to pass the reboot command to the firmware??? */
0038 static void ip27_machine_restart(char *command)
0039 {
0040 #if 0
0041     int i;
0042 #endif
0043 
0044     printk("Reboot started from CPU %d\n", smp_processor_id());
0045 #ifdef CONFIG_SMP
0046     smp_send_stop();
0047 #endif
0048 #if 0
0049     for_each_online_node(i)
0050         REMOTE_HUB_S(i, PROMOP_REG, PROMOP_REBOOT);
0051 #else
0052     LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
0053 #endif
0054     noreturn;
0055 }
0056 
0057 static void ip27_machine_halt(void)
0058 {
0059     int i;
0060 
0061 #ifdef CONFIG_SMP
0062     smp_send_stop();
0063 #endif
0064     for_each_online_node(i)
0065         REMOTE_HUB_S(i, PROMOP_REG, PROMOP_RESTART);
0066     LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
0067     noreturn;
0068 }
0069 
0070 static void ip27_machine_power_off(void)
0071 {
0072     /* To do ...  */
0073     noreturn;
0074 }
0075 
0076 void ip27_reboot_setup(void)
0077 {
0078     _machine_restart = ip27_machine_restart;
0079     _machine_halt = ip27_machine_halt;
0080     pm_power_off = ip27_machine_power_off;
0081 }