xref: /titanic_50/usr/src/cmd/mdb/sparc/kmdb/kaif.h (revision df4cb6e0bcfc660e38e1e96ccd7b794c0466228a)
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 2006 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_MASTER_CPUID_UNSET		-1
45 
46 #define	KAIF_CPU_STATE_NONE		0
47 #define	KAIF_CPU_STATE_MASTER		1
48 #define	KAIF_CPU_STATE_SLAVE		2
49 
50 #define	KAIF_CPU_CMD_RESUME		0
51 #define	KAIF_CPU_CMD_RESUME_MASTER	1
52 #define	KAIF_CPU_CMD_SWITCH		2
53 
54 #define	KAIF_LSUCTL_VWAPT_MASK	(LSU_VM|LSU_VR|LSU_VW)
55 #define	KAIF_LSUCTL_PWAPT_MASK	(LSU_PM|LSU_PR|LSU_PW)
56 #define	KAIF_LSUCTL_WAPT_MASK	(LSU_PM|LSU_VM|LSU_PR|LSU_PW|LSU_VR|LSU_VW)
57 
58 #ifndef _ASM
59 extern kaif_cpusave_t *kaif_cpusave;
60 extern kaif_cpusave_t kaif_cb_save;
61 extern int kaif_ncpusave;
62 extern int kaif_master_cpuid;
63 
64 extern int *kaif_promexitarmp;
65 
66 extern void (*kaif_ktrap_install)(int, void (*)(void));
67 extern void (*kaif_ktrap_restore)(void);
68 
69 extern caddr_t kaif_tba;
70 extern caddr_t kaif_tba_obp;
71 #ifdef	sun4v
72 extern caddr_t	kaif_tba_kernel;
73 #endif
74 extern caddr_t kaif_tba_native;
75 extern size_t kaif_tba_native_sz;
76 
77 extern int kaif_trap_switch;
78 
79 extern void kaif_trap_set_debugger(void);
80 extern void kaif_trap_set_saved(kaif_cpusave_t *);
81 
82 extern void kaif_hdlr_imiss(void);
83 extern caddr_t kaif_hdlr_imiss_patch;
84 extern void kaif_hdlr_dmiss(void);
85 extern caddr_t kaif_hdlr_dmiss_patch;
86 extern void kaif_hdlr_generic(void);
87 extern void kaif_dtrap(void);
88 
89 extern caddr_t kaif_dseg_start;
90 extern caddr_t kaif_dseg_lim;
91 
92 extern uintptr_t kaif_invoke(uintptr_t, uint_t, const uintptr_t[],
93     kreg_t, kreg_t);
94 
95 extern void kaif_enter(void);
96 
97 extern void kaif_ktrap(void);
98 extern void kaif_slave_entry(void);
99 extern void kaif_trap_obp(void);
100 
101 extern void kaif_mod_loaded(struct modctl *);
102 extern void kaif_mod_unloading(struct modctl *);
103 
104 extern void kaif_wapt_set_regs(void);
105 extern void kaif_wapt_clear_regs(void);
106 
107 extern void kaif_activate(kdi_debugvec_t **, uint_t);
108 extern void kaif_deactivate(void);
109 extern void kaif_resume(int);
110 extern void kaif_slave_entry(void);
111 extern void kaif_prom_rearm(void);
112 extern void kaif_debugger_entry(kaif_cpusave_t *);
113 
114 extern int kaif_memrange_add(caddr_t, size_t);
115 
116 extern void kaif_slave_loop_barrier(void);
117 
118 #endif
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif /* _KAIF_H */
125