1 /* $NetBSD: scsi_tape.h,v 1.24 2005/12/11 12:23:50 christos Exp $ */
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Originally written by Julian Elischer (julian@tfs.com)
34 * for TRW Financial Systems.
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.
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.
46 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
50 * SCSI tape interface description
54 * SCSI command formats
62 #define SRW_FIXED 0x01
73 #define SP_FILEMARKS 0x01
74 #define SP_SEQ_FILEMARKS 0x02
80 #define WRITE_FILEMARKS 0x10
81 struct scsi_write_filemarks
{
101 #define SL_IMMED 0x01
104 #define LD_UNLOAD 0x00
106 #define LD_RETENSION 0x02
115 #define SE_IMMED 0x02
120 #define READ_BLOCK_LIMITS 0x05
121 struct scsi_block_limits
{
128 struct scsi_block_limits_data
{
130 u_int8_t max_length
[3]; /* Most significant */
131 u_int8_t min_length
[2]; /* Most significant */
134 /* See SCSI-II spec 9.3.3.1 */
135 struct scsi_tape_dev_conf_page
{
136 u_int8_t pagecode
; /* 0x10 */
137 u_int8_t pagelength
; /* 0x0e */
139 #define SMT_CAP 0x40 /* change active partition */
140 #define SMT_CAF 0x20 /* change active format */
141 #define SMT_AFMASK 0x1f /* active format mask */
142 u_int8_t active_partition
;
143 u_int8_t wb_full_ratio
;
144 u_int8_t rb_empty_ratio
;
145 u_int8_t wrdelay_time
[2];
147 #define SMT_DBR 0x80 /* data buffer recovery */
148 #define SMT_BIS 0x40 /* block identifiers supported */
149 #define SMT_RSMK 0x20 /* report setmarks */
150 #define SMT_AVC 0x10 /* automatic velocity control */
151 #define SMT_SOCF_MASK 0xc0 /* stop on consecutive formats */
152 #define SMT_RBO 0x20 /* recover buffer order */
153 #define SMT_REW 0x10 /* report early warning */
156 #define SMT_EODDEFINED 0xe0 /* EOD defined */
157 #define SMT_EEG 0x10 /* enable EOD generation */
158 #define SMT_SEW 0x80 /* synchronize at early warning */
159 u_int8_t ew_bufsize
[3];
160 u_int8_t sel_comp_alg
;
161 #define SMT_COMP_NONE 0x00
162 #define SMT_COMP_DEFAULT 0x01
166 /* from SCSI-3: SSC-Rev10 (6/97) */
167 struct scsi_tape_dev_compression_page
{
168 u_int8_t pagecode
; /* 0x0f */
169 u_int8_t pagelength
; /* 0x0e */
171 #define DCP_DCE 0x80 /* enable compression */
172 #define DCP_DCC 0x40 /* compression capable */
174 #define DCP_DDE 0x80 /* enable decompression */
175 /* There's a lot of gup about bits 5,6 for reporting exceptions */
176 /* in transitions between compressed and uncompressed data- but */
177 /* mostly we want the default (0), which is to report a MEDIUM */
178 /* ERROR when a read transitions into data that can't be de- */
180 u_int8_t comp_alg
[4]; /* compression algorithm */
181 u_int8_t decomp_alg
[4]; /* de-"" */
182 u_int8_t reserved
[4];
185 /* defines for the device specific byte in the mode select/sense header */
186 #define SMH_DSP_SPEED 0x0F
187 #define SMH_DSP_BUFF_MODE 0x70
188 #define SMH_DSP_BUFF_MODE_OFF 0x00
189 #define SMH_DSP_BUFF_MODE_ON 0x10
190 #define SMH_DSP_BUFF_MODE_MLTI 0x20
191 #define SMH_DSP_WRITE_PROT 0x80
193 #define READ_POSITION 0x34
194 struct scsi_tape_read_position
{
196 u_int8_t byte1
; /* set LSB to read hardware block pos */
197 u_int8_t reserved
[8];
201 struct scsi_tape_locate
{
211 #define HALFINCH_800 0x01
212 #define HALFINCH_1600 0x02
213 #define HALFINCH_6250 0x03
220 #define QIC_1320 0x12
222 #define QIC_3095 0x45
223 #define QIC_3220 0x47