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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FM_PROTOCOL_H
#define _SYS_FM_PROTOCOL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#include <sys/varargs.h>
#include <sys/nvpair.h>
#else
#include <libnvpair.h>
#include <stdarg.h>
#endif
#include <sys/processor.h>
/* FM common member names */
#define FM_CLASS "class"
#define FM_VERSION "version"
/* FM event class values */
#define FM_EREPORT_CLASS "ereport"
#define FM_FAULT_CLASS "fault"
#define FM_RSRC_CLASS "resource"
#define FM_LIST_EVENT "list"
#define FM_LIST_SUSPECT_CLASS FM_LIST_EVENT ".suspect"
/* ereport class subcategory values */
#define FM_ERROR_CPU "cpu"
#define FM_ERROR_IO "io"
/* ereport version and payload member names */
#define FM_EREPORT_VERS0 0
#define FM_EREPORT_VERSION FM_EREPORT_VERS0
/* ereport payload member names */
#define FM_EREPORT_DETECTOR "detector"
#define FM_EREPORT_ENA "ena"
/* list event payload member names */
#define FM_LIST_EVENT_SIZE "list-sz"
/* list.suspect versions and payload member names */
#define FM_SUSPECT_UUID "uuid"
#define FM_SUSPECT_DIAG_CODE "code"
#define FM_SUSPECT_DIAG_TIME "diag-time"
#define FM_SUSPECT_DE "de"
#define FM_SUSPECT_FAULT_LIST "fault-list"
#define FM_SUSPECT_FAULT_SZ "fault-list-sz"
#define FM_SUSPECT_MESSAGE "message"
#define FM_SUSPECT_VERS0 0
#define FM_SUSPECT_VERSION FM_SUSPECT_VERS0
/* fault event versions and payload member names */
#define FM_FAULT_VERS0 0
#define FM_FAULT_VERSION FM_FAULT_VERS0
#define FM_FAULT_ASRU "asru"
#define FM_FAULT_FRU "fru"
#define FM_FAULT_FRU_LABEL "fru-label"
#define FM_FAULT_CERTAINTY "certainty"
#define FM_FAULT_RESOURCE "resource"
/* resource event versions and payload member names */
#define FM_RSRC_VERS0 0
#define FM_RSRC_VERSION FM_RSRC_VERS0
#define FM_RSRC_RESOURCE "resource"
/* resource.*.asru.* payload member names */
#define FM_RSRC_ASRU_UUID "uuid"
#define FM_RSRC_ASRU_FAULTY "faulty"
#define FM_RSRC_ASRU_UNUSABLE "unusable"
#define FM_RSRC_ASRU_EVENT "event"
/*
* FM ENA Format Macros
*/
#define ENA_FORMAT_MASK 0x3
#define ENA_FORMAT(ena) ((ena) & ENA_FORMAT_MASK)
/* ENA format types */
#define FM_ENA_FMT0 0
#define FM_ENA_FMT1 1
#define FM_ENA_FMT2 2
/* Format 1 */
#define ENA_FMT1_GEN_MASK 0x00000000000003FCull
#define ENA_FMT1_ID_MASK 0xFFFFFFFFFFFFFC00ull
#define ENA_FMT1_CPUID_MASK 0x00000000000FFC00ull
#define ENA_FMT1_TIME_MASK 0xFFFFFFFFFFF00000ull
#define ENA_FMT1_GEN_SHFT 2
#define ENA_FMT1_ID_SHFT 10
#define ENA_FMT1_CPUID_SHFT ENA_FMT1_ID_SHFT
#define ENA_FMT1_TIME_SHFT 20
/* Format 2 */
#define ENA_FMT2_GEN_MASK 0x00000000000003FCull
#define ENA_FMT2_ID_MASK 0xFFFFFFFFFFFFFC00ull
#define ENA_FMT2_TIME_MASK ENA_FMT2_ID_MASK
#define ENA_FMT2_GEN_SHFT 2
#define ENA_FMT2_ID_SHFT 10
#define ENA_FMT2_TIME_SHFT ENA_FMT2_ID_SHFT
/* Common FMRI type names */
#define FM_FMRI_AUTHORITY "authority"
#define FM_FMRI_SCHEME "scheme"
#define FM_FMRI_SVC_AUTHORITY "svc-authority"
/* FMRI authority-type member names */
#define FM_FMRI_AUTH_CHASSIS "chassis-id"
#define FM_FMRI_AUTH_PRODUCT "product-id"
#define FM_FMRI_AUTH_DOMAIN "domain-id"
#define FM_FMRI_AUTH_SERVER "server-id"
#define FM_FMRI_AUTH_HOST "host-id"
#define FM_AUTH_VERS0 0
#define FM_FMRI_AUTH_VERSION FM_AUTH_VERS0
/* scheme name values */
#define FM_FMRI_SCHEME_FMD "fmd"
#define FM_FMRI_SCHEME_DEV "dev"
#define FM_FMRI_SCHEME_HC "hc"
#define FM_FMRI_SCHEME_SVC "svc"
#define FM_FMRI_SCHEME_CPU "cpu"
#define FM_FMRI_SCHEME_MEM "mem"
#define FM_FMRI_SCHEME_MOD "mod"
#define FM_FMRI_SCHEME_PKG "pkg"
#define FM_FMRI_SCHEME_LEGACY "legacy-hc"
/* Scheme versions */
#define FMD_SCHEME_VERSION0 0
#define FM_FMD_SCHEME_VERSION FMD_SCHEME_VERSION0
#define DEV_SCHEME_VERSION0 0
#define FM_DEV_SCHEME_VERSION DEV_SCHEME_VERSION0
#define FM_HC_VERS0 0
#define FM_HC_SCHEME_VERSION FM_HC_VERS0
#define CPU_SCHEME_VERSION0 0
#define FM_CPU_SCHEME_VERSION CPU_SCHEME_VERSION0
#define MEM_SCHEME_VERSION0 0
#define FM_MEM_SCHEME_VERSION MEM_SCHEME_VERSION0
#define MOD_SCHEME_VERSION0 0
#define FM_MOD_SCHEME_VERSION MOD_SCHEME_VERSION0
#define PKG_SCHEME_VERSION0 0
#define FM_PKG_SCHEME_VERSION PKG_SCHEME_VERSION0
#define LEGACY_SCHEME_VERSION0 0
#define FM_LEGACY_SCHEME_VERSION LEGACY_SCHEME_VERSION0
/* hc scheme member names */
#define FM_FMRI_HC_SERIAL_ID "serial"
#define FM_FMRI_HC_PART "part"
#define FM_FMRI_HC_REVISION "revision"
#define FM_FMRI_HC_ROOT "hc-root"
#define FM_FMRI_HC_LIST_SZ "hc-list-sz"
#define FM_FMRI_HC_LIST "hc-list"
/* hc-list version and member names */
#define FM_FMRI_HC_NAME "hc-name"
#define FM_FMRI_HC_ID "hc-id"
#define HC_LIST_VERSION0 0
#define FM_HC_LIST_VERSION HC_LIST_VERSION0
/* fmd module scheme member names */
#define FM_FMRI_FMD_NAME "mod-name"
#define FM_FMRI_FMD_VERSION "mod-version"
/* dev scheme member names */
#define FM_FMRI_DEV_ID "devid"
#define FM_FMRI_DEV_PATH "device-path"
/* pkg scheme member names */
#define FM_FMRI_PKG_BASEDIR "pkg-basedir"
#define FM_FMRI_PKG_INST "pkg-inst"
#define FM_FMRI_PKG_VERSION "pkg-version"
/* svc scheme member names */
#define FM_FMRI_SVC_NAME "service-name"
#define FM_FMRI_SVC_VERSION "service-version"
#define FM_FMRI_SVC_INSTANCE "instance"
#define FM_FMRI_SVC_CONTRACT_ID "contract-id"
/* svc-authority member names */
#define FM_FMRI_SVC_AUTH_SCOPE "scope"
#define FM_FMRI_SVC_AUTH_SYSTEM_FQN "system-FQN"
/* cpu scheme member names */
#define FM_FMRI_CPU_ID "cpuid"
#define FM_FMRI_CPU_SERIAL_ID "serial"
#define FM_FMRI_CPU_MASK "cpumask"
/* legacy-hc scheme member names */
#define FM_FMRI_LEGACY_HC "component"
/* mem scheme member names */
#define FM_FMRI_MEM_UNUM "unum"
#define FM_FMRI_MEM_SERIAL_ID "serial"
#define FM_FMRI_MEM_PHYSADDR "physaddr"
/* mod scheme member names */
#define FM_FMRI_MOD_PKG "mod-pkg"
#define FM_FMRI_MOD_NAME "mod-name"
#define FM_FMRI_MOD_ID "mod-id"
#define FM_FMRI_MOD_DESC "mod-desc"
extern nv_alloc_t *fm_nva_xcreate(char *, size_t);
extern void fm_nva_xdestroy(nv_alloc_t *);
extern nvlist_t *fm_nvlist_create(nv_alloc_t *);
extern void fm_nvlist_destroy(nvlist_t *, int);
#define FM_NVA_FREE 0 /* free allocator on nvlist_destroy */
#define FM_NVA_RETAIN 1 /* keep allocator on nvlist_destroy */
extern void fm_ereport_set(nvlist_t *, int, const char *, uint64_t,
const nvlist_t *, ...);
extern void fm_payload_set(nvlist_t *, ...);
extern int i_fm_payload_set(nvlist_t *, const char *, va_list);
extern void fm_fmri_hc_set(nvlist_t *, int, const nvlist_t *, const char *,
const char *, const char *, const char *, uint32_t, ...);
extern void fm_fmri_dev_set(nvlist_t *, int, const nvlist_t *, const char *,
const char *);
extern void fm_fmri_de_set(nvlist_t *, int, const nvlist_t *, const char *);
extern void fm_fmri_cpu_set(nvlist_t *, int, const nvlist_t *, uint32_t,
uint8_t, uint64_t);
extern void fm_fmri_mem_set(nvlist_t *, int, const nvlist_t *, const char *,
const char *);
extern void fm_authority_set(nvlist_t *, int, const char *, const char *,
const char *, const char *);
extern uint64_t fm_ena_increment(uint64_t);
extern uint64_t fm_ena_generate(uint64_t, uchar_t);
extern uint64_t fm_ena_generate_cpu(uint64_t, processorid_t, uchar_t);
extern uint64_t fm_ena_generation_get(uint64_t);
extern uchar_t fm_ena_format_get(uint64_t);
extern uint64_t fm_ena_id_get(uint64_t);
extern uint64_t fm_ena_time_get(uint64_t);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FM_PROTOCOL_H */
|