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_ERRMSG 9F "Jan 16, 2006"
8 scsi_errmsg \- display a SCSI request sense message
12 #include <sys/scsi/scsi.h>
16 \fBvoid\fR \fBscsi_errmsg\fR(\fBstruct scsi_device *\fR\fIdevp\fR, \fBstruct scsi_pkt *\fR\fIpktp\fR,
17 \fBchar *\fR\fIdrv_name\fR, \fBint\fR \fIseverity\fR, \fBdaddr_t\fR \fIblkno\fR, \fBdaddr_t\fR \fIerr_blkno\fR,
18 \fBstruct scsi_key_strings *\fR\fIcmdlist\fR, \fBstruct scsi_extended_sense *\fR\fIsensep\fR);
24 Solaris DDI specific (Solaris DDI).
32 Pointer to the \fBscsi_device\fR(9S) structure.
41 Pointer to a \fBscsi_pkt\fR(9S) structure.
50 String used by \fBscsi_log\fR(9F).
59 Error severity level, maps to severity strings below.
68 Requested block number.
86 An array of \fBSCSI \fRcommand description strings.
95 A pointer to a \fBscsi_extended_sense\fR(9S) structure.
101 The \fBscsi_errmsg()\fR function interprets the request sense information in
102 the \fIsensep\fR pointer and generates a standard message that is displayed
103 using \fBscsi_log\fR(9F). The first line of the message is always a
104 \fBCE_WARN\fR, with the continuation lines being \fBCE_CONT\fR. \fIsensep\fR
105 may be \fINULL\fR, in which case no sense key or vendor information is
109 The driver should make the determination as to when to call this function based
110 on the severity of the failure and the severity level that the driver wants to
114 The \fBscsi_device\fR(9S) structure denoted by \fIdevp\fR supplies the
115 identification of the device that requested the display. \fIseverity\fR selects
116 which string is used in the "Error Level:" reporting, according to the
124 \fBSeverity Value:\fR \fBString:\fR
125 \fBSCSI_ERR_ALL\fR \fBAll\fR
126 \fBSCSI_ERR_UNKNOWN\fR \fBUnknown\fR
127 \fBSCSI_ERR_INFO\fR \fBInformational\fR
128 \fBSCSI_ERR_RECOVERE\fR \fBRecovered\fR
129 \fBSCSI_ERR_RETRYABL\fR \fBRetryable\fR
130 \fBSCSI_ERR_FATAL\fR \fBFatal\fR
135 \fIblkno\fR is the block number of the original request that generated the
136 error. \fIerr_blkno\fR is the block number where the error occurred.
137 \fIcmdlist\fR is a mapping table for translating the \fBSCSI \fRcommand code in
138 \fIpktp\fR to the actual command string.
141 The \fIcmdlist\fR is described in the structure below:
145 struct scsi_key_strings {
154 For a basic \fBSCSI\fR disk, the following list is appropriate:
158 static struct scsi_key_strings scsi_cmds[] = {
159 0x00, "test unit ready",
160 0x01, "rezero/rewind",
161 0x03, "request sense",
178 0x37, "read defect data",
179 0x3b, "write buffer",
188 The \fBscsi_errmsg()\fR function may be called from user, interrupt, or kernel
192 \fBExample 1 \fRGenerating error information.
200 scsi_errmsg(devp, pkt, "sd", SCSI_ERR_INFO, bp->b_blkno,
201 err_blkno, sd_cmds, rqsense);
212 \fBWARNING: /sbus@1,f8000000/esp@0,800000/sd@1,0 (sd1):
213 Error for Command: read Error Level: Informational
214 Requested Block: 23936 Error Block: 23936
215 Vendor: QUANTUM Serial Number: 123456
216 Sense Key: Unit Attention
217 ASC: 0x29 (reset), ASCQ: 0x0, FRU: 0x0\fR
224 \fBcmn_err\fR(9F), \fBscsi_log\fR(9F), \fBscsi_device\fR(9S),
225 \fBscsi_extended_sense\fR(9S), \fBscsi_pkt\fR(9S)
228 \fIWriting Device Drivers\fR