1scsi_vu_errmsg(9F)       Kernel Functions for Drivers       scsi_vu_errmsg(9F)
2
3
4

NAME

6       scsi_vu_errmsg - display a SCSI request sense message
7

SYNOPSIS

9       #include <sys/scsi/scsi.h>
10
11
12
13       void scsi_vu_errmsg(struct scsi_pkt *pktp, char *drv_name, int severity,
14            int err_blkno, struct scsi_key_strings *cmdlist,
15            struct scsi_extended_sense *sensep,
16            struct scsi_asq_key_strings *asc_list,
17            char **decode_fru struct scsi_device*, char *, int, char);
18
19

INTERFACE LEVEL

21       Solaris DDI specific (Solaris DDI).
22

PARAMETERS

24       The following parameters are supported:
25
26       devp          Pointer to the scsi_device(9S) structure.
27
28
29       pktp          Pointer to a scsi_pkt(9S) structure.
30
31
32       drv_name      String used by scsi_log(9F).
33
34
35       severity      Error severity level, maps to severity strings below.
36
37
38       blkno         Requested block number.
39
40
41       err_blkno     Error block number.
42
43
44       cmdlist       An array of SCSI command description strings.
45
46
47       sensep        A pointer to a scsi_extended_sense(9S) structure.
48
49
50       asc_list      A  pointer  to  a  array of asc and ascq message list.The
51                     list must be terminated with -1 asc value.
52
53
54       decode_fru    This is a function pointer that will be called after  the
55                     entire sense information has been decoded. The parameters
56                     will be the scsi_device structure to identify the device.
57                     Second  argument  will be a pointer to a buffer of length
58                     specified by third argument. The fourth argument will  be
59                     the  FRU  byte.  decode_fru  might  be NULL if no special
60                     decoding is required. decode_fru is  expected  to  return
61                     pointer to a char string if decoding possible and NULL if
62                     no decoding is possible.
63
64

DESCRIPTION

66       This function is very similar to scsi_errmsg(9F) but allows decoding of
67       vendor-unique ASC/ASCQ and FRU information.
68
69
70       The  scsi_vu_errmsg() function interprets the request sense information
71       in the sensep pointer and generates a standard  message  that  is  dis‐
72       played  using  scsi_log(9F).  It  first  searches  the list array for a
73       matching vendor unique code if supplied. If it does not find one in the
74       list  then the standard list is searched. The first line of the message
75       is always a CE_WARN, with the continuation lines being CE_CONT.  sensep
76       may  be  NULL, in which case no sense key or vendor information is dis‐
77       played.
78
79
80       The driver should make the determination as to when to call this  func‐
81       tion  based  on the severity of the failure and the severity level that
82       the driver wants to report.
83
84
85       The scsi_device(9S) structure denoted by devp supplies the  identifica‐
86       tion  of  the device that requested the display. severity selects which
87       string is used in the Error Level: reporting, according  to  the  table
88       below:
89
90              Severity Value:      String:
91              SCSI_ERR_ALL         All
92              SCSI_ERR_UNKNOWN     Unknown
93              SCSI_ERR_INFO        Information
94              SCSI_ERR_RECOVERED   Recovered
95              SCSI_ERR_RETRYABLE   Retryable
96              SCSI_ERR_FATAL       Fatal
97
98
99
100       blkno  is  the  block number of the original request that generated the
101       error. err_blkno is the block number where the error occurred.  cmdlist
102       is a mapping table for translating the SCSI command code in pktp to the
103       actual command string.
104
105
106       The cmdlist is described in the structure below:
107
108         struct scsi_key_strings {
109             int key;
110             char *message;
111         };
112
113
114
115       For a basic SCSI disk, the following list is appropriate:
116
117              static struct scsi_key_strings scsi_cmds[] = {
118                      0x00, "test unit ready",
119                      0x01, "rezero/rewind",
120                      0x03, "request sense",
121                      0x04, "format",
122                      0x07, "reassign",
123                      0x08, "read",
124                      0x0a, "write",
125                      0x0b, "seek",
126                      0x12, "inquiry",
127                      0x15, "mode select",
128                      0x16, "reserve",
129                      0x17, "release",
130                      0x18, "copy",
131                      0x1a, "mode sense",
132                      0x1b, "start/stop",
133                      0x1e, "door lock",
134                      0x28, "read(10)",
135                      0x2a, "write(10)",
136                      0x2f, "verify",
137                      0x37, "read defect data",
138                      0x3b, "write buffer",
139                      -1, NULL
140              };
141
142

CONTEXT

144       The scsi_vu_errmsg() function may be called from  user,  interrupt,  or
145       kernel context.
146

EXAMPLES

148       Example 1 Using scsi_vu_errmsg()
149
150              struct scsi_asq_key_strings cd_slist[] = {
151                      0x81, 0, "Logical Unit is inaccessable",
152                      -1, 0, NULL,
153              };
154
155
156              scsi_vu_errmsg(devp, pkt, "sd",
157                             SCSI_ERR_INFO, bp->b_blkno, err_blkno,
158                             sd_cmds, rqsense, cd_list,
159                             my_decode_fru);
160
161
162
163       This generates the following console warning:
164
165
166         WARNING: /sbus@1,f8000000/esp@0,800000/sd@1,0 (sd1):
167                   Error for Command: read        Error Level: Informational
168                   Requested Block: 23936         Error Block: 23936
169                   Vendor: XYZ                Serial Number: 123456
170                   Sense Key:  Unit Attention
171                   ASC: 0x81 (Logical Unit is inaccessable), ASCQ: 0x0
172                   FRU: 0x11 (replace LUN 1, located in slot 1)
173
174

SEE ALSO

176       cmn_err(9F),     scsi_errmsg(9F),     scsi_log(9F),    scsi_errmsg(9F),
177       scsi_asc_key_strings(9S),   scsi_device(9S),   scsi_extended_sense(9S),
178       scsi_pkt(9S)
179
180
181       Writing Device Drivers
182
183
184       STREAMS Programming Guide
185
186
187
188SunOS 5.11                        16 Jan 2006               scsi_vu_errmsg(9F)
Impressum