core.h 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. /*
  2. * xtensa/config/core.h -- HAL definitions that are dependent on CORE configuration
  3. *
  4. * This header file is sometimes referred to as the "compile-time HAL" or CHAL.
  5. * It was generated for a specific Xtensa processor configuration.
  6. *
  7. * Source for configuration-independent binaries (which link in a
  8. * configuration-specific HAL library) must NEVER include this file.
  9. * It is perfectly normal, however, for the HAL source itself to include this file.
  10. */
  11. /*
  12. * Copyright (c) 2003 Tensilica, Inc. All Rights Reserved.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of version 2.1 of the GNU Lesser General Public
  16. * License as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it would be useful, but
  19. * WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. *
  22. * Further, this software is distributed without any warranty that it is
  23. * free of the rightful claim of any third person regarding infringement
  24. * or the like. Any license provided herein, whether implied or
  25. * otherwise, applies only to this software file. Patent licenses, if
  26. * any, provided herein do not apply to combinations of this program with
  27. * other software, or any other product whatsoever.
  28. *
  29. * You should have received a copy of the GNU Lesser General Public
  30. * License along with this program; if not, write the Free Software
  31. * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
  32. * USA.
  33. */
  34. #ifndef XTENSA_CONFIG_CORE_H
  35. #define XTENSA_CONFIG_CORE_H
  36. #include <xtensa/hal.h>
  37. /*----------------------------------------------------------------------
  38. GENERAL
  39. ----------------------------------------------------------------------*/
  40. /*
  41. * Separators for macros that expand into arrays.
  42. * These can be predefined by files that #include this one,
  43. * when different separators are required.
  44. */
  45. /* Element separator for macros that expand into 1-dimensional arrays: */
  46. #ifndef XCHAL_SEP
  47. #define XCHAL_SEP ,
  48. #endif
  49. /* Array separator for macros that expand into 2-dimensional arrays: */
  50. #ifndef XCHAL_SEP2
  51. #define XCHAL_SEP2 },{
  52. #endif
  53. /*----------------------------------------------------------------------
  54. ENDIANNESS
  55. ----------------------------------------------------------------------*/
  56. #define XCHAL_HAVE_BE 1
  57. #define XCHAL_HAVE_LE 0
  58. #define XCHAL_MEMORY_ORDER XTHAL_BIGENDIAN
  59. /*----------------------------------------------------------------------
  60. REGISTER WINDOWS
  61. ----------------------------------------------------------------------*/
  62. #define XCHAL_HAVE_WINDOWED 1 /* 1 if windowed registers option configured, 0 otherwise */
  63. #define XCHAL_NUM_AREGS 64 /* number of physical address regs */
  64. #define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */
  65. /*----------------------------------------------------------------------
  66. ADDRESS ALIGNMENT
  67. ----------------------------------------------------------------------*/
  68. /* These apply to a selected set of core load and store instructions only (see ISA): */
  69. #define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* 1 if unaligned loads cause an exception, 0 otherwise */
  70. #define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* 1 if unaligned stores cause an exception, 0 otherwise */
  71. /*----------------------------------------------------------------------
  72. INTERRUPTS
  73. ----------------------------------------------------------------------*/
  74. #define XCHAL_HAVE_INTERRUPTS 1 /* 1 if interrupt option configured, 0 otherwise */
  75. #define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* 1 if high-priority interrupt option configured, 0 otherwise */
  76. #define XCHAL_HAVE_HIGHLEVEL_INTERRUPTS XCHAL_HAVE_HIGHPRI_INTERRUPTS
  77. #define XCHAL_HAVE_NMI 0 /* 1 if NMI option configured, 0 otherwise */
  78. #define XCHAL_NUM_INTERRUPTS 17 /* number of interrupts */
  79. #define XCHAL_NUM_INTERRUPTS_LOG2 5 /* number of bits to hold an interrupt number: roundup(log2(number of interrupts)) */
  80. #define XCHAL_NUM_EXTINTERRUPTS 10 /* number of external interrupts */
  81. #define XCHAL_NUM_INTLEVELS 4 /* number of interrupt levels (not including level zero!) */
  82. #define XCHAL_NUM_LOWPRI_LEVELS 1 /* number of low-priority interrupt levels (always 1) */
  83. #define XCHAL_FIRST_HIGHPRI_LEVEL (XCHAL_NUM_LOWPRI_LEVELS+1) /* level of first high-priority interrupt (always 2) */
  84. #define XCHAL_EXCM_LEVEL 1 /* level of interrupts masked by PS.EXCM (XEA2 only; always 1 in T10xx);
  85. for XEA1, where there is no PS.EXCM, this is always 1;
  86. interrupts at levels FIRST_HIGHPRI <= n <= EXCM_LEVEL, if any,
  87. are termed "medium priority" interrupts (post T10xx only) */
  88. /* Note: 1 <= LOWPRI_LEVELS <= EXCM_LEVEL < DEBUGLEVEL <= NUM_INTLEVELS < NMILEVEL <= 15 */
  89. /* Masks of interrupts at each interrupt level: */
  90. #define XCHAL_INTLEVEL0_MASK 0x00000000
  91. #define XCHAL_INTLEVEL1_MASK 0x000064F9
  92. #define XCHAL_INTLEVEL2_MASK 0x00008902
  93. #define XCHAL_INTLEVEL3_MASK 0x00011204
  94. #define XCHAL_INTLEVEL4_MASK 0x00000000
  95. #define XCHAL_INTLEVEL5_MASK 0x00000000
  96. #define XCHAL_INTLEVEL6_MASK 0x00000000
  97. #define XCHAL_INTLEVEL7_MASK 0x00000000
  98. #define XCHAL_INTLEVEL8_MASK 0x00000000
  99. #define XCHAL_INTLEVEL9_MASK 0x00000000
  100. #define XCHAL_INTLEVEL10_MASK 0x00000000
  101. #define XCHAL_INTLEVEL11_MASK 0x00000000
  102. #define XCHAL_INTLEVEL12_MASK 0x00000000
  103. #define XCHAL_INTLEVEL13_MASK 0x00000000
  104. #define XCHAL_INTLEVEL14_MASK 0x00000000
  105. #define XCHAL_INTLEVEL15_MASK 0x00000000
  106. /* As an array of entries (eg. for C constant arrays): */
  107. #define XCHAL_INTLEVEL_MASKS 0x00000000 XCHAL_SEP \
  108. 0x000064F9 XCHAL_SEP \
  109. 0x00008902 XCHAL_SEP \
  110. 0x00011204 XCHAL_SEP \
  111. 0x00000000 XCHAL_SEP \
  112. 0x00000000 XCHAL_SEP \
  113. 0x00000000 XCHAL_SEP \
  114. 0x00000000 XCHAL_SEP \
  115. 0x00000000 XCHAL_SEP \
  116. 0x00000000 XCHAL_SEP \
  117. 0x00000000 XCHAL_SEP \
  118. 0x00000000 XCHAL_SEP \
  119. 0x00000000 XCHAL_SEP \
  120. 0x00000000 XCHAL_SEP \
  121. 0x00000000 XCHAL_SEP \
  122. 0x00000000
  123. /* Masks of interrupts at each range 1..n of interrupt levels: */
  124. #define XCHAL_INTLEVEL0_ANDBELOW_MASK 0x00000000
  125. #define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x000064F9
  126. #define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x0000EDFB
  127. #define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x0001FFFF
  128. #define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x0001FFFF
  129. #define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x0001FFFF
  130. #define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x0001FFFF
  131. #define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x0001FFFF
  132. #define XCHAL_INTLEVEL8_ANDBELOW_MASK 0x0001FFFF
  133. #define XCHAL_INTLEVEL9_ANDBELOW_MASK 0x0001FFFF
  134. #define XCHAL_INTLEVEL10_ANDBELOW_MASK 0x0001FFFF
  135. #define XCHAL_INTLEVEL11_ANDBELOW_MASK 0x0001FFFF
  136. #define XCHAL_INTLEVEL12_ANDBELOW_MASK 0x0001FFFF
  137. #define XCHAL_INTLEVEL13_ANDBELOW_MASK 0x0001FFFF
  138. #define XCHAL_INTLEVEL14_ANDBELOW_MASK 0x0001FFFF
  139. #define XCHAL_INTLEVEL15_ANDBELOW_MASK 0x0001FFFF
  140. #define XCHAL_LOWPRI_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK /* mask of all low-priority interrupts */
  141. #define XCHAL_EXCM_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK /* mask of all interrupts masked by PS.EXCM (or CEXCM) */
  142. /* As an array of entries (eg. for C constant arrays): */
  143. #define XCHAL_INTLEVEL_ANDBELOW_MASKS 0x00000000 XCHAL_SEP \
  144. 0x000064F9 XCHAL_SEP \
  145. 0x0000EDFB XCHAL_SEP \
  146. 0x0001FFFF XCHAL_SEP \
  147. 0x0001FFFF XCHAL_SEP \
  148. 0x0001FFFF XCHAL_SEP \
  149. 0x0001FFFF XCHAL_SEP \
  150. 0x0001FFFF XCHAL_SEP \
  151. 0x0001FFFF XCHAL_SEP \
  152. 0x0001FFFF XCHAL_SEP \
  153. 0x0001FFFF XCHAL_SEP \
  154. 0x0001FFFF XCHAL_SEP \
  155. 0x0001FFFF XCHAL_SEP \
  156. 0x0001FFFF XCHAL_SEP \
  157. 0x0001FFFF XCHAL_SEP \
  158. 0x0001FFFF
  159. /* Interrupt numbers for each interrupt level at which only one interrupt was configured: */
  160. /*#define XCHAL_INTLEVEL1_NUM ...more than one interrupt at this level...*/
  161. /*#define XCHAL_INTLEVEL2_NUM ...more than one interrupt at this level...*/
  162. /*#define XCHAL_INTLEVEL3_NUM ...more than one interrupt at this level...*/
  163. /* Level of each interrupt: */
  164. #define XCHAL_INT0_LEVEL 1
  165. #define XCHAL_INT1_LEVEL 2
  166. #define XCHAL_INT2_LEVEL 3
  167. #define XCHAL_INT3_LEVEL 1
  168. #define XCHAL_INT4_LEVEL 1
  169. #define XCHAL_INT5_LEVEL 1
  170. #define XCHAL_INT6_LEVEL 1
  171. #define XCHAL_INT7_LEVEL 1
  172. #define XCHAL_INT8_LEVEL 2
  173. #define XCHAL_INT9_LEVEL 3
  174. #define XCHAL_INT10_LEVEL 1
  175. #define XCHAL_INT11_LEVEL 2
  176. #define XCHAL_INT12_LEVEL 3
  177. #define XCHAL_INT13_LEVEL 1
  178. #define XCHAL_INT14_LEVEL 1
  179. #define XCHAL_INT15_LEVEL 2
  180. #define XCHAL_INT16_LEVEL 3
  181. #define XCHAL_INT17_LEVEL 0
  182. #define XCHAL_INT18_LEVEL 0
  183. #define XCHAL_INT19_LEVEL 0
  184. #define XCHAL_INT20_LEVEL 0
  185. #define XCHAL_INT21_LEVEL 0
  186. #define XCHAL_INT22_LEVEL 0
  187. #define XCHAL_INT23_LEVEL 0
  188. #define XCHAL_INT24_LEVEL 0
  189. #define XCHAL_INT25_LEVEL 0
  190. #define XCHAL_INT26_LEVEL 0
  191. #define XCHAL_INT27_LEVEL 0
  192. #define XCHAL_INT28_LEVEL 0
  193. #define XCHAL_INT29_LEVEL 0
  194. #define XCHAL_INT30_LEVEL 0
  195. #define XCHAL_INT31_LEVEL 0
  196. /* As an array of entries (eg. for C constant arrays): */
  197. #define XCHAL_INT_LEVELS 1 XCHAL_SEP \
  198. 2 XCHAL_SEP \
  199. 3 XCHAL_SEP \
  200. 1 XCHAL_SEP \
  201. 1 XCHAL_SEP \
  202. 1 XCHAL_SEP \
  203. 1 XCHAL_SEP \
  204. 1 XCHAL_SEP \
  205. 2 XCHAL_SEP \
  206. 3 XCHAL_SEP \
  207. 1 XCHAL_SEP \
  208. 2 XCHAL_SEP \
  209. 3 XCHAL_SEP \
  210. 1 XCHAL_SEP \
  211. 1 XCHAL_SEP \
  212. 2 XCHAL_SEP \
  213. 3 XCHAL_SEP \
  214. 0 XCHAL_SEP \
  215. 0 XCHAL_SEP \
  216. 0 XCHAL_SEP \
  217. 0 XCHAL_SEP \
  218. 0 XCHAL_SEP \
  219. 0 XCHAL_SEP \
  220. 0 XCHAL_SEP \
  221. 0 XCHAL_SEP \
  222. 0 XCHAL_SEP \
  223. 0 XCHAL_SEP \
  224. 0 XCHAL_SEP \
  225. 0 XCHAL_SEP \
  226. 0 XCHAL_SEP \
  227. 0 XCHAL_SEP \
  228. 0
  229. /* Type of each interrupt: */
  230. #define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  231. #define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  232. #define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  233. #define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  234. #define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  235. #define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  236. #define XCHAL_INT6_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
  237. #define XCHAL_INT7_TYPE XTHAL_INTTYPE_EXTERN_EDGE
  238. #define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_EDGE
  239. #define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_EDGE
  240. #define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER
  241. #define XCHAL_INT11_TYPE XTHAL_INTTYPE_TIMER
  242. #define XCHAL_INT12_TYPE XTHAL_INTTYPE_TIMER
  243. #define XCHAL_INT13_TYPE XTHAL_INTTYPE_SOFTWARE
  244. #define XCHAL_INT14_TYPE XTHAL_INTTYPE_SOFTWARE
  245. #define XCHAL_INT15_TYPE XTHAL_INTTYPE_SOFTWARE
  246. #define XCHAL_INT16_TYPE XTHAL_INTTYPE_SOFTWARE
  247. #define XCHAL_INT17_TYPE XTHAL_INTTYPE_UNCONFIGURED
  248. #define XCHAL_INT18_TYPE XTHAL_INTTYPE_UNCONFIGURED
  249. #define XCHAL_INT19_TYPE XTHAL_INTTYPE_UNCONFIGURED
  250. #define XCHAL_INT20_TYPE XTHAL_INTTYPE_UNCONFIGURED
  251. #define XCHAL_INT21_TYPE XTHAL_INTTYPE_UNCONFIGURED
  252. #define XCHAL_INT22_TYPE XTHAL_INTTYPE_UNCONFIGURED
  253. #define XCHAL_INT23_TYPE XTHAL_INTTYPE_UNCONFIGURED
  254. #define XCHAL_INT24_TYPE XTHAL_INTTYPE_UNCONFIGURED
  255. #define XCHAL_INT25_TYPE XTHAL_INTTYPE_UNCONFIGURED
  256. #define XCHAL_INT26_TYPE XTHAL_INTTYPE_UNCONFIGURED
  257. #define XCHAL_INT27_TYPE XTHAL_INTTYPE_UNCONFIGURED
  258. #define XCHAL_INT28_TYPE XTHAL_INTTYPE_UNCONFIGURED
  259. #define XCHAL_INT29_TYPE XTHAL_INTTYPE_UNCONFIGURED
  260. #define XCHAL_INT30_TYPE XTHAL_INTTYPE_UNCONFIGURED
  261. #define XCHAL_INT31_TYPE XTHAL_INTTYPE_UNCONFIGURED
  262. /* As an array of entries (eg. for C constant arrays): */
  263. #define XCHAL_INT_TYPES XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  264. XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  265. XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  266. XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  267. XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  268. XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  269. XTHAL_INTTYPE_EXTERN_LEVEL XCHAL_SEP \
  270. XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \
  271. XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \
  272. XTHAL_INTTYPE_EXTERN_EDGE XCHAL_SEP \
  273. XTHAL_INTTYPE_TIMER XCHAL_SEP \
  274. XTHAL_INTTYPE_TIMER XCHAL_SEP \
  275. XTHAL_INTTYPE_TIMER XCHAL_SEP \
  276. XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \
  277. XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \
  278. XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \
  279. XTHAL_INTTYPE_SOFTWARE XCHAL_SEP \
  280. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  281. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  282. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  283. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  284. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  285. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  286. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  287. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  288. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  289. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  290. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  291. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  292. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  293. XTHAL_INTTYPE_UNCONFIGURED XCHAL_SEP \
  294. XTHAL_INTTYPE_UNCONFIGURED
  295. /* Masks of interrupts for each type of interrupt: */
  296. #define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFFE0000
  297. #define XCHAL_INTTYPE_MASK_SOFTWARE 0x0001E000
  298. #define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x00000380
  299. #define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000007F
  300. #define XCHAL_INTTYPE_MASK_TIMER 0x00001C00
  301. #define XCHAL_INTTYPE_MASK_NMI 0x00000000
  302. /* As an array of entries (eg. for C constant arrays): */
  303. #define XCHAL_INTTYPE_MASKS 0xFFFE0000 XCHAL_SEP \
  304. 0x0001E000 XCHAL_SEP \
  305. 0x00000380 XCHAL_SEP \
  306. 0x0000007F XCHAL_SEP \
  307. 0x00001C00 XCHAL_SEP \
  308. 0x00000000
  309. /* Interrupts assigned to each timer (CCOMPARE0 to CCOMPARE3), -1 if unassigned */
  310. #define XCHAL_TIMER0_INTERRUPT 10
  311. #define XCHAL_TIMER1_INTERRUPT 11
  312. #define XCHAL_TIMER2_INTERRUPT 12
  313. #define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED
  314. /* As an array of entries (eg. for C constant arrays): */
  315. #define XCHAL_TIMER_INTERRUPTS 10 XCHAL_SEP \
  316. 11 XCHAL_SEP \
  317. 12 XCHAL_SEP \
  318. XTHAL_TIMER_UNCONFIGURED
  319. /* Indexing macros: */
  320. #define _XCHAL_INTLEVEL_MASK(n) XCHAL_INTLEVEL ## n ## _MASK
  321. #define XCHAL_INTLEVEL_MASK(n) _XCHAL_INTLEVEL_MASK(n) /* n = 0 .. 15 */
  322. #define _XCHAL_INTLEVEL_ANDBELOWMASK(n) XCHAL_INTLEVEL ## n ## _ANDBELOW_MASK
  323. #define XCHAL_INTLEVEL_ANDBELOW_MASK(n) _XCHAL_INTLEVEL_ANDBELOWMASK(n) /* n = 0 .. 15 */
  324. #define _XCHAL_INT_LEVEL(n) XCHAL_INT ## n ## _LEVEL
  325. #define XCHAL_INT_LEVEL(n) _XCHAL_INT_LEVEL(n) /* n = 0 .. 31 */
  326. #define _XCHAL_INT_TYPE(n) XCHAL_INT ## n ## _TYPE
  327. #define XCHAL_INT_TYPE(n) _XCHAL_INT_TYPE(n) /* n = 0 .. 31 */
  328. #define _XCHAL_TIMER_INTERRUPT(n) XCHAL_TIMER ## n ## _INTERRUPT
  329. #define XCHAL_TIMER_INTERRUPT(n) _XCHAL_TIMER_INTERRUPT(n) /* n = 0 .. 3 */
  330. /*
  331. * External interrupt vectors/levels.
  332. * These macros describe how Xtensa processor interrupt numbers
  333. * (as numbered internally, eg. in INTERRUPT and INTENABLE registers)
  334. * map to external BInterrupt<n> pins, for those interrupts
  335. * configured as external (level-triggered, edge-triggered, or NMI).
  336. * See the Xtensa processor databook for more details.
  337. */
  338. /* Core interrupt numbers mapped to each EXTERNAL interrupt number: */
  339. #define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */
  340. #define XCHAL_EXTINT1_NUM 1 /* (intlevel 2) */
  341. #define XCHAL_EXTINT2_NUM 2 /* (intlevel 3) */
  342. #define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */
  343. #define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */
  344. #define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */
  345. #define XCHAL_EXTINT6_NUM 6 /* (intlevel 1) */
  346. #define XCHAL_EXTINT7_NUM 7 /* (intlevel 1) */
  347. #define XCHAL_EXTINT8_NUM 8 /* (intlevel 2) */
  348. #define XCHAL_EXTINT9_NUM 9 /* (intlevel 3) */
  349. /* Corresponding interrupt masks: */
  350. #define XCHAL_EXTINT0_MASK 0x00000001
  351. #define XCHAL_EXTINT1_MASK 0x00000002
  352. #define XCHAL_EXTINT2_MASK 0x00000004
  353. #define XCHAL_EXTINT3_MASK 0x00000008
  354. #define XCHAL_EXTINT4_MASK 0x00000010
  355. #define XCHAL_EXTINT5_MASK 0x00000020
  356. #define XCHAL_EXTINT6_MASK 0x00000040
  357. #define XCHAL_EXTINT7_MASK 0x00000080
  358. #define XCHAL_EXTINT8_MASK 0x00000100
  359. #define XCHAL_EXTINT9_MASK 0x00000200
  360. /* Core config interrupt levels mapped to each external interrupt: */
  361. #define XCHAL_EXTINT0_LEVEL 1 /* (int number 0) */
  362. #define XCHAL_EXTINT1_LEVEL 2 /* (int number 1) */
  363. #define XCHAL_EXTINT2_LEVEL 3 /* (int number 2) */
  364. #define XCHAL_EXTINT3_LEVEL 1 /* (int number 3) */
  365. #define XCHAL_EXTINT4_LEVEL 1 /* (int number 4) */
  366. #define XCHAL_EXTINT5_LEVEL 1 /* (int number 5) */
  367. #define XCHAL_EXTINT6_LEVEL 1 /* (int number 6) */
  368. #define XCHAL_EXTINT7_LEVEL 1 /* (int number 7) */
  369. #define XCHAL_EXTINT8_LEVEL 2 /* (int number 8) */
  370. #define XCHAL_EXTINT9_LEVEL 3 /* (int number 9) */
  371. /*----------------------------------------------------------------------
  372. EXCEPTIONS and VECTORS
  373. ----------------------------------------------------------------------*/
  374. #define XCHAL_HAVE_EXCEPTIONS 1 /* 1 if exception option configured, 0 otherwise */
  375. #define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture number: 1 for XEA1 (old), 2 for XEA2 (new) */
  376. #define XCHAL_HAVE_XEA1 0 /* 1 if XEA1, 0 otherwise */
  377. #define XCHAL_HAVE_XEA2 1 /* 1 if XEA2, 0 otherwise */
  378. /* For backward compatibility ONLY -- DO NOT USE (will be removed in future release): */
  379. #define XCHAL_HAVE_OLD_EXC_ARCH XCHAL_HAVE_XEA1 /* (DEPRECATED) 1 if old exception architecture (XEA1), 0 otherwise (eg. XEA2) */
  380. #define XCHAL_HAVE_EXCM XCHAL_HAVE_XEA2 /* (DEPRECATED) 1 if PS.EXCM bit exists (currently equals XCHAL_HAVE_TLBS) */
  381. #define XCHAL_RESET_VECTOR_VADDR 0xFE000020
  382. #define XCHAL_RESET_VECTOR_PADDR 0xFE000020
  383. #define XCHAL_USER_VECTOR_VADDR 0xD0000220
  384. #define XCHAL_PROGRAMEXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR /* for backward compatibility */
  385. #define XCHAL_USEREXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR /* for backward compatibility */
  386. #define XCHAL_USER_VECTOR_PADDR 0x00000220
  387. #define XCHAL_PROGRAMEXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR /* for backward compatibility */
  388. #define XCHAL_USEREXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR /* for backward compatibility */
  389. #define XCHAL_KERNEL_VECTOR_VADDR 0xD0000200
  390. #define XCHAL_STACKEDEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR /* for backward compatibility */
  391. #define XCHAL_KERNELEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR /* for backward compatibility */
  392. #define XCHAL_KERNEL_VECTOR_PADDR 0x00000200
  393. #define XCHAL_STACKEDEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR /* for backward compatibility */
  394. #define XCHAL_KERNELEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR /* for backward compatibility */
  395. #define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD0000290
  396. #define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x00000290
  397. #define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000
  398. #define XCHAL_WINDOW_VECTORS_PADDR 0x00000000
  399. #define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000240
  400. #define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000240
  401. #define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD0000250
  402. #define XCHAL_INTLEVEL3_VECTOR_PADDR 0x00000250
  403. #define XCHAL_INTLEVEL4_VECTOR_VADDR 0xFE000520
  404. #define XCHAL_INTLEVEL4_VECTOR_PADDR 0xFE000520
  405. #define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR
  406. #define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL4_VECTOR_PADDR
  407. /* Indexing macros: */
  408. #define _XCHAL_INTLEVEL_VECTOR_VADDR(n) XCHAL_INTLEVEL ## n ## _VECTOR_VADDR
  409. #define XCHAL_INTLEVEL_VECTOR_VADDR(n) _XCHAL_INTLEVEL_VECTOR_VADDR(n) /* n = 0 .. 15 */
  410. /*
  411. * General Exception Causes
  412. * (values of EXCCAUSE special register set by general exceptions,
  413. * which vector to the user, kernel, or double-exception vectors):
  414. */
  415. #define XCHAL_EXCCAUSE_ILLEGAL_INSTRUCTION 0 /* Illegal Instruction (IllegalInstruction) */
  416. #define XCHAL_EXCCAUSE_SYSTEM_CALL 1 /* System Call (SystemCall) */
  417. #define XCHAL_EXCCAUSE_INSTRUCTION_FETCH_ERROR 2 /* Instruction Fetch Error (InstructionFetchError) */
  418. #define XCHAL_EXCCAUSE_LOAD_STORE_ERROR 3 /* Load Store Error (LoadStoreError) */
  419. #define XCHAL_EXCCAUSE_LEVEL1_INTERRUPT 4 /* Level 1 Interrupt (Level1Interrupt) */
  420. #define XCHAL_EXCCAUSE_ALLOCA 5 /* Stack Extension Assist (Alloca) */
  421. #define XCHAL_EXCCAUSE_INTEGER_DIVIDE_BY_ZERO 6 /* Integer Divide by Zero (IntegerDivideByZero) */
  422. #define XCHAL_EXCCAUSE_SPECULATION 7 /* Speculation (Speculation) */
  423. #define XCHAL_EXCCAUSE_PRIVILEGED 8 /* Privileged Instruction (Privileged) */
  424. #define XCHAL_EXCCAUSE_UNALIGNED 9 /* Unaligned Load Store (Unaligned) */
  425. #define XCHAL_EXCCAUSE_ITLB_MISS 16 /* ITlb Miss Exception (ITlbMiss) */
  426. #define XCHAL_EXCCAUSE_ITLB_MULTIHIT 17 /* ITlb Mutltihit Exception (ITlbMultihit) */
  427. #define XCHAL_EXCCAUSE_ITLB_PRIVILEGE 18 /* ITlb Privilege Exception (ITlbPrivilege) */
  428. #define XCHAL_EXCCAUSE_ITLB_SIZE_RESTRICTION 19 /* ITlb Size Restriction Exception (ITlbSizeRestriction) */
  429. #define XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE 20 /* Fetch Cache Attribute Exception (FetchCacheAttribute) */
  430. #define XCHAL_EXCCAUSE_DTLB_MISS 24 /* DTlb Miss Exception (DTlbMiss) */
  431. #define XCHAL_EXCCAUSE_DTLB_MULTIHIT 25 /* DTlb Multihit Exception (DTlbMultihit) */
  432. #define XCHAL_EXCCAUSE_DTLB_PRIVILEGE 26 /* DTlb Privilege Exception (DTlbPrivilege) */
  433. #define XCHAL_EXCCAUSE_DTLB_SIZE_RESTRICTION 27 /* DTlb Size Restriction Exception (DTlbSizeRestriction) */
  434. #define XCHAL_EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28 /* Load Cache Attribute Exception (LoadCacheAttribute) */
  435. #define XCHAL_EXCCAUSE_STORE_CACHE_ATTRIBUTE 29 /* Store Cache Attribute Exception (StoreCacheAttribute) */
  436. #define XCHAL_EXCCAUSE_FLOATING_POINT 40 /* Floating Point Exception (FloatingPoint) */
  437. /*----------------------------------------------------------------------
  438. TIMERS
  439. ----------------------------------------------------------------------*/
  440. #define XCHAL_HAVE_CCOUNT 1 /* 1 if have CCOUNT, 0 otherwise */
  441. /*#define XCHAL_HAVE_TIMERS XCHAL_HAVE_CCOUNT*/
  442. #define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */
  443. /*----------------------------------------------------------------------
  444. DEBUG
  445. ----------------------------------------------------------------------*/
  446. #define XCHAL_HAVE_DEBUG 1 /* 1 if debug option configured, 0 otherwise */
  447. #define XCHAL_HAVE_OCD 1 /* 1 if OnChipDebug option configured, 0 otherwise */
  448. #define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */
  449. #define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */
  450. #define XCHAL_DEBUGLEVEL 4 /* debug interrupt level */
  451. /*DebugExternalInterrupt 0 0|1*/
  452. /*DebugUseDIRArray 0 0|1*/
  453. /*----------------------------------------------------------------------
  454. COPROCESSORS and EXTRA STATE
  455. ----------------------------------------------------------------------*/
  456. #define XCHAL_HAVE_CP 0 /* 1 if coprocessor option configured (CPENABLE present) */
  457. #define XCHAL_CP_MAXCFG 0 /* max allowed cp id plus one (per cfg) */
  458. #include <xtensa/config/tie.h>
  459. /*----------------------------------------------------------------------
  460. INTERNAL I/D RAM/ROMs and XLMI
  461. ----------------------------------------------------------------------*/
  462. #define XCHAL_NUM_INSTROM 0 /* number of core instruction ROMs configured */
  463. #define XCHAL_NUM_INSTRAM 0 /* number of core instruction RAMs configured */
  464. #define XCHAL_NUM_DATAROM 0 /* number of core data ROMs configured */
  465. #define XCHAL_NUM_DATARAM 0 /* number of core data RAMs configured */
  466. #define XCHAL_NUM_XLMI 0 /* number of core XLMI ports configured */
  467. #define XCHAL_NUM_IROM XCHAL_NUM_INSTROM /* (DEPRECATED) */
  468. #define XCHAL_NUM_IRAM XCHAL_NUM_INSTRAM /* (DEPRECATED) */
  469. #define XCHAL_NUM_DROM XCHAL_NUM_DATAROM /* (DEPRECATED) */
  470. #define XCHAL_NUM_DRAM XCHAL_NUM_DATARAM /* (DEPRECATED) */
  471. /*----------------------------------------------------------------------
  472. CACHE
  473. ----------------------------------------------------------------------*/
  474. /* Size of the cache lines in log2(bytes): */
  475. #define XCHAL_ICACHE_LINEWIDTH 4
  476. #define XCHAL_DCACHE_LINEWIDTH 4
  477. /* Size of the cache lines in bytes: */
  478. #define XCHAL_ICACHE_LINESIZE 16
  479. #define XCHAL_DCACHE_LINESIZE 16
  480. /* Max for both I-cache and D-cache (used for general alignment): */
  481. #define XCHAL_CACHE_LINEWIDTH_MAX 4
  482. #define XCHAL_CACHE_LINESIZE_MAX 16
  483. /* Number of cache sets in log2(lines per way): */
  484. #define XCHAL_ICACHE_SETWIDTH 8
  485. #define XCHAL_DCACHE_SETWIDTH 8
  486. /* Max for both I-cache and D-cache (used for general cache-coherency page alignment): */
  487. #define XCHAL_CACHE_SETWIDTH_MAX 8
  488. #define XCHAL_CACHE_SETSIZE_MAX 256
  489. /* Cache set associativity (number of ways): */
  490. #define XCHAL_ICACHE_WAYS 2
  491. #define XCHAL_DCACHE_WAYS 2
  492. /* Size of the caches in bytes (ways * 2^(linewidth + setwidth)): */
  493. #define XCHAL_ICACHE_SIZE 8192
  494. #define XCHAL_DCACHE_SIZE 8192
  495. /* Cache features: */
  496. #define XCHAL_DCACHE_IS_WRITEBACK 0
  497. /* Whether cache locking feature is available: */
  498. #define XCHAL_ICACHE_LINE_LOCKABLE 0
  499. #define XCHAL_DCACHE_LINE_LOCKABLE 0
  500. /* Number of (encoded) cache attribute bits: */
  501. #define XCHAL_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */
  502. /* (The number of access mode bits (decoded cache attribute bits) is defined by the architecture; see xtensa/hal.h?) */
  503. /* Cache Attribute encodings -- lists of access modes for each cache attribute: */
  504. #define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \
  505. XTHAL_FAM_BYPASS XCHAL_SEP \
  506. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  507. XTHAL_FAM_BYPASS XCHAL_SEP \
  508. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  509. XTHAL_FAM_CACHED XCHAL_SEP \
  510. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  511. XTHAL_FAM_CACHED XCHAL_SEP \
  512. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  513. XTHAL_FAM_CACHED XCHAL_SEP \
  514. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  515. XTHAL_FAM_CACHED XCHAL_SEP \
  516. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  517. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  518. XTHAL_FAM_EXCEPTION XCHAL_SEP \
  519. XTHAL_FAM_EXCEPTION
  520. #define XCHAL_LCA_LIST XTHAL_LAM_EXCEPTION XCHAL_SEP \
  521. XTHAL_LAM_BYPASSG XCHAL_SEP \
  522. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  523. XTHAL_LAM_BYPASSG XCHAL_SEP \
  524. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  525. XTHAL_LAM_CACHED XCHAL_SEP \
  526. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  527. XTHAL_LAM_CACHED XCHAL_SEP \
  528. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  529. XTHAL_LAM_NACACHED XCHAL_SEP \
  530. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  531. XTHAL_LAM_NACACHED XCHAL_SEP \
  532. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  533. XTHAL_LAM_ISOLATE XCHAL_SEP \
  534. XTHAL_LAM_EXCEPTION XCHAL_SEP \
  535. XTHAL_LAM_CACHED
  536. #define XCHAL_SCA_LIST XTHAL_SAM_EXCEPTION XCHAL_SEP \
  537. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  538. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  539. XTHAL_SAM_BYPASS XCHAL_SEP \
  540. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  541. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  542. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  543. XTHAL_SAM_WRITETHRU XCHAL_SEP \
  544. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  545. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  546. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  547. XTHAL_SAM_WRITETHRU XCHAL_SEP \
  548. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  549. XTHAL_SAM_ISOLATE XCHAL_SEP \
  550. XTHAL_SAM_EXCEPTION XCHAL_SEP \
  551. XTHAL_SAM_WRITETHRU
  552. /* Test:
  553. read/only: 0 + 1 + 2 + 4 + 5 + 6 + 8 + 9 + 10 + 12 + 14
  554. read/only: 0 + 1 + 2 + 4 + 5 + 6 + 8 + 9 + 10 + 12 + 14
  555. all: 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15
  556. fault: 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14
  557. r/w/x cached:
  558. r/w/x dcached:
  559. I-bypass: 1 + 3
  560. load guard bit set: 1 + 3
  561. load guard bit clr: 0 + 2 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15
  562. hit-cache r/w/x: 7 + 11
  563. fams: 5
  564. fams: 0 / 6 / 18 / 1 / 2
  565. fams: Bypass / Isolate / Cached / Exception / NACached
  566. MMU okay: yes
  567. */
  568. /*----------------------------------------------------------------------
  569. MMU
  570. ----------------------------------------------------------------------*/
  571. /*
  572. * General notes on MMU parameters.
  573. *
  574. * Terminology:
  575. * ASID = address-space ID (acts as an "extension" of virtual addresses)
  576. * VPN = virtual page number
  577. * PPN = physical page number
  578. * CA = encoded cache attribute (access modes)
  579. * TLB = translation look-aside buffer (term is stretched somewhat here)
  580. * I = instruction (fetch accesses)
  581. * D = data (load and store accesses)
  582. * way = each TLB (ITLB and DTLB) consists of a number of "ways"
  583. * that simultaneously match the virtual address of an access;
  584. * a TLB successfully translates a virtual address if exactly
  585. * one way matches the vaddr; if none match, it is a miss;
  586. * if multiple match, one gets a "multihit" exception;
  587. * each way can be independently configured in terms of number of
  588. * entries, page sizes, which fields are writable or constant, etc.
  589. * set = group of contiguous ways with exactly identical parameters
  590. * ARF = auto-refill; hardware services a 1st-level miss by loading a PTE
  591. * from the page table and storing it in one of the auto-refill ways;
  592. * if this PTE load also misses, a miss exception is posted for s/w.
  593. * min-wired = a "min-wired" way can be used to map a single (minimum-sized)
  594. * page arbitrarily under program control; it has a single entry,
  595. * is non-auto-refill (some other way(s) must be auto-refill),
  596. * all its fields (VPN, PPN, ASID, CA) are all writable, and it
  597. * supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current
  598. * restriction is that this be the only page size it supports).
  599. *
  600. * TLB way entries are virtually indexed.
  601. * TLB ways that support multiple page sizes:
  602. * - must have all writable VPN and PPN fields;
  603. * - can only use one page size at any given time (eg. setup at startup),
  604. * selected by the respective ITLBCFG or DTLBCFG special register,
  605. * whose bits n*4+3 .. n*4 index the list of page sizes for way n
  606. * (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n);
  607. * this list may be sparse for auto-refill ways because auto-refill
  608. * ways have independent lists of supported page sizes sharing a
  609. * common encoding with PTE entries; the encoding is the index into
  610. * this list; unsupported sizes for a given way are zero in the list;
  611. * selecting unsupported sizes results in undefined hardware behaviour;
  612. * - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition).
  613. */
  614. #define XCHAL_HAVE_CACHEATTR 0 /* 1 if CACHEATTR register present, 0 if TLBs present instead */
  615. #define XCHAL_HAVE_TLBS 1 /* 1 if TLBs present, 0 if CACHEATTR present instead */
  616. #define XCHAL_HAVE_MMU XCHAL_HAVE_TLBS /* (DEPRECATED; use XCHAL_HAVE_TLBS instead; will be removed in future release) */
  617. #define XCHAL_HAVE_SPANNING_WAY 0 /* 1 if single way maps entire virtual address space in I+D */
  618. #define XCHAL_HAVE_IDENTITY_MAP 0 /* 1 if virtual addr == physical addr always, 0 otherwise */
  619. #define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* 1 if have MMU that mimics a CACHEATTR config (CaMMU) */
  620. #define XCHAL_HAVE_XLT_CACHEATTR 0 /* 1 if have MMU that mimics a CACHEATTR config, but with translation (CaXltMMU) */
  621. #define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs (address space IDs) */
  622. #define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */
  623. #define XCHAL_MMU_ASID_KERNEL 1 /* ASID value indicating kernel (ring 0) address space */
  624. #define XCHAL_MMU_RINGS 4 /* number of rings supported (1..4) */
  625. #define XCHAL_MMU_RING_BITS 2 /* number of bits needed to hold ring number */
  626. #define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */
  627. #define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */
  628. #define XCHAL_MMU_MAX_PTE_PAGE_SIZE 12 /* max page size in a PTE structure (log2) */
  629. #define XCHAL_MMU_MIN_PTE_PAGE_SIZE 12 /* min page size in a PTE structure (log2) */
  630. /*** Instruction TLB: ***/
  631. #define XCHAL_ITLB_WAY_BITS 3 /* number of bits holding the ways */
  632. #define XCHAL_ITLB_WAYS 7 /* number of ways (n-way set-associative TLB) */
  633. #define XCHAL_ITLB_ARF_WAYS 4 /* number of auto-refill ways */
  634. #define XCHAL_ITLB_SETS 4 /* number of sets (groups of ways with identical settings) */
  635. /* Way set to which each way belongs: */
  636. #define XCHAL_ITLB_WAY0_SET 0
  637. #define XCHAL_ITLB_WAY1_SET 0
  638. #define XCHAL_ITLB_WAY2_SET 0
  639. #define XCHAL_ITLB_WAY3_SET 0
  640. #define XCHAL_ITLB_WAY4_SET 1
  641. #define XCHAL_ITLB_WAY5_SET 2
  642. #define XCHAL_ITLB_WAY6_SET 3
  643. /* Ways sets that are used by hardware auto-refill (ARF): */
  644. #define XCHAL_ITLB_ARF_SETS 1 /* number of auto-refill sets */
  645. #define XCHAL_ITLB_ARF_SET0 0 /* index of n'th auto-refill set */
  646. /* Way sets that are "min-wired" (see terminology comment above): */
  647. #define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */
  648. /* ITLB way set 0 (group of ways 0 thru 3): */
  649. #define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */
  650. #define XCHAL_ITLB_SET0_WAYS 4 /* number of (contiguous) ways in this way set */
  651. #define XCHAL_ITLB_SET0_ENTRIES_LOG2 2 /* log2(number of entries in this way) */
  652. #define XCHAL_ITLB_SET0_ENTRIES 4 /* number of entries in this way (always a power of 2) */
  653. #define XCHAL_ITLB_SET0_ARF 1 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  654. #define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */
  655. #define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */
  656. #define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */
  657. #define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */
  658. #define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP;
  659. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  660. #define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
  661. #define XCHAL_ITLB_SET0_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */
  662. #define XCHAL_ITLB_SET0_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */
  663. #define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
  664. #define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  665. #define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  666. #define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  667. #define XCHAL_ITLB_SET0_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  668. /* ITLB way set 1 (group of ways 4 thru 4): */
  669. #define XCHAL_ITLB_SET1_WAY 4 /* index of first way in this way set */
  670. #define XCHAL_ITLB_SET1_WAYS 1 /* number of (contiguous) ways in this way set */
  671. #define XCHAL_ITLB_SET1_ENTRIES_LOG2 2 /* log2(number of entries in this way) */
  672. #define XCHAL_ITLB_SET1_ENTRIES 4 /* number of entries in this way (always a power of 2) */
  673. #define XCHAL_ITLB_SET1_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  674. #define XCHAL_ITLB_SET1_PAGESIZES 4 /* number of supported page sizes in this way */
  675. #define XCHAL_ITLB_SET1_PAGESZ_BITS 2 /* number of bits to encode the page size */
  676. #define XCHAL_ITLB_SET1_PAGESZ_LOG2_MIN 20 /* log2(minimum supported page size) */
  677. #define XCHAL_ITLB_SET1_PAGESZ_LOG2_MAX 26 /* log2(maximum supported page size) */
  678. #define XCHAL_ITLB_SET1_PAGESZ_LOG2_LIST 20 XCHAL_SEP 22 XCHAL_SEP 24 XCHAL_SEP 26 /* list of log2(page size)s, separated by XCHAL_SEP;
  679. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  680. #define XCHAL_ITLB_SET1_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
  681. #define XCHAL_ITLB_SET1_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */
  682. #define XCHAL_ITLB_SET1_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */
  683. #define XCHAL_ITLB_SET1_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
  684. #define XCHAL_ITLB_SET1_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  685. #define XCHAL_ITLB_SET1_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  686. #define XCHAL_ITLB_SET1_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  687. #define XCHAL_ITLB_SET1_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  688. /* ITLB way set 2 (group of ways 5 thru 5): */
  689. #define XCHAL_ITLB_SET2_WAY 5 /* index of first way in this way set */
  690. #define XCHAL_ITLB_SET2_WAYS 1 /* number of (contiguous) ways in this way set */
  691. #define XCHAL_ITLB_SET2_ENTRIES_LOG2 1 /* log2(number of entries in this way) */
  692. #define XCHAL_ITLB_SET2_ENTRIES 2 /* number of entries in this way (always a power of 2) */
  693. #define XCHAL_ITLB_SET2_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  694. #define XCHAL_ITLB_SET2_PAGESIZES 1 /* number of supported page sizes in this way */
  695. #define XCHAL_ITLB_SET2_PAGESZ_BITS 0 /* number of bits to encode the page size */
  696. #define XCHAL_ITLB_SET2_PAGESZ_LOG2_MIN 27 /* log2(minimum supported page size) */
  697. #define XCHAL_ITLB_SET2_PAGESZ_LOG2_MAX 27 /* log2(maximum supported page size) */
  698. #define XCHAL_ITLB_SET2_PAGESZ_LOG2_LIST 27 /* list of log2(page size)s, separated by XCHAL_SEP;
  699. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  700. #define XCHAL_ITLB_SET2_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */
  701. #define XCHAL_ITLB_SET2_VPN_CONSTMASK 0xF0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */
  702. #define XCHAL_ITLB_SET2_PPN_CONSTMASK 0xF8000000 /* constant PPN bits, including entry index bits; 0 if all writable */
  703. #define XCHAL_ITLB_SET2_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */
  704. #define XCHAL_ITLB_SET2_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  705. #define XCHAL_ITLB_SET2_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  706. #define XCHAL_ITLB_SET2_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  707. #define XCHAL_ITLB_SET2_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  708. /* Constant ASID values for each entry of ITLB way set 2 (because ASID_CONSTMASK is non-zero): */
  709. #define XCHAL_ITLB_SET2_E0_ASID_CONST 0x01
  710. #define XCHAL_ITLB_SET2_E1_ASID_CONST 0x01
  711. /* Constant VPN values for each entry of ITLB way set 2 (because VPN_CONSTMASK is non-zero): */
  712. #define XCHAL_ITLB_SET2_E0_VPN_CONST 0xD0000000
  713. #define XCHAL_ITLB_SET2_E1_VPN_CONST 0xD8000000
  714. /* Constant PPN values for each entry of ITLB way set 2 (because PPN_CONSTMASK is non-zero): */
  715. #define XCHAL_ITLB_SET2_E0_PPN_CONST 0x00000000
  716. #define XCHAL_ITLB_SET2_E1_PPN_CONST 0x00000000
  717. /* Constant CA values for each entry of ITLB way set 2 (because CA_CONSTMASK is non-zero): */
  718. #define XCHAL_ITLB_SET2_E0_CA_CONST 0x07
  719. #define XCHAL_ITLB_SET2_E1_CA_CONST 0x03
  720. /* ITLB way set 3 (group of ways 6 thru 6): */
  721. #define XCHAL_ITLB_SET3_WAY 6 /* index of first way in this way set */
  722. #define XCHAL_ITLB_SET3_WAYS 1 /* number of (contiguous) ways in this way set */
  723. #define XCHAL_ITLB_SET3_ENTRIES_LOG2 1 /* log2(number of entries in this way) */
  724. #define XCHAL_ITLB_SET3_ENTRIES 2 /* number of entries in this way (always a power of 2) */
  725. #define XCHAL_ITLB_SET3_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  726. #define XCHAL_ITLB_SET3_PAGESIZES 1 /* number of supported page sizes in this way */
  727. #define XCHAL_ITLB_SET3_PAGESZ_BITS 0 /* number of bits to encode the page size */
  728. #define XCHAL_ITLB_SET3_PAGESZ_LOG2_MIN 28 /* log2(minimum supported page size) */
  729. #define XCHAL_ITLB_SET3_PAGESZ_LOG2_MAX 28 /* log2(maximum supported page size) */
  730. #define XCHAL_ITLB_SET3_PAGESZ_LOG2_LIST 28 /* list of log2(page size)s, separated by XCHAL_SEP;
  731. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  732. #define XCHAL_ITLB_SET3_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */
  733. #define XCHAL_ITLB_SET3_VPN_CONSTMASK 0xE0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */
  734. #define XCHAL_ITLB_SET3_PPN_CONSTMASK 0xF0000000 /* constant PPN bits, including entry index bits; 0 if all writable */
  735. #define XCHAL_ITLB_SET3_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */
  736. #define XCHAL_ITLB_SET3_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  737. #define XCHAL_ITLB_SET3_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  738. #define XCHAL_ITLB_SET3_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  739. #define XCHAL_ITLB_SET3_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  740. /* Constant ASID values for each entry of ITLB way set 3 (because ASID_CONSTMASK is non-zero): */
  741. #define XCHAL_ITLB_SET3_E0_ASID_CONST 0x01
  742. #define XCHAL_ITLB_SET3_E1_ASID_CONST 0x01
  743. /* Constant VPN values for each entry of ITLB way set 3 (because VPN_CONSTMASK is non-zero): */
  744. #define XCHAL_ITLB_SET3_E0_VPN_CONST 0xE0000000
  745. #define XCHAL_ITLB_SET3_E1_VPN_CONST 0xF0000000
  746. /* Constant PPN values for each entry of ITLB way set 3 (because PPN_CONSTMASK is non-zero): */
  747. #define XCHAL_ITLB_SET3_E0_PPN_CONST 0xF0000000
  748. #define XCHAL_ITLB_SET3_E1_PPN_CONST 0xF0000000
  749. /* Constant CA values for each entry of ITLB way set 3 (because CA_CONSTMASK is non-zero): */
  750. #define XCHAL_ITLB_SET3_E0_CA_CONST 0x07
  751. #define XCHAL_ITLB_SET3_E1_CA_CONST 0x03
  752. /* Indexing macros: */
  753. #define _XCHAL_ITLB_SET(n,_what) XCHAL_ITLB_SET ## n ## _what
  754. #define XCHAL_ITLB_SET(n,what) _XCHAL_ITLB_SET(n, _ ## what )
  755. #define _XCHAL_ITLB_SET_E(n,i,_what) XCHAL_ITLB_SET ## n ## _E ## i ## _what
  756. #define XCHAL_ITLB_SET_E(n,i,what) _XCHAL_ITLB_SET_E(n,i, _ ## what )
  757. /*
  758. * Example use: XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,ENTRIES)
  759. * to get the value of XCHAL_ITLB_SET<n>_ENTRIES where <n> is the first auto-refill set.
  760. */
  761. /*** Data TLB: ***/
  762. #define XCHAL_DTLB_WAY_BITS 4 /* number of bits holding the ways */
  763. #define XCHAL_DTLB_WAYS 10 /* number of ways (n-way set-associative TLB) */
  764. #define XCHAL_DTLB_ARF_WAYS 4 /* number of auto-refill ways */
  765. #define XCHAL_DTLB_SETS 5 /* number of sets (groups of ways with identical settings) */
  766. /* Way set to which each way belongs: */
  767. #define XCHAL_DTLB_WAY0_SET 0
  768. #define XCHAL_DTLB_WAY1_SET 0
  769. #define XCHAL_DTLB_WAY2_SET 0
  770. #define XCHAL_DTLB_WAY3_SET 0
  771. #define XCHAL_DTLB_WAY4_SET 1
  772. #define XCHAL_DTLB_WAY5_SET 2
  773. #define XCHAL_DTLB_WAY6_SET 3
  774. #define XCHAL_DTLB_WAY7_SET 4
  775. #define XCHAL_DTLB_WAY8_SET 4
  776. #define XCHAL_DTLB_WAY9_SET 4
  777. /* Ways sets that are used by hardware auto-refill (ARF): */
  778. #define XCHAL_DTLB_ARF_SETS 1 /* number of auto-refill sets */
  779. #define XCHAL_DTLB_ARF_SET0 0 /* index of n'th auto-refill set */
  780. /* Way sets that are "min-wired" (see terminology comment above): */
  781. #define XCHAL_DTLB_MINWIRED_SETS 1 /* number of "min-wired" sets */
  782. #define XCHAL_DTLB_MINWIRED_SET0 4 /* index of n'th "min-wired" set */
  783. /* DTLB way set 0 (group of ways 0 thru 3): */
  784. #define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */
  785. #define XCHAL_DTLB_SET0_WAYS 4 /* number of (contiguous) ways in this way set */
  786. #define XCHAL_DTLB_SET0_ENTRIES_LOG2 2 /* log2(number of entries in this way) */
  787. #define XCHAL_DTLB_SET0_ENTRIES 4 /* number of entries in this way (always a power of 2) */
  788. #define XCHAL_DTLB_SET0_ARF 1 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  789. #define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */
  790. #define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */
  791. #define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */
  792. #define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */
  793. #define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP;
  794. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  795. #define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
  796. #define XCHAL_DTLB_SET0_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */
  797. #define XCHAL_DTLB_SET0_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */
  798. #define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
  799. #define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  800. #define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  801. #define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  802. #define XCHAL_DTLB_SET0_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  803. /* DTLB way set 1 (group of ways 4 thru 4): */
  804. #define XCHAL_DTLB_SET1_WAY 4 /* index of first way in this way set */
  805. #define XCHAL_DTLB_SET1_WAYS 1 /* number of (contiguous) ways in this way set */
  806. #define XCHAL_DTLB_SET1_ENTRIES_LOG2 2 /* log2(number of entries in this way) */
  807. #define XCHAL_DTLB_SET1_ENTRIES 4 /* number of entries in this way (always a power of 2) */
  808. #define XCHAL_DTLB_SET1_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  809. #define XCHAL_DTLB_SET1_PAGESIZES 4 /* number of supported page sizes in this way */
  810. #define XCHAL_DTLB_SET1_PAGESZ_BITS 2 /* number of bits to encode the page size */
  811. #define XCHAL_DTLB_SET1_PAGESZ_LOG2_MIN 20 /* log2(minimum supported page size) */
  812. #define XCHAL_DTLB_SET1_PAGESZ_LOG2_MAX 26 /* log2(maximum supported page size) */
  813. #define XCHAL_DTLB_SET1_PAGESZ_LOG2_LIST 20 XCHAL_SEP 22 XCHAL_SEP 24 XCHAL_SEP 26 /* list of log2(page size)s, separated by XCHAL_SEP;
  814. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  815. #define XCHAL_DTLB_SET1_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
  816. #define XCHAL_DTLB_SET1_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */
  817. #define XCHAL_DTLB_SET1_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */
  818. #define XCHAL_DTLB_SET1_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
  819. #define XCHAL_DTLB_SET1_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  820. #define XCHAL_DTLB_SET1_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  821. #define XCHAL_DTLB_SET1_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  822. #define XCHAL_DTLB_SET1_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  823. /* DTLB way set 2 (group of ways 5 thru 5): */
  824. #define XCHAL_DTLB_SET2_WAY 5 /* index of first way in this way set */
  825. #define XCHAL_DTLB_SET2_WAYS 1 /* number of (contiguous) ways in this way set */
  826. #define XCHAL_DTLB_SET2_ENTRIES_LOG2 1 /* log2(number of entries in this way) */
  827. #define XCHAL_DTLB_SET2_ENTRIES 2 /* number of entries in this way (always a power of 2) */
  828. #define XCHAL_DTLB_SET2_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  829. #define XCHAL_DTLB_SET2_PAGESIZES 1 /* number of supported page sizes in this way */
  830. #define XCHAL_DTLB_SET2_PAGESZ_BITS 0 /* number of bits to encode the page size */
  831. #define XCHAL_DTLB_SET2_PAGESZ_LOG2_MIN 27 /* log2(minimum supported page size) */
  832. #define XCHAL_DTLB_SET2_PAGESZ_LOG2_MAX 27 /* log2(maximum supported page size) */
  833. #define XCHAL_DTLB_SET2_PAGESZ_LOG2_LIST 27 /* list of log2(page size)s, separated by XCHAL_SEP;
  834. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  835. #define XCHAL_DTLB_SET2_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */
  836. #define XCHAL_DTLB_SET2_VPN_CONSTMASK 0xF0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */
  837. #define XCHAL_DTLB_SET2_PPN_CONSTMASK 0xF8000000 /* constant PPN bits, including entry index bits; 0 if all writable */
  838. #define XCHAL_DTLB_SET2_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */
  839. #define XCHAL_DTLB_SET2_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  840. #define XCHAL_DTLB_SET2_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  841. #define XCHAL_DTLB_SET2_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  842. #define XCHAL_DTLB_SET2_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  843. /* Constant ASID values for each entry of DTLB way set 2 (because ASID_CONSTMASK is non-zero): */
  844. #define XCHAL_DTLB_SET2_E0_ASID_CONST 0x01
  845. #define XCHAL_DTLB_SET2_E1_ASID_CONST 0x01
  846. /* Constant VPN values for each entry of DTLB way set 2 (because VPN_CONSTMASK is non-zero): */
  847. #define XCHAL_DTLB_SET2_E0_VPN_CONST 0xD0000000
  848. #define XCHAL_DTLB_SET2_E1_VPN_CONST 0xD8000000
  849. /* Constant PPN values for each entry of DTLB way set 2 (because PPN_CONSTMASK is non-zero): */
  850. #define XCHAL_DTLB_SET2_E0_PPN_CONST 0x00000000
  851. #define XCHAL_DTLB_SET2_E1_PPN_CONST 0x00000000
  852. /* Constant CA values for each entry of DTLB way set 2 (because CA_CONSTMASK is non-zero): */
  853. #define XCHAL_DTLB_SET2_E0_CA_CONST 0x07
  854. #define XCHAL_DTLB_SET2_E1_CA_CONST 0x03
  855. /* DTLB way set 3 (group of ways 6 thru 6): */
  856. #define XCHAL_DTLB_SET3_WAY 6 /* index of first way in this way set */
  857. #define XCHAL_DTLB_SET3_WAYS 1 /* number of (contiguous) ways in this way set */
  858. #define XCHAL_DTLB_SET3_ENTRIES_LOG2 1 /* log2(number of entries in this way) */
  859. #define XCHAL_DTLB_SET3_ENTRIES 2 /* number of entries in this way (always a power of 2) */
  860. #define XCHAL_DTLB_SET3_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  861. #define XCHAL_DTLB_SET3_PAGESIZES 1 /* number of supported page sizes in this way */
  862. #define XCHAL_DTLB_SET3_PAGESZ_BITS 0 /* number of bits to encode the page size */
  863. #define XCHAL_DTLB_SET3_PAGESZ_LOG2_MIN 28 /* log2(minimum supported page size) */
  864. #define XCHAL_DTLB_SET3_PAGESZ_LOG2_MAX 28 /* log2(maximum supported page size) */
  865. #define XCHAL_DTLB_SET3_PAGESZ_LOG2_LIST 28 /* list of log2(page size)s, separated by XCHAL_SEP;
  866. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  867. #define XCHAL_DTLB_SET3_ASID_CONSTMASK 0xFF /* constant ASID bits; 0 if all writable */
  868. #define XCHAL_DTLB_SET3_VPN_CONSTMASK 0xE0000000 /* constant VPN bits, not including entry index bits; 0 if all writable */
  869. #define XCHAL_DTLB_SET3_PPN_CONSTMASK 0xF0000000 /* constant PPN bits, including entry index bits; 0 if all writable */
  870. #define XCHAL_DTLB_SET3_CA_CONSTMASK 0x0000000F /* constant CA bits; 0 if all writable */
  871. #define XCHAL_DTLB_SET3_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  872. #define XCHAL_DTLB_SET3_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  873. #define XCHAL_DTLB_SET3_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  874. #define XCHAL_DTLB_SET3_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  875. /* Constant ASID values for each entry of DTLB way set 3 (because ASID_CONSTMASK is non-zero): */
  876. #define XCHAL_DTLB_SET3_E0_ASID_CONST 0x01
  877. #define XCHAL_DTLB_SET3_E1_ASID_CONST 0x01
  878. /* Constant VPN values for each entry of DTLB way set 3 (because VPN_CONSTMASK is non-zero): */
  879. #define XCHAL_DTLB_SET3_E0_VPN_CONST 0xE0000000
  880. #define XCHAL_DTLB_SET3_E1_VPN_CONST 0xF0000000
  881. /* Constant PPN values for each entry of DTLB way set 3 (because PPN_CONSTMASK is non-zero): */
  882. #define XCHAL_DTLB_SET3_E0_PPN_CONST 0xF0000000
  883. #define XCHAL_DTLB_SET3_E1_PPN_CONST 0xF0000000
  884. /* Constant CA values for each entry of DTLB way set 3 (because CA_CONSTMASK is non-zero): */
  885. #define XCHAL_DTLB_SET3_E0_CA_CONST 0x07
  886. #define XCHAL_DTLB_SET3_E1_CA_CONST 0x03
  887. /* DTLB way set 4 (group of ways 7 thru 9): */
  888. #define XCHAL_DTLB_SET4_WAY 7 /* index of first way in this way set */
  889. #define XCHAL_DTLB_SET4_WAYS 3 /* number of (contiguous) ways in this way set */
  890. #define XCHAL_DTLB_SET4_ENTRIES_LOG2 0 /* log2(number of entries in this way) */
  891. #define XCHAL_DTLB_SET4_ENTRIES 1 /* number of entries in this way (always a power of 2) */
  892. #define XCHAL_DTLB_SET4_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
  893. #define XCHAL_DTLB_SET4_PAGESIZES 1 /* number of supported page sizes in this way */
  894. #define XCHAL_DTLB_SET4_PAGESZ_BITS 0 /* number of bits to encode the page size */
  895. #define XCHAL_DTLB_SET4_PAGESZ_LOG2_MIN 12 /* log2(minimum supported page size) */
  896. #define XCHAL_DTLB_SET4_PAGESZ_LOG2_MAX 12 /* log2(maximum supported page size) */
  897. #define XCHAL_DTLB_SET4_PAGESZ_LOG2_LIST 12 /* list of log2(page size)s, separated by XCHAL_SEP;
  898. 2^PAGESZ_BITS entries in list, unsupported entries are zero */
  899. #define XCHAL_DTLB_SET4_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
  900. #define XCHAL_DTLB_SET4_VPN_CONSTMASK 0 /* constant VPN bits, not including entry index bits; 0 if all writable */
  901. #define XCHAL_DTLB_SET4_PPN_CONSTMASK 0 /* constant PPN bits, including entry index bits; 0 if all writable */
  902. #define XCHAL_DTLB_SET4_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
  903. #define XCHAL_DTLB_SET4_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
  904. #define XCHAL_DTLB_SET4_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
  905. #define XCHAL_DTLB_SET4_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
  906. #define XCHAL_DTLB_SET4_CA_RESET 0 /* 1 if CA reset values defined (and all writable); 0 otherwise */
  907. /* Indexing macros: */
  908. #define _XCHAL_DTLB_SET(n,_what) XCHAL_DTLB_SET ## n ## _what
  909. #define XCHAL_DTLB_SET(n,what) _XCHAL_DTLB_SET(n, _ ## what )
  910. #define _XCHAL_DTLB_SET_E(n,i,_what) XCHAL_DTLB_SET ## n ## _E ## i ## _what
  911. #define XCHAL_DTLB_SET_E(n,i,what) _XCHAL_DTLB_SET_E(n,i, _ ## what )
  912. /*
  913. * Example use: XCHAL_DTLB_SET(XCHAL_DTLB_ARF_SET0,ENTRIES)
  914. * to get the value of XCHAL_DTLB_SET<n>_ENTRIES where <n> is the first auto-refill set.
  915. */
  916. /*
  917. * Determine whether we have a full MMU (with Page Table and Protection)
  918. * usable for an MMU-based OS:
  919. */
  920. #if XCHAL_HAVE_TLBS && !XCHAL_HAVE_SPANNING_WAY && XCHAL_ITLB_ARF_WAYS > 0 && XCHAL_DTLB_ARF_WAYS > 0 && XCHAL_MMU_RINGS >= 2
  921. # define XCHAL_HAVE_PTP_MMU 1 /* have full MMU (with page table [autorefill] and protection) */
  922. #else
  923. # define XCHAL_HAVE_PTP_MMU 0 /* don't have full MMU */
  924. #endif
  925. /*
  926. * For full MMUs, report kernel RAM segment and kernel I/O segment static page mappings:
  927. */
  928. #if XCHAL_HAVE_PTP_MMU
  929. #define XCHAL_KSEG_CACHED_VADDR 0xD0000000 /* virt.addr of kernel RAM cached static map */
  930. #define XCHAL_KSEG_CACHED_PADDR 0x00000000 /* phys.addr of kseg_cached */
  931. #define XCHAL_KSEG_CACHED_SIZE 0x08000000 /* size in bytes of kseg_cached (assumed power of 2!!!) */
  932. #define XCHAL_KSEG_BYPASS_VADDR 0xD8000000 /* virt.addr of kernel RAM bypass (uncached) static map */
  933. #define XCHAL_KSEG_BYPASS_PADDR 0x00000000 /* phys.addr of kseg_bypass */
  934. #define XCHAL_KSEG_BYPASS_SIZE 0x08000000 /* size in bytes of kseg_bypass (assumed power of 2!!!) */
  935. #define XCHAL_KIO_CACHED_VADDR 0xE0000000 /* virt.addr of kernel I/O cached static map */
  936. #define XCHAL_KIO_CACHED_PADDR 0xF0000000 /* phys.addr of kio_cached */
  937. #define XCHAL_KIO_CACHED_SIZE 0x10000000 /* size in bytes of kio_cached (assumed power of 2!!!) */
  938. #define XCHAL_KIO_BYPASS_VADDR 0xF0000000 /* virt.addr of kernel I/O bypass (uncached) static map */
  939. #define XCHAL_KIO_BYPASS_PADDR 0xF0000000 /* phys.addr of kio_bypass */
  940. #define XCHAL_KIO_BYPASS_SIZE 0x10000000 /* size in bytes of kio_bypass (assumed power of 2!!!) */
  941. #define XCHAL_SEG_MAPPABLE_VADDR 0x00000000 /* start of largest non-static-mapped virtual addr area */
  942. #define XCHAL_SEG_MAPPABLE_SIZE 0xD0000000 /* size in bytes of " */
  943. /* define XCHAL_SEG_MAPPABLE2_xxx if more areas present, sorted in order of descending size. */
  944. #endif
  945. /*----------------------------------------------------------------------
  946. MISC
  947. ----------------------------------------------------------------------*/
  948. #define XCHAL_NUM_WRITEBUFFER_ENTRIES 4 /* number of write buffer entries */
  949. #define XCHAL_CORE_ID "linux_be" /* configuration's alphanumeric core identifier
  950. (CoreID) set in the Xtensa Processor Generator */
  951. #define XCHAL_BUILD_UNIQUE_ID 0x00003256 /* software build-unique ID (22-bit) */
  952. /* These definitions describe the hardware targeted by this software: */
  953. #define XCHAL_HW_CONFIGID0 0xC103D1FF /* config ID reg 0 value (upper 32 of 64 bits) */
  954. #define XCHAL_HW_CONFIGID1 0x00803256 /* config ID reg 1 value (lower 32 of 64 bits) */
  955. #define XCHAL_CONFIGID0 XCHAL_HW_CONFIGID0 /* for backward compatibility only -- don't use! */
  956. #define XCHAL_CONFIGID1 XCHAL_HW_CONFIGID1 /* for backward compatibility only -- don't use! */
  957. #define XCHAL_HW_RELEASE_MAJOR 1050 /* major release of targeted hardware */
  958. #define XCHAL_HW_RELEASE_MINOR 1 /* minor release of targeted hardware */
  959. #define XCHAL_HW_RELEASE_NAME "T1050.1" /* full release name of targeted hardware */
  960. #define XTHAL_HW_REL_T1050 1
  961. #define XTHAL_HW_REL_T1050_1 1
  962. #define XCHAL_HW_CONFIGID_RELIABLE 1
  963. /*
  964. * Miscellaneous special register fields:
  965. */
  966. /* DBREAKC (special register number 160): */
  967. #define XCHAL_DBREAKC_VALIDMASK 0xC000003F /* bits of DBREAKC that are defined */
  968. /* MASK field: */
  969. #define XCHAL_DBREAKC_MASK_BITS 6 /* number of bits in MASK field */
  970. #define XCHAL_DBREAKC_MASK_NUM 64 /* max number of possible causes (2^bits) */
  971. #define XCHAL_DBREAKC_MASK_SHIFT 0 /* position of MASK bits in DBREAKC, starting from lsbit */
  972. #define XCHAL_DBREAKC_MASK_MASK 0x0000003F /* mask of bits in MASK field of DBREAKC */
  973. /* LOADBREAK field: */
  974. #define XCHAL_DBREAKC_LOADBREAK_BITS 1 /* number of bits in LOADBREAK field */
  975. #define XCHAL_DBREAKC_LOADBREAK_NUM 2 /* max number of possible causes (2^bits) */
  976. #define XCHAL_DBREAKC_LOADBREAK_SHIFT 30 /* position of LOADBREAK bits in DBREAKC, starting from lsbit */
  977. #define XCHAL_DBREAKC_LOADBREAK_MASK 0x40000000 /* mask of bits in LOADBREAK field of DBREAKC */
  978. /* STOREBREAK field: */
  979. #define XCHAL_DBREAKC_STOREBREAK_BITS 1 /* number of bits in STOREBREAK field */
  980. #define XCHAL_DBREAKC_STOREBREAK_NUM 2 /* max number of possible causes (2^bits) */
  981. #define XCHAL_DBREAKC_STOREBREAK_SHIFT 31 /* position of STOREBREAK bits in DBREAKC, starting from lsbit */
  982. #define XCHAL_DBREAKC_STOREBREAK_MASK 0x80000000 /* mask of bits in STOREBREAK field of DBREAKC */
  983. /* PS (special register number 230): */
  984. #define XCHAL_PS_VALIDMASK 0x00070FFF /* bits of PS that are defined */
  985. /* INTLEVEL field: */
  986. #define XCHAL_PS_INTLEVEL_BITS 4 /* number of bits in INTLEVEL field */
  987. #define XCHAL_PS_INTLEVEL_NUM 16 /* max number of possible causes (2^bits) */
  988. #define XCHAL_PS_INTLEVEL_SHIFT 0 /* position of INTLEVEL bits in PS, starting from lsbit */
  989. #define XCHAL_PS_INTLEVEL_MASK 0x0000000F /* mask of bits in INTLEVEL field of PS */
  990. /* EXCM field: */
  991. #define XCHAL_PS_EXCM_BITS 1 /* number of bits in EXCM field */
  992. #define XCHAL_PS_EXCM_NUM 2 /* max number of possible causes (2^bits) */
  993. #define XCHAL_PS_EXCM_SHIFT 4 /* position of EXCM bits in PS, starting from lsbit */
  994. #define XCHAL_PS_EXCM_MASK 0x00000010 /* mask of bits in EXCM field of PS */
  995. /* PROGSTACK field: */
  996. #define XCHAL_PS_PROGSTACK_BITS 1 /* number of bits in PROGSTACK field */
  997. #define XCHAL_PS_PROGSTACK_NUM 2 /* max number of possible causes (2^bits) */
  998. #define XCHAL_PS_PROGSTACK_SHIFT 5 /* position of PROGSTACK bits in PS, starting from lsbit */
  999. #define XCHAL_PS_PROGSTACK_MASK 0x00000020 /* mask of bits in PROGSTACK field of PS */
  1000. /* RING field: */
  1001. #define XCHAL_PS_RING_BITS 2 /* number of bits in RING field */
  1002. #define XCHAL_PS_RING_NUM 4 /* max number of possible causes (2^bits) */
  1003. #define XCHAL_PS_RING_SHIFT 6 /* position of RING bits in PS, starting from lsbit */
  1004. #define XCHAL_PS_RING_MASK 0x000000C0 /* mask of bits in RING field of PS */
  1005. /* OWB field: */
  1006. #define XCHAL_PS_OWB_BITS 4 /* number of bits in OWB field */
  1007. #define XCHAL_PS_OWB_NUM 16 /* max number of possible causes (2^bits) */
  1008. #define XCHAL_PS_OWB_SHIFT 8 /* position of OWB bits in PS, starting from lsbit */
  1009. #define XCHAL_PS_OWB_MASK 0x00000F00 /* mask of bits in OWB field of PS */
  1010. /* CALLINC field: */
  1011. #define XCHAL_PS_CALLINC_BITS 2 /* number of bits in CALLINC field */
  1012. #define XCHAL_PS_CALLINC_NUM 4 /* max number of possible causes (2^bits) */
  1013. #define XCHAL_PS_CALLINC_SHIFT 16 /* position of CALLINC bits in PS, starting from lsbit */
  1014. #define XCHAL_PS_CALLINC_MASK 0x00030000 /* mask of bits in CALLINC field of PS */
  1015. /* WOE field: */
  1016. #define XCHAL_PS_WOE_BITS 1 /* number of bits in WOE field */
  1017. #define XCHAL_PS_WOE_NUM 2 /* max number of possible causes (2^bits) */
  1018. #define XCHAL_PS_WOE_SHIFT 18 /* position of WOE bits in PS, starting from lsbit */
  1019. #define XCHAL_PS_WOE_MASK 0x00040000 /* mask of bits in WOE field of PS */
  1020. /* EXCCAUSE (special register number 232): */
  1021. #define XCHAL_EXCCAUSE_VALIDMASK 0x0000003F /* bits of EXCCAUSE that are defined */
  1022. /* EXCCAUSE field: */
  1023. #define XCHAL_EXCCAUSE_BITS 6 /* number of bits in EXCCAUSE register */
  1024. #define XCHAL_EXCCAUSE_NUM 64 /* max number of possible causes (2^bits) */
  1025. #define XCHAL_EXCCAUSE_SHIFT 0 /* position of EXCCAUSE bits in register, starting from lsbit */
  1026. #define XCHAL_EXCCAUSE_MASK 0x0000003F /* mask of bits in EXCCAUSE register */
  1027. /* DEBUGCAUSE (special register number 233): */
  1028. #define XCHAL_DEBUGCAUSE_VALIDMASK 0x0000003F /* bits of DEBUGCAUSE that are defined */
  1029. /* ICOUNT field: */
  1030. #define XCHAL_DEBUGCAUSE_ICOUNT_BITS 1 /* number of bits in ICOUNT field */
  1031. #define XCHAL_DEBUGCAUSE_ICOUNT_NUM 2 /* max number of possible causes (2^bits) */
  1032. #define XCHAL_DEBUGCAUSE_ICOUNT_SHIFT 0 /* position of ICOUNT bits in DEBUGCAUSE, starting from lsbit */
  1033. #define XCHAL_DEBUGCAUSE_ICOUNT_MASK 0x00000001 /* mask of bits in ICOUNT field of DEBUGCAUSE */
  1034. /* IBREAK field: */
  1035. #define XCHAL_DEBUGCAUSE_IBREAK_BITS 1 /* number of bits in IBREAK field */
  1036. #define XCHAL_DEBUGCAUSE_IBREAK_NUM 2 /* max number of possible causes (2^bits) */
  1037. #define XCHAL_DEBUGCAUSE_IBREAK_SHIFT 1 /* position of IBREAK bits in DEBUGCAUSE, starting from lsbit */
  1038. #define XCHAL_DEBUGCAUSE_IBREAK_MASK 0x00000002 /* mask of bits in IBREAK field of DEBUGCAUSE */
  1039. /* DBREAK field: */
  1040. #define XCHAL_DEBUGCAUSE_DBREAK_BITS 1 /* number of bits in DBREAK field */
  1041. #define XCHAL_DEBUGCAUSE_DBREAK_NUM 2 /* max number of possible causes (2^bits) */
  1042. #define XCHAL_DEBUGCAUSE_DBREAK_SHIFT 2 /* position of DBREAK bits in DEBUGCAUSE, starting from lsbit */
  1043. #define XCHAL_DEBUGCAUSE_DBREAK_MASK 0x00000004 /* mask of bits in DBREAK field of DEBUGCAUSE */
  1044. /* BREAK field: */
  1045. #define XCHAL_DEBUGCAUSE_BREAK_BITS 1 /* number of bits in BREAK field */
  1046. #define XCHAL_DEBUGCAUSE_BREAK_NUM 2 /* max number of possible causes (2^bits) */
  1047. #define XCHAL_DEBUGCAUSE_BREAK_SHIFT 3 /* position of BREAK bits in DEBUGCAUSE, starting from lsbit */
  1048. #define XCHAL_DEBUGCAUSE_BREAK_MASK 0x00000008 /* mask of bits in BREAK field of DEBUGCAUSE */
  1049. /* BREAKN field: */
  1050. #define XCHAL_DEBUGCAUSE_BREAKN_BITS 1 /* number of bits in BREAKN field */
  1051. #define XCHAL_DEBUGCAUSE_BREAKN_NUM 2 /* max number of possible causes (2^bits) */
  1052. #define XCHAL_DEBUGCAUSE_BREAKN_SHIFT 4 /* position of BREAKN bits in DEBUGCAUSE, starting from lsbit */
  1053. #define XCHAL_DEBUGCAUSE_BREAKN_MASK 0x00000010 /* mask of bits in BREAKN field of DEBUGCAUSE */
  1054. /* DEBUGINT field: */
  1055. #define XCHAL_DEBUGCAUSE_DEBUGINT_BITS 1 /* number of bits in DEBUGINT field */
  1056. #define XCHAL_DEBUGCAUSE_DEBUGINT_NUM 2 /* max number of possible causes (2^bits) */
  1057. #define XCHAL_DEBUGCAUSE_DEBUGINT_SHIFT 5 /* position of DEBUGINT bits in DEBUGCAUSE, starting from lsbit */
  1058. #define XCHAL_DEBUGCAUSE_DEBUGINT_MASK 0x00000020 /* mask of bits in DEBUGINT field of DEBUGCAUSE */
  1059. /*----------------------------------------------------------------------
  1060. ISA
  1061. ----------------------------------------------------------------------*/
  1062. #define XCHAL_HAVE_DENSITY 1 /* 1 if density option configured, 0 otherwise */
  1063. #define XCHAL_HAVE_LOOPS 1 /* 1 if zero-overhead loops option configured, 0 otherwise */
  1064. /* Misc instructions: */
  1065. #define XCHAL_HAVE_NSA 0 /* 1 if NSA/NSAU instructions option configured, 0 otherwise */
  1066. #define XCHAL_HAVE_MINMAX 0 /* 1 if MIN/MAX instructions option configured, 0 otherwise */
  1067. #define XCHAL_HAVE_SEXT 0 /* 1 if sign-extend instruction option configured, 0 otherwise */
  1068. #define XCHAL_HAVE_CLAMPS 0 /* 1 if CLAMPS instruction option configured, 0 otherwise */
  1069. #define XCHAL_HAVE_MAC16 0 /* 1 if MAC16 option configured, 0 otherwise */
  1070. #define XCHAL_HAVE_MUL16 0 /* 1 if 16-bit integer multiply option configured, 0 otherwise */
  1071. /*#define XCHAL_HAVE_POPC 0*/ /* 1 if CRC instruction option configured, 0 otherwise */
  1072. /*#define XCHAL_HAVE_CRC 0*/ /* 1 if POPC instruction option configured, 0 otherwise */
  1073. #define XCHAL_HAVE_SPECULATION 0 /* 1 if speculation option configured, 0 otherwise */
  1074. /*#define XCHAL_HAVE_MP_SYNC 0*/ /* 1 if multiprocessor sync. option configured, 0 otherwise */
  1075. #define XCHAL_HAVE_PRID 0 /* 1 if processor ID register configured, 0 otherwise */
  1076. #define XCHAL_NUM_MISC_REGS 2 /* number of miscellaneous registers (0..4) */
  1077. /* These relate a bit more to TIE: */
  1078. #define XCHAL_HAVE_BOOLEANS 0 /* 1 if booleans option configured, 0 otherwise */
  1079. #define XCHAL_HAVE_MUL32 0 /* 1 if 32-bit integer multiply option configured, 0 otherwise */
  1080. #define XCHAL_HAVE_MUL32_HIGH 0 /* 1 if MUL32 option includes MULUH and MULSH, 0 otherwise */
  1081. #define XCHAL_HAVE_FP 0 /* 1 if floating point option configured, 0 otherwise */
  1082. /*----------------------------------------------------------------------
  1083. DERIVED
  1084. ----------------------------------------------------------------------*/
  1085. #if XCHAL_HAVE_BE
  1086. #define XCHAL_INST_ILLN 0xD60F /* 2-byte illegal instruction, msb-first */
  1087. #define XCHAL_INST_ILLN_BYTE0 0xD6 /* 2-byte illegal instruction, 1st byte */
  1088. #define XCHAL_INST_ILLN_BYTE1 0x0F /* 2-byte illegal instruction, 2nd byte */
  1089. #else
  1090. #define XCHAL_INST_ILLN 0xF06D /* 2-byte illegal instruction, lsb-first */
  1091. #define XCHAL_INST_ILLN_BYTE0 0x6D /* 2-byte illegal instruction, 1st byte */
  1092. #define XCHAL_INST_ILLN_BYTE1 0xF0 /* 2-byte illegal instruction, 2nd byte */
  1093. #endif
  1094. /* Belongs in xtensa/hal.h: */
  1095. #define XTHAL_INST_ILL 0x000000 /* 3-byte illegal instruction */
  1096. /*
  1097. * Because information as to exactly which hardware release is targeted
  1098. * by a given software build is not always available, compile-time HAL
  1099. * Hardware-Release "_AT" macros are fuzzy (return 0, 1, or XCHAL_MAYBE):
  1100. */
  1101. #ifndef XCHAL_HW_RELEASE_MAJOR
  1102. # define XCHAL_HW_CONFIGID_RELIABLE 0
  1103. #endif
  1104. #if XCHAL_HW_CONFIGID_RELIABLE
  1105. # define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) (XTHAL_REL_LE( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0)
  1106. # define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) (XTHAL_REL_GE( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0)
  1107. # define XCHAL_HW_RELEASE_AT(major,minor) (XTHAL_REL_EQ( XCHAL_HW_RELEASE_MAJOR,XCHAL_HW_RELEASE_MINOR, major,minor ) ? 1 : 0)
  1108. # define XCHAL_HW_RELEASE_MAJOR_AT(major) ((XCHAL_HW_RELEASE_MAJOR == (major)) ? 1 : 0)
  1109. #else
  1110. # define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) ( ((major) < 1040 && XCHAL_HAVE_XEA2) ? 0 \
  1111. : ((major) > 1050 && XCHAL_HAVE_XEA1) ? 1 \
  1112. : XTHAL_MAYBE )
  1113. # define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) ( ((major) >= 2000 && XCHAL_HAVE_XEA1) ? 0 \
  1114. : (XTHAL_REL_LE(major,minor, 1040,0) && XCHAL_HAVE_XEA2) ? 1 \
  1115. : XTHAL_MAYBE )
  1116. # define XCHAL_HW_RELEASE_AT(major,minor) ( (((major) < 1040 && XCHAL_HAVE_XEA2) || \
  1117. ((major) >= 2000 && XCHAL_HAVE_XEA1)) ? 0 : XTHAL_MAYBE)
  1118. # define XCHAL_HW_RELEASE_MAJOR_AT(major) XCHAL_HW_RELEASE_AT(major,0)
  1119. #endif
  1120. /*
  1121. * Specific errata:
  1122. */
  1123. /*
  1124. * Erratum T1020.H13, T1030.H7, T1040.H10, T1050.H4 (fixed in T1040.3 and T1050.1;
  1125. * relevant only in XEA1, kernel-vector mode, level-one interrupts and overflows enabled):
  1126. */
  1127. #define XCHAL_MAYHAVE_ERRATUM_XEA1KWIN (XCHAL_HAVE_XEA1 && \
  1128. (XCHAL_HW_RELEASE_AT_OR_BELOW(1040,2) != 0 \
  1129. || XCHAL_HW_RELEASE_AT(1050,0)))
  1130. #endif /*XTENSA_CONFIG_CORE_H*/