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