1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _CPU_SGNBLK_DEFS_H 28*7c478bd9Sstevel@tonic-gate #define _CPU_SGNBLK_DEFS_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifndef _ASM 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 39*7c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h> 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #endif /* _ASM */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* 44*7c478bd9Sstevel@tonic-gate * Build a CPU signature given a signature, state and sub-state. 45*7c478bd9Sstevel@tonic-gate */ 46*7c478bd9Sstevel@tonic-gate #define CPU_SIG_BLD(sig, state, sub_state) \ 47*7c478bd9Sstevel@tonic-gate (((sig) << 16) | ((state) << 8) | (sub_state)) 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate /* 50*7c478bd9Sstevel@tonic-gate * Definition of a CPU signature. 51*7c478bd9Sstevel@tonic-gate */ 52*7c478bd9Sstevel@tonic-gate typedef union { 53*7c478bd9Sstevel@tonic-gate struct cpu_signature { 54*7c478bd9Sstevel@tonic-gate ushort_t sig; /* see xxxx_SIG below. */ 55*7c478bd9Sstevel@tonic-gate uchar_t state; /* see SIGBST_xxxx below. */ 56*7c478bd9Sstevel@tonic-gate uchar_t sub_state; /* EXIT_xxx if SIGBST_EXIT. */ 57*7c478bd9Sstevel@tonic-gate } state_t; 58*7c478bd9Sstevel@tonic-gate uint32_t signature; 59*7c478bd9Sstevel@tonic-gate } sig_state_t; 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate /* 62*7c478bd9Sstevel@tonic-gate * CPU Signatures - the signature defines the entity that the CPU is executing. 63*7c478bd9Sstevel@tonic-gate * This entity can be the OS, OPB or the debugger. This signature consists of 64*7c478bd9Sstevel@tonic-gate * two ASCII characters. 65*7c478bd9Sstevel@tonic-gate */ 66*7c478bd9Sstevel@tonic-gate #define SIG_BLD(f, s) (((f) << 8) | (s)) 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate #define OBP_SIG SIG_BLD('O', 'B') 69*7c478bd9Sstevel@tonic-gate #define OS_SIG SIG_BLD('O', 'S') 70*7c478bd9Sstevel@tonic-gate #define DBG_SIG SIG_BLD('D', 'B') 71*7c478bd9Sstevel@tonic-gate #define POST_SIG SIG_BLD('P', 'O') 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate /* 74*7c478bd9Sstevel@tonic-gate * CPU State - the state identifies what the CPU is doing. 75*7c478bd9Sstevel@tonic-gate * The states should be defined in an increasing, linear 76*7c478bd9Sstevel@tonic-gate * manner. 77*7c478bd9Sstevel@tonic-gate */ 78*7c478bd9Sstevel@tonic-gate #define SIGST_NONE 0 79*7c478bd9Sstevel@tonic-gate #define SIGST_RUN 1 80*7c478bd9Sstevel@tonic-gate #define SIGST_EXIT 2 81*7c478bd9Sstevel@tonic-gate #define SIGST_PRERUN 3 82*7c478bd9Sstevel@tonic-gate #define SIGST_DOMAINSTOP 4 83*7c478bd9Sstevel@tonic-gate #define SIGST_RESET 5 84*7c478bd9Sstevel@tonic-gate #define SIGST_POWEROFF 6 85*7c478bd9Sstevel@tonic-gate #define SIGST_DETACHED 7 86*7c478bd9Sstevel@tonic-gate #define SIGST_CALLBACK 8 87*7c478bd9Sstevel@tonic-gate #define SIGST_OFFLINE 9 88*7c478bd9Sstevel@tonic-gate #define SIGST_BOOTING 10 89*7c478bd9Sstevel@tonic-gate #define SIGST_UNKNOWN 11 90*7c478bd9Sstevel@tonic-gate #define SIGST_ERROR_RESET 12 91*7c478bd9Sstevel@tonic-gate #define SIGST_ERROR_RESET_SYNC 13 92*7c478bd9Sstevel@tonic-gate #define SIGST_QUIESCED 14 93*7c478bd9Sstevel@tonic-gate #define SIGST_QUIESCE_INPROGRESS 15 94*7c478bd9Sstevel@tonic-gate #define SIGST_RESUME_INPROGRESS 16 95*7c478bd9Sstevel@tonic-gate #define SIGST_INIT 17 96*7c478bd9Sstevel@tonic-gate #define SIGST_LOADING 18 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate /* 99*7c478bd9Sstevel@tonic-gate * CPU sub-state - the sub-state is used to further qualify 100*7c478bd9Sstevel@tonic-gate * the state. 101*7c478bd9Sstevel@tonic-gate */ 102*7c478bd9Sstevel@tonic-gate #define SIGSUBST_NULL 0 103*7c478bd9Sstevel@tonic-gate #define SIGSUBST_HALT 1 104*7c478bd9Sstevel@tonic-gate #define SIGSUBST_ENVIRON 2 105*7c478bd9Sstevel@tonic-gate #define SIGSUBST_REBOOT 3 106*7c478bd9Sstevel@tonic-gate #define SIGSUBST_PANIC 4 107*7c478bd9Sstevel@tonic-gate #define SIGSUBST_PANIC_CONT 5 108*7c478bd9Sstevel@tonic-gate #define SIGSUBST_HUNG 6 109*7c478bd9Sstevel@tonic-gate #define SIGSUBST_WATCH 7 110*7c478bd9Sstevel@tonic-gate #define SIGSUBST_PANIC_REBOOT 8 111*7c478bd9Sstevel@tonic-gate #define SIGSUBST_ERROR_RESET_REBOOT 9 112*7c478bd9Sstevel@tonic-gate #define SIGSUBST_OBP_RESET 10 113*7c478bd9Sstevel@tonic-gate #define SIGSUBST_DEBUG 11 114*7c478bd9Sstevel@tonic-gate #define SIGSUBST_DUMP 12 115*7c478bd9Sstevel@tonic-gate #define SIGSUBST_FAILED 13 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate #define CPU_SIGNATURE(sig, state, sub_state, cpuid) \ 120*7c478bd9Sstevel@tonic-gate { \ 121*7c478bd9Sstevel@tonic-gate if (cpu_sgn_func) \ 122*7c478bd9Sstevel@tonic-gate (*cpu_sgn_func)((sig), (state), (sub_state), (cpuid)); \ 123*7c478bd9Sstevel@tonic-gate } 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate extern void (*cpu_sgn_func)(ushort_t, uchar_t, uchar_t, int); 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate #ifdef _STARFIRE 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate extern void register_bbus_intr(); 132*7c478bd9Sstevel@tonic-gate extern void cpu_sgn_mapin(int); 133*7c478bd9Sstevel@tonic-gate extern void cpu_sgn_mapout(int); 134*7c478bd9Sstevel@tonic-gate extern int cpu_sgn_exists(int); 135*7c478bd9Sstevel@tonic-gate extern ushort_t get_cpu_sgn(int); 136*7c478bd9Sstevel@tonic-gate extern uchar_t get_cpu_sgn_state(int); 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate #define REGISTER_BBUS_INTR() register_bbus_intr() 139*7c478bd9Sstevel@tonic-gate #define CPU_SGN_MAPIN(cpuid) cpu_sgn_mapin(cpuid) 140*7c478bd9Sstevel@tonic-gate #define CPU_SGN_MAPOUT(cpuid) cpu_sgn_mapout(cpuid) 141*7c478bd9Sstevel@tonic-gate #define CPU_SGN_EXISTS(cpuid) cpu_sgn_exists(cpuid) 142*7c478bd9Sstevel@tonic-gate #define SGN_CPU_IS_OS(cpuid) (get_cpu_sgn(cpuid) == OS_SIG) 143*7c478bd9Sstevel@tonic-gate #define SGN_CPU_IS_OBP(cpuid) (get_cpu_sgn(cpuid) == OBP_SIG) 144*7c478bd9Sstevel@tonic-gate #define SGN_CPU_STATE_IS_DETACHED(cpuid) \ 145*7c478bd9Sstevel@tonic-gate (get_cpu_sgn_state(cpuid) == SIGST_DETACHED) 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate #else 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate #define REGISTER_BBUS_INTR() 150*7c478bd9Sstevel@tonic-gate #define CPU_SGN_MAPIN(cpuid) 151*7c478bd9Sstevel@tonic-gate #define CPU_SGN_MAPOUT(cpuid) 152*7c478bd9Sstevel@tonic-gate #define CPU_SGN_EXISTS(cpuid) (0) 153*7c478bd9Sstevel@tonic-gate #define SGN_CPU_IS_OS(cpuid) (0) 154*7c478bd9Sstevel@tonic-gate #define SGN_CPU_IS_OBP(cpuid) (0) 155*7c478bd9Sstevel@tonic-gate #define SGN_CPU_STATE_IS_DETACHED(cpuid) (0) 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate #endif /* _STARFIRE */ 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 162*7c478bd9Sstevel@tonic-gate } 163*7c478bd9Sstevel@tonic-gate #endif 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate #endif /* _CPU_SGNBLK_DEFS_H */ 166