xref: /onnv-gate/usr/src/uts/common/io/scsi/impl/scsi_data.c (revision 173:1711d947ee87)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*173Scth  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * Global SCSI data
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/scsi/scsi.h>
34*173Scth #include <sys/cdio.h>			/* CDROM SCMD_ commands */
350Sstevel@tonic-gate 
360Sstevel@tonic-gate char *sense_keys[NUM_SENSE_KEYS + NUM_IMPL_SENSE_KEYS] = {
37*173Scth 					/* ==== SCSI Standard Keys */
38*173Scth 	"No_Additional_Sense",		/* 0x00 KEY_NO_SENSE */
39*173Scth 	"Soft_Error",			/* 0x01 KEY_RECOVERABLE_ERROR */
40*173Scth 	"Not_Ready",			/* 0x02 KEY_NOT_READY */
41*173Scth 	"Media_Error",			/* 0x03 KEY_MEDIUM_ERROR */
42*173Scth 	"Hardware_Error",		/* 0x04 KEY_HARDWARE_ERROR */
43*173Scth 	"Illegal_Request",		/* 0x05 KEY_ILLEGAL_REQUEST */
44*173Scth 	"Unit_Attention",		/* 0x06 KEY_UNIT_ATTENTION */
45*173Scth 	"Write_Protected",		/* 0x07 KEY_WRITE_PROTECT */
46*173Scth 	"Blank_Check",			/* 0x08 KEY_BLANK_CHECK */
47*173Scth 	"Vendor_Unique",		/* 0x09 KEY_VENDOR_UNIQUE */
48*173Scth 	"Copy_Aborted",			/* 0x0a KEY_COPY_ABORTED */
49*173Scth 	"Aborted_Command",		/* 0x0b KEY_ABORTED_COMMAND */
50*173Scth 	"Equal_Error",			/* 0x0c KEY_EQUAL */
51*173Scth 	"Volume_Overflow",		/* 0x0d KEY_VOLUME_OVERFLOW */
52*173Scth 	"Miscompare_Error",		/* 0x0e KEY_MISCOMPARE */
53*173Scth 	"Reserved",			/* 0x0f KEY_RESERVED */
54*173Scth 					/* ==== SUN SCSA 'pseudo' keys */
55*173Scth 	"fatal",			/* 0x10 SUN_KEY_FATAL */
56*173Scth 	"timeout",			/* 0x11 SUN_KEY_TIMEOUT */
57*173Scth 	"EOF",				/* 0x12 SUN_KEY_EOF */
58*173Scth 	"EOT",				/* 0x13 SUN_KEY_EOT */
59*173Scth 	"length_error",			/* 0x14 SUN_KEY_LENGTH */
60*173Scth 	"BOT",				/* 0x15 SUN_KEY_BOT */
61*173Scth 	"wrong_tape_media"		/* 0x16 SUN_KEY_WRONGMEDIA */
620Sstevel@tonic-gate };
630Sstevel@tonic-gate 
640Sstevel@tonic-gate 
650Sstevel@tonic-gate char *scsi_state_bits = "\20\05STS\04XFER\03CMD\02SEL\01ARB";
660Sstevel@tonic-gate 
670Sstevel@tonic-gate 
680Sstevel@tonic-gate /*
690Sstevel@tonic-gate  * This structure is used to allow you to quickly determine the size of the
700Sstevel@tonic-gate  * cdb by examining the cmd code.  It is used in conjunction with the
710Sstevel@tonic-gate  * CDB_GROUPID macro.  Lookup returns size of cdb.  If unknown, zero returned.
720Sstevel@tonic-gate  */
730Sstevel@tonic-gate uchar_t	scsi_cdb_size[] = {
740Sstevel@tonic-gate 	CDB_GROUP0,	/* Group 0, 6  byte cdb */
750Sstevel@tonic-gate 	CDB_GROUP1,	/* Group 1, 10 byte cdb */
760Sstevel@tonic-gate 	CDB_GROUP2,	/* Group 2, 10 byte cdb */
770Sstevel@tonic-gate 	CDB_GROUP3,	/* Group 3,  reserved */
780Sstevel@tonic-gate 	CDB_GROUP4,	/* Group 4, 16 byte cdb */
790Sstevel@tonic-gate 	CDB_GROUP5,	/* Group 5, 12 byte cdb */
800Sstevel@tonic-gate 	CDB_GROUP6,	/* Group 6,  ? byte cdb (vendor specific) */
810Sstevel@tonic-gate 	CDB_GROUP7	/* Group 7,  ? byte cdb (vendor specific) */
820Sstevel@tonic-gate };
830Sstevel@tonic-gate 
840Sstevel@tonic-gate /*
850Sstevel@tonic-gate  * Basic SCSI command description strings that can be used by drivers
860Sstevel@tonic-gate  * to pass to scsi_errmsg().
870Sstevel@tonic-gate  */
880Sstevel@tonic-gate struct scsi_key_strings scsi_cmds[] = {
89*173Scth 	SCSI_CMDS_KEY_STRINGS,
90*173Scth 	SCSI_CMDS_KEY_STRINGS_CDIO,
91*173Scth 	-1,			NULL
920Sstevel@tonic-gate };
93