[MIPS] RTLX: Protect rtlx_{read,write} with mutex.
[linux-2.6/linux-mips/linux-dm7025.git] / drivers / scsi / osst.h
blob2cc7b5a1606a089b0346d0e8d53a914929bdde8e
1 /*
2 * $Header: /cvsroot/osst/Driver/osst.h,v 1.16 2005/01/01 21:13:35 wriede Exp $
3 */
5 #include <asm/byteorder.h>
6 #include <linux/completion.h>
8 /* FIXME - rename and use the following two types or delete them!
9 * and the types really should go to st.h anyway...
10 * INQUIRY packet command - Data Format (From Table 6-8 of QIC-157C)
12 typedef struct {
13 unsigned device_type :5; /* Peripheral Device Type */
14 unsigned reserved0_765 :3; /* Peripheral Qualifier - Reserved */
15 unsigned reserved1_6t0 :7; /* Reserved */
16 unsigned rmb :1; /* Removable Medium Bit */
17 unsigned ansi_version :3; /* ANSI Version */
18 unsigned ecma_version :3; /* ECMA Version */
19 unsigned iso_version :2; /* ISO Version */
20 unsigned response_format :4; /* Response Data Format */
21 unsigned reserved3_45 :2; /* Reserved */
22 unsigned reserved3_6 :1; /* TrmIOP - Reserved */
23 unsigned reserved3_7 :1; /* AENC - Reserved */
24 u8 additional_length; /* Additional Length (total_length-4) */
25 u8 rsv5, rsv6, rsv7; /* Reserved */
26 u8 vendor_id[8]; /* Vendor Identification */
27 u8 product_id[16]; /* Product Identification */
28 u8 revision_level[4]; /* Revision Level */
29 u8 vendor_specific[20]; /* Vendor Specific - Optional */
30 u8 reserved56t95[40]; /* Reserved - Optional */
31 /* Additional information may be returned */
32 } idetape_inquiry_result_t;
35 * READ POSITION packet command - Data Format (From Table 6-57)
37 typedef struct {
38 unsigned reserved0_10 :2; /* Reserved */
39 unsigned bpu :1; /* Block Position Unknown */
40 unsigned reserved0_543 :3; /* Reserved */
41 unsigned eop :1; /* End Of Partition */
42 unsigned bop :1; /* Beginning Of Partition */
43 u8 partition; /* Partition Number */
44 u8 reserved2, reserved3; /* Reserved */
45 u32 first_block; /* First Block Location */
46 u32 last_block; /* Last Block Location (Optional) */
47 u8 reserved12; /* Reserved */
48 u8 blocks_in_buffer[3]; /* Blocks In Buffer - (Optional) */
49 u32 bytes_in_buffer; /* Bytes In Buffer (Optional) */
50 } idetape_read_position_result_t;
53 * Follows structures which are related to the SELECT SENSE / MODE SENSE
54 * packet commands.
56 #define COMPRESSION_PAGE 0x0f
57 #define COMPRESSION_PAGE_LENGTH 16
59 #define CAPABILITIES_PAGE 0x2a
60 #define CAPABILITIES_PAGE_LENGTH 20
62 #define TAPE_PARAMTR_PAGE 0x2b
63 #define TAPE_PARAMTR_PAGE_LENGTH 16
65 #define NUMBER_RETRIES_PAGE 0x2f
66 #define NUMBER_RETRIES_PAGE_LENGTH 4
68 #define BLOCK_SIZE_PAGE 0x30
69 #define BLOCK_SIZE_PAGE_LENGTH 4
71 #define BUFFER_FILLING_PAGE 0x33
72 #define BUFFER_FILLING_PAGE_LENGTH 4
74 #define VENDOR_IDENT_PAGE 0x36
75 #define VENDOR_IDENT_PAGE_LENGTH 8
77 #define LOCATE_STATUS_PAGE 0x37
78 #define LOCATE_STATUS_PAGE_LENGTH 0
80 #define MODE_HEADER_LENGTH 4
84 * REQUEST SENSE packet command result - Data Format.
86 typedef struct {
87 unsigned error_code :7; /* Current of deferred errors */
88 unsigned valid :1; /* The information field conforms to QIC-157C */
89 u8 reserved1 :8; /* Segment Number - Reserved */
90 unsigned sense_key :4; /* Sense Key */
91 unsigned reserved2_4 :1; /* Reserved */
92 unsigned ili :1; /* Incorrect Length Indicator */
93 unsigned eom :1; /* End Of Medium */
94 unsigned filemark :1; /* Filemark */
95 u32 information __attribute__ ((packed));
96 u8 asl; /* Additional sense length (n-7) */
97 u32 command_specific; /* Additional command specific information */
98 u8 asc; /* Additional Sense Code */
99 u8 ascq; /* Additional Sense Code Qualifier */
100 u8 replaceable_unit_code; /* Field Replaceable Unit Code */
101 unsigned sk_specific1 :7; /* Sense Key Specific */
102 unsigned sksv :1; /* Sense Key Specific information is valid */
103 u8 sk_specific2; /* Sense Key Specific */
104 u8 sk_specific3; /* Sense Key Specific */
105 u8 pad[2]; /* Padding to 20 bytes */
106 } idetape_request_sense_result_t;
109 * Mode Parameter Header for the MODE SENSE packet command
111 typedef struct {
112 u8 mode_data_length; /* Length of the following data transfer */
113 u8 medium_type; /* Medium Type */
114 u8 dsp; /* Device Specific Parameter */
115 u8 bdl; /* Block Descriptor Length */
116 } osst_mode_parameter_header_t;
119 * Mode Parameter Block Descriptor the MODE SENSE packet command
121 * Support for block descriptors is optional.
123 typedef struct {
124 u8 density_code; /* Medium density code */
125 u8 blocks[3]; /* Number of blocks */
126 u8 reserved4; /* Reserved */
127 u8 length[3]; /* Block Length */
128 } osst_parameter_block_descriptor_t;
131 * The Data Compression Page, as returned by the MODE SENSE packet command.
133 typedef struct {
134 #if defined(__BIG_ENDIAN_BITFIELD)
135 unsigned ps :1;
136 unsigned reserved0 :1; /* Reserved */
137 unsigned page_code :6; /* Page Code - Should be 0xf */
138 #elif defined(__LITTLE_ENDIAN_BITFIELD)
139 unsigned page_code :6; /* Page Code - Should be 0xf */
140 unsigned reserved0 :1; /* Reserved */
141 unsigned ps :1;
142 #else
143 #error "Please fix <asm/byteorder.h>"
144 #endif
145 u8 page_length; /* Page Length - Should be 14 */
146 #if defined(__BIG_ENDIAN_BITFIELD)
147 unsigned dce :1; /* Data Compression Enable */
148 unsigned dcc :1; /* Data Compression Capable */
149 unsigned reserved2 :6; /* Reserved */
150 #elif defined(__LITTLE_ENDIAN_BITFIELD)
151 unsigned reserved2 :6; /* Reserved */
152 unsigned dcc :1; /* Data Compression Capable */
153 unsigned dce :1; /* Data Compression Enable */
154 #else
155 #error "Please fix <asm/byteorder.h>"
156 #endif
157 #if defined(__BIG_ENDIAN_BITFIELD)
158 unsigned dde :1; /* Data Decompression Enable */
159 unsigned red :2; /* Report Exception on Decompression */
160 unsigned reserved3 :5; /* Reserved */
161 #elif defined(__LITTLE_ENDIAN_BITFIELD)
162 unsigned reserved3 :5; /* Reserved */
163 unsigned red :2; /* Report Exception on Decompression */
164 unsigned dde :1; /* Data Decompression Enable */
165 #else
166 #error "Please fix <asm/byteorder.h>"
167 #endif
168 u32 ca; /* Compression Algorithm */
169 u32 da; /* Decompression Algorithm */
170 u8 reserved[4]; /* Reserved */
171 } osst_data_compression_page_t;
174 * The Medium Partition Page, as returned by the MODE SENSE packet command.
176 typedef struct {
177 #if defined(__BIG_ENDIAN_BITFIELD)
178 unsigned ps :1;
179 unsigned reserved1_6 :1; /* Reserved */
180 unsigned page_code :6; /* Page Code - Should be 0x11 */
181 #elif defined(__LITTLE_ENDIAN_BITFIELD)
182 unsigned page_code :6; /* Page Code - Should be 0x11 */
183 unsigned reserved1_6 :1; /* Reserved */
184 unsigned ps :1;
185 #else
186 #error "Please fix <asm/byteorder.h>"
187 #endif
188 u8 page_length; /* Page Length - Should be 6 */
189 u8 map; /* Maximum Additional Partitions - Should be 0 */
190 u8 apd; /* Additional Partitions Defined - Should be 0 */
191 #if defined(__BIG_ENDIAN_BITFIELD)
192 unsigned fdp :1; /* Fixed Data Partitions */
193 unsigned sdp :1; /* Should be 0 */
194 unsigned idp :1; /* Should be 0 */
195 unsigned psum :2; /* Should be 0 */
196 unsigned reserved4_012 :3; /* Reserved */
197 #elif defined(__LITTLE_ENDIAN_BITFIELD)
198 unsigned reserved4_012 :3; /* Reserved */
199 unsigned psum :2; /* Should be 0 */
200 unsigned idp :1; /* Should be 0 */
201 unsigned sdp :1; /* Should be 0 */
202 unsigned fdp :1; /* Fixed Data Partitions */
203 #else
204 #error "Please fix <asm/byteorder.h>"
205 #endif
206 u8 mfr; /* Medium Format Recognition */
207 u8 reserved[2]; /* Reserved */
208 } osst_medium_partition_page_t;
211 * Capabilities and Mechanical Status Page
213 typedef struct {
214 #if defined(__BIG_ENDIAN_BITFIELD)
215 unsigned reserved1_67 :2;
216 unsigned page_code :6; /* Page code - Should be 0x2a */
217 #elif defined(__LITTLE_ENDIAN_BITFIELD)
218 unsigned page_code :6; /* Page code - Should be 0x2a */
219 unsigned reserved1_67 :2;
220 #else
221 #error "Please fix <asm/byteorder.h>"
222 #endif
223 u8 page_length; /* Page Length - Should be 0x12 */
224 u8 reserved2, reserved3;
225 #if defined(__BIG_ENDIAN_BITFIELD)
226 unsigned reserved4_67 :2;
227 unsigned sprev :1; /* Supports SPACE in the reverse direction */
228 unsigned reserved4_1234 :4;
229 unsigned ro :1; /* Read Only Mode */
230 #elif defined(__LITTLE_ENDIAN_BITFIELD)
231 unsigned ro :1; /* Read Only Mode */
232 unsigned reserved4_1234 :4;
233 unsigned sprev :1; /* Supports SPACE in the reverse direction */
234 unsigned reserved4_67 :2;
235 #else
236 #error "Please fix <asm/byteorder.h>"
237 #endif
238 #if defined(__BIG_ENDIAN_BITFIELD)
239 unsigned reserved5_67 :2;
240 unsigned qfa :1; /* Supports the QFA two partition formats */
241 unsigned reserved5_4 :1;
242 unsigned efmt :1; /* Supports ERASE command initiated formatting */
243 unsigned reserved5_012 :3;
244 #elif defined(__LITTLE_ENDIAN_BITFIELD)
245 unsigned reserved5_012 :3;
246 unsigned efmt :1; /* Supports ERASE command initiated formatting */
247 unsigned reserved5_4 :1;
248 unsigned qfa :1; /* Supports the QFA two partition formats */
249 unsigned reserved5_67 :2;
250 #else
251 #error "Please fix <asm/byteorder.h>"
252 #endif
253 #if defined(__BIG_ENDIAN_BITFIELD)
254 unsigned cmprs :1; /* Supports data compression */
255 unsigned ecc :1; /* Supports error correction */
256 unsigned reserved6_45 :2; /* Reserved */
257 unsigned eject :1; /* The device can eject the volume */
258 unsigned prevent :1; /* The device defaults in the prevent state after power up */
259 unsigned locked :1; /* The volume is locked */
260 unsigned lock :1; /* Supports locking the volume */
261 #elif defined(__LITTLE_ENDIAN_BITFIELD)
262 unsigned lock :1; /* Supports locking the volume */
263 unsigned locked :1; /* The volume is locked */
264 unsigned prevent :1; /* The device defaults in the prevent state after power up */
265 unsigned eject :1; /* The device can eject the volume */
266 unsigned reserved6_45 :2; /* Reserved */
267 unsigned ecc :1; /* Supports error correction */
268 unsigned cmprs :1; /* Supports data compression */
269 #else
270 #error "Please fix <asm/byteorder.h>"
271 #endif
272 #if defined(__BIG_ENDIAN_BITFIELD)
273 unsigned blk32768 :1; /* slowb - the device restricts the byte count for PIO */
274 /* transfers for slow buffer memory ??? */
275 /* Also 32768 block size in some cases */
276 unsigned reserved7_3_6 :4;
277 unsigned blk1024 :1; /* Supports 1024 bytes block size */
278 unsigned blk512 :1; /* Supports 512 bytes block size */
279 unsigned reserved7_0 :1;
280 #elif defined(__LITTLE_ENDIAN_BITFIELD)
281 unsigned reserved7_0 :1;
282 unsigned blk512 :1; /* Supports 512 bytes block size */
283 unsigned blk1024 :1; /* Supports 1024 bytes block size */
284 unsigned reserved7_3_6 :4;
285 unsigned blk32768 :1; /* slowb - the device restricts the byte count for PIO */
286 /* transfers for slow buffer memory ??? */
287 /* Also 32768 block size in some cases */
288 #else
289 #error "Please fix <asm/byteorder.h>"
290 #endif
291 __be16 max_speed; /* Maximum speed supported in KBps */
292 u8 reserved10, reserved11;
293 __be16 ctl; /* Continuous Transfer Limit in blocks */
294 __be16 speed; /* Current Speed, in KBps */
295 __be16 buffer_size; /* Buffer Size, in 512 bytes */
296 u8 reserved18, reserved19;
297 } osst_capabilities_page_t;
300 * Block Size Page
302 typedef struct {
303 #if defined(__BIG_ENDIAN_BITFIELD)
304 unsigned ps :1;
305 unsigned reserved1_6 :1;
306 unsigned page_code :6; /* Page code - Should be 0x30 */
307 #elif defined(__LITTLE_ENDIAN_BITFIELD)
308 unsigned page_code :6; /* Page code - Should be 0x30 */
309 unsigned reserved1_6 :1;
310 unsigned ps :1;
311 #else
312 #error "Please fix <asm/byteorder.h>"
313 #endif
314 u8 page_length; /* Page Length - Should be 2 */
315 u8 reserved2;
316 #if defined(__BIG_ENDIAN_BITFIELD)
317 unsigned one :1;
318 unsigned reserved2_6 :1;
319 unsigned record32_5 :1;
320 unsigned record32 :1;
321 unsigned reserved2_23 :2;
322 unsigned play32_5 :1;
323 unsigned play32 :1;
324 #elif defined(__LITTLE_ENDIAN_BITFIELD)
325 unsigned play32 :1;
326 unsigned play32_5 :1;
327 unsigned reserved2_23 :2;
328 unsigned record32 :1;
329 unsigned record32_5 :1;
330 unsigned reserved2_6 :1;
331 unsigned one :1;
332 #else
333 #error "Please fix <asm/byteorder.h>"
334 #endif
335 } osst_block_size_page_t;
338 * Tape Parameters Page
340 typedef struct {
341 #if defined(__BIG_ENDIAN_BITFIELD)
342 unsigned ps :1;
343 unsigned reserved1_6 :1;
344 unsigned page_code :6; /* Page code - Should be 0x2b */
345 #elif defined(__LITTLE_ENDIAN_BITFIELD)
346 unsigned page_code :6; /* Page code - Should be 0x2b */
347 unsigned reserved1_6 :1;
348 unsigned ps :1;
349 #else
350 #error "Please fix <asm/byteorder.h>"
351 #endif
352 u8 reserved2;
353 u8 density;
354 u8 reserved3,reserved4;
355 __be16 segtrk;
356 __be16 trks;
357 u8 reserved5,reserved6,reserved7,reserved8,reserved9,reserved10;
358 } osst_tape_paramtr_page_t;
360 /* OnStream definitions */
362 #define OS_CONFIG_PARTITION (0xff)
363 #define OS_DATA_PARTITION (0)
364 #define OS_PARTITION_VERSION (1)
367 * partition
369 typedef struct os_partition_s {
370 __u8 partition_num;
371 __u8 par_desc_ver;
372 __be16 wrt_pass_cntr;
373 __be32 first_frame_ppos;
374 __be32 last_frame_ppos;
375 __be32 eod_frame_ppos;
376 } os_partition_t;
379 * DAT entry
381 typedef struct os_dat_entry_s {
382 __be32 blk_sz;
383 __be16 blk_cnt;
384 __u8 flags;
385 __u8 reserved;
386 } os_dat_entry_t;
389 * DAT
391 #define OS_DAT_FLAGS_DATA (0xc)
392 #define OS_DAT_FLAGS_MARK (0x1)
394 typedef struct os_dat_s {
395 __u8 dat_sz;
396 __u8 reserved1;
397 __u8 entry_cnt;
398 __u8 reserved3;
399 os_dat_entry_t dat_list[16];
400 } os_dat_t;
403 * Frame types
405 #define OS_FRAME_TYPE_FILL (0)
406 #define OS_FRAME_TYPE_EOD (1 << 0)
407 #define OS_FRAME_TYPE_MARKER (1 << 1)
408 #define OS_FRAME_TYPE_HEADER (1 << 3)
409 #define OS_FRAME_TYPE_DATA (1 << 7)
412 * AUX
414 typedef struct os_aux_s {
415 __be32 format_id; /* hardware compability AUX is based on */
416 char application_sig[4]; /* driver used to write this media */
417 __be32 hdwr; /* reserved */
418 __be32 update_frame_cntr; /* for configuration frame */
419 __u8 frame_type;
420 __u8 frame_type_reserved;
421 __u8 reserved_18_19[2];
422 os_partition_t partition;
423 __u8 reserved_36_43[8];
424 __be32 frame_seq_num;
425 __be32 logical_blk_num_high;
426 __be32 logical_blk_num;
427 os_dat_t dat;
428 __u8 reserved188_191[4];
429 __be32 filemark_cnt;
430 __be32 phys_fm;
431 __be32 last_mark_ppos;
432 __u8 reserved204_223[20];
435 * __u8 app_specific[32];
437 * Linux specific fields:
439 __be32 next_mark_ppos; /* when known, points to next marker */
440 __be32 last_mark_lbn; /* storing log_blk_num of last mark is extends ADR spec */
441 __u8 linux_specific[24];
443 __u8 reserved_256_511[256];
444 } os_aux_t;
446 #define OS_FM_TAB_MAX 1024
448 typedef struct os_fm_tab_s {
449 __u8 fm_part_num;
450 __u8 reserved_1;
451 __u8 fm_tab_ent_sz;
452 __u8 reserved_3;
453 __be16 fm_tab_ent_cnt;
454 __u8 reserved6_15[10];
455 __be32 fm_tab_ent[OS_FM_TAB_MAX];
456 } os_fm_tab_t;
458 typedef struct os_ext_trk_ey_s {
459 __u8 et_part_num;
460 __u8 fmt;
461 __be16 fm_tab_off;
462 __u8 reserved4_7[4];
463 __be32 last_hlb_hi;
464 __be32 last_hlb;
465 __be32 last_pp;
466 __u8 reserved20_31[12];
467 } os_ext_trk_ey_t;
469 typedef struct os_ext_trk_tb_s {
470 __u8 nr_stream_part;
471 __u8 reserved_1;
472 __u8 et_ent_sz;
473 __u8 reserved3_15[13];
474 os_ext_trk_ey_t dat_ext_trk_ey;
475 os_ext_trk_ey_t qfa_ext_trk_ey;
476 } os_ext_trk_tb_t;
478 typedef struct os_header_s {
479 char ident_str[8];
480 __u8 major_rev;
481 __u8 minor_rev;
482 __be16 ext_trk_tb_off;
483 __u8 reserved12_15[4];
484 __u8 pt_par_num;
485 __u8 pt_reserved1_3[3];
486 os_partition_t partition[16];
487 __be32 cfg_col_width;
488 __be32 dat_col_width;
489 __be32 qfa_col_width;
490 __u8 cartridge[16];
491 __u8 reserved304_511[208];
492 __be32 old_filemark_list[16680/4]; /* in ADR 1.4 __u8 track_table[16680] */
493 os_ext_trk_tb_t ext_track_tb;
494 __u8 reserved17272_17735[464];
495 os_fm_tab_t dat_fm_tab;
496 os_fm_tab_t qfa_fm_tab;
497 __u8 reserved25960_32767[6808];
498 } os_header_t;
502 * OnStream ADRL frame
504 #define OS_FRAME_SIZE (32 * 1024 + 512)
505 #define OS_DATA_SIZE (32 * 1024)
506 #define OS_AUX_SIZE (512)
507 //#define OSST_MAX_SG 2
509 /* The OnStream tape buffer descriptor. */
510 struct osst_buffer {
511 unsigned char in_use;
512 unsigned char dma; /* DMA-able buffer */
513 int buffer_size;
514 int buffer_blocks;
515 int buffer_bytes;
516 int read_pointer;
517 int writing;
518 int midlevel_result;
519 int syscall_result;
520 struct osst_request *last_SRpnt;
521 struct st_cmdstatus cmdstat;
522 unsigned char *b_data;
523 os_aux_t *aux; /* onstream AUX structure at end of each block */
524 unsigned short use_sg; /* zero or number of s/g segments for this adapter */
525 unsigned short sg_segs; /* number of segments in s/g list */
526 unsigned short orig_sg_segs; /* number of segments allocated at first try */
527 struct scatterlist sg[1]; /* MUST BE last item */
530 /* The OnStream tape drive descriptor */
531 struct osst_tape {
532 struct scsi_driver *driver;
533 unsigned capacity;
534 struct scsi_device *device;
535 struct semaphore lock; /* for serialization */
536 struct completion wait; /* for SCSI commands */
537 struct osst_buffer * buffer;
539 /* Drive characteristics */
540 unsigned char omit_blklims;
541 unsigned char do_auto_lock;
542 unsigned char can_bsr;
543 unsigned char can_partitions;
544 unsigned char two_fm;
545 unsigned char fast_mteom;
546 unsigned char restr_dma;
547 unsigned char scsi2_logical;
548 unsigned char default_drvbuffer; /* 0xff = don't touch, value 3 bits */
549 unsigned char pos_unknown; /* after reset position unknown */
550 int write_threshold;
551 int timeout; /* timeout for normal commands */
552 int long_timeout; /* timeout for commands known to take long time*/
554 /* Mode characteristics */
555 struct st_modedef modes[ST_NBR_MODES];
556 int current_mode;
558 /* Status variables */
559 int partition;
560 int new_partition;
561 int nbr_partitions; /* zero until partition support enabled */
562 struct st_partstat ps[ST_NBR_PARTITIONS];
563 unsigned char dirty;
564 unsigned char ready;
565 unsigned char write_prot;
566 unsigned char drv_write_prot;
567 unsigned char in_use;
568 unsigned char blksize_changed;
569 unsigned char density_changed;
570 unsigned char compression_changed;
571 unsigned char drv_buffer;
572 unsigned char density;
573 unsigned char door_locked;
574 unsigned char rew_at_close;
575 unsigned char inited;
576 int block_size;
577 int min_block;
578 int max_block;
579 int recover_count; /* from tape opening */
580 int abort_count;
581 int write_count;
582 int read_count;
583 int recover_erreg; /* from last status call */
585 * OnStream specific data
587 int os_fw_rev; /* the firmware revision * 10000 */
588 unsigned char raw; /* flag OnStream raw access (32.5KB block size) */
589 unsigned char poll; /* flag that this drive needs polling (IDE|firmware) */
590 unsigned char frame_in_buffer; /* flag that the frame as per frame_seq_number
591 * has been read into STp->buffer and is valid */
592 int frame_seq_number; /* logical frame number */
593 int logical_blk_num; /* logical block number */
594 unsigned first_frame_position; /* physical frame to be transferred to/from host */
595 unsigned last_frame_position; /* physical frame to be transferd to/from tape */
596 int cur_frames; /* current number of frames in internal buffer */
597 int max_frames; /* max number of frames in internal buffer */
598 char application_sig[5]; /* application signature */
599 unsigned char fast_open; /* flag that reminds us we didn't check headers at open */
600 unsigned short wrt_pass_cntr; /* write pass counter */
601 int update_frame_cntr; /* update frame counter */
602 int onstream_write_error; /* write error recovery active */
603 int header_ok; /* header frame verified ok */
604 int linux_media; /* reading linux-specifc media */
605 int linux_media_version;
606 os_header_t * header_cache; /* cache is kept for filemark positions */
607 int filemark_cnt;
608 int first_mark_ppos;
609 int last_mark_ppos;
610 int last_mark_lbn; /* storing log_blk_num of last mark is extends ADR spec */
611 int first_data_ppos;
612 int eod_frame_ppos;
613 int eod_frame_lfa;
614 int write_type; /* used in write error recovery */
615 int read_error_frame; /* used in read error recovery */
616 unsigned long cmd_start_time;
617 unsigned long max_cmd_time;
619 #if DEBUG
620 unsigned char write_pending;
621 int nbr_finished;
622 int nbr_waits;
623 unsigned char last_cmnd[6];
624 unsigned char last_sense[16];
625 #endif
626 struct gendisk *drive;
629 /* scsi tape command */
630 struct osst_request {
631 unsigned char cmd[MAX_COMMAND_SIZE];
632 unsigned char sense[SCSI_SENSE_BUFFERSIZE];
633 int result;
634 struct osst_tape *stp;
635 struct completion *waiting;
638 /* Values of write_type */
639 #define OS_WRITE_DATA 0
640 #define OS_WRITE_EOD 1
641 #define OS_WRITE_NEW_MARK 2
642 #define OS_WRITE_LAST_MARK 3
643 #define OS_WRITE_HEADER 4
644 #define OS_WRITE_FILLER 5
646 /* Additional rw state */
647 #define OS_WRITING_COMPLETE 3