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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [scsi/] [README.st] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
This file contains brief information about the SCSI tape driver.
2
The driver is currently maintained by Kai M{kisara (email
3
Kai.Makisara@metla.fi)
4
 
5
Last modified: Sun Jun 30 15:47:14 1996 by root@kai.makisara.fi
6
 
7
 
8
BASICS
9
 
10
The driver is generic, i.e., it does not contain any code tailored
11
to any specific tape drive. The tape parameters can be specified with
12
one of the following three methods:
13
 
14
1. Each user can specify the tape parameters he/she wants to use
15
directly with ioctls. This is administratively a very simple and
16
flexible method and applicable to single-user workstations. However,
17
in a multiuser environment the next user finds the tape parameters in
18
state the previous user left them.
19
 
20
2. The system manager (root) can define default values for some tape
21
parameters, like block size and density using the MTSETDRVBUFFER ioctl.
22
These parameters can be programmed to come into effect either when a
23
new tape is loaded into the drive or if writing begins at the
24
beginning of the tape. The second method is applicable if the tape
25
drive performs auto-detection of the tape format well (like some
26
QIC-drives). The result is that any tape can be read, writing can be
27
continued using existing format, and the default format is used if
28
the tape is rewritten from the beginning (or a new tape is written
29
for the first time). The first method is applicable if the drive
30
does not perform auto-detection well enough and there is a single
31
"sensible" mode for the device. An example is a DAT drive that is
32
used only in variable block mode (I don't know if this is sensible
33
or not :-).
34
 
35
The user can override the parameters defined by the system
36
manager. The changes persist until the defaults again come into
37
effect.
38
 
39
3. Up to four modes can be defined and selected using the minor number
40
(bits 5 and 6). Mode 0 corresponds to the defaults discussed
41
above. Additional modes are dormant until they are defined by the
42
system manager (root). When specification of a new mode is started,
43
the configuration of mode 0 is used to provide a starting point for
44
definition of the new mode.
45
 
46
Using the modes allows the system manager to give the users choices
47
over some of the buffering parameters not directly accessible to the
48
users (buffered and asynchronous writes). The modes also allow choices
49
between formats in multi-tape operations (the explicitly overridden
50
parameters are reset when a new tape is loaded).
51
 
52
If more than one mode is used, all modes should contain definitions
53
for the same set of parameters.
54
 
55
Many Unices contain internal tables that associate different modes to
56
supported devices. The Linux SCSI tape driver does not contain such
57
tables (and will not do that in future). Instead of that, a utility
58
program can be made that fetches the inquiry data sent by the device,
59
scans its database, and sets up the modes using the ioctls. Another
60
alternative is to make a small script that uses mt to set the defaults
61
tailored to the system.
62
 
63
 
64
The driver supports fixed and variable block size (within buffer
65
limits). Both the auto-rewind (minor equals device number) and
66
non-rewind devices (minor is 128 + device number) are implemented.
67
 
68
Support is provided for changing the tape partition and partitioning
69
of the tape with one or two partitions. By default support for
70
partitioned tape is disabled for each driver and it can be enabled
71
with the ioctl MTSETDRVBUFFER.
72
 
73
By default the driver writes one filemark when the device is closed after
74
writing and the last operation has been a write. Two filemarks can be
75
optionally written. In both cases end of data is signified by
76
returning zero bytes for two consecutive reads.
77
 
78
The compile options are defined in the file linux/drivers/scsi/st_options.h.
79
 
80
 
81
BUFFERING
82
 
83
The driver uses tape buffers allocated either at system initialization
84
or at run-time when needed. One buffer is used for each open tape
85
device. The size of the buffers is selectable at compile and/or boot
86
time. The buffers are used to store the data being transferred to/from
87
the SCSI adapter. The following buffering options are selectable at
88
compile time and/or at run time (via ioctl):
89
 
90
Buffering of data across write calls in fixed block mode (define
91
ST_BUFFER_WRITES).
92
 
93
Asynchronous writing. Writing the buffer contents to the tape is
94
started and the write call returns immediately. The status is checked
95
at the next tape operation.
96
 
97
Buffered writes and asynchronous writes may in some rare cases cause
98
problems in multivolume operations if there is not enough space after
99
the early-warning mark to flush the driver buffer.
100
 
101
Read ahead for fixed block mode (ST_READ_AHEAD). Filling the buffer is
102
attempted even if the user does not want to get all of the data at
103
this read command. Should be disabled for those drives that don't like
104
a filemark to truncate a read request or that don't like backspacing.
105
 
106
The buffer size is defined (in 1024 byte units) by ST_BUFFER_BLOCKS or
107
at boot time. If this size is not enough, the driver tries to allocate
108
a large enough temporary buffer that is released when the device is
109
closed. The maximum buffer size is defined by the kernel memory
110
allocation (currently 256 kB for Alphas and 128 kB for other
111
architectures).
112
 
113
Allocation of the buffers is done at run-time when they are
114
needed. Allocation of the specified number of buffers can be done at
115
initialization if ST_RUNTIME_BUFFERS is defined non-zero. The
116
advantage of run-time allocation is that memory is not wasted for
117
buffers not being used. The disadvantage is that there may not be
118
memory available at the time when a buffer is needed for the first
119
time (once a buffer is allocated, it is not released).
120
 
121
The maximum number of buffers allocated at initialization is defined by
122
ST_MAX_BUFFERS. One buffer is allocated for each drive detected when
123
the driver is initialized up to the maximum. The minimum number of
124
allocated buffers is ST_EXTRA_DEVS (in hosts.h). This ensures some
125
functionality also for the drives found after tape driver
126
initialization (a SCSI adapter driver is loaded as a module). The
127
default for ST_EXTRA_DEVS is two. The driver tries to allocate new
128
buffers at run-time if necessary.
129
 
130
The threshold for triggering asynchronous write in fixed block mode
131
is defined by ST_WRITE_THRESHOLD. This may be optimized for each
132
use pattern. The default triggers asynchronous write after three
133
default sized writes (10 kB) from tar.
134
 
135
 
136
BOOT TIME CONFIGURATION
137
 
138
The buffer size, write threshold, and the maximum number of allocated buffers
139
are configurable at boot time using, e.g., the LILO command line. The option
140
syntax is the following:
141
 
142
           st=aa[,bb[,cc]]
143
 
144
where
145
  aa is the buffer size in 1024 byte units
146
  bb is the write threshold in 1024 byte units
147
  cc is the maximum number of tape buffers to allocate (the number of
148
        buffers is bounded also by the number of drives detected)
149
 
150
 
151
IOCTLS
152
 
153
The tape is positioned and the drive parameters are set with ioctls
154
defined in mtio.h The tape control program 'mt' uses these ioctls. Try
155
to find an mt that supports all of the Linux SCSI tape ioctls and
156
opens the device for writing if the tape contents will be modified
157
(look for a package mt-st* from the Linux ftp sites; the GNU mt does
158
not open for writing for, e.g., erase).
159
 
160
The supported ioctls are:
161
 
162
The following use the structure mtop:
163
 
164
MTFSF   Space forward over count filemarks. Tape positioned after filemark.
165
MTFSFM  As above but tape positioned before filemark.
166
MTBSF   Space backward over count filemarks. Tape positioned before
167
        filemark.
168
MTBSFM  As above but ape positioned after filemark.
169
MTFSR   Space forward over count records.
170
MTBSR   Space backward over count records.
171
MTFSS   Space forward over count setmarks.
172
MTBSS   Space backward over count setmarks.
173
MTWEOF  Write count filemarks.
174
MTWSM   Write count setmarks.
175
MTREW   Rewind tape.
176
MTOFFL  Set device off line (often rewind plus eject).
177
MTNOP   Do nothing except flush the buffers.
178
MTRETEN Re-tension tape.
179
MTEOM   Space to end of recorded data.
180
MTERASE Erase tape.
181
MTSEEK  Seek to tape block count. Uses Tandberg-compatible seek (QFA)
182
        for SCSI-1 drives and SCSI-2 seek for SCSI-2 drives. The file and
183
        block numbers in the status are not valid after a seek.
184
MTSETBLK Set the drive block size. Setting to zero sets the drive into
185
        variable block mode (if applicable).
186
MTSETDENSITY Sets the drive density code to arg. See drive
187
        documentation for available codes.
188
MTLOCK and MTUNLOCK Explicitly lock/unlock the tape drive door.
189
MTLOAD and MTUNLOAD Explicitly load and unload the tape.
190
MTCOMPRESSION Sets compressing or uncompressing drive mode using the
191
        SCSI mode page 15. Note that some drives other methods for
192
        control of compression. Some drives (like the Exabytes) use
193
        density codes for compression control. Some drives use another
194
        mode page but this page has not been implemented in the
195
        driver. Some drives without compression capability will accept
196
        any compression mode without error.
197
MTSETPART Moves the tape to the partition given by the argument at the
198
        next tape operation. The block at which the tape is positioned
199
        is the block where the tape was previously positioned in the
200
        new active partition unless the next tape operation is
201
        MTSEEK. In this case the tape is moved directly to the block
202
        specified by MTSEEK. MTSETPART is inactive unless
203
        MT_ST_CAN_PARTITIONS set.
204
MTMKPART Formats the tape with one partition (argument zero) or two
205
        partitions (the argument gives in megabytes the size of
206
        partition 1 that is physically the first partition of the
207
        tape). The drive has to support partitions with size specified
208
        by the initiator. Inactive unless MT_ST_CAN_PARTITIONS set.
209
MTSETDRVBUFFER
210
        Is used for several purposes. The command is obtained from count
211
        with mask MT_SET_OPTIONS, the low order bits are used as argument.
212
        This command is only allowed for the superuser (root). The
213
        subcommands are:
214
 
215
           The drive buffer option is set to the argument. Zero means
216
           no buffering.
217
        MT_ST_BOOLEANS
218
           Sets the buffering options. The bits are the new states
219
           (enabled/disabled) the following options (in the
220
           parenthesis is specified whether the option is global or
221
           can be specified differently for each mode):
222
             MT_ST_BUFFER_WRITES write buffering (mode)
223
             MT_ST_ASYNC_WRITES asynchronous writes (mode)
224
             MT_ST_READ_AHEAD  read ahead (mode)
225
             MT_ST_TWO_FM writing of two filemarks (global)
226
             MT_ST_FAST_EOM using the SCSI spacing to EOD (global)
227
             MT_ST_AUTO_LOCK automatic locking of the drive door (global)
228
             MT_ST_DEF_WRITES the defaults are meant only for writes (mode)
229
             MT_ST_CAN_BSR backspacing over more than one records can
230
                be used for repositioning the tape (global)
231
             MT_ST_NO_BLKLIMS the driver does not ask the block limits
232
                from the drive (block size can be changed only to
233
                variable) (global)
234
             MT_ST_CAN_PARTITIONS enables support for partitioned
235
                tapes (global)
236
             MT_ST_SCSI2LOGICAL the logical block number is used in
237
                the MTSEEK and MTIOCPOS for SCSI-2 drives instead of
238
                the device dependent address. It is recommended to set
239
                this flag unless there are tapes using the device
240
                dependent (from the old times) (global)
241
             MT_ST_DEBUGGING debugging (global; debugging must be
242
                compiled into the driver)
243
        MT_ST_SETBOOLEANS
244
        MT_ST_CLEARBOOLEANS
245
           Sets or clears the option bits.
246
        MT_ST_WRITE_THRESHOLD
247
           Sets the write threshold for this device to kilobytes
248
           specified by the lowest bits.
249
        MT_ST_DEF_BLKSIZE
250
           Defines the default block size set automatically. Value
251
           0xffffff means that the default is not used any more.
252
        MT_ST_DEF_DENSITY
253
        MT_ST_DEF_DRVBUFFER
254
        MT_ST_DEF_COMPRESSION
255
           Used to set or clear the density (8 bits), drive buffer
256
           state (3 bits), and compression (single bit). If the value is
257
           MT_ST_CLEAR_DEFAULT (0xfffff), the default will not be used
258
           any more. Otherwise the lower-most bits of the value contain
259
           the new value of the parameter.
260
 
261
The following ioctl uses the structure mtpos:
262
MTIOCPOS Reads the current position from the drive. Uses
263
        Tandberg-compatible QFA for SCSI-1 drives and the SCSI-2
264
        command for the SCSI-2 drives.
265
 
266
The following ioctl uses the structure mtget to return the status:
267
MTIOCGET Returns some status information.
268
        The file number and block number within file are returned. The
269
        block is -1 when it can't be determined (e.g., after MTBSF).
270
        The drive type is either MTISSCSI1 or MTISSCSI2.
271
        The number of recovered errors since the previous status call
272
        is stored in the lower word of the field mt_erreg.
273
        The current block size and the density code are stored in the field
274
        mt_dsreg (shifts for the subfields are MT_ST_BLKSIZE_SHIFT and
275
        MT_ST_DENSITY_SHIFT).
276
        The GMT_xxx status bits reflect the drive status. GMT_DR_OPEN
277
        is set if there is no tape in the drive. GMT_EOD means either
278
        end of recorded data or end of tape. GMT_EOT means end of tape.
279
 
280
The following ioctls use the structure mtlocation that contains both
281
the block number and the partition number. These ioctls are available
282
only for SCSI-2 tape drives and the block number is the
283
device-independent logical block number defined by the standard.
284
 
285
MTGETLOC Returns the current block and partition number.
286
MTSETLOC Sets the tape to the block and partition specified by the
287
        arguments.
288
 
289
 
290
MISCELLANEOUS COMPILE OPTIONS
291
 
292
The recovered write errors are considered fatal if ST_RECOVERED_WRITE_FATAL
293
is defined.
294
 
295
The maximum number of tape devices is determined by the define
296
ST_MAX_TAPES. If more tapes are detected at driver initialization, the
297
maximum is adjusted accordingly.
298
 
299
Immediate return from tape positioning SCSI commands can be enabled by
300
defining ST_NOWAIT. If this is defined, the user should take care that
301
the next tape operation is not started before the previous one has
302
finished. The drives and SCSI adapters should handle this condition
303
gracefully, but some drive/adapter combinations are known to hang the
304
SCSI bus in this case.
305
 
306
The MTEOM command is by default implemented as spacing over 32767
307
filemarks. With this method the file number in the status is
308
correct. The user can request using direct spacing to EOD by setting
309
ST_FAST_EOM 1 (or using the MT_ST_OPTIONS ioctl). In this case the file
310
number will be invalid.
311
 
312
When using read ahead or buffered writes the position within the file
313
may not be correct after the file is closed (correct position may
314
require backspacing over more than one record). The correct position
315
within file can be obtained if ST_IN_FILE_POS is defined at compile
316
time or the MT_ST_CAN_BSR bit is set for the drive with an ioctl.
317
(The driver always backs over a filemark crossed by read ahead if the
318
user does not request data that far.)

powered by: WebSVN 2.1.0

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