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