ultra.S 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /* $Id: ultra.S,v 1.72 2002/02/09 19:49:31 davem Exp $
  2. * ultra.S: Don't expand these all over the place...
  3. *
  4. * Copyright (C) 1997, 2000 David S. Miller (davem@redhat.com)
  5. */
  6. #include <linux/config.h>
  7. #include <asm/asi.h>
  8. #include <asm/pgtable.h>
  9. #include <asm/page.h>
  10. #include <asm/spitfire.h>
  11. #include <asm/mmu_context.h>
  12. #include <asm/pil.h>
  13. #include <asm/head.h>
  14. #include <asm/thread_info.h>
  15. #include <asm/cacheflush.h>
  16. /* Basically, most of the Spitfire vs. Cheetah madness
  17. * has to do with the fact that Cheetah does not support
  18. * IMMU flushes out of the secondary context. Someone needs
  19. * to throw a south lake birthday party for the folks
  20. * in Microelectronics who refused to fix this shit.
  21. */
  22. /* This file is meant to be read efficiently by the CPU, not humans.
  23. * Staraj sie tego nikomu nie pierdolnac...
  24. */
  25. .text
  26. .align 32
  27. .globl __flush_tlb_mm
  28. __flush_tlb_mm: /* %o0=(ctx & TAG_CONTEXT_BITS), %o1=SECONDARY_CONTEXT */
  29. ldxa [%o1] ASI_DMMU, %g2
  30. cmp %g2, %o0
  31. bne,pn %icc, __spitfire_flush_tlb_mm_slow
  32. mov 0x50, %g3
  33. stxa %g0, [%g3] ASI_DMMU_DEMAP
  34. stxa %g0, [%g3] ASI_IMMU_DEMAP
  35. retl
  36. flush %g6
  37. nop
  38. nop
  39. nop
  40. nop
  41. nop
  42. nop
  43. nop
  44. nop
  45. .align 32
  46. .globl __flush_tlb_pending
  47. __flush_tlb_pending:
  48. /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */
  49. rdpr %pstate, %g7
  50. sllx %o1, 3, %o1
  51. andn %g7, PSTATE_IE, %g2
  52. wrpr %g2, %pstate
  53. mov SECONDARY_CONTEXT, %o4
  54. ldxa [%o4] ASI_DMMU, %g2
  55. stxa %o0, [%o4] ASI_DMMU
  56. 1: sub %o1, (1 << 3), %o1
  57. ldx [%o2 + %o1], %o3
  58. andcc %o3, 1, %g0
  59. andn %o3, 1, %o3
  60. be,pn %icc, 2f
  61. or %o3, 0x10, %o3
  62. stxa %g0, [%o3] ASI_IMMU_DEMAP
  63. 2: stxa %g0, [%o3] ASI_DMMU_DEMAP
  64. membar #Sync
  65. brnz,pt %o1, 1b
  66. nop
  67. stxa %g2, [%o4] ASI_DMMU
  68. flush %g6
  69. retl
  70. wrpr %g7, 0x0, %pstate
  71. nop
  72. .align 32
  73. .globl __flush_tlb_kernel_range
  74. __flush_tlb_kernel_range: /* %o0=start, %o1=end */
  75. cmp %o0, %o1
  76. be,pn %xcc, 2f
  77. sethi %hi(PAGE_SIZE), %o4
  78. sub %o1, %o0, %o3
  79. sub %o3, %o4, %o3
  80. or %o0, 0x20, %o0 ! Nucleus
  81. 1: stxa %g0, [%o0 + %o3] ASI_DMMU_DEMAP
  82. stxa %g0, [%o0 + %o3] ASI_IMMU_DEMAP
  83. membar #Sync
  84. brnz,pt %o3, 1b
  85. sub %o3, %o4, %o3
  86. 2: retl
  87. flush %g6
  88. __spitfire_flush_tlb_mm_slow:
  89. rdpr %pstate, %g1
  90. wrpr %g1, PSTATE_IE, %pstate
  91. stxa %o0, [%o1] ASI_DMMU
  92. stxa %g0, [%g3] ASI_DMMU_DEMAP
  93. stxa %g0, [%g3] ASI_IMMU_DEMAP
  94. flush %g6
  95. stxa %g2, [%o1] ASI_DMMU
  96. flush %g6
  97. retl
  98. wrpr %g1, 0, %pstate
  99. /*
  100. * The following code flushes one page_size worth.
  101. */
  102. #if (PAGE_SHIFT == 13)
  103. #define ITAG_MASK 0xfe
  104. #elif (PAGE_SHIFT == 16)
  105. #define ITAG_MASK 0x7fe
  106. #else
  107. #error unsupported PAGE_SIZE
  108. #endif
  109. .align 32
  110. .globl __flush_icache_page
  111. __flush_icache_page: /* %o0 = phys_page */
  112. membar #StoreStore
  113. srlx %o0, PAGE_SHIFT, %o0
  114. sethi %uhi(PAGE_OFFSET), %g1
  115. sllx %o0, PAGE_SHIFT, %o0
  116. sethi %hi(PAGE_SIZE), %g2
  117. sllx %g1, 32, %g1
  118. add %o0, %g1, %o0
  119. 1: subcc %g2, 32, %g2
  120. bne,pt %icc, 1b
  121. flush %o0 + %g2
  122. retl
  123. nop
  124. #ifdef DCACHE_ALIASING_POSSIBLE
  125. #if (PAGE_SHIFT != 13)
  126. #error only page shift of 13 is supported by dcache flush
  127. #endif
  128. #define DTAG_MASK 0x3
  129. .align 64
  130. .globl __flush_dcache_page
  131. __flush_dcache_page: /* %o0=kaddr, %o1=flush_icache */
  132. sethi %uhi(PAGE_OFFSET), %g1
  133. sllx %g1, 32, %g1
  134. sub %o0, %g1, %o0
  135. clr %o4
  136. srlx %o0, 11, %o0
  137. sethi %hi(1 << 14), %o2
  138. 1: ldxa [%o4] ASI_DCACHE_TAG, %o3 ! LSU Group
  139. add %o4, (1 << 5), %o4 ! IEU0
  140. ldxa [%o4] ASI_DCACHE_TAG, %g1 ! LSU Group
  141. add %o4, (1 << 5), %o4 ! IEU0
  142. ldxa [%o4] ASI_DCACHE_TAG, %g2 ! LSU Group o3 available
  143. add %o4, (1 << 5), %o4 ! IEU0
  144. andn %o3, DTAG_MASK, %o3 ! IEU1
  145. ldxa [%o4] ASI_DCACHE_TAG, %g3 ! LSU Group
  146. add %o4, (1 << 5), %o4 ! IEU0
  147. andn %g1, DTAG_MASK, %g1 ! IEU1
  148. cmp %o0, %o3 ! IEU1 Group
  149. be,a,pn %xcc, dflush1 ! CTI
  150. sub %o4, (4 << 5), %o4 ! IEU0 (Group)
  151. cmp %o0, %g1 ! IEU1 Group
  152. andn %g2, DTAG_MASK, %g2 ! IEU0
  153. be,a,pn %xcc, dflush2 ! CTI
  154. sub %o4, (3 << 5), %o4 ! IEU0 (Group)
  155. cmp %o0, %g2 ! IEU1 Group
  156. andn %g3, DTAG_MASK, %g3 ! IEU0
  157. be,a,pn %xcc, dflush3 ! CTI
  158. sub %o4, (2 << 5), %o4 ! IEU0 (Group)
  159. cmp %o0, %g3 ! IEU1 Group
  160. be,a,pn %xcc, dflush4 ! CTI
  161. sub %o4, (1 << 5), %o4 ! IEU0
  162. 2: cmp %o4, %o2 ! IEU1 Group
  163. bne,pt %xcc, 1b ! CTI
  164. nop ! IEU0
  165. /* The I-cache does not snoop local stores so we
  166. * better flush that too when necessary.
  167. */
  168. brnz,pt %o1, __flush_icache_page
  169. sllx %o0, 11, %o0
  170. retl
  171. nop
  172. dflush1:stxa %g0, [%o4] ASI_DCACHE_TAG
  173. add %o4, (1 << 5), %o4
  174. dflush2:stxa %g0, [%o4] ASI_DCACHE_TAG
  175. add %o4, (1 << 5), %o4
  176. dflush3:stxa %g0, [%o4] ASI_DCACHE_TAG
  177. add %o4, (1 << 5), %o4
  178. dflush4:stxa %g0, [%o4] ASI_DCACHE_TAG
  179. add %o4, (1 << 5), %o4
  180. membar #Sync
  181. ba,pt %xcc, 2b
  182. nop
  183. #endif /* DCACHE_ALIASING_POSSIBLE */
  184. .align 32
  185. __prefill_dtlb:
  186. rdpr %pstate, %g7
  187. wrpr %g7, PSTATE_IE, %pstate
  188. mov TLB_TAG_ACCESS, %g1
  189. stxa %o5, [%g1] ASI_DMMU
  190. stxa %o2, [%g0] ASI_DTLB_DATA_IN
  191. flush %g6
  192. retl
  193. wrpr %g7, %pstate
  194. __prefill_itlb:
  195. rdpr %pstate, %g7
  196. wrpr %g7, PSTATE_IE, %pstate
  197. mov TLB_TAG_ACCESS, %g1
  198. stxa %o5, [%g1] ASI_IMMU
  199. stxa %o2, [%g0] ASI_ITLB_DATA_IN
  200. flush %g6
  201. retl
  202. wrpr %g7, %pstate
  203. .globl __update_mmu_cache
  204. __update_mmu_cache: /* %o0=hw_context, %o1=address, %o2=pte, %o3=fault_code */
  205. srlx %o1, PAGE_SHIFT, %o1
  206. andcc %o3, FAULT_CODE_DTLB, %g0
  207. sllx %o1, PAGE_SHIFT, %o5
  208. bne,pt %xcc, __prefill_dtlb
  209. or %o5, %o0, %o5
  210. ba,a,pt %xcc, __prefill_itlb
  211. /* Cheetah specific versions, patched at boot time.
  212. *
  213. * This writes of the PRIMARY_CONTEXT register in this file are
  214. * safe even on Cheetah+ and later wrt. the page size fields.
  215. * The nucleus page size fields do not matter because we make
  216. * no data references, and these instructions execute out of a
  217. * locked I-TLB entry sitting in the fully assosciative I-TLB.
  218. * This sequence should also never trap.
  219. */
  220. __cheetah_flush_tlb_mm: /* 15 insns */
  221. rdpr %pstate, %g7
  222. andn %g7, PSTATE_IE, %g2
  223. wrpr %g2, 0x0, %pstate
  224. wrpr %g0, 1, %tl
  225. mov PRIMARY_CONTEXT, %o2
  226. mov 0x40, %g3
  227. ldxa [%o2] ASI_DMMU, %g2
  228. stxa %o0, [%o2] ASI_DMMU
  229. stxa %g0, [%g3] ASI_DMMU_DEMAP
  230. stxa %g0, [%g3] ASI_IMMU_DEMAP
  231. stxa %g2, [%o2] ASI_DMMU
  232. flush %g6
  233. wrpr %g0, 0, %tl
  234. retl
  235. wrpr %g7, 0x0, %pstate
  236. __cheetah_flush_tlb_pending: /* 23 insns */
  237. /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */
  238. rdpr %pstate, %g7
  239. sllx %o1, 3, %o1
  240. andn %g7, PSTATE_IE, %g2
  241. wrpr %g2, 0x0, %pstate
  242. wrpr %g0, 1, %tl
  243. mov PRIMARY_CONTEXT, %o4
  244. ldxa [%o4] ASI_DMMU, %g2
  245. stxa %o0, [%o4] ASI_DMMU
  246. 1: sub %o1, (1 << 3), %o1
  247. ldx [%o2 + %o1], %o3
  248. andcc %o3, 1, %g0
  249. be,pn %icc, 2f
  250. andn %o3, 1, %o3
  251. stxa %g0, [%o3] ASI_IMMU_DEMAP
  252. 2: stxa %g0, [%o3] ASI_DMMU_DEMAP
  253. membar #Sync
  254. brnz,pt %o1, 1b
  255. nop
  256. stxa %g2, [%o4] ASI_DMMU
  257. flush %g6
  258. wrpr %g0, 0, %tl
  259. retl
  260. wrpr %g7, 0x0, %pstate
  261. #ifdef DCACHE_ALIASING_POSSIBLE
  262. flush_dcpage_cheetah: /* 11 insns */
  263. sethi %uhi(PAGE_OFFSET), %g1
  264. sllx %g1, 32, %g1
  265. sub %o0, %g1, %o0
  266. sethi %hi(PAGE_SIZE), %o4
  267. 1: subcc %o4, (1 << 5), %o4
  268. stxa %g0, [%o0 + %o4] ASI_DCACHE_INVALIDATE
  269. membar #Sync
  270. bne,pt %icc, 1b
  271. nop
  272. retl /* I-cache flush never needed on Cheetah, see callers. */
  273. nop
  274. #endif /* DCACHE_ALIASING_POSSIBLE */
  275. cheetah_patch_one:
  276. 1: lduw [%o1], %g1
  277. stw %g1, [%o0]
  278. flush %o0
  279. subcc %o2, 1, %o2
  280. add %o1, 4, %o1
  281. bne,pt %icc, 1b
  282. add %o0, 4, %o0
  283. retl
  284. nop
  285. .globl cheetah_patch_cachetlbops
  286. cheetah_patch_cachetlbops:
  287. save %sp, -128, %sp
  288. sethi %hi(__flush_tlb_mm), %o0
  289. or %o0, %lo(__flush_tlb_mm), %o0
  290. sethi %hi(__cheetah_flush_tlb_mm), %o1
  291. or %o1, %lo(__cheetah_flush_tlb_mm), %o1
  292. call cheetah_patch_one
  293. mov 15, %o2
  294. sethi %hi(__flush_tlb_pending), %o0
  295. or %o0, %lo(__flush_tlb_pending), %o0
  296. sethi %hi(__cheetah_flush_tlb_pending), %o1
  297. or %o1, %lo(__cheetah_flush_tlb_pending), %o1
  298. call cheetah_patch_one
  299. mov 23, %o2
  300. #ifdef DCACHE_ALIASING_POSSIBLE
  301. sethi %hi(__flush_dcache_page), %o0
  302. or %o0, %lo(__flush_dcache_page), %o0
  303. sethi %hi(flush_dcpage_cheetah), %o1
  304. or %o1, %lo(flush_dcpage_cheetah), %o1
  305. call cheetah_patch_one
  306. mov 11, %o2
  307. #endif /* DCACHE_ALIASING_POSSIBLE */
  308. ret
  309. restore
  310. #ifdef CONFIG_SMP
  311. /* These are all called by the slaves of a cross call, at
  312. * trap level 1, with interrupts fully disabled.
  313. *
  314. * Register usage:
  315. * %g5 mm->context (all tlb flushes)
  316. * %g1 address arg 1 (tlb page and range flushes)
  317. * %g7 address arg 2 (tlb range flush only)
  318. *
  319. * %g6 ivector table, don't touch
  320. * %g2 scratch 1
  321. * %g3 scratch 2
  322. * %g4 scratch 3
  323. *
  324. * TODO: Make xcall TLB range flushes use the tricks above... -DaveM
  325. */
  326. .align 32
  327. .globl xcall_flush_tlb_mm
  328. xcall_flush_tlb_mm:
  329. mov PRIMARY_CONTEXT, %g2
  330. mov 0x40, %g4
  331. ldxa [%g2] ASI_DMMU, %g3
  332. stxa %g5, [%g2] ASI_DMMU
  333. stxa %g0, [%g4] ASI_DMMU_DEMAP
  334. stxa %g0, [%g4] ASI_IMMU_DEMAP
  335. stxa %g3, [%g2] ASI_DMMU
  336. retry
  337. .globl xcall_flush_tlb_pending
  338. xcall_flush_tlb_pending:
  339. /* %g5=context, %g1=nr, %g7=vaddrs[] */
  340. sllx %g1, 3, %g1
  341. mov PRIMARY_CONTEXT, %g4
  342. ldxa [%g4] ASI_DMMU, %g2
  343. stxa %g5, [%g4] ASI_DMMU
  344. 1: sub %g1, (1 << 3), %g1
  345. ldx [%g7 + %g1], %g5
  346. andcc %g5, 0x1, %g0
  347. be,pn %icc, 2f
  348. andn %g5, 0x1, %g5
  349. stxa %g0, [%g5] ASI_IMMU_DEMAP
  350. 2: stxa %g0, [%g5] ASI_DMMU_DEMAP
  351. membar #Sync
  352. brnz,pt %g1, 1b
  353. nop
  354. stxa %g2, [%g4] ASI_DMMU
  355. retry
  356. .globl xcall_flush_tlb_kernel_range
  357. xcall_flush_tlb_kernel_range:
  358. sethi %hi(PAGE_SIZE - 1), %g2
  359. or %g2, %lo(PAGE_SIZE - 1), %g2
  360. andn %g1, %g2, %g1
  361. andn %g7, %g2, %g7
  362. sub %g7, %g1, %g3
  363. add %g2, 1, %g2
  364. sub %g3, %g2, %g3
  365. or %g1, 0x20, %g1 ! Nucleus
  366. 1: stxa %g0, [%g1 + %g3] ASI_DMMU_DEMAP
  367. stxa %g0, [%g1 + %g3] ASI_IMMU_DEMAP
  368. membar #Sync
  369. brnz,pt %g3, 1b
  370. sub %g3, %g2, %g3
  371. retry
  372. nop
  373. nop
  374. /* This runs in a very controlled environment, so we do
  375. * not need to worry about BH races etc.
  376. */
  377. .globl xcall_sync_tick
  378. xcall_sync_tick:
  379. rdpr %pstate, %g2
  380. wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
  381. rdpr %pil, %g2
  382. wrpr %g0, 15, %pil
  383. sethi %hi(109f), %g7
  384. b,pt %xcc, etrap_irq
  385. 109: or %g7, %lo(109b), %g7
  386. call smp_synchronize_tick_client
  387. nop
  388. clr %l6
  389. b rtrap_xcall
  390. ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
  391. /* NOTE: This is SPECIAL!! We do etrap/rtrap however
  392. * we choose to deal with the "BH's run with
  393. * %pil==15" problem (described in asm/pil.h)
  394. * by just invoking rtrap directly past where
  395. * BH's are checked for.
  396. *
  397. * We do it like this because we do not want %pil==15
  398. * lockups to prevent regs being reported.
  399. */
  400. .globl xcall_report_regs
  401. xcall_report_regs:
  402. rdpr %pstate, %g2
  403. wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
  404. rdpr %pil, %g2
  405. wrpr %g0, 15, %pil
  406. sethi %hi(109f), %g7
  407. b,pt %xcc, etrap_irq
  408. 109: or %g7, %lo(109b), %g7
  409. call __show_regs
  410. add %sp, PTREGS_OFF, %o0
  411. clr %l6
  412. /* Has to be a non-v9 branch due to the large distance. */
  413. b rtrap_xcall
  414. ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
  415. #ifdef DCACHE_ALIASING_POSSIBLE
  416. .align 32
  417. .globl xcall_flush_dcache_page_cheetah
  418. xcall_flush_dcache_page_cheetah: /* %g1 == physical page address */
  419. sethi %hi(PAGE_SIZE), %g3
  420. 1: subcc %g3, (1 << 5), %g3
  421. stxa %g0, [%g1 + %g3] ASI_DCACHE_INVALIDATE
  422. membar #Sync
  423. bne,pt %icc, 1b
  424. nop
  425. retry
  426. nop
  427. #endif /* DCACHE_ALIASING_POSSIBLE */
  428. .globl xcall_flush_dcache_page_spitfire
  429. xcall_flush_dcache_page_spitfire: /* %g1 == physical page address
  430. %g7 == kernel page virtual address
  431. %g5 == (page->mapping != NULL) */
  432. #ifdef DCACHE_ALIASING_POSSIBLE
  433. srlx %g1, (13 - 2), %g1 ! Form tag comparitor
  434. sethi %hi(L1DCACHE_SIZE), %g3 ! D$ size == 16K
  435. sub %g3, (1 << 5), %g3 ! D$ linesize == 32
  436. 1: ldxa [%g3] ASI_DCACHE_TAG, %g2
  437. andcc %g2, 0x3, %g0
  438. be,pn %xcc, 2f
  439. andn %g2, 0x3, %g2
  440. cmp %g2, %g1
  441. bne,pt %xcc, 2f
  442. nop
  443. stxa %g0, [%g3] ASI_DCACHE_TAG
  444. membar #Sync
  445. 2: cmp %g3, 0
  446. bne,pt %xcc, 1b
  447. sub %g3, (1 << 5), %g3
  448. brz,pn %g5, 2f
  449. #endif /* DCACHE_ALIASING_POSSIBLE */
  450. sethi %hi(PAGE_SIZE), %g3
  451. 1: flush %g7
  452. subcc %g3, (1 << 5), %g3
  453. bne,pt %icc, 1b
  454. add %g7, (1 << 5), %g7
  455. 2: retry
  456. nop
  457. nop
  458. .globl xcall_promstop
  459. xcall_promstop:
  460. rdpr %pstate, %g2
  461. wrpr %g2, PSTATE_IG | PSTATE_AG, %pstate
  462. rdpr %pil, %g2
  463. wrpr %g0, 15, %pil
  464. sethi %hi(109f), %g7
  465. b,pt %xcc, etrap_irq
  466. 109: or %g7, %lo(109b), %g7
  467. flushw
  468. call prom_stopself
  469. nop
  470. /* We should not return, just spin if we do... */
  471. 1: b,a,pt %xcc, 1b
  472. nop
  473. .data
  474. errata32_hwbug:
  475. .xword 0
  476. .text
  477. /* These two are not performance critical... */
  478. .globl xcall_flush_tlb_all_spitfire
  479. xcall_flush_tlb_all_spitfire:
  480. /* Spitfire Errata #32 workaround. */
  481. sethi %hi(errata32_hwbug), %g4
  482. stx %g0, [%g4 + %lo(errata32_hwbug)]
  483. clr %g2
  484. clr %g3
  485. 1: ldxa [%g3] ASI_DTLB_DATA_ACCESS, %g4
  486. and %g4, _PAGE_L, %g5
  487. brnz,pn %g5, 2f
  488. mov TLB_TAG_ACCESS, %g7
  489. stxa %g0, [%g7] ASI_DMMU
  490. membar #Sync
  491. stxa %g0, [%g3] ASI_DTLB_DATA_ACCESS
  492. membar #Sync
  493. /* Spitfire Errata #32 workaround. */
  494. sethi %hi(errata32_hwbug), %g4
  495. stx %g0, [%g4 + %lo(errata32_hwbug)]
  496. 2: ldxa [%g3] ASI_ITLB_DATA_ACCESS, %g4
  497. and %g4, _PAGE_L, %g5
  498. brnz,pn %g5, 2f
  499. mov TLB_TAG_ACCESS, %g7
  500. stxa %g0, [%g7] ASI_IMMU
  501. membar #Sync
  502. stxa %g0, [%g3] ASI_ITLB_DATA_ACCESS
  503. membar #Sync
  504. /* Spitfire Errata #32 workaround. */
  505. sethi %hi(errata32_hwbug), %g4
  506. stx %g0, [%g4 + %lo(errata32_hwbug)]
  507. 2: add %g2, 1, %g2
  508. cmp %g2, SPITFIRE_HIGHEST_LOCKED_TLBENT
  509. ble,pt %icc, 1b
  510. sll %g2, 3, %g3
  511. flush %g6
  512. retry
  513. .globl xcall_flush_tlb_all_cheetah
  514. xcall_flush_tlb_all_cheetah:
  515. mov 0x80, %g2
  516. stxa %g0, [%g2] ASI_DMMU_DEMAP
  517. stxa %g0, [%g2] ASI_IMMU_DEMAP
  518. retry
  519. /* These just get rescheduled to PIL vectors. */
  520. .globl xcall_call_function
  521. xcall_call_function:
  522. wr %g0, (1 << PIL_SMP_CALL_FUNC), %set_softint
  523. retry
  524. .globl xcall_receive_signal
  525. xcall_receive_signal:
  526. wr %g0, (1 << PIL_SMP_RECEIVE_SIGNAL), %set_softint
  527. retry
  528. .globl xcall_capture
  529. xcall_capture:
  530. wr %g0, (1 << PIL_SMP_CAPTURE), %set_softint
  531. retry
  532. #endif /* CONFIG_SMP */