xref: /titanic_52/usr/src/cmd/mdb/sparc/kmdb/kaif.h (revision e5803b76927480e8f9b67b22201c484ccf4c2bcf)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _KAIF_H
27 #define	_KAIF_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifndef	sun4v
32 #include <sys/spitregs.h>
33 #endif	/* sun4v */
34 
35 #ifndef _ASM
36 #include <kmdb/kmdb_dpi_impl.h>
37 #include <kmdb/kaif_regs.h>
38 #endif
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #define	KAIF_CPU_STATE_NONE		0
45 #define	KAIF_CPU_STATE_MASTER		1
46 #define	KAIF_CPU_STATE_SLAVE		2
47 
48 #define	KAIF_LSUCTL_VWAPT_MASK	(LSU_VM|LSU_VR|LSU_VW)
49 #define	KAIF_LSUCTL_PWAPT_MASK	(LSU_PM|LSU_PR|LSU_PW)
50 #define	KAIF_LSUCTL_WAPT_MASK	(LSU_PM|LSU_VM|LSU_PR|LSU_PW|LSU_VR|LSU_VW)
51 
52 #ifndef _ASM
53 extern kaif_cpusave_t *kaif_cpusave;
54 extern kaif_cpusave_t kaif_cb_save;
55 extern int kaif_ncpusave;
56 extern int kaif_master_cpuid;
57 
58 extern int *kaif_promexitarmp;
59 
60 extern void (*kaif_ktrap_install)(int, void (*)(void));
61 extern void (*kaif_ktrap_restore)(void);
62 
63 extern caddr_t kaif_tba;
64 extern caddr_t kaif_tba_obp;
65 #ifdef	sun4v
66 extern caddr_t	kaif_tba_kernel;
67 #endif
68 extern caddr_t kaif_tba_native;
69 extern size_t kaif_tba_native_sz;
70 
71 extern int kaif_trap_switch;
72 
73 extern void kaif_trap_set_debugger(void);
74 extern void kaif_trap_set_saved(kaif_cpusave_t *);
75 
76 extern void kaif_hdlr_imiss(void);
77 extern caddr_t kaif_hdlr_imiss_patch;
78 extern void kaif_hdlr_dmiss(void);
79 extern caddr_t kaif_hdlr_dmiss_patch;
80 extern void kaif_hdlr_generic(void);
81 extern void kaif_dtrap(void);
82 
83 extern caddr_t kaif_dseg_start;
84 extern caddr_t kaif_dseg_lim;
85 
86 extern uintptr_t kaif_invoke(uintptr_t, uint_t, const uintptr_t[],
87     kreg_t, kreg_t);
88 
89 extern void kaif_enter(void);
90 
91 extern void kaif_ktrap(void);
92 extern void kaif_slave_entry(void);
93 extern void kaif_trap_obp(void);
94 
95 extern void kaif_mod_loaded(struct modctl *);
96 extern void kaif_mod_unloading(struct modctl *);
97 
98 extern void kaif_wapt_set_regs(void);
99 extern void kaif_wapt_clear_regs(void);
100 
101 extern void kaif_activate(kdi_debugvec_t **, uint_t);
102 extern void kaif_deactivate(void);
103 extern void kaif_resume(int);
104 extern void kaif_slave_entry(void);
105 extern void kaif_prom_rearm(void);
106 extern void kaif_debugger_entry(kaif_cpusave_t *);
107 
108 extern void kaif_slave_loop_barrier(void);
109 
110 #endif
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* _KAIF_H */
117