ip27-reset.c 1.7 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/agent.h>
  25. #include <asm/sn/arch.h>
  26. #include <asm/sn/gda.h>
  27. #include "ip27-common.h"
  28. void machine_restart(char *command) __noreturn;
  29. void machine_halt(void) __noreturn;
  30. void machine_power_off(void) __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(i, PROMOP_REG, 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(i, PROMOP_REG, 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. }