ip27-reset.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Reset an IP27.
  7. *
  8. * Copyright (C) 1997, 1998, 1999, 2000, 06 by Ralf Baechle
  9. * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/sched.h>
  13. #include <linux/timer.h>
  14. #include <linux/smp.h>
  15. #include <linux/mmzone.h>
  16. #include <linux/nodemask.h>
  17. #include <linux/pm.h>
  18. #include <asm/io.h>
  19. #include <asm/irq.h>
  20. #include <asm/reboot.h>
  21. #include <asm/system.h>
  22. #include <asm/sgialib.h>
  23. #include <asm/sn/addrs.h>
  24. #include <asm/sn/arch.h>
  25. #include <asm/sn/gda.h>
  26. #include <asm/sn/sn0/hub.h>
  27. void machine_restart(char *command) __attribute__((noreturn));
  28. void machine_halt(void) __attribute__((noreturn));
  29. void machine_power_off(void) __attribute__((noreturn));
  30. #define noreturn while(1); /* Silence gcc. */
  31. /* XXX How to pass the reboot command to the firmware??? */
  32. static void ip27_machine_restart(char *command)
  33. {
  34. #if 0
  35. int i;
  36. #endif
  37. printk("Reboot started from CPU %d\n", smp_processor_id());
  38. #ifdef CONFIG_SMP
  39. smp_send_stop();
  40. #endif
  41. #if 0
  42. for_each_online_node(i)
  43. REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
  44. PROMOP_REBOOT);
  45. #else
  46. LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
  47. #endif
  48. noreturn;
  49. }
  50. static void ip27_machine_halt(void)
  51. {
  52. int i;
  53. #ifdef CONFIG_SMP
  54. smp_send_stop();
  55. #endif
  56. for_each_online_node(i)
  57. REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
  58. PROMOP_RESTART);
  59. LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
  60. noreturn;
  61. }
  62. static void ip27_machine_power_off(void)
  63. {
  64. /* To do ... */
  65. noreturn;
  66. }
  67. void ip27_reboot_setup(void)
  68. {
  69. _machine_restart = ip27_machine_restart;
  70. _machine_halt = ip27_machine_halt;
  71. pm_power_off = ip27_machine_power_off;
  72. }