bitfield.h 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2005-2017 Andes Technology Corporation
  3. #ifndef __NDS32_BITFIELD_H__
  4. #define __NDS32_BITFIELD_H__
  5. /******************************************************************************
  6. * cr0: CPU_VER (CPU Version Register)
  7. *****************************************************************************/
  8. #define CPU_VER_offCFGID 0 /* Minor configuration */
  9. #define CPU_VER_offREV 16 /* Revision of the CPU version */
  10. #define CPU_VER_offCPUID 24 /* Major CPU versions */
  11. #define CPU_VER_mskCFGID ( 0xFFFF << CPU_VER_offCFGID )
  12. #define CPU_VER_mskREV ( 0xFF << CPU_VER_offREV )
  13. #define CPU_VER_mskCPUID ( 0xFF << CPU_VER_offCPUID )
  14. /******************************************************************************
  15. * cr1: ICM_CFG (Instruction Cache/Memory Configuration Register)
  16. *****************************************************************************/
  17. #define ICM_CFG_offISET 0 /* I-cache sets (# of cache lines) per way */
  18. #define ICM_CFG_offIWAY 3 /* I-cache ways */
  19. #define ICM_CFG_offISZ 6 /* I-cache line size */
  20. #define ICM_CFG_offILCK 9 /* I-cache locking support */
  21. #define ICM_CFG_offILMB 10 /* On-chip ILM banks */
  22. #define ICM_CFG_offBSAV 13 /* ILM base register alignment version */
  23. /* bit 15:31 reserved */
  24. #define ICM_CFG_mskISET ( 0x7 << ICM_CFG_offISET )
  25. #define ICM_CFG_mskIWAY ( 0x7 << ICM_CFG_offIWAY )
  26. #define ICM_CFG_mskISZ ( 0x7 << ICM_CFG_offISZ )
  27. #define ICM_CFG_mskILCK ( 0x1 << ICM_CFG_offILCK )
  28. #define ICM_CFG_mskILMB ( 0x7 << ICM_CFG_offILMB )
  29. #define ICM_CFG_mskBSAV ( 0x3 << ICM_CFG_offBSAV )
  30. /******************************************************************************
  31. * cr2: DCM_CFG (Data Cache/Memory Configuration Register)
  32. *****************************************************************************/
  33. #define DCM_CFG_offDSET 0 /* D-cache sets (# of cache lines) per way */
  34. #define DCM_CFG_offDWAY 3 /* D-cache ways */
  35. #define DCM_CFG_offDSZ 6 /* D-cache line size */
  36. #define DCM_CFG_offDLCK 9 /* D-cache locking support */
  37. #define DCM_CFG_offDLMB 10 /* On-chip DLM banks */
  38. #define DCM_CFG_offBSAV 13 /* DLM base register alignment version */
  39. /* bit 15:31 reserved */
  40. #define DCM_CFG_mskDSET ( 0x7 << DCM_CFG_offDSET )
  41. #define DCM_CFG_mskDWAY ( 0x7 << DCM_CFG_offDWAY )
  42. #define DCM_CFG_mskDSZ ( 0x7 << DCM_CFG_offDSZ )
  43. #define DCM_CFG_mskDLCK ( 0x1 << DCM_CFG_offDLCK )
  44. #define DCM_CFG_mskDLMB ( 0x7 << DCM_CFG_offDLMB )
  45. #define DCM_CFG_mskBSAV ( 0x3 << DCM_CFG_offBSAV )
  46. /******************************************************************************
  47. * cr3: MMU_CFG (MMU Configuration Register)
  48. *****************************************************************************/
  49. #define MMU_CFG_offMMPS 0 /* Memory management protection scheme */
  50. #define MMU_CFG_offMMPV 2 /* Memory management protection version number */
  51. #define MMU_CFG_offFATB 7 /* Fully-associative or non-fully-associative TLB */
  52. #define MMU_CFG_offTBW 8 /* TLB ways(non-associative) TBS */
  53. #define MMU_CFG_offTBS 11 /* TLB sets per way(non-associative) TBS */
  54. /* bit 14:14 reserved */
  55. #define MMU_CFG_offEP8MIN4 15 /* 8KB page supported while minimum page is 4KB */
  56. #define MMU_CFG_offfEPSZ 16 /* Extra page size supported */
  57. #define MMU_CFG_offTLBLCK 24 /* TLB locking support */
  58. #define MMU_CFG_offHPTWK 25 /* Hardware Page Table Walker implemented */
  59. #define MMU_CFG_offDE 26 /* Default endian */
  60. #define MMU_CFG_offNTPT 27 /* Partitions for non-translated attributes */
  61. #define MMU_CFG_offIVTB 28 /* Invisible TLB */
  62. #define MMU_CFG_offVLPT 29 /* VLPT for fast TLB fill handling implemented */
  63. #define MMU_CFG_offNTME 30 /* Non-translated VA to PA mapping */
  64. /* bit 31 reserved */
  65. #define MMU_CFG_mskMMPS ( 0x3 << MMU_CFG_offMMPS )
  66. #define MMU_CFG_mskMMPV ( 0x1F << MMU_CFG_offMMPV )
  67. #define MMU_CFG_mskFATB ( 0x1 << MMU_CFG_offFATB )
  68. #define MMU_CFG_mskTBW ( 0x7 << MMU_CFG_offTBW )
  69. #define MMU_CFG_mskTBS ( 0x7 << MMU_CFG_offTBS )
  70. #define MMU_CFG_mskEP8MIN4 ( 0x1 << MMU_CFG_offEP8MIN4 )
  71. #define MMU_CFG_mskfEPSZ ( 0xFF << MMU_CFG_offfEPSZ )
  72. #define MMU_CFG_mskTLBLCK ( 0x1 << MMU_CFG_offTLBLCK )
  73. #define MMU_CFG_mskHPTWK ( 0x1 << MMU_CFG_offHPTWK )
  74. #define MMU_CFG_mskDE ( 0x1 << MMU_CFG_offDE )
  75. #define MMU_CFG_mskNTPT ( 0x1 << MMU_CFG_offNTPT )
  76. #define MMU_CFG_mskIVTB ( 0x1 << MMU_CFG_offIVTB )
  77. #define MMU_CFG_mskVLPT ( 0x1 << MMU_CFG_offVLPT )
  78. #define MMU_CFG_mskNTME ( 0x1 << MMU_CFG_offNTME )
  79. /******************************************************************************
  80. * cr4: MSC_CFG (Misc Configuration Register)
  81. *****************************************************************************/
  82. #define MSC_CFG_offEDM 0
  83. #define MSC_CFG_offLMDMA 1
  84. #define MSC_CFG_offPFM 2
  85. #define MSC_CFG_offHSMP 3
  86. #define MSC_CFG_offTRACE 4
  87. #define MSC_CFG_offDIV 5
  88. #define MSC_CFG_offMAC 6
  89. #define MSC_CFG_offAUDIO 7
  90. #define MSC_CFG_offL2C 9
  91. #define MSC_CFG_offRDREG 10
  92. #define MSC_CFG_offADR24 11
  93. #define MSC_CFG_offINTLC 12
  94. #define MSC_CFG_offBASEV 13
  95. #define MSC_CFG_offNOD 16
  96. /* bit 13:31 reserved */
  97. #define MSC_CFG_mskEDM ( 0x1 << MSC_CFG_offEDM )
  98. #define MSC_CFG_mskLMDMA ( 0x1 << MSC_CFG_offLMDMA )
  99. #define MSC_CFG_mskPFM ( 0x1 << MSC_CFG_offPFM )
  100. #define MSC_CFG_mskHSMP ( 0x1 << MSC_CFG_offHSMP )
  101. #define MSC_CFG_mskTRACE ( 0x1 << MSC_CFG_offTRACE )
  102. #define MSC_CFG_mskDIV ( 0x1 << MSC_CFG_offDIV )
  103. #define MSC_CFG_mskMAC ( 0x1 << MSC_CFG_offMAC )
  104. #define MSC_CFG_mskAUDIO ( 0x3 << MSC_CFG_offAUDIO )
  105. #define MSC_CFG_mskL2C ( 0x1 << MSC_CFG_offL2C )
  106. #define MSC_CFG_mskRDREG ( 0x1 << MSC_CFG_offRDREG )
  107. #define MSC_CFG_mskADR24 ( 0x1 << MSC_CFG_offADR24 )
  108. #define MSC_CFG_mskINTLC ( 0x1 << MSC_CFG_offINTLC )
  109. #define MSC_CFG_mskBASEV ( 0x7 << MSC_CFG_offBASEV )
  110. #define MSC_CFG_mskNOD ( 0x1 << MSC_CFG_offNOD )
  111. /******************************************************************************
  112. * cr5: CORE_CFG (Core Identification Register)
  113. *****************************************************************************/
  114. #define CORE_ID_offCOREID 0
  115. /* bit 4:31 reserved */
  116. #define CORE_ID_mskCOREID ( 0xF << CORE_ID_offCOREID )
  117. /******************************************************************************
  118. * cr6: FUCOP_EXIST (FPU and Coprocessor Existence Configuration Register)
  119. *****************************************************************************/
  120. #define FUCOP_EXIST_offCP0EX 0
  121. #define FUCOP_EXIST_offCP1EX 1
  122. #define FUCOP_EXIST_offCP2EX 2
  123. #define FUCOP_EXIST_offCP3EX 3
  124. #define FUCOP_EXIST_offCP0ISFPU 31
  125. #define FUCOP_EXIST_mskCP0EX ( 0x1 << FUCOP_EXIST_offCP0EX )
  126. #define FUCOP_EXIST_mskCP1EX ( 0x1 << FUCOP_EXIST_offCP1EX )
  127. #define FUCOP_EXIST_mskCP2EX ( 0x1 << FUCOP_EXIST_offCP2EX )
  128. #define FUCOP_EXIST_mskCP3EX ( 0x1 << FUCOP_EXIST_offCP3EX )
  129. #define FUCOP_EXIST_mskCP0ISFPU ( 0x1 << FUCOP_EXIST_offCP0ISFPU )
  130. /******************************************************************************
  131. * ir0: PSW (Processor Status Word Register)
  132. * ir1: IPSW (Interruption PSW Register)
  133. * ir2: P_IPSW (Previous IPSW Register)
  134. *****************************************************************************/
  135. #define PSW_offGIE 0 /* Global Interrupt Enable */
  136. #define PSW_offINTL 1 /* Interruption Stack Level */
  137. #define PSW_offPOM 3 /* Processor Operation Mode, User/Superuser */
  138. #define PSW_offBE 5 /* Endianness for data memory access, 1:MSB, 0:LSB */
  139. #define PSW_offIT 6 /* Enable instruction address translation */
  140. #define PSW_offDT 7 /* Enable data address translation */
  141. #define PSW_offIME 8 /* Instruction Machine Error flag */
  142. #define PSW_offDME 9 /* Data Machine Error flag */
  143. #define PSW_offDEX 10 /* Debug Exception */
  144. #define PSW_offHSS 11 /* Hardware Single Stepping */
  145. #define PSW_offDRBE 12 /* Device Register Endian Mode */
  146. #define PSW_offAEN 13 /* Audio ISA special feature */
  147. #define PSW_offWBNA 14 /* Write Back Non-Allocate */
  148. #define PSW_offIFCON 15 /* IFC On */
  149. #define PSW_offCPL 16 /* Current Priority Level */
  150. /* bit 19:31 reserved */
  151. #define PSW_mskGIE ( 0x1 << PSW_offGIE )
  152. #define PSW_mskINTL ( 0x3 << PSW_offINTL )
  153. #define PSW_mskPOM ( 0x3 << PSW_offPOM )
  154. #define PSW_mskBE ( 0x1 << PSW_offBE )
  155. #define PSW_mskIT ( 0x1 << PSW_offIT )
  156. #define PSW_mskDT ( 0x1 << PSW_offDT )
  157. #define PSW_mskIME ( 0x1 << PSW_offIME )
  158. #define PSW_mskDME ( 0x1 << PSW_offDME )
  159. #define PSW_mskDEX ( 0x1 << PSW_offDEX )
  160. #define PSW_mskHSS ( 0x1 << PSW_offHSS )
  161. #define PSW_mskDRBE ( 0x1 << PSW_offDRBE )
  162. #define PSW_mskAEN ( 0x1 << PSW_offAEN )
  163. #define PSW_mskWBNA ( 0x1 << PSW_offWBNA )
  164. #define PSW_mskIFCON ( 0x1 << PSW_offIFCON )
  165. #define PSW_mskCPL ( 0x7 << PSW_offCPL )
  166. #define PSW_SYSTEM ( 1 << PSW_offPOM )
  167. #define PSW_INTL_1 ( 1 << PSW_offINTL )
  168. #define PSW_CPL_NO ( 0 << PSW_offCPL )
  169. #define PSW_CPL_ANY ( 7 << PSW_offCPL )
  170. #define PSW_clr (PSW_mskGIE|PSW_mskINTL|PSW_mskPOM|PSW_mskIT|PSW_mskDT|PSW_mskIME|PSW_mskWBNA)
  171. #ifdef __NDS32_EB__
  172. #ifdef CONFIG_WBNA
  173. #define PSW_init (PSW_mskWBNA|(1<<PSW_offINTL)|(1<<PSW_offPOM)|PSW_mskIT|PSW_mskDT|PSW_mskBE)
  174. #else
  175. #define PSW_init ((1<<PSW_offINTL)|(1<<PSW_offPOM)|PSW_mskIT|PSW_mskDT|PSW_mskBE)
  176. #endif
  177. #else
  178. #ifdef CONFIG_WBNA
  179. #define PSW_init (PSW_mskWBNA|(1<<PSW_offINTL)|(1<<PSW_offPOM)|PSW_mskIT|PSW_mskDT)
  180. #else
  181. #define PSW_init ((1<<PSW_offINTL)|(1<<PSW_offPOM)|PSW_mskIT|PSW_mskDT)
  182. #endif
  183. #endif
  184. /******************************************************************************
  185. * ir3: IVB (Interruption Vector Base Register)
  186. *****************************************************************************/
  187. /* bit 0:12 reserved */
  188. #define IVB_offNIVIC 1 /* Number of input for IVIC Controller */
  189. #define IVB_offIVIC_VER 11 /* IVIC Version */
  190. #define IVB_offEVIC 13 /* External Vector Interrupt Controller mode */
  191. #define IVB_offESZ 14 /* Size of each vector entry */
  192. #define IVB_offIVBASE 16 /* BasePA of interrupt vector table */
  193. #define IVB_mskNIVIC ( 0x7 << IVB_offNIVIC )
  194. #define IVB_mskIVIC_VER ( 0x3 << IVB_offIVIC_VER )
  195. #define IVB_mskEVIC ( 0x1 << IVB_offEVIC )
  196. #define IVB_mskESZ ( 0x3 << IVB_offESZ )
  197. #define IVB_mskIVBASE ( 0xFFFF << IVB_offIVBASE )
  198. #define IVB_valESZ4 0
  199. #define IVB_valESZ16 1
  200. #define IVB_valESZ64 2
  201. #define IVB_valESZ256 3
  202. /******************************************************************************
  203. * ir4: EVA (Exception Virtual Address Register)
  204. * ir5: P_EVA (Previous EVA Register)
  205. *****************************************************************************/
  206. /* This register contains the VA that causes the exception */
  207. /******************************************************************************
  208. * ir6: ITYPE (Interruption Type Register)
  209. * ir7: P_ITYPE (Previous ITYPE Register)
  210. *****************************************************************************/
  211. #define ITYPE_offETYPE 0 /* Exception Type */
  212. #define ITYPE_offINST 4 /* Exception caused by insn fetch or data access */
  213. /* bit 5:15 reserved */
  214. #define ITYPE_offVECTOR 5 /* Vector */
  215. #define ITYPE_offSWID 16 /* SWID of debugging exception */
  216. /* bit 31:31 reserved */
  217. #define ITYPE_mskETYPE ( 0xF << ITYPE_offETYPE )
  218. #define ITYPE_mskINST ( 0x1 << ITYPE_offINST )
  219. #define ITYPE_mskVECTOR ( 0x7F << ITYPE_offVECTOR )
  220. #define ITYPE_mskSWID ( 0x7FFF << ITYPE_offSWID )
  221. /* Additional definitions for ITYPE register */
  222. #define ITYPE_offSTYPE 16 /* Arithmetic Sub Type */
  223. #define ITYPE_offCPID 20 /* Co-Processor ID which generate the exception */
  224. #define ITYPE_mskSTYPE ( 0xF << ITYPE_offSTYPE )
  225. #define ITYPE_mskCPID ( 0x3 << ITYPE_offCPID )
  226. #define NDS32_VECTOR_mskNONEXCEPTION 0x78
  227. #define NDS32_VECTOR_offEXCEPTION 8
  228. #define NDS32_VECTOR_offINTERRUPT 9
  229. /* Interrupt vector entry */
  230. #define ENTRY_RESET_NMI 0
  231. #define ENTRY_TLB_FILL 1
  232. #define ENTRY_PTE_NOT_PRESENT 2
  233. #define ENTRY_TLB_MISC 3
  234. #define ENTRY_TLB_VLPT_MISS 4
  235. #define ENTRY_MACHINE_ERROR 5
  236. #define ENTRY_DEBUG_RELATED 6
  237. #define ENTRY_GENERAL_EXCPETION 7
  238. #define ENTRY_SYSCALL 8
  239. /* PTE not present exception definition */
  240. #define ETYPE_NON_LEAF_PTE_NOT_PRESENT 0
  241. #define ETYPE_LEAF_PTE_NOT_PRESENT 1
  242. /* General exception ETYPE definition */
  243. #define ETYPE_ALIGNMENT_CHECK 0
  244. #define ETYPE_RESERVED_INSTRUCTION 1
  245. #define ETYPE_TRAP 2
  246. #define ETYPE_ARITHMETIC 3
  247. #define ETYPE_PRECISE_BUS_ERROR 4
  248. #define ETYPE_IMPRECISE_BUS_ERROR 5
  249. #define ETYPE_COPROCESSOR 6
  250. #define ETYPE_RESERVED_VALUE 7
  251. #define ETYPE_NONEXISTENT_MEM_ADDRESS 8
  252. #define ETYPE_MPZIU_CONTROL 9
  253. #define ETYPE_NEXT_PRECISE_STACK_OFL 10
  254. /* Kerenl reserves software ID */
  255. #define SWID_RAISE_INTERRUPT_LEVEL 0x1a /* SWID_RAISE_INTERRUPT_LEVEL is used to
  256. * raise interrupt level for debug exception
  257. */
  258. /******************************************************************************
  259. * ir8: MERR (Machine Error Log Register)
  260. *****************************************************************************/
  261. /* bit 0:30 reserved */
  262. #define MERR_offBUSERR 31 /* Bus error caused by a load insn */
  263. #define MERR_mskBUSERR ( 0x1 << MERR_offBUSERR )
  264. /******************************************************************************
  265. * ir9: IPC (Interruption Program Counter Register)
  266. * ir10: P_IPC (Previous IPC Register)
  267. * ir11: OIPC (Overflow Interruption Program Counter Register)
  268. *****************************************************************************/
  269. /* This is the shadow stack register of the Program Counter */
  270. /******************************************************************************
  271. * ir12: P_P0 (Previous P0 Register)
  272. * ir13: P_P1 (Previous P1 Register)
  273. *****************************************************************************/
  274. /* These are shadow registers of $p0 and $p1 */
  275. /******************************************************************************
  276. * ir14: INT_MASK (Interruption Masking Register)
  277. *****************************************************************************/
  278. #define INT_MASK_offH0IM 0 /* Hardware Interrupt 0 Mask bit */
  279. #define INT_MASK_offH1IM 1 /* Hardware Interrupt 1 Mask bit */
  280. #define INT_MASK_offH2IM 2 /* Hardware Interrupt 2 Mask bit */
  281. #define INT_MASK_offH3IM 3 /* Hardware Interrupt 3 Mask bit */
  282. #define INT_MASK_offH4IM 4 /* Hardware Interrupt 4 Mask bit */
  283. #define INT_MASK_offH5IM 5 /* Hardware Interrupt 5 Mask bit */
  284. /* bit 6:15 reserved */
  285. #define INT_MASK_offSIM 16 /* Software Interrupt Mask bit */
  286. /* bit 17:29 reserved */
  287. #define INT_MASK_offIDIVZE 30 /* Enable detection for Divide-By-Zero */
  288. #define INT_MASK_offDSSIM 31 /* Default Single Stepping Interruption Mask */
  289. #define INT_MASK_mskH0IM ( 0x1 << INT_MASK_offH0IM )
  290. #define INT_MASK_mskH1IM ( 0x1 << INT_MASK_offH1IM )
  291. #define INT_MASK_mskH2IM ( 0x1 << INT_MASK_offH2IM )
  292. #define INT_MASK_mskH3IM ( 0x1 << INT_MASK_offH3IM )
  293. #define INT_MASK_mskH4IM ( 0x1 << INT_MASK_offH4IM )
  294. #define INT_MASK_mskH5IM ( 0x1 << INT_MASK_offH5IM )
  295. #define INT_MASK_mskSIM ( 0x1 << INT_MASK_offSIM )
  296. #define INT_MASK_mskIDIVZE ( 0x1 << INT_MASK_offIDIVZE )
  297. #define INT_MASK_mskDSSIM ( 0x1 << INT_MASK_offDSSIM )
  298. #define INT_MASK_INITAIAL_VAL (INT_MASK_mskDSSIM|INT_MASK_mskIDIVZE)
  299. /******************************************************************************
  300. * ir15: INT_PEND (Interrupt Pending Register)
  301. *****************************************************************************/
  302. #define INT_PEND_offH0I 0 /* Hardware Interrupt 0 pending bit */
  303. #define INT_PEND_offH1I 1 /* Hardware Interrupt 1 pending bit */
  304. #define INT_PEND_offH2I 2 /* Hardware Interrupt 2 pending bit */
  305. #define INT_PEND_offH3I 3 /* Hardware Interrupt 3 pending bit */
  306. #define INT_PEND_offH4I 4 /* Hardware Interrupt 4 pending bit */
  307. #define INT_PEND_offH5I 5 /* Hardware Interrupt 5 pending bit */
  308. #define INT_PEND_offCIPL 0 /* Current Interrupt Priority Level */
  309. /* bit 6:15 reserved */
  310. #define INT_PEND_offSWI 16 /* Software Interrupt pending bit */
  311. /* bit 17:31 reserved */
  312. #define INT_PEND_mskH0I ( 0x1 << INT_PEND_offH0I )
  313. #define INT_PEND_mskH1I ( 0x1 << INT_PEND_offH1I )
  314. #define INT_PEND_mskH2I ( 0x1 << INT_PEND_offH2I )
  315. #define INT_PEND_mskH3I ( 0x1 << INT_PEND_offH3I )
  316. #define INT_PEND_mskH4I ( 0x1 << INT_PEND_offH4I )
  317. #define INT_PEND_mskH5I ( 0x1 << INT_PEND_offH5I )
  318. #define INT_PEND_mskCIPL ( 0x1 << INT_PEND_offCIPL )
  319. #define INT_PEND_mskSWI ( 0x1 << INT_PEND_offSWI )
  320. /******************************************************************************
  321. * mr0: MMU_CTL (MMU Control Register)
  322. *****************************************************************************/
  323. #define MMU_CTL_offD 0 /* Default minimum page size */
  324. #define MMU_CTL_offNTC0 1 /* Non-Translated Cachebility of partition 0 */
  325. #define MMU_CTL_offNTC1 3 /* Non-Translated Cachebility of partition 1 */
  326. #define MMU_CTL_offNTC2 5 /* Non-Translated Cachebility of partition 2 */
  327. #define MMU_CTL_offNTC3 7 /* Non-Translated Cachebility of partition 3 */
  328. #define MMU_CTL_offTBALCK 9 /* TLB all-lock resolution scheme */
  329. #define MMU_CTL_offMPZIU 10 /* Multiple Page Size In Use bit */
  330. #define MMU_CTL_offNTM0 11 /* Non-Translated VA to PA of partition 0 */
  331. #define MMU_CTL_offNTM1 13 /* Non-Translated VA to PA of partition 1 */
  332. #define MMU_CTL_offNTM2 15 /* Non-Translated VA to PA of partition 2 */
  333. #define MMU_CTL_offNTM3 17 /* Non-Translated VA to PA of partition 3 */
  334. #define MMU_CTL_offUNA 23 /* Unaligned access */
  335. /* bit 24:31 reserved */
  336. #define MMU_CTL_mskD ( 0x1 << MMU_CTL_offD )
  337. #define MMU_CTL_mskNTC0 ( 0x3 << MMU_CTL_offNTC0 )
  338. #define MMU_CTL_mskNTC1 ( 0x3 << MMU_CTL_offNTC1 )
  339. #define MMU_CTL_mskNTC2 ( 0x3 << MMU_CTL_offNTC2 )
  340. #define MMU_CTL_mskNTC3 ( 0x3 << MMU_CTL_offNTC3 )
  341. #define MMU_CTL_mskTBALCK ( 0x1 << MMU_CTL_offTBALCK )
  342. #define MMU_CTL_mskMPZIU ( 0x1 << MMU_CTL_offMPZIU )
  343. #define MMU_CTL_mskNTM0 ( 0x3 << MMU_CTL_offNTM0 )
  344. #define MMU_CTL_mskNTM1 ( 0x3 << MMU_CTL_offNTM1 )
  345. #define MMU_CTL_mskNTM2 ( 0x3 << MMU_CTL_offNTM2 )
  346. #define MMU_CTL_mskNTM3 ( 0x3 << MMU_CTL_offNTM3 )
  347. #define MMU_CTL_D4KB 0
  348. #define MMU_CTL_D8KB 1
  349. #define MMU_CTL_UNA ( 0x1 << MMU_CTL_offUNA )
  350. #define MMU_CTL_CACHEABLE_NON 0
  351. #define MMU_CTL_CACHEABLE_WB 2
  352. #define MMU_CTL_CACHEABLE_WT 3
  353. /******************************************************************************
  354. * mr1: L1_PPTB (L1 Physical Page Table Base Register)
  355. *****************************************************************************/
  356. #define L1_PPTB_offNV 0 /* Enable Hardware Page Table Walker (HPTWK) */
  357. /* bit 1:11 reserved */
  358. #define L1_PPTB_offBASE 12 /* First level physical page table base address */
  359. #define L1_PPTB_mskNV ( 0x1 << L1_PPTB_offNV )
  360. #define L1_PPTB_mskBASE ( 0xFFFFF << L1_PPTB_offBASE )
  361. /******************************************************************************
  362. * mr2: TLB_VPN (TLB Access VPN Register)
  363. *****************************************************************************/
  364. /* bit 0:11 reserved */
  365. #define TLB_VPN_offVPN 12 /* Virtual Page Number */
  366. #define TLB_VPN_mskVPN ( 0xFFFFF << TLB_VPN_offVPN )
  367. /******************************************************************************
  368. * mr3: TLB_DATA (TLB Access Data Register)
  369. *****************************************************************************/
  370. #define TLB_DATA_offV 0 /* PTE is valid and present */
  371. #define TLB_DATA_offM 1 /* Page read/write access privilege */
  372. #define TLB_DATA_offD 4 /* Dirty bit */
  373. #define TLB_DATA_offX 5 /* Executable bit */
  374. #define TLB_DATA_offA 6 /* Access bit */
  375. #define TLB_DATA_offG 7 /* Global page (shared across contexts) */
  376. #define TLB_DATA_offC 8 /* Cacheability atribute */
  377. /* bit 11:11 reserved */
  378. #define TLB_DATA_offPPN 12 /* Phisical Page Number */
  379. #define TLB_DATA_mskV ( 0x1 << TLB_DATA_offV )
  380. #define TLB_DATA_mskM ( 0x7 << TLB_DATA_offM )
  381. #define TLB_DATA_mskD ( 0x1 << TLB_DATA_offD )
  382. #define TLB_DATA_mskX ( 0x1 << TLB_DATA_offX )
  383. #define TLB_DATA_mskA ( 0x1 << TLB_DATA_offA )
  384. #define TLB_DATA_mskG ( 0x1 << TLB_DATA_offG )
  385. #define TLB_DATA_mskC ( 0x7 << TLB_DATA_offC )
  386. #define TLB_DATA_mskPPN ( 0xFFFFF << TLB_DATA_offPPN )
  387. #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
  388. #define TLB_DATA_kernel_text_attr (TLB_DATA_mskV|TLB_DATA_mskM|TLB_DATA_mskD|TLB_DATA_mskX|TLB_DATA_mskG|TLB_DATA_mskC)
  389. #else
  390. #define TLB_DATA_kernel_text_attr (TLB_DATA_mskV|TLB_DATA_mskM|TLB_DATA_mskD|TLB_DATA_mskX|TLB_DATA_mskG|(0x6 << TLB_DATA_offC))
  391. #endif
  392. /******************************************************************************
  393. * mr4: TLB_MISC (TLB Access Misc Register)
  394. *****************************************************************************/
  395. #define TLB_MISC_offACC_PSZ 0 /* Page size of a PTE entry */
  396. #define TLB_MISC_offCID 4 /* Context id */
  397. /* bit 13:31 reserved */
  398. #define TLB_MISC_mskACC_PSZ ( 0xF << TLB_MISC_offACC_PSZ )
  399. #define TLB_MISC_mskCID ( 0x1FF << TLB_MISC_offCID )
  400. /******************************************************************************
  401. * mr5: VLPT_IDX (Virtual Linear Page Table Index Register)
  402. *****************************************************************************/
  403. #define VLPT_IDX_offZERO 0 /* Always 0 */
  404. #define VLPT_IDX_offEVPN 2 /* Exception Virtual Page Number */
  405. #define VLPT_IDX_offVLPTB 22 /* Base VA of VLPT */
  406. #define VLPT_IDX_mskZERO ( 0x3 << VLPT_IDX_offZERO )
  407. #define VLPT_IDX_mskEVPN ( 0xFFFFF << VLPT_IDX_offEVPN )
  408. #define VLPT_IDX_mskVLPTB ( 0x3FF << VLPT_IDX_offVLPTB )
  409. /******************************************************************************
  410. * mr6: ILMB (Instruction Local Memory Base Register)
  411. *****************************************************************************/
  412. #define ILMB_offIEN 0 /* Enable ILM */
  413. #define ILMB_offILMSZ 1 /* Size of ILM */
  414. /* bit 5:19 reserved */
  415. #define ILMB_offIBPA 20 /* Base PA of ILM */
  416. #define ILMB_mskIEN ( 0x1 << ILMB_offIEN )
  417. #define ILMB_mskILMSZ ( 0xF << ILMB_offILMSZ )
  418. #define ILMB_mskIBPA ( 0xFFF << ILMB_offIBPA )
  419. /******************************************************************************
  420. * mr7: DLMB (Data Local Memory Base Register)
  421. *****************************************************************************/
  422. #define DLMB_offDEN 0 /* Enable DLM */
  423. #define DLMB_offDLMSZ 1 /* Size of DLM */
  424. #define DLMB_offDBM 5 /* Enable Double-Buffer Mode for DLM */
  425. #define DLMB_offDBB 6 /* Double-buffer bank which can be accessed by the processor */
  426. /* bit 7:19 reserved */
  427. #define DLMB_offDBPA 20 /* Base PA of DLM */
  428. #define DLMB_mskDEN ( 0x1 << DLMB_offDEN )
  429. #define DLMB_mskDLMSZ ( 0xF << DLMB_offDLMSZ )
  430. #define DLMB_mskDBM ( 0x1 << DLMB_offDBM )
  431. #define DLMB_mskDBB ( 0x1 << DLMB_offDBB )
  432. #define DLMB_mskDBPA ( 0xFFF << DLMB_offDBPA )
  433. /******************************************************************************
  434. * mr8: CACHE_CTL (Cache Control Register)
  435. *****************************************************************************/
  436. #define CACHE_CTL_offIC_EN 0 /* Enable I-cache */
  437. #define CACHE_CTL_offDC_EN 1 /* Enable D-cache */
  438. #define CACHE_CTL_offICALCK 2 /* I-cache all-lock resolution scheme */
  439. #define CACHE_CTL_offDCALCK 3 /* D-cache all-lock resolution scheme */
  440. #define CACHE_CTL_offDCCWF 4 /* Enable D-cache Critical Word Forwarding */
  441. #define CACHE_CTL_offDCPMW 5 /* Enable D-cache concurrent miss and write-back processing */
  442. /* bit 6:31 reserved */
  443. #define CACHE_CTL_mskIC_EN ( 0x1 << CACHE_CTL_offIC_EN )
  444. #define CACHE_CTL_mskDC_EN ( 0x1 << CACHE_CTL_offDC_EN )
  445. #define CACHE_CTL_mskICALCK ( 0x1 << CACHE_CTL_offICALCK )
  446. #define CACHE_CTL_mskDCALCK ( 0x1 << CACHE_CTL_offDCALCK )
  447. #define CACHE_CTL_mskDCCWF ( 0x1 << CACHE_CTL_offDCCWF )
  448. #define CACHE_CTL_mskDCPMW ( 0x1 << CACHE_CTL_offDCPMW )
  449. /******************************************************************************
  450. * mr9: HSMP_SADDR (High Speed Memory Port Starting Address)
  451. *****************************************************************************/
  452. #define HSMP_SADDR_offEN 0 /* Enable control bit for the High Speed Memory port */
  453. /* bit 1:19 reserved */
  454. #define HSMP_SADDR_offRANGE 1 /* Denote the address range (only defined in HSMP v2 ) */
  455. #define HSMP_SADDR_offSADDR 20 /* Starting base PA of the High Speed Memory Port region */
  456. #define HSMP_SADDR_mskEN ( 0x1 << HSMP_SADDR_offEN )
  457. #define HSMP_SADDR_mskRANGE ( 0xFFF << HSMP_SADDR_offRANGE )
  458. #define HSMP_SADDR_mskSADDR ( 0xFFF << HSMP_SADDR_offSADDR )
  459. /******************************************************************************
  460. * mr10: HSMP_EADDR (High Speed Memory Port Ending Address)
  461. *****************************************************************************/
  462. /* bit 0:19 reserved */
  463. #define HSMP_EADDR_offEADDR 20
  464. #define HSMP_EADDR_mskEADDR ( 0xFFF << HSMP_EADDR_offEADDR )
  465. /******************************************************************************
  466. * dr0+(n*5): BPCn (n=0-7) (Breakpoint Control Register)
  467. *****************************************************************************/
  468. #define BPC_offWP 0 /* Configuration of BPAn */
  469. #define BPC_offEL 1 /* Enable BPAn */
  470. #define BPC_offS 2 /* Data address comparison for a store instruction */
  471. #define BPC_offP 3 /* Compared data address is PA */
  472. #define BPC_offC 4 /* CID value is compared with the BPCIDn register */
  473. #define BPC_offBE0 5 /* Enable byte mask for the comparison with register */
  474. #define BPC_offBE1 6 /* Enable byte mask for the comparison with register */
  475. #define BPC_offBE2 7 /* Enable byte mask for the comparison with register */
  476. #define BPC_offBE3 8 /* Enable byte mask for the comparison with register */
  477. #define BPC_offT 9 /* Enable breakpoint Embedded Tracer triggering operation */
  478. #define BPC_mskWP ( 0x1 << BPC_offWP )
  479. #define BPC_mskEL ( 0x1 << BPC_offEL )
  480. #define BPC_mskS ( 0x1 << BPC_offS )
  481. #define BPC_mskP ( 0x1 << BPC_offP )
  482. #define BPC_mskC ( 0x1 << BPC_offC )
  483. #define BPC_mskBE0 ( 0x1 << BPC_offBE0 )
  484. #define BPC_mskBE1 ( 0x1 << BPC_offBE1 )
  485. #define BPC_mskBE2 ( 0x1 << BPC_offBE2 )
  486. #define BPC_mskBE3 ( 0x1 << BPC_offBE3 )
  487. #define BPC_mskT ( 0x1 << BPC_offT )
  488. /******************************************************************************
  489. * dr1+(n*5): BPAn (n=0-7) (Breakpoint Address Register)
  490. *****************************************************************************/
  491. /* These registers contain break point address */
  492. /******************************************************************************
  493. * dr2+(n*5): BPAMn (n=0-7) (Breakpoint Address Mask Register)
  494. *****************************************************************************/
  495. /* These registerd contain the address comparison mask for the BPAn register */
  496. /******************************************************************************
  497. * dr3+(n*5): BPVn (n=0-7) Breakpoint Data Value Register
  498. *****************************************************************************/
  499. /* The BPVn register contains the data value that will be compared with the
  500. * incoming load/store data value */
  501. /******************************************************************************
  502. * dr4+(n*5): BPCIDn (n=0-7) (Breakpoint Context ID Register)
  503. *****************************************************************************/
  504. #define BPCID_offCID 0 /* CID that will be compared with a process's CID */
  505. /* bit 9:31 reserved */
  506. #define BPCID_mskCID ( 0x1FF << BPCID_offCID )
  507. /******************************************************************************
  508. * dr40: EDM_CFG (EDM Configuration Register)
  509. *****************************************************************************/
  510. #define EDM_CFG_offBC 0 /* Number of hardware breakpoint sets implemented */
  511. #define EDM_CFG_offDIMU 3 /* Debug Instruction Memory Unit exists */
  512. /* bit 4:15 reserved */
  513. #define EDM_CFG_offVER 16 /* EDM version */
  514. #define EDM_CFG_mskBC ( 0x7 << EDM_CFG_offBC )
  515. #define EDM_CFG_mskDIMU ( 0x1 << EDM_CFG_offDIMU )
  516. #define EDM_CFG_mskVER ( 0xFFFF << EDM_CFG_offVER )
  517. /******************************************************************************
  518. * dr41: EDMSW (EDM Status Word)
  519. *****************************************************************************/
  520. #define EDMSW_offWV 0 /* Write Valid */
  521. #define EDMSW_offRV 1 /* Read Valid */
  522. #define EDMSW_offDE 2 /* Debug exception has occurred for this core */
  523. /* bit 3:31 reserved */
  524. #define EDMSW_mskWV ( 0x1 << EDMSW_offWV )
  525. #define EDMSW_mskRV ( 0x1 << EDMSW_offRV )
  526. #define EDMSW_mskDE ( 0x1 << EDMSW_offDE )
  527. /******************************************************************************
  528. * dr42: EDM_CTL (EDM Control Register)
  529. *****************************************************************************/
  530. /* bit 0:30 reserved */
  531. #define EDM_CTL_offV3_EDM_MODE 6 /* EDM compatibility control bit */
  532. #define EDM_CTL_offDEH_SEL 31 /* Controls where debug exception is directed to */
  533. #define EDM_CTL_mskV3_EDM_MODE ( 0x1 << EDM_CTL_offV3_EDM_MODE )
  534. #define EDM_CTL_mskDEH_SEL ( 0x1 << EDM_CTL_offDEH_SEL )
  535. /******************************************************************************
  536. * dr43: EDM_DTR (EDM Data Transfer Register)
  537. *****************************************************************************/
  538. /* This is used to exchange data between the embedded EDM logic
  539. * and the processor core */
  540. /******************************************************************************
  541. * dr44: BPMTC (Breakpoint Match Trigger Counter Register)
  542. *****************************************************************************/
  543. #define BPMTC_offBPMTC 0 /* Breakpoint match trigger counter value */
  544. /* bit 16:31 reserved */
  545. #define BPMTC_mskBPMTC ( 0xFFFF << BPMTC_offBPMTC )
  546. /******************************************************************************
  547. * dr45: DIMBR (Debug Instruction Memory Base Register)
  548. *****************************************************************************/
  549. /* bit 0:11 reserved */
  550. #define DIMBR_offDIMB 12 /* Base address of the Debug Instruction Memory (DIM) */
  551. #define DIMBR_mskDIMB ( 0xFFFFF << DIMBR_offDIMB )
  552. /******************************************************************************
  553. * dr46: TECR0(Trigger Event Control register 0)
  554. * dr47: TECR1 (Trigger Event Control register 1)
  555. *****************************************************************************/
  556. #define TECR_offBP 0 /* Controld which BP is used as a trigger source */
  557. #define TECR_offNMI 8 /* Use NMI as a trigger source */
  558. #define TECR_offHWINT 9 /* Corresponding interrupt is used as a trigger source */
  559. #define TECR_offEVIC 15 /* Enable HWINT as a trigger source in EVIC mode */
  560. #define TECR_offSYS 16 /* Enable SYSCALL instruction as a trigger source */
  561. #define TECR_offDBG 17 /* Enable debug exception as a trigger source */
  562. #define TECR_offMRE 18 /* Enable MMU related exception as a trigger source */
  563. #define TECR_offE 19 /* An exception is used as a trigger source */
  564. /* bit 20:30 reserved */
  565. #define TECR_offL 31 /* Link/Cascade TECR0 trigger event to TECR1 trigger event */
  566. #define TECR_mskBP ( 0xFF << TECR_offBP )
  567. #define TECR_mskNMI ( 0x1 << TECR_offBNMI )
  568. #define TECR_mskHWINT ( 0x3F << TECR_offBHWINT )
  569. #define TECR_mskEVIC ( 0x1 << TECR_offBEVIC )
  570. #define TECR_mskSYS ( 0x1 << TECR_offBSYS )
  571. #define TECR_mskDBG ( 0x1 << TECR_offBDBG )
  572. #define TECR_mskMRE ( 0x1 << TECR_offBMRE )
  573. #define TECR_mskE ( 0x1 << TECR_offE )
  574. #define TECR_mskL ( 0x1 << TECR_offL )
  575. /******************************************************************************
  576. * pfr0-2: PFMC0-2 (Performance Counter Register 0-2)
  577. *****************************************************************************/
  578. /* These registers contains performance event count */
  579. /******************************************************************************
  580. * pfr3: PFM_CTL (Performance Counter Control Register)
  581. *****************************************************************************/
  582. #define PFM_CTL_offEN0 0 /* Enable PFMC0 */
  583. #define PFM_CTL_offEN1 1 /* Enable PFMC1 */
  584. #define PFM_CTL_offEN2 2 /* Enable PFMC2 */
  585. #define PFM_CTL_offIE0 3 /* Enable interrupt for PFMC0 */
  586. #define PFM_CTL_offIE1 4 /* Enable interrupt for PFMC1 */
  587. #define PFM_CTL_offIE2 5 /* Enable interrupt for PFMC2 */
  588. #define PFM_CTL_offOVF0 6 /* Overflow bit of PFMC0 */
  589. #define PFM_CTL_offOVF1 7 /* Overflow bit of PFMC1 */
  590. #define PFM_CTL_offOVF2 8 /* Overflow bit of PFMC2 */
  591. #define PFM_CTL_offKS0 9 /* Enable superuser mode event counting for PFMC0 */
  592. #define PFM_CTL_offKS1 10 /* Enable superuser mode event counting for PFMC1 */
  593. #define PFM_CTL_offKS2 11 /* Enable superuser mode event counting for PFMC2 */
  594. #define PFM_CTL_offKU0 12 /* Enable user mode event counting for PFMC0 */
  595. #define PFM_CTL_offKU1 13 /* Enable user mode event counting for PFMC1 */
  596. #define PFM_CTL_offKU2 14 /* Enable user mode event counting for PFMC2 */
  597. #define PFM_CTL_offSEL0 15 /* The event selection for PFMC0 */
  598. #define PFM_CTL_offSEL1 16 /* The event selection for PFMC1 */
  599. #define PFM_CTL_offSEL2 22 /* The event selection for PFMC2 */
  600. /* bit 28:31 reserved */
  601. #define PFM_CTL_mskEN0 ( 0x01 << PFM_CTL_offEN0 )
  602. #define PFM_CTL_mskEN1 ( 0x01 << PFM_CTL_offEN1 )
  603. #define PFM_CTL_mskEN2 ( 0x01 << PFM_CTL_offEN2 )
  604. #define PFM_CTL_mskIE0 ( 0x01 << PFM_CTL_offIE0 )
  605. #define PFM_CTL_mskIE1 ( 0x01 << PFM_CTL_offIE1 )
  606. #define PFM_CTL_mskIE2 ( 0x01 << PFM_CTL_offIE2 )
  607. #define PFM_CTL_mskOVF0 ( 0x01 << PFM_CTL_offOVF0 )
  608. #define PFM_CTL_mskOVF1 ( 0x01 << PFM_CTL_offOVF1 )
  609. #define PFM_CTL_mskOVF2 ( 0x01 << PFM_CTL_offOVF2 )
  610. #define PFM_CTL_mskKS0 ( 0x01 << PFM_CTL_offKS0 )
  611. #define PFM_CTL_mskKS1 ( 0x01 << PFM_CTL_offKS1 )
  612. #define PFM_CTL_mskKS2 ( 0x01 << PFM_CTL_offKS2 )
  613. #define PFM_CTL_mskKU0 ( 0x01 << PFM_CTL_offKU0 )
  614. #define PFM_CTL_mskKU1 ( 0x01 << PFM_CTL_offKU1 )
  615. #define PFM_CTL_mskKU2 ( 0x01 << PFM_CTL_offKU2 )
  616. #define PFM_CTL_mskSEL0 ( 0x01 << PFM_CTL_offSEL0 )
  617. #define PFM_CTL_mskSEL1 ( 0x3F << PFM_CTL_offSEL1 )
  618. #define PFM_CTL_mskSEL2 ( 0x3F << PFM_CTL_offSEL2 )
  619. /******************************************************************************
  620. * SDZ_CTL (Structure Downsizing Control Register)
  621. *****************************************************************************/
  622. #define SDZ_CTL_offICDZ 0 /* I-cache downsizing control */
  623. #define SDZ_CTL_offDCDZ 3 /* D-cache downsizing control */
  624. #define SDZ_CTL_offMTBDZ 6 /* MTLB downsizing control */
  625. #define SDZ_CTL_offBTBDZ 9 /* Branch Target Table downsizing control */
  626. /* bit 12:31 reserved */
  627. #define SDZ_CTL_mskICDZ ( 0x07 << SDZ_CTL_offICDZ )
  628. #define SDZ_CTL_mskDCDZ ( 0x07 << SDZ_CTL_offDCDZ )
  629. #define SDZ_CTL_mskMTBDZ ( 0x07 << SDZ_CTL_offMTBDZ )
  630. #define SDZ_CTL_mskBTBDZ ( 0x07 << SDZ_CTL_offBTBDZ )
  631. /******************************************************************************
  632. * N13MISC_CTL (N13 Miscellaneous Control Register)
  633. *****************************************************************************/
  634. #define N13MISC_CTL_offBTB 0 /* Disable Branch Target Buffer */
  635. #define N13MISC_CTL_offRTP 1 /* Disable Return Target Predictor */
  636. #define N13MISC_CTL_offPTEPF 2 /* Disable HPTWK L2 PTE pefetch */
  637. #define N13MISC_CTL_offSP_SHADOW_EN 4 /* Enable shadow stack pointers */
  638. /* bit 6, 9:31 reserved */
  639. #define N13MISC_CTL_makBTB ( 0x1 << N13MISC_CTL_offBTB )
  640. #define N13MISC_CTL_makRTP ( 0x1 << N13MISC_CTL_offRTP )
  641. #define N13MISC_CTL_makPTEPF ( 0x1 << N13MISC_CTL_offPTEPF )
  642. #define N13MISC_CTL_makSP_SHADOW_EN ( 0x1 << N13MISC_CTL_offSP_SHADOW_EN )
  643. #define MISC_init (N13MISC_CTL_makBTB|N13MISC_CTL_makRTP|N13MISC_CTL_makSP_SHADOW_EN)
  644. /******************************************************************************
  645. * PRUSR_ACC_CTL (Privileged Resource User Access Control Registers)
  646. *****************************************************************************/
  647. #define PRUSR_ACC_CTL_offDMA_EN 0 /* Allow user mode access of DMA registers */
  648. #define PRUSR_ACC_CTL_offPFM_EN 1 /* Allow user mode access of PFM registers */
  649. #define PRUSR_ACC_CTL_mskDMA_EN ( 0x1 << PRUSR_ACC_CTL_offDMA_EN )
  650. #define PRUSR_ACC_CTL_mskPFM_EN ( 0x1 << PRUSR_ACC_CTL_offPFM_EN )
  651. /******************************************************************************
  652. * dmar0: DMA_CFG (DMA Configuration Register)
  653. *****************************************************************************/
  654. #define DMA_CFG_offNCHN 0 /* The number of DMA channels implemented */
  655. #define DMA_CFG_offUNEA 2 /* Un-aligned External Address transfer feature */
  656. #define DMA_CFG_off2DET 3 /* 2-D Element Transfer feature */
  657. /* bit 4:15 reserved */
  658. #define DMA_CFG_offVER 16 /* DMA architecture and implementation version */
  659. #define DMA_CFG_mskNCHN ( 0x3 << DMA_CFG_offNCHN )
  660. #define DMA_CFG_mskUNEA ( 0x1 << DMA_CFG_offUNEA )
  661. #define DMA_CFG_msk2DET ( 0x1 << DMA_CFG_off2DET )
  662. #define DMA_CFG_mskVER ( 0xFFFF << DMA_CFG_offVER )
  663. /******************************************************************************
  664. * dmar1: DMA_GCSW (DMA Global Control and Status Word Register)
  665. *****************************************************************************/
  666. #define DMA_GCSW_offC0STAT 0 /* DMA channel 0 state */
  667. #define DMA_GCSW_offC1STAT 3 /* DMA channel 1 state */
  668. /* bit 6:11 reserved */
  669. #define DMA_GCSW_offC0INT 12 /* DMA channel 0 generate interrupt */
  670. #define DMA_GCSW_offC1INT 13 /* DMA channel 1 generate interrupt */
  671. /* bit 14:30 reserved */
  672. #define DMA_GCSW_offEN 31 /* Enable DMA engine */
  673. #define DMA_GCSW_mskC0STAT ( 0x7 << DMA_GCSW_offC0STAT )
  674. #define DMA_GCSW_mskC1STAT ( 0x7 << DMA_GCSW_offC1STAT )
  675. #define DMA_GCSW_mskC0INT ( 0x1 << DMA_GCSW_offC0INT )
  676. #define DMA_GCSW_mskC1INT ( 0x1 << DMA_GCSW_offC1INT )
  677. #define DMA_GCSW_mskEN ( 0x1 << DMA_GCSW_offEN )
  678. /******************************************************************************
  679. * dmar2: DMA_CHNSEL (DMA Channel Selection Register)
  680. *****************************************************************************/
  681. #define DMA_CHNSEL_offCHAN 0 /* Selected channel number */
  682. /* bit 2:31 reserved */
  683. #define DMA_CHNSEL_mskCHAN ( 0x3 << DMA_CHNSEL_offCHAN )
  684. /******************************************************************************
  685. * dmar3: DMA_ACT (DMA Action Register)
  686. *****************************************************************************/
  687. #define DMA_ACT_offACMD 0 /* DMA Action Command */
  688. /* bit 2:31 reserved */
  689. #define DMA_ACT_mskACMD ( 0x3 << DMA_ACT_offACMD )
  690. /******************************************************************************
  691. * dmar4: DMA_SETUP (DMA Setup Register)
  692. *****************************************************************************/
  693. #define DMA_SETUP_offLM 0 /* Local Memory Selection */
  694. #define DMA_SETUP_offTDIR 1 /* Transfer Direction */
  695. #define DMA_SETUP_offTES 2 /* Transfer Element Size */
  696. #define DMA_SETUP_offESTR 4 /* External memory transfer Stride */
  697. #define DMA_SETUP_offCIE 16 /* Interrupt Enable on Completion */
  698. #define DMA_SETUP_offSIE 17 /* Interrupt Enable on explicit Stop */
  699. #define DMA_SETUP_offEIE 18 /* Interrupt Enable on Error */
  700. #define DMA_SETUP_offUE 19 /* Enable the Un-aligned External Address */
  701. #define DMA_SETUP_off2DE 20 /* Enable the 2-D External Transfer */
  702. #define DMA_SETUP_offCOA 21 /* Transfer Coalescable */
  703. /* bit 22:31 reserved */
  704. #define DMA_SETUP_mskLM ( 0x1 << DMA_SETUP_offLM )
  705. #define DMA_SETUP_mskTDIR ( 0x1 << DMA_SETUP_offTDIR )
  706. #define DMA_SETUP_mskTES ( 0x3 << DMA_SETUP_offTES )
  707. #define DMA_SETUP_mskESTR ( 0xFFF << DMA_SETUP_offESTR )
  708. #define DMA_SETUP_mskCIE ( 0x1 << DMA_SETUP_offCIE )
  709. #define DMA_SETUP_mskSIE ( 0x1 << DMA_SETUP_offSIE )
  710. #define DMA_SETUP_mskEIE ( 0x1 << DMA_SETUP_offEIE )
  711. #define DMA_SETUP_mskUE ( 0x1 << DMA_SETUP_offUE )
  712. #define DMA_SETUP_msk2DE ( 0x1 << DMA_SETUP_off2DE )
  713. #define DMA_SETUP_mskCOA ( 0x1 << DMA_SETUP_offCOA )
  714. /******************************************************************************
  715. * dmar5: DMA_ISADDR (DMA Internal Start Address Register)
  716. *****************************************************************************/
  717. #define DMA_ISADDR_offISADDR 0 /* Internal Start Address */
  718. /* bit 20:31 reserved */
  719. #define DMA_ISADDR_mskISADDR ( 0xFFFFF << DMA_ISADDR_offISADDR )
  720. /******************************************************************************
  721. * dmar6: DMA_ESADDR (DMA External Start Address Register)
  722. *****************************************************************************/
  723. /* This register holds External Start Address */
  724. /******************************************************************************
  725. * dmar7: DMA_TCNT (DMA Transfer Element Count Register)
  726. *****************************************************************************/
  727. #define DMA_TCNT_offTCNT 0 /* DMA transfer element count */
  728. /* bit 18:31 reserved */
  729. #define DMA_TCNT_mskTCNT ( 0x3FFFF << DMA_TCNT_offTCNT )
  730. /******************************************************************************
  731. * dmar8: DMA_STATUS (DMA Status Register)
  732. *****************************************************************************/
  733. #define DMA_STATUS_offSTAT 0 /* DMA channel state */
  734. #define DMA_STATUS_offSTUNA 3 /* Un-aligned error on External Stride value */
  735. #define DMA_STATUS_offDERR 4 /* DMA Transfer Disruption Error */
  736. #define DMA_STATUS_offEUNA 5 /* Un-aligned error on the External address */
  737. #define DMA_STATUS_offIUNA 6 /* Un-aligned error on the Internal address */
  738. #define DMA_STATUS_offIOOR 7 /* Out-Of-Range error on the Internal address */
  739. #define DMA_STATUS_offEBUS 8 /* Bus Error on an External DMA transfer */
  740. #define DMA_STATUS_offESUP 9 /* DMA setup error */
  741. /* bit 10:31 reserved */
  742. #define DMA_STATUS_mskSTAT ( 0x7 << DMA_STATUS_offSTAT )
  743. #define DMA_STATUS_mskSTUNA ( 0x1 << DMDMA_STATUS_offSTUNA )
  744. #define DMA_STATUS_mskDERR ( 0x1 << DMDMA_STATUS_offDERR )
  745. #define DMA_STATUS_mskEUNA ( 0x1 << DMDMA_STATUS_offEUNA )
  746. #define DMA_STATUS_mskIUNA ( 0x1 << DMDMA_STATUS_offIUNA )
  747. #define DMA_STATUS_mskIOOR ( 0x1 << DMDMA_STATUS_offIOOR )
  748. #define DMA_STATUS_mskEBUS ( 0x1 << DMDMA_STATUS_offEBUS )
  749. #define DMA_STATUS_mskESUP ( 0x1 << DMDMA_STATUS_offESUP )
  750. /******************************************************************************
  751. * dmar9: DMA_2DSET (DMA 2D Setup Register)
  752. *****************************************************************************/
  753. #define DMA_2DSET_offWECNT 0 /* The Width Element Count for a 2-D region */
  754. #define DMA_2DSET_offHTSTR 16 /* The Height Stride for a 2-D region */
  755. #define DMA_2DSET_mskHTSTR ( 0xFFFF << DMA_2DSET_offHTSTR )
  756. #define DMA_2DSET_mskWECNT ( 0xFFFF << DMA_2DSET_offWECNT )
  757. /******************************************************************************
  758. * dmar10: DMA_2DSCTL (DMA 2D Startup Control Register)
  759. *****************************************************************************/
  760. #define DMA_2DSCTL_offSTWECNT 0 /* Startup Width Element Count for a 2-D region */
  761. /* bit 16:31 reserved */
  762. #define DMA_2DSCTL_mskSTWECNT ( 0xFFFF << DMA_2DSCTL_offSTWECNT )
  763. /******************************************************************************
  764. * fpcsr: FPCSR (Floating-Point Control Status Register)
  765. *****************************************************************************/
  766. #define FPCSR_offRM 0
  767. #define FPCSR_offIVO 2
  768. #define FPCSR_offDBZ 3
  769. #define FPCSR_offOVF 4
  770. #define FPCSR_offUDF 5
  771. #define FPCSR_offIEX 6
  772. #define FPCSR_offIVOE 7
  773. #define FPCSR_offDBZE 8
  774. #define FPCSR_offOVFE 9
  775. #define FPCSR_offUDFE 10
  776. #define FPCSR_offIEXE 11
  777. #define FPCSR_offDNZ 12
  778. #define FPCSR_offIVOT 13
  779. #define FPCSR_offDBZT 14
  780. #define FPCSR_offOVFT 15
  781. #define FPCSR_offUDFT 16
  782. #define FPCSR_offIEXT 17
  783. #define FPCSR_offDNIT 18
  784. #define FPCSR_offRIT 19
  785. #define FPCSR_mskRM ( 0x3 << FPCSR_offRM )
  786. #define FPCSR_mskIVO ( 0x1 << FPCSR_offIVO )
  787. #define FPCSR_mskDBZ ( 0x1 << FPCSR_offDBZ )
  788. #define FPCSR_mskOVF ( 0x1 << FPCSR_offOVF )
  789. #define FPCSR_mskUDF ( 0x1 << FPCSR_offUDF )
  790. #define FPCSR_mskIEX ( 0x1 << FPCSR_offIEX )
  791. #define FPCSR_mskIVOE ( 0x1 << FPCSR_offIVOE )
  792. #define FPCSR_mskDBZE ( 0x1 << FPCSR_offDBZE )
  793. #define FPCSR_mskOVFE ( 0x1 << FPCSR_offOVFE )
  794. #define FPCSR_mskUDFE ( 0x1 << FPCSR_offUDFE )
  795. #define FPCSR_mskIEXE ( 0x1 << FPCSR_offIEXE )
  796. #define FPCSR_mskDNZ ( 0x1 << FPCSR_offDNZ )
  797. #define FPCSR_mskIVOT ( 0x1 << FPCSR_offIVOT )
  798. #define FPCSR_mskDBZT ( 0x1 << FPCSR_offDBZT )
  799. #define FPCSR_mskOVFT ( 0x1 << FPCSR_offOVFT )
  800. #define FPCSR_mskUDFT ( 0x1 << FPCSR_offUDFT )
  801. #define FPCSR_mskIEXT ( 0x1 << FPCSR_offIEXT )
  802. #define FPCSR_mskDNIT ( 0x1 << FPCSR_offDNIT )
  803. #define FPCSR_mskRIT ( 0x1 << FPCSR_offRIT )
  804. #define FPCSR_mskALL (FPCSR_mskIVO | FPCSR_mskDBZ | FPCSR_mskOVF | FPCSR_mskUDF | FPCSR_mskIEX)
  805. #define FPCSR_mskALLE (FPCSR_mskIVOE | FPCSR_mskDBZE | FPCSR_mskOVFE | FPCSR_mskUDFE | FPCSR_mskIEXE)
  806. #define FPCSR_mskALLT (FPCSR_mskIVOT | FPCSR_mskDBZT | FPCSR_mskOVFT | FPCSR_mskUDFT | FPCSR_mskIEXT |FPCSR_mskDNIT | FPCSR_mskRIT)
  807. /******************************************************************************
  808. * fpcfg: FPCFG (Floating-Point Configuration Register)
  809. *****************************************************************************/
  810. #define FPCFG_offSP 0
  811. #define FPCFG_offDP 1
  812. #define FPCFG_offFREG 2
  813. #define FPCFG_offFMA 4
  814. #define FPCFG_offIMVER 22
  815. #define FPCFG_offAVER 27
  816. #define FPCFG_mskSP ( 0x1 << FPCFG_offSP )
  817. #define FPCFG_mskDP ( 0x1 << FPCFG_offDP )
  818. #define FPCFG_mskFREG ( 0x3 << FPCFG_offFREG )
  819. #define FPCFG_mskFMA ( 0x1 << FPCFG_offFMA )
  820. #define FPCFG_mskIMVER ( 0x1F << FPCFG_offIMVER )
  821. #define FPCFG_mskAVER ( 0x1F << FPCFG_offAVER )
  822. /******************************************************************************
  823. * fucpr: FUCOP_CTL (FPU and Coprocessor Enable Control Register)
  824. *****************************************************************************/
  825. #define FUCOP_CTL_offCP0EN 0
  826. #define FUCOP_CTL_offCP1EN 1
  827. #define FUCOP_CTL_offCP2EN 2
  828. #define FUCOP_CTL_offCP3EN 3
  829. #define FUCOP_CTL_offAUEN 31
  830. #define FUCOP_CTL_mskCP0EN ( 0x1 << FUCOP_CTL_offCP0EN )
  831. #define FUCOP_CTL_mskCP1EN ( 0x1 << FUCOP_CTL_offCP1EN )
  832. #define FUCOP_CTL_mskCP2EN ( 0x1 << FUCOP_CTL_offCP2EN )
  833. #define FUCOP_CTL_mskCP3EN ( 0x1 << FUCOP_CTL_offCP3EN )
  834. #define FUCOP_CTL_mskAUEN ( 0x1 << FUCOP_CTL_offAUEN )
  835. #endif /* __NDS32_BITFIELD_H__ */