mipsregs.h 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001 by Ralf Baechle
  7. * Copyright (C) 2000 Silicon Graphics, Inc.
  8. * Modified for further R[236]000 support by Paul M. Antoine, 1996.
  9. * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
  10. * Copyright (C) 2000, 07 MIPS Technologies, Inc.
  11. * Copyright (C) 2003, 2004 Maciej W. Rozycki
  12. */
  13. #ifndef _ASM_MIPSREGS_H
  14. #define _ASM_MIPSREGS_H
  15. #include <linux/linkage.h>
  16. #include <asm/hazards.h>
  17. #include <asm/war.h>
  18. /*
  19. * The following macros are especially useful for __asm__
  20. * inline assembler.
  21. */
  22. #ifndef __STR
  23. #define __STR(x) #x
  24. #endif
  25. #ifndef STR
  26. #define STR(x) __STR(x)
  27. #endif
  28. /*
  29. * Configure language
  30. */
  31. #ifdef __ASSEMBLY__
  32. #define _ULCAST_
  33. #else
  34. #define _ULCAST_ (unsigned long)
  35. #endif
  36. /*
  37. * Coprocessor 0 register names
  38. */
  39. #define CP0_INDEX $0
  40. #define CP0_RANDOM $1
  41. #define CP0_ENTRYLO0 $2
  42. #define CP0_ENTRYLO1 $3
  43. #define CP0_CONF $3
  44. #define CP0_CONTEXT $4
  45. #define CP0_PAGEMASK $5
  46. #define CP0_WIRED $6
  47. #define CP0_INFO $7
  48. #define CP0_BADVADDR $8
  49. #define CP0_COUNT $9
  50. #define CP0_ENTRYHI $10
  51. #define CP0_COMPARE $11
  52. #define CP0_STATUS $12
  53. #define CP0_CAUSE $13
  54. #define CP0_EPC $14
  55. #define CP0_PRID $15
  56. #define CP0_CONFIG $16
  57. #define CP0_LLADDR $17
  58. #define CP0_WATCHLO $18
  59. #define CP0_WATCHHI $19
  60. #define CP0_XCONTEXT $20
  61. #define CP0_FRAMEMASK $21
  62. #define CP0_DIAGNOSTIC $22
  63. #define CP0_DEBUG $23
  64. #define CP0_DEPC $24
  65. #define CP0_PERFORMANCE $25
  66. #define CP0_ECC $26
  67. #define CP0_CACHEERR $27
  68. #define CP0_TAGLO $28
  69. #define CP0_TAGHI $29
  70. #define CP0_ERROREPC $30
  71. #define CP0_DESAVE $31
  72. /*
  73. * R4640/R4650 cp0 register names. These registers are listed
  74. * here only for completeness; without MMU these CPUs are not useable
  75. * by Linux. A future ELKS port might take make Linux run on them
  76. * though ...
  77. */
  78. #define CP0_IBASE $0
  79. #define CP0_IBOUND $1
  80. #define CP0_DBASE $2
  81. #define CP0_DBOUND $3
  82. #define CP0_CALG $17
  83. #define CP0_IWATCH $18
  84. #define CP0_DWATCH $19
  85. /*
  86. * Coprocessor 0 Set 1 register names
  87. */
  88. #define CP0_S1_DERRADDR0 $26
  89. #define CP0_S1_DERRADDR1 $27
  90. #define CP0_S1_INTCONTROL $20
  91. /*
  92. * Coprocessor 0 Set 2 register names
  93. */
  94. #define CP0_S2_SRSCTL $12 /* MIPSR2 */
  95. /*
  96. * Coprocessor 0 Set 3 register names
  97. */
  98. #define CP0_S3_SRSMAP $12 /* MIPSR2 */
  99. /*
  100. * TX39 Series
  101. */
  102. #define CP0_TX39_CACHE $7
  103. /*
  104. * Coprocessor 1 (FPU) register names
  105. */
  106. #define CP1_REVISION $0
  107. #define CP1_STATUS $31
  108. /*
  109. * FPU Status Register Values
  110. */
  111. /*
  112. * Status Register Values
  113. */
  114. #define FPU_CSR_FLUSH 0x01000000 /* flush denormalised results to 0 */
  115. #define FPU_CSR_COND 0x00800000 /* $fcc0 */
  116. #define FPU_CSR_COND0 0x00800000 /* $fcc0 */
  117. #define FPU_CSR_COND1 0x02000000 /* $fcc1 */
  118. #define FPU_CSR_COND2 0x04000000 /* $fcc2 */
  119. #define FPU_CSR_COND3 0x08000000 /* $fcc3 */
  120. #define FPU_CSR_COND4 0x10000000 /* $fcc4 */
  121. #define FPU_CSR_COND5 0x20000000 /* $fcc5 */
  122. #define FPU_CSR_COND6 0x40000000 /* $fcc6 */
  123. #define FPU_CSR_COND7 0x80000000 /* $fcc7 */
  124. /*
  125. * Bits 18 - 20 of the FPU Status Register will be read as 0,
  126. * and should be written as zero.
  127. */
  128. #define FPU_CSR_RSVD 0x001c0000
  129. /*
  130. * X the exception cause indicator
  131. * E the exception enable
  132. * S the sticky/flag bit
  133. */
  134. #define FPU_CSR_ALL_X 0x0003f000
  135. #define FPU_CSR_UNI_X 0x00020000
  136. #define FPU_CSR_INV_X 0x00010000
  137. #define FPU_CSR_DIV_X 0x00008000
  138. #define FPU_CSR_OVF_X 0x00004000
  139. #define FPU_CSR_UDF_X 0x00002000
  140. #define FPU_CSR_INE_X 0x00001000
  141. #define FPU_CSR_ALL_E 0x00000f80
  142. #define FPU_CSR_INV_E 0x00000800
  143. #define FPU_CSR_DIV_E 0x00000400
  144. #define FPU_CSR_OVF_E 0x00000200
  145. #define FPU_CSR_UDF_E 0x00000100
  146. #define FPU_CSR_INE_E 0x00000080
  147. #define FPU_CSR_ALL_S 0x0000007c
  148. #define FPU_CSR_INV_S 0x00000040
  149. #define FPU_CSR_DIV_S 0x00000020
  150. #define FPU_CSR_OVF_S 0x00000010
  151. #define FPU_CSR_UDF_S 0x00000008
  152. #define FPU_CSR_INE_S 0x00000004
  153. /* Bits 0 and 1 of FPU Status Register specify the rounding mode */
  154. #define FPU_CSR_RM 0x00000003
  155. #define FPU_CSR_RN 0x0 /* nearest */
  156. #define FPU_CSR_RZ 0x1 /* towards zero */
  157. #define FPU_CSR_RU 0x2 /* towards +Infinity */
  158. #define FPU_CSR_RD 0x3 /* towards -Infinity */
  159. /*
  160. * Values for PageMask register
  161. */
  162. #ifdef CONFIG_CPU_VR41XX
  163. /* Why doesn't stupidity hurt ... */
  164. #define PM_1K 0x00000000
  165. #define PM_4K 0x00001800
  166. #define PM_16K 0x00007800
  167. #define PM_64K 0x0001f800
  168. #define PM_256K 0x0007f800
  169. #else
  170. #define PM_4K 0x00000000
  171. #define PM_8K 0x00002000
  172. #define PM_16K 0x00006000
  173. #define PM_32K 0x0000e000
  174. #define PM_64K 0x0001e000
  175. #define PM_128K 0x0003e000
  176. #define PM_256K 0x0007e000
  177. #define PM_512K 0x000fe000
  178. #define PM_1M 0x001fe000
  179. #define PM_2M 0x003fe000
  180. #define PM_4M 0x007fe000
  181. #define PM_8M 0x00ffe000
  182. #define PM_16M 0x01ffe000
  183. #define PM_32M 0x03ffe000
  184. #define PM_64M 0x07ffe000
  185. #define PM_256M 0x1fffe000
  186. #define PM_1G 0x7fffe000
  187. #endif
  188. /*
  189. * Default page size for a given kernel configuration
  190. */
  191. #ifdef CONFIG_PAGE_SIZE_4KB
  192. #define PM_DEFAULT_MASK PM_4K
  193. #elif defined(CONFIG_PAGE_SIZE_8KB)
  194. #define PM_DEFAULT_MASK PM_8K
  195. #elif defined(CONFIG_PAGE_SIZE_16KB)
  196. #define PM_DEFAULT_MASK PM_16K
  197. #elif defined(CONFIG_PAGE_SIZE_32KB)
  198. #define PM_DEFAULT_MASK PM_32K
  199. #elif defined(CONFIG_PAGE_SIZE_64KB)
  200. #define PM_DEFAULT_MASK PM_64K
  201. #else
  202. #error Bad page size configuration!
  203. #endif
  204. /*
  205. * Default huge tlb size for a given kernel configuration
  206. */
  207. #ifdef CONFIG_PAGE_SIZE_4KB
  208. #define PM_HUGE_MASK PM_1M
  209. #elif defined(CONFIG_PAGE_SIZE_8KB)
  210. #define PM_HUGE_MASK PM_4M
  211. #elif defined(CONFIG_PAGE_SIZE_16KB)
  212. #define PM_HUGE_MASK PM_16M
  213. #elif defined(CONFIG_PAGE_SIZE_32KB)
  214. #define PM_HUGE_MASK PM_64M
  215. #elif defined(CONFIG_PAGE_SIZE_64KB)
  216. #define PM_HUGE_MASK PM_256M
  217. #elif defined(CONFIG_HUGETLB_PAGE)
  218. #error Bad page size configuration for hugetlbfs!
  219. #endif
  220. /*
  221. * Values used for computation of new tlb entries
  222. */
  223. #define PL_4K 12
  224. #define PL_16K 14
  225. #define PL_64K 16
  226. #define PL_256K 18
  227. #define PL_1M 20
  228. #define PL_4M 22
  229. #define PL_16M 24
  230. #define PL_64M 26
  231. #define PL_256M 28
  232. /*
  233. * PageGrain bits
  234. */
  235. #define PG_RIE (_ULCAST_(1) << 31)
  236. #define PG_XIE (_ULCAST_(1) << 30)
  237. #define PG_ELPA (_ULCAST_(1) << 29)
  238. #define PG_ESP (_ULCAST_(1) << 28)
  239. /*
  240. * R4x00 interrupt enable / cause bits
  241. */
  242. #define IE_SW0 (_ULCAST_(1) << 8)
  243. #define IE_SW1 (_ULCAST_(1) << 9)
  244. #define IE_IRQ0 (_ULCAST_(1) << 10)
  245. #define IE_IRQ1 (_ULCAST_(1) << 11)
  246. #define IE_IRQ2 (_ULCAST_(1) << 12)
  247. #define IE_IRQ3 (_ULCAST_(1) << 13)
  248. #define IE_IRQ4 (_ULCAST_(1) << 14)
  249. #define IE_IRQ5 (_ULCAST_(1) << 15)
  250. /*
  251. * R4x00 interrupt cause bits
  252. */
  253. #define C_SW0 (_ULCAST_(1) << 8)
  254. #define C_SW1 (_ULCAST_(1) << 9)
  255. #define C_IRQ0 (_ULCAST_(1) << 10)
  256. #define C_IRQ1 (_ULCAST_(1) << 11)
  257. #define C_IRQ2 (_ULCAST_(1) << 12)
  258. #define C_IRQ3 (_ULCAST_(1) << 13)
  259. #define C_IRQ4 (_ULCAST_(1) << 14)
  260. #define C_IRQ5 (_ULCAST_(1) << 15)
  261. /*
  262. * Bitfields in the R4xx0 cp0 status register
  263. */
  264. #define ST0_IE 0x00000001
  265. #define ST0_EXL 0x00000002
  266. #define ST0_ERL 0x00000004
  267. #define ST0_KSU 0x00000018
  268. # define KSU_USER 0x00000010
  269. # define KSU_SUPERVISOR 0x00000008
  270. # define KSU_KERNEL 0x00000000
  271. #define ST0_UX 0x00000020
  272. #define ST0_SX 0x00000040
  273. #define ST0_KX 0x00000080
  274. #define ST0_DE 0x00010000
  275. #define ST0_CE 0x00020000
  276. /*
  277. * Setting c0_status.co enables Hit_Writeback and Hit_Writeback_Invalidate
  278. * cacheops in userspace. This bit exists only on RM7000 and RM9000
  279. * processors.
  280. */
  281. #define ST0_CO 0x08000000
  282. /*
  283. * Bitfields in the R[23]000 cp0 status register.
  284. */
  285. #define ST0_IEC 0x00000001
  286. #define ST0_KUC 0x00000002
  287. #define ST0_IEP 0x00000004
  288. #define ST0_KUP 0x00000008
  289. #define ST0_IEO 0x00000010
  290. #define ST0_KUO 0x00000020
  291. /* bits 6 & 7 are reserved on R[23]000 */
  292. #define ST0_ISC 0x00010000
  293. #define ST0_SWC 0x00020000
  294. #define ST0_CM 0x00080000
  295. /*
  296. * Bits specific to the R4640/R4650
  297. */
  298. #define ST0_UM (_ULCAST_(1) << 4)
  299. #define ST0_IL (_ULCAST_(1) << 23)
  300. #define ST0_DL (_ULCAST_(1) << 24)
  301. /*
  302. * Enable the MIPS MDMX and DSP ASEs
  303. */
  304. #define ST0_MX 0x01000000
  305. /*
  306. * Bitfields in the TX39 family CP0 Configuration Register 3
  307. */
  308. #define TX39_CONF_ICS_SHIFT 19
  309. #define TX39_CONF_ICS_MASK 0x00380000
  310. #define TX39_CONF_ICS_1KB 0x00000000
  311. #define TX39_CONF_ICS_2KB 0x00080000
  312. #define TX39_CONF_ICS_4KB 0x00100000
  313. #define TX39_CONF_ICS_8KB 0x00180000
  314. #define TX39_CONF_ICS_16KB 0x00200000
  315. #define TX39_CONF_DCS_SHIFT 16
  316. #define TX39_CONF_DCS_MASK 0x00070000
  317. #define TX39_CONF_DCS_1KB 0x00000000
  318. #define TX39_CONF_DCS_2KB 0x00010000
  319. #define TX39_CONF_DCS_4KB 0x00020000
  320. #define TX39_CONF_DCS_8KB 0x00030000
  321. #define TX39_CONF_DCS_16KB 0x00040000
  322. #define TX39_CONF_CWFON 0x00004000
  323. #define TX39_CONF_WBON 0x00002000
  324. #define TX39_CONF_RF_SHIFT 10
  325. #define TX39_CONF_RF_MASK 0x00000c00
  326. #define TX39_CONF_DOZE 0x00000200
  327. #define TX39_CONF_HALT 0x00000100
  328. #define TX39_CONF_LOCK 0x00000080
  329. #define TX39_CONF_ICE 0x00000020
  330. #define TX39_CONF_DCE 0x00000010
  331. #define TX39_CONF_IRSIZE_SHIFT 2
  332. #define TX39_CONF_IRSIZE_MASK 0x0000000c
  333. #define TX39_CONF_DRSIZE_SHIFT 0
  334. #define TX39_CONF_DRSIZE_MASK 0x00000003
  335. /*
  336. * Status register bits available in all MIPS CPUs.
  337. */
  338. #define ST0_IM 0x0000ff00
  339. #define STATUSB_IP0 8
  340. #define STATUSF_IP0 (_ULCAST_(1) << 8)
  341. #define STATUSB_IP1 9
  342. #define STATUSF_IP1 (_ULCAST_(1) << 9)
  343. #define STATUSB_IP2 10
  344. #define STATUSF_IP2 (_ULCAST_(1) << 10)
  345. #define STATUSB_IP3 11
  346. #define STATUSF_IP3 (_ULCAST_(1) << 11)
  347. #define STATUSB_IP4 12
  348. #define STATUSF_IP4 (_ULCAST_(1) << 12)
  349. #define STATUSB_IP5 13
  350. #define STATUSF_IP5 (_ULCAST_(1) << 13)
  351. #define STATUSB_IP6 14
  352. #define STATUSF_IP6 (_ULCAST_(1) << 14)
  353. #define STATUSB_IP7 15
  354. #define STATUSF_IP7 (_ULCAST_(1) << 15)
  355. #define STATUSB_IP8 0
  356. #define STATUSF_IP8 (_ULCAST_(1) << 0)
  357. #define STATUSB_IP9 1
  358. #define STATUSF_IP9 (_ULCAST_(1) << 1)
  359. #define STATUSB_IP10 2
  360. #define STATUSF_IP10 (_ULCAST_(1) << 2)
  361. #define STATUSB_IP11 3
  362. #define STATUSF_IP11 (_ULCAST_(1) << 3)
  363. #define STATUSB_IP12 4
  364. #define STATUSF_IP12 (_ULCAST_(1) << 4)
  365. #define STATUSB_IP13 5
  366. #define STATUSF_IP13 (_ULCAST_(1) << 5)
  367. #define STATUSB_IP14 6
  368. #define STATUSF_IP14 (_ULCAST_(1) << 6)
  369. #define STATUSB_IP15 7
  370. #define STATUSF_IP15 (_ULCAST_(1) << 7)
  371. #define ST0_CH 0x00040000
  372. #define ST0_SR 0x00100000
  373. #define ST0_TS 0x00200000
  374. #define ST0_BEV 0x00400000
  375. #define ST0_RE 0x02000000
  376. #define ST0_FR 0x04000000
  377. #define ST0_CU 0xf0000000
  378. #define ST0_CU0 0x10000000
  379. #define ST0_CU1 0x20000000
  380. #define ST0_CU2 0x40000000
  381. #define ST0_CU3 0x80000000
  382. #define ST0_XX 0x80000000 /* MIPS IV naming */
  383. /*
  384. * Bitfields and bit numbers in the coprocessor 0 IntCtl register. (MIPSR2)
  385. *
  386. * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
  387. */
  388. #define INTCTLB_IPPCI 26
  389. #define INTCTLF_IPPCI (_ULCAST_(7) << INTCTLB_IPPCI)
  390. #define INTCTLB_IPTI 29
  391. #define INTCTLF_IPTI (_ULCAST_(7) << INTCTLB_IPTI)
  392. /*
  393. * Bitfields and bit numbers in the coprocessor 0 cause register.
  394. *
  395. * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
  396. */
  397. #define CAUSEB_EXCCODE 2
  398. #define CAUSEF_EXCCODE (_ULCAST_(31) << 2)
  399. #define CAUSEB_IP 8
  400. #define CAUSEF_IP (_ULCAST_(255) << 8)
  401. #define CAUSEB_IP0 8
  402. #define CAUSEF_IP0 (_ULCAST_(1) << 8)
  403. #define CAUSEB_IP1 9
  404. #define CAUSEF_IP1 (_ULCAST_(1) << 9)
  405. #define CAUSEB_IP2 10
  406. #define CAUSEF_IP2 (_ULCAST_(1) << 10)
  407. #define CAUSEB_IP3 11
  408. #define CAUSEF_IP3 (_ULCAST_(1) << 11)
  409. #define CAUSEB_IP4 12
  410. #define CAUSEF_IP4 (_ULCAST_(1) << 12)
  411. #define CAUSEB_IP5 13
  412. #define CAUSEF_IP5 (_ULCAST_(1) << 13)
  413. #define CAUSEB_IP6 14
  414. #define CAUSEF_IP6 (_ULCAST_(1) << 14)
  415. #define CAUSEB_IP7 15
  416. #define CAUSEF_IP7 (_ULCAST_(1) << 15)
  417. #define CAUSEB_IV 23
  418. #define CAUSEF_IV (_ULCAST_(1) << 23)
  419. #define CAUSEB_CE 28
  420. #define CAUSEF_CE (_ULCAST_(3) << 28)
  421. #define CAUSEB_TI 30
  422. #define CAUSEF_TI (_ULCAST_(1) << 30)
  423. #define CAUSEB_BD 31
  424. #define CAUSEF_BD (_ULCAST_(1) << 31)
  425. /*
  426. * Bits in the coprocessor 0 config register.
  427. */
  428. /* Generic bits. */
  429. #define CONF_CM_CACHABLE_NO_WA 0
  430. #define CONF_CM_CACHABLE_WA 1
  431. #define CONF_CM_UNCACHED 2
  432. #define CONF_CM_CACHABLE_NONCOHERENT 3
  433. #define CONF_CM_CACHABLE_CE 4
  434. #define CONF_CM_CACHABLE_COW 5
  435. #define CONF_CM_CACHABLE_CUW 6
  436. #define CONF_CM_CACHABLE_ACCELERATED 7
  437. #define CONF_CM_CMASK 7
  438. #define CONF_BE (_ULCAST_(1) << 15)
  439. /* Bits common to various processors. */
  440. #define CONF_CU (_ULCAST_(1) << 3)
  441. #define CONF_DB (_ULCAST_(1) << 4)
  442. #define CONF_IB (_ULCAST_(1) << 5)
  443. #define CONF_DC (_ULCAST_(7) << 6)
  444. #define CONF_IC (_ULCAST_(7) << 9)
  445. #define CONF_EB (_ULCAST_(1) << 13)
  446. #define CONF_EM (_ULCAST_(1) << 14)
  447. #define CONF_SM (_ULCAST_(1) << 16)
  448. #define CONF_SC (_ULCAST_(1) << 17)
  449. #define CONF_EW (_ULCAST_(3) << 18)
  450. #define CONF_EP (_ULCAST_(15)<< 24)
  451. #define CONF_EC (_ULCAST_(7) << 28)
  452. #define CONF_CM (_ULCAST_(1) << 31)
  453. /* Bits specific to the R4xx0. */
  454. #define R4K_CONF_SW (_ULCAST_(1) << 20)
  455. #define R4K_CONF_SS (_ULCAST_(1) << 21)
  456. #define R4K_CONF_SB (_ULCAST_(3) << 22)
  457. /* Bits specific to the R5000. */
  458. #define R5K_CONF_SE (_ULCAST_(1) << 12)
  459. #define R5K_CONF_SS (_ULCAST_(3) << 20)
  460. /* Bits specific to the RM7000. */
  461. #define RM7K_CONF_SE (_ULCAST_(1) << 3)
  462. #define RM7K_CONF_TE (_ULCAST_(1) << 12)
  463. #define RM7K_CONF_CLK (_ULCAST_(1) << 16)
  464. #define RM7K_CONF_TC (_ULCAST_(1) << 17)
  465. #define RM7K_CONF_SI (_ULCAST_(3) << 20)
  466. #define RM7K_CONF_SC (_ULCAST_(1) << 31)
  467. /* Bits specific to the R10000. */
  468. #define R10K_CONF_DN (_ULCAST_(3) << 3)
  469. #define R10K_CONF_CT (_ULCAST_(1) << 5)
  470. #define R10K_CONF_PE (_ULCAST_(1) << 6)
  471. #define R10K_CONF_PM (_ULCAST_(3) << 7)
  472. #define R10K_CONF_EC (_ULCAST_(15)<< 9)
  473. #define R10K_CONF_SB (_ULCAST_(1) << 13)
  474. #define R10K_CONF_SK (_ULCAST_(1) << 14)
  475. #define R10K_CONF_SS (_ULCAST_(7) << 16)
  476. #define R10K_CONF_SC (_ULCAST_(7) << 19)
  477. #define R10K_CONF_DC (_ULCAST_(7) << 26)
  478. #define R10K_CONF_IC (_ULCAST_(7) << 29)
  479. /* Bits specific to the VR41xx. */
  480. #define VR41_CONF_CS (_ULCAST_(1) << 12)
  481. #define VR41_CONF_P4K (_ULCAST_(1) << 13)
  482. #define VR41_CONF_BP (_ULCAST_(1) << 16)
  483. #define VR41_CONF_M16 (_ULCAST_(1) << 20)
  484. #define VR41_CONF_AD (_ULCAST_(1) << 23)
  485. /* Bits specific to the R30xx. */
  486. #define R30XX_CONF_FDM (_ULCAST_(1) << 19)
  487. #define R30XX_CONF_REV (_ULCAST_(1) << 22)
  488. #define R30XX_CONF_AC (_ULCAST_(1) << 23)
  489. #define R30XX_CONF_RF (_ULCAST_(1) << 24)
  490. #define R30XX_CONF_HALT (_ULCAST_(1) << 25)
  491. #define R30XX_CONF_FPINT (_ULCAST_(7) << 26)
  492. #define R30XX_CONF_DBR (_ULCAST_(1) << 29)
  493. #define R30XX_CONF_SB (_ULCAST_(1) << 30)
  494. #define R30XX_CONF_LOCK (_ULCAST_(1) << 31)
  495. /* Bits specific to the TX49. */
  496. #define TX49_CONF_DC (_ULCAST_(1) << 16)
  497. #define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */
  498. #define TX49_CONF_HALT (_ULCAST_(1) << 18)
  499. #define TX49_CONF_CWFON (_ULCAST_(1) << 27)
  500. /* Bits specific to the MIPS32/64 PRA. */
  501. #define MIPS_CONF_MT (_ULCAST_(7) << 7)
  502. #define MIPS_CONF_AR (_ULCAST_(7) << 10)
  503. #define MIPS_CONF_AT (_ULCAST_(3) << 13)
  504. #define MIPS_CONF_M (_ULCAST_(1) << 31)
  505. /*
  506. * Bits in the MIPS32/64 PRA coprocessor 0 config registers 1 and above.
  507. */
  508. #define MIPS_CONF1_FP (_ULCAST_(1) << 0)
  509. #define MIPS_CONF1_EP (_ULCAST_(1) << 1)
  510. #define MIPS_CONF1_CA (_ULCAST_(1) << 2)
  511. #define MIPS_CONF1_WR (_ULCAST_(1) << 3)
  512. #define MIPS_CONF1_PC (_ULCAST_(1) << 4)
  513. #define MIPS_CONF1_MD (_ULCAST_(1) << 5)
  514. #define MIPS_CONF1_C2 (_ULCAST_(1) << 6)
  515. #define MIPS_CONF1_DA (_ULCAST_(7) << 7)
  516. #define MIPS_CONF1_DL (_ULCAST_(7) << 10)
  517. #define MIPS_CONF1_DS (_ULCAST_(7) << 13)
  518. #define MIPS_CONF1_IA (_ULCAST_(7) << 16)
  519. #define MIPS_CONF1_IL (_ULCAST_(7) << 19)
  520. #define MIPS_CONF1_IS (_ULCAST_(7) << 22)
  521. #define MIPS_CONF1_TLBS (_ULCAST_(63)<< 25)
  522. #define MIPS_CONF2_SA (_ULCAST_(15)<< 0)
  523. #define MIPS_CONF2_SL (_ULCAST_(15)<< 4)
  524. #define MIPS_CONF2_SS (_ULCAST_(15)<< 8)
  525. #define MIPS_CONF2_SU (_ULCAST_(15)<< 12)
  526. #define MIPS_CONF2_TA (_ULCAST_(15)<< 16)
  527. #define MIPS_CONF2_TL (_ULCAST_(15)<< 20)
  528. #define MIPS_CONF2_TS (_ULCAST_(15)<< 24)
  529. #define MIPS_CONF2_TU (_ULCAST_(7) << 28)
  530. #define MIPS_CONF3_TL (_ULCAST_(1) << 0)
  531. #define MIPS_CONF3_SM (_ULCAST_(1) << 1)
  532. #define MIPS_CONF3_MT (_ULCAST_(1) << 2)
  533. #define MIPS_CONF3_SP (_ULCAST_(1) << 4)
  534. #define MIPS_CONF3_VINT (_ULCAST_(1) << 5)
  535. #define MIPS_CONF3_VEIC (_ULCAST_(1) << 6)
  536. #define MIPS_CONF3_LPA (_ULCAST_(1) << 7)
  537. #define MIPS_CONF3_DSP (_ULCAST_(1) << 10)
  538. #define MIPS_CONF3_ULRI (_ULCAST_(1) << 13)
  539. #define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0)
  540. #define MIPS_CONF4_MMUEXTDEF (_ULCAST_(3) << 14)
  541. #define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14)
  542. #define MIPS_CONF7_WII (_ULCAST_(1) << 31)
  543. #define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
  544. /*
  545. * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
  546. */
  547. #define MIPS_FPIR_S (_ULCAST_(1) << 16)
  548. #define MIPS_FPIR_D (_ULCAST_(1) << 17)
  549. #define MIPS_FPIR_PS (_ULCAST_(1) << 18)
  550. #define MIPS_FPIR_3D (_ULCAST_(1) << 19)
  551. #define MIPS_FPIR_W (_ULCAST_(1) << 20)
  552. #define MIPS_FPIR_L (_ULCAST_(1) << 21)
  553. #define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
  554. #ifndef __ASSEMBLY__
  555. /*
  556. * Functions to access the R10000 performance counters. These are basically
  557. * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
  558. * performance counter number encoded into bits 1 ... 5 of the instruction.
  559. * Only performance counters 0 to 1 actually exist, so for a non-R10000 aware
  560. * disassembler these will look like an access to sel 0 or 1.
  561. */
  562. #define read_r10k_perf_cntr(counter) \
  563. ({ \
  564. unsigned int __res; \
  565. __asm__ __volatile__( \
  566. "mfpc\t%0, %1" \
  567. : "=r" (__res) \
  568. : "i" (counter)); \
  569. \
  570. __res; \
  571. })
  572. #define write_r10k_perf_cntr(counter,val) \
  573. do { \
  574. __asm__ __volatile__( \
  575. "mtpc\t%0, %1" \
  576. : \
  577. : "r" (val), "i" (counter)); \
  578. } while (0)
  579. #define read_r10k_perf_event(counter) \
  580. ({ \
  581. unsigned int __res; \
  582. __asm__ __volatile__( \
  583. "mfps\t%0, %1" \
  584. : "=r" (__res) \
  585. : "i" (counter)); \
  586. \
  587. __res; \
  588. })
  589. #define write_r10k_perf_cntl(counter,val) \
  590. do { \
  591. __asm__ __volatile__( \
  592. "mtps\t%0, %1" \
  593. : \
  594. : "r" (val), "i" (counter)); \
  595. } while (0)
  596. /*
  597. * Macros to access the system control coprocessor
  598. */
  599. #define __read_32bit_c0_register(source, sel) \
  600. ({ int __res; \
  601. if (sel == 0) \
  602. __asm__ __volatile__( \
  603. "mfc0\t%0, " #source "\n\t" \
  604. : "=r" (__res)); \
  605. else \
  606. __asm__ __volatile__( \
  607. ".set\tmips32\n\t" \
  608. "mfc0\t%0, " #source ", " #sel "\n\t" \
  609. ".set\tmips0\n\t" \
  610. : "=r" (__res)); \
  611. __res; \
  612. })
  613. #define __read_64bit_c0_register(source, sel) \
  614. ({ unsigned long long __res; \
  615. if (sizeof(unsigned long) == 4) \
  616. __res = __read_64bit_c0_split(source, sel); \
  617. else if (sel == 0) \
  618. __asm__ __volatile__( \
  619. ".set\tmips3\n\t" \
  620. "dmfc0\t%0, " #source "\n\t" \
  621. ".set\tmips0" \
  622. : "=r" (__res)); \
  623. else \
  624. __asm__ __volatile__( \
  625. ".set\tmips64\n\t" \
  626. "dmfc0\t%0, " #source ", " #sel "\n\t" \
  627. ".set\tmips0" \
  628. : "=r" (__res)); \
  629. __res; \
  630. })
  631. #define __write_32bit_c0_register(register, sel, value) \
  632. do { \
  633. if (sel == 0) \
  634. __asm__ __volatile__( \
  635. "mtc0\t%z0, " #register "\n\t" \
  636. : : "Jr" ((unsigned int)(value))); \
  637. else \
  638. __asm__ __volatile__( \
  639. ".set\tmips32\n\t" \
  640. "mtc0\t%z0, " #register ", " #sel "\n\t" \
  641. ".set\tmips0" \
  642. : : "Jr" ((unsigned int)(value))); \
  643. } while (0)
  644. #define __write_64bit_c0_register(register, sel, value) \
  645. do { \
  646. if (sizeof(unsigned long) == 4) \
  647. __write_64bit_c0_split(register, sel, value); \
  648. else if (sel == 0) \
  649. __asm__ __volatile__( \
  650. ".set\tmips3\n\t" \
  651. "dmtc0\t%z0, " #register "\n\t" \
  652. ".set\tmips0" \
  653. : : "Jr" (value)); \
  654. else \
  655. __asm__ __volatile__( \
  656. ".set\tmips64\n\t" \
  657. "dmtc0\t%z0, " #register ", " #sel "\n\t" \
  658. ".set\tmips0" \
  659. : : "Jr" (value)); \
  660. } while (0)
  661. #define __read_ulong_c0_register(reg, sel) \
  662. ((sizeof(unsigned long) == 4) ? \
  663. (unsigned long) __read_32bit_c0_register(reg, sel) : \
  664. (unsigned long) __read_64bit_c0_register(reg, sel))
  665. #define __write_ulong_c0_register(reg, sel, val) \
  666. do { \
  667. if (sizeof(unsigned long) == 4) \
  668. __write_32bit_c0_register(reg, sel, val); \
  669. else \
  670. __write_64bit_c0_register(reg, sel, val); \
  671. } while (0)
  672. /*
  673. * On RM7000/RM9000 these are uses to access cop0 set 1 registers
  674. */
  675. #define __read_32bit_c0_ctrl_register(source) \
  676. ({ int __res; \
  677. __asm__ __volatile__( \
  678. "cfc0\t%0, " #source "\n\t" \
  679. : "=r" (__res)); \
  680. __res; \
  681. })
  682. #define __write_32bit_c0_ctrl_register(register, value) \
  683. do { \
  684. __asm__ __volatile__( \
  685. "ctc0\t%z0, " #register "\n\t" \
  686. : : "Jr" ((unsigned int)(value))); \
  687. } while (0)
  688. /*
  689. * These versions are only needed for systems with more than 38 bits of
  690. * physical address space running the 32-bit kernel. That's none atm :-)
  691. */
  692. #define __read_64bit_c0_split(source, sel) \
  693. ({ \
  694. unsigned long long __val; \
  695. unsigned long __flags; \
  696. \
  697. local_irq_save(__flags); \
  698. if (sel == 0) \
  699. __asm__ __volatile__( \
  700. ".set\tmips64\n\t" \
  701. "dmfc0\t%M0, " #source "\n\t" \
  702. "dsll\t%L0, %M0, 32\n\t" \
  703. "dsra\t%M0, %M0, 32\n\t" \
  704. "dsra\t%L0, %L0, 32\n\t" \
  705. ".set\tmips0" \
  706. : "=r" (__val)); \
  707. else \
  708. __asm__ __volatile__( \
  709. ".set\tmips64\n\t" \
  710. "dmfc0\t%M0, " #source ", " #sel "\n\t" \
  711. "dsll\t%L0, %M0, 32\n\t" \
  712. "dsra\t%M0, %M0, 32\n\t" \
  713. "dsra\t%L0, %L0, 32\n\t" \
  714. ".set\tmips0" \
  715. : "=r" (__val)); \
  716. local_irq_restore(__flags); \
  717. \
  718. __val; \
  719. })
  720. #define __write_64bit_c0_split(source, sel, val) \
  721. do { \
  722. unsigned long __flags; \
  723. \
  724. local_irq_save(__flags); \
  725. if (sel == 0) \
  726. __asm__ __volatile__( \
  727. ".set\tmips64\n\t" \
  728. "dsll\t%L0, %L0, 32\n\t" \
  729. "dsrl\t%L0, %L0, 32\n\t" \
  730. "dsll\t%M0, %M0, 32\n\t" \
  731. "or\t%L0, %L0, %M0\n\t" \
  732. "dmtc0\t%L0, " #source "\n\t" \
  733. ".set\tmips0" \
  734. : : "r" (val)); \
  735. else \
  736. __asm__ __volatile__( \
  737. ".set\tmips64\n\t" \
  738. "dsll\t%L0, %L0, 32\n\t" \
  739. "dsrl\t%L0, %L0, 32\n\t" \
  740. "dsll\t%M0, %M0, 32\n\t" \
  741. "or\t%L0, %L0, %M0\n\t" \
  742. "dmtc0\t%L0, " #source ", " #sel "\n\t" \
  743. ".set\tmips0" \
  744. : : "r" (val)); \
  745. local_irq_restore(__flags); \
  746. } while (0)
  747. #define read_c0_index() __read_32bit_c0_register($0, 0)
  748. #define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
  749. #define read_c0_random() __read_32bit_c0_register($1, 0)
  750. #define write_c0_random(val) __write_32bit_c0_register($1, 0, val)
  751. #define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
  752. #define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
  753. #define read_c0_entrylo1() __read_ulong_c0_register($3, 0)
  754. #define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
  755. #define read_c0_conf() __read_32bit_c0_register($3, 0)
  756. #define write_c0_conf(val) __write_32bit_c0_register($3, 0, val)
  757. #define read_c0_context() __read_ulong_c0_register($4, 0)
  758. #define write_c0_context(val) __write_ulong_c0_register($4, 0, val)
  759. #define read_c0_userlocal() __read_ulong_c0_register($4, 2)
  760. #define write_c0_userlocal(val) __write_ulong_c0_register($4, 2, val)
  761. #define read_c0_pagemask() __read_32bit_c0_register($5, 0)
  762. #define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
  763. #define read_c0_pagegrain() __read_32bit_c0_register($5, 1)
  764. #define write_c0_pagegrain(val) __write_32bit_c0_register($5, 1, val)
  765. #define read_c0_wired() __read_32bit_c0_register($6, 0)
  766. #define write_c0_wired(val) __write_32bit_c0_register($6, 0, val)
  767. #define read_c0_info() __read_32bit_c0_register($7, 0)
  768. #define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */
  769. #define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
  770. #define read_c0_badvaddr() __read_ulong_c0_register($8, 0)
  771. #define write_c0_badvaddr(val) __write_ulong_c0_register($8, 0, val)
  772. #define read_c0_count() __read_32bit_c0_register($9, 0)
  773. #define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
  774. #define read_c0_count2() __read_32bit_c0_register($9, 6) /* pnx8550 */
  775. #define write_c0_count2(val) __write_32bit_c0_register($9, 6, val)
  776. #define read_c0_count3() __read_32bit_c0_register($9, 7) /* pnx8550 */
  777. #define write_c0_count3(val) __write_32bit_c0_register($9, 7, val)
  778. #define read_c0_entryhi() __read_ulong_c0_register($10, 0)
  779. #define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
  780. #define read_c0_compare() __read_32bit_c0_register($11, 0)
  781. #define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
  782. #define read_c0_compare2() __read_32bit_c0_register($11, 6) /* pnx8550 */
  783. #define write_c0_compare2(val) __write_32bit_c0_register($11, 6, val)
  784. #define read_c0_compare3() __read_32bit_c0_register($11, 7) /* pnx8550 */
  785. #define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val)
  786. #define read_c0_status() __read_32bit_c0_register($12, 0)
  787. #ifdef CONFIG_MIPS_MT_SMTC
  788. #define write_c0_status(val) \
  789. do { \
  790. __write_32bit_c0_register($12, 0, val); \
  791. __ehb(); \
  792. } while (0)
  793. #else
  794. /*
  795. * Legacy non-SMTC code, which may be hazardous
  796. * but which might not support EHB
  797. */
  798. #define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
  799. #endif /* CONFIG_MIPS_MT_SMTC */
  800. #define read_c0_cause() __read_32bit_c0_register($13, 0)
  801. #define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
  802. #define read_c0_epc() __read_ulong_c0_register($14, 0)
  803. #define write_c0_epc(val) __write_ulong_c0_register($14, 0, val)
  804. #define read_c0_prid() __read_32bit_c0_register($15, 0)
  805. #define read_c0_config() __read_32bit_c0_register($16, 0)
  806. #define read_c0_config1() __read_32bit_c0_register($16, 1)
  807. #define read_c0_config2() __read_32bit_c0_register($16, 2)
  808. #define read_c0_config3() __read_32bit_c0_register($16, 3)
  809. #define read_c0_config4() __read_32bit_c0_register($16, 4)
  810. #define read_c0_config5() __read_32bit_c0_register($16, 5)
  811. #define read_c0_config6() __read_32bit_c0_register($16, 6)
  812. #define read_c0_config7() __read_32bit_c0_register($16, 7)
  813. #define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
  814. #define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
  815. #define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
  816. #define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
  817. #define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
  818. #define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
  819. #define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
  820. #define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
  821. /*
  822. * The WatchLo register. There may be upto 8 of them.
  823. */
  824. #define read_c0_watchlo0() __read_ulong_c0_register($18, 0)
  825. #define read_c0_watchlo1() __read_ulong_c0_register($18, 1)
  826. #define read_c0_watchlo2() __read_ulong_c0_register($18, 2)
  827. #define read_c0_watchlo3() __read_ulong_c0_register($18, 3)
  828. #define read_c0_watchlo4() __read_ulong_c0_register($18, 4)
  829. #define read_c0_watchlo5() __read_ulong_c0_register($18, 5)
  830. #define read_c0_watchlo6() __read_ulong_c0_register($18, 6)
  831. #define read_c0_watchlo7() __read_ulong_c0_register($18, 7)
  832. #define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
  833. #define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
  834. #define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
  835. #define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
  836. #define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
  837. #define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
  838. #define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
  839. #define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
  840. /*
  841. * The WatchHi register. There may be upto 8 of them.
  842. */
  843. #define read_c0_watchhi0() __read_32bit_c0_register($19, 0)
  844. #define read_c0_watchhi1() __read_32bit_c0_register($19, 1)
  845. #define read_c0_watchhi2() __read_32bit_c0_register($19, 2)
  846. #define read_c0_watchhi3() __read_32bit_c0_register($19, 3)
  847. #define read_c0_watchhi4() __read_32bit_c0_register($19, 4)
  848. #define read_c0_watchhi5() __read_32bit_c0_register($19, 5)
  849. #define read_c0_watchhi6() __read_32bit_c0_register($19, 6)
  850. #define read_c0_watchhi7() __read_32bit_c0_register($19, 7)
  851. #define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
  852. #define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
  853. #define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
  854. #define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
  855. #define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
  856. #define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
  857. #define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
  858. #define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
  859. #define read_c0_xcontext() __read_ulong_c0_register($20, 0)
  860. #define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
  861. #define read_c0_intcontrol() __read_32bit_c0_ctrl_register($20)
  862. #define write_c0_intcontrol(val) __write_32bit_c0_ctrl_register($20, val)
  863. #define read_c0_framemask() __read_32bit_c0_register($21, 0)
  864. #define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
  865. /* RM9000 PerfControl performance counter control register */
  866. #define read_c0_perfcontrol() __read_32bit_c0_register($22, 0)
  867. #define write_c0_perfcontrol(val) __write_32bit_c0_register($22, 0, val)
  868. #define read_c0_diag() __read_32bit_c0_register($22, 0)
  869. #define write_c0_diag(val) __write_32bit_c0_register($22, 0, val)
  870. #define read_c0_diag1() __read_32bit_c0_register($22, 1)
  871. #define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val)
  872. #define read_c0_diag2() __read_32bit_c0_register($22, 2)
  873. #define write_c0_diag2(val) __write_32bit_c0_register($22, 2, val)
  874. #define read_c0_diag3() __read_32bit_c0_register($22, 3)
  875. #define write_c0_diag3(val) __write_32bit_c0_register($22, 3, val)
  876. #define read_c0_diag4() __read_32bit_c0_register($22, 4)
  877. #define write_c0_diag4(val) __write_32bit_c0_register($22, 4, val)
  878. #define read_c0_diag5() __read_32bit_c0_register($22, 5)
  879. #define write_c0_diag5(val) __write_32bit_c0_register($22, 5, val)
  880. #define read_c0_debug() __read_32bit_c0_register($23, 0)
  881. #define write_c0_debug(val) __write_32bit_c0_register($23, 0, val)
  882. #define read_c0_depc() __read_ulong_c0_register($24, 0)
  883. #define write_c0_depc(val) __write_ulong_c0_register($24, 0, val)
  884. /*
  885. * MIPS32 / MIPS64 performance counters
  886. */
  887. #define read_c0_perfctrl0() __read_32bit_c0_register($25, 0)
  888. #define write_c0_perfctrl0(val) __write_32bit_c0_register($25, 0, val)
  889. #define read_c0_perfcntr0() __read_32bit_c0_register($25, 1)
  890. #define write_c0_perfcntr0(val) __write_32bit_c0_register($25, 1, val)
  891. #define read_c0_perfctrl1() __read_32bit_c0_register($25, 2)
  892. #define write_c0_perfctrl1(val) __write_32bit_c0_register($25, 2, val)
  893. #define read_c0_perfcntr1() __read_32bit_c0_register($25, 3)
  894. #define write_c0_perfcntr1(val) __write_32bit_c0_register($25, 3, val)
  895. #define read_c0_perfctrl2() __read_32bit_c0_register($25, 4)
  896. #define write_c0_perfctrl2(val) __write_32bit_c0_register($25, 4, val)
  897. #define read_c0_perfcntr2() __read_32bit_c0_register($25, 5)
  898. #define write_c0_perfcntr2(val) __write_32bit_c0_register($25, 5, val)
  899. #define read_c0_perfctrl3() __read_32bit_c0_register($25, 6)
  900. #define write_c0_perfctrl3(val) __write_32bit_c0_register($25, 6, val)
  901. #define read_c0_perfcntr3() __read_32bit_c0_register($25, 7)
  902. #define write_c0_perfcntr3(val) __write_32bit_c0_register($25, 7, val)
  903. /* RM9000 PerfCount performance counter register */
  904. #define read_c0_perfcount() __read_64bit_c0_register($25, 0)
  905. #define write_c0_perfcount(val) __write_64bit_c0_register($25, 0, val)
  906. #define read_c0_ecc() __read_32bit_c0_register($26, 0)
  907. #define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
  908. #define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
  909. #define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)
  910. #define read_c0_cacheerr() __read_32bit_c0_register($27, 0)
  911. #define read_c0_derraddr1() __read_ulong_c0_register($27, 1)
  912. #define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val)
  913. #define read_c0_taglo() __read_32bit_c0_register($28, 0)
  914. #define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
  915. #define read_c0_dtaglo() __read_32bit_c0_register($28, 2)
  916. #define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val)
  917. #define read_c0_taghi() __read_32bit_c0_register($29, 0)
  918. #define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
  919. #define read_c0_errorepc() __read_ulong_c0_register($30, 0)
  920. #define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
  921. /* MIPSR2 */
  922. #define read_c0_hwrena() __read_32bit_c0_register($7, 0)
  923. #define write_c0_hwrena(val) __write_32bit_c0_register($7, 0, val)
  924. #define read_c0_intctl() __read_32bit_c0_register($12, 1)
  925. #define write_c0_intctl(val) __write_32bit_c0_register($12, 1, val)
  926. #define read_c0_srsctl() __read_32bit_c0_register($12, 2)
  927. #define write_c0_srsctl(val) __write_32bit_c0_register($12, 2, val)
  928. #define read_c0_srsmap() __read_32bit_c0_register($12, 3)
  929. #define write_c0_srsmap(val) __write_32bit_c0_register($12, 3, val)
  930. #define read_c0_ebase() __read_32bit_c0_register($15, 1)
  931. #define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val)
  932. /* Cavium OCTEON (cnMIPS) */
  933. #define read_c0_cvmcount() __read_ulong_c0_register($9, 6)
  934. #define write_c0_cvmcount(val) __write_ulong_c0_register($9, 6, val)
  935. #define read_c0_cvmctl() __read_64bit_c0_register($9, 7)
  936. #define write_c0_cvmctl(val) __write_64bit_c0_register($9, 7, val)
  937. #define read_c0_cvmmemctl() __read_64bit_c0_register($11, 7)
  938. #define write_c0_cvmmemctl(val) __write_64bit_c0_register($11, 7, val)
  939. /*
  940. * The cacheerr registers are not standardized. On OCTEON, they are
  941. * 64 bits wide.
  942. */
  943. #define read_octeon_c0_icacheerr() __read_64bit_c0_register($27, 0)
  944. #define write_octeon_c0_icacheerr(val) __write_64bit_c0_register($27, 0, val)
  945. #define read_octeon_c0_dcacheerr() __read_64bit_c0_register($27, 1)
  946. #define write_octeon_c0_dcacheerr(val) __write_64bit_c0_register($27, 1, val)
  947. /*
  948. * Macros to access the floating point coprocessor control registers
  949. */
  950. #define read_32bit_cp1_register(source) \
  951. ({ int __res; \
  952. __asm__ __volatile__( \
  953. ".set\tpush\n\t" \
  954. ".set\treorder\n\t" \
  955. /* gas fails to assemble cfc1 for some archs (octeon).*/ \
  956. ".set\tmips1\n\t" \
  957. "cfc1\t%0,"STR(source)"\n\t" \
  958. ".set\tpop" \
  959. : "=r" (__res)); \
  960. __res;})
  961. #define rddsp(mask) \
  962. ({ \
  963. unsigned int __res; \
  964. \
  965. __asm__ __volatile__( \
  966. " .set push \n" \
  967. " .set noat \n" \
  968. " # rddsp $1, %x1 \n" \
  969. " .word 0x7c000cb8 | (%x1 << 16) \n" \
  970. " move %0, $1 \n" \
  971. " .set pop \n" \
  972. : "=r" (__res) \
  973. : "i" (mask)); \
  974. __res; \
  975. })
  976. #define wrdsp(val, mask) \
  977. do { \
  978. __asm__ __volatile__( \
  979. " .set push \n" \
  980. " .set noat \n" \
  981. " move $1, %0 \n" \
  982. " # wrdsp $1, %x1 \n" \
  983. " .word 0x7c2004f8 | (%x1 << 11) \n" \
  984. " .set pop \n" \
  985. : \
  986. : "r" (val), "i" (mask)); \
  987. } while (0)
  988. #if 0 /* Need DSP ASE capable assembler ... */
  989. #define mflo0() ({ long mflo0; __asm__("mflo %0, $ac0" : "=r" (mflo0)); mflo0;})
  990. #define mflo1() ({ long mflo1; __asm__("mflo %0, $ac1" : "=r" (mflo1)); mflo1;})
  991. #define mflo2() ({ long mflo2; __asm__("mflo %0, $ac2" : "=r" (mflo2)); mflo2;})
  992. #define mflo3() ({ long mflo3; __asm__("mflo %0, $ac3" : "=r" (mflo3)); mflo3;})
  993. #define mfhi0() ({ long mfhi0; __asm__("mfhi %0, $ac0" : "=r" (mfhi0)); mfhi0;})
  994. #define mfhi1() ({ long mfhi1; __asm__("mfhi %0, $ac1" : "=r" (mfhi1)); mfhi1;})
  995. #define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;})
  996. #define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;})
  997. #define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x))
  998. #define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x))
  999. #define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x))
  1000. #define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x))
  1001. #define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x))
  1002. #define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x))
  1003. #define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x))
  1004. #define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x))
  1005. #else
  1006. #define mfhi0() \
  1007. ({ \
  1008. unsigned long __treg; \
  1009. \
  1010. __asm__ __volatile__( \
  1011. " .set push \n" \
  1012. " .set noat \n" \
  1013. " # mfhi %0, $ac0 \n" \
  1014. " .word 0x00000810 \n" \
  1015. " move %0, $1 \n" \
  1016. " .set pop \n" \
  1017. : "=r" (__treg)); \
  1018. __treg; \
  1019. })
  1020. #define mfhi1() \
  1021. ({ \
  1022. unsigned long __treg; \
  1023. \
  1024. __asm__ __volatile__( \
  1025. " .set push \n" \
  1026. " .set noat \n" \
  1027. " # mfhi %0, $ac1 \n" \
  1028. " .word 0x00200810 \n" \
  1029. " move %0, $1 \n" \
  1030. " .set pop \n" \
  1031. : "=r" (__treg)); \
  1032. __treg; \
  1033. })
  1034. #define mfhi2() \
  1035. ({ \
  1036. unsigned long __treg; \
  1037. \
  1038. __asm__ __volatile__( \
  1039. " .set push \n" \
  1040. " .set noat \n" \
  1041. " # mfhi %0, $ac2 \n" \
  1042. " .word 0x00400810 \n" \
  1043. " move %0, $1 \n" \
  1044. " .set pop \n" \
  1045. : "=r" (__treg)); \
  1046. __treg; \
  1047. })
  1048. #define mfhi3() \
  1049. ({ \
  1050. unsigned long __treg; \
  1051. \
  1052. __asm__ __volatile__( \
  1053. " .set push \n" \
  1054. " .set noat \n" \
  1055. " # mfhi %0, $ac3 \n" \
  1056. " .word 0x00600810 \n" \
  1057. " move %0, $1 \n" \
  1058. " .set pop \n" \
  1059. : "=r" (__treg)); \
  1060. __treg; \
  1061. })
  1062. #define mflo0() \
  1063. ({ \
  1064. unsigned long __treg; \
  1065. \
  1066. __asm__ __volatile__( \
  1067. " .set push \n" \
  1068. " .set noat \n" \
  1069. " # mflo %0, $ac0 \n" \
  1070. " .word 0x00000812 \n" \
  1071. " move %0, $1 \n" \
  1072. " .set pop \n" \
  1073. : "=r" (__treg)); \
  1074. __treg; \
  1075. })
  1076. #define mflo1() \
  1077. ({ \
  1078. unsigned long __treg; \
  1079. \
  1080. __asm__ __volatile__( \
  1081. " .set push \n" \
  1082. " .set noat \n" \
  1083. " # mflo %0, $ac1 \n" \
  1084. " .word 0x00200812 \n" \
  1085. " move %0, $1 \n" \
  1086. " .set pop \n" \
  1087. : "=r" (__treg)); \
  1088. __treg; \
  1089. })
  1090. #define mflo2() \
  1091. ({ \
  1092. unsigned long __treg; \
  1093. \
  1094. __asm__ __volatile__( \
  1095. " .set push \n" \
  1096. " .set noat \n" \
  1097. " # mflo %0, $ac2 \n" \
  1098. " .word 0x00400812 \n" \
  1099. " move %0, $1 \n" \
  1100. " .set pop \n" \
  1101. : "=r" (__treg)); \
  1102. __treg; \
  1103. })
  1104. #define mflo3() \
  1105. ({ \
  1106. unsigned long __treg; \
  1107. \
  1108. __asm__ __volatile__( \
  1109. " .set push \n" \
  1110. " .set noat \n" \
  1111. " # mflo %0, $ac3 \n" \
  1112. " .word 0x00600812 \n" \
  1113. " move %0, $1 \n" \
  1114. " .set pop \n" \
  1115. : "=r" (__treg)); \
  1116. __treg; \
  1117. })
  1118. #define mthi0(x) \
  1119. do { \
  1120. __asm__ __volatile__( \
  1121. " .set push \n" \
  1122. " .set noat \n" \
  1123. " move $1, %0 \n" \
  1124. " # mthi $1, $ac0 \n" \
  1125. " .word 0x00200011 \n" \
  1126. " .set pop \n" \
  1127. : \
  1128. : "r" (x)); \
  1129. } while (0)
  1130. #define mthi1(x) \
  1131. do { \
  1132. __asm__ __volatile__( \
  1133. " .set push \n" \
  1134. " .set noat \n" \
  1135. " move $1, %0 \n" \
  1136. " # mthi $1, $ac1 \n" \
  1137. " .word 0x00200811 \n" \
  1138. " .set pop \n" \
  1139. : \
  1140. : "r" (x)); \
  1141. } while (0)
  1142. #define mthi2(x) \
  1143. do { \
  1144. __asm__ __volatile__( \
  1145. " .set push \n" \
  1146. " .set noat \n" \
  1147. " move $1, %0 \n" \
  1148. " # mthi $1, $ac2 \n" \
  1149. " .word 0x00201011 \n" \
  1150. " .set pop \n" \
  1151. : \
  1152. : "r" (x)); \
  1153. } while (0)
  1154. #define mthi3(x) \
  1155. do { \
  1156. __asm__ __volatile__( \
  1157. " .set push \n" \
  1158. " .set noat \n" \
  1159. " move $1, %0 \n" \
  1160. " # mthi $1, $ac3 \n" \
  1161. " .word 0x00201811 \n" \
  1162. " .set pop \n" \
  1163. : \
  1164. : "r" (x)); \
  1165. } while (0)
  1166. #define mtlo0(x) \
  1167. do { \
  1168. __asm__ __volatile__( \
  1169. " .set push \n" \
  1170. " .set noat \n" \
  1171. " move $1, %0 \n" \
  1172. " # mtlo $1, $ac0 \n" \
  1173. " .word 0x00200013 \n" \
  1174. " .set pop \n" \
  1175. : \
  1176. : "r" (x)); \
  1177. } while (0)
  1178. #define mtlo1(x) \
  1179. do { \
  1180. __asm__ __volatile__( \
  1181. " .set push \n" \
  1182. " .set noat \n" \
  1183. " move $1, %0 \n" \
  1184. " # mtlo $1, $ac1 \n" \
  1185. " .word 0x00200813 \n" \
  1186. " .set pop \n" \
  1187. : \
  1188. : "r" (x)); \
  1189. } while (0)
  1190. #define mtlo2(x) \
  1191. do { \
  1192. __asm__ __volatile__( \
  1193. " .set push \n" \
  1194. " .set noat \n" \
  1195. " move $1, %0 \n" \
  1196. " # mtlo $1, $ac2 \n" \
  1197. " .word 0x00201013 \n" \
  1198. " .set pop \n" \
  1199. : \
  1200. : "r" (x)); \
  1201. } while (0)
  1202. #define mtlo3(x) \
  1203. do { \
  1204. __asm__ __volatile__( \
  1205. " .set push \n" \
  1206. " .set noat \n" \
  1207. " move $1, %0 \n" \
  1208. " # mtlo $1, $ac3 \n" \
  1209. " .word 0x00201813 \n" \
  1210. " .set pop \n" \
  1211. : \
  1212. : "r" (x)); \
  1213. } while (0)
  1214. #endif
  1215. /*
  1216. * TLB operations.
  1217. *
  1218. * It is responsibility of the caller to take care of any TLB hazards.
  1219. */
  1220. static inline void tlb_probe(void)
  1221. {
  1222. __asm__ __volatile__(
  1223. ".set noreorder\n\t"
  1224. "tlbp\n\t"
  1225. ".set reorder");
  1226. }
  1227. static inline void tlb_read(void)
  1228. {
  1229. #if MIPS34K_MISSED_ITLB_WAR
  1230. int res = 0;
  1231. __asm__ __volatile__(
  1232. " .set push \n"
  1233. " .set noreorder \n"
  1234. " .set noat \n"
  1235. " .set mips32r2 \n"
  1236. " .word 0x41610001 # dvpe $1 \n"
  1237. " move %0, $1 \n"
  1238. " ehb \n"
  1239. " .set pop \n"
  1240. : "=r" (res));
  1241. instruction_hazard();
  1242. #endif
  1243. __asm__ __volatile__(
  1244. ".set noreorder\n\t"
  1245. "tlbr\n\t"
  1246. ".set reorder");
  1247. #if MIPS34K_MISSED_ITLB_WAR
  1248. if ((res & _ULCAST_(1)))
  1249. __asm__ __volatile__(
  1250. " .set push \n"
  1251. " .set noreorder \n"
  1252. " .set noat \n"
  1253. " .set mips32r2 \n"
  1254. " .word 0x41600021 # evpe \n"
  1255. " ehb \n"
  1256. " .set pop \n");
  1257. #endif
  1258. }
  1259. static inline void tlb_write_indexed(void)
  1260. {
  1261. __asm__ __volatile__(
  1262. ".set noreorder\n\t"
  1263. "tlbwi\n\t"
  1264. ".set reorder");
  1265. }
  1266. static inline void tlb_write_random(void)
  1267. {
  1268. __asm__ __volatile__(
  1269. ".set noreorder\n\t"
  1270. "tlbwr\n\t"
  1271. ".set reorder");
  1272. }
  1273. /*
  1274. * Manipulate bits in a c0 register.
  1275. */
  1276. #ifndef CONFIG_MIPS_MT_SMTC
  1277. /*
  1278. * SMTC Linux requires shutting-down microthread scheduling
  1279. * during CP0 register read-modify-write sequences.
  1280. */
  1281. #define __BUILD_SET_C0(name) \
  1282. static inline unsigned int \
  1283. set_c0_##name(unsigned int set) \
  1284. { \
  1285. unsigned int res, new; \
  1286. \
  1287. res = read_c0_##name(); \
  1288. new = res | set; \
  1289. write_c0_##name(new); \
  1290. \
  1291. return res; \
  1292. } \
  1293. \
  1294. static inline unsigned int \
  1295. clear_c0_##name(unsigned int clear) \
  1296. { \
  1297. unsigned int res, new; \
  1298. \
  1299. res = read_c0_##name(); \
  1300. new = res & ~clear; \
  1301. write_c0_##name(new); \
  1302. \
  1303. return res; \
  1304. } \
  1305. \
  1306. static inline unsigned int \
  1307. change_c0_##name(unsigned int change, unsigned int val) \
  1308. { \
  1309. unsigned int res, new; \
  1310. \
  1311. res = read_c0_##name(); \
  1312. new = res & ~change; \
  1313. new |= (val & change); \
  1314. write_c0_##name(new); \
  1315. \
  1316. return res; \
  1317. }
  1318. #else /* SMTC versions that manage MT scheduling */
  1319. #include <linux/irqflags.h>
  1320. /*
  1321. * This is a duplicate of dmt() in mipsmtregs.h to avoid problems with
  1322. * header file recursion.
  1323. */
  1324. static inline unsigned int __dmt(void)
  1325. {
  1326. int res;
  1327. __asm__ __volatile__(
  1328. " .set push \n"
  1329. " .set mips32r2 \n"
  1330. " .set noat \n"
  1331. " .word 0x41610BC1 # dmt $1 \n"
  1332. " ehb \n"
  1333. " move %0, $1 \n"
  1334. " .set pop \n"
  1335. : "=r" (res));
  1336. instruction_hazard();
  1337. return res;
  1338. }
  1339. #define __VPECONTROL_TE_SHIFT 15
  1340. #define __VPECONTROL_TE (1UL << __VPECONTROL_TE_SHIFT)
  1341. #define __EMT_ENABLE __VPECONTROL_TE
  1342. static inline void __emt(unsigned int previous)
  1343. {
  1344. if ((previous & __EMT_ENABLE))
  1345. __asm__ __volatile__(
  1346. " .set mips32r2 \n"
  1347. " .word 0x41600be1 # emt \n"
  1348. " ehb \n"
  1349. " .set mips0 \n");
  1350. }
  1351. static inline void __ehb(void)
  1352. {
  1353. __asm__ __volatile__(
  1354. " .set mips32r2 \n"
  1355. " ehb \n" " .set mips0 \n");
  1356. }
  1357. /*
  1358. * Note that local_irq_save/restore affect TC-specific IXMT state,
  1359. * not Status.IE as in non-SMTC kernel.
  1360. */
  1361. #define __BUILD_SET_C0(name) \
  1362. static inline unsigned int \
  1363. set_c0_##name(unsigned int set) \
  1364. { \
  1365. unsigned int res; \
  1366. unsigned int new; \
  1367. unsigned int omt; \
  1368. unsigned long flags; \
  1369. \
  1370. local_irq_save(flags); \
  1371. omt = __dmt(); \
  1372. res = read_c0_##name(); \
  1373. new = res | set; \
  1374. write_c0_##name(new); \
  1375. __emt(omt); \
  1376. local_irq_restore(flags); \
  1377. \
  1378. return res; \
  1379. } \
  1380. \
  1381. static inline unsigned int \
  1382. clear_c0_##name(unsigned int clear) \
  1383. { \
  1384. unsigned int res; \
  1385. unsigned int new; \
  1386. unsigned int omt; \
  1387. unsigned long flags; \
  1388. \
  1389. local_irq_save(flags); \
  1390. omt = __dmt(); \
  1391. res = read_c0_##name(); \
  1392. new = res & ~clear; \
  1393. write_c0_##name(new); \
  1394. __emt(omt); \
  1395. local_irq_restore(flags); \
  1396. \
  1397. return res; \
  1398. } \
  1399. \
  1400. static inline unsigned int \
  1401. change_c0_##name(unsigned int change, unsigned int newbits) \
  1402. { \
  1403. unsigned int res; \
  1404. unsigned int new; \
  1405. unsigned int omt; \
  1406. unsigned long flags; \
  1407. \
  1408. local_irq_save(flags); \
  1409. \
  1410. omt = __dmt(); \
  1411. res = read_c0_##name(); \
  1412. new = res & ~change; \
  1413. new |= (newbits & change); \
  1414. write_c0_##name(new); \
  1415. __emt(omt); \
  1416. local_irq_restore(flags); \
  1417. \
  1418. return res; \
  1419. }
  1420. #endif
  1421. __BUILD_SET_C0(status)
  1422. __BUILD_SET_C0(cause)
  1423. __BUILD_SET_C0(config)
  1424. __BUILD_SET_C0(intcontrol)
  1425. __BUILD_SET_C0(intctl)
  1426. __BUILD_SET_C0(srsmap)
  1427. #endif /* !__ASSEMBLY__ */
  1428. #endif /* _ASM_MIPSREGS_H */