xref: /onnv-gate/usr/src/cmd/mdb/sparc/kmdb/kaif.h (revision 2011:c79d679743e6)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2011Shyw  * Common Development and Distribution License (the "License").
6*2011Shyw  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2011Shyw  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _KAIF_H
270Sstevel@tonic-gate #define	_KAIF_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef	sun4v
320Sstevel@tonic-gate #include <sys/spitregs.h>
330Sstevel@tonic-gate #endif	/* sun4v */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifndef _ASM
360Sstevel@tonic-gate #include <kmdb/kmdb_dpi_impl.h>
370Sstevel@tonic-gate #include <kmdb/kaif_regs.h>
380Sstevel@tonic-gate #endif
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #ifdef __cplusplus
410Sstevel@tonic-gate extern "C" {
420Sstevel@tonic-gate #endif
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #define	KAIF_MASTER_CPUID_UNSET		-1
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #define	KAIF_CPU_STATE_NONE		0
470Sstevel@tonic-gate #define	KAIF_CPU_STATE_MASTER		1
480Sstevel@tonic-gate #define	KAIF_CPU_STATE_SLAVE		2
490Sstevel@tonic-gate 
500Sstevel@tonic-gate #define	KAIF_CPU_CMD_RESUME		0
510Sstevel@tonic-gate #define	KAIF_CPU_CMD_RESUME_MASTER	1
520Sstevel@tonic-gate #define	KAIF_CPU_CMD_SWITCH		2
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #define	KAIF_LSUCTL_VWAPT_MASK	(LSU_VM|LSU_VR|LSU_VW)
550Sstevel@tonic-gate #define	KAIF_LSUCTL_PWAPT_MASK	(LSU_PM|LSU_PR|LSU_PW)
560Sstevel@tonic-gate #define	KAIF_LSUCTL_WAPT_MASK	(LSU_PM|LSU_VM|LSU_PR|LSU_PW|LSU_VR|LSU_VW)
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #ifndef _ASM
590Sstevel@tonic-gate extern kaif_cpusave_t *kaif_cpusave;
600Sstevel@tonic-gate extern kaif_cpusave_t kaif_cb_save;
610Sstevel@tonic-gate extern int kaif_ncpusave;
620Sstevel@tonic-gate extern int kaif_master_cpuid;
630Sstevel@tonic-gate 
640Sstevel@tonic-gate extern int *kaif_promexitarmp;
650Sstevel@tonic-gate 
660Sstevel@tonic-gate extern void (*kaif_ktrap_install)(int, void (*)(void));
670Sstevel@tonic-gate extern void (*kaif_ktrap_restore)(void);
680Sstevel@tonic-gate 
690Sstevel@tonic-gate extern caddr_t kaif_tba;
700Sstevel@tonic-gate extern caddr_t kaif_tba_obp;
710Sstevel@tonic-gate #ifdef	sun4v
720Sstevel@tonic-gate extern caddr_t	kaif_tba_kernel;
730Sstevel@tonic-gate #endif
740Sstevel@tonic-gate extern caddr_t kaif_tba_native;
750Sstevel@tonic-gate extern size_t kaif_tba_native_sz;
760Sstevel@tonic-gate 
770Sstevel@tonic-gate extern int kaif_trap_switch;
780Sstevel@tonic-gate 
790Sstevel@tonic-gate extern void kaif_trap_set_debugger(void);
800Sstevel@tonic-gate extern void kaif_trap_set_saved(kaif_cpusave_t *);
810Sstevel@tonic-gate 
820Sstevel@tonic-gate extern void kaif_hdlr_imiss(void);
830Sstevel@tonic-gate extern caddr_t kaif_hdlr_imiss_patch;
840Sstevel@tonic-gate extern void kaif_hdlr_dmiss(void);
850Sstevel@tonic-gate extern caddr_t kaif_hdlr_dmiss_patch;
860Sstevel@tonic-gate extern void kaif_hdlr_generic(void);
870Sstevel@tonic-gate extern void kaif_dtrap(void);
880Sstevel@tonic-gate 
890Sstevel@tonic-gate extern caddr_t kaif_dseg_start;
900Sstevel@tonic-gate extern caddr_t kaif_dseg_lim;
910Sstevel@tonic-gate 
920Sstevel@tonic-gate extern uintptr_t kaif_invoke(uintptr_t, uint_t, const uintptr_t[],
930Sstevel@tonic-gate     kreg_t, kreg_t);
940Sstevel@tonic-gate 
950Sstevel@tonic-gate extern void kaif_enter(void);
960Sstevel@tonic-gate 
970Sstevel@tonic-gate extern void kaif_ktrap(void);
980Sstevel@tonic-gate extern void kaif_slave_entry(void);
990Sstevel@tonic-gate extern void kaif_trap_obp(void);
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate extern void kaif_mod_loaded(struct modctl *);
1020Sstevel@tonic-gate extern void kaif_mod_unloading(struct modctl *);
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate extern void kaif_wapt_set_regs(void);
1050Sstevel@tonic-gate extern void kaif_wapt_clear_regs(void);
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate extern void kaif_activate(kdi_debugvec_t **, uint_t);
1080Sstevel@tonic-gate extern void kaif_deactivate(void);
1090Sstevel@tonic-gate extern void kaif_resume(int);
1100Sstevel@tonic-gate extern void kaif_slave_entry(void);
1110Sstevel@tonic-gate extern void kaif_prom_rearm(void);
1120Sstevel@tonic-gate extern void kaif_debugger_entry(kaif_cpusave_t *);
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate extern int kaif_memrange_add(caddr_t, size_t);
1150Sstevel@tonic-gate 
116*2011Shyw extern void kaif_slave_loop_barrier(void);
117*2011Shyw 
1180Sstevel@tonic-gate #endif
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate #ifdef __cplusplus
1210Sstevel@tonic-gate }
1220Sstevel@tonic-gate #endif
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate #endif /* _KAIF_H */
125