idle_power4.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #include <asm/irqflags.h>
  17. #undef DEBUG
  18. .text
  19. _GLOBAL(power4_idle)
  20. BEGIN_FTR_SECTION
  21. blr
  22. END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
  23. /* Now check if user or arch enabled NAP mode */
  24. LOAD_REG_ADDRBASE(r3,powersave_nap)
  25. lwz r4,ADDROFF(powersave_nap)(r3)
  26. cmpwi 0,r4,0
  27. beqlr
  28. /* Hard disable interrupts */
  29. mfmsr r7
  30. rldicl r0,r7,48,1
  31. rotldi r0,r0,16
  32. mtmsrd r0,1
  33. /* Check if something happened while soft-disabled */
  34. lbz r0,PACAIRQHAPPENED(r13)
  35. cmpwi cr0,r0,0
  36. bnelr
  37. /* Soft-enable interrupts */
  38. #ifdef CONFIG_TRACE_IRQFLAGS
  39. mflr r0
  40. std r0,16(r1)
  41. stdu r1,-128(r1)
  42. bl trace_hardirqs_on
  43. addi r1,r1,128
  44. ld r0,16(r1)
  45. mtlr r0
  46. mfmsr r7
  47. #endif /* CONFIG_TRACE_IRQFLAGS */
  48. li r0,1
  49. stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */
  50. BEGIN_FTR_SECTION
  51. DSSALL
  52. sync
  53. END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  54. CURRENT_THREAD_INFO(r9, r1)
  55. ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
  56. ori r8,r8,_TLF_NAPPING /* so when we take an exception */
  57. std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
  58. ori r7,r7,MSR_EE
  59. oris r7,r7,MSR_POW@h
  60. 1: sync
  61. isync
  62. mtmsrd r7
  63. isync
  64. b 1b