2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH SCSI_VU_ERRMSG 9F "April 9, 2016"
8 scsi_vu_errmsg \- display a SCSI request sense message
12 #include <sys/scsi/scsi.h>
16 \fBvoid\fR \fBscsi_vu_errmsg\fR(\fBstruct scsi_pkt\fR \fI*pktp\fR, \fBchar\fR \fI*drv_name\fR, \fBint severity,\fR
17 \fBint err_blkno,\fR \fBstruct scsi_key_strings\fR \fI*cmdlist\fR,
18 \fBstruct scsi_extended_sense\fR \fI*sensep\fR,
19 \fBstruct scsi_asq_key_strings\fR \fI*asc_list\fR,
20 \fBchar **decode_fru struct scsi_device\fR\fI*\fR, char \fI*\fR, int, char);
25 Solaris DDI specific (Solaris DDI).
28 The following parameters are supported:
35 Pointer to the \fBscsi_device\fR(9S) structure.
44 Pointer to a \fBscsi_pkt\fR(9S) structure.
53 String used by \fBscsi_log\fR(9F).
62 Error severity level, maps to severity strings below.
71 Requested block number.
89 An array of SCSI command description strings.
98 A pointer to a \fBscsi_extended_sense\fR(9S) structure.
107 A pointer to a array of asc and ascq message list.The list must be terminated
108 with \fB-1\fR asc value.
114 \fB\fIdecode_fru\fR\fR
117 This is a function pointer that will be called after the entire sense
118 information has been decoded. The parameters will be the scsi_device structure
119 to identify the device. Second argument will be a pointer to a buffer of length
120 specified by third argument. The fourth argument will be the FRU byte.
121 \fIdecode_fru\fR might be \fINULL\fR if no special decoding is required.
122 \fIdecode_fru\fR is expected to return pointer to a char string if decoding
123 possible and \fINULL\fR if no decoding is possible.
128 This function is very similar to \fBscsi_errmsg\fR(9F) but allows decoding of
129 vendor-unique ASC/ASCQ and FRU information.
132 The \fBscsi_vu_errmsg()\fR function interprets the request sense information in
133 the \fIsensep\fR pointer and generates a standard message that is displayed
134 using \fBscsi_log\fR(9F). It first searches the list array for a matching
135 vendor unique code if supplied. If it does not find one in the list then the
136 standard list is searched. The first line of the message is always a
137 \fBCE_WARN\fR, with the continuation lines being \fBCE_CONT\fR. \fIsensep\fR
138 may be \fINULL\fR, in which case no sense key or vendor information is
142 The driver should make the determination as to when to call this function based
143 on the severity of the failure and the severity level that the driver wants to
147 The \fBscsi_device\fR(9S) structure denoted by \fIdevp\fR supplies the
148 identification of the device that requested the display. \fIseverity\fR selects
149 which string is used in the Error Level: reporting, according to the table
154 Severity Value: String:
156 SCSI_ERR_UNKNOWN Unknown
157 SCSI_ERR_INFO Information
158 SCSI_ERR_RECOVERED Recovered
159 SCSI_ERR_RETRYABLE Retryable
166 \fIblkno\fR is the block number of the original request that generated the
167 error. \fIerr_blkno\fR is the block number where the error occurred.
168 \fIcmdlist\fR is a mapping table for translating the SCSI command code in pktp
169 to the actual command string.
172 The \fIcmdlist\fR is described in the structure below:
176 struct scsi_key_strings {
185 For a basic SCSI disk, the following list is appropriate:
189 static struct scsi_key_strings scsi_cmds[] = {
190 0x00, "test unit ready",
191 0x01, "rezero/rewind",
192 0x03, "request sense",
209 0x37, "read defect data",
210 0x3b, "write buffer",
218 The \fBscsi_vu_errmsg()\fR function may be called from user, interrupt, or
222 \fBExample 1 \fRUsing \fBscsi_vu_errmsg()\fR
226 struct scsi_asq_key_strings cd_slist[] = {
227 0x81, 0, "Logical Unit is inaccessible",
232 scsi_vu_errmsg(devp, pkt, "sd",
233 SCSI_ERR_INFO, bp->b_blkno, err_blkno,
234 sd_cmds, rqsense, cd_list,
241 This generates the following console warning:
246 WARNING: /sbus@1,f8000000/esp@0,800000/sd@1,0 (sd1):
247 Error for Command: read Error Level: Informational
248 Requested Block: 23936 Error Block: 23936
249 Vendor: XYZ Serial Number: 123456
250 Sense Key: Unit Attention
251 ASC: 0x81 (Logical Unit is inaccessible), ASCQ: 0x0
252 FRU: 0x11 (replace LUN 1, located in slot 1)
258 \fBcmn_err\fR(9F), \fBscsi_errmsg\fR(9F), \fBscsi_log\fR(9F),
259 \fBscsi_errmsg\fR(9F), \fBscsi_asc_key_strings\fR(9S), \fBscsi_device\fR(9S),
260 \fBscsi_extended_sense\fR(9S), \fBscsi_pkt\fR(9S)
263 \fIWriting Device Drivers\fR
266 \fISTREAMS Programming Guide\fR