FreeBSD/Linux Kernel Cross Reference
sys/scsi/scsi_tape.h
1 /*
2 * SCSI tape interface description
3 */
4
5 /*
6 * Written by Julian Elischer (julian@tfs.com)
7 * for TRW Financial Systems.
8 *
9 * TRW Financial Systems, in accordance with their agreement with Carnegie
10 * Mellon University, makes this software available to CMU to distribute
11 * or use in any manner that they see fit as long as this message is kept with
12 * the software. For this reason TFS also grants any other persons or
13 * organisations permission to use or modify this software.
14 *
15 * TFS supplies this software to be publicly redistributed
16 * on the understanding that TFS is not responsible for the correct
17 * functioning of this software in any circumstances.
18 *
19 */
20
21 /*
22 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
23 *
24 * $FreeBSD: src/sys/scsi/scsi_tape.h,v 1.16.6.1 1999/09/05 08:21:45 peter Exp $
25 */
26 #ifndef SCSI_SCSI_TAPE_H
27 #define SCSI_SCSI_TAPE_H 1
28
29
30
31 /*
32 * SCSI command formats
33 */
34
35
36 struct scsi_rw_tape
37 {
38 u_char op_code;
39 u_char byte2;
40 #define SRWT_FIXED 0x01
41 u_char len[3];
42 u_char control;
43 };
44
45 struct scsi_space
46 {
47 u_char op_code;
48 u_char byte2;
49 #define SS_CODE 0x03
50 u_char number[3];
51 u_char control;
52 };
53 #define SP_BLKS 0
54 #define SP_FILEMARKS 1
55 #define SP_SEQ_FILEMARKS 2
56 #define SP_EOM 3
57
58 struct scsi_write_filemarks
59 {
60 u_char op_code;
61 u_char byte2;
62 u_char number[3];
63 u_char control;
64 };
65
66 struct scsi_rewind
67 {
68 u_char op_code;
69 u_char byte2;
70 #define SR_IMMED 0x01
71 u_char unused[3];
72 u_char control;
73 };
74
75 /*
76 ** Tape erase - AKL: Andreas Klemm <andreas@knobel.gun.de>
77 */
78 struct scsi_erase
79 {
80 u_char op_code;
81 u_char byte2;
82 #define SE_LONG 0x01 /*
83 ** Archive Viper 2525 doesn't allow short
84 ** erase, other tapes possibly don't allow
85 ** that, too.
86 */
87 #define SE_IMMED 0x02
88 u_char unused[3];
89 u_char control;
90 };
91
92 struct scsi_load
93 {
94 u_char op_code;
95 u_char byte2;
96 #define SL_IMMED 0x01
97 u_char unused[2];
98 u_char how;
99 u_char control;
100 };
101 #define LD_UNLOAD 0
102 #define LD_LOAD 1
103 #define LD_RETEN 2
104
105
106 struct scsi_blk_limits
107 {
108 u_char op_code;
109 u_char byte2;
110 u_char unused[3];
111 u_char control;
112 };
113
114 /*
115 * Opcodes
116 */
117
118 #define REWIND 0x01
119 #define READ_BLK_LIMITS 0x05
120 #define READ_COMMAND_TAPE 0x08
121 #define WRITE_COMMAND_TAPE 0x0a
122 #define WRITE_FILEMARKS 0x10
123 #define SPACE 0x11
124 #define ERASE 0x19
125 #define LOAD_UNLOAD 0x1b
126
127
128
129 struct scsi_blk_limits_data
130 {
131 u_char reserved;
132 u_char max_length_2; /* Most significant */
133 u_char max_length_1;
134 u_char max_length_0; /* Least significant */
135 u_char min_length_1; /* Most significant */
136 u_char min_length_0; /* Least significant */
137 };
138
139 /* defines for the device specific byte in the mode select/sense header */
140 #define SMH_DSP_SPEED 0x0F
141 #define SMH_DSP_BUFF_MODE 0x70
142 #define SMH_DSP_BUFF_MODE_OFF 0x00
143 #define SMH_DSP_BUFF_MODE_ON 0x10
144 #define SMH_DSP_BUFF_MODE_MLTI 0x20
145 #define SMH_DSP_WRITE_PROT 0x80
146
147 /* A special for the CIPHER ST150S(old drive) */
148 struct blk_desc_cipher
149 {
150 u_char density;
151 u_char nblocks[3];
152 u_char reserved;
153 u_char blklen[3];
154 u_char other;
155 #define ST150_SEC 0x01 /* soft error count */
156 #define SR150_AUI 0x02 /* autoload inhibit */
157 };
158
159 /*
160 * This structure defines the various mode pages that tapes know about.
161 */
162 #define PAGE_HEADERLEN 2
163 struct tape_pages
164 {
165 u_char pg_code; /* page code */
166 #define ST_PAGE_CONFIGURATION 0x10
167 #define ST_PAGE_MEDIUM_PART 0x11
168 #define ST_PAGE_MEDIUM_PART2 0x12
169 #define ST_PAGE_MEDIUM_PART3 0x13
170 #define ST_PAGE_MEDIUM_PART4 0x14
171 #define ST_P_CODE 0x3F /* page code */
172 #define ST_P_PS 0x80 /* page savable */
173 u_char pg_length; /* page length */
174 union
175 {
176 struct
177 {
178 u_char active_format; /* active format for density*/
179 #define ST_P_CAP 0x40 /* change active Partition */
180 #define ST_P_CAF 0x20 /* change active format */
181 #define ST_P_AF 0x1F /* active format */
182 u_char active_partition; /* */
183 u_char write_buffer_full_ratio; /* highwater writing*/
184 u_char read_buffer_empty_ratio; /* lowwater reading*/
185 u_char write_delay_high; /* # 100mSecs before flush*/
186 u_char write_delay_low; /* of buffer to the media */
187 u_char flags1; /* various single bit flags */
188 #define ST_P_DBR 0x80 /* supports data-buffer recovery */
189 #define ST_P_BIS 0x40 /* supports Block_ID */
190 #define ST_P_RSmk 0x20 /* Reports setmarks during reads and spaces */
191 #define ST_P_AVC 0x10 /* Supports Automatic Velocity Control */
192 #define ST_P_SOCF 0x0C /* Stop On Consecutive Filemarks, */
193 #define ST_P_RBO 0x02 /* Recoverd Buffered Data order, 1 = LIFO */
194 #define ST_P_REW 0x01 /* Report Early Warning (see SEW) */
195 u_char gap_size; /*I/B gap, 1=min 0=default */
196 u_char flags2; /* various single bit flags */
197 #define ST_P_EOD 0xE0 /* What is and EOD....*/
198 #define ST_P_EOD_DEF 0x00 /* Drive's default */
199 #define ST_P_EOD_FMT 0x20 /* define by format */
200 #define ST_P_EOD_SOCF 0x40 /* define by SOCF (above) */
201 #define ST_P_EEG 0x10 /* use EOD above */
202 #define ST_P_SEW 0x04 /* Synchronise at Early warning.. flush buffers*/
203 u_char early_warn_high;/* buf size at early warning */
204 u_char early_warn_med; /* after early warning, only */
205 u_char early_warn_low; /* buufer this much data */
206 u_char data_compress_alg; /* 0 = off, 1 = default */
207 u_char reserved; /* The standard says so */
208 } configuration;
209 struct
210 {
211 #define ST_MAXPARTS 16 /*for now*/
212 u_char max_add_parts; /* that drive allows */
213 u_char parts_defined; /* max min(ST_MAXPARTS,max_add_parts) */
214 u_char flags;
215 #define ST_P_FDP 0x80
216 #define ST_P_SDP 0x40
217 #define ST_P_IDP 0x20
218 #define ST_P_PSUM 0x18 /* units of part defs.. */
219 #define ST_P_PSUM_BYTES 0x0 /* units of part defs.. */
220 #define ST_P_PSUM_KBYTES 0x08 /* units of part defs.. */
221 #define ST_P_PSUM_MBYTES 0x10 /* units of part defs.. */
222 u_char medium_format_recog;
223 #define ST_P_REC_NONE 0x00
224 #define ST_P_REC_FMT 0x01 /* can recognise format of new media */
225 #define ST_P_REC_PART 0x02 /* can recognise partitions of new media */
226 #define ST_P_REC_FMT_PART 0x03 /* can recognise format and parts */
227 u_char reserved1;
228 u_char reserved2;
229 struct
230 {
231 u_char high;
232 u_char low;
233 }part[ST_MAXPARTS];
234 } medium_partition;
235 struct
236 {
237 struct
238 {
239 u_char high;
240 u_char low;
241 }part[ST_MAXPARTS];
242 } medium_partition_extra;
243 }pages;
244 };
245
246
247 #endif /*SCSI_SCSI_TAPE_H*/
Cache object: af0e6a490a518726553b3e84b0434088
|