Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / drivers / scsi / st.h
blob38b5fa1be7ee86a58ca73bbc19dfefd78f7b343f
2 #ifndef _ST_H
3 #define _ST_H
4 /*
5 $Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/st.h,v 1.1 1992/04/24 18:01:50 root Exp root $
6 */
8 #ifndef _SCSI_H
9 #include "scsi.h"
10 #endif
11 #include <linux/devfs_fs_kernel.h>
13 /* The tape buffer descriptor. */
14 typedef struct {
15 unsigned char in_use;
16 unsigned char dma; /* DMA-able buffer */
17 int buffer_size;
18 int buffer_blocks;
19 int buffer_bytes;
20 int read_pointer;
21 int writing;
22 int midlevel_result;
23 int syscall_result;
24 Scsi_Request *last_SRpnt;
25 unsigned char *b_data;
26 unsigned short use_sg; /* zero or number of segments for this adapter */
27 unsigned short sg_segs; /* total number of allocated segments */
28 unsigned short orig_sg_segs; /* number of segments allocated at first try */
29 struct scatterlist sg[1]; /* MUST BE last item */
30 } ST_buffer;
33 /* The tape mode definition */
34 typedef struct {
35 unsigned char defined;
36 unsigned char sysv; /* SYS V semantics? */
37 unsigned char do_async_writes;
38 unsigned char do_buffer_writes;
39 unsigned char do_read_ahead;
40 unsigned char defaults_for_writes;
41 unsigned char default_compression; /* 0 = don't touch, etc */
42 short default_density; /* Forced density, -1 = no value */
43 int default_blksize; /* Forced blocksize, -1 = no value */
44 } ST_mode;
46 #define ST_NBR_MODE_BITS 2
47 #define ST_NBR_MODES (1 << ST_NBR_MODE_BITS)
48 #define ST_MODE_SHIFT (7 - ST_NBR_MODE_BITS)
49 #define ST_MODE_MASK ((ST_NBR_MODES - 1) << ST_MODE_SHIFT)
50 #define ST_MAX_TAPES (1 << ST_MODE_SHIFT)
52 /* The status related to each partition */
53 typedef struct {
54 unsigned char rw;
55 unsigned char eof;
56 unsigned char at_sm;
57 unsigned char last_block_valid;
58 u32 last_block_visited;
59 int drv_block; /* The block where the drive head is */
60 int drv_file;
61 } ST_partstat;
63 #define ST_NBR_PARTITIONS 4
65 /* The tape drive descriptor */
66 typedef struct {
67 kdev_t devt;
68 Scsi_Device *device;
69 struct semaphore lock; /* For serialization */
70 struct semaphore sem; /* For SCSI commands */
71 ST_buffer *buffer;
73 /* Drive characteristics */
74 unsigned char omit_blklims;
75 unsigned char do_auto_lock;
76 unsigned char can_bsr;
77 unsigned char can_partitions;
78 unsigned char two_fm;
79 unsigned char fast_mteom;
80 unsigned char restr_dma;
81 unsigned char scsi2_logical;
82 unsigned char default_drvbuffer; /* 0xff = don't touch, value 3 bits */
83 int tape_type;
84 int write_threshold;
85 int timeout; /* timeout for normal commands */
86 int long_timeout; /* timeout for commands known to take long time */
88 /* Mode characteristics */
89 ST_mode modes[ST_NBR_MODES];
90 int current_mode;
91 devfs_handle_t de_r[ST_NBR_MODES]; /* Rewind entries */
92 devfs_handle_t de_n[ST_NBR_MODES]; /* No-rewind entries */
94 /* Status variables */
95 int partition;
96 int new_partition;
97 int nbr_partitions; /* zero until partition support enabled */
98 ST_partstat ps[ST_NBR_PARTITIONS];
99 unsigned char dirty;
100 unsigned char ready;
101 unsigned char write_prot;
102 unsigned char drv_write_prot;
103 unsigned char in_use;
104 unsigned char blksize_changed;
105 unsigned char density_changed;
106 unsigned char compression_changed;
107 unsigned char drv_buffer;
108 unsigned char density;
109 unsigned char door_locked;
110 unsigned char autorew_dev; /* auto-rewind device */
111 unsigned char rew_at_close; /* rewind necessary at close */
112 unsigned char inited;
113 int block_size;
114 int min_block;
115 int max_block;
116 int recover_count; /* From tape opening */
117 int recover_reg; /* From last status call */
119 #if DEBUG
120 unsigned char write_pending;
121 int nbr_finished;
122 int nbr_waits;
123 unsigned char last_cmnd[6];
124 unsigned char last_sense[16];
125 #endif
126 } Scsi_Tape;
129 /* Values of eof */
130 #define ST_NOEOF 0
131 #define ST_FM_HIT 1
132 #define ST_FM 2
133 #define ST_EOM_OK 3
134 #define ST_EOM_ERROR 4
135 #define ST_EOD_1 5
136 #define ST_EOD_2 6
137 #define ST_EOD 7
138 /* EOD hit while reading => ST_EOD_1 => return zero => ST_EOD_2 =>
139 return zero => ST_EOD, return ENOSPC */
141 /* Values of rw */
142 #define ST_IDLE 0
143 #define ST_READING 1
144 #define ST_WRITING 2
146 /* Values of ready state */
147 #define ST_READY 0
148 #define ST_NOT_READY 1
149 #define ST_NO_TAPE 2
151 /* Values for door lock state */
152 #define ST_UNLOCKED 0
153 #define ST_LOCKED_EXPLICIT 1
154 #define ST_LOCKED_AUTO 2
155 #define ST_LOCK_FAILS 3
157 /* Positioning SCSI-commands for Tandberg, etc. drives */
158 #define QFA_REQUEST_BLOCK 0x02
159 #define QFA_SEEK_BLOCK 0x0c
161 /* Setting the binary options */
162 #define ST_DONT_TOUCH 0
163 #define ST_NO 1
164 #define ST_YES 2
166 #endif