idle_power4.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * This file contains the power_save function for 970-family CPUs.
  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; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/threads.h>
  10. #include <asm/processor.h>
  11. #include <asm/page.h>
  12. #include <asm/cputable.h>
  13. #include <asm/thread_info.h>
  14. #include <asm/ppc_asm.h>
  15. #include <asm/asm-offsets.h>
  16. #undef DEBUG
  17. .text
  18. _GLOBAL(power4_idle)
  19. BEGIN_FTR_SECTION
  20. blr
  21. END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
  22. /* Now check if user or arch enabled NAP mode */
  23. LOAD_REG_ADDRBASE(r3,powersave_nap)
  24. lwz r4,ADDROFF(powersave_nap)(r3)
  25. cmpwi 0,r4,0
  26. beqlr
  27. /* Go to NAP now */
  28. mfmsr r7
  29. rldicl r0,r7,48,1
  30. rotldi r0,r0,16
  31. mtmsrd r0,1 /* hard-disable interrupts */
  32. li r0,1
  33. stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */
  34. stb r0,PACAHARDIRQEN(r13)
  35. BEGIN_FTR_SECTION
  36. DSSALL
  37. sync
  38. END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  39. clrrdi r9,r1,THREAD_SHIFT /* current thread_info */
  40. ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
  41. ori r8,r8,_TLF_NAPPING /* so when we take an exception */
  42. std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
  43. ori r7,r7,MSR_EE
  44. oris r7,r7,MSR_POW@h
  45. 1: sync
  46. isync
  47. mtmsrd r7
  48. isync
  49. b 1b
  50. _GLOBAL(power4_cpu_offline_powersave)
  51. /* Go to NAP now */
  52. mfmsr r7
  53. rldicl r0,r7,48,1
  54. rotldi r0,r0,16
  55. mtmsrd r0,1 /* hard-disable interrupts */
  56. li r0,1
  57. li r6,0
  58. stb r0,PACAHARDIRQEN(r13) /* we'll hard-enable shortly */
  59. stb r6,PACASOFTIRQEN(r13) /* soft-disable irqs */
  60. BEGIN_FTR_SECTION
  61. DSSALL
  62. sync
  63. END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  64. ori r7,r7,MSR_EE
  65. oris r7,r7,MSR_POW@h
  66. sync
  67. isync
  68. mtmsrd r7
  69. isync
  70. blr