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

NAME

6       scsi_errmsg - display a SCSI request sense message
7

SYNOPSIS

9       #include <sys/scsi/scsi.h>
10
11
12
13       void scsi_errmsg(struct scsi_device *devp, struct scsi_pkt *pktp,
14            char *drv_name, int severity, daddr_t blkno, daddr_t err_blkno,
15            struct scsi_key_strings *cmdlist, struct scsi_extended_sense *sensep);
16
17

INTERFACE LEVEL

19       Solaris DDI specific (Solaris DDI).
20

PARAMETERS

22       devp         Pointer to the  scsi_device(9S) structure.
23
24
25       pktp         Pointer to a scsi_pkt(9S) structure.
26
27
28       drv_name     String used by scsi_log(9F).
29
30
31       severity     Error severity level, maps to severity strings below.
32
33
34       blkno        Requested block number.
35
36
37       err_blkno    Error block number.
38
39
40       cmdlist      An array of SCSI command description strings.
41
42
43       sensep       A pointer to a scsi_extended_sense(9S) structure.
44
45

DESCRIPTION

47       The  scsi_errmsg() function interprets the request sense information in
48       the sensep pointer and generates a standard message that  is  displayed
49       using  scsi_log(9F). The first line of the message is always a CE_WARN,
50       with the continuation lines being CE_CONT. sensep may be NULL, in which
51       case no sense key or vendor information is displayed.
52
53
54       The  driver should make the determination as to when to call this func‐
55       tion based on the severity of the failure and the severity  level  that
56       the driver wants to report.
57
58
59       The  scsi_device(9S) structure denoted by devp supplies the identifica‐
60       tion of the device that requested the display. severity  selects  which
61       string  is  used in the "Error Level:" reporting, according to the fol‐
62       lowing table:
63
64
65
66
67             Severity Value:                   String:
68       SCSI_ERR_ALL                  All
69       SCSI_ERR_UNKNOWN              Unknown
70       SCSI_ERR_INFO                 Informational
71       SCSI_ERR_RECOVERE             Recovered
72       SCSI_ERR_RETRYABL             Retryable
73       SCSI_ERR_FATAL                Fatal
74
75
76
77       blkno is the block number of the original request  that  generated  the
78       error.  err_blkno is the block number where the error occurred. cmdlist
79       is a mapping table for translating the SCSI command code in pktp to the
80       actual command string.
81
82
83       The cmdlist is described in the structure below:
84
85         struct scsi_key_strings {
86                 int key;
87                 char *message;
88         };
89
90
91
92       For a basic SCSI disk, the following list is appropriate:
93
94         static struct scsi_key_strings scsi_cmds[] = {
95                 0x00, "test unit ready",
96                 0x01, "rezero/rewind",
97                 0x03, "request sense",
98                 0x04, "format",
99                 0x07, "reassign",
100                 0x08, "read",
101                 0x0a, "write",
102                 0x0b, "seek",
103                 0x12, "inquiry",
104                 0x15, "mode select",
105                 0x16, "reserve",
106                 0x17, "release",
107                 0x18, "copy",
108                 0x1a, "mode sense",
109                 0x1b, "start/stop",
110                 0x1e, "door lock",
111                 0x28, "read(10)",
112                 0x2a, "write(10)",
113                 0x2f, "verify",
114                 0x37, "read defect data",
115                 0x3b, "write buffer",
116                 -1, NULL
117         };
118
119

CONTEXT

121       The  scsi_errmsg() function may be called from user, interrupt, or ker‐
122       nel context.
123

EXAMPLES

125       Example 1 Generating error information.
126
127
128       This entry:
129
130
131         scsi_errmsg(devp, pkt, "sd", SCSI_ERR_INFO, bp->b_blkno,
132                  err_blkno, sd_cmds, rqsense);
133
134
135
136       Generates:
137
138
139         WARNING: /sbus@1,f8000000/esp@0,800000/sd@1,0 (sd1):
140         Error for Command: read Error Level: Informational
141         Requested Block: 23936 Error Block: 23936
142         Vendor: QUANTUM Serial Number: 123456
143         Sense Key:  Unit Attention
144         ASC: 0x29 (reset), ASCQ: 0x0, FRU: 0x0
145
146

SEE ALSO

148       cmn_err(9F),  scsi_log(9F),  scsi_device(9S),  scsi_extended_sense(9S),
149       scsi_pkt(9S)
150
151
152       Writing Device Drivers
153
154
155
156SunOS 5.11                        16 Jan 2006                  scsi_errmsg(9F)
Impressum