proc-arm720.S 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /*
  2. * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720
  3. *
  4. * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
  5. * Rob Scott (rscott@mtrob.fdns.net)
  6. * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd.
  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 as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. *
  23. * These are the low level assembler for performing cache and TLB
  24. * functions on the ARM720T. The ARM720T has a writethrough IDC
  25. * cache, so we don't need to clean it.
  26. *
  27. * Changelog:
  28. * 05-09-2000 SJH Created by moving 720 specific functions
  29. * out of 'proc-arm6,7.S' per RMK discussion
  30. * 07-25-2000 SJH Added idle function.
  31. * 08-25-2000 DBS Updated for integration of ARM Ltd version.
  32. */
  33. #include <linux/linkage.h>
  34. #include <linux/init.h>
  35. #include <asm/assembler.h>
  36. #include <asm/asm-offsets.h>
  37. #include <asm/pgtable.h>
  38. #include <asm/procinfo.h>
  39. #include <asm/ptrace.h>
  40. /*
  41. * Function: arm720_proc_init (void)
  42. * : arm720_proc_fin (void)
  43. *
  44. * Notes : This processor does not require these
  45. */
  46. ENTRY(cpu_arm720_dcache_clean_area)
  47. ENTRY(cpu_arm720_proc_init)
  48. mov pc, lr
  49. ENTRY(cpu_arm720_proc_fin)
  50. stmfd sp!, {lr}
  51. mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
  52. msr cpsr_c, ip
  53. mrc p15, 0, r0, c1, c0, 0
  54. bic r0, r0, #0x1000 @ ...i............
  55. bic r0, r0, #0x000e @ ............wca.
  56. mcr p15, 0, r0, c1, c0, 0 @ disable caches
  57. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  58. ldmfd sp!, {pc}
  59. /*
  60. * Function: arm720_proc_do_idle(void)
  61. * Params : r0 = unused
  62. * Purpose : put the processer in proper idle mode
  63. */
  64. ENTRY(cpu_arm720_do_idle)
  65. mov pc, lr
  66. /*
  67. * Function: arm720_switch_mm(unsigned long pgd_phys)
  68. * Params : pgd_phys Physical address of page table
  69. * Purpose : Perform a task switch, saving the old process' state and restoring
  70. * the new.
  71. */
  72. ENTRY(cpu_arm720_switch_mm)
  73. mov r1, #0
  74. mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
  75. mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
  76. mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
  77. mov pc, lr
  78. /*
  79. * Function: arm720_set_pte(pte_t *ptep, pte_t pte)
  80. * Params : r0 = Address to set
  81. * : r1 = value to set
  82. * Purpose : Set a PTE and flush it out of any WB cache
  83. */
  84. .align 5
  85. ENTRY(cpu_arm720_set_pte)
  86. str r1, [r0], #-2048 @ linux version
  87. eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
  88. bic r2, r1, #PTE_SMALL_AP_MASK
  89. bic r2, r2, #PTE_TYPE_MASK
  90. orr r2, r2, #PTE_TYPE_SMALL
  91. tst r1, #L_PTE_USER @ User?
  92. orrne r2, r2, #PTE_SMALL_AP_URO_SRW
  93. tst r1, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
  94. orreq r2, r2, #PTE_SMALL_AP_UNO_SRW
  95. tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young
  96. movne r2, #0
  97. str r2, [r0] @ hardware version
  98. mov pc, lr
  99. /*
  100. * Function: arm720_reset
  101. * Params : r0 = address to jump to
  102. * Notes : This sets up everything for a reset
  103. */
  104. ENTRY(cpu_arm720_reset)
  105. mov ip, #0
  106. mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
  107. mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
  108. mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
  109. bic ip, ip, #0x000f @ ............wcam
  110. bic ip, ip, #0x2100 @ ..v....s........
  111. mcr p15, 0, ip, c1, c0, 0 @ ctrl register
  112. mov pc, r0
  113. __INIT
  114. .type __arm710_setup, #function
  115. __arm710_setup:
  116. mov r0, #0
  117. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  118. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  119. mrc p15, 0, r0, c1, c0 @ get control register
  120. ldr r5, arm710_cr1_clear
  121. bic r0, r0, r5
  122. ldr r5, arm710_cr1_set
  123. orr r0, r0, r5
  124. mov pc, lr @ __ret (head.S)
  125. .size __arm710_setup, . - __arm710_setup
  126. /*
  127. * R
  128. * .RVI ZFRS BLDP WCAM
  129. * .... 0001 ..11 1101
  130. *
  131. */
  132. .type arm710_cr1_clear, #object
  133. .type arm710_cr1_set, #object
  134. arm710_cr1_clear:
  135. .word 0x0f3f
  136. arm710_cr1_set:
  137. .word 0x013d
  138. .type __arm720_setup, #function
  139. __arm720_setup:
  140. mov r0, #0
  141. mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
  142. mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
  143. mrc p15, 0, r0, c1, c0 @ get control register
  144. ldr r5, arm720_cr1_clear
  145. bic r0, r0, r5
  146. ldr r5, arm720_cr1_set
  147. orr r0, r0, r5
  148. mov pc, lr @ __ret (head.S)
  149. .size __arm720_setup, . - __arm720_setup
  150. /*
  151. * R
  152. * .RVI ZFRS BLDP WCAM
  153. * ..1. 1001 ..11 1101
  154. *
  155. */
  156. .type arm720_cr1_clear, #object
  157. .type arm720_cr1_set, #object
  158. arm720_cr1_clear:
  159. .word 0x2f3f
  160. arm720_cr1_set:
  161. .word 0x213d
  162. __INITDATA
  163. /*
  164. * Purpose : Function pointers used to access above functions - all calls
  165. * come through these
  166. */
  167. .type arm720_processor_functions, #object
  168. ENTRY(arm720_processor_functions)
  169. .word v4t_late_abort
  170. .word cpu_arm720_proc_init
  171. .word cpu_arm720_proc_fin
  172. .word cpu_arm720_reset
  173. .word cpu_arm720_do_idle
  174. .word cpu_arm720_dcache_clean_area
  175. .word cpu_arm720_switch_mm
  176. .word cpu_arm720_set_pte
  177. .size arm720_processor_functions, . - arm720_processor_functions
  178. .section ".rodata"
  179. .type cpu_arch_name, #object
  180. cpu_arch_name: .asciz "armv4t"
  181. .size cpu_arch_name, . - cpu_arch_name
  182. .type cpu_elf_name, #object
  183. cpu_elf_name: .asciz "v4"
  184. .size cpu_elf_name, . - cpu_elf_name
  185. .type cpu_arm710_name, #object
  186. cpu_arm710_name:
  187. .asciz "ARM710T"
  188. .size cpu_arm710_name, . - cpu_arm710_name
  189. .type cpu_arm720_name, #object
  190. cpu_arm720_name:
  191. .asciz "ARM720T"
  192. .size cpu_arm720_name, . - cpu_arm720_name
  193. .align
  194. /*
  195. * See linux/include/asm-arm/procinfo.h for a definition of this structure.
  196. */
  197. .section ".proc.info.init", #alloc, #execinstr
  198. .type __arm710_proc_info, #object
  199. __arm710_proc_info:
  200. .long 0x41807100 @ cpu_val
  201. .long 0xffffff00 @ cpu_mask
  202. .long PMD_TYPE_SECT | \
  203. PMD_SECT_BUFFERABLE | \
  204. PMD_SECT_CACHEABLE | \
  205. PMD_BIT4 | \
  206. PMD_SECT_AP_WRITE | \
  207. PMD_SECT_AP_READ
  208. b __arm710_setup @ cpu_flush
  209. .long cpu_arch_name @ arch_name
  210. .long cpu_elf_name @ elf_name
  211. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  212. .long cpu_arm710_name @ name
  213. .long arm720_processor_functions
  214. .long v4_tlb_fns
  215. .long v4wt_user_fns
  216. .long v4_cache_fns
  217. .size __arm710_proc_info, . - __arm710_proc_info
  218. .type __arm720_proc_info, #object
  219. __arm720_proc_info:
  220. .long 0x41807200 @ cpu_val
  221. .long 0xffffff00 @ cpu_mask
  222. .long PMD_TYPE_SECT | \
  223. PMD_SECT_BUFFERABLE | \
  224. PMD_SECT_CACHEABLE | \
  225. PMD_BIT4 | \
  226. PMD_SECT_AP_WRITE | \
  227. PMD_SECT_AP_READ
  228. b __arm720_setup @ cpu_flush
  229. .long cpu_arch_name @ arch_name
  230. .long cpu_elf_name @ elf_name
  231. .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
  232. .long cpu_arm720_name @ name
  233. .long arm720_processor_functions
  234. .long v4_tlb_fns
  235. .long v4wt_user_fns
  236. .long v4_cache_fns
  237. .size __arm720_proc_info, . - __arm720_proc_info