Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  *  linux/arch/mips/sni/process.c
0004  *
0005  *  Reset a SNI machine.
0006  */
0007 #include <linux/delay.h>
0008 
0009 #include <asm/io.h>
0010 #include <asm/reboot.h>
0011 #include <asm/sni.h>
0012 
0013 /*
0014  * This routine reboots the machine by asking the keyboard
0015  * controller to pulse the reset-line low. We try that for a while,
0016  * and if it doesn't work, we do some other stupid things.
0017  */
0018 static inline void kb_wait(void)
0019 {
0020     int i;
0021 
0022     for (i = 0; i < 0x10000; i++)
0023         if ((inb_p(0x64) & 0x02) == 0)
0024             break;
0025 }
0026 
0027 /* XXX This ends up at the ARC firmware prompt ...  */
0028 void sni_machine_restart(char *command)
0029 {
0030     int i;
0031 
0032     /* This does a normal via the keyboard controller like a PC.
0033        We can do that easier ...  */
0034     local_irq_disable();
0035     for (;;) {
0036         for (i = 0; i < 100; i++) {
0037             kb_wait();
0038             udelay(50);
0039             outb_p(0xfe, 0x64);  /* pulse reset low */
0040             udelay(50);
0041         }
0042     }
0043 }
0044 
0045 void sni_machine_power_off(void)
0046 {
0047     *(volatile unsigned char *)PCIMT_CSWCSM = 0xfd;
0048 }