17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5a35baf17Shyw * Common Development and Distribution License (the "License"). 6a35baf17Shyw * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _KAIF_H 277c478bd9Sstevel@tonic-gate #define _KAIF_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef sun4v 327c478bd9Sstevel@tonic-gate #include <sys/spitregs.h> 337c478bd9Sstevel@tonic-gate #endif /* sun4v */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifndef _ASM 367c478bd9Sstevel@tonic-gate #include <kmdb/kmdb_dpi_impl.h> 377c478bd9Sstevel@tonic-gate #include <kmdb/kaif_regs.h> 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #ifdef __cplusplus 417c478bd9Sstevel@tonic-gate extern "C" { 427c478bd9Sstevel@tonic-gate #endif 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #define KAIF_CPU_STATE_NONE 0 457c478bd9Sstevel@tonic-gate #define KAIF_CPU_STATE_MASTER 1 467c478bd9Sstevel@tonic-gate #define KAIF_CPU_STATE_SLAVE 2 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #define KAIF_LSUCTL_VWAPT_MASK (LSU_VM|LSU_VR|LSU_VW) 497c478bd9Sstevel@tonic-gate #define KAIF_LSUCTL_PWAPT_MASK (LSU_PM|LSU_PR|LSU_PW) 507c478bd9Sstevel@tonic-gate #define KAIF_LSUCTL_WAPT_MASK (LSU_PM|LSU_VM|LSU_PR|LSU_PW|LSU_VR|LSU_VW) 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate #ifndef _ASM 537c478bd9Sstevel@tonic-gate extern kaif_cpusave_t *kaif_cpusave; 547c478bd9Sstevel@tonic-gate extern kaif_cpusave_t kaif_cb_save; 557c478bd9Sstevel@tonic-gate extern int kaif_ncpusave; 567c478bd9Sstevel@tonic-gate extern int kaif_master_cpuid; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate extern int *kaif_promexitarmp; 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate extern void (*kaif_ktrap_install)(int, void (*)(void)); 617c478bd9Sstevel@tonic-gate extern void (*kaif_ktrap_restore)(void); 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate extern caddr_t kaif_tba; 647c478bd9Sstevel@tonic-gate extern caddr_t kaif_tba_obp; 657c478bd9Sstevel@tonic-gate #ifdef sun4v 667c478bd9Sstevel@tonic-gate extern caddr_t kaif_tba_kernel; 677c478bd9Sstevel@tonic-gate #endif 687c478bd9Sstevel@tonic-gate extern caddr_t kaif_tba_native; 697c478bd9Sstevel@tonic-gate extern size_t kaif_tba_native_sz; 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate extern int kaif_trap_switch; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate extern void kaif_trap_set_debugger(void); 747c478bd9Sstevel@tonic-gate extern void kaif_trap_set_saved(kaif_cpusave_t *); 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate extern void kaif_hdlr_imiss(void); 777c478bd9Sstevel@tonic-gate extern caddr_t kaif_hdlr_imiss_patch; 787c478bd9Sstevel@tonic-gate extern void kaif_hdlr_dmiss(void); 797c478bd9Sstevel@tonic-gate extern caddr_t kaif_hdlr_dmiss_patch; 807c478bd9Sstevel@tonic-gate extern void kaif_hdlr_generic(void); 817c478bd9Sstevel@tonic-gate extern void kaif_dtrap(void); 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate extern caddr_t kaif_dseg_start; 847c478bd9Sstevel@tonic-gate extern caddr_t kaif_dseg_lim; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate extern uintptr_t kaif_invoke(uintptr_t, uint_t, const uintptr_t[], 877c478bd9Sstevel@tonic-gate kreg_t, kreg_t); 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate extern void kaif_enter(void); 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate extern void kaif_ktrap(void); 927c478bd9Sstevel@tonic-gate extern void kaif_slave_entry(void); 937c478bd9Sstevel@tonic-gate extern void kaif_trap_obp(void); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate extern void kaif_mod_loaded(struct modctl *); 967c478bd9Sstevel@tonic-gate extern void kaif_mod_unloading(struct modctl *); 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate extern void kaif_wapt_set_regs(void); 997c478bd9Sstevel@tonic-gate extern void kaif_wapt_clear_regs(void); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate extern void kaif_activate(kdi_debugvec_t **, uint_t); 1027c478bd9Sstevel@tonic-gate extern void kaif_deactivate(void); 1037c478bd9Sstevel@tonic-gate extern void kaif_resume(int); 1047c478bd9Sstevel@tonic-gate extern void kaif_slave_entry(void); 1057c478bd9Sstevel@tonic-gate extern void kaif_prom_rearm(void); 1067c478bd9Sstevel@tonic-gate extern void kaif_debugger_entry(kaif_cpusave_t *); 1077c478bd9Sstevel@tonic-gate 108a35baf17Shyw extern void kaif_slave_loop_barrier(void); 109a35baf17Shyw 1107c478bd9Sstevel@tonic-gate #endif 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1137c478bd9Sstevel@tonic-gate } 1147c478bd9Sstevel@tonic-gate #endif 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #endif /* _KAIF_H */ 117