OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [scsi/] [st.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
 
2
#ifndef _ST_H
3
#define _ST_H
4
 
5
#ifndef _SCSI_H
6
#include "scsi.h"
7
#endif
8
#include <linux/devfs_fs_kernel.h>
9
#include <linux/completion.h>
10
 
11
/* The tape buffer descriptor. */
12
typedef struct {
13
        unsigned char in_use;
14
        unsigned char dma;      /* DMA-able buffer */
15
        int buffer_size;
16
        int buffer_blocks;
17
        int buffer_bytes;
18
        int read_pointer;
19
        int writing;
20
        int midlevel_result;
21
        int syscall_result;
22
        Scsi_Request *last_SRpnt;
23
        unsigned char *b_data;
24
        unsigned short use_sg;  /* zero or number of segments for this adapter */
25
        unsigned short sg_segs; /* total number of allocated segments */
26
        unsigned short orig_sg_segs;    /* number of segments allocated at first try */
27
        unsigned int *sg_lengths;
28
        struct scatterlist sg[1];       /* MUST BE last item */
29
} ST_buffer;
30
 
31
 
32
/* The tape mode definition */
33
typedef struct {
34
        unsigned char defined;
35
        unsigned char sysv;     /* SYS V semantics? */
36
        unsigned char do_async_writes;
37
        unsigned char do_buffer_writes;
38
        unsigned char do_read_ahead;
39
        unsigned char defaults_for_writes;
40
        unsigned char default_compression;      /* 0 = don't touch, etc */
41
        short default_density;  /* Forced density, -1 = no value */
42
        int default_blksize;    /* Forced blocksize, -1 = no value */
43
} ST_mode;
44
 
45
#define ST_NBR_MODE_BITS 2
46
#define ST_NBR_MODES (1 << ST_NBR_MODE_BITS)
47
#define ST_MODE_SHIFT (7 - ST_NBR_MODE_BITS)
48
#define ST_MODE_MASK ((ST_NBR_MODES - 1) << ST_MODE_SHIFT)
49
#define ST_MAX_TAPES (1 << ST_MODE_SHIFT)
50
 
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;
61
 
62
#define ST_NBR_PARTITIONS 4
63
 
64
/* The tape drive descriptor */
65
typedef struct {
66
        kdev_t devt;
67
        Scsi_Device *device;
68
        struct semaphore lock;  /* For serialization */
69
        struct completion wait; /* For SCSI commands */
70
        ST_buffer *buffer;
71
 
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 immediate;
80
        unsigned char restr_dma;
81
        unsigned char scsi2_logical;
82
        unsigned char default_drvbuffer;        /* 0xff = don't touch, value 3 bits */
83
        unsigned char cln_mode;                 /* 0 = none, otherwise sense byte nbr */
84
        unsigned char cln_sense_value;
85
        unsigned char cln_sense_mask;
86
        unsigned char use_pf;                   /* Set Page Format bit in all mode selects? */
87
        unsigned char c_algo;        /* compression algorithm */
88
        int tape_type;
89
        int timeout;            /* timeout for normal commands */
90
        int long_timeout;       /* timeout for commands known to take long time */
91
 
92
        /* Mode characteristics */
93
        ST_mode modes[ST_NBR_MODES];
94
        int current_mode;
95
        devfs_handle_t de_r[ST_NBR_MODES];  /*  Rewind entries     */
96
        devfs_handle_t de_n[ST_NBR_MODES];  /*  No-rewind entries  */
97
 
98
        /* Status variables */
99
        int partition;
100
        int new_partition;
101
        int nbr_partitions;     /* zero until partition support enabled */
102
        ST_partstat ps[ST_NBR_PARTITIONS];
103
        unsigned char dirty;
104
        unsigned char ready;
105
        unsigned char write_prot;
106
        unsigned char drv_write_prot;
107
        unsigned char in_use;
108
        unsigned char blksize_changed;
109
        unsigned char density_changed;
110
        unsigned char compression_changed;
111
        unsigned char drv_buffer;
112
        unsigned char density;
113
        unsigned char door_locked;
114
        unsigned char autorew_dev;   /* auto-rewind device */
115
        unsigned char rew_at_close;  /* rewind necessary at close */
116
        unsigned char inited;
117
        unsigned char cleaning_req;  /* cleaning requested? */
118
        int block_size;
119
        int min_block;
120
        int max_block;
121
        int recover_count;     /* From tape opening */
122
        int recover_reg;       /* From last status call */
123
 
124
#if DEBUG
125
        unsigned char write_pending;
126
        int nbr_finished;
127
        int nbr_waits;
128
        unsigned char last_cmnd[6];
129
        unsigned char last_sense[16];
130
#endif
131
} Scsi_Tape;
132
 
133
/* Bit masks for use_pf */
134
#define USE_PF      1
135
#define PF_TESTED   2
136
 
137
/* Values of eof */
138
#define ST_NOEOF        0
139
#define ST_FM_HIT       1
140
#define ST_FM           2
141
#define ST_EOM_OK       3
142
#define ST_EOM_ERROR    4
143
#define ST_EOD_1        5
144
#define ST_EOD_2        6
145
#define ST_EOD          7
146
/* EOD hit while reading => ST_EOD_1 => return zero => ST_EOD_2 =>
147
   return zero => ST_EOD, return ENOSPC */
148
 
149
/* Values of rw */
150
#define ST_IDLE         0
151
#define ST_READING      1
152
#define ST_WRITING      2
153
 
154
/* Values of ready state */
155
#define ST_READY        0
156
#define ST_NOT_READY    1
157
#define ST_NO_TAPE      2
158
 
159
/* Values for door lock state */
160
#define ST_UNLOCKED     0
161
#define ST_LOCKED_EXPLICIT 1
162
#define ST_LOCKED_AUTO  2
163
#define ST_LOCK_FAILS   3
164
 
165
/* Positioning SCSI-commands for Tandberg, etc. drives */
166
#define QFA_REQUEST_BLOCK       0x02
167
#define QFA_SEEK_BLOCK          0x0c
168
 
169
/* Setting the binary options */
170
#define ST_DONT_TOUCH  0
171
#define ST_NO          1
172
#define ST_YES         2
173
 
174
#define EXTENDED_SENSE_START  18
175
 
176
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.