arm.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * Program Status Registers
  3. */
  4. #define PsrMusr 0x00000010 /* mode */
  5. #define PsrMfiq 0x00000011
  6. #define PsrMirq 0x00000012
  7. #define PsrMsvc 0x00000013
  8. #define PsrMabt 0x00000017
  9. #define PsrMund 0x0000001B
  10. #define PsrMsys 0x0000001F
  11. #define PsrMask 0x0000001F
  12. #define PsrDfiq 0x00000040 /* disable FIQ interrupts */
  13. #define PsrDirq 0x00000080 /* disable IRQ interrupts */
  14. #define PsrV 0x10000000 /* overflow */
  15. #define PsrC 0x20000000 /* carry/borrow/extend */
  16. #define PsrZ 0x40000000 /* zero */
  17. #define PsrN 0x80000000 /* negative/less than */
  18. /*
  19. * Coprocessors
  20. */
  21. #define CpFP 10 /* float FP, VFP cfg. */
  22. #define CpDFP 11 /* double FP */
  23. #define CpSC 15 /* System Control */
  24. /*
  25. * opcode 1
  26. */
  27. #define CpDef 0 /* default */
  28. #define CpL2 1 /* L2 cache operations */
  29. /*
  30. * Primary (CRn) CpSC registers.
  31. */
  32. #define CpID 0 /* ID and cache type */
  33. #define CpCONTROL 1 /* miscellaneous control */
  34. #define CpTTB 2 /* Translation Table Base */
  35. #define CpDAC 3 /* Domain Access Control */
  36. #define CpFSR 5 /* Fault Status */
  37. #define CpFAR 6 /* Fault Address */
  38. #define CpCACHE 7 /* cache/write buffer control */
  39. #define CpTLB 8 /* TLB control */
  40. #define CpCLD 9 /* Cache Lockdown */
  41. #define CpTLD 10 /* TLB Lockdown */
  42. #define CpPID 13 /* Process ID */
  43. #define CpTESTCFG 15 /* test config. (arm926) */
  44. /*
  45. * CpID Secondary (CRm) registers.
  46. */
  47. #define CpIDidct 0
  48. /*
  49. * CpID op1==0 opcode2 fields.
  50. */
  51. #define CpIDid 0 /* main ID */
  52. #define CpIDct 1 /* cache type */
  53. /*
  54. * CpCONTROL
  55. */
  56. #define CpCmmu 0x00000001 /* M: MMU enable */
  57. #define CpCalign 0x00000002 /* A: alignment fault enable */
  58. #define CpCdcache 0x00000004 /* C: data cache on */
  59. #define CpCwb 0x00000008 /* W: write buffer turned on */
  60. #define CpCi32 0x00000010 /* P: 32-bit program space */
  61. #define CpCd32 0x00000020 /* D: 32-bit data space */
  62. #define CpCbe 0x00000080 /* B: big-endian operation */
  63. #define CpCsystem 0x00000100 /* S: system permission */
  64. #define CpCrom 0x00000200 /* R: ROM permission */
  65. #define CpCicache 0x00001000 /* I: instruction cache on */
  66. #define CpChv 0x00002000 /* V: high vectors */
  67. /*
  68. * CpCACHE Secondary (CRm) registers and opcode2 fields.
  69. * In ARM-speak, 'flush' means invalidate and 'clean' means writeback.
  70. * In arm arch v6, these must be available in user mode:
  71. * CpCACHEinvi, CpCACHEwait (prefetch flush)
  72. * CpCACHEwb, CpCACHEwait (DSB: data sync barrier)
  73. * CpCACHEwb, CpCACHEdmbarr (DMB: data memory barrier)
  74. */
  75. #define CpCACHEintr 0 /* interrupt */
  76. #define CpCACHEinvi 5 /* instruction */
  77. #define CpCACHEinvd 6 /* data */
  78. #define CpCACHEinvu 7 /* unified (I+D) */
  79. #define CpCACHEwb 10 /* writeback D */
  80. #define CpCACHEwbu 11 /* writeback U (not 926ejs) */
  81. #define CpCACHEwbi 14 /* writeback D + invalidate */
  82. #define CpCACHEwbui 15 /* writeback U + inval (not 926ejs) */
  83. /*
  84. * the 926ejs manual says that we can't use CpCACHEall nor CpCACHEwait
  85. * for writeback operations on the 926ejs, except for CpCACHEwb + CpCACHEwait,
  86. * which means `drain write buffer'.
  87. */
  88. #define CpCACHEall 0 /* entire */
  89. #define CpCACHEse 1 /* single entry */
  90. #define CpCACHEsi 2 /* set/index */
  91. #define CpCACHEtest 3 /* test loop */
  92. #define CpCACHEwait 4 /* wait */
  93. #define CpCACHEdmbarr 5 /* wb: data memory barrier */
  94. /*
  95. * CpTLB Secondary (CRm) registers and opcode2 fields.
  96. */
  97. #define CpTLBinvi 5 /* instruction */
  98. #define CpTLBinvd 6 /* data */
  99. #define CpTLBinvu 7 /* unified */
  100. #define CpTLBinv 0 /* invalidate all */
  101. #define CpTLBinvse 1 /* invalidate single entry */
  102. /*
  103. * CpTESTCFG Secondary (CRm) registers and opcode2 fields; sheeva only.
  104. * opcode1 == CpL2 (1). L2 cache operations block the CPU until finished.
  105. * Specifically, write-back (clean) blocks until all dirty lines have been
  106. * drained from the L2 buffers.
  107. */
  108. #define CpTCl2cfg 1
  109. #define CpTCl2flush 9 /* cpu blocks until flush done */
  110. #define CpTCl2waylck 10
  111. #define CpTCl2inv 11
  112. #define CpTCl2perfctl 12
  113. #define CpTCl2perfcnt 13
  114. /* CpTCl2cfg */
  115. #define CpTCl2conf 0
  116. /* CpTCl2conf bits */
  117. #define CpTCldcstream (1<<29) /* D cache streaming switch */
  118. #define CpTCl2wralloc (1<<28) /* cache write allocate */
  119. #define CpTCl2prefdis (1<<24) /* l2 cache prefetch disable */
  120. #define CpTCl2ena (1<<22) /* l2 cache enable */
  121. /* CpTCl2flush & CpTCl2inv */
  122. #define CpTCl2all 0
  123. #define CpTCl2seva 1
  124. #define CpTCl2way 2
  125. #define CpTCl2sepa 3
  126. #define CpTCl2valow 4
  127. #define CpTCl2vahigh 5 /* also triggers flush or inv */
  128. /* CpTCl2flush
  129. #define CpTCecccnt 6 /* ecc error count */
  130. #define CpTCeccthr 7 /* ecc error threshold */
  131. /* CpTCl2waylck */
  132. #define CpTCl2waylock 7
  133. /* CpTCl2inv */
  134. #define CpTCl2erraddr 7 /* ecc error address */
  135. /* CpTCl2perfctl */
  136. #define CpTCl2perf0ctl 0
  137. #define CpTCl2perf1ctl 1
  138. /* CpTCl2perfcnt */
  139. #define CpTCl2perf0low 0
  140. #define CpTCl2perf0high 1
  141. #define CpTCl2perf1low 2
  142. #define CpTCl2perf1high 3
  143. /*
  144. * MMU page table entries.
  145. * Mbo (0x10) bit is implementation-defined and mandatory on some pre-v7 arms.
  146. */
  147. #define Mbo 0x10 /* must be 1 on earlier arms */
  148. #define Fault 0x00000000 /* L[12] pte: unmapped */
  149. #define Coarse (Mbo|1) /* L1 */
  150. #define Section (Mbo|2) /* L1 1MB */
  151. #define Fine (Mbo|3) /* L1 */
  152. #define Large 0x00000001u /* L2 64KB */
  153. #define Small 0x00000002u /* L2 4KB */
  154. #define Tiny 0x00000003u /* L2 1KB, deprecated */
  155. #define Buffered 0x00000004u /* L[12]: write-back not -thru */
  156. #define Cached 0x00000008u /* L[12] */
  157. #define Dom0 0
  158. #define Noaccess 0 /* AP, DAC */
  159. #define Krw 1 /* AP */
  160. #define Uro 2 /* AP */
  161. #define Urw 3 /* AP */
  162. #define Client 1 /* DAC */
  163. #define Manager 3 /* DAC */
  164. #define AP(n, v) F((v), ((n)*2)+4, 2)
  165. #define L1AP(ap) (AP(3, (ap))) /* in L1, only Sections have AP */
  166. #define L2AP(ap) (AP(3, (ap))|AP(2, (ap))|AP(1, (ap))|AP(0, (ap))) /* pre-armv7 */
  167. #define DAC(n, v) F((v), (n)*2, 2)
  168. #define HVECTORS 0xffff0000 /* addr of vectors */