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 5*ae115bc7Smrj * Common Development and Distribution License (the "License"). 6*ae115bc7Smrj * 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 _SYS_KDI_MACHIMPL_H 277c478bd9Sstevel@tonic-gate #define _SYS_KDI_MACHIMPL_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/modctl.h> 327c478bd9Sstevel@tonic-gate #include <sys/types.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* Return codes from the kdi_xc_one op */ 397c478bd9Sstevel@tonic-gate #define KDI_XC_RES_ERR -1 407c478bd9Sstevel@tonic-gate #define KDI_XC_RES_OK 0 417c478bd9Sstevel@tonic-gate #define KDI_XC_RES_BUSY 1 427c478bd9Sstevel@tonic-gate #define KDI_XC_RES_NACK 2 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate struct regs; 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate typedef struct kdi_mach { 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * Iterates through the CPUs in the ready set, invoking the 497c478bd9Sstevel@tonic-gate * caller-provided callback with the CPU ID of each one. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate int (*mkdi_cpu_ready_iter)(int (*)(int, void *), void *); 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate /* 547c478bd9Sstevel@tonic-gate * Send a two-argument cross-call to a specific CPU. 557c478bd9Sstevel@tonic-gate */ 567c478bd9Sstevel@tonic-gate int (*mkdi_xc_one)(int, void (*)(uintptr_t, uintptr_t), 577c478bd9Sstevel@tonic-gate uintptr_t, uintptr_t); 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 607c478bd9Sstevel@tonic-gate * Used by the state-saving code, at TL=1, to determine the current 617c478bd9Sstevel@tonic-gate * CPU's ID. This routine may only use registers %g1 and %g2, and 627c478bd9Sstevel@tonic-gate * must return the result in %g1. %g7 will contain the return address. 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate void (*mkdi_cpu_index)(void); 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Used by the trap handlers to retrieve TTEs for virtual addresses. 687c478bd9Sstevel@tonic-gate * This routine may use %g1-g6, and must return the result in %g1. %g7 697c478bd9Sstevel@tonic-gate * will contain the return address. 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate void (*mkdi_trap_vatotte)(void); 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate void (*mkdi_tickwait)(clock_t); 747c478bd9Sstevel@tonic-gate int (*mkdi_get_stick)(uint64_t *); 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate void (*mkdi_kernpanic)(struct regs *, uint_t); 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate void (*mkdi_cpu_init)(int, int, int, int); 797c478bd9Sstevel@tonic-gate } kdi_mach_t; 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate #define mkdi_cpu_ready_iter kdi_mach.mkdi_cpu_ready_iter 827c478bd9Sstevel@tonic-gate #define mkdi_xc_one kdi_mach.mkdi_xc_one 837c478bd9Sstevel@tonic-gate #define mkdi_cpu_index kdi_mach.mkdi_cpu_index 847c478bd9Sstevel@tonic-gate #define mkdi_trap_vatotte kdi_mach.mkdi_trap_vatotte 857c478bd9Sstevel@tonic-gate #define mkdi_tickwait kdi_mach.mkdi_tickwait 867c478bd9Sstevel@tonic-gate #define mkdi_get_stick kdi_mach.mkdi_get_stick 877c478bd9Sstevel@tonic-gate #define mkdi_kernpanic kdi_mach.mkdi_kernpanic 887c478bd9Sstevel@tonic-gate #define mkdi_cpu_init kdi_mach.mkdi_cpu_init 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate extern void kdi_cpu_index(void); 917c478bd9Sstevel@tonic-gate extern void kdi_trap_vatotte(void); 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate extern int kdi_watchdog_disable(void); 947c478bd9Sstevel@tonic-gate extern void kdi_watchdog_restore(void); 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate extern void kdi_tlb_page_lock(caddr_t, int); 977c478bd9Sstevel@tonic-gate extern void kdi_tlb_page_unlock(caddr_t, int); 987c478bd9Sstevel@tonic-gate 99*ae115bc7Smrj extern void kmdb_enter(void); 100*ae115bc7Smrj 1017c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1027c478bd9Sstevel@tonic-gate } 1037c478bd9Sstevel@tonic-gate #endif 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #endif /* _SYS_KDI_MACHIMPL_H */ 106