1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* These get patched into the trap tab 3 * once we know we have a cheetah proc 4 */ 5 .globl cheetah_fecc_trap_vect 6 .type cheetah_fecc_trap_vect 7 cheetah_fecc_trap_vector: 8 membar #Sync 9 ldxa [%g0] ASI_DCU_CONTROL_ 10 andn %g1, DCU_DC | DCU_IC, 11 stxa %g1, [%g0] ASI_DCU_CON 12 membar #Sync 13 sethi %hi(cheetah_fast_ecc), 14 jmpl %g2 + %lo(cheetah_fast 15 mov 0, %g1 16 .size cheetah_fecc_trap_vect 17 18 .globl cheetah_fecc_trap_vect 19 .type cheetah_fecc_trap_vect 20 cheetah_fecc_trap_vector_tl1: 21 membar #Sync 22 ldxa [%g0] ASI_DCU_CONTROL_ 23 andn %g1, DCU_DC | DCU_IC, 24 stxa %g1, [%g0] ASI_DCU_CON 25 membar #Sync 26 sethi %hi(cheetah_fast_ecc), 27 jmpl %g2 + %lo(cheetah_fast 28 mov 1, %g1 29 .size cheetah_fecc_trap_vect 30 31 .globl cheetah_cee_trap_vector 32 .type cheetah_cee_trap_vector,#funct 33 cheetah_cee_trap_vector: 34 membar #Sync 35 ldxa [%g0] ASI_DCU_CONTROL_ 36 andn %g1, DCU_IC, %g1 37 stxa %g1, [%g0] ASI_DCU_CON 38 membar #Sync 39 sethi %hi(cheetah_cee), %g2 40 jmpl %g2 + %lo(cheetah_cee) 41 mov 0, %g1 42 .size cheetah_cee_trap_vecto 43 44 .globl cheetah_cee_trap_vecto 45 .type cheetah_cee_trap_vecto 46 cheetah_cee_trap_vector_tl1: 47 membar #Sync 48 ldxa [%g0] ASI_DCU_CONTROL_ 49 andn %g1, DCU_IC, %g1 50 stxa %g1, [%g0] ASI_DCU_CON 51 membar #Sync 52 sethi %hi(cheetah_cee), %g2 53 jmpl %g2 + %lo(cheetah_cee) 54 mov 1, %g1 55 .size cheetah_cee_trap_vecto 56 57 .globl cheetah_deferred_trap_vector 58 .type cheetah_deferred_trap_vector,# 59 cheetah_deferred_trap_vector: 60 membar #Sync 61 ldxa [%g0] ASI_DCU_CONTROL_ 62 andn %g1, DCU_DC | DCU_IC, 63 stxa %g1, [%g0] ASI_DCU_CON 64 membar #Sync; 65 sethi %hi(cheetah_deferred_t 66 jmpl %g2 + %lo(cheetah_defe 67 mov 0, %g1 68 .size cheetah_deferred_trap_ 69 70 .globl cheetah_deferred_trap_ 71 .type cheetah_deferred_trap_ 72 cheetah_deferred_trap_vector_tl1: 73 membar #Sync; 74 ldxa [%g0] ASI_DCU_CONTROL_ 75 andn %g1, DCU_DC | DCU_IC, 76 stxa %g1, [%g0] ASI_DCU_CON 77 membar #Sync; 78 sethi %hi(cheetah_deferred_t 79 jmpl %g2 + %lo(cheetah_defe 80 mov 1, %g1 81 .size cheetah_deferred_trap_ 82 83 /* Cheetah+ specific traps. These are 84 * error traps. The first argument to 85 * is encoded as follows: 86 * 87 * Bit0: 0=dcache,1=icache 88 * Bit1: 0=recoverable,1=unreco 89 */ 90 .globl cheetah_plus_dcpe_trap 91 .type cheetah_plus_dcpe_trap 92 cheetah_plus_dcpe_trap_vector: 93 membar #Sync 94 sethi %hi(do_cheetah_plus_da 95 jmpl %g7 + %lo(do_cheetah_p 96 nop 97 nop 98 nop 99 nop 100 nop 101 .size cheetah_plus_dcpe_trap 102 103 .type do_cheetah_plus_data_p 104 do_cheetah_plus_data_parity: 105 rdpr %pil, %g2 106 wrpr %g0, PIL_NORMAL_MAX, % 107 ba,pt %xcc, etrap_irq 108 rd %pc, %g7 109 #ifdef CONFIG_TRACE_IRQFLAGS 110 call trace_hardirqs_off 111 nop 112 #endif 113 mov 0x0, %o0 114 call cheetah_plus_parity_er 115 add %sp, PTREGS_OFF, %o1 116 ba,a,pt %xcc, rtrap_irq 117 .size do_cheetah_plus_data_p 118 119 .globl cheetah_plus_dcpe_trap 120 .type cheetah_plus_dcpe_trap 121 cheetah_plus_dcpe_trap_vector_tl1: 122 membar #Sync 123 wrpr PSTATE_IG | PSTATE_PEF 124 sethi %hi(do_dcpe_tl1), %g3 125 jmpl %g3 + %lo(do_dcpe_tl1) 126 nop 127 nop 128 nop 129 nop 130 .size cheetah_plus_dcpe_trap 131 132 .globl cheetah_plus_icpe_trap 133 .type cheetah_plus_icpe_trap 134 cheetah_plus_icpe_trap_vector: 135 membar #Sync 136 sethi %hi(do_cheetah_plus_in 137 jmpl %g7 + %lo(do_cheetah_p 138 nop 139 nop 140 nop 141 nop 142 nop 143 .size cheetah_plus_icpe_trap 144 145 .type do_cheetah_plus_insn_p 146 do_cheetah_plus_insn_parity: 147 rdpr %pil, %g2 148 wrpr %g0, PIL_NORMAL_MAX, % 149 ba,pt %xcc, etrap_irq 150 rd %pc, %g7 151 #ifdef CONFIG_TRACE_IRQFLAGS 152 call trace_hardirqs_off 153 nop 154 #endif 155 mov 0x1, %o0 156 call cheetah_plus_parity_er 157 add %sp, PTREGS_OFF, %o1 158 ba,a,pt %xcc, rtrap_irq 159 .size do_cheetah_plus_insn_p 160 161 .globl cheetah_plus_icpe_trap 162 .type cheetah_plus_icpe_trap 163 cheetah_plus_icpe_trap_vector_tl1: 164 membar #Sync 165 wrpr PSTATE_IG | PSTATE_PEF 166 sethi %hi(do_icpe_tl1), %g3 167 jmpl %g3 + %lo(do_icpe_tl1) 168 nop 169 nop 170 nop 171 nop 172 .size cheetah_plus_icpe_trap 173 174 /* If we take one of these traps when 175 * jump to interrupt globals. If some 176 * was also using interrupt globals, w 177 * We may use all interrupt global reg 178 */ 179 .globl do_dcpe_tl1 180 .type do_dcpe_tl1,#function 181 do_dcpe_tl1: 182 rdpr %tl, %g1 183 mov 1, %g2 184 sethi %hi(TSTATE_IG), %g3 185 1: wrpr %g2, %tl 186 rdpr %tstate, %g4 187 andcc %g4, %g3, %g0 188 bne,a,pn %xcc, do_dcpe_tl1_fata 189 wrpr %g1, %tl 190 add %g2, 1, %g2 191 cmp %g2, %g1 192 ble,pt %icc, 1b 193 nop 194 wrpr %g1, %tl 195 do_dcpe_tl1_nonfatal: /* Ok we may use inter 196 sethi %hi(dcache_parity_tl1_ 197 lduw [%g2 + %lo(dcache_pari 198 add %g1, 1, %g1 199 stw %g1, [%g2 + %lo(dcache 200 /* Reset D-cache parity */ 201 sethi %hi(1 << 16), %g1 202 mov (1 << 5), %g2 203 sub %g1, %g2, %g1 204 1: srl %g1, 14, %g3 205 membar #Sync 206 stxa %g3, [%g1] ASI_DCACHE_ 207 membar #Sync 208 sub %g2, 8, %g3 209 2: membar #Sync 210 stxa %g0, [%g1 + %g3] ASI_D 211 membar #Sync 212 subcc %g3, 8, %g3 213 bge,pt %icc, 2b 214 nop 215 subcc %g1, %g2, %g1 216 bge,pt %icc, 1b 217 nop 218 ba,a,pt %xcc, dcpe_icpe_tl1_co 219 220 do_dcpe_tl1_fatal: 221 sethi %hi(1f), %g7 222 ba,pt %xcc, etraptl1 223 1: or %g7, %lo(1b), %g7 224 mov 0x2, %o0 225 call cheetah_plus_parity_er 226 add %sp, PTREGS_OFF, %o1 227 ba,a,pt %xcc, rtrap 228 .size do_dcpe_tl1,.-do_dcpe_ 229 230 .globl do_icpe_tl1 231 .type do_icpe_tl1,#function 232 do_icpe_tl1: 233 rdpr %tl, %g1 234 mov 1, %g2 235 sethi %hi(TSTATE_IG), %g3 236 1: wrpr %g2, %tl 237 rdpr %tstate, %g4 238 andcc %g4, %g3, %g0 239 bne,a,pn %xcc, do_icpe_tl1_fata 240 wrpr %g1, %tl 241 add %g2, 1, %g2 242 cmp %g2, %g1 243 ble,pt %icc, 1b 244 nop 245 wrpr %g1, %tl 246 do_icpe_tl1_nonfatal: /* Ok we may use inter 247 sethi %hi(icache_parity_tl1_ 248 lduw [%g2 + %lo(icache_pari 249 add %g1, 1, %g1 250 stw %g1, [%g2 + %lo(icache 251 /* Flush I-cache */ 252 sethi %hi(1 << 15), %g1 253 mov (1 << 5), %g2 254 sub %g1, %g2, %g1 255 1: or %g1, (2 << 3), %g3 256 stxa %g0, [%g3] ASI_IC_TAG 257 membar #Sync 258 subcc %g1, %g2, %g1 259 bge,pt %icc, 1b 260 nop 261 ba,a,pt %xcc, dcpe_icpe_tl1_co 262 263 do_icpe_tl1_fatal: 264 sethi %hi(1f), %g7 265 ba,pt %xcc, etraptl1 266 1: or %g7, %lo(1b), %g7 267 mov 0x3, %o0 268 call cheetah_plus_parity_er 269 add %sp, PTREGS_OFF, %o1 270 ba,a,pt %xcc, rtrap 271 .size do_icpe_tl1,.-do_icpe_ 272 273 .type dcpe_icpe_tl1_common,# 274 dcpe_icpe_tl1_common: 275 /* Flush D-cache, re-enable D/I caches 276 * retry the trapping instruction. 277 */ 278 sethi %hi(1 << 16), %g1 279 mov (1 << 5), %g2 280 sub %g1, %g2, %g1 281 1: stxa %g0, [%g1] ASI_DCACHE_ 282 membar #Sync 283 subcc %g1, %g2, %g1 284 bge,pt %icc, 1b 285 nop 286 ldxa [%g0] ASI_DCU_CONTROL_ 287 or %g1, (DCU_DC | DCU_IC) 288 stxa %g1, [%g0] ASI_DCU_CON 289 membar #Sync 290 retry 291 .size dcpe_icpe_tl1_common,. 292 293 /* Capture I/D/E-cache state into per- 294 * 295 * %g1: (TL>=0) ? 1 : 0 296 * %g2: scratch 297 * %g3: scratch 298 * %g4: AFSR 299 * %g5: AFAR 300 * %g6: unused, will have curr 301 * %g7: scratch 302 */ 303 .type __cheetah_log_error,#f 304 __cheetah_log_error: 305 /* Put "TL1" software bit into AFSR. * 306 and %g1, 0x1, %g1 307 sllx %g1, 63, %g2 308 or %g4, %g2, %g4 309 310 /* Get log entry pointer for this cpu 311 BRANCH_IF_JALAPENO(g2,g3,50f) 312 ldxa [%g0] ASI_SAFARI_CONFI 313 srlx %g2, 17, %g2 314 ba,pt %xcc, 60f 315 and %g2, 0x3ff, %g2 316 317 50: ldxa [%g0] ASI_JBUS_CONFIG, 318 srlx %g2, 17, %g2 319 and %g2, 0x1f, %g2 320 321 60: sllx %g2, 9, %g2 322 sethi %hi(cheetah_error_log) 323 ldx [%g3 + %lo(cheetah_err 324 brz,pn %g3, 80f 325 nop 326 327 add %g3, %g2, %g3 328 sllx %g1, 8, %g1 329 add %g3, %g1, %g1 330 331 /* %g1 holds pointer to the top of the 332 ldx [%g1 + 0x0], %g7 333 cmp %g7, -1 334 bne,pn %xcc, 80f 335 nop 336 337 stx %g4, [%g1 + 0x0] 338 stx %g5, [%g1 + 0x8] 339 add %g1, 0x10, %g1 340 341 /* %g1 now points to D-cache logging a 342 set 0x3ff8, %g2 /* DC_ 343 and %g5, %g2, %g2 /* DC_ 344 srlx %g5, 12, %g3 345 or %g3, 1, %g3 /* PHY 346 347 10: ldxa [%g2] ASI_DCACHE_TAG, 348 cmp %g3, %g7 /* TAG 349 bne,pt %xcc, 13f 350 nop 351 352 /* Yep, what we want, capture state. * 353 stx %g2, [%g1 + 0x20] 354 stx %g7, [%g1 + 0x28] 355 356 /* A membar Sync is required before an 357 membar #Sync 358 ldxa [%g2] ASI_DCACHE_UTAG, 359 membar #Sync 360 stx %g7, [%g1 + 0x30] 361 ldxa [%g2] ASI_DCACHE_SNOOP 362 stx %g7, [%g1 + 0x38] 363 clr %g3 364 365 12: ldxa [%g2 + %g3] ASI_DCACHE 366 stx %g7, [%g1] 367 add %g3, (1 << 5), %g3 368 cmp %g3, (4 << 5) 369 bl,pt %xcc, 12b 370 add %g1, 0x8, %g1 371 372 ba,pt %xcc, 20f 373 add %g1, 0x20, %g1 374 375 13: sethi %hi(1 << 14), %g7 376 add %g2, %g7, %g2 377 srlx %g2, 14, %g7 378 cmp %g7, 4 379 bl,pt %xcc, 10b 380 nop 381 382 add %g1, 0x40, %g1 383 384 /* %g1 now points to I-cache logging a 385 20: set 0x1fe0, %g2 /* IC_ 386 and %g5, %g2, %g2 /* IC_ 387 sllx %g2, 1, %g2 /* IC_ 388 srlx %g5, (13 - 8), %g3 /* 389 andn %g3, 0xff, %g3 /* Mas 390 391 21: ldxa [%g2] ASI_IC_TAG, %g7 392 andn %g7, 0xff, %g7 393 cmp %g3, %g7 394 bne,pt %xcc, 23f 395 nop 396 397 /* Yep, what we want, capture state. * 398 stx %g2, [%g1 + 0x40] 399 stx %g7, [%g1 + 0x48] 400 add %g2, (1 << 3), %g2 401 ldxa [%g2] ASI_IC_TAG, %g7 402 add %g2, (1 << 3), %g2 403 stx %g7, [%g1 + 0x50] 404 ldxa [%g2] ASI_IC_TAG, %g7 405 add %g2, (1 << 3), %g2 406 stx %g7, [%g1 + 0x60] 407 ldxa [%g2] ASI_IC_TAG, %g7 408 stx %g7, [%g1 + 0x68] 409 sub %g2, (3 << 3), %g2 410 ldxa [%g2] ASI_IC_STAG, %g7 411 stx %g7, [%g1 + 0x58] 412 clr %g3 413 srlx %g2, 2, %g2 414 415 22: ldxa [%g2 + %g3] ASI_IC_INS 416 stx %g7, [%g1] 417 add %g3, (1 << 3), %g3 418 cmp %g3, (8 << 3) 419 bl,pt %xcc, 22b 420 add %g1, 0x8, %g1 421 422 ba,pt %xcc, 30f 423 add %g1, 0x30, %g1 424 425 23: sethi %hi(1 << 14), %g7 426 add %g2, %g7, %g2 427 srlx %g2, 14, %g7 428 cmp %g7, 4 429 bl,pt %xcc, 21b 430 nop 431 432 add %g1, 0x70, %g1 433 434 /* %g1 now points to E-cache logging a 435 30: andn %g5, (32 - 1), %g2 436 stx %g2, [%g1 + 0x20] 437 ldxa [%g2] ASI_EC_TAG_DATA, 438 stx %g7, [%g1 + 0x28] 439 ldxa [%g2] ASI_EC_R, %g0 440 clr %g3 441 442 31: ldxa [%g3] ASI_EC_DATA, %g7 443 stx %g7, [%g1 + %g3] 444 add %g3, 0x8, %g3 445 cmp %g3, 0x20 446 447 bl,pt %xcc, 31b 448 nop 449 80: 450 rdpr %tt, %g2 451 cmp %g2, 0x70 452 be c_fast_ecc 453 cmp %g2, 0x63 454 be c_cee 455 nop 456 ba,a,pt %xcc, c_deferred 457 .size __cheetah_log_error,.- 458 459 /* Cheetah FECC trap handling, we get 460 * in the trap table. That code has d 461 * and has disabled both the I-cache a 462 * control register. The I-cache is d 463 * capture the corrupted cache line, a 464 * because corrupt data may have been 465 * want to reference it. 466 * 467 * %g1 is one if this trap occurred at 468 * 469 * Next, we turn off error reporting s 470 */ 471 .globl cheetah_fast_ecc 472 .type cheetah_fast_ecc,#func 473 cheetah_fast_ecc: 474 ldxa [%g0] ASI_ESTATE_ERROR 475 andn %g2, ESTATE_ERROR_NCEE 476 stxa %g2, [%g0] ASI_ESTATE_ 477 membar #Sync 478 479 /* Fetch and clear AFSR/AFAR */ 480 ldxa [%g0] ASI_AFSR, %g4 481 ldxa [%g0] ASI_AFAR, %g5 482 stxa %g4, [%g0] ASI_AFSR 483 membar #Sync 484 485 ba,pt %xcc, __cheetah_log_er 486 nop 487 .size cheetah_fast_ecc,.-che 488 489 .type c_fast_ecc,#function 490 c_fast_ecc: 491 rdpr %pil, %g2 492 wrpr %g0, PIL_NORMAL_MAX, % 493 ba,pt %xcc, etrap_irq 494 rd %pc, %g7 495 #ifdef CONFIG_TRACE_IRQFLAGS 496 call trace_hardirqs_off 497 nop 498 #endif 499 mov %l4, %o1 500 mov %l5, %o2 501 call cheetah_fecc_handler 502 add %sp, PTREGS_OFF, %o0 503 ba,a,pt %xcc, rtrap_irq 504 .size c_fast_ecc,.-c_fast_ec 505 506 /* Our caller has disabled I-cache and 507 .globl cheetah_cee 508 .type cheetah_cee,#function 509 cheetah_cee: 510 ldxa [%g0] ASI_ESTATE_ERROR 511 andn %g2, ESTATE_ERROR_CEEN 512 stxa %g2, [%g0] ASI_ESTATE_ 513 membar #Sync 514 515 /* Fetch and clear AFSR/AFAR */ 516 ldxa [%g0] ASI_AFSR, %g4 517 ldxa [%g0] ASI_AFAR, %g5 518 stxa %g4, [%g0] ASI_AFSR 519 membar #Sync 520 521 ba,pt %xcc, __cheetah_log_er 522 nop 523 .size cheetah_cee,.-cheetah_ 524 525 .type c_cee,#function 526 c_cee: 527 rdpr %pil, %g2 528 wrpr %g0, PIL_NORMAL_MAX, % 529 ba,pt %xcc, etrap_irq 530 rd %pc, %g7 531 #ifdef CONFIG_TRACE_IRQFLAGS 532 call trace_hardirqs_off 533 nop 534 #endif 535 mov %l4, %o1 536 mov %l5, %o2 537 call cheetah_cee_handler 538 add %sp, PTREGS_OFF, %o0 539 ba,a,pt %xcc, rtrap_irq 540 .size c_cee,.-c_cee 541 542 /* Our caller has disabled I-cache+D-c 543 .globl cheetah_deferred_trap 544 .type cheetah_deferred_trap, 545 cheetah_deferred_trap: 546 ldxa [%g0] ASI_ESTATE_ERROR 547 andn %g2, ESTATE_ERROR_NCEE 548 stxa %g2, [%g0] ASI_ESTATE_ 549 membar #Sync 550 551 /* Fetch and clear AFSR/AFAR */ 552 ldxa [%g0] ASI_AFSR, %g4 553 ldxa [%g0] ASI_AFAR, %g5 554 stxa %g4, [%g0] ASI_AFSR 555 membar #Sync 556 557 ba,pt %xcc, __cheetah_log_er 558 nop 559 .size cheetah_deferred_trap, 560 561 .type c_deferred,#function 562 c_deferred: 563 rdpr %pil, %g2 564 wrpr %g0, PIL_NORMAL_MAX, % 565 ba,pt %xcc, etrap_irq 566 rd %pc, %g7 567 #ifdef CONFIG_TRACE_IRQFLAGS 568 call trace_hardirqs_off 569 nop 570 #endif 571 mov %l4, %o1 572 mov %l5, %o2 573 call cheetah_deferred_handl 574 add %sp, PTREGS_OFF, %o0 575 ba,a,pt %xcc, rtrap_irq 576 .size c_deferred,.-c_deferre
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.