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