Import 2.3.18pre1
[davej-history.git] / drivers / scsi / st.h
blob9d386767f9d1b16cb068adbbe5e87b0a0591f311
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
12 /* The tape buffer descriptor. */
13 typedef struct {
14 unsigned char in_use;
15 unsigned char dma; /* DMA-able buffer */
16 int this_size; /* allocated size of the structure */
17 int buffer_size;
18 int buffer_blocks;
19 int buffer_bytes;
20 int read_pointer;
21 int writing;
22 int last_result;
23 int last_result_fatal;
24 Scsi_Cmnd *last_SCpnt;
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)
51 /* The status related to each partition */
52 typedef struct {
53 unsigned char rw;
54 unsigned char eof;
55 unsigned char at_sm;
56 unsigned char last_block_valid;
57 u32 last_block_visited;
58 int drv_block; /* The block where the drive head is */
59 int drv_file;
60 } ST_partstat;
62 #define ST_NBR_PARTITIONS 4
64 /* The tape drive descriptor */
65 typedef struct {
66 kdev_t devt;
67 unsigned capacity;
68 Scsi_Device *device;
69 struct semaphore sem;
70 ST_buffer *buffer;
72 /* Drive characteristics */
73 unsigned char omit_blklims;
74 unsigned char do_auto_lock;
75 unsigned char can_bsr;
76 unsigned char can_partitions;
77 unsigned char two_fm;
78 unsigned char fast_mteom;
79 unsigned char restr_dma;
80 unsigned char scsi2_logical;
81 unsigned char default_drvbuffer; /* 0xff = don't touch, value 3 bits */
82 int write_threshold;
83 int timeout; /* timeout for normal commands */
84 int long_timeout; /* timeout for commands known to take long time */
86 /* Mode characteristics */
87 ST_mode modes[ST_NBR_MODES];
88 int current_mode;
90 /* Status variables */
91 int partition;
92 int new_partition;
93 int nbr_partitions; /* zero until partition support enabled */
94 ST_partstat ps[ST_NBR_PARTITIONS];
95 unsigned char dirty;
96 unsigned char ready;
97 unsigned char write_prot;
98 unsigned char drv_write_prot;
99 unsigned char in_use;
100 unsigned char blksize_changed;
101 unsigned char density_changed;
102 unsigned char compression_changed;
103 unsigned char drv_buffer;
104 unsigned char density;
105 unsigned char door_locked;
106 unsigned char rew_at_close;
107 int block_size;
108 int min_block;
109 int max_block;
110 int recover_count;
111 struct mtget *mt_status;
113 #if DEBUG
114 unsigned char write_pending;
115 int nbr_finished;
116 int nbr_waits;
117 unsigned char last_cmnd[6];
118 unsigned char last_sense[16];
119 #endif
120 } Scsi_Tape;
122 extern Scsi_Tape *scsi_tapes;
124 /* Values of eof */
125 #define ST_NOEOF 0
126 #define ST_FM_HIT 1
127 #define ST_FM 2
128 #define ST_EOM_OK 3
129 #define ST_EOM_ERROR 4
130 #define ST_EOD_1 5
131 #define ST_EOD_2 6
132 #define ST_EOD 7
133 /* EOD hit while reading => ST_EOD_1 => return zero => ST_EOD_2 =>
134 return zero => ST_EOD, return ENOSPC */
136 /* Values of rw */
137 #define ST_IDLE 0
138 #define ST_READING 1
139 #define ST_WRITING 2
141 /* Values of ready state */
142 #define ST_READY 0
143 #define ST_NOT_READY 1
144 #define ST_NO_TAPE 2
146 /* Values for door lock state */
147 #define ST_UNLOCKED 0
148 #define ST_LOCKED_EXPLICIT 1
149 #define ST_LOCKED_AUTO 2
150 #define ST_LOCK_FAILS 3
152 /* Positioning SCSI-commands for Tandberg, etc. drives */
153 #define QFA_REQUEST_BLOCK 0x02
154 #define QFA_SEEK_BLOCK 0x0c
156 /* Setting the binary options */
157 #define ST_DONT_TOUCH 0
158 #define ST_NO 1
159 #define ST_YES 2
161 #endif