xref: /titanic_52/usr/src/uts/common/sys/scsi/impl/sense.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
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 (c) 1996, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SCSI_IMPL_SENSE_H
28 #define	_SYS_SCSI_IMPL_SENSE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Implementation Variant defines
38  * for SCSI Sense Information
39  */
40 
41 /*
42  * These are 'pseudo' sense keys for common Sun implementation driver
43  * detected errors. Note that they start out as being higher than the
44  * legal key numbers for standard SCSI.
45  */
46 
47 #define	SUN_KEY_FATAL		0x10	/* driver, scsi handshake failure */
48 #define	SUN_KEY_TIMEOUT		0x11	/* driver, command timeout */
49 #define	SUN_KEY_EOF		0x12	/* driver, eof hit */
50 #define	SUN_KEY_EOT		0x13	/* driver, eot hit */
51 #define	SUN_KEY_LENGTH		0x14	/* driver, length error */
52 #define	SUN_KEY_BOT		0x15	/* driver, bot hit */
53 #define	SUN_KEY_WRONGMEDIA	0x16	/* driver, wrong tape media */
54 
55 #define	NUM_IMPL_SENSE_KEYS	7	/* seven extra keys */
56 
57 /*
58  * Common sense length allocation sufficient for this implementation.
59  */
60 
61 #define	SENSE_LENGTH	\
62 	(roundup(sizeof (struct scsi_extended_sense), sizeof (int)))
63 
64 /*
65  * Minimum useful Sense Length value
66  */
67 
68 #define	SUN_MIN_SENSE_LENGTH	4
69 
70 /*
71  * Specific variants to the Extended Sense structure.
72  *
73  * Defines for:
74  *	Emulex MD21 SCSI/ESDI Controller
75  *	Emulex MT02 SCSI/QIC-36 Controller.
76  *
77  * 1) The Emulex controllers put error class and error code into the byte
78  * right after the 'additional sense length' field in Extended Sense.
79  *
80  * 2) Except that some people state that this isn't so for the MD21- only
81  * the MT02.
82  */
83 
84 #define	emulex_ercl_ercd	es_cmd_info[0]
85 
86 /*
87  * 2) These are valid on Extended Sense for the MD21, FORMAT command only:
88  */
89 
90 #define	emulex_cyl_msb		es_info_1
91 #define	emulex_cyl_lsb		es_info_2
92 #define	emulex_head_num		es_info_3
93 #define	emulex_sect_num		es_info_4
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif	/* _SYS_SCSI_IMPL_SENSE_H */
100