Home | History | Annotate | Line # | Download | only in scsipi
scsi_tape.h revision 1.19.6.1
      1  1.19.6.1   nathanw /*	$NetBSD: scsi_tape.h,v 1.19.6.1 2001/06/21 20:05:51 nathanw Exp $	*/
      2       1.5       cgd 
      3      1.17   mycroft /*-
      4      1.17   mycroft  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5      1.17   mycroft  * All rights reserved.
      6      1.17   mycroft  *
      7      1.17   mycroft  * This code is derived from software contributed to The NetBSD Foundation
      8      1.17   mycroft  * by Charles M. Hannum.
      9       1.4   mycroft  *
     10       1.4   mycroft  * Redistribution and use in source and binary forms, with or without
     11       1.4   mycroft  * modification, are permitted provided that the following conditions
     12       1.4   mycroft  * are met:
     13       1.4   mycroft  * 1. Redistributions of source code must retain the above copyright
     14       1.4   mycroft  *    notice, this list of conditions and the following disclaimer.
     15       1.4   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.4   mycroft  *    notice, this list of conditions and the following disclaimer in the
     17       1.4   mycroft  *    documentation and/or other materials provided with the distribution.
     18       1.4   mycroft  * 3. All advertising materials mentioning features or use of this software
     19       1.4   mycroft  *    must display the following acknowledgement:
     20      1.17   mycroft  *        This product includes software developed by the NetBSD
     21      1.17   mycroft  *        Foundation, Inc. and its contributors.
     22      1.17   mycroft  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23      1.17   mycroft  *    contributors may be used to endorse or promote products derived
     24      1.17   mycroft  *    from this software without specific prior written permission.
     25       1.4   mycroft  *
     26      1.17   mycroft  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27      1.17   mycroft  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28      1.17   mycroft  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29      1.17   mycroft  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30      1.17   mycroft  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31      1.17   mycroft  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32      1.17   mycroft  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33      1.17   mycroft  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34      1.17   mycroft  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35      1.17   mycroft  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36      1.17   mycroft  * POSSIBILITY OF SUCH DAMAGE.
     37       1.3   mycroft  */
     38       1.3   mycroft 
     39       1.3   mycroft /*
     40       1.4   mycroft  * Originally written by Julian Elischer (julian (at) tfs.com)
     41       1.1       cgd  * for TRW Financial Systems.
     42       1.1       cgd  *
     43       1.1       cgd  * TRW Financial Systems, in accordance with their agreement with Carnegie
     44       1.1       cgd  * Mellon University, makes this software available to CMU to distribute
     45      1.12     enami  * or use in any manner that they see fit as long as this message is kept with
     46       1.1       cgd  * the software. For this reason TFS also grants any other persons or
     47       1.1       cgd  * organisations permission to use or modify this software.
     48       1.1       cgd  *
     49       1.1       cgd  * TFS supplies this software to be publicly redistributed
     50       1.1       cgd  * on the understanding that TFS is not responsible for the correct
     51       1.1       cgd  * functioning of this software in any circumstances.
     52       1.1       cgd  *
     53       1.4   mycroft  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     54       1.1       cgd  */
     55       1.1       cgd 
     56       1.1       cgd /*
     57       1.4   mycroft  * SCSI tape interface description
     58       1.1       cgd  */
     59       1.3   mycroft 
     60       1.1       cgd /*
     61       1.3   mycroft  * SCSI command formats
     62       1.1       cgd  */
     63       1.1       cgd 
     64       1.4   mycroft #define	READ			0x08
     65       1.4   mycroft #define WRITE			0x0a
     66       1.4   mycroft struct scsi_rw_tape {
     67       1.8   mycroft 	u_int8_t opcode;
     68       1.8   mycroft 	u_int8_t byte2;
     69       1.4   mycroft #define	SRW_FIXED		0x01
     70       1.8   mycroft 	u_int8_t len[3];
     71       1.8   mycroft 	u_int8_t control;
     72       1.4   mycroft };
     73       1.1       cgd 
     74       1.4   mycroft #define	SPACE			0x11
     75       1.4   mycroft struct scsi_space {
     76       1.8   mycroft 	u_int8_t opcode;
     77       1.8   mycroft 	u_int8_t byte2;
     78       1.4   mycroft #define	SS_CODE			0x03
     79       1.4   mycroft #define SP_BLKS			0x00
     80       1.4   mycroft #define SP_FILEMARKS		0x01
     81       1.4   mycroft #define SP_SEQ_FILEMARKS	0x02
     82       1.4   mycroft #define	SP_EOM			0x03
     83       1.8   mycroft 	u_int8_t number[3];
     84       1.8   mycroft 	u_int8_t control;
     85       1.4   mycroft };
     86       1.1       cgd 
     87       1.4   mycroft #define	WRITE_FILEMARKS		0x10
     88       1.4   mycroft struct scsi_write_filemarks {
     89       1.8   mycroft 	u_int8_t opcode;
     90       1.8   mycroft 	u_int8_t byte2;
     91       1.8   mycroft 	u_int8_t number[3];
     92       1.8   mycroft 	u_int8_t control;
     93       1.4   mycroft };
     94       1.1       cgd 
     95       1.4   mycroft #define REWIND			0x01
     96       1.4   mycroft struct scsi_rewind {
     97       1.8   mycroft 	u_int8_t opcode;
     98       1.8   mycroft 	u_int8_t byte2;
     99       1.4   mycroft #define	SR_IMMED		0x01
    100       1.8   mycroft 	u_int8_t unused[3];
    101       1.8   mycroft 	u_int8_t control;
    102       1.4   mycroft };
    103       1.1       cgd 
    104       1.4   mycroft #define LOAD			0x1b
    105       1.4   mycroft struct scsi_load {
    106       1.8   mycroft 	u_int8_t opcode;
    107       1.8   mycroft 	u_int8_t byte2;
    108       1.4   mycroft #define	SL_IMMED		0x01
    109       1.8   mycroft 	u_int8_t unused[2];
    110       1.8   mycroft 	u_int8_t how;
    111       1.4   mycroft #define LD_UNLOAD		0x00
    112       1.4   mycroft #define LD_LOAD			0x01
    113       1.4   mycroft #define LD_RETENSION		0x02
    114       1.8   mycroft 	u_int8_t control;
    115       1.4   mycroft };
    116       1.3   mycroft 
    117       1.7   thorpej #define	ERASE			0x19
    118       1.7   thorpej struct scsi_erase {
    119       1.8   mycroft 	u_int8_t opcode;
    120       1.8   mycroft 	u_int8_t byte2;
    121       1.7   thorpej #define	SE_LONG			0x01
    122       1.7   thorpej #define	SE_IMMED		0x02
    123       1.8   mycroft 	u_int8_t unused[3];
    124       1.8   mycroft 	u_int8_t control;
    125       1.7   thorpej };
    126       1.7   thorpej 
    127       1.4   mycroft #define	READ_BLOCK_LIMITS	0x05
    128       1.4   mycroft struct scsi_block_limits {
    129       1.8   mycroft 	u_int8_t opcode;
    130       1.8   mycroft 	u_int8_t byte2;
    131       1.8   mycroft 	u_int8_t unused[3];
    132       1.8   mycroft 	u_int8_t control;
    133       1.4   mycroft };
    134       1.1       cgd 
    135       1.4   mycroft struct scsi_block_limits_data {
    136       1.8   mycroft 	u_int8_t reserved;
    137      1.12     enami 	u_int8_t max_length[3];		/* Most significant */
    138      1.12     enami 	u_int8_t min_length[2];		/* Most significant */
    139       1.7   thorpej };
    140       1.7   thorpej 
    141       1.7   thorpej /* See SCSI-II spec 9.3.3.1 */
    142       1.7   thorpej struct scsi_tape_dev_conf_page {
    143       1.8   mycroft 	u_int8_t pagecode;	/* 0x10 */
    144       1.8   mycroft 	u_int8_t pagelength;	/* 0x0e */
    145       1.8   mycroft 	u_int8_t byte2;
    146       1.7   thorpej #define	SMT_CAP			0x40	/* change active partition */
    147       1.7   thorpej #define	SMT_CAF			0x20	/* change active format */
    148       1.7   thorpej #define	SMT_AFMASK		0x1f	/* active format mask */
    149       1.8   mycroft 	u_int8_t active_partition;
    150       1.8   mycroft 	u_int8_t wb_full_ratio;
    151       1.8   mycroft 	u_int8_t rb_empty_ratio;
    152       1.8   mycroft 	u_int8_t wrdelay_time[2];
    153       1.8   mycroft 	u_int8_t byte8;
    154       1.7   thorpej #define	SMT_DBR			0x80	/* data buffer recovery */
    155       1.7   thorpej #define	SMT_BIS			0x40	/* block identifiers supported */
    156       1.7   thorpej #define	SMT_RSMK		0x20	/* report setmarks */
    157       1.7   thorpej #define	SMT_AVC			0x10	/* automatic velocity control */
    158       1.7   thorpej #define SMT_SOCF_MASK		0xc0	/* stop on consecutive formats */
    159       1.7   thorpej #define	SMT_RBO			0x20	/* recover buffer order */
    160       1.7   thorpej #define	SMT_REW			0x10	/* report early warning */
    161       1.8   mycroft 	u_int8_t gap_size;
    162       1.8   mycroft 	u_int8_t byte10;
    163       1.7   thorpej #define	SMT_EODDEFINED		0xe0	/* EOD defined */
    164       1.7   thorpej #define	SMT_EEG			0x10	/* enable EOD generation */
    165       1.7   thorpej #define	SMT_SEW			0x80	/* synchronize at early warning */
    166       1.8   mycroft 	u_int8_t ew_bufsize[3];
    167       1.8   mycroft 	u_int8_t sel_comp_alg;
    168       1.7   thorpej #define	SMT_COMP_NONE		0x00
    169       1.7   thorpej #define	SMT_COMP_DEFAULT	0x01
    170       1.8   mycroft 	u_int8_t reserved;
    171       1.1       cgd };
    172       1.1       cgd 
    173      1.11    mjacob /* from SCSI-3: SSC-Rev10 (6/97) */
    174      1.11    mjacob struct scsi_tape_dev_compression_page {
    175      1.12     enami 	u_int8_t pagecode;	/* 0x0f */
    176      1.12     enami 	u_int8_t pagelength;	/* 0x0e */
    177      1.12     enami 	u_int8_t dce_dcc;
    178      1.11    mjacob #define	DCP_DCE			0x80	/* enable compression */
    179      1.11    mjacob #define	DCP_DCC			0x40	/* compression capable */
    180      1.12     enami 	u_int8_t dde_red;
    181      1.11    mjacob #define	DCP_DDE			0x80	/* enable decompression */
    182      1.11    mjacob /* There's a lot of gup about bits 5,6 for reporting exceptions */
    183      1.11    mjacob /* in transitions between compressed and uncompressed data- but */
    184      1.11    mjacob /* mostly we want the default (0), which is to report a MEDIUM	*/
    185      1.11    mjacob /* ERROR when a read transitions into data that can't be de-	*/
    186      1.11    mjacob /* compressed */
    187      1.12     enami 	u_int8_t comp_alg[4];		/* compression algorithm */
    188      1.12     enami 	u_int8_t decomp_alg[4];		/* de-"" */
    189      1.12     enami 	u_int8_t reserved[4];
    190      1.11    mjacob };
    191      1.11    mjacob 
    192       1.3   mycroft /* defines for the device specific byte in the mode select/sense header */
    193       1.3   mycroft #define	SMH_DSP_SPEED		0x0F
    194       1.3   mycroft #define	SMH_DSP_BUFF_MODE	0x70
    195       1.3   mycroft #define	SMH_DSP_BUFF_MODE_OFF	0x00
    196       1.3   mycroft #define	SMH_DSP_BUFF_MODE_ON	0x10
    197       1.3   mycroft #define	SMH_DSP_BUFF_MODE_MLTI	0x20
    198       1.3   mycroft #define	SMH_DSP_WRITE_PROT	0x80
    199       1.3   mycroft 
    200       1.3   mycroft /* A special for the CIPHER ST150S(old drive) */
    201       1.4   mycroft struct block_desc_cipher {
    202       1.8   mycroft 	u_int8_t density;
    203       1.8   mycroft 	u_int8_t nblocks[3];
    204       1.8   mycroft 	u_int8_t reserved;
    205       1.8   mycroft 	u_int8_t blklen[3];
    206       1.8   mycroft 	u_int8_t other;
    207       1.4   mycroft #define ST150_SEC		0x01	/* soft error count */
    208       1.4   mycroft #define	SR150_AUI		0x02	/* autoload inhibit */
    209       1.1       cgd };
    210      1.11    mjacob 
    211      1.11    mjacob 
    212      1.11    mjacob #define	READ_POSITION	0x34
    213      1.11    mjacob struct scsi_tape_read_position {
    214      1.12     enami 	u_int8_t opcode;		/* READ_POSITION */
    215      1.12     enami 	u_int8_t byte1;			/* set LSB to read hardware block pos */
    216      1.12     enami 	u_int8_t reserved[8];
    217      1.11    mjacob };
    218      1.11    mjacob 
    219      1.11    mjacob #define	LOCATE		0x2B
    220      1.15  drochner struct scsi_tape_locate {
    221      1.15  drochner 	u_int8_t opcode;
    222      1.15  drochner 	u_int8_t byte2;
    223      1.15  drochner 	u_int8_t reserved1;
    224      1.15  drochner 	u_int8_t blkaddr[4];
    225      1.15  drochner 	u_int8_t reserved2;
    226      1.15  drochner 	u_int8_t partition;
    227      1.15  drochner 	u_int8_t control;
    228      1.15  drochner };
    229       1.3   mycroft 
    230       1.3   mycroft #define	HALFINCH_800	0x01
    231       1.3   mycroft #define	HALFINCH_1600	0x02
    232       1.3   mycroft #define	HALFINCH_6250	0x03
    233       1.3   mycroft #define	QIC_11		0x04	/* from Archive 150S Theory of Op. XXX	*/
    234       1.3   mycroft #define QIC_24		0x05	/* may be bad, works for CIPHER ST150S XXX */
    235       1.3   mycroft #define QIC_120		0x0f
    236       1.3   mycroft #define QIC_150		0x10
    237       1.3   mycroft #define QIC_320		0x11
    238       1.3   mycroft #define QIC_525		0x11
    239       1.3   mycroft #define QIC_1320	0x12
    240       1.3   mycroft #define DDS		0x13
    241       1.3   mycroft #define DAT_1		0x13
    242       1.9   thorpej #define QIC_3095	0x45
    243  1.19.6.1   nathanw #define QIC_3220	0x47
    244