1 /* 2 * HISTORY 3 * $Log: scsi_tape.h,v $ 4 * Revision 1.1 1993/03/21 18:04:42 cgd 5 * after 0.2.2 "stable" patches applied 6 * 7 * Revision 1.2 1993/01/26 18:39:08 julian 8 * add the 'write protected' bit in the device status struct. 9 * 10 * Revision 1.1 1992/09/26 22:10:21 julian 11 * Initial revision 12 * 13 * 14 * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE 15 * -------------------- ----- ---------------------- 16 * CURRENT PATCH LEVEL: 1 00098 17 * -------------------- ----- ---------------------- 18 * 19 * 16 Feb 93 Julian Elischer ADDED for SCSI system 20 * 21 */ 22 23 /* 24 * SCSI tape interface description 25 */ 26 27 /* 28 * Written by Julian Elischer (julian (at) tfs.com) 29 * for TRW Financial Systems. 30 * 31 * TRW Financial Systems, in accordance with their agreement with Carnegie 32 * Mellon University, makes this software available to CMU to distribute 33 * or use in any manner that they see fit as long as this message is kept with 34 * the software. For this reason TFS also grants any other persons or 35 * organisations permission to use or modify this software. 36 * 37 * TFS supplies this software to be publicly redistributed 38 * on the understanding that TFS is not responsible for the correct 39 * functioning of this software in any circumstances. 40 * 41 */ 42 43 /* 44 * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992 45 */ 46 47 /* 48 * SCSI command format 49 */ 50 51 52 struct scsi_rw_tape 53 { 54 u_char op_code; 55 u_char fixed:1; 56 u_char :4; 57 u_char lun:3; 58 u_char len[3]; 59 u_char link:1; 60 u_char flag:1; 61 u_char :6; 62 } rw_tape; 63 64 struct scsi_space 65 { 66 u_char op_code; 67 u_char code:2; 68 u_char :3; 69 u_char lun:3; 70 u_char number[3]; 71 u_char link:1; 72 u_char flag:1; 73 u_char :6; 74 } space; 75 #define SP_BLKS 0 76 #define SP_FILEMARKS 1 77 #define SP_SEQ_FILEMARKS 2 78 #define SP_EOM 3 79 80 struct scsi_write_filemarks 81 { 82 u_char op_code; 83 u_char :5; 84 u_char lun:3; 85 u_char number[3]; 86 u_char link:1; 87 u_char flag:1; 88 u_char :6; 89 } write_filemarks; 90 91 struct scsi_rewind 92 { 93 u_char op_code; 94 u_char immed:1; 95 u_char :4; 96 u_char lun:3; 97 u_char unused[3]; 98 u_char link:1; 99 u_char flag:1; 100 u_char :6; 101 } rewind; 102 103 struct scsi_load 104 { 105 u_char op_code; 106 u_char immed:1; 107 u_char :4; 108 u_char lun:3; 109 u_char unused[2]; 110 u_char load:1; 111 u_char reten:1; 112 u_char :6; 113 u_char link:1; 114 u_char flag:1; 115 u_char :6; 116 } load; 117 #define LD_UNLOAD 0 118 #define LD_LOAD 1 119 120 struct scsi_blk_limits 121 { 122 u_char op_code; 123 u_char :5; 124 u_char lun:3; 125 u_char unused[3]; 126 u_char link:1; 127 u_char flag:1; 128 u_char :6; 129 } blk_limits; 130 131 /* 132 * Opcodes 133 */ 134 135 #define REWIND 0x01 136 #define READ_BLK_LIMITS 0x05 137 #define READ_COMMAND_TAPE 0x08 138 #define WRITE_COMMAND_TAPE 0x0a 139 #define WRITE_FILEMARKS 0x10 140 #define SPACE 0x11 141 #define LOAD_UNLOAD 0x1b /* same as above */ 142 143 144 145 struct scsi_blk_limits_data 146 { 147 u_char reserved; 148 u_char max_length_2; /* Most significant */ 149 u_char max_length_1; 150 u_char max_length_0; /* Least significant */ 151 u_char min_length_1; /* Most significant */ 152 u_char min_length_0; /* Least significant */ 153 }; 154 155 struct scsi_mode_header_tape 156 { 157 u_char data_length; /* Sense data length */ 158 u_char medium_type; 159 u_char speed:4; 160 u_char buf_mode:3; 161 u_char write_protected:1; 162 u_char blk_desc_len; 163 }; 164 165 166 #define QIC_120 0x0f 167 #define QIC_150 0x10 168 #define QIC_320 0x11 169 #define QIC_525 0x11 170 #define QIC_1320 0x12 171 172 173