1*fcf3ce44SJohn Forte /*
2*fcf3ce44SJohn Forte  * CDDL HEADER START
3*fcf3ce44SJohn Forte  *
4*fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5*fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6*fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7*fcf3ce44SJohn Forte  *
8*fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10*fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11*fcf3ce44SJohn Forte  * and limitations under the License.
12*fcf3ce44SJohn Forte  *
13*fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14*fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16*fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17*fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fcf3ce44SJohn Forte  *
19*fcf3ce44SJohn Forte  * CDDL HEADER END
20*fcf3ce44SJohn Forte  */
21*fcf3ce44SJohn Forte /*
22*fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*fcf3ce44SJohn Forte  * Use is subject to license terms.
24*fcf3ce44SJohn Forte  */
25*fcf3ce44SJohn Forte 
26*fcf3ce44SJohn Forte /*
27*fcf3ce44SJohn Forte  * local SCSI definitions
28*fcf3ce44SJohn Forte  */
29*fcf3ce44SJohn Forte 
30*fcf3ce44SJohn Forte #ifndef	_G_SCSI_H
31*fcf3ce44SJohn Forte #define	_G_SCSI_H
32*fcf3ce44SJohn Forte 
33*fcf3ce44SJohn Forte 
34*fcf3ce44SJohn Forte /*
35*fcf3ce44SJohn Forte  * Include any headers you depend on.
36*fcf3ce44SJohn Forte  */
37*fcf3ce44SJohn Forte 
38*fcf3ce44SJohn Forte /*
39*fcf3ce44SJohn Forte  * I18N message number ranges
40*fcf3ce44SJohn Forte  *  This file: 18500 - 18999
41*fcf3ce44SJohn Forte  *  Shared common messages: 1 - 1999
42*fcf3ce44SJohn Forte  */
43*fcf3ce44SJohn Forte 
44*fcf3ce44SJohn Forte #ifdef	__cplusplus
45*fcf3ce44SJohn Forte extern "C" {
46*fcf3ce44SJohn Forte #endif
47*fcf3ce44SJohn Forte 
48*fcf3ce44SJohn Forte #define	MODEPAGE_GEOMETRY	0x04
49*fcf3ce44SJohn Forte 
50*fcf3ce44SJohn Forte /* NOTE: These command op codes are not defined in commands.h */
51*fcf3ce44SJohn Forte #define		SCMD_SYNC_CACHE			0x35
52*fcf3ce44SJohn Forte #define		SCMD_LOG_SENSE			0x4d
53*fcf3ce44SJohn Forte #define		SCMD_PERS_RESERV_IN		0x5e
54*fcf3ce44SJohn Forte #define		SCMD_PERS_RESERV_OUT		0x5f
55*fcf3ce44SJohn Forte 
56*fcf3ce44SJohn Forte #define	MAX_MODE_SENSE_LEN		0xffff
57*fcf3ce44SJohn Forte 
58*fcf3ce44SJohn Forte /*
59*fcf3ce44SJohn Forte  *  Structure for MODE SELECT/SENSE 10 byte page header
60*fcf3ce44SJohn Forte  *
61*fcf3ce44SJohn Forte  */
62*fcf3ce44SJohn Forte typedef struct mode_header_10_struct {
63*fcf3ce44SJohn Forte 	ushort_t length;
64*fcf3ce44SJohn Forte 	uchar_t medium_type; /* device specific */
65*fcf3ce44SJohn Forte 	uchar_t device_specific; /* device specfic parameters */
66*fcf3ce44SJohn Forte 	ushort_t	rsvdl;	/* reserved */
67*fcf3ce44SJohn Forte 	ushort_t bdesc_length;	/* length of block descriptor(s), if any */
68*fcf3ce44SJohn Forte } Mode_header_10;
69*fcf3ce44SJohn Forte 
70*fcf3ce44SJohn Forte typedef	struct	mode_page_04_struct {
71*fcf3ce44SJohn Forte 	struct	mode_page mode_page;	/* common mode page header */
72*fcf3ce44SJohn Forte 	uchar_t	num_cylinders_hi;
73*fcf3ce44SJohn Forte 	uchar_t	num_cylinders_mid;
74*fcf3ce44SJohn Forte 	uchar_t	num_cylinders_lo;
75*fcf3ce44SJohn Forte 	uchar_t	num_heads;
76*fcf3ce44SJohn Forte 	uchar_t	write_precomp_hi;
77*fcf3ce44SJohn Forte 	uchar_t	write_precomp_mid;
78*fcf3ce44SJohn Forte 	uchar_t	write_precomp_lo;
79*fcf3ce44SJohn Forte 	uchar_t	reduced_write_i_hi;
80*fcf3ce44SJohn Forte 	uchar_t	reduced_write_i_mid;
81*fcf3ce44SJohn Forte 	uchar_t	reduced_write_i_lo;
82*fcf3ce44SJohn Forte 	ushort_t	step_rate;
83*fcf3ce44SJohn Forte 	uchar_t	landing_zone_hi;
84*fcf3ce44SJohn Forte 	uchar_t	landing_zone_mid;
85*fcf3ce44SJohn Forte 	uchar_t	landing_zone_lo;
86*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH)
87*fcf3ce44SJohn Forte 	uchar_t	rpl	: 2,	/* RPL */
88*fcf3ce44SJohn Forte 			: 6;
89*fcf3ce44SJohn Forte #elif defined(_BIT_FIELDS_HTOL)
90*fcf3ce44SJohn Forte 	uchar_t		: 6,
91*fcf3ce44SJohn Forte 		rpl	: 2;    /* disable correction */
92*fcf3ce44SJohn Forte #else
93*fcf3ce44SJohn Forte #error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
94*fcf3ce44SJohn Forte #endif  /* _BIT_FIELDS_LTOH */
95*fcf3ce44SJohn Forte 	uchar_t	rot_offset;
96*fcf3ce44SJohn Forte 	uchar_t	: 8;	/* reserved */
97*fcf3ce44SJohn Forte 	ushort_t	rpm;
98*fcf3ce44SJohn Forte 	uchar_t	: 8;	/* reserved */
99*fcf3ce44SJohn Forte 	uchar_t	: 8;	/* reserved */
100*fcf3ce44SJohn Forte } Mp_04;
101*fcf3ce44SJohn Forte 
102*fcf3ce44SJohn Forte 
103*fcf3ce44SJohn Forte typedef	struct	mode_page_01_struct {
104*fcf3ce44SJohn Forte 	struct	mode_page mode_page;	/* common mode page header */
105*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH)
106*fcf3ce44SJohn Forte 	uchar_t	dcr	: 1,	/* disable correction */
107*fcf3ce44SJohn Forte 		dte	: 1,	/* disable transfer on error */
108*fcf3ce44SJohn Forte 		per	: 1,	/* post error */
109*fcf3ce44SJohn Forte 		eec	: 1,	/* enable early correction */
110*fcf3ce44SJohn Forte 		rc	: 1,	/* read continuous */
111*fcf3ce44SJohn Forte 		tb	: 1,	/* transfer block */
112*fcf3ce44SJohn Forte 		arre	: 1,	/* auto read realloc enabled */
113*fcf3ce44SJohn Forte 		awre	: 1;	/* auto write realloc enabled */
114*fcf3ce44SJohn Forte #elif defined(_BIT_FIELDS_HTOL)
115*fcf3ce44SJohn Forte 	uchar_t	awre	: 1,	/* auto write realloc enabled */
116*fcf3ce44SJohn Forte 		arre	: 1,	/* auto read realloc enabled */
117*fcf3ce44SJohn Forte 		tb	: 1,	/* transfer block */
118*fcf3ce44SJohn Forte 		rc	: 1,	/* read continuous */
119*fcf3ce44SJohn Forte 		eec	: 1,	/* enable early correction */
120*fcf3ce44SJohn Forte 		per	: 1,	/* post error */
121*fcf3ce44SJohn Forte 		dte	: 1,	/* disable transfer on error */
122*fcf3ce44SJohn Forte 		dcr	: 1;    /* disable correction */
123*fcf3ce44SJohn Forte #else
124*fcf3ce44SJohn Forte #error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
125*fcf3ce44SJohn Forte #endif  /* _BIT_FIELDS_LTOH */
126*fcf3ce44SJohn Forte 	uchar_t	read_retry_count;
127*fcf3ce44SJohn Forte 	uchar_t	correction_span;
128*fcf3ce44SJohn Forte 	uchar_t	head_offset_count;
129*fcf3ce44SJohn Forte 	uchar_t	strobe_offset_count;
130*fcf3ce44SJohn Forte 	uchar_t			: 8;	/* reserved */
131*fcf3ce44SJohn Forte 	uchar_t	write_retry_count;
132*fcf3ce44SJohn Forte 	uchar_t			: 8;	/* reserved */
133*fcf3ce44SJohn Forte 	ushort_t	recovery_time_limit;
134*fcf3ce44SJohn Forte } Mp_01;
135*fcf3ce44SJohn Forte 
136*fcf3ce44SJohn Forte /*
137*fcf3ce44SJohn Forte  * I define here for backward compatability
138*fcf3ce44SJohn Forte  * with 2.5.1
139*fcf3ce44SJohn Forte  * For 2.6 & above you can use "mode_caching"
140*fcf3ce44SJohn Forte  */
141*fcf3ce44SJohn Forte struct my_mode_caching {
142*fcf3ce44SJohn Forte 	struct	mode_page mode_page;	/* common mode page header */
143*fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH)
144*fcf3ce44SJohn Forte 	uchar_t	rcd		: 1,	/* Read Cache Disable */
145*fcf3ce44SJohn Forte 		mf		: 1,	/* Multiplication Factor */
146*fcf3ce44SJohn Forte 		wce		: 1,	/* Write Cache Enable */
147*fcf3ce44SJohn Forte 				: 5;	/* Reserved */
148*fcf3ce44SJohn Forte 	uchar_t	write_ret_prio	: 4,	/* Write Retention Priority */
149*fcf3ce44SJohn Forte 		dmd_rd_ret_prio	: 4;	/* Demand Read Retention Priority */
150*fcf3ce44SJohn Forte #elif defined(_BIT_FIELDS_HTOL)
151*fcf3ce44SJohn Forte 	uchar_t			: 5,	/* Reserved */
152*fcf3ce44SJohn Forte 		wce		: 1,	/* Write Cache Enable */
153*fcf3ce44SJohn Forte 		mf		: 1,	/* Multiplication Factor */
154*fcf3ce44SJohn Forte 		rcd		: 1;	/* Read Cache Disable */
155*fcf3ce44SJohn Forte 	uchar_t	dmd_rd_ret_prio	: 4,	/* Demand Read Retention Priority */
156*fcf3ce44SJohn Forte 		write_ret_prio	: 4;	/* Write Retention Priority */
157*fcf3ce44SJohn Forte #else
158*fcf3ce44SJohn Forte #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
159*fcf3ce44SJohn Forte #endif	/* _BIT_FIELDS_LTOH */
160*fcf3ce44SJohn Forte 	ushort_t	pf_dsbl_trans_len;	/* Disable prefetch Xfer len. */
161*fcf3ce44SJohn Forte 	ushort_t	min_prefetch;	/* Minimum Prefetch */
162*fcf3ce44SJohn Forte 	ushort_t	max_prefetch;	/* Maximum Prefetch */
163*fcf3ce44SJohn Forte 	ushort_t	max_prefetch_ceiling;	/* Maximum Prefetch Ceiling */
164*fcf3ce44SJohn Forte };
165*fcf3ce44SJohn Forte 
166*fcf3ce44SJohn Forte /*
167*fcf3ce44SJohn Forte  *              SCSI CDB structures
168*fcf3ce44SJohn Forte  */
169*fcf3ce44SJohn Forte typedef	struct	my_cdb_g0 {
170*fcf3ce44SJohn Forte 	unsigned	char	cmd;
171*fcf3ce44SJohn Forte 	unsigned	char	lba_msb;
172*fcf3ce44SJohn Forte 	unsigned	char	lba;
173*fcf3ce44SJohn Forte 	unsigned	char	lba_lsb;
174*fcf3ce44SJohn Forte 	unsigned	char	count;
175*fcf3ce44SJohn Forte 	unsigned	char	control;
176*fcf3ce44SJohn Forte 	}my_cdb_g0;
177*fcf3ce44SJohn Forte 
178*fcf3ce44SJohn Forte typedef	struct {
179*fcf3ce44SJohn Forte 	unsigned	char	cmd;
180*fcf3ce44SJohn Forte 	unsigned	char	byte1;
181*fcf3ce44SJohn Forte 	unsigned	char	byte2;
182*fcf3ce44SJohn Forte 	unsigned	char	byte3;
183*fcf3ce44SJohn Forte 	unsigned	char	byte4;
184*fcf3ce44SJohn Forte 	unsigned	char	byte5;
185*fcf3ce44SJohn Forte 	unsigned	char	byte6;
186*fcf3ce44SJohn Forte 	unsigned	char	byte7;
187*fcf3ce44SJohn Forte 	unsigned	char	byte8;
188*fcf3ce44SJohn Forte 	unsigned	char	byte9;
189*fcf3ce44SJohn Forte 	}my_cdb_g1;
190*fcf3ce44SJohn Forte 
191*fcf3ce44SJohn Forte typedef struct l_inquiry80_struct {
192*fcf3ce44SJohn Forte 	/*
193*fcf3ce44SJohn Forte 	 * byte 0
194*fcf3ce44SJohn Forte 	 *
195*fcf3ce44SJohn Forte 	 * Bits 7-5 are the Peripheral Device Qualifier
196*fcf3ce44SJohn Forte 	 * Bits 4-0 are the Peripheral Device Type
197*fcf3ce44SJohn Forte 	 *
198*fcf3ce44SJohn Forte 	 */
199*fcf3ce44SJohn Forte 	uchar_t	inq_dtype;
200*fcf3ce44SJohn Forte 	uchar_t	inq_page_code;
201*fcf3ce44SJohn Forte 	uchar_t reserved;		/* reserved */
202*fcf3ce44SJohn Forte 	uchar_t inq_page_len;
203*fcf3ce44SJohn Forte 	uchar_t inq_serial[251];
204*fcf3ce44SJohn Forte } L_inquiry80;
205*fcf3ce44SJohn Forte 
206*fcf3ce44SJohn Forte typedef struct l_inquiry00_struct {
207*fcf3ce44SJohn Forte 	uchar_t		qual    :3,
208*fcf3ce44SJohn Forte 			dtype   :5;
209*fcf3ce44SJohn Forte 	uchar_t		page_code;
210*fcf3ce44SJohn Forte 	uchar_t		reserved;
211*fcf3ce44SJohn Forte 	uchar_t		len;
212*fcf3ce44SJohn Forte 	uchar_t		page_list[251];
213*fcf3ce44SJohn Forte } L_inquiry00;
214*fcf3ce44SJohn Forte 
215*fcf3ce44SJohn Forte #ifdef	__cplusplus
216*fcf3ce44SJohn Forte }
217*fcf3ce44SJohn Forte #endif
218*fcf3ce44SJohn Forte 
219*fcf3ce44SJohn Forte #endif	/* _G_SCSI_H */
220