idle_power4.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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/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. LOAD_REG_ADDRBASE(r3,cur_cpu_spec)
  38. ld r4,ADDROFF(cur_cpu_spec)(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. LOAD_REG_ADDRBASE(r3,powersave_nap)
  44. lwz r4,ADDROFF(powersave_nap)(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