ip27-reset.c 1.8 KB

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