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/compiler.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/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) __noreturn;
  28. void machine_halt(void) __noreturn;
  29. void machine_power_off(void) __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. }