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/config.h>
  12. #include <linux/kernel.h>
  13. #include <linux/sched.h>
  14. #include <linux/timer.h>
  15. #include <linux/smp.h>
  16. #include <linux/mmzone.h>
  17. #include <linux/nodemask.h>
  18. #include <linux/pm.h>
  19. #include <asm/io.h>
  20. #include <asm/irq.h>
  21. #include <asm/reboot.h>
  22. #include <asm/system.h>
  23. #include <asm/sgialib.h>
  24. #include <asm/sn/addrs.h>
  25. #include <asm/sn/arch.h>
  26. #include <asm/sn/gda.h>
  27. #include <asm/sn/sn0/hub.h>
  28. void machine_restart(char *command) __attribute__((noreturn));
  29. void machine_halt(void) __attribute__((noreturn));
  30. void machine_power_off(void) __attribute__((noreturn));
  31. #define noreturn while(1); /* Silence gcc. */
  32. /* XXX How to pass the reboot command to the firmware??? */
  33. static void ip27_machine_restart(char *command)
  34. {
  35. #if 0
  36. int i;
  37. #endif
  38. printk("Reboot started from CPU %d\n", smp_processor_id());
  39. #ifdef CONFIG_SMP
  40. smp_send_stop();
  41. #endif
  42. #if 0
  43. for_each_online_node(i)
  44. REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
  45. PROMOP_REBOOT);
  46. #else
  47. LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
  48. #endif
  49. noreturn;
  50. }
  51. static void ip27_machine_halt(void)
  52. {
  53. int i;
  54. #ifdef CONFIG_SMP
  55. smp_send_stop();
  56. #endif
  57. for_each_online_node(i)
  58. REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
  59. PROMOP_RESTART);
  60. LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
  61. noreturn;
  62. }
  63. static void ip27_machine_power_off(void)
  64. {
  65. /* To do ... */
  66. noreturn;
  67. }
  68. void ip27_reboot_setup(void)
  69. {
  70. _machine_restart = ip27_machine_restart;
  71. _machine_halt = ip27_machine_halt;
  72. pm_power_off = ip27_machine_power_off;
  73. }