scsi_tape.h 8.4 KB

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