Kernel Functions for Drivers scsivuerrmsg(9F)
NAME
scsivuerrmsg - display a SCSI request sense message
SYNOPSIS
#include
void scsivuerrmsg(struct scsipkt *pktp, char *drvname, int severity,
int errblkno, struct scsikeystrings *cmdlist,
struct scsiextendedsense *sensep,
struct scsiasqkeystrings *asclist,
char **decodefru struct scsidevice*, char *, int, char);
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
PARAMETERS
The following parameters are supported:
devp Pointer to the scsidevice(9S) structure.
pktp Pointer to a scsipkt(9S) structure.
drvname String used by scsilog(9F).
severity Error severity level, maps to severity strings
below.
blkno Requested block number.
errblkno Error block number.
cmdlist An array of SCSI command description strings.
sensep A pointer to a scsiextendedsense(9S) struc-
ture.
asclist A pointer to a array of asc and ascq message
list.The list must be terminated with -1 asc
value.
SunOS 5.11 Last change: 16 Jan 2006 1
Kernel Functions for Drivers scsivuerrmsg(9F)
decodefru This is a function pointer that will be called
after the entire sense information has been
decoded. The parameters will be the
scsidevice 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.
decodefru might be NUL if no special decod-
ing is required. decodefru is expected to
return pointer to a char string if decoding
possible and NUL if no decoding is possible.
DESCRIPTION
This function is very similar to scsierrmsg(9F) but allows
decoding of vendor-unique ASC/ASCQ and FRU information.
The scsivuerrmsg() function interprets the request sense
information in the sensep pointer and generates a standard
message that is displayed using scsilog(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 stan-
dard list is searched. The first line of the message is
always a CEWARN, with the continuation lines being CECONT.
sensep may be NUL, in which case no sense key or vendor
information is displayed.
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.
The scsidevice(9S) structure denoted by devp supplies the
identification of the device that requested the display.
severity selects which string is used in the Error Level:
reporting, according to the table below:
Severity Value: String:
SCSIERAL All
SCSIERUNKNOWN Unknown
SCSIERINFO Information
SCSIERECOVERED Recovered
SCSIERETRYABLE Retryable
SCSIERFATAL Fatal
blkno is the block number of the original request that gen-
erated the error. errblkno is the block number where the
error occurred. cmdlist is a mapping table for translating
SunOS 5.11 Last change: 16 Jan 2006 2
Kernel Functions for Drivers scsivuerrmsg(9F)
the SCSI command code in pktp to the actual command string.
The cmdlist is described in the structure below:
struct scsikeystrings {
int key;
char *message;
};
For a basic SCSI disk, the following list is appropriate:
static struct scsikeystrings scsicmds[] = {
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, NUL
};
CONTEXT
The scsivuerrmsg() function may be called from user,
interrupt, or kernel context.
EXAMPLES
Example 1 Using scsivuerrmsg()
struct scsiasqkeystrings cdslist[] = {
0x81, 0, "Logical Unit is inaccessable",
-1, 0, NUL,
};
SunOS 5.11 Last change: 16 Jan 2006 3
Kernel Functions for Drivers scsivuerrmsg(9F)
scsivuerrmsg(devp, pkt, "sd",
SCSIERINFO, bp->bblkno, errblkno,
sdcmds, rqsense, cdlist,
mydecodefru);
This generates the following console warning:
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 inaccessable), ASCQ: 0x0
FRU: 0x11 (replace LUN 1, located in slot 1)
SEE ALSO
cmnerr(9F), scsierrmsg(9F), scsilog(9F), scsierrmsg(9F),
scsiasckeystrings(9S), scsidevice(9S),
scsiextendedsense(9S), scsipkt(9S)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.11 Last change: 16 Jan 2006 4
|