1 /* $Id: entry.S,v 1.144 2002/02/09 19:49:30 davem Exp $
2 * arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points.
4 * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
10 #include <linux/errno.h>
15 #include <asm/ptrace.h>
17 #include <asm/signal.h>
18 #include <asm/pgtable.h>
19 #include <asm/processor.h>
20 #include <asm/visasm.h>
21 #include <asm/estate.h>
22 #include <asm/auxio.h>
23 #include <asm/sfafsr.h>
25 #include <asm/unistd.h>
32 /* This is trivial with the new code... */
35 sethi %hi(TSTATE_PEF), %g4
41 andcc %g5, FPRS_FEF, %g0
45 /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */
48 109: or %g7, %lo(109b), %g7
50 ba,a,pt %xcc, rtrap_clr_l6
52 1: TRAP_LOAD_THREAD_REG(%g6, %g1)
53 ldub [%g6 + TI_FPSAVED], %g5
54 wr %g0, FPRS_FEF, %fprs
55 andcc %g5, FPRS_FEF, %g0
58 ldx [%g6 + TI_GSR], %g7
59 1: andcc %g5, FPRS_DL, %g0
62 andcc %g5, FPRS_DU, %g0
93 b,pt %xcc, fpdis_exit2
95 1: mov SECONDARY_CONTEXT, %g3
96 add %g6, TI_FPREGS + 0x80, %g1
100 661: ldxa [%g3] ASI_DMMU, %g5
101 .section .sun4v_1insn_patch, "ax"
103 ldxa [%g3] ASI_MMU, %g5
106 sethi %hi(sparc64_kern_sec_context), %g2
107 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
109 661: stxa %g2, [%g3] ASI_DMMU
110 .section .sun4v_1insn_patch, "ax"
112 stxa %g2, [%g3] ASI_MMU
116 add %g6, TI_FPREGS + 0xc0, %g2
120 ldda [%g1] ASI_BLK_S, %f32
121 ldda [%g2] ASI_BLK_S, %f48
133 b,pt %xcc, fpdis_exit
135 2: andcc %g5, FPRS_DU, %g0
138 mov SECONDARY_CONTEXT, %g3
141 661: ldxa [%g3] ASI_DMMU, %g5
142 .section .sun4v_1insn_patch, "ax"
144 ldxa [%g3] ASI_MMU, %g5
147 add %g6, TI_FPREGS, %g1
148 sethi %hi(sparc64_kern_sec_context), %g2
149 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
151 661: stxa %g2, [%g3] ASI_DMMU
152 .section .sun4v_1insn_patch, "ax"
154 stxa %g2, [%g3] ASI_MMU
158 add %g6, TI_FPREGS + 0x40, %g2
159 faddd %f32, %f34, %f36
160 fmuld %f32, %f34, %f38
162 ldda [%g1] ASI_BLK_S, %f0
163 ldda [%g2] ASI_BLK_S, %f16
165 faddd %f32, %f34, %f40
166 fmuld %f32, %f34, %f42
167 faddd %f32, %f34, %f44
168 fmuld %f32, %f34, %f46
169 faddd %f32, %f34, %f48
170 fmuld %f32, %f34, %f50
171 faddd %f32, %f34, %f52
172 fmuld %f32, %f34, %f54
173 faddd %f32, %f34, %f56
174 fmuld %f32, %f34, %f58
175 faddd %f32, %f34, %f60
176 fmuld %f32, %f34, %f62
177 ba,pt %xcc, fpdis_exit
179 3: mov SECONDARY_CONTEXT, %g3
180 add %g6, TI_FPREGS, %g1
182 661: ldxa [%g3] ASI_DMMU, %g5
183 .section .sun4v_1insn_patch, "ax"
185 ldxa [%g3] ASI_MMU, %g5
188 sethi %hi(sparc64_kern_sec_context), %g2
189 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
191 661: stxa %g2, [%g3] ASI_DMMU
192 .section .sun4v_1insn_patch, "ax"
194 stxa %g2, [%g3] ASI_MMU
200 ldda [%g1] ASI_BLK_S, %f0
201 ldda [%g1 + %g2] ASI_BLK_S, %f16
203 ldda [%g1] ASI_BLK_S, %f32
204 ldda [%g1 + %g2] ASI_BLK_S, %f48
208 661: stxa %g5, [%g3] ASI_DMMU
209 .section .sun4v_1insn_patch, "ax"
211 stxa %g5, [%g3] ASI_MMU
217 ldx [%g6 + TI_XFSR], %fsr
219 or %g3, %g4, %g3 ! anal...
221 wr %g0, FPRS_FEF, %fprs ! clean DU/DL bits
227 add %sp, PTREGS_OFF, %o0
231 .globl do_fpother_check_fitos
233 do_fpother_check_fitos:
234 TRAP_LOAD_THREAD_REG(%g6, %g1)
235 sethi %hi(fp_other_bounce - 4), %g7
236 or %g7, %lo(fp_other_bounce - 4), %g7
238 /* NOTE: Need to preserve %g7 until we fully commit
239 * to the fitos fixup.
241 stx %fsr, [%g6 + TI_XFSR]
243 andcc %g3, TSTATE_PRIV, %g0
244 bne,pn %xcc, do_fptrap_after_fsr
246 ldx [%g6 + TI_XFSR], %g3
249 cmp %g1, 2 ! Unfinished FP-OP
250 bne,pn %xcc, do_fptrap_after_fsr
251 sethi %hi(1 << 23), %g1 ! Inexact
253 bne,pn %xcc, do_fptrap_after_fsr
255 lduwa [%g1] ASI_AIUP, %g3 ! This cannot ever fail
256 #define FITOS_MASK 0xc1f83fe0
257 #define FITOS_COMPARE 0x81a01880
258 sethi %hi(FITOS_MASK), %g1
259 or %g1, %lo(FITOS_MASK), %g1
261 sethi %hi(FITOS_COMPARE), %g2
262 or %g2, %lo(FITOS_COMPARE), %g2
264 bne,pn %xcc, do_fptrap_after_fsr
266 std %f62, [%g6 + TI_FPREGS + (62 * 4)]
267 sethi %hi(fitos_table_1), %g1
269 or %g1, %lo(fitos_table_1), %g1
272 ba,pt %xcc, fitos_emul_continue
309 sethi %hi(fitos_table_2), %g1
311 or %g1, %lo(fitos_table_2), %g1
315 ba,pt %xcc, fitos_emul_fini
352 ldd [%g6 + TI_FPREGS + (62 * 4)], %f62
358 TRAP_LOAD_THREAD_REG(%g6, %g1)
359 stx %fsr, [%g6 + TI_XFSR]
361 ldub [%g6 + TI_FPSAVED], %g3
364 stb %g3, [%g6 + TI_FPSAVED]
366 stx %g3, [%g6 + TI_GSR]
367 mov SECONDARY_CONTEXT, %g3
369 661: ldxa [%g3] ASI_DMMU, %g5
370 .section .sun4v_1insn_patch, "ax"
372 ldxa [%g3] ASI_MMU, %g5
375 sethi %hi(sparc64_kern_sec_context), %g2
376 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
378 661: stxa %g2, [%g3] ASI_DMMU
379 .section .sun4v_1insn_patch, "ax"
381 stxa %g2, [%g3] ASI_MMU
385 add %g6, TI_FPREGS, %g2
386 andcc %g1, FPRS_DL, %g0
389 stda %f0, [%g2] ASI_BLK_S
390 stda %f16, [%g2 + %g3] ASI_BLK_S
391 andcc %g1, FPRS_DU, %g0
394 stda %f32, [%g2] ASI_BLK_S
395 stda %f48, [%g2 + %g3] ASI_BLK_S
396 5: mov SECONDARY_CONTEXT, %g1
399 661: stxa %g5, [%g1] ASI_DMMU
400 .section .sun4v_1insn_patch, "ax"
402 stxa %g5, [%g1] ASI_MMU
409 /* The registers for cross calls will be:
411 * DATA 0: [low 32-bits] Address of function to call, jmp to this
412 * [high 32-bits] MMU Context Argument 0, place in %g5
413 * DATA 1: Address Argument 1, place in %g1
414 * DATA 2: Address Argument 2, place in %g7
416 * With this method we can do most of the cross-call tlb/cache
417 * flushing very quickly.
424 ldxa [%g3 + %g0] ASI_INTR_R, %g3
425 sethi %hi(KERNBASE), %g4
427 bgeu,pn %xcc, do_ivec_xcall
429 stxa %g0, [%g0] ASI_INTR_RECEIVE
432 sethi %hi(ivector_table_pa), %g2
433 ldx [%g2 + %lo(ivector_table_pa)], %g2
437 TRAP_LOAD_IRQ_WORK_PA(%g6, %g1)
440 stxa %g5, [%g3] ASI_PHYS_USE_EC
442 wr %g0, 1 << PIL_DEVICE_IRQ, %set_softint
446 ldxa [%g1 + %g0] ASI_INTR_R, %g1
450 ldxa [%g7 + %g0] ASI_INTR_R, %g7
451 stxa %g0, [%g0] ASI_INTR_RECEIVE
462 ldx [%o0 + PT_V9_TSTATE], %o1
466 stx %o1, [%o0 + PT_V9_G1]
468 ldx [%o0 + PT_V9_TSTATE], %o1
469 ldx [%o0 + PT_V9_G1], %o2
470 or %g0, %ulo(TSTATE_ICC), %o3
477 stx %o1, [%o0 + PT_V9_TSTATE]
480 utrap_trap: /* %g3=handler,%g4=level */
481 TRAP_LOAD_THREAD_REG(%g6, %g1)
482 ldx [%g6 + TI_UTRAPS], %g1
483 brnz,pt %g1, invoke_utrap
490 add %sp, PTREGS_OFF, %o0
500 andn %l6, TSTATE_CWP, %l6
501 wrpr %l6, %l7, %tstate
507 /* We need to carefully read the error status, ACK
508 * the errors, prevent recursive traps, and pass the
509 * information on to C code for logging.
511 * We pass the AFAR in as-is, and we encode the status
512 * information as described in asm-sparc64/sfafsr.h
514 .globl __spitfire_access_error
515 __spitfire_access_error:
516 /* Disable ESTATE error reporting so that we do not
517 * take recursive traps and RED state the processor.
519 stxa %g0, [%g0] ASI_ESTATE_ERROR_EN
523 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
525 /* __spitfire_cee_trap branches here with AFSR in %g4 and
526 * UDBE_CE in %g1. It only clears ESTATE_ERR_CE in the
527 * ESTATE Error Enable register.
529 __spitfire_cee_trap_continue:
530 ldxa [%g0] ASI_AFAR, %g5 ! Get AFAR
533 and %g3, 0x1ff, %g3 ! Paranoia
534 sllx %g3, SFSTAT_TRAP_TYPE_SHIFT, %g3
540 sllx %g3, SFSTAT_TL_GT_ONE_SHIFT, %g3
544 /* Read in the UDB error register state, clearing the
545 * sticky error bits as-needed. We only clear them if
546 * the UE bit is set. Likewise, __spitfire_cee_trap
547 * below will only do so if the CE bit is set.
549 * NOTE: UltraSparc-I/II have high and low UDB error
550 * registers, corresponding to the two UDB units
551 * present on those chips. UltraSparc-IIi only
552 * has a single UDB, called "SDB" in the manual.
553 * For IIi the upper UDB register always reads
554 * as zero so for our purposes things will just
555 * work with the checks below.
557 1: ldxa [%g0] ASI_UDBH_ERROR_R, %g3
558 and %g3, 0x3ff, %g7 ! Paranoia
559 sllx %g7, SFSTAT_UDBH_SHIFT, %g7
561 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
564 stxa %g3, [%g0] ASI_UDB_ERROR_W
568 ldxa [%g3] ASI_UDBL_ERROR_R, %g3
569 and %g3, 0x3ff, %g7 ! Paranoia
570 sllx %g7, SFSTAT_UDBL_SHIFT, %g7
572 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
576 stxa %g3, [%g7] ASI_UDB_ERROR_W
579 1: /* Ok, now that we've latched the error state,
580 * clear the sticky bits in the AFSR.
582 stxa %g4, [%g0] ASI_AFSR
597 1: ba,pt %xcc, etrap_irq
601 #ifdef CONFIG_TRACE_IRQFLAGS
602 call trace_hardirqs_off
607 call spitfire_access_error
608 add %sp, PTREGS_OFF, %o0
612 /* This is the trap handler entry point for ECC correctable
613 * errors. They are corrected, but we listen for the trap
614 * so that the event can be logged.
616 * Disrupting errors are either:
617 * 1) single-bit ECC errors during UDB reads to system
619 * 2) data parity errors during write-back events
621 * As far as I can make out from the manual, the CEE trap
622 * is only for correctable errors during memory read
623 * accesses by the front-end of the processor.
625 * The code below is only for trap level 1 CEE events,
626 * as it is the only situation where we can safely record
627 * and log. For trap level >1 we just clear the CE bit
628 * in the AFSR and return.
630 * This is just like __spiftire_access_error above, but it
631 * specifically handles correctable errors. If an
632 * uncorrectable error is indicated in the AFSR we
633 * will branch directly above to __spitfire_access_error
634 * to handle it instead. Uncorrectable therefore takes
635 * priority over correctable, and the error logging
636 * C code will notice this case by inspecting the
639 .globl __spitfire_cee_trap
641 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
643 sllx %g3, SFAFSR_UE_SHIFT, %g3
644 andcc %g4, %g3, %g0 ! Check for UE
645 bne,pn %xcc, __spitfire_access_error
648 /* Ok, in this case we only have a correctable error.
649 * Indicate we only wish to capture that state in register
650 * %g1, and we only disable CE error reporting unlike UE
651 * handling which disables all errors.
653 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g3
654 andn %g3, ESTATE_ERR_CE, %g3
655 stxa %g3, [%g0] ASI_ESTATE_ERROR_EN
658 /* Preserve AFSR in %g4, indicate UDB state to capture in %g1 */
659 ba,pt %xcc, __spitfire_cee_trap_continue
662 .globl __spitfire_data_access_exception
663 .globl __spitfire_data_access_exception_tl1
664 __spitfire_data_access_exception_tl1:
666 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
669 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
670 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
671 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
674 cmp %g3, 0x80 ! first win spill/fill trap
676 cmp %g3, 0xff ! last win spill/fill trap
679 ba,pt %xcc, winfix_dax
681 1: sethi %hi(109f), %g7
683 109: or %g7, %lo(109b), %g7
686 call spitfire_data_access_exception_tl1
687 add %sp, PTREGS_OFF, %o0
691 __spitfire_data_access_exception:
693 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
696 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
697 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
698 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
702 109: or %g7, %lo(109b), %g7
705 call spitfire_data_access_exception
706 add %sp, PTREGS_OFF, %o0
710 .globl __spitfire_insn_access_exception
711 .globl __spitfire_insn_access_exception_tl1
712 __spitfire_insn_access_exception_tl1:
714 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
716 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
717 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
718 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
722 109: or %g7, %lo(109b), %g7
725 call spitfire_insn_access_exception_tl1
726 add %sp, PTREGS_OFF, %o0
730 __spitfire_insn_access_exception:
732 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
734 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
735 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
736 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
740 109: or %g7, %lo(109b), %g7
743 call spitfire_insn_access_exception
744 add %sp, PTREGS_OFF, %o0
748 /* These get patched into the trap table at boot time
749 * once we know we have a cheetah processor.
751 .globl cheetah_fecc_trap_vector, cheetah_fecc_trap_vector_tl1
752 cheetah_fecc_trap_vector:
754 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
755 andn %g1, DCU_DC | DCU_IC, %g1
756 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
758 sethi %hi(cheetah_fast_ecc), %g2
759 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
761 cheetah_fecc_trap_vector_tl1:
763 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
764 andn %g1, DCU_DC | DCU_IC, %g1
765 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
767 sethi %hi(cheetah_fast_ecc), %g2
768 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
770 .globl cheetah_cee_trap_vector, cheetah_cee_trap_vector_tl1
771 cheetah_cee_trap_vector:
773 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
774 andn %g1, DCU_IC, %g1
775 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
777 sethi %hi(cheetah_cee), %g2
778 jmpl %g2 + %lo(cheetah_cee), %g0
780 cheetah_cee_trap_vector_tl1:
782 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
783 andn %g1, DCU_IC, %g1
784 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
786 sethi %hi(cheetah_cee), %g2
787 jmpl %g2 + %lo(cheetah_cee), %g0
789 .globl cheetah_deferred_trap_vector, cheetah_deferred_trap_vector_tl1
790 cheetah_deferred_trap_vector:
792 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
793 andn %g1, DCU_DC | DCU_IC, %g1;
794 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
796 sethi %hi(cheetah_deferred_trap), %g2
797 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
799 cheetah_deferred_trap_vector_tl1:
801 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
802 andn %g1, DCU_DC | DCU_IC, %g1;
803 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
805 sethi %hi(cheetah_deferred_trap), %g2
806 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
809 /* Cheetah+ specific traps. These are for the new I/D cache parity
810 * error traps. The first argument to cheetah_plus_parity_handler
811 * is encoded as follows:
813 * Bit0: 0=dcache,1=icache
814 * Bit1: 0=recoverable,1=unrecoverable
816 .globl cheetah_plus_dcpe_trap_vector, cheetah_plus_dcpe_trap_vector_tl1
817 cheetah_plus_dcpe_trap_vector:
819 sethi %hi(do_cheetah_plus_data_parity), %g7
820 jmpl %g7 + %lo(do_cheetah_plus_data_parity), %g0
827 do_cheetah_plus_data_parity:
830 ba,pt %xcc, etrap_irq
832 #ifdef CONFIG_TRACE_IRQFLAGS
833 call trace_hardirqs_off
837 call cheetah_plus_parity_error
838 add %sp, PTREGS_OFF, %o1
839 ba,a,pt %xcc, rtrap_irq
841 cheetah_plus_dcpe_trap_vector_tl1:
843 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
844 sethi %hi(do_dcpe_tl1), %g3
845 jmpl %g3 + %lo(do_dcpe_tl1), %g0
851 .globl cheetah_plus_icpe_trap_vector, cheetah_plus_icpe_trap_vector_tl1
852 cheetah_plus_icpe_trap_vector:
854 sethi %hi(do_cheetah_plus_insn_parity), %g7
855 jmpl %g7 + %lo(do_cheetah_plus_insn_parity), %g0
862 do_cheetah_plus_insn_parity:
865 ba,pt %xcc, etrap_irq
867 #ifdef CONFIG_TRACE_IRQFLAGS
868 call trace_hardirqs_off
872 call cheetah_plus_parity_error
873 add %sp, PTREGS_OFF, %o1
874 ba,a,pt %xcc, rtrap_irq
876 cheetah_plus_icpe_trap_vector_tl1:
878 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
879 sethi %hi(do_icpe_tl1), %g3
880 jmpl %g3 + %lo(do_icpe_tl1), %g0
886 /* If we take one of these traps when tl >= 1, then we
887 * jump to interrupt globals. If some trap level above us
888 * was also using interrupt globals, we cannot recover.
889 * We may use all interrupt global registers except %g6.
891 .globl do_dcpe_tl1, do_icpe_tl1
893 rdpr %tl, %g1 ! Save original trap level
894 mov 1, %g2 ! Setup TSTATE checking loop
895 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
896 1: wrpr %g2, %tl ! Set trap level to check
897 rdpr %tstate, %g4 ! Read TSTATE for this level
898 andcc %g4, %g3, %g0 ! Interrupt globals in use?
899 bne,a,pn %xcc, do_dcpe_tl1_fatal ! Yep, irrecoverable
900 wrpr %g1, %tl ! Restore original trap level
901 add %g2, 1, %g2 ! Next trap level
902 cmp %g2, %g1 ! Hit them all yet?
903 ble,pt %icc, 1b ! Not yet
905 wrpr %g1, %tl ! Restore original trap level
906 do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
907 sethi %hi(dcache_parity_tl1_occurred), %g2
908 lduw [%g2 + %lo(dcache_parity_tl1_occurred)], %g1
910 stw %g1, [%g2 + %lo(dcache_parity_tl1_occurred)]
911 /* Reset D-cache parity */
912 sethi %hi(1 << 16), %g1 ! D-cache size
913 mov (1 << 5), %g2 ! D-cache line size
914 sub %g1, %g2, %g1 ! Move down 1 cacheline
915 1: srl %g1, 14, %g3 ! Compute UTAG
917 stxa %g3, [%g1] ASI_DCACHE_UTAG
919 sub %g2, 8, %g3 ! 64-bit data word within line
921 stxa %g0, [%g1 + %g3] ASI_DCACHE_DATA
923 subcc %g3, 8, %g3 ! Next 64-bit data word
926 subcc %g1, %g2, %g1 ! Next cacheline
929 ba,pt %xcc, dcpe_icpe_tl1_common
935 1: or %g7, %lo(1b), %g7
937 call cheetah_plus_parity_error
938 add %sp, PTREGS_OFF, %o1
943 rdpr %tl, %g1 ! Save original trap level
944 mov 1, %g2 ! Setup TSTATE checking loop
945 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
946 1: wrpr %g2, %tl ! Set trap level to check
947 rdpr %tstate, %g4 ! Read TSTATE for this level
948 andcc %g4, %g3, %g0 ! Interrupt globals in use?
949 bne,a,pn %xcc, do_icpe_tl1_fatal ! Yep, irrecoverable
950 wrpr %g1, %tl ! Restore original trap level
951 add %g2, 1, %g2 ! Next trap level
952 cmp %g2, %g1 ! Hit them all yet?
953 ble,pt %icc, 1b ! Not yet
955 wrpr %g1, %tl ! Restore original trap level
956 do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
957 sethi %hi(icache_parity_tl1_occurred), %g2
958 lduw [%g2 + %lo(icache_parity_tl1_occurred)], %g1
960 stw %g1, [%g2 + %lo(icache_parity_tl1_occurred)]
962 sethi %hi(1 << 15), %g1 ! I-cache size
963 mov (1 << 5), %g2 ! I-cache line size
965 1: or %g1, (2 << 3), %g3
966 stxa %g0, [%g3] ASI_IC_TAG
971 ba,pt %xcc, dcpe_icpe_tl1_common
977 1: or %g7, %lo(1b), %g7
979 call cheetah_plus_parity_error
980 add %sp, PTREGS_OFF, %o1
984 dcpe_icpe_tl1_common:
985 /* Flush D-cache, re-enable D/I caches in DCU and finally
986 * retry the trapping instruction.
988 sethi %hi(1 << 16), %g1 ! D-cache size
989 mov (1 << 5), %g2 ! D-cache line size
991 1: stxa %g0, [%g1] ASI_DCACHE_TAG
996 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
997 or %g1, (DCU_DC | DCU_IC), %g1
998 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
1002 /* Capture I/D/E-cache state into per-cpu error scoreboard.
1004 * %g1: (TL>=0) ? 1 : 0
1009 * %g6: unused, will have current thread ptr after etrap
1012 __cheetah_log_error:
1013 /* Put "TL1" software bit into AFSR. */
1018 /* Get log entry pointer for this cpu at this trap level. */
1019 BRANCH_IF_JALAPENO(g2,g3,50f)
1020 ldxa [%g0] ASI_SAFARI_CONFIG, %g2
1025 50: ldxa [%g0] ASI_JBUS_CONFIG, %g2
1029 60: sllx %g2, 9, %g2
1030 sethi %hi(cheetah_error_log), %g3
1031 ldx [%g3 + %lo(cheetah_error_log)], %g3
1039 /* %g1 holds pointer to the top of the logging scoreboard */
1040 ldx [%g1 + 0x0], %g7
1045 stx %g4, [%g1 + 0x0]
1046 stx %g5, [%g1 + 0x8]
1049 /* %g1 now points to D-cache logging area */
1050 set 0x3ff8, %g2 /* DC_addr mask */
1051 and %g5, %g2, %g2 /* DC_addr bits of AFAR */
1053 or %g3, 1, %g3 /* PHYS tag + valid */
1055 10: ldxa [%g2] ASI_DCACHE_TAG, %g7
1056 cmp %g3, %g7 /* TAG match? */
1060 /* Yep, what we want, capture state. */
1061 stx %g2, [%g1 + 0x20]
1062 stx %g7, [%g1 + 0x28]
1064 /* A membar Sync is required before and after utag access. */
1066 ldxa [%g2] ASI_DCACHE_UTAG, %g7
1068 stx %g7, [%g1 + 0x30]
1069 ldxa [%g2] ASI_DCACHE_SNOOP_TAG, %g7
1070 stx %g7, [%g1 + 0x38]
1073 12: ldxa [%g2 + %g3] ASI_DCACHE_DATA, %g7
1075 add %g3, (1 << 5), %g3
1083 13: sethi %hi(1 << 14), %g7
1092 /* %g1 now points to I-cache logging area */
1093 20: set 0x1fe0, %g2 /* IC_addr mask */
1094 and %g5, %g2, %g2 /* IC_addr bits of AFAR */
1095 sllx %g2, 1, %g2 /* IC_addr[13:6]==VA[12:5] */
1096 srlx %g5, (13 - 8), %g3 /* Make PTAG */
1097 andn %g3, 0xff, %g3 /* Mask off undefined bits */
1099 21: ldxa [%g2] ASI_IC_TAG, %g7
1105 /* Yep, what we want, capture state. */
1106 stx %g2, [%g1 + 0x40]
1107 stx %g7, [%g1 + 0x48]
1108 add %g2, (1 << 3), %g2
1109 ldxa [%g2] ASI_IC_TAG, %g7
1110 add %g2, (1 << 3), %g2
1111 stx %g7, [%g1 + 0x50]
1112 ldxa [%g2] ASI_IC_TAG, %g7
1113 add %g2, (1 << 3), %g2
1114 stx %g7, [%g1 + 0x60]
1115 ldxa [%g2] ASI_IC_TAG, %g7
1116 stx %g7, [%g1 + 0x68]
1117 sub %g2, (3 << 3), %g2
1118 ldxa [%g2] ASI_IC_STAG, %g7
1119 stx %g7, [%g1 + 0x58]
1123 22: ldxa [%g2 + %g3] ASI_IC_INSTR, %g7
1125 add %g3, (1 << 3), %g3
1133 23: sethi %hi(1 << 14), %g7
1142 /* %g1 now points to E-cache logging area */
1143 30: andn %g5, (32 - 1), %g2
1144 stx %g2, [%g1 + 0x20]
1145 ldxa [%g2] ASI_EC_TAG_DATA, %g7
1146 stx %g7, [%g1 + 0x28]
1147 ldxa [%g2] ASI_EC_R, %g0
1150 31: ldxa [%g3] ASI_EC_DATA, %g7
1151 stx %g7, [%g1 + %g3]
1164 ba,pt %xcc, c_deferred
1166 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
1167 * in the trap table. That code has done a memory barrier
1168 * and has disabled both the I-cache and D-cache in the DCU
1169 * control register. The I-cache is disabled so that we may
1170 * capture the corrupted cache line, and the D-cache is disabled
1171 * because corrupt data may have been placed there and we don't
1172 * want to reference it.
1174 * %g1 is one if this trap occurred at %tl >= 1.
1176 * Next, we turn off error reporting so that we don't recurse.
1178 .globl cheetah_fast_ecc
1180 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1181 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
1182 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1185 /* Fetch and clear AFSR/AFAR */
1186 ldxa [%g0] ASI_AFSR, %g4
1187 ldxa [%g0] ASI_AFAR, %g5
1188 stxa %g4, [%g0] ASI_AFSR
1191 ba,pt %xcc, __cheetah_log_error
1197 ba,pt %xcc, etrap_irq
1199 #ifdef CONFIG_TRACE_IRQFLAGS
1200 call trace_hardirqs_off
1205 call cheetah_fecc_handler
1206 add %sp, PTREGS_OFF, %o0
1207 ba,a,pt %xcc, rtrap_irq
1209 /* Our caller has disabled I-cache and performed membar Sync. */
1212 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1213 andn %g2, ESTATE_ERROR_CEEN, %g2
1214 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1217 /* Fetch and clear AFSR/AFAR */
1218 ldxa [%g0] ASI_AFSR, %g4
1219 ldxa [%g0] ASI_AFAR, %g5
1220 stxa %g4, [%g0] ASI_AFSR
1223 ba,pt %xcc, __cheetah_log_error
1229 ba,pt %xcc, etrap_irq
1231 #ifdef CONFIG_TRACE_IRQFLAGS
1232 call trace_hardirqs_off
1237 call cheetah_cee_handler
1238 add %sp, PTREGS_OFF, %o0
1239 ba,a,pt %xcc, rtrap_irq
1241 /* Our caller has disabled I-cache+D-cache and performed membar Sync. */
1242 .globl cheetah_deferred_trap
1243 cheetah_deferred_trap:
1244 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1245 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
1246 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1249 /* Fetch and clear AFSR/AFAR */
1250 ldxa [%g0] ASI_AFSR, %g4
1251 ldxa [%g0] ASI_AFAR, %g5
1252 stxa %g4, [%g0] ASI_AFSR
1255 ba,pt %xcc, __cheetah_log_error
1261 ba,pt %xcc, etrap_irq
1263 #ifdef CONFIG_TRACE_IRQFLAGS
1264 call trace_hardirqs_off
1269 call cheetah_deferred_handler
1270 add %sp, PTREGS_OFF, %o0
1271 ba,a,pt %xcc, rtrap_irq
1276 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
1278 sethi %hi(109f), %g7
1280 109: or %g7, %lo(109b), %g7
1282 add %sp, PTREGS_OFF, %o0
1291 /* Setup %g4/%g5 now as they are used in the
1296 ldxa [%g4] ASI_DMMU, %g4
1297 ldxa [%g3] ASI_DMMU, %g5
1298 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
1300 bgu,pn %icc, winfix_mna
1303 1: sethi %hi(109f), %g7
1305 109: or %g7, %lo(109b), %g7
1308 call mem_address_unaligned
1309 add %sp, PTREGS_OFF, %o0
1315 sethi %hi(109f), %g7
1317 ldxa [%g4] ASI_DMMU, %g5
1318 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
1321 ldxa [%g4] ASI_DMMU, %g4
1323 109: or %g7, %lo(109b), %g7
1327 add %sp, PTREGS_OFF, %o0
1333 sethi %hi(109f), %g7
1335 ldxa [%g4] ASI_DMMU, %g5
1336 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
1339 ldxa [%g4] ASI_DMMU, %g4
1341 109: or %g7, %lo(109b), %g7
1345 add %sp, PTREGS_OFF, %o0
1349 .globl breakpoint_trap
1351 call sparc_breakpoint
1352 add %sp, PTREGS_OFF, %o0
1356 #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
1357 defined(CONFIG_SOLARIS_EMUL_MODULE)
1358 /* SunOS uses syscall zero as the 'indirect syscall' it looks
1359 * like indir_syscall(scall_num, arg0, arg1, arg2...); etc.
1360 * This is complete brain damage.
1366 cmp %o0, NR_SYSCALLS
1369 sethi %hi(sunos_nosys), %l6
1371 or %l6, %lo(sunos_nosys), %l6
1372 1: sethi %hi(sunos_sys_table), %l7
1373 or %l7, %lo(sunos_sys_table), %l7
1374 lduw [%l7 + %o0], %l6
1388 stx %o0, [%sp + PTREGS_OFF + PT_V9_I1]
1389 b,pt %xcc, ret_sys_call
1390 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1392 /* SunOS getuid() returns uid in %o0 and euid in %o1 */
1395 call sys32_geteuid16
1398 stx %o0, [%sp + PTREGS_OFF + PT_V9_I1]
1399 b,pt %xcc, ret_sys_call
1400 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1402 /* SunOS getgid() returns gid in %o0 and egid in %o1 */
1405 call sys32_getegid16
1408 stx %o0, [%sp + PTREGS_OFF + PT_V9_I1]
1409 b,pt %xcc, ret_sys_call
1410 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1413 /* SunOS's execv() call only specifies the argv argument, the
1414 * environment settings are the same as the calling processes.
1418 sethi %hi(sparc_execve), %g1
1419 ba,pt %xcc, execve_merge
1420 or %g1, %lo(sparc_execve), %g1
1421 #ifdef CONFIG_COMPAT
1424 stx %g0, [%sp + PTREGS_OFF + PT_V9_I2]
1427 sethi %hi(sparc32_execve), %g1
1428 or %g1, %lo(sparc32_execve), %g1
1433 add %sp, PTREGS_OFF, %o0
1435 .globl sys_pipe, sys_sigpause, sys_nis_syscall
1436 .globl sys_rt_sigreturn
1438 .globl sys_sigaltstack
1440 sys_pipe: ba,pt %xcc, sparc_pipe
1441 add %sp, PTREGS_OFF, %o0
1442 sys_nis_syscall:ba,pt %xcc, c_sys_nis_syscall
1443 add %sp, PTREGS_OFF, %o0
1444 sys_memory_ordering:
1445 ba,pt %xcc, sparc_memory_ordering
1446 add %sp, PTREGS_OFF, %o1
1447 sys_sigaltstack:ba,pt %xcc, do_sigaltstack
1448 add %i6, STACK_BIAS, %o2
1449 #ifdef CONFIG_COMPAT
1450 .globl sys32_sigstack
1451 sys32_sigstack: ba,pt %xcc, do_sys32_sigstack
1453 .globl sys32_sigaltstack
1455 ba,pt %xcc, do_sys32_sigaltstack
1459 #ifdef CONFIG_COMPAT
1460 .globl sys32_sigreturn
1462 add %sp, PTREGS_OFF, %o0
1464 add %o7, 1f-.-4, %o7
1468 add %sp, PTREGS_OFF, %o0
1469 call do_rt_sigreturn
1470 add %o7, 1f-.-4, %o7
1472 #ifdef CONFIG_COMPAT
1473 .globl sys32_rt_sigreturn
1475 add %sp, PTREGS_OFF, %o0
1476 call do_rt_sigreturn32
1477 add %o7, 1f-.-4, %o7
1481 1: ldx [%curptr + TI_FLAGS], %l5
1482 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1485 add %sp, PTREGS_OFF, %o0
1492 /* This is how fork() was meant to be done, 8 instruction entry.
1494 * I questioned the following code briefly, let me clear things
1495 * up so you must not reason on it like I did.
1497 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
1498 * need it here because the only piece of window state we copy to
1499 * the child is the CWP register. Even if the parent sleeps,
1500 * we are safe because we stuck it into pt_regs of the parent
1501 * so it will not change.
1503 * XXX This raises the question, whether we can do the same on
1504 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
1505 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
1506 * XXX fork_kwim in UREG_G1 (global registers are considered
1507 * XXX volatile across a system call in the sparc ABI I think
1508 * XXX if it isn't we can use regs->y instead, anyone who depends
1509 * XXX upon the Y register being preserved across a fork deserves
1512 * In fact we should take advantage of that fact for other things
1513 * during system calls...
1515 .globl sys_fork, sys_vfork, sys_clone, sparc_exit
1516 .globl ret_from_syscall
1518 sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
1519 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
1520 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
1521 ba,pt %xcc, sys_clone
1527 ba,pt %xcc, sparc_do_fork
1528 add %sp, PTREGS_OFF, %o2
1530 /* Clear current_thread_info()->new_child, and
1531 * check performance counter stuff too.
1533 stb %g0, [%g6 + TI_NEW_CHILD]
1534 ldx [%g6 + TI_FLAGS], %l0
1537 andcc %l0, _TIF_PERFCTR, %g0
1540 ldx [%g6 + TI_PCR], %o7
1543 /* Blackbird errata workaround. See commentary in
1544 * smp.c:smp_percpu_timer_interrupt() for more
1550 99: wr %g0, %g0, %pic
1553 1: b,pt %xcc, ret_sys_call
1554 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
1555 sparc_exit: rdpr %pstate, %g2
1556 wrpr %g2, PSTATE_IE, %pstate
1560 wrpr %g3, 0x0, %cansave
1561 wrpr %g0, 0x0, %otherwin
1562 wrpr %g2, 0x0, %pstate
1563 ba,pt %xcc, sys_exit
1564 stb %g0, [%g6 + TI_WSAVED]
1566 linux_sparc_ni_syscall:
1567 sethi %hi(sys_ni_syscall), %l7
1569 or %l7, %lo(sys_ni_syscall), %l7
1571 linux_syscall_trace32:
1572 add %sp, PTREGS_OFF, %o0
1582 linux_syscall_trace:
1583 add %sp, PTREGS_OFF, %o0
1594 /* Linux 32-bit and SunOS system calls enter here... */
1596 .globl linux_sparc_syscall32
1597 linux_sparc_syscall32:
1598 /* Direct access to user regs, much faster. */
1599 cmp %g1, NR_SYSCALLS ! IEU1 Group
1600 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1601 srl %i0, 0, %o0 ! IEU0
1602 sll %g1, 2, %l4 ! IEU0 Group
1603 srl %i4, 0, %o4 ! IEU1
1604 lduw [%l7 + %l4], %l7 ! Load
1605 srl %i1, 0, %o1 ! IEU0 Group
1606 ldx [%curptr + TI_FLAGS], %l0 ! Load
1608 srl %i5, 0, %o5 ! IEU1
1609 srl %i2, 0, %o2 ! IEU0 Group
1610 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1611 bne,pn %icc, linux_syscall_trace32 ! CTI
1613 call %l7 ! CTI Group brk forced
1614 srl %i3, 0, %o3 ! IEU0
1617 /* Linux native and SunOS system calls enter here... */
1619 .globl linux_sparc_syscall, ret_sys_call
1620 linux_sparc_syscall:
1621 /* Direct access to user regs, much faster. */
1622 cmp %g1, NR_SYSCALLS ! IEU1 Group
1623 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1625 sll %g1, 2, %l4 ! IEU0 Group
1627 lduw [%l7 + %l4], %l7 ! Load
1628 4: mov %i2, %o2 ! IEU0 Group
1629 ldx [%curptr + TI_FLAGS], %l0 ! Load
1632 mov %i4, %o4 ! IEU0 Group
1633 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1634 bne,pn %icc, linux_syscall_trace ! CTI Group
1636 2: call %l7 ! CTI Group brk forced
1640 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1642 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
1643 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
1645 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
1648 /* Check if force_successful_syscall_return()
1651 ldub [%curptr + TI_SYS_NOERROR], %l2
1653 stb %g0, [%curptr + TI_SYS_NOERROR]
1655 cmp %o0, -ERESTART_RESTARTBLOCK
1657 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
1659 /* System call success, clear Carry condition code. */
1661 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
1662 bne,pn %icc, linux_syscall_trace2
1663 add %l1, 0x4, %l2 ! npc = npc+4
1664 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1665 ba,pt %xcc, rtrap_clr_l6
1666 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1669 /* System call failure, set Carry condition code.
1670 * Also, get abs(errno) to return to the process.
1672 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
1675 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1677 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
1678 bne,pn %icc, linux_syscall_trace2
1679 add %l1, 0x4, %l2 ! npc = npc+4
1680 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1683 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1684 linux_syscall_trace2:
1685 add %sp, PTREGS_OFF, %o0
1688 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1690 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1693 .globl __flushw_user
1698 1: save %sp, -128, %sp
1704 restore %g0, %g0, %g0
1709 .globl hard_smp_processor_id
1710 hard_smp_processor_id:
1712 .globl real_hard_smp_processor_id
1713 real_hard_smp_processor_id:
1721 * returns %o0: sysino
1723 .globl sun4v_devino_to_sysino
1724 .type sun4v_devino_to_sysino,#function
1725 sun4v_devino_to_sysino:
1726 mov HV_FAST_INTR_DEVINO2SYSINO, %o5
1730 .size sun4v_devino_to_sysino, .-sun4v_devino_to_sysino
1734 * returns %o0: intr_enabled (HV_INTR_{DISABLED,ENABLED})
1736 .globl sun4v_intr_getenabled
1737 .type sun4v_intr_getenabled,#function
1738 sun4v_intr_getenabled:
1739 mov HV_FAST_INTR_GETENABLED, %o5
1743 .size sun4v_intr_getenabled, .-sun4v_intr_getenabled
1746 * %o1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
1748 .globl sun4v_intr_setenabled
1749 .type sun4v_intr_setenabled,#function
1750 sun4v_intr_setenabled:
1751 mov HV_FAST_INTR_SETENABLED, %o5
1755 .size sun4v_intr_setenabled, .-sun4v_intr_setenabled
1759 * returns %o0: intr_state (HV_INTR_STATE_*)
1761 .globl sun4v_intr_getstate
1762 .type sun4v_intr_getstate,#function
1763 sun4v_intr_getstate:
1764 mov HV_FAST_INTR_GETSTATE, %o5
1768 .size sun4v_intr_getstate, .-sun4v_intr_getstate
1771 * %o1: intr_state (HV_INTR_STATE_*)
1773 .globl sun4v_intr_setstate
1774 .type sun4v_intr_setstate,#function
1775 sun4v_intr_setstate:
1776 mov HV_FAST_INTR_SETSTATE, %o5
1780 .size sun4v_intr_setstate, .-sun4v_intr_setstate
1784 * returns %o0: cpuid
1786 .globl sun4v_intr_gettarget
1787 .type sun4v_intr_gettarget,#function
1788 sun4v_intr_gettarget:
1789 mov HV_FAST_INTR_GETTARGET, %o5
1793 .size sun4v_intr_gettarget, .-sun4v_intr_gettarget
1798 .globl sun4v_intr_settarget
1799 .type sun4v_intr_settarget,#function
1800 sun4v_intr_settarget:
1801 mov HV_FAST_INTR_SETTARGET, %o5
1805 .size sun4v_intr_settarget, .-sun4v_intr_settarget
1812 * returns %o0: status
1814 .globl sun4v_cpu_start
1815 .type sun4v_cpu_start,#function
1817 mov HV_FAST_CPU_START, %o5
1821 .size sun4v_cpu_start, .-sun4v_cpu_start
1825 * returns %o0: status
1827 .globl sun4v_cpu_stop
1828 .type sun4v_cpu_stop,#function
1830 mov HV_FAST_CPU_STOP, %o5
1834 .size sun4v_cpu_stop, .-sun4v_cpu_stop
1836 /* returns %o0: status */
1837 .globl sun4v_cpu_yield
1838 .type sun4v_cpu_yield, #function
1840 mov HV_FAST_CPU_YIELD, %o5
1844 .size sun4v_cpu_yield, .-sun4v_cpu_yield
1848 * %o2: num queue entries
1850 * returns %o0: status
1852 .globl sun4v_cpu_qconf
1853 .type sun4v_cpu_qconf,#function
1855 mov HV_FAST_CPU_QCONF, %o5
1859 .size sun4v_cpu_qconf, .-sun4v_cpu_qconf
1861 /* %o0: num cpus in cpu list
1862 * %o1: cpu list paddr
1863 * %o2: mondo block paddr
1865 * returns %o0: status
1867 .globl sun4v_cpu_mondo_send
1868 .type sun4v_cpu_mondo_send,#function
1869 sun4v_cpu_mondo_send:
1870 mov HV_FAST_CPU_MONDO_SEND, %o5
1874 .size sun4v_cpu_mondo_send, .-sun4v_cpu_mondo_send
1878 * returns %o0: -status if status non-zero, else
1879 * %o0: cpu state as HV_CPU_STATE_*
1881 .globl sun4v_cpu_state
1882 .type sun4v_cpu_state,#function
1884 mov HV_FAST_CPU_STATE, %o5
1891 .size sun4v_cpu_state, .-sun4v_cpu_state
1893 /* %o0: virtual address
1896 * %o3: HV_MMU_* flags
1898 * returns %o0: status
1900 .globl sun4v_mmu_map_perm_addr
1901 .type sun4v_mmu_map_perm_addr,#function
1902 sun4v_mmu_map_perm_addr:
1903 mov HV_FAST_MMU_MAP_PERM_ADDR, %o5
1907 .size sun4v_mmu_map_perm_addr, .-sun4v_mmu_map_perm_addr
1909 /* %o0: number of TSB descriptions
1910 * %o1: TSB descriptions real address
1912 * returns %o0: status
1914 .globl sun4v_mmu_tsb_ctx0
1915 .type sun4v_mmu_tsb_ctx0,#function
1917 mov HV_FAST_MMU_TSB_CTX0, %o5
1921 .size sun4v_mmu_tsb_ctx0, .-sun4v_mmu_tsb_ctx0
1923 /* %o0: API group number
1924 * %o1: pointer to unsigned long major number storage
1925 * %o2: pointer to unsigned long minor number storage
1927 * returns %o0: status
1929 .globl sun4v_get_version
1930 .type sun4v_get_version,#function
1932 mov HV_CORE_GET_VER, %o5
1939 .size sun4v_get_version, .-sun4v_get_version
1941 /* %o0: API group number
1942 * %o1: desired major number
1943 * %o2: desired minor number
1944 * %o3: pointer to unsigned long actual minor number storage
1946 * returns %o0: status
1948 .globl sun4v_set_version
1949 .type sun4v_set_version,#function
1951 mov HV_CORE_SET_VER, %o5
1956 .size sun4v_set_version, .-sun4v_set_version
1958 /* %o0: pointer to unsigned long time
1960 * returns %o0: status
1962 .globl sun4v_tod_get
1963 .type sun4v_tod_get,#function
1966 mov HV_FAST_TOD_GET, %o5
1971 .size sun4v_tod_get, .-sun4v_tod_get
1975 * returns %o0: status
1977 .globl sun4v_tod_set
1978 .type sun4v_tod_set,#function
1980 mov HV_FAST_TOD_SET, %o5
1984 .size sun4v_tod_set, .-sun4v_tod_set
1986 /* %o0: pointer to unsigned long status
1988 * returns %o0: signed character
1990 .globl sun4v_con_getchar
1991 .type sun4v_con_getchar,#function
1994 mov HV_FAST_CONS_GETCHAR, %o5
2001 .size sun4v_con_getchar, .-sun4v_con_getchar
2003 /* %o0: signed long character
2005 * returns %o0: status
2007 .globl sun4v_con_putchar
2008 .type sun4v_con_putchar,#function
2010 mov HV_FAST_CONS_PUTCHAR, %o5
2014 .size sun4v_con_putchar, .-sun4v_con_putchar
2016 /* %o0: buffer real address
2018 * %o2: pointer to unsigned long bytes_read
2020 * returns %o0: status
2022 .globl sun4v_con_read
2023 .type sun4v_con_read,#function
2026 mov HV_FAST_CONS_READ, %o5
2029 cmp %o1, -1 /* break */
2032 cmp %o1, -2 /* hup */
2038 .size sun4v_con_read, .-sun4v_con_read
2040 /* %o0: buffer real address
2042 * %o2: pointer to unsigned long bytes_written
2044 * returns %o0: status
2046 .globl sun4v_con_write
2047 .type sun4v_con_write,#function
2050 mov HV_FAST_CONS_WRITE, %o5
2055 .size sun4v_con_write, .-sun4v_con_write
2058 * %o1: address of description string
2060 * returns %o0: status
2062 .globl sun4v_mach_set_soft_state
2063 .type sun4v_mach_set_soft_state,#function
2064 sun4v_mach_set_soft_state:
2065 mov HV_FAST_MACH_SET_SOFT_STATE, %o5
2069 .size sun4v_mach_set_soft_state, .-sun4v_mach_set_soft_state
2075 .globl sun4v_mach_exit
2076 .type sun4v_mach_exit,#function
2078 mov HV_FAST_MACH_EXIT, %o5
2082 .size sun4v_mach_exit, .-sun4v_mach_exit
2084 /* %o0: buffer real address
2085 * %o1: buffer length
2086 * %o2: pointer to unsigned long real_buf_len
2088 * returns %o0: status
2090 .globl sun4v_mach_desc
2091 .type sun4v_mach_desc,#function
2094 mov HV_FAST_MACH_DESC, %o5
2099 .size sun4v_mach_desc, .-sun4v_mach_desc
2101 /* %o0: new timeout in milliseconds
2102 * %o1: pointer to unsigned long orig_timeout
2104 * returns %o0: status
2106 .globl sun4v_mach_set_watchdog
2107 .type sun4v_mach_set_watchdog,#function
2108 sun4v_mach_set_watchdog:
2110 mov HV_FAST_MACH_SET_WATCHDOG, %o5
2115 .size sun4v_mach_set_watchdog, .-sun4v_mach_set_watchdog
2117 /* No inputs and does not return. */
2118 .globl sun4v_mach_sir
2119 .type sun4v_mach_sir,#function
2122 mov HV_FAST_MACH_SIR, %o5
2127 .size sun4v_mach_sir, .-sun4v_mach_sir
2133 * returns %o0: status
2135 .globl sun4v_ldc_tx_qconf
2136 .type sun4v_ldc_tx_qconf,#function
2138 mov HV_FAST_LDC_TX_QCONF, %o5
2142 .size sun4v_ldc_tx_qconf, .-sun4v_ldc_tx_qconf
2145 * %o1: pointer to unsigned long ra
2146 * %o2: pointer to unsigned long num_entries
2148 * returns %o0: status
2150 .globl sun4v_ldc_tx_qinfo
2151 .type sun4v_ldc_tx_qinfo,#function
2155 mov HV_FAST_LDC_TX_QINFO, %o5
2161 .size sun4v_ldc_tx_qinfo, .-sun4v_ldc_tx_qinfo
2164 * %o1: pointer to unsigned long head_off
2165 * %o2: pointer to unsigned long tail_off
2166 * %o2: pointer to unsigned long chan_state
2168 * returns %o0: status
2170 .globl sun4v_ldc_tx_get_state
2171 .type sun4v_ldc_tx_get_state,#function
2172 sun4v_ldc_tx_get_state:
2176 mov HV_FAST_LDC_TX_GET_STATE, %o5
2183 .size sun4v_ldc_tx_get_state, .-sun4v_ldc_tx_get_state
2188 * returns %o0: status
2190 .globl sun4v_ldc_tx_set_qtail
2191 .type sun4v_ldc_tx_set_qtail,#function
2192 sun4v_ldc_tx_set_qtail:
2193 mov HV_FAST_LDC_TX_SET_QTAIL, %o5
2197 .size sun4v_ldc_tx_set_qtail, .-sun4v_ldc_tx_set_qtail
2203 * returns %o0: status
2205 .globl sun4v_ldc_rx_qconf
2206 .type sun4v_ldc_rx_qconf,#function
2208 mov HV_FAST_LDC_RX_QCONF, %o5
2212 .size sun4v_ldc_rx_qconf, .-sun4v_ldc_rx_qconf
2215 * %o1: pointer to unsigned long ra
2216 * %o2: pointer to unsigned long num_entries
2218 * returns %o0: status
2220 .globl sun4v_ldc_rx_qinfo
2221 .type sun4v_ldc_rx_qinfo,#function
2225 mov HV_FAST_LDC_RX_QINFO, %o5
2231 .size sun4v_ldc_rx_qinfo, .-sun4v_ldc_rx_qinfo
2234 * %o1: pointer to unsigned long head_off
2235 * %o2: pointer to unsigned long tail_off
2236 * %o2: pointer to unsigned long chan_state
2238 * returns %o0: status
2240 .globl sun4v_ldc_rx_get_state
2241 .type sun4v_ldc_rx_get_state,#function
2242 sun4v_ldc_rx_get_state:
2246 mov HV_FAST_LDC_RX_GET_STATE, %o5
2253 .size sun4v_ldc_rx_get_state, .-sun4v_ldc_rx_get_state
2258 * returns %o0: status
2260 .globl sun4v_ldc_rx_set_qhead
2261 .type sun4v_ldc_rx_set_qhead,#function
2262 sun4v_ldc_rx_set_qhead:
2263 mov HV_FAST_LDC_RX_SET_QHEAD, %o5
2267 .size sun4v_ldc_rx_set_qhead, .-sun4v_ldc_rx_set_qhead
2273 * returns %o0: status
2275 .globl sun4v_ldc_set_map_table
2276 .type sun4v_ldc_set_map_table,#function
2277 sun4v_ldc_set_map_table:
2278 mov HV_FAST_LDC_SET_MAP_TABLE, %o5
2282 .size sun4v_ldc_set_map_table, .-sun4v_ldc_set_map_table
2285 * %o1: pointer to unsigned long ra
2286 * %o2: pointer to unsigned long num_entries
2288 * returns %o0: status
2290 .globl sun4v_ldc_get_map_table
2291 .type sun4v_ldc_get_map_table,#function
2292 sun4v_ldc_get_map_table:
2295 mov HV_FAST_LDC_GET_MAP_TABLE, %o5
2301 .size sun4v_ldc_get_map_table, .-sun4v_ldc_get_map_table
2308 * %o5: pointer to unsigned long actual_len
2310 * returns %o0: status
2312 .globl sun4v_ldc_copy
2313 .type sun4v_ldc_copy,#function
2316 mov HV_FAST_LDC_COPY, %o5
2321 .size sun4v_ldc_copy, .-sun4v_ldc_copy
2325 * %o2: pointer to unsigned long ra
2326 * %o3: pointer to unsigned long perm
2328 * returns %o0: status
2330 .globl sun4v_ldc_mapin
2331 .type sun4v_ldc_mapin,#function
2335 mov HV_FAST_LDC_MAPIN, %o5
2341 .size sun4v_ldc_mapin, .-sun4v_ldc_mapin
2345 * returns %o0: status
2347 .globl sun4v_ldc_unmap
2348 .type sun4v_ldc_unmap,#function
2350 mov HV_FAST_LDC_UNMAP, %o5
2354 .size sun4v_ldc_unmap, .-sun4v_ldc_unmap
2360 * returns %o0: status
2362 .globl sun4v_ldc_revoke
2363 .type sun4v_ldc_revoke,#function
2365 mov HV_FAST_LDC_REVOKE, %o5
2369 .size sun4v_ldc_revoke, .-sun4v_ldc_revoke
2371 /* %o0: device handle
2373 * %o2: pointer to unsigned long cookie
2375 * returns %o0: status
2377 .globl sun4v_vintr_get_cookie
2378 .type sun4v_vintr_get_cookie,#function
2379 sun4v_vintr_get_cookie:
2381 mov HV_FAST_VINTR_GET_COOKIE, %o5
2386 .size sun4v_vintr_get_cookie, .-sun4v_vintr_get_cookie
2388 /* %o0: device handle
2392 * returns %o0: status
2394 .globl sun4v_vintr_set_cookie
2395 .type sun4v_vintr_set_cookie,#function
2396 sun4v_vintr_set_cookie:
2397 mov HV_FAST_VINTR_SET_COOKIE, %o5
2401 .size sun4v_vintr_set_cookie, .-sun4v_vintr_set_cookie
2403 /* %o0: device handle
2405 * %o2: pointer to unsigned long valid_state
2407 * returns %o0: status
2409 .globl sun4v_vintr_get_valid
2410 .type sun4v_vintr_get_valid,#function
2411 sun4v_vintr_get_valid:
2413 mov HV_FAST_VINTR_GET_VALID, %o5
2418 .size sun4v_vintr_get_valid, .-sun4v_vintr_get_valid
2420 /* %o0: device handle
2424 * returns %o0: status
2426 .globl sun4v_vintr_set_valid
2427 .type sun4v_vintr_set_valid,#function
2428 sun4v_vintr_set_valid:
2429 mov HV_FAST_VINTR_SET_VALID, %o5
2433 .size sun4v_vintr_set_valid, .-sun4v_vintr_set_valid
2435 /* %o0: device handle
2437 * %o2: pointer to unsigned long state
2439 * returns %o0: status
2441 .globl sun4v_vintr_get_state
2442 .type sun4v_vintr_get_state,#function
2443 sun4v_vintr_get_state:
2445 mov HV_FAST_VINTR_GET_STATE, %o5
2450 .size sun4v_vintr_get_state, .-sun4v_vintr_get_state
2452 /* %o0: device handle
2456 * returns %o0: status
2458 .globl sun4v_vintr_set_state
2459 .type sun4v_vintr_set_state,#function
2460 sun4v_vintr_set_state:
2461 mov HV_FAST_VINTR_SET_STATE, %o5
2465 .size sun4v_vintr_set_state, .-sun4v_vintr_set_state
2467 /* %o0: device handle
2469 * %o2: pointer to unsigned long cpuid
2471 * returns %o0: status
2473 .globl sun4v_vintr_get_target
2474 .type sun4v_vintr_get_target,#function
2475 sun4v_vintr_get_target:
2477 mov HV_FAST_VINTR_GET_TARGET, %o5
2482 .size sun4v_vintr_get_target, .-sun4v_vintr_get_target
2484 /* %o0: device handle
2488 * returns %o0: status
2490 .globl sun4v_vintr_set_target
2491 .type sun4v_vintr_set_target,#function
2492 sun4v_vintr_set_target:
2493 mov HV_FAST_VINTR_SET_TARGET, %o5
2497 .size sun4v_vintr_set_target, .-sun4v_vintr_set_target
2499 /* %o0: NCS sub-function
2500 * %o1: sub-function arg real-address
2501 * %o2: sub-function arg size
2503 * returns %o0: status
2505 .globl sun4v_ncs_request
2506 .type sun4v_ncs_request,#function
2508 mov HV_FAST_NCS_REQUEST, %o5
2512 .size sun4v_ncs_request, .-sun4v_ncs_request
2514 .globl sun4v_svc_send
2515 .type sun4v_svc_send,#function
2521 mov HV_FAST_SVC_SEND, %o5
2526 .size sun4v_svc_send, .-sun4v_svc_send
2528 .globl sun4v_svc_recv
2529 .type sun4v_svc_recv,#function
2535 mov HV_FAST_SVC_RECV, %o5
2540 .size sun4v_svc_recv, .-sun4v_svc_recv
2542 .globl sun4v_svc_getstatus
2543 .type sun4v_svc_getstatus,#function
2544 sun4v_svc_getstatus:
2545 mov HV_FAST_SVC_GETSTATUS, %o5
2551 .size sun4v_svc_getstatus, .-sun4v_svc_getstatus
2553 .globl sun4v_svc_setstatus
2554 .type sun4v_svc_setstatus,#function
2555 sun4v_svc_setstatus:
2556 mov HV_FAST_SVC_SETSTATUS, %o5
2560 .size sun4v_svc_setstatus, .-sun4v_svc_setstatus
2562 .globl sun4v_svc_clrstatus
2563 .type sun4v_svc_clrstatus,#function
2564 sun4v_svc_clrstatus:
2565 mov HV_FAST_SVC_CLRSTATUS, %o5
2569 .size sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
2571 .globl sun4v_mmustat_conf
2572 .type sun4v_mmustat_conf,#function
2575 mov HV_FAST_MMUSTAT_CONF, %o5
2580 .size sun4v_mmustat_conf, .-sun4v_mmustat_conf
2582 .globl sun4v_mmustat_info
2583 .type sun4v_mmustat_info,#function
2586 mov HV_FAST_MMUSTAT_INFO, %o5
2591 .size sun4v_mmustat_info, .-sun4v_mmustat_info
2593 .globl sun4v_mmu_demap_all
2594 .type sun4v_mmu_demap_all,#function
2595 sun4v_mmu_demap_all:
2599 mov HV_FAST_MMU_DEMAP_ALL, %o5
2603 .size sun4v_mmu_demap_all, .-sun4v_mmu_demap_all