scsi.h 6.8 KB

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