Home | History | Annotate | Line # | Download | only in scsipi
scsi_tape.h revision 1.9
      1 /*	$NetBSD: scsi_tape.h,v 1.9 1996/05/24 02:04:47 thorpej Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994 Charles Hannum.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Charles Hannum.
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /*
     33  * Originally written by Julian Elischer (julian (at) tfs.com)
     34  * for TRW Financial Systems.
     35  *
     36  * TRW Financial Systems, in accordance with their agreement with Carnegie
     37  * Mellon University, makes this software available to CMU to distribute
     38  * or use in any manner that they see fit as long as this message is kept with
     39  * the software. For this reason TFS also grants any other persons or
     40  * organisations permission to use or modify this software.
     41  *
     42  * TFS supplies this software to be publicly redistributed
     43  * on the understanding that TFS is not responsible for the correct
     44  * functioning of this software in any circumstances.
     45  *
     46  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     47  */
     48 
     49 /*
     50  * SCSI tape interface description
     51  */
     52 
     53 #ifndef	_SCSI_TAPE_H_
     54 #define _SCSI_TAPE_H_ 1
     55 
     56 /*
     57  * SCSI command formats
     58  */
     59 
     60 #define	READ			0x08
     61 #define WRITE			0x0a
     62 struct scsi_rw_tape {
     63 	u_int8_t opcode;
     64 	u_int8_t byte2;
     65 #define	SRW_FIXED		0x01
     66 	u_int8_t len[3];
     67 	u_int8_t control;
     68 };
     69 
     70 #define	SPACE			0x11
     71 struct scsi_space {
     72 	u_int8_t opcode;
     73 	u_int8_t byte2;
     74 #define	SS_CODE			0x03
     75 #define SP_BLKS			0x00
     76 #define SP_FILEMARKS		0x01
     77 #define SP_SEQ_FILEMARKS	0x02
     78 #define	SP_EOM			0x03
     79 	u_int8_t number[3];
     80 	u_int8_t control;
     81 };
     82 
     83 #define	WRITE_FILEMARKS		0x10
     84 struct scsi_write_filemarks {
     85 	u_int8_t opcode;
     86 	u_int8_t byte2;
     87 	u_int8_t number[3];
     88 	u_int8_t control;
     89 };
     90 
     91 #define REWIND			0x01
     92 struct scsi_rewind {
     93 	u_int8_t opcode;
     94 	u_int8_t byte2;
     95 #define	SR_IMMED		0x01
     96 	u_int8_t unused[3];
     97 	u_int8_t control;
     98 };
     99 
    100 #define LOAD			0x1b
    101 struct scsi_load {
    102 	u_int8_t opcode;
    103 	u_int8_t byte2;
    104 #define	SL_IMMED		0x01
    105 	u_int8_t unused[2];
    106 	u_int8_t how;
    107 #define LD_UNLOAD		0x00
    108 #define LD_LOAD			0x01
    109 #define LD_RETENSION		0x02
    110 	u_int8_t control;
    111 };
    112 
    113 #define	ERASE			0x19
    114 struct scsi_erase {
    115 	u_int8_t opcode;
    116 	u_int8_t byte2;
    117 #define	SE_LONG			0x01
    118 #define	SE_IMMED		0x02
    119 	u_int8_t unused[3];
    120 	u_int8_t control;
    121 };
    122 
    123 #define	READ_BLOCK_LIMITS	0x05
    124 struct scsi_block_limits {
    125 	u_int8_t opcode;
    126 	u_int8_t byte2;
    127 	u_int8_t unused[3];
    128 	u_int8_t control;
    129 };
    130 
    131 struct scsi_block_limits_data {
    132 	u_int8_t reserved;
    133 	u_int8_t max_length[3];	/* Most significant */
    134 	u_int8_t min_length[2];	/* Most significant */
    135 };
    136 
    137 /* See SCSI-II spec 9.3.3.1 */
    138 struct scsi_tape_dev_conf_page {
    139 	u_int8_t pagecode;	/* 0x10 */
    140 	u_int8_t pagelength;	/* 0x0e */
    141 	u_int8_t byte2;
    142 #define	SMT_CAP			0x40	/* change active partition */
    143 #define	SMT_CAF			0x20	/* change active format */
    144 #define	SMT_AFMASK		0x1f	/* active format mask */
    145 	u_int8_t active_partition;
    146 	u_int8_t wb_full_ratio;
    147 	u_int8_t rb_empty_ratio;
    148 	u_int8_t wrdelay_time[2];
    149 	u_int8_t byte8;
    150 #define	SMT_DBR			0x80	/* data buffer recovery */
    151 #define	SMT_BIS			0x40	/* block identifiers supported */
    152 #define	SMT_RSMK		0x20	/* report setmarks */
    153 #define	SMT_AVC			0x10	/* automatic velocity control */
    154 #define SMT_SOCF_MASK		0xc0	/* stop on consecutive formats */
    155 #define	SMT_RBO			0x20	/* recover buffer order */
    156 #define	SMT_REW			0x10	/* report early warning */
    157 	u_int8_t gap_size;
    158 	u_int8_t byte10;
    159 #define	SMT_EODDEFINED		0xe0	/* EOD defined */
    160 #define	SMT_EEG			0x10	/* enable EOD generation */
    161 #define	SMT_SEW			0x80	/* synchronize at early warning */
    162 	u_int8_t ew_bufsize[3];
    163 	u_int8_t sel_comp_alg;
    164 #define	SMT_COMP_NONE		0x00
    165 #define	SMT_COMP_DEFAULT	0x01
    166 	u_int8_t reserved;
    167 };
    168 
    169 /* defines for the device specific byte in the mode select/sense header */
    170 #define	SMH_DSP_SPEED		0x0F
    171 #define	SMH_DSP_BUFF_MODE	0x70
    172 #define	SMH_DSP_BUFF_MODE_OFF	0x00
    173 #define	SMH_DSP_BUFF_MODE_ON	0x10
    174 #define	SMH_DSP_BUFF_MODE_MLTI	0x20
    175 #define	SMH_DSP_WRITE_PROT	0x80
    176 
    177 /* A special for the CIPHER ST150S(old drive) */
    178 struct block_desc_cipher {
    179 	u_int8_t density;
    180 	u_int8_t nblocks[3];
    181 	u_int8_t reserved;
    182 	u_int8_t blklen[3];
    183 	u_int8_t other;
    184 #define ST150_SEC		0x01	/* soft error count */
    185 #define	SR150_AUI		0x02	/* autoload inhibit */
    186 };
    187 
    188 /**********************************************************************
    189 			from the scsi2 spec
    190                 Value Tracks Density(bpi) Code Type  Reference     Note
    191                 0x1     9       800       NRZI  R    X3.22-1983    2
    192                 0x2     9      1600       PE    R    X3.39-1986    2
    193                 0x3     9      6250       GCR   R    X3.54-1986    2
    194                 0x5    4/9     8000       GCR   C    X3.136-1986   1
    195                 0x6     9      3200       PE    R    X3.157-1987   2
    196                 0x7     4      6400       IMFM  C    X3.116-1986   1
    197                 0x8     4      8000       GCR   CS   X3.158-1986   1
    198                 0x9    18     37871       GCR   C    X3B5/87-099   2
    199                 0xA    22      6667       MFM   C    X3B5/86-199   1
    200                 0xB     4      1600       PE    C    X3.56-1986    1
    201                 0xC    24     12690       GCR   C    HI-TC1        1,5
    202                 0xD    24     25380       GCR   C    HI-TC2        1,5
    203                 0xF    15     10000       GCR   C    QIC-120       1,5
    204                 0x10   18     10000       GCR   C    QIC-150       1,5
    205                 0x11   26     16000       GCR   C    QIC-320(525?) 1,5
    206                 0x12   30     51667       RLL   C    QIC-1350      1,5
    207                 0x13    1     61000       DDS   CS    X3B5/88-185A 4
    208                 0x14    1     43245       RLL   CS    X3.202-1991  4
    209                 0x15    1     45434       RLL   CS    ECMA TC17    4
    210                 0x16   48     10000       MFM   C     X3.193-1990  1
    211                 0x17   48     42500       MFM   C     X3B5/91-174  1
    212 		0x45   73     67733	  RLL	C     QIC3095
    213 
    214                 where Code means:
    215                 NRZI Non Return to Zero, change on ones
    216                 GCR  Group Code Recording
    217                 PE   Phase Encoded
    218                 IMFM Inverted Modified Frequency Modulation
    219                 MFM  Modified Frequency Modulation
    220                 DDS  Dat Data Storage
    221                 RLL  Run Length Encoding
    222 
    223                 where Type means:
    224                 R    Reel-to-Reel
    225                 C    Cartridge
    226                 CS   cassette
    227 
    228                 where Notes means:
    229                 1    Serial Recorded
    230                 2    Parallel Recorded
    231                 3    Old format know as QIC-11
    232                 4    Helical Scan
    233                 5    Not ANSI standard, rather industry standard.
    234 ********************************************************************/
    235 
    236 #define	HALFINCH_800	0x01
    237 #define	HALFINCH_1600	0x02
    238 #define	HALFINCH_6250	0x03
    239 #define	QIC_11		0x04	/* from Archive 150S Theory of Op. XXX	*/
    240 #define QIC_24		0x05	/* may be bad, works for CIPHER ST150S XXX */
    241 #define QIC_120		0x0f
    242 #define QIC_150		0x10
    243 #define QIC_320		0x11
    244 #define QIC_525		0x11
    245 #define QIC_1320	0x12
    246 #define DDS		0x13
    247 #define DAT_1		0x13
    248 #define QIC_3095	0x45
    249 
    250 #endif /* _SCSI_TAPE_H_ */
    251