idle_power4.S 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * This file contains the power_save function for 6xx & 7xxx CPUs
  3. * rewritten in assembler
  4. *
  5. * Warning ! This code assumes that if your machine has a 750fx
  6. * it will have PLL 1 set to low speed mode (used during NAP/DOZE).
  7. * if this is not the case some additional changes will have to
  8. * be done to check a runtime var (a bit like powersave-nap)
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #include <linux/config.h>
  16. #include <linux/threads.h>
  17. #include <asm/processor.h>
  18. #include <asm/page.h>
  19. #include <asm/cputable.h>
  20. #include <asm/thread_info.h>
  21. #include <asm/ppc_asm.h>
  22. #include <asm/offsets.h>
  23. #undef DEBUG
  24. .text
  25. /*
  26. * Here is the power_save_6xx function. This could eventually be
  27. * split into several functions & changing the function pointer
  28. * depending on the various features.
  29. */
  30. _GLOBAL(power4_idle)
  31. BEGIN_FTR_SECTION
  32. blr
  33. END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
  34. /* We must dynamically check for the NAP feature as it
  35. * can be cleared by CPU init after the fixups are done
  36. */
  37. LOADBASE(r3,cur_cpu_spec)
  38. ld r4,cur_cpu_spec@l(r3)
  39. ld r4,CPU_SPEC_FEATURES(r4)
  40. andi. r0,r4,CPU_FTR_CAN_NAP
  41. beqlr
  42. /* Now check if user or arch enabled NAP mode */
  43. LOADBASE(r3,powersave_nap)
  44. lwz r4,powersave_nap@l(r3)
  45. cmpwi 0,r4,0
  46. beqlr
  47. /* Clear MSR:EE */
  48. mfmsr r7
  49. li r4,0
  50. ori r4,r4,MSR_EE
  51. andc r0,r7,r4
  52. mtmsrd r0
  53. /* Check current_thread_info()->flags */
  54. clrrdi r4,r1,THREAD_SHIFT
  55. ld r4,TI_FLAGS(r4)
  56. andi. r0,r4,_TIF_NEED_RESCHED
  57. beq 1f
  58. mtmsrd r7 /* out of line this ? */
  59. blr
  60. 1:
  61. /* Go to NAP now */
  62. BEGIN_FTR_SECTION
  63. DSSALL
  64. sync
  65. END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  66. oris r7,r7,MSR_POW@h
  67. sync
  68. isync
  69. mtmsrd r7
  70. isync
  71. sync
  72. blr