core.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. /*
  2. * Xtensa processor core configuration information.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1999-2006 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_CORE_H
  11. #define _XTENSA_CORE_H
  12. /****************************************************************************
  13. Parameters Useful for Any Code, USER or PRIVILEGED
  14. ****************************************************************************/
  15. /*
  16. * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is
  17. * configured, and a value of 0 otherwise. These macros are always defined.
  18. */
  19. /*----------------------------------------------------------------------
  20. ISA
  21. ----------------------------------------------------------------------*/
  22. #define XCHAL_HAVE_BE 1 /* big-endian byte ordering */
  23. #define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */
  24. #define XCHAL_NUM_AREGS 64 /* num of physical addr regs */
  25. #define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */
  26. #define XCHAL_MAX_INSTRUCTION_SIZE 3 /* max instr bytes (3..8) */
  27. #define XCHAL_HAVE_DEBUG 1 /* debug option */
  28. #define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */
  29. #define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */
  30. #define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */
  31. #define XCHAL_HAVE_MINMAX 0 /* MIN/MAX instructions */
  32. #define XCHAL_HAVE_SEXT 0 /* SEXT instruction */
  33. #define XCHAL_HAVE_CLAMPS 0 /* CLAMPS instruction */
  34. #define XCHAL_HAVE_MUL16 0 /* MUL16S/MUL16U instructions */
  35. #define XCHAL_HAVE_MUL32 0 /* MULL instruction */
  36. #define XCHAL_HAVE_MUL32_HIGH 0 /* MULUH/MULSH instructions */
  37. #define XCHAL_HAVE_L32R 1 /* L32R instruction */
  38. #define XCHAL_HAVE_ABSOLUTE_LITERALS 1 /* non-PC-rel (extended) L32R */
  39. #define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */
  40. #define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */
  41. #define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */
  42. #define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */
  43. #define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */
  44. #define XCHAL_HAVE_ABS 1 /* ABS instruction */
  45. /*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */
  46. /*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */
  47. #define XCHAL_HAVE_RELEASE_SYNC 0 /* L32AI/S32RI instructions */
  48. #define XCHAL_HAVE_S32C1I 0 /* S32C1I instruction */
  49. #define XCHAL_HAVE_SPECULATION 0 /* speculation */
  50. #define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */
  51. #define XCHAL_NUM_CONTEXTS 1 /* */
  52. #define XCHAL_NUM_MISC_REGS 2 /* num of scratch regs (0..4) */
  53. #define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */
  54. #define XCHAL_HAVE_PRID 1 /* processor ID register */
  55. #define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */
  56. #define XCHAL_HAVE_BOOLEANS 0 /* boolean registers */
  57. #define XCHAL_HAVE_CP 0 /* CPENABLE reg (coprocessor) */
  58. #define XCHAL_CP_MAXCFG 0 /* max allowed cp id plus one */
  59. #define XCHAL_HAVE_MAC16 0 /* MAC16 package */
  60. #define XCHAL_HAVE_VECTORFPU2005 0 /* vector floating-point pkg */
  61. #define XCHAL_HAVE_FP 0 /* floating point pkg */
  62. #define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */
  63. #define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */
  64. #define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */
  65. /*----------------------------------------------------------------------
  66. MISC
  67. ----------------------------------------------------------------------*/
  68. #define XCHAL_NUM_WRITEBUFFER_ENTRIES 4 /* size of write buffer */
  69. #define XCHAL_INST_FETCH_WIDTH 4 /* instr-fetch width in bytes */
  70. #define XCHAL_DATA_WIDTH 4 /* data width in bytes */
  71. /* In T1050, applies to selected core load and store instructions (see ISA): */
  72. #define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */
  73. #define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/
  74. #define XCHAL_CORE_ID "fsf" /* alphanum core name
  75. (CoreID) set in the Xtensa
  76. Processor Generator */
  77. #define XCHAL_BUILD_UNIQUE_ID 0x00006700 /* 22-bit sw build ID */
  78. /*
  79. * These definitions describe the hardware targeted by this software.
  80. */
  81. #define XCHAL_HW_CONFIGID0 0xC103C3FF /* ConfigID hi 32 bits*/
  82. #define XCHAL_HW_CONFIGID1 0x0C006700 /* ConfigID lo 32 bits*/
  83. #define XCHAL_HW_VERSION_NAME "LX2.0.0" /* full version name */
  84. #define XCHAL_HW_VERSION_MAJOR 2200 /* major ver# of targeted hw */
  85. #define XCHAL_HW_VERSION_MINOR 0 /* minor ver# of targeted hw */
  86. #define XTHAL_HW_REL_LX2 1
  87. #define XTHAL_HW_REL_LX2_0 1
  88. #define XTHAL_HW_REL_LX2_0_0 1
  89. #define XCHAL_HW_CONFIGID_RELIABLE 1
  90. /* If software targets a *range* of hardware versions, these are the bounds: */
  91. #define XCHAL_HW_MIN_VERSION_MAJOR 2200 /* major v of earliest tgt hw */
  92. #define XCHAL_HW_MIN_VERSION_MINOR 0 /* minor v of earliest tgt hw */
  93. #define XCHAL_HW_MAX_VERSION_MAJOR 2200 /* major v of latest tgt hw */
  94. #define XCHAL_HW_MAX_VERSION_MINOR 0 /* minor v of latest tgt hw */
  95. /*----------------------------------------------------------------------
  96. CACHE
  97. ----------------------------------------------------------------------*/
  98. #define XCHAL_ICACHE_LINESIZE 16 /* I-cache line size in bytes */
  99. #define XCHAL_DCACHE_LINESIZE 16 /* D-cache line size in bytes */
  100. #define XCHAL_ICACHE_LINEWIDTH 4 /* log2(I line size in bytes) */
  101. #define XCHAL_DCACHE_LINEWIDTH 4 /* log2(D line size in bytes) */
  102. #define XCHAL_ICACHE_SIZE 8192 /* I-cache size in bytes or 0 */
  103. #define XCHAL_DCACHE_SIZE 8192 /* D-cache size in bytes or 0 */
  104. #define XCHAL_DCACHE_IS_WRITEBACK 0 /* writeback feature */
  105. /****************************************************************************
  106. Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code
  107. ****************************************************************************/
  108. #ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY
  109. /*----------------------------------------------------------------------
  110. CACHE
  111. ----------------------------------------------------------------------*/
  112. #define XCHAL_HAVE_PIF 1 /* any outbound PIF present */
  113. /* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */
  114. /* Number of cache sets in log2(lines per way): */
  115. #define XCHAL_ICACHE_SETWIDTH 8
  116. #define XCHAL_DCACHE_SETWIDTH 8
  117. /* Cache set associativity (number of ways): */
  118. #define XCHAL_ICACHE_WAYS 2
  119. #define XCHAL_DCACHE_WAYS 2
  120. /* Cache features: */
  121. #define XCHAL_ICACHE_LINE_LOCKABLE 0
  122. #define XCHAL_DCACHE_LINE_LOCKABLE 0
  123. #define XCHAL_ICACHE_ECC_PARITY 0
  124. #define XCHAL_DCACHE_ECC_PARITY 0
  125. /* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */
  126. #define XCHAL_CA_BITS 4
  127. /*----------------------------------------------------------------------
  128. INTERNAL I/D RAM/ROMs and XLMI
  129. ----------------------------------------------------------------------*/
  130. #define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */
  131. #define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */
  132. #define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */
  133. #define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */
  134. #define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/
  135. #define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */
  136. /*----------------------------------------------------------------------
  137. INTERRUPTS and TIMERS
  138. ----------------------------------------------------------------------*/
  139. #define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */
  140. #define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */
  141. #define XCHAL_HAVE_NMI 0 /* non-maskable interrupt */
  142. #define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */
  143. #define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */
  144. #define XCHAL_NUM_INTERRUPTS 17 /* number of interrupts */
  145. #define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */
  146. #define XCHAL_NUM_EXTINTERRUPTS 10 /* num of external interrupts */
  147. #define XCHAL_NUM_INTLEVELS 4 /* number of interrupt levels
  148. (not including level zero) */
  149. #define XCHAL_EXCM_LEVEL 1 /* level masked by PS.EXCM */
  150. /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */
  151. /* Masks of interrupts at each interrupt level: */
  152. #define XCHAL_INTLEVEL1_MASK 0x000064F9
  153. #define XCHAL_INTLEVEL2_MASK 0x00008902
  154. #define XCHAL_INTLEVEL3_MASK 0x00011204
  155. #define XCHAL_INTLEVEL4_MASK 0x00000000
  156. #define XCHAL_INTLEVEL5_MASK 0x00000000
  157. #define XCHAL_INTLEVEL6_MASK 0x00000000
  158. #define XCHAL_INTLEVEL7_MASK 0x00000000
  159. /* Masks of interrupts at each range 1..n of interrupt levels: */
  160. #define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x000064F9
  161. #define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x0000EDFB
  162. #define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x0001FFFF
  163. #define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x0001FFFF
  164. #define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x0001FFFF
  165. #define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x0001FFFF
  166. #define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x0001FFFF
  167. /* Level of each interrupt: */
  168. #define XCHAL_INT0_LEVEL 1
  169. #define XCHAL_INT1_LEVEL 2
  170. #define XCHAL_INT2_LEVEL 3
  171. #define XCHAL_INT3_LEVEL 1
  172. #define XCHAL_INT4_LEVEL 1
  173. #define XCHAL_INT5_LEVEL 1
  174. #define XCHAL_INT6_LEVEL 1
  175. #define XCHAL_INT7_LEVEL 1
  176. #define XCHAL_INT8_LEVEL 2
  177. #define XCHAL_INT9_LEVEL 3
  178. #define XCHAL_INT10_LEVEL 1
  179. #define XCHAL_INT11_LEVEL 2
  180. #define XCHAL_INT12_LEVEL 3
  181. #define XCHAL_INT13_LEVEL 1
  182. #define XCHAL_INT14_LEVEL 1
  183. #define XCHAL_INT15_LEVEL 2
  184. #define XCHAL_INT16_LEVEL 3
  185. #define XCHAL_DEBUGLEVEL 4 /* debug interrupt level */
  186. #define XCHAL_HAVE_DEBUG_EXTERN_INT 0 /* OCD external db interrupt */
  187. /* Type of each interrupt: */
  188. #define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  189. #define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  190. #define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  191. #define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  192. #define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  193. #define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  194. #define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  195. #define XCHAL_INT7_TYPE XTHAL_INTTYPE_EXTERN_EDGE
  196. #define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_EDGE
  197. #define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_EDGE
  198. #define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER
  199. #define XCHAL_INT11_TYPE XTHAL_INTTYPE_TIMER
  200. #define XCHAL_INT12_TYPE XTHAL_INTTYPE_TIMER
  201. #define XCHAL_INT13_TYPE XTHAL_INTTYPE_SOFTWARE
  202. #define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE
  203. #define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE
  204. #define XCHAL_INT16_TYPE XTHAL_INTTYPE_SOFTWARE
  205. /* Masks of interrupts for each type of interrupt: */
  206. #define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFFE0000
  207. #define XCHAL_INTTYPE_MASK_SOFTWARE 0x0001E000
  208. #define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000380
  209. #define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000007F
  210. #define XCHAL_INTTYPE_MASK_TIMER 0x00001C00
  211. #define XCHAL_INTTYPE_MASK_NMI 0x00000000
  212. #define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000
  213. /* Interrupt numbers assigned to specific interrupt sources: */
  214. #define XCHAL_TIMER0_INTERRUPT 10 /* CCOMPARE0 */
  215. #define XCHAL_TIMER1_INTERRUPT 11 /* CCOMPARE1 */
  216. #define XCHAL_TIMER2_INTERRUPT 12 /* CCOMPARE2 */
  217. #define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED
  218. /* Interrupt numbers for levels at which only one interrupt is configured: */
  219. /* (There are many interrupts each at level(s) 1, 2, 3.) */
  220. /*
  221. * External interrupt vectors/levels.
  222. * These macros describe how Xtensa processor interrupt numbers
  223. * (as numbered internally, eg. in INTERRUPT and INTENABLE registers)
  224. * map to external BInterrupt<n> pins, for those interrupts
  225. * configured as external (level-triggered, edge-triggered, or NMI).
  226. * See the Xtensa processor databook for more details.
  227. */
  228. /* Core interrupt numbers mapped to each EXTERNAL interrupt number: */
  229. #define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */
  230. #define XCHAL_EXTINT1_NUM 1 /* (intlevel 2) */
  231. #define XCHAL_EXTINT2_NUM 2 /* (intlevel 3) */
  232. #define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */
  233. #define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */
  234. #define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */
  235. #define XCHAL_EXTINT6_NUM 6 /* (intlevel 1) */
  236. #define XCHAL_EXTINT7_NUM 7 /* (intlevel 1) */
  237. #define XCHAL_EXTINT8_NUM 8 /* (intlevel 2) */
  238. #define XCHAL_EXTINT9_NUM 9 /* (intlevel 3) */
  239. /*----------------------------------------------------------------------
  240. EXCEPTIONS and VECTORS
  241. ----------------------------------------------------------------------*/
  242. #define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture
  243. number: 1 == XEA1 (old)
  244. 2 == XEA2 (new)
  245. 0 == XEAX (extern) */
  246. #define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */
  247. #define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */
  248. #define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */
  249. #define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */
  250. #define XCHAL_HAVE_MEM_ECC_PARITY 0 /* local memory ECC/parity */
  251. #define XCHAL_RESET_VECTOR_VADDR 0xFE000020
  252. #define XCHAL_RESET_VECTOR_PADDR 0xFE000020
  253. #define XCHAL_USER_VECTOR_VADDR 0xD0000220
  254. #define XCHAL_USER_VECTOR_PADDR 0x00000220
  255. #define XCHAL_KERNEL_VECTOR_VADDR 0xD0000200
  256. #define XCHAL_KERNEL_VECTOR_PADDR 0x00000200
  257. #define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD0000290
  258. #define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x00000290
  259. #define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000
  260. #define XCHAL_WINDOW_VECTORS_PADDR 0x00000000
  261. #define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000240
  262. #define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000240
  263. #define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD0000250
  264. #define XCHAL_INTLEVEL3_VECTOR_PADDR 0x00000250
  265. #define XCHAL_INTLEVEL4_VECTOR_VADDR 0xFE000520
  266. #define XCHAL_INTLEVEL4_VECTOR_PADDR 0xFE000520
  267. #define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR
  268. #define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL4_VECTOR_PADDR
  269. /*----------------------------------------------------------------------
  270. DEBUG
  271. ----------------------------------------------------------------------*/
  272. #define XCHAL_HAVE_OCD 1 /* OnChipDebug option */
  273. #define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */
  274. #define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */
  275. #define XCHAL_HAVE_OCD_DIR_ARRAY 1 /* faster OCD option */
  276. /*----------------------------------------------------------------------
  277. MMU
  278. ----------------------------------------------------------------------*/
  279. /* See <xtensa/config/core-matmap.h> header file for more details. */
  280. #define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */
  281. #define XCHAL_HAVE_SPANNING_WAY 0 /* one way maps I+D 4GB vaddr */
  282. #define XCHAL_HAVE_IDENTITY_MAP 0 /* vaddr == paddr always */
  283. #define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */
  284. #define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* region protection */
  285. #define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */
  286. #define XCHAL_HAVE_PTP_MMU 1 /* full MMU (with page table
  287. [autorefill] and protection)
  288. usable for an MMU-based OS */
  289. /* If none of the above last 4 are set, it's a custom TLB configuration. */
  290. #define XCHAL_ITLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
  291. #define XCHAL_DTLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
  292. #define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs */
  293. #define XCHAL_MMU_RINGS 4 /* number of rings (1..4) */
  294. #define XCHAL_MMU_RING_BITS 2 /* num of bits in RING field */
  295. #endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */
  296. #endif /* _XTENSA_CORE_CONFIGURATION_H */