scsi-defs.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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 this library; if not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /*
  15. * This header file contains public constants and structures used by
  16. * the scsi code for linux.
  17. */
  18. /*
  19. * SCSI opcodes
  20. */
  21. #define TEST_UNIT_READY 0x00
  22. #define REWIND 0x01
  23. #define REQUEST_SENSE 0x03
  24. #define FORMAT_UNIT 0x04
  25. #define READ_BLOCK_LIMITS 0x05
  26. #define REASSIGN_BLOCKS 0x07
  27. #define READ_6 0x08
  28. #define WRITE_6 0x0a
  29. #define SET_CAPACITY 0x0b
  30. #define READ_REVERSE 0x0f
  31. #define WRITE_FILEMARKS 0x10
  32. #define SPACE 0x11
  33. #define INQUIRY 0x12
  34. #define RECOVER_BUFFERED_DATA 0x14
  35. #define MODE_SELECT 0x15
  36. #define RESERVE 0x16
  37. #define RELEASE 0x17
  38. #define COPY 0x18
  39. #define ERASE 0x19
  40. #define MODE_SENSE 0x1a
  41. #define START_STOP 0x1b
  42. #define RECEIVE_DIAGNOSTIC 0x1c
  43. #define SEND_DIAGNOSTIC 0x1d
  44. #define ALLOW_MEDIUM_REMOVAL 0x1e
  45. #define READ_CAPACITY_10 0x25
  46. #define READ_10 0x28
  47. #define WRITE_10 0x2a
  48. #define SEEK_10 0x2b
  49. #define LOCATE_10 0x2b
  50. #define WRITE_VERIFY_10 0x2e
  51. #define VERIFY_10 0x2f
  52. #define SEARCH_HIGH 0x30
  53. #define SEARCH_EQUAL 0x31
  54. #define SEARCH_LOW 0x32
  55. #define SET_LIMITS 0x33
  56. #define PRE_FETCH 0x34
  57. #define READ_POSITION 0x34
  58. #define SYNCHRONIZE_CACHE 0x35
  59. #define LOCK_UNLOCK_CACHE 0x36
  60. #define READ_DEFECT_DATA 0x37
  61. #define MEDIUM_SCAN 0x38
  62. #define COMPARE 0x39
  63. #define COPY_VERIFY 0x3a
  64. #define WRITE_BUFFER 0x3b
  65. #define READ_BUFFER 0x3c
  66. #define UPDATE_BLOCK 0x3d
  67. #define READ_LONG_10 0x3e
  68. #define WRITE_LONG_10 0x3f
  69. #define CHANGE_DEFINITION 0x40
  70. #define WRITE_SAME_10 0x41
  71. #define UNMAP 0x42
  72. #define READ_TOC 0x43
  73. #define REPORT_DENSITY_SUPPORT 0x44
  74. #define GET_CONFIGURATION 0x46
  75. #define GET_EVENT_STATUS_NOTIFICATION 0x4a
  76. #define LOG_SELECT 0x4c
  77. #define LOG_SENSE 0x4d
  78. #define RESERVE_TRACK 0x53
  79. #define MODE_SELECT_10 0x55
  80. #define RESERVE_10 0x56
  81. #define RELEASE_10 0x57
  82. #define MODE_SENSE_10 0x5a
  83. #define SEND_CUE_SHEET 0x5d
  84. #define PERSISTENT_RESERVE_IN 0x5e
  85. #define PERSISTENT_RESERVE_OUT 0x5f
  86. #define VARLENGTH_CDB 0x7f
  87. #define WRITE_FILEMARKS_16 0x80
  88. #define ALLOW_OVERWRITE 0x82
  89. #define EXTENDED_COPY 0x83
  90. #define ATA_PASSTHROUGH 0x85
  91. #define ACCESS_CONTROL_IN 0x86
  92. #define ACCESS_CONTROL_OUT 0x87
  93. #define READ_16 0x88
  94. #define COMPARE_AND_WRITE 0x89
  95. #define WRITE_16 0x8a
  96. #define WRITE_VERIFY_16 0x8e
  97. #define VERIFY_16 0x8f
  98. #define PRE_FETCH_16 0x90
  99. #define SPACE_16 0x91
  100. #define SYNCHRONIZE_CACHE_16 0x91
  101. #define LOCATE_16 0x92
  102. #define WRITE_SAME_16 0x93
  103. #define ERASE_16 0x93
  104. #define SERVICE_ACTION_IN_16 0x9e
  105. #define WRITE_LONG_16 0x9f
  106. #define REPORT_LUNS 0xa0
  107. #define BLANK 0xa1
  108. #define MAINTENANCE_IN 0xa3
  109. #define MAINTENANCE_OUT 0xa4
  110. #define MOVE_MEDIUM 0xa5
  111. #define LOAD_UNLOAD 0xa6
  112. #define SET_READ_AHEAD 0xa7
  113. #define READ_12 0xa8
  114. #define WRITE_12 0xaa
  115. #define SERVICE_ACTION_IN_12 0xab
  116. #define ERASE_12 0xac
  117. #define READ_DVD_STRUCTURE 0xad
  118. #define WRITE_VERIFY_12 0xae
  119. #define VERIFY_12 0xaf
  120. #define SEARCH_HIGH_12 0xb0
  121. #define SEARCH_EQUAL_12 0xb1
  122. #define SEARCH_LOW_12 0xb2
  123. #define READ_ELEMENT_STATUS 0xb8
  124. #define SEND_VOLUME_TAG 0xb6
  125. #define READ_DEFECT_DATA_12 0xb7
  126. #define SET_CD_SPEED 0xbb
  127. #define MECHANISM_STATUS 0xbd
  128. #define READ_CD 0xbe
  129. #define SEND_DVD_STRUCTURE 0xbf
  130. /*
  131. * SERVICE ACTION IN subcodes
  132. */
  133. #define SAI_READ_CAPACITY_16 0x10
  134. /*
  135. * SAM Status codes
  136. */
  137. #define GOOD 0x00
  138. #define CHECK_CONDITION 0x02
  139. #define CONDITION_GOOD 0x04
  140. #define BUSY 0x08
  141. #define INTERMEDIATE_GOOD 0x10
  142. #define INTERMEDIATE_C_GOOD 0x14
  143. #define RESERVATION_CONFLICT 0x18
  144. #define COMMAND_TERMINATED 0x22
  145. #define TASK_SET_FULL 0x28
  146. #define ACA_ACTIVE 0x30
  147. #define TASK_ABORTED 0x40
  148. #define STATUS_MASK 0x3e
  149. /*
  150. * SENSE KEYS
  151. */
  152. #define NO_SENSE 0x00
  153. #define RECOVERED_ERROR 0x01
  154. #define NOT_READY 0x02
  155. #define MEDIUM_ERROR 0x03
  156. #define HARDWARE_ERROR 0x04
  157. #define ILLEGAL_REQUEST 0x05
  158. #define UNIT_ATTENTION 0x06
  159. #define DATA_PROTECT 0x07
  160. #define BLANK_CHECK 0x08
  161. #define COPY_ABORTED 0x0a
  162. #define ABORTED_COMMAND 0x0b
  163. #define VOLUME_OVERFLOW 0x0d
  164. #define MISCOMPARE 0x0e
  165. /*
  166. * DEVICE TYPES
  167. */
  168. #define TYPE_DISK 0x00
  169. #define TYPE_TAPE 0x01
  170. #define TYPE_PRINTER 0x02
  171. #define TYPE_PROCESSOR 0x03 /* HP scanners use this */
  172. #define TYPE_WORM 0x04 /* Treated as ROM by our system */
  173. #define TYPE_ROM 0x05
  174. #define TYPE_SCANNER 0x06
  175. #define TYPE_MOD 0x07 /* Magneto-optical disk -
  176. * - treated as TYPE_DISK */
  177. #define TYPE_MEDIUM_CHANGER 0x08
  178. #define TYPE_STORAGE_ARRAY 0x0c /* Storage array device */
  179. #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
  180. #define TYPE_RBC 0x0e /* Simplified Direct-Access Device */
  181. #define TYPE_OSD 0x11 /* Object-storage Device */
  182. #define TYPE_WLUN 0x1e /* Well known LUN */
  183. #define TYPE_NOT_PRESENT 0x1f
  184. #define TYPE_INACTIVE 0x20
  185. #define TYPE_NO_LUN 0x7f
  186. /* Mode page codes for mode sense/set */
  187. #define MODE_PAGE_R_W_ERROR 0x01
  188. #define MODE_PAGE_HD_GEOMETRY 0x04
  189. #define MODE_PAGE_FLEXIBLE_DISK_GEOMETRY 0x05
  190. #define MODE_PAGE_CACHING 0x08
  191. #define MODE_PAGE_AUDIO_CTL 0x0e
  192. #define MODE_PAGE_POWER 0x1a
  193. #define MODE_PAGE_FAULT_FAIL 0x1c
  194. #define MODE_PAGE_TO_PROTECT 0x1d
  195. #define MODE_PAGE_CAPABILITIES 0x2a
  196. #define MODE_PAGE_ALLS 0x3f
  197. /* Not in Mt. Fuji, but in ATAPI 2.6 -- depricated now in favor
  198. * of MODE_PAGE_SENSE_POWER */
  199. #define MODE_PAGE_CDROM 0x0d
  200. /* Event notification classes for GET EVENT STATUS NOTIFICATION */
  201. #define GESN_NO_EVENTS 0
  202. #define GESN_OPERATIONAL_CHANGE 1
  203. #define GESN_POWER_MANAGEMENT 2
  204. #define GESN_EXTERNAL_REQUEST 3
  205. #define GESN_MEDIA 4
  206. #define GESN_MULTIPLE_HOSTS 5
  207. #define GESN_DEVICE_BUSY 6
  208. /* Event codes for MEDIA event status notification */
  209. #define MEC_NO_CHANGE 0
  210. #define MEC_EJECT_REQUESTED 1
  211. #define MEC_NEW_MEDIA 2
  212. #define MEC_MEDIA_REMOVAL 3 /* only for media changers */
  213. #define MEC_MEDIA_CHANGED 4 /* only for media changers */
  214. #define MEC_BG_FORMAT_COMPLETED 5 /* MRW or DVD+RW b/g format completed */
  215. #define MEC_BG_FORMAT_RESTARTED 6 /* MRW or DVD+RW b/g format restarted */
  216. #define MS_TRAY_OPEN 1
  217. #define MS_MEDIA_PRESENT 2
  218. /*
  219. * Based on values from <linux/cdrom.h> but extending CD_MINS
  220. * to the maximum common size allowed by the Orange's Book ATIP
  221. *
  222. * 90 and 99 min CDs are also available but using them as the
  223. * upper limit reduces the effectiveness of the heuristic to
  224. * detect DVDs burned to less than 25% of their maximum capacity
  225. */
  226. /* Some generally useful CD-ROM information */
  227. #define CD_MINS 80 /* max. minutes per CD */
  228. #define CD_SECS 60 /* seconds per minute */
  229. #define CD_FRAMES 75 /* frames per second */
  230. #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */
  231. #define CD_MAX_BYTES (CD_MINS * CD_SECS * CD_FRAMES * CD_FRAMESIZE)
  232. #define CD_MAX_SECTORS (CD_MAX_BYTES / 512)
  233. /*
  234. * The MMC values are not IDE specific and might need to be moved
  235. * to a common header if they are also needed for the SCSI emulation
  236. */
  237. /* Profile list from MMC-6 revision 1 table 91 */
  238. #define MMC_PROFILE_NONE 0x0000
  239. #define MMC_PROFILE_CD_ROM 0x0008
  240. #define MMC_PROFILE_CD_R 0x0009
  241. #define MMC_PROFILE_CD_RW 0x000A
  242. #define MMC_PROFILE_DVD_ROM 0x0010
  243. #define MMC_PROFILE_DVD_R_SR 0x0011
  244. #define MMC_PROFILE_DVD_RAM 0x0012
  245. #define MMC_PROFILE_DVD_RW_RO 0x0013
  246. #define MMC_PROFILE_DVD_RW_SR 0x0014
  247. #define MMC_PROFILE_DVD_R_DL_SR 0x0015
  248. #define MMC_PROFILE_DVD_R_DL_JR 0x0016
  249. #define MMC_PROFILE_DVD_RW_DL 0x0017
  250. #define MMC_PROFILE_DVD_DDR 0x0018
  251. #define MMC_PROFILE_DVD_PLUS_RW 0x001A
  252. #define MMC_PROFILE_DVD_PLUS_R 0x001B
  253. #define MMC_PROFILE_DVD_PLUS_RW_DL 0x002A
  254. #define MMC_PROFILE_DVD_PLUS_R_DL 0x002B
  255. #define MMC_PROFILE_BD_ROM 0x0040
  256. #define MMC_PROFILE_BD_R_SRM 0x0041
  257. #define MMC_PROFILE_BD_R_RRM 0x0042
  258. #define MMC_PROFILE_BD_RE 0x0043
  259. #define MMC_PROFILE_HDDVD_ROM 0x0050
  260. #define MMC_PROFILE_HDDVD_R 0x0051
  261. #define MMC_PROFILE_HDDVD_RAM 0x0052
  262. #define MMC_PROFILE_HDDVD_RW 0x0053
  263. #define MMC_PROFILE_HDDVD_R_DL 0x0058
  264. #define MMC_PROFILE_HDDVD_RW_DL 0x005A
  265. #define MMC_PROFILE_INVALID 0xFFFF