1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_SCSI_IMPL_MODE_H
#define _SYS_SCSI_IMPL_MODE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Defines and Structures for SCSI Mode Sense/Select data
*
* Implementation Specific variations
*/
/*
* Variations to Sequential Access device mode header
*/
struct modeheader_seq {
uchar_t datalen; /* sense data length */
uchar_t mediumtype; /* medium type */
#if defined(_BIT_FIELDS_LTOH)
uchar_t speed :4, /* speed */
bufm :3, /* buffered mode */
wp :1; /* write protected */
#elif defined(_BIT_FIELDS_HTOL)
uchar_t wp :1, /* write protected */
bufm :3, /* buffered mode */
speed :4; /* speed */
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif /* _BIT_FIELDS_LTOH */
uchar_t bd_len; /* block length in bytes */
struct block_descriptor blk_desc;
};
/*
* Variations to Direct Access device pages
*/
/*
* Page 1: CCS error recovery page was a little different than SCSI-2/3
*/
#define PAGELENGTH_DAD_MODE_ERR_RECOV_CCS 0x06
struct mode_err_recov_ccs {
struct mode_page mode_page; /* common mode page header */
#if defined(_BIT_FIELDS_LTOH)
uchar_t dcr : 1, /* disable correction */
dte : 1, /* disable transfer on error */
per : 1, /* post error */
eec : 1, /* enable early correction */
rc : 1, /* read continuous */
tb : 1, /* transfer block */
arre : 1, /* auto read realloc enabled */
awre : 1; /* auto write realloc enabled */
#elif defined(_BIT_FIELDS_HTOL)
uchar_t awre : 1, /* auto write realloc enabled */
arre : 1, /* auto read realloc enabled */
tb : 1, /* transfer block */
rc : 1, /* read continuous */
eec : 1, /* enable early correction */
per : 1, /* post error */
dte : 1, /* disable transfer on error */
dcr : 1; /* disable correction */
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif /* _BIT_FIELDS_LTOH */
uchar_t retry_count;
uchar_t correction_span;
uchar_t head_offset_count;
uchar_t strobe_offset_count;
uchar_t recovery_time_limit;
};
/*
* Page 3: CCS Direct Access Device Format Parameters
*
* The 0x8 bit in the Drive Type byte is used in CCS
* as an INHIBIT SAVE bit. This bit is not in SCSI-2/3.
*/
#define _reserved_ins ins
/*
* Page 8: SCSI-2 Cache page was a little different than SCSI-3
*/
#define PAGELENGTH_DAD_MODE_CACHE 0x0A
struct mode_cache {
struct mode_page mode_page; /* common mode page header */
#if defined(_BIT_FIELDS_LTOH)
uchar_t rcd : 1, /* Read Cache Disable */
mf : 1, /* Multiplication Factor */
wce : 1, /* Write Cache Enable */
: 5;
uchar_t write_reten_pri : 4, /* Write Retention Priority */
read_reten_pri : 4; /* Demand Read Retention Priority */
#elif defined(_BIT_FIELDS_HTOL)
uchar_t : 5,
wce : 1, /* Write Cache Enable */
mf : 1, /* Multiplication Factor */
rcd : 1; /* Read Cache Disable */
uchar_t read_reten_pri : 4, /* Demand Read Retention Priority */
write_reten_pri : 4; /* Write Retention Priority */
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif /* _BIT_FIELDS_LTOH */
ushort_t dis_prefetch_len; /* Disable prefetch xfer length */
ushort_t min_prefetch; /* minimum prefetch length */
ushort_t max_prefetch; /* maximum prefetch length */
ushort_t prefetch_ceiling; /* max prefetch ceiling */
};
/*
* Page 0x38 - This is the CCS Cache Page
*/
struct mode_cache_ccs {
struct mode_page mode_page; /* common mode page header */
uchar_t mode; /* Cache control and size */
uchar_t threshold; /* Prefetch threshold */
uchar_t max_prefetch; /* Max. prefetch */
uchar_t max_multiplier; /* Max. prefetch multiplier */
uchar_t min_prefetch; /* Min. prefetch */
uchar_t min_multiplier; /* Min. prefetch multiplier */
uchar_t rsvd2[8];
};
/*
* Page A: SCSI-2 control page was a little different than SCSI-3
*/
#define PAGELENGTH_MODE_CONTROL 0x06
struct mode_control {
struct mode_page mode_page; /* common mode page header */
#if defined(_BIT_FIELDS_LTOH)
uchar_t rlec : 1, /* Report Log Exception bit */
: 7;
uchar_t qdisable: 1, /* Queue disable */
que_err : 1, /* Queue error */
: 2,
que_mod : 4; /* Queue algorithm modifier */
uchar_t eanp : 1,
uaaenp : 1,
raenp : 1,
: 4,
eeca : 1;
#elif defined(_BIT_FIELDS_HTOL)
uchar_t : 7,
rlec : 1; /* Report Log Exception bit */
uchar_t que_mod : 4, /* Queue algorithm modifier */
: 2,
que_err : 1, /* Queue error */
qdisable: 1; /* Queue disable */
uchar_t eeca : 1,
: 4,
raenp : 1,
uaaenp : 1,
eanp : 1;
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif /* _BIT_FIELDS_LTOH */
uchar_t reserved;
ushort_t ready_aen_holdoff;
};
/*
* Emulex MD21 Unique Mode Select/Sense structure.
* This is apparently not used, although the MD21
* documentation refers to it.
*
* The medium_type in the mode header must be 0x80
* to indicate a vendor unique format. There is then
* a standard block descriptor page, which must be
* zeros (although the block descriptor length is set
* appropriately in the mode header).
*
* After this stuff, comes the vendor unique ESDI
* format parameters for the MD21.
*
* Notes:
*
* 1) The logical number of sectors/track should be the
* number of physical sectors/track less the number spare
* sectors/track.
*
* 2) The logical number of cylinders should be the
* number of physical cylinders less three (3) reserved
* for use by the drive, and less any alternate cylinders
* allocated.
*
* 3) head skew- see MD21 manual.
*/
struct emulex_format_params {
uchar_t alt_cyl; /* number of alternate cylinders */
#if defined(_BIT_FIELDS_LTOH)
uchar_t : 1,
sst : 2, /* spare sectors per track */
ssz : 1, /* sector size. 1 == 256 bps, 0 == 512 bps */
nheads : 4; /* number of heads */
#elif defined(_BIT_FIELDS_HTOL)
uchar_t nheads : 4, /* number of heads */
ssz : 1, /* sector size. 1 == 256 bps, 0 == 512 bps */
sst : 2, /* spare sectors per track */
: 1;
#else
#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
#endif /* _BIT_FIELDS_LTOH */
uchar_t nsect; /* logical sectors/track */
uchar_t ncyl_hi; /* logical number of cylinders, msb */
uchar_t ncyl_lo; /* logical number of cylinders, lsb */
uchar_t head_skew; /* head skew */
uchar_t reserved[3];
};
/*
* Page 0x31: CD-ROM speed page
*/
#define CDROM_MODE_SPEED 0x31
struct mode_speed {
struct mode_page mode_page; /* common mode page header */
uchar_t speed; /* drive speed */
uchar_t reserved;
};
/*
* Definitions for drive speed supported are in cdio.h
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SCSI_IMPL_MODE_H */
|