xref: /titanic_41/usr/src/uts/sparc/sys/kdi_machimpl.h (revision 0eb822a1c0c2bea495647510b75f77f0e57633eb)
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 _SYS_KDI_MACHIMPL_H
28 #define	_SYS_KDI_MACHIMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/modctl.h>
33 #include <sys/types.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /* Return codes from the kdi_xc_one op */
40 #define	KDI_XC_RES_ERR		-1
41 #define	KDI_XC_RES_OK		0
42 #define	KDI_XC_RES_BUSY		1
43 #define	KDI_XC_RES_NACK		2
44 
45 struct regs;
46 
47 typedef struct kdi_mach {
48 	/*
49 	 * Iterates through the CPUs in the ready set, invoking the
50 	 * caller-provided callback with the CPU ID of each one.
51 	 */
52 	int (*mkdi_cpu_ready_iter)(int (*)(int, void *), void *);
53 
54 	/*
55 	 * Send a two-argument cross-call to a specific CPU.
56 	 */
57 	int (*mkdi_xc_one)(int, void (*)(uintptr_t, uintptr_t),
58 	    uintptr_t, uintptr_t);
59 
60 	/*
61 	 * Used by the state-saving code, at TL=1, to determine the current
62 	 * CPU's ID.  This routine may only use registers %g1 and %g2, and
63 	 * must return the result in %g1.  %g7 will contain the return address.
64 	 */
65 	void (*mkdi_cpu_index)(void);
66 
67 	/*
68 	 * Used by the trap handlers to retrieve TTEs for virtual addresses.
69 	 * This routine may use %g1-g6, and must return the result in %g1.  %g7
70 	 * will contain the return address.
71 	 */
72 	void (*mkdi_trap_vatotte)(void);
73 
74 	void (*mkdi_tickwait)(clock_t);
75 	int (*mkdi_get_stick)(uint64_t *);
76 
77 	void (*mkdi_kernpanic)(struct regs *, uint_t);
78 
79 	void (*mkdi_cpu_init)(int, int, int, int);
80 } kdi_mach_t;
81 
82 #define	mkdi_cpu_ready_iter	kdi_mach.mkdi_cpu_ready_iter
83 #define	mkdi_xc_one		kdi_mach.mkdi_xc_one
84 #define	mkdi_cpu_index		kdi_mach.mkdi_cpu_index
85 #define	mkdi_trap_vatotte	kdi_mach.mkdi_trap_vatotte
86 #define	mkdi_tickwait		kdi_mach.mkdi_tickwait
87 #define	mkdi_get_stick		kdi_mach.mkdi_get_stick
88 #define	mkdi_kernpanic		kdi_mach.mkdi_kernpanic
89 #define	mkdi_cpu_init		kdi_mach.mkdi_cpu_init
90 
91 extern void kdi_cpu_index(void);
92 extern void kdi_trap_vatotte(void);
93 
94 extern int kdi_watchdog_disable(void);
95 extern void kdi_watchdog_restore(void);
96 
97 extern void kdi_tlb_page_lock(caddr_t, int);
98 extern void kdi_tlb_page_unlock(caddr_t, int);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* _SYS_KDI_MACHIMPL_H */
105