xref: /illumos-gate/usr/src/uts/common/io/scsi/impl/scsi_data.c (revision 069e6b7e31ba5dcbc5441b98af272714d9a5455c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * Global SCSI data
31  */
32 
33 #include <sys/scsi/scsi.h>
34 #include <sys/cdio.h>			/* CDROM SCMD_ commands */
35 
36 char *sense_keys[NUM_SENSE_KEYS + NUM_IMPL_SENSE_KEYS] = {
37 					/* ==== SCSI Standard Keys */
38 	"No_Additional_Sense",		/* 0x00 KEY_NO_SENSE */
39 	"Soft_Error",			/* 0x01 KEY_RECOVERABLE_ERROR */
40 	"Not_Ready",			/* 0x02 KEY_NOT_READY */
41 	"Media_Error",			/* 0x03 KEY_MEDIUM_ERROR */
42 	"Hardware_Error",		/* 0x04 KEY_HARDWARE_ERROR */
43 	"Illegal_Request",		/* 0x05 KEY_ILLEGAL_REQUEST */
44 	"Unit_Attention",		/* 0x06 KEY_UNIT_ATTENTION */
45 	"Write_Protected",		/* 0x07 KEY_WRITE_PROTECT */
46 	"Blank_Check",			/* 0x08 KEY_BLANK_CHECK */
47 	"Vendor_Unique",		/* 0x09 KEY_VENDOR_UNIQUE */
48 	"Copy_Aborted",			/* 0x0a KEY_COPY_ABORTED */
49 	"Aborted_Command",		/* 0x0b KEY_ABORTED_COMMAND */
50 	"Equal_Error",			/* 0x0c KEY_EQUAL */
51 	"Volume_Overflow",		/* 0x0d KEY_VOLUME_OVERFLOW */
52 	"Miscompare_Error",		/* 0x0e KEY_MISCOMPARE */
53 	"Reserved",			/* 0x0f KEY_RESERVED */
54 					/* ==== SUN SCSA 'pseudo' keys */
55 	"fatal",			/* 0x10 SUN_KEY_FATAL */
56 	"timeout",			/* 0x11 SUN_KEY_TIMEOUT */
57 	"EOF",				/* 0x12 SUN_KEY_EOF */
58 	"EOT",				/* 0x13 SUN_KEY_EOT */
59 	"length_error",			/* 0x14 SUN_KEY_LENGTH */
60 	"BOT",				/* 0x15 SUN_KEY_BOT */
61 	"wrong_tape_media"		/* 0x16 SUN_KEY_WRONGMEDIA */
62 };
63 
64 
65 char *scsi_state_bits = "\20\05STS\04XFER\03CMD\02SEL\01ARB";
66 
67 
68 /*
69  * This structure is used to allow you to quickly determine the size of the
70  * cdb by examining the cmd code.  It is used in conjunction with the
71  * CDB_GROUPID macro.  Lookup returns size of cdb.  If unknown, zero returned.
72  */
73 uchar_t	scsi_cdb_size[] = {
74 	CDB_GROUP0,	/* Group 0, 6  byte cdb */
75 	CDB_GROUP1,	/* Group 1, 10 byte cdb */
76 	CDB_GROUP2,	/* Group 2, 10 byte cdb */
77 	CDB_GROUP3,	/* Group 3,  reserved */
78 	CDB_GROUP4,	/* Group 4, 16 byte cdb */
79 	CDB_GROUP5,	/* Group 5, 12 byte cdb */
80 	CDB_GROUP6,	/* Group 6,  ? byte cdb (vendor specific) */
81 	CDB_GROUP7	/* Group 7,  ? byte cdb (vendor specific) */
82 };
83 
84 /*
85  * Basic SCSI command description strings that can be used by drivers
86  * to pass to scsi_errmsg().
87  */
88 struct scsi_key_strings scsi_cmds[] = {
89 	SCSI_CMDS_KEY_STRINGS,
90 	SCSI_CMDS_KEY_STRINGS_CDIO,
91 	-1,			NULL
92 };
93