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