reboot.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #include <linux/stddef.h>
  15. #include <linux/reboot.h>
  16. #include <linux/smp.h>
  17. #include <asm/page.h>
  18. #include <asm/setup.h>
  19. #include <hv/hypervisor.h>
  20. #ifndef CONFIG_SMP
  21. #define smp_send_stop()
  22. #endif
  23. void machine_halt(void)
  24. {
  25. warn_early_printk();
  26. raw_local_irq_disable_all();
  27. smp_send_stop();
  28. hv_halt();
  29. }
  30. void machine_power_off(void)
  31. {
  32. warn_early_printk();
  33. raw_local_irq_disable_all();
  34. smp_send_stop();
  35. hv_power_off();
  36. }
  37. void machine_restart(char *cmd)
  38. {
  39. raw_local_irq_disable_all();
  40. smp_send_stop();
  41. hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
  42. }
  43. /*
  44. * Power off function, if any
  45. */
  46. void (*pm_power_off)(void) = machine_power_off;