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