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
|
'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (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]
.TH SCSI_VU_ERRMSG 9F "April 9, 2016"
.SH NAME
scsi_vu_errmsg \- display a SCSI request sense message
.SH SYNOPSIS
.LP
.nf
#include <sys/scsi/scsi.h>
\fBvoid\fR \fBscsi_vu_errmsg\fR(\fBstruct scsi_pkt\fR \fI*pktp\fR, \fBchar\fR \fI*drv_name\fR, \fBint severity,\fR
\fBint err_blkno,\fR \fBstruct scsi_key_strings\fR \fI*cmdlist\fR,
\fBstruct scsi_extended_sense\fR \fI*sensep\fR,
\fBstruct scsi_asq_key_strings\fR \fI*asc_list\fR,
\fBchar **decode_fru struct scsi_device\fR\fI*\fR, char \fI*\fR, int, char);
.fi
.SH INTERFACE LEVEL
.LP
Solaris DDI specific (Solaris DDI).
.SH PARAMETERS
.LP
The following parameters are supported:
.sp
.ne 2
.na
\fB\fIdevp\fR\fR
.ad
.RS 14n
Pointer to the \fBscsi_device\fR(9S) structure.
.RE
.sp
.ne 2
.na
\fB\fIpktp\fR\fR
.ad
.RS 14n
Pointer to a \fBscsi_pkt\fR(9S) structure.
.RE
.sp
.ne 2
.na
\fB\fIdrv_name\fR\fR
.ad
.RS 14n
String used by \fBscsi_log\fR(9F).
.RE
.sp
.ne 2
.na
\fB\fIseverity\fR\fR
.ad
.RS 14n
Error severity level, maps to severity strings below.
.RE
.sp
.ne 2
.na
\fB\fIblkno\fR\fR
.ad
.RS 14n
Requested block number.
.RE
.sp
.ne 2
.na
\fB\fIerr_blkno\fR\fR
.ad
.RS 14n
Error block number.
.RE
.sp
.ne 2
.na
\fB\fIcmdlist\fR\fR
.ad
.RS 14n
An array of SCSI command description strings.
.RE
.sp
.ne 2
.na
\fB\fIsensep\fR\fR
.ad
.RS 14n
A pointer to a \fBscsi_extended_sense\fR(9S) structure.
.RE
.sp
.ne 2
.na
\fB\fIasc_list\fR\fR
.ad
.RS 14n
A pointer to a array of asc and ascq message list.The list must be terminated
with \fB-1\fR asc value.
.RE
.sp
.ne 2
.na
\fB\fIdecode_fru\fR\fR
.ad
.RS 14n
This is a function pointer that will be called after the entire sense
information has been decoded. The parameters will be the scsi_device structure
to identify the device. Second argument will be a pointer to a buffer of length
specified by third argument. The fourth argument will be the FRU byte.
\fIdecode_fru\fR might be \fINULL\fR if no special decoding is required.
\fIdecode_fru\fR is expected to return pointer to a char string if decoding
possible and \fINULL\fR if no decoding is possible.
.RE
.SH DESCRIPTION
.LP
This function is very similar to \fBscsi_errmsg\fR(9F) but allows decoding of
vendor-unique ASC/ASCQ and FRU information.
.sp
.LP
The \fBscsi_vu_errmsg()\fR function interprets the request sense information in
the \fIsensep\fR pointer and generates a standard message that is displayed
using \fBscsi_log\fR(9F). It first searches the list array for a matching
vendor unique code if supplied. If it does not find one in the list then the
standard list is searched. The first line of the message is always a
\fBCE_WARN\fR, with the continuation lines being \fBCE_CONT\fR. \fIsensep\fR
may be \fINULL\fR, in which case no sense key or vendor information is
displayed.
.sp
.LP
The driver should make the determination as to when to call this function based
on the severity of the failure and the severity level that the driver wants to
report.
.sp
.LP
The \fBscsi_device\fR(9S) structure denoted by \fIdevp\fR supplies the
identification of the device that requested the display. \fIseverity\fR selects
which string is used in the Error Level: reporting, according to the table
below:
.sp
.in +2
.nf
Severity Value: String:
SCSI_ERR_ALL All
SCSI_ERR_UNKNOWN Unknown
SCSI_ERR_INFO Information
SCSI_ERR_RECOVERED Recovered
SCSI_ERR_RETRYABLE Retryable
SCSI_ERR_FATAL Fatal
.fi
.in -2
.sp
.LP
\fIblkno\fR is the block number of the original request that generated the
error. \fIerr_blkno\fR is the block number where the error occurred.
\fIcmdlist\fR is a mapping table for translating the SCSI command code in pktp
to the actual command string.
.sp
.LP
The \fIcmdlist\fR is described in the structure below:
.sp
.in +2
.nf
struct scsi_key_strings {
int key;
char *message;
};
.fi
.in -2
.sp
.LP
For a basic SCSI disk, the following list is appropriate:
.sp
.in +2
.nf
static struct scsi_key_strings scsi_cmds[] = {
0x00, "test unit ready",
0x01, "rezero/rewind",
0x03, "request sense",
0x04, "format",
0x07, "reassign",
0x08, "read",
0x0a, "write",
0x0b, "seek",
0x12, "inquiry",
0x15, "mode select",
0x16, "reserve",
0x17, "release",
0x18, "copy",
0x1a, "mode sense",
0x1b, "start/stop",
0x1e, "door lock",
0x28, "read(10)",
0x2a, "write(10)",
0x2f, "verify",
0x37, "read defect data",
0x3b, "write buffer",
-1, NULL
};
.fi
.in -2
.SH CONTEXT
.LP
The \fBscsi_vu_errmsg()\fR function may be called from user, interrupt, or
kernel context.
.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBscsi_vu_errmsg()\fR
.sp
.in +2
.nf
struct scsi_asq_key_strings cd_slist[] = {
0x81, 0, "Logical Unit is inaccessible",
-1, 0, NULL,
};
scsi_vu_errmsg(devp, pkt, "sd",
SCSI_ERR_INFO, bp->b_blkno, err_blkno,
sd_cmds, rqsense, cd_list,
my_decode_fru);
.fi
.in -2
.sp
.LP
This generates the following console warning:
.sp
.in +2
.nf
WARNING: /sbus@1,f8000000/esp@0,800000/sd@1,0 (sd1):
Error for Command: read Error Level: Informational
Requested Block: 23936 Error Block: 23936
Vendor: XYZ Serial Number: 123456
Sense Key: Unit Attention
ASC: 0x81 (Logical Unit is inaccessible), ASCQ: 0x0
FRU: 0x11 (replace LUN 1, located in slot 1)
.fi
.in -2
.SH SEE ALSO
.LP
\fBcmn_err\fR(9F), \fBscsi_errmsg\fR(9F), \fBscsi_log\fR(9F),
\fBscsi_errmsg\fR(9F), \fBscsi_asc_key_strings\fR(9S), \fBscsi_device\fR(9S),
\fBscsi_extended_sense\fR(9S), \fBscsi_pkt\fR(9S)
.sp
.LP
\fIWriting Device Drivers\fR
.sp
.LP
\fISTREAMS Programming Guide\fR
|