headsmp.S 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include <linux/linkage.h>
  2. #include <linux/init.h>
  3. .section ".text.head", "ax"
  4. __CPUINIT
  5. /*
  6. * Tegra specific entry point for secondary CPUs.
  7. * The secondary kernel init calls v7_flush_dcache_all before it enables
  8. * the L1; however, the L1 comes out of reset in an undefined state, so
  9. * the clean + invalidate performed by v7_flush_dcache_all causes a bunch
  10. * of cache lines with uninitialized data and uninitialized tags to get
  11. * written out to memory, which does really unpleasant things to the main
  12. * processor. We fix this by performing an invalidate, rather than a
  13. * clean + invalidate, before jumping into the kernel.
  14. */
  15. ENTRY(v7_invalidate_l1)
  16. mov r0, #0
  17. mcr p15, 2, r0, c0, c0, 0
  18. mrc p15, 1, r0, c0, c0, 0
  19. ldr r1, =0x7fff
  20. and r2, r1, r0, lsr #13
  21. ldr r1, =0x3ff
  22. and r3, r1, r0, lsr #3 @ NumWays - 1
  23. add r2, r2, #1 @ NumSets
  24. and r0, r0, #0x7
  25. add r0, r0, #4 @ SetShift
  26. clz r1, r3 @ WayShift
  27. add r4, r3, #1 @ NumWays
  28. 1: sub r2, r2, #1 @ NumSets--
  29. mov r3, r4 @ Temp = NumWays
  30. 2: subs r3, r3, #1 @ Temp--
  31. mov r5, r3, lsl r1
  32. mov r6, r2, lsl r0
  33. orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift)
  34. mcr p15, 0, r5, c7, c6, 2
  35. bgt 2b
  36. cmp r2, #0
  37. bgt 1b
  38. dsb
  39. isb
  40. mov pc, lr
  41. ENDPROC(v7_invalidate_l1)
  42. ENTRY(tegra_secondary_startup)
  43. msr cpsr_fsxc, #0xd3
  44. bl v7_invalidate_l1
  45. mrc p15, 0, r0, c0, c0, 5
  46. and r0, r0, #15
  47. ldr r1, =0x6000f100
  48. str r0, [r1]
  49. 1: ldr r2, [r1]
  50. cmp r0, r2
  51. beq 1b
  52. b secondary_startup
  53. ENDPROC(tegra_secondary_startup)