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