idle.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * The idle loop for all SuperH platforms.
  3. *
  4. * Copyright (C) 2002 - 2009 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/init.h>
  12. #include <linux/mm.h>
  13. #include <linux/pm.h>
  14. #include <linux/tick.h>
  15. #include <linux/preempt.h>
  16. #include <linux/thread_info.h>
  17. #include <linux/irqflags.h>
  18. #include <linux/smp.h>
  19. #include <linux/atomic.h>
  20. #include <asm/pgalloc.h>
  21. #include <asm/smp.h>
  22. #include <asm/bl_bit.h>
  23. static void (*sh_idle)(void);
  24. void default_idle(void)
  25. {
  26. set_bl_bit();
  27. local_irq_enable();
  28. /* Isn't this racy ? */
  29. cpu_sleep();
  30. clear_bl_bit();
  31. }
  32. void arch_cpu_idle_dead(void)
  33. {
  34. play_dead();
  35. }
  36. void arch_cpu_idle(void)
  37. {
  38. sh_idle();
  39. }
  40. void __init select_idle_routine(void)
  41. {
  42. /*
  43. * If a platform has set its own idle routine, leave it alone.
  44. */
  45. if (!sh_idle)
  46. sh_idle = default_idle;
  47. }
  48. void stop_this_cpu(void *unused)
  49. {
  50. local_irq_disable();
  51. set_cpu_online(smp_processor_id(), false);
  52. for (;;)
  53. cpu_sleep();
  54. }