17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
5ae115bcmrj * Common Development and Distribution License (the "License").
6ae115bcmrj * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
217c478bdstevel@tonic-gate/*
22ae115bcmrj * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bdstevel@tonic-gate * Use is subject to license terms.
247c478bdstevel@tonic-gate */
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate#ifndef _SYS_KDI_MACHIMPL_H
277c478bdstevel@tonic-gate#define	_SYS_KDI_MACHIMPL_H
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bdstevel@tonic-gate
317c478bdstevel@tonic-gate#include <sys/modctl.h>
327c478bdstevel@tonic-gate#include <sys/types.h>
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate#ifdef __cplusplus
357c478bdstevel@tonic-gateextern "C" {
367c478bdstevel@tonic-gate#endif
377c478bdstevel@tonic-gate
387c478bdstevel@tonic-gate/* Return codes from the kdi_xc_one op */
397c478bdstevel@tonic-gate#define	KDI_XC_RES_ERR		-1
407c478bdstevel@tonic-gate#define	KDI_XC_RES_OK		0
417c478bdstevel@tonic-gate#define	KDI_XC_RES_BUSY		1
427c478bdstevel@tonic-gate#define	KDI_XC_RES_NACK		2
437c478bdstevel@tonic-gate
447c478bdstevel@tonic-gatestruct regs;
457c478bdstevel@tonic-gate
467c478bdstevel@tonic-gatetypedef struct kdi_mach {
477c478bdstevel@tonic-gate	/*
487c478bdstevel@tonic-gate	 * Iterates through the CPUs in the ready set, invoking the
497c478bdstevel@tonic-gate	 * caller-provided callback with the CPU ID of each one.
507c478bdstevel@tonic-gate	 */
517c478bdstevel@tonic-gate	int (*mkdi_cpu_ready_iter)(int (*)(int, void *), void *);
527c478bdstevel@tonic-gate
537c478bdstevel@tonic-gate	/*
547c478bdstevel@tonic-gate	 * Send a two-argument cross-call to a specific CPU.
557c478bdstevel@tonic-gate	 */
567c478bdstevel@tonic-gate	int (*mkdi_xc_one)(int, void (*)(uintptr_t, uintptr_t),
577c478bdstevel@tonic-gate	    uintptr_t, uintptr_t);
587c478bdstevel@tonic-gate
597c478bdstevel@tonic-gate	/*
607c478bdstevel@tonic-gate	 * Used by the state-saving code, at TL=1, to determine the current
617c478bdstevel@tonic-gate	 * CPU's ID.  This routine may only use registers %g1 and %g2, and
627c478bdstevel@tonic-gate	 * must return the result in %g1.  %g7 will contain the return address.
637c478bdstevel@tonic-gate	 */
647c478bdstevel@tonic-gate	void (*mkdi_cpu_index)(void);
657c478bdstevel@tonic-gate
667c478bdstevel@tonic-gate	/*
677c478bdstevel@tonic-gate	 * Used by the trap handlers to retrieve TTEs for virtual addresses.
687c478bdstevel@tonic-gate	 * This routine may use %g1-g6, and must return the result in %g1.  %g7
697c478bdstevel@tonic-gate	 * will contain the return address.
707c478bdstevel@tonic-gate	 */
717c478bdstevel@tonic-gate	void (*mkdi_trap_vatotte)(void);
727c478bdstevel@tonic-gate
737c478bdstevel@tonic-gate	void (*mkdi_tickwait)(clock_t);
747c478bdstevel@tonic-gate	int (*mkdi_get_stick)(uint64_t *);
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gate	void (*mkdi_kernpanic)(struct regs *, uint_t);
777c478bdstevel@tonic-gate
787c478bdstevel@tonic-gate	void (*mkdi_cpu_init)(int, int, int, int);
797c478bdstevel@tonic-gate} kdi_mach_t;
807c478bdstevel@tonic-gate
817c478bdstevel@tonic-gate#define	mkdi_cpu_ready_iter	kdi_mach.mkdi_cpu_ready_iter
827c478bdstevel@tonic-gate#define	mkdi_xc_one		kdi_mach.mkdi_xc_one
837c478bdstevel@tonic-gate#define	mkdi_cpu_index		kdi_mach.mkdi_cpu_index
847c478bdstevel@tonic-gate#define	mkdi_trap_vatotte	kdi_mach.mkdi_trap_vatotte
857c478bdstevel@tonic-gate#define	mkdi_tickwait		kdi_mach.mkdi_tickwait
867c478bdstevel@tonic-gate#define	mkdi_get_stick		kdi_mach.mkdi_get_stick
877c478bdstevel@tonic-gate#define	mkdi_kernpanic		kdi_mach.mkdi_kernpanic
887c478bdstevel@tonic-gate#define	mkdi_cpu_init		kdi_mach.mkdi_cpu_init
897c478bdstevel@tonic-gate
907c478bdstevel@tonic-gateextern void kdi_cpu_index(void);
917c478bdstevel@tonic-gateextern void kdi_trap_vatotte(void);
927c478bdstevel@tonic-gate
937c478bdstevel@tonic-gateextern int kdi_watchdog_disable(void);
947c478bdstevel@tonic-gateextern void kdi_watchdog_restore(void);
957c478bdstevel@tonic-gate
967c478bdstevel@tonic-gateextern void kdi_tlb_page_lock(caddr_t, int);
977c478bdstevel@tonic-gateextern void kdi_tlb_page_unlock(caddr_t, int);
987c478bdstevel@tonic-gate
99ae115bcmrjextern void kmdb_enter(void);
100ae115bcmrj
1017c478bdstevel@tonic-gate#ifdef __cplusplus
1027c478bdstevel@tonic-gate}
1037c478bdstevel@tonic-gate#endif
1047c478bdstevel@tonic-gate
1057c478bdstevel@tonic-gate#endif /* _SYS_KDI_MACHIMPL_H */
106