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