scsi.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. /*
  16. * This header file contains public constants and structures used by
  17. * the scsi code for linux.
  18. */
  19. #ifndef _SCSI_SCSI_H
  20. #define _SCSI_SCSI_H 1
  21. #include <features.h>
  22. /*
  23. * SCSI opcodes
  24. */
  25. #define TEST_UNIT_READY 0x00
  26. #define REZERO_UNIT 0x01
  27. #define REQUEST_SENSE 0x03
  28. #define FORMAT_UNIT 0x04
  29. #define READ_BLOCK_LIMITS 0x05
  30. #define REASSIGN_BLOCKS 0x07
  31. #define READ_6 0x08
  32. #define WRITE_6 0x0a
  33. #define SEEK_6 0x0b
  34. #define READ_REVERSE 0x0f
  35. #define WRITE_FILEMARKS 0x10
  36. #define SPACE 0x11
  37. #define INQUIRY 0x12
  38. #define RECOVER_BUFFERED_DATA 0x14
  39. #define MODE_SELECT 0x15
  40. #define RESERVE 0x16
  41. #define RELEASE 0x17
  42. #define COPY 0x18
  43. #define ERASE 0x19
  44. #define MODE_SENSE 0x1a
  45. #define START_STOP 0x1b
  46. #define RECEIVE_DIAGNOSTIC 0x1c
  47. #define SEND_DIAGNOSTIC 0x1d
  48. #define ALLOW_MEDIUM_REMOVAL 0x1e
  49. #define SET_WINDOW 0x24
  50. #define READ_CAPACITY 0x25
  51. #define READ_10 0x28
  52. #define WRITE_10 0x2a
  53. #define SEEK_10 0x2b
  54. #define WRITE_VERIFY 0x2e
  55. #define VERIFY 0x2f
  56. #define SEARCH_HIGH 0x30
  57. #define SEARCH_EQUAL 0x31
  58. #define SEARCH_LOW 0x32
  59. #define SET_LIMITS 0x33
  60. #define PRE_FETCH 0x34
  61. #define READ_POSITION 0x34
  62. #define SYNCHRONIZE_CACHE 0x35
  63. #define LOCK_UNLOCK_CACHE 0x36
  64. #define READ_DEFECT_DATA 0x37
  65. #define MEDIUM_SCAN 0x38
  66. #define COMPARE 0x39
  67. #define COPY_VERIFY 0x3a
  68. #define WRITE_BUFFER 0x3b
  69. #define READ_BUFFER 0x3c
  70. #define UPDATE_BLOCK 0x3d
  71. #define READ_LONG 0x3e
  72. #define WRITE_LONG 0x3f
  73. #define CHANGE_DEFINITION 0x40
  74. #define WRITE_SAME 0x41
  75. #define READ_TOC 0x43
  76. #define LOG_SELECT 0x4c
  77. #define LOG_SENSE 0x4d
  78. #define MODE_SELECT_10 0x55
  79. #define RESERVE_10 0x56
  80. #define RELEASE_10 0x57
  81. #define MODE_SENSE_10 0x5a
  82. #define PERSISTENT_RESERVE_IN 0x5e
  83. #define PERSISTENT_RESERVE_OUT 0x5f
  84. #define MOVE_MEDIUM 0xa5
  85. #define READ_12 0xa8
  86. #define WRITE_12 0xaa
  87. #define WRITE_VERIFY_12 0xae
  88. #define SEARCH_HIGH_12 0xb0
  89. #define SEARCH_EQUAL_12 0xb1
  90. #define SEARCH_LOW_12 0xb2
  91. #define READ_ELEMENT_STATUS 0xb8
  92. #define SEND_VOLUME_TAG 0xb6
  93. #define WRITE_LONG_2 0xea
  94. /*
  95. * Status codes
  96. */
  97. #define GOOD 0x00
  98. #define CHECK_CONDITION 0x01
  99. #define CONDITION_GOOD 0x02
  100. #define BUSY 0x04
  101. #define INTERMEDIATE_GOOD 0x08
  102. #define INTERMEDIATE_C_GOOD 0x0a
  103. #define RESERVATION_CONFLICT 0x0c
  104. #define COMMAND_TERMINATED 0x11
  105. #define QUEUE_FULL 0x14
  106. #define STATUS_MASK 0x3e
  107. /*
  108. * SENSE KEYS
  109. */
  110. #define NO_SENSE 0x00
  111. #define RECOVERED_ERROR 0x01
  112. #define NOT_READY 0x02
  113. #define MEDIUM_ERROR 0x03
  114. #define HARDWARE_ERROR 0x04
  115. #define ILLEGAL_REQUEST 0x05
  116. #define UNIT_ATTENTION 0x06
  117. #define DATA_PROTECT 0x07
  118. #define BLANK_CHECK 0x08
  119. #define COPY_ABORTED 0x0a
  120. #define ABORTED_COMMAND 0x0b
  121. #define VOLUME_OVERFLOW 0x0d
  122. #define MISCOMPARE 0x0e
  123. /*
  124. * DEVICE TYPES
  125. */
  126. #define TYPE_DISK 0x00
  127. #define TYPE_TAPE 0x01
  128. #define TYPE_PROCESSOR 0x03 /* HP scanners use this */
  129. #define TYPE_WORM 0x04 /* Treated as ROM by our system */
  130. #define TYPE_ROM 0x05
  131. #define TYPE_SCANNER 0x06
  132. #define TYPE_MOD 0x07 /* Magneto-optical disk -
  133. * - treated as TYPE_DISK */
  134. #define TYPE_MEDIUM_CHANGER 0x08
  135. #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
  136. #define TYPE_NO_LUN 0x7f
  137. /*
  138. * standard mode-select header prepended to all mode-select commands
  139. *
  140. * moved here from cdrom.h -- kraxel
  141. */
  142. struct ccs_modesel_head
  143. {
  144. unsigned char _r1; /* reserved. */
  145. unsigned char medium; /* device-specific medium type. */
  146. unsigned char _r2; /* reserved. */
  147. unsigned char block_desc_length; /* block descriptor length. */
  148. unsigned char density; /* device-specific density code. */
  149. unsigned char number_blocks_hi; /* number of blocks in this block
  150. desc. */
  151. unsigned char number_blocks_med;
  152. unsigned char number_blocks_lo;
  153. unsigned char _r3;
  154. unsigned char block_length_hi; /* block length for blocks in this
  155. desc. */
  156. unsigned char block_length_med;
  157. unsigned char block_length_lo;
  158. };
  159. /*
  160. * MESSAGE CODES
  161. */
  162. #define COMMAND_COMPLETE 0x00
  163. #define EXTENDED_MESSAGE 0x01
  164. #define EXTENDED_MODIFY_DATA_POINTER 0x00
  165. #define EXTENDED_SDTR 0x01
  166. #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
  167. #define EXTENDED_WDTR 0x03
  168. #define SAVE_POINTERS 0x02
  169. #define RESTORE_POINTERS 0x03
  170. #define DISCONNECT 0x04
  171. #define INITIATOR_ERROR 0x05
  172. #define ABORT 0x06
  173. #define MESSAGE_REJECT 0x07
  174. #define NOP 0x08
  175. #define MSG_PARITY_ERROR 0x09
  176. #define LINKED_CMD_COMPLETE 0x0a
  177. #define LINKED_FLG_CMD_COMPLETE 0x0b
  178. #define BUS_DEVICE_RESET 0x0c
  179. #define INITIATE_RECOVERY 0x0f /* SCSI-II only */
  180. #define RELEASE_RECOVERY 0x10 /* SCSI-II only */
  181. #define SIMPLE_QUEUE_TAG 0x20
  182. #define HEAD_OF_QUEUE_TAG 0x21
  183. #define ORDERED_QUEUE_TAG 0x22
  184. /*
  185. * Here are some scsi specific ioctl commands which are sometimes useful.
  186. */
  187. /* These are a few other constants only used by scsi devices. */
  188. #define SCSI_IOCTL_GET_IDLUN 0x5382
  189. /* Used to turn on and off tagged queuing for scsi devices. */
  190. #define SCSI_IOCTL_TAGGED_ENABLE 0x5383
  191. #define SCSI_IOCTL_TAGGED_DISABLE 0x5384
  192. /* Used to obtain the host number of a device. */
  193. #define SCSI_IOCTL_PROBE_HOST 0x5385
  194. /* Used to get the bus number for a device. */
  195. #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
  196. #endif /* scsi/scsi.h */