hotplug.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2002 ARM Ltd.
  3. * All Rights Reserved
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/errno.h>
  11. #include <linux/smp.h>
  12. #include <asm/smp_plat.h>
  13. #include "common.h"
  14. static inline void cpu_enter_lowpower(void)
  15. {
  16. }
  17. static inline void cpu_leave_lowpower(void)
  18. {
  19. }
  20. static inline void platform_do_lowpower(unsigned int cpu)
  21. {
  22. /* Just enter wfi for now. TODO: Properly shut off the cpu. */
  23. for (;;) {
  24. /*
  25. * here's the WFI
  26. */
  27. asm("wfi"
  28. :
  29. :
  30. : "memory", "cc");
  31. if (pen_release == cpu_logical_map(cpu)) {
  32. /*
  33. * OK, proper wakeup, we're done
  34. */
  35. break;
  36. }
  37. /*
  38. * getting here, means that we have come out of WFI without
  39. * having been woken up - this shouldn't happen
  40. *
  41. * The trouble is, letting people know about this is not really
  42. * possible, since we are currently running incoherently, and
  43. * therefore cannot safely call printk() or anything else
  44. */
  45. pr_debug("CPU%u: spurious wakeup call\n", cpu);
  46. }
  47. }
  48. /*
  49. * platform-specific code to shutdown a CPU
  50. *
  51. * Called with IRQs disabled
  52. */
  53. void __ref msm_cpu_die(unsigned int cpu)
  54. {
  55. /*
  56. * we're ready for shutdown now, so do it
  57. */
  58. cpu_enter_lowpower();
  59. platform_do_lowpower(cpu);
  60. /*
  61. * bring this CPU back into the world of cache
  62. * coherency, and then restore interrupts
  63. */
  64. cpu_leave_lowpower();
  65. }