reset.c 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * linux/arch/mips/sni/process.c
  3. *
  4. * Reset a SNI machine.
  5. */
  6. #include <asm/io.h>
  7. #include <asm/reboot.h>
  8. #include <asm/sni.h>
  9. /*
  10. * This routine reboots the machine by asking the keyboard
  11. * controller to pulse the reset-line low. We try that for a while,
  12. * and if it doesn't work, we do some other stupid things.
  13. */
  14. static inline void kb_wait(void)
  15. {
  16. int i;
  17. for (i = 0; i < 0x10000; i++)
  18. if ((inb_p(0x64) & 0x02) == 0)
  19. break;
  20. }
  21. /* XXX This ends up at the ARC firmware prompt ... */
  22. void sni_machine_restart(char *command)
  23. {
  24. int i, j;
  25. /* This does a normal via the keyboard controller like a PC.
  26. We can do that easier ... */
  27. local_irq_disable();
  28. for (;;) {
  29. for (i = 0; i < 100; i++) {
  30. kb_wait();
  31. for (j = 0; j < 100000 ; j++)
  32. /* nothing */;
  33. outb_p(0xfe, 0x64); /* pulse reset low */
  34. }
  35. }
  36. }
  37. void sni_machine_power_off(void)
  38. {
  39. *(volatile unsigned char *)PCIMT_CSWCSM = 0xfd;
  40. }