headsmp.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include <linux/linkage.h>
  2. #include <linux/init.h>
  3. #include "sleep.h"
  4. .section ".text.head", "ax"
  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. bl v7_invalidate_l1
  44. /* Enable coresight */
  45. mov32 r0, 0xC5ACCE55
  46. mcr p14, 0, r0, c7, c12, 6
  47. b secondary_startup
  48. ENDPROC(tegra_secondary_startup)