1999-09-30 16:12:41 +04:00
|
|
|
/* $NetBSD: scsi_tape.h,v 1.18 1999/09/30 12:12:41 soren Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1998-08-17 04:49:01 +04:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Charles M. Hannum.
|
1994-04-13 09:43:19 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1998-08-17 04:49:01 +04:00
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
1994-04-13 09:43:19 +04:00
|
|
|
*
|
1998-08-17 04:49:01 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
1994-03-29 08:29:20 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1994-04-13 09:43:19 +04:00
|
|
|
* Originally written by Julian Elischer (julian@tfs.com)
|
1993-03-21 21:04:42 +03:00
|
|
|
* for TRW Financial Systems.
|
|
|
|
*
|
|
|
|
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
|
|
|
* Mellon University, makes this software available to CMU to distribute
|
1997-10-01 05:18:38 +04:00
|
|
|
* or use in any manner that they see fit as long as this message is kept with
|
1993-03-21 21:04:42 +03:00
|
|
|
* the software. For this reason TFS also grants any other persons or
|
|
|
|
* organisations permission to use or modify this software.
|
|
|
|
*
|
|
|
|
* TFS supplies this software to be publicly redistributed
|
|
|
|
* on the understanding that TFS is not responsible for the correct
|
|
|
|
* functioning of this software in any circumstances.
|
|
|
|
*
|
1994-04-13 09:43:19 +04:00
|
|
|
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
1993-03-21 21:04:42 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1994-04-13 09:43:19 +04:00
|
|
|
* SCSI tape interface description
|
1993-03-21 21:04:42 +03:00
|
|
|
*/
|
1994-03-29 08:29:20 +04:00
|
|
|
|
1993-03-21 21:04:42 +03:00
|
|
|
/*
|
1994-03-29 08:29:20 +04:00
|
|
|
* SCSI command formats
|
1993-03-21 21:04:42 +03:00
|
|
|
*/
|
|
|
|
|
1994-04-13 09:43:19 +04:00
|
|
|
#define READ 0x08
|
|
|
|
#define WRITE 0x0a
|
|
|
|
struct scsi_rw_tape {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
1994-04-13 09:43:19 +04:00
|
|
|
#define SRW_FIXED 0x01
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t len[3];
|
|
|
|
u_int8_t control;
|
1994-04-13 09:43:19 +04:00
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-04-13 09:43:19 +04:00
|
|
|
#define SPACE 0x11
|
|
|
|
struct scsi_space {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
1994-04-13 09:43:19 +04:00
|
|
|
#define SS_CODE 0x03
|
|
|
|
#define SP_BLKS 0x00
|
|
|
|
#define SP_FILEMARKS 0x01
|
|
|
|
#define SP_SEQ_FILEMARKS 0x02
|
|
|
|
#define SP_EOM 0x03
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t number[3];
|
|
|
|
u_int8_t control;
|
1994-04-13 09:43:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define WRITE_FILEMARKS 0x10
|
|
|
|
struct scsi_write_filemarks {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
|
|
|
u_int8_t number[3];
|
|
|
|
u_int8_t control;
|
1994-04-13 09:43:19 +04:00
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-04-13 09:43:19 +04:00
|
|
|
#define REWIND 0x01
|
|
|
|
struct scsi_rewind {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
1994-04-13 09:43:19 +04:00
|
|
|
#define SR_IMMED 0x01
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t unused[3];
|
|
|
|
u_int8_t control;
|
1994-04-13 09:43:19 +04:00
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-04-13 09:43:19 +04:00
|
|
|
#define LOAD 0x1b
|
|
|
|
struct scsi_load {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
1994-04-13 09:43:19 +04:00
|
|
|
#define SL_IMMED 0x01
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t unused[2];
|
|
|
|
u_int8_t how;
|
1994-04-13 09:43:19 +04:00
|
|
|
#define LD_UNLOAD 0x00
|
|
|
|
#define LD_LOAD 0x01
|
|
|
|
#define LD_RETENSION 0x02
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t control;
|
1994-04-13 09:43:19 +04:00
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1996-01-11 06:36:34 +03:00
|
|
|
#define ERASE 0x19
|
|
|
|
struct scsi_erase {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
1996-01-11 06:36:34 +03:00
|
|
|
#define SE_LONG 0x01
|
|
|
|
#define SE_IMMED 0x02
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t unused[3];
|
|
|
|
u_int8_t control;
|
1996-01-11 06:36:34 +03:00
|
|
|
};
|
|
|
|
|
1994-04-13 09:43:19 +04:00
|
|
|
#define READ_BLOCK_LIMITS 0x05
|
|
|
|
struct scsi_block_limits {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
|
|
|
u_int8_t unused[3];
|
|
|
|
u_int8_t control;
|
1994-04-13 09:43:19 +04:00
|
|
|
};
|
1993-03-21 21:04:42 +03:00
|
|
|
|
1994-04-13 09:43:19 +04:00
|
|
|
struct scsi_block_limits_data {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t reserved;
|
1997-10-01 05:18:38 +04:00
|
|
|
u_int8_t max_length[3]; /* Most significant */
|
|
|
|
u_int8_t min_length[2]; /* Most significant */
|
1993-03-21 21:04:42 +03:00
|
|
|
};
|
|
|
|
|
1996-01-11 06:36:34 +03:00
|
|
|
/* See SCSI-II spec 9.3.3.1 */
|
|
|
|
struct scsi_tape_dev_conf_page {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t pagecode; /* 0x10 */
|
|
|
|
u_int8_t pagelength; /* 0x0e */
|
|
|
|
u_int8_t byte2;
|
1996-01-11 06:36:34 +03:00
|
|
|
#define SMT_CAP 0x40 /* change active partition */
|
|
|
|
#define SMT_CAF 0x20 /* change active format */
|
|
|
|
#define SMT_AFMASK 0x1f /* active format mask */
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t active_partition;
|
|
|
|
u_int8_t wb_full_ratio;
|
|
|
|
u_int8_t rb_empty_ratio;
|
|
|
|
u_int8_t wrdelay_time[2];
|
|
|
|
u_int8_t byte8;
|
1996-01-11 06:36:34 +03:00
|
|
|
#define SMT_DBR 0x80 /* data buffer recovery */
|
|
|
|
#define SMT_BIS 0x40 /* block identifiers supported */
|
|
|
|
#define SMT_RSMK 0x20 /* report setmarks */
|
|
|
|
#define SMT_AVC 0x10 /* automatic velocity control */
|
|
|
|
#define SMT_SOCF_MASK 0xc0 /* stop on consecutive formats */
|
|
|
|
#define SMT_RBO 0x20 /* recover buffer order */
|
|
|
|
#define SMT_REW 0x10 /* report early warning */
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t gap_size;
|
|
|
|
u_int8_t byte10;
|
1996-01-11 06:36:34 +03:00
|
|
|
#define SMT_EODDEFINED 0xe0 /* EOD defined */
|
|
|
|
#define SMT_EEG 0x10 /* enable EOD generation */
|
|
|
|
#define SMT_SEW 0x80 /* synchronize at early warning */
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t ew_bufsize[3];
|
|
|
|
u_int8_t sel_comp_alg;
|
1996-01-11 06:36:34 +03:00
|
|
|
#define SMT_COMP_NONE 0x00
|
|
|
|
#define SMT_COMP_DEFAULT 0x01
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t reserved;
|
1996-01-11 06:36:34 +03:00
|
|
|
};
|
|
|
|
|
1997-09-29 23:29:02 +04:00
|
|
|
/* from SCSI-3: SSC-Rev10 (6/97) */
|
|
|
|
struct scsi_tape_dev_compression_page {
|
1997-10-01 05:18:38 +04:00
|
|
|
u_int8_t pagecode; /* 0x0f */
|
|
|
|
u_int8_t pagelength; /* 0x0e */
|
|
|
|
u_int8_t dce_dcc;
|
1997-09-29 23:29:02 +04:00
|
|
|
#define DCP_DCE 0x80 /* enable compression */
|
|
|
|
#define DCP_DCC 0x40 /* compression capable */
|
1997-10-01 05:18:38 +04:00
|
|
|
u_int8_t dde_red;
|
1997-09-29 23:29:02 +04:00
|
|
|
#define DCP_DDE 0x80 /* enable decompression */
|
|
|
|
/* There's a lot of gup about bits 5,6 for reporting exceptions */
|
|
|
|
/* in transitions between compressed and uncompressed data- but */
|
|
|
|
/* mostly we want the default (0), which is to report a MEDIUM */
|
|
|
|
/* ERROR when a read transitions into data that can't be de- */
|
|
|
|
/* compressed */
|
1997-10-01 05:18:38 +04:00
|
|
|
u_int8_t comp_alg[4]; /* compression algorithm */
|
|
|
|
u_int8_t decomp_alg[4]; /* de-"" */
|
|
|
|
u_int8_t reserved[4];
|
1997-09-29 23:29:02 +04:00
|
|
|
};
|
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
/* defines for the device specific byte in the mode select/sense header */
|
|
|
|
#define SMH_DSP_SPEED 0x0F
|
|
|
|
#define SMH_DSP_BUFF_MODE 0x70
|
|
|
|
#define SMH_DSP_BUFF_MODE_OFF 0x00
|
|
|
|
#define SMH_DSP_BUFF_MODE_ON 0x10
|
|
|
|
#define SMH_DSP_BUFF_MODE_MLTI 0x20
|
|
|
|
#define SMH_DSP_WRITE_PROT 0x80
|
|
|
|
|
|
|
|
/* A special for the CIPHER ST150S(old drive) */
|
1994-04-13 09:43:19 +04:00
|
|
|
struct block_desc_cipher {
|
1996-03-19 06:05:15 +03:00
|
|
|
u_int8_t density;
|
|
|
|
u_int8_t nblocks[3];
|
|
|
|
u_int8_t reserved;
|
|
|
|
u_int8_t blklen[3];
|
|
|
|
u_int8_t other;
|
1994-04-13 09:43:19 +04:00
|
|
|
#define ST150_SEC 0x01 /* soft error count */
|
|
|
|
#define SR150_AUI 0x02 /* autoload inhibit */
|
1993-03-21 21:04:42 +03:00
|
|
|
};
|
|
|
|
|
1997-09-29 23:29:02 +04:00
|
|
|
|
|
|
|
#define READ_POSITION 0x34
|
|
|
|
struct scsi_tape_read_position {
|
1997-10-01 05:18:38 +04:00
|
|
|
u_int8_t opcode; /* READ_POSITION */
|
|
|
|
u_int8_t byte1; /* set LSB to read hardware block pos */
|
|
|
|
u_int8_t reserved[8];
|
1997-09-29 23:29:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define LOCATE 0x2B
|
1998-08-06 14:20:38 +04:00
|
|
|
struct scsi_tape_locate {
|
|
|
|
u_int8_t opcode;
|
|
|
|
u_int8_t byte2;
|
|
|
|
u_int8_t reserved1;
|
|
|
|
u_int8_t blkaddr[4];
|
|
|
|
u_int8_t reserved2;
|
|
|
|
u_int8_t partition;
|
|
|
|
u_int8_t control;
|
|
|
|
};
|
1997-09-29 23:29:02 +04:00
|
|
|
|
1994-03-29 08:29:20 +04:00
|
|
|
#define HALFINCH_800 0x01
|
|
|
|
#define HALFINCH_1600 0x02
|
|
|
|
#define HALFINCH_6250 0x03
|
|
|
|
#define QIC_11 0x04 /* from Archive 150S Theory of Op. XXX */
|
|
|
|
#define QIC_24 0x05 /* may be bad, works for CIPHER ST150S XXX */
|
|
|
|
#define QIC_120 0x0f
|
|
|
|
#define QIC_150 0x10
|
|
|
|
#define QIC_320 0x11
|
|
|
|
#define QIC_525 0x11
|
|
|
|
#define QIC_1320 0x12
|
|
|
|
#define DDS 0x13
|
|
|
|
#define DAT_1 0x13
|
1996-05-24 06:04:29 +04:00
|
|
|
#define QIC_3095 0x45
|