proc-ucv2.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * linux/arch/unicore32/mm/proc-ucv2.S
  3. *
  4. * Code specific to PKUnity SoC and UniCore ISA
  5. *
  6. * Copyright (C) 2001-2010 GUAN Xue-tao
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/linkage.h>
  14. #include <asm/assembler.h>
  15. #include <asm/hwcap.h>
  16. #include <asm/pgtable-hwdef.h>
  17. #include <asm/pgtable.h>
  18. #include "proc-macros.S"
  19. ENTRY(cpu_proc_fin)
  20. stm.w (lr), [sp-]
  21. mov ip, #PSR_R_BIT | PSR_I_BIT | PRIV_MODE
  22. mov.a asr, ip
  23. b.l __cpuc_flush_kern_all
  24. ldm.w (pc), [sp]+
  25. /*
  26. * cpu_reset(loc)
  27. *
  28. * Perform a soft reset of the system. Put the CPU into the
  29. * same state as it would be if it had been reset, and branch
  30. * to what would be the reset vector.
  31. *
  32. * - loc - location to jump to for soft reset
  33. */
  34. .align 5
  35. ENTRY(cpu_reset)
  36. mov ip, #0
  37. movc p0.c5, ip, #28 @ Cache invalidate all
  38. nop8
  39. movc p0.c6, ip, #6 @ TLB invalidate all
  40. nop8
  41. movc ip, p0.c1, #0 @ ctrl register
  42. or ip, ip, #0x2000 @ vector base address
  43. andn ip, ip, #0x000f @ ............idam
  44. movc p0.c1, ip, #0 @ disable caches and mmu
  45. nop
  46. mov pc, r0 @ jump to loc
  47. nop8
  48. /*
  49. * cpu_do_idle()
  50. *
  51. * Idle the processor (eg, wait for interrupt).
  52. *
  53. * IRQs are already disabled.
  54. */
  55. ENTRY(cpu_do_idle)
  56. mov r0, #0 @ PCI address
  57. .rept 8
  58. ldw r1, [r0]
  59. .endr
  60. mov pc, lr
  61. ENTRY(cpu_dcache_clean_area)
  62. #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
  63. csub.a r1, #MAX_AREA_SIZE
  64. bsg 101f
  65. mov r9, #PAGE_SZ
  66. sub r9, r9, #1 @ PAGE_MASK
  67. 1: va2pa r0, r10, r11, r12, r13 @ r10 is PA
  68. b 3f
  69. 2: cand.a r0, r9
  70. beq 1b
  71. 3: movc p0.c5, r10, #11 @ clean D entry
  72. nop8
  73. add r0, r0, #CACHE_LINESIZE
  74. add r10, r10, #CACHE_LINESIZE
  75. sub.a r1, r1, #CACHE_LINESIZE
  76. bua 2b
  77. mov pc, lr
  78. #endif
  79. 101: mov ip, #0
  80. movc p0.c5, ip, #10 @ Dcache clean all
  81. nop8
  82. mov pc, lr
  83. /*
  84. * cpu_do_switch_mm(pgd_phys)
  85. *
  86. * Set the translation table base pointer to be pgd_phys
  87. *
  88. * - pgd_phys - physical address of new pgd
  89. *
  90. * It is assumed that:
  91. * - we are not using split page tables
  92. */
  93. .align 5
  94. ENTRY(cpu_do_switch_mm)
  95. movc p0.c2, r0, #0 @ update page table ptr
  96. nop8
  97. movc p0.c6, ip, #6 @ TLB invalidate all
  98. nop8
  99. mov pc, lr
  100. /*
  101. * cpu_set_pte(ptep, pte)
  102. *
  103. * Set a level 2 translation table entry.
  104. *
  105. * - ptep - pointer to level 2 translation table entry
  106. * - pte - PTE value to store
  107. */
  108. .align 5
  109. ENTRY(cpu_set_pte)
  110. stw r1, [r0]
  111. #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
  112. sub r2, r0, #PAGE_OFFSET
  113. movc p0.c5, r2, #11 @ Dcache clean line
  114. nop8
  115. #else
  116. mov ip, #0
  117. movc p0.c5, ip, #10 @ Dcache clean all
  118. nop8
  119. @dcacheline_flush r0, r2, ip
  120. #endif
  121. mov pc, lr