Home | History | Annotate | Download | only in ddk
      1 /*
      2  * scsi.h
      3  *
      4  * SCSI port and class interface.
      5  *
      6  * This file is part of the w32api package.
      7  *
      8  * Contributors:
      9  *   Created by Casper S. Hornstrup <chorns (at) users.sourceforge.net>
     10  *
     11  * THIS SOFTWARE IS NOT COPYRIGHTED
     12  *
     13  * This source code is offered for use in the public domain. You may
     14  * use, modify or distribute it freely.
     15  *
     16  * This code is distributed in the hope that it will be useful but
     17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
     18  * DISCLAIMED. This includes but is not limited to warranties of
     19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     20  *
     21  */
     22 
     23 #ifndef _NTSCSI_
     24 #define _NTSCSI_
     25 
     26 #ifdef __cplusplus
     27 extern "C" {
     28 #endif
     29 
     30 #ifndef _NTSCSI_USER_MODE_
     31 #include "srb.h"
     32 #endif
     33 
     34 #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK    0x02
     35 #define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK      0x04
     36 #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK      0x08
     37 #define NOTIFICATION_MEDIA_STATUS_CLASS_MASK          0x10
     38 #define NOTIFICATION_MULTI_HOST_CLASS_MASK            0x20
     39 #define NOTIFICATION_DEVICE_BUSY_CLASS_MASK           0x40
     40 
     41 
     42 #define NOTIFICATION_NO_CLASS_EVENTS                  0x0
     43 #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS  0x1
     44 #define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS    0x2
     45 #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS    0x3
     46 #define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS        0x4
     47 #define NOTIFICATION_MULTI_HOST_CLASS_EVENTS          0x5
     48 #define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS         0x6
     49 
     50 #define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE         0x0
     51 #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED  0x1
     52 #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED   0x2
     53 
     54 #define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE        0x0
     55 #define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY   0x1
     56 #define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY    0x2
     57 
     58 #define NOTIFICATION_OPERATIONAL_OPCODE_NONE             0x0
     59 #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE   0x1
     60 #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED    0x2
     61 #define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET       0x3
     62 #define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4
     63 #define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED  0x5
     64 
     65 #define NOTIFICATION_POWER_EVENT_NO_CHANGE          0x0
     66 #define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED   0x1
     67 #define NOTIFICATION_POWER_EVENT_CHANGE_FAILED      0x2
     68 
     69 #define NOTIFICATION_POWER_STATUS_ACTIVE            0x1
     70 #define NOTIFICATION_POWER_STATUS_IDLE              0x2
     71 #define NOTIFICATION_POWER_STATUS_STANDBY           0x3
     72 #define NOTIFICATION_POWER_STATUS_SLEEP             0x4
     73 
     74 #define NOTIFICATION_MEDIA_EVENT_NO_EVENT           0x0
     75 #define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE       0x0
     76 #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN     0x1
     77 #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP       0x2
     78 #define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL        0x3
     79 
     80 #define NOTIFICATION_EXTERNAL_STATUS_READY          0x0
     81 #define NOTIFICATION_EXTERNAL_STATUS_PREVENT        0x1
     82 
     83 #define NOTIFICATION_EXTERNAL_REQUEST_NONE          0x0000
     84 #define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001
     85 #define NOTIFICATION_EXTERNAL_REQUEST_PLAY          0x0101
     86 #define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK   0x0102
     87 #define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD  0x0103
     88 #define NOTIFICATION_EXTERNAL_REQUEST_PAUSE         0x0104
     89 #define NOTIFICATION_EXTERNAL_REQUEST_STOP          0x0106
     90 #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW     0x0200
     91 #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH    0x02ff
     92 
     93 #define NOTIFICATION_MEDIA_EVENT_NO_CHANGE          0x0
     94 #define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST      0x1
     95 #define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA          0x2
     96 #define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL      0x3
     97 #define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE       0x4
     98 
     99 #define NOTIFICATION_BUSY_EVENT_NO_EVENT               0x0
    100 #define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE        0x0
    101 #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST  0x1
    102 #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT    0x2
    103 #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE  0x3
    104 
    105 #define NOTIFICATION_MULTI_HOST_STATUS_READY           0x0
    106 #define NOTIFICATION_MULTI_HOST_STATUS_PREVENT         0x1
    107 
    108 #define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS   0x0
    109 #define NOTIFICATION_MULTI_HOST_PRIORITY_LOW           0x1
    110 #define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM        0x2
    111 #define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH          0x3
    112 
    113 #define NOTIFICATION_BUSY_EVENT_NO_EVENT            0x0
    114 #define NOTIFICATION_BUSY_EVENT_NO_CHANGE           0x0
    115 #define NOTIFICATION_BUSY_EVENT_BUSY                0x1
    116 
    117 #define NOTIFICATION_BUSY_STATUS_NO_EVENT           0x0
    118 #define NOTIFICATION_BUSY_STATUS_POWER              0x1
    119 #define NOTIFICATION_BUSY_STATUS_IMMEDIATE          0x2
    120 #define NOTIFICATION_BUSY_STATUS_DEFERRED           0x3
    121 
    122 #define DVD_FORMAT_LEAD_IN          0x00
    123 #define DVD_FORMAT_COPYRIGHT        0x01
    124 #define DVD_FORMAT_DISK_KEY         0x02
    125 #define DVD_FORMAT_BCA              0x03
    126 #define DVD_FORMAT_MANUFACTURING    0x04
    127 
    128 #define DVD_REPORT_AGID            0x00
    129 #define DVD_CHALLENGE_KEY          0x01
    130 #define DVD_KEY_1                  0x02
    131 #define DVD_KEY_2                  0x03
    132 #define DVD_TITLE_KEY              0x04
    133 #define DVD_REPORT_ASF             0x05
    134 #define DVD_INVALIDATE_AGID        0x3F
    135 
    136 #define BLANK_FULL              0x0
    137 #define BLANK_MINIMAL           0x1
    138 #define BLANK_TRACK             0x2
    139 #define BLANK_UNRESERVE_TRACK   0x3
    140 #define BLANK_TAIL              0x4
    141 #define BLANK_UNCLOSE_SESSION   0x5
    142 #define BLANK_SESSION           0x6
    143 
    144 #define CD_EXPECTED_SECTOR_ANY          0x0
    145 #define CD_EXPECTED_SECTOR_CDDA         0x1
    146 #define CD_EXPECTED_SECTOR_MODE1        0x2
    147 #define CD_EXPECTED_SECTOR_MODE2        0x3
    148 #define CD_EXPECTED_SECTOR_MODE2_FORM1  0x4
    149 #define CD_EXPECTED_SECTOR_MODE2_FORM2  0x5
    150 
    151 #define DISK_STATUS_EMPTY       0x00
    152 #define DISK_STATUS_INCOMPLETE  0x01
    153 #define DISK_STATUS_COMPLETE    0x02
    154 #define DISK_STATUS_OTHERS      0x03
    155 
    156 #define LAST_SESSION_EMPTY              0x00
    157 #define LAST_SESSION_INCOMPLETE         0x01
    158 #define LAST_SESSION_RESERVED_DAMAGED   0x02
    159 #define LAST_SESSION_COMPLETE           0x03
    160 
    161 #define DISK_TYPE_CDDA          0x00
    162 #define DISK_TYPE_CDI           0x10
    163 #define DISK_TYPE_XA            0x20
    164 #define DISK_TYPE_UNDEFINED     0xFF
    165 
    166 #define DISC_BGFORMAT_STATE_NONE        0x0
    167 #define DISC_BGFORMAT_STATE_INCOMPLETE  0x1
    168 #define DISC_BGFORMAT_STATE_RUNNING     0x2
    169 #define DISC_BGFORMAT_STATE_COMPLETE    0x3
    170 
    171 #define DATA_BLOCK_MODE0    0x0
    172 #define DATA_BLOCK_MODE1    0x1
    173 #define DATA_BLOCK_MODE2    0x2
    174 
    175 /* READ_TOC formats */
    176 #define READ_TOC_FORMAT_TOC         0x00
    177 #define READ_TOC_FORMAT_SESSION     0x01
    178 #define READ_TOC_FORMAT_FULL_TOC    0x02
    179 #define READ_TOC_FORMAT_PMA         0x03
    180 #define READ_TOC_FORMAT_ATIP        0x04
    181 
    182 #define CDB6GENERIC_LENGTH                   6
    183 #define CDB10GENERIC_LENGTH                  10
    184 #define CDB12GENERIC_LENGTH                  12
    185 
    186 #define SETBITON                             1
    187 #define SETBITOFF                            0
    188 
    189 /* Mode Sense/Select page constants */
    190 #define MODE_PAGE_VENDOR_SPECIFIC       0x00
    191 #define MODE_PAGE_ERROR_RECOVERY        0x01
    192 #define MODE_PAGE_DISCONNECT            0x02
    193 #define MODE_PAGE_FORMAT_DEVICE         0x03
    194 #define MODE_PAGE_MRW                   0x03
    195 #define MODE_PAGE_RIGID_GEOMETRY        0x04
    196 #define MODE_PAGE_FLEXIBILE             0x05
    197 #define MODE_PAGE_WRITE_PARAMETERS      0x05
    198 #define MODE_PAGE_VERIFY_ERROR          0x07
    199 #define MODE_PAGE_CACHING               0x08
    200 #define MODE_PAGE_PERIPHERAL            0x09
    201 #define MODE_PAGE_CONTROL               0x0A
    202 #define MODE_PAGE_MEDIUM_TYPES          0x0B
    203 #define MODE_PAGE_NOTCH_PARTITION       0x0C
    204 #define MODE_PAGE_CD_AUDIO_CONTROL      0x0E
    205 #define MODE_PAGE_DATA_COMPRESS         0x0F
    206 #define MODE_PAGE_DEVICE_CONFIG         0x10
    207 #define MODE_PAGE_XOR_CONTROL           0x10
    208 #define MODE_PAGE_MEDIUM_PARTITION      0x11
    209 #define MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT 0x14
    210 #define MODE_PAGE_EXTENDED              0x15
    211 #define MODE_PAGE_EXTENDED_DEVICE_SPECIFIC 0x16
    212 #define MODE_PAGE_CDVD_FEATURE_SET      0x18
    213 #define MODE_PAGE_PROTOCOL_SPECIFIC_LUN 0x18
    214 #define MODE_PAGE_PROTOCOL_SPECIFIC_PORT 0x19
    215 #define MODE_PAGE_POWER_CONDITION       0x1A
    216 #define MODE_PAGE_LUN_MAPPING           0x1B
    217 #define MODE_PAGE_FAULT_REPORTING       0x1C
    218 #define MODE_PAGE_CDVD_INACTIVITY       0x1D
    219 #define MODE_PAGE_ELEMENT_ADDRESS       0x1D
    220 #define MODE_PAGE_TRANSPORT_GEOMETRY    0x1E
    221 #define MODE_PAGE_DEVICE_CAPABILITIES   0x1F
    222 #define MODE_PAGE_CAPABILITIES          0x2A
    223 
    224 #define MODE_SENSE_RETURN_ALL           0x3f
    225 
    226 #define MODE_SENSE_CURRENT_VALUES       0x00
    227 #define MODE_SENSE_CHANGEABLE_VALUES    0x40
    228 #define MODE_SENSE_DEFAULT_VAULES       0x80
    229 #define MODE_SENSE_SAVED_VALUES         0xc0
    230 
    231 /* SCSI CDB operation codes */
    232 #define SCSIOP_TEST_UNIT_READY          0x00
    233 #define SCSIOP_REZERO_UNIT              0x01
    234 #define SCSIOP_REWIND                   0x01
    235 #define SCSIOP_REQUEST_BLOCK_ADDR       0x02
    236 #define SCSIOP_REQUEST_SENSE            0x03
    237 #define SCSIOP_FORMAT_UNIT              0x04
    238 #define SCSIOP_READ_BLOCK_LIMITS        0x05
    239 #define SCSIOP_REASSIGN_BLOCKS          0x07
    240 #define SCSIOP_INIT_ELEMENT_STATUS      0x07
    241 #define SCSIOP_READ6                    0x08
    242 #define SCSIOP_RECEIVE                  0x08
    243 #define SCSIOP_WRITE6                   0x0A
    244 #define SCSIOP_PRINT                    0x0A
    245 #define SCSIOP_SEND                     0x0A
    246 #define SCSIOP_SEEK6                    0x0B
    247 #define SCSIOP_TRACK_SELECT             0x0B
    248 #define SCSIOP_SLEW_PRINT               0x0B
    249 #define SCSIOP_SET_CAPACITY             0x0B
    250 #define SCSIOP_SEEK_BLOCK               0x0C
    251 #define SCSIOP_PARTITION                0x0D
    252 #define SCSIOP_READ_REVERSE             0x0F
    253 #define SCSIOP_WRITE_FILEMARKS          0x10
    254 #define SCSIOP_FLUSH_BUFFER             0x10
    255 #define SCSIOP_SPACE                    0x11
    256 #define SCSIOP_INQUIRY                  0x12
    257 #define SCSIOP_VERIFY6                  0x13
    258 #define SCSIOP_RECOVER_BUF_DATA         0x14
    259 #define SCSIOP_MODE_SELECT              0x15
    260 #define SCSIOP_RESERVE_UNIT             0x16
    261 #define SCSIOP_RELEASE_UNIT             0x17
    262 #define SCSIOP_COPY                     0x18
    263 #define SCSIOP_ERASE                    0x19
    264 #define SCSIOP_MODE_SENSE               0x1A
    265 #define SCSIOP_START_STOP_UNIT          0x1B
    266 #define SCSIOP_STOP_PRINT               0x1B
    267 #define SCSIOP_LOAD_UNLOAD              0x1B
    268 #define SCSIOP_RECEIVE_DIAGNOSTIC       0x1C
    269 #define SCSIOP_SEND_DIAGNOSTIC          0x1D
    270 #define SCSIOP_MEDIUM_REMOVAL           0x1E
    271 
    272 #define SCSIOP_READ_FORMATTED_CAPACITY  0x23
    273 #define SCSIOP_READ_CAPACITY            0x25
    274 #define SCSIOP_READ                     0x28
    275 #define SCSIOP_WRITE                    0x2A
    276 #define SCSIOP_SEEK                     0x2B
    277 #define SCSIOP_LOCATE                   0x2B
    278 #define SCSIOP_POSITION_TO_ELEMENT      0x2B
    279 #define SCSIOP_WRITE_VERIFY             0x2E
    280 #define SCSIOP_VERIFY                   0x2F
    281 #define SCSIOP_SEARCH_DATA_HIGH         0x30
    282 #define SCSIOP_SEARCH_DATA_EQUAL        0x31
    283 #define SCSIOP_SEARCH_DATA_LOW          0x32
    284 #define SCSIOP_SET_LIMITS               0x33
    285 #define SCSIOP_READ_POSITION            0x34
    286 #define SCSIOP_SYNCHRONIZE_CACHE        0x35
    287 #define SCSIOP_COMPARE                  0x39
    288 #define SCSIOP_COPY_COMPARE             0x3A
    289 #define SCSIOP_WRITE_DATA_BUFF          0x3B
    290 #define SCSIOP_READ_DATA_BUFF           0x3C
    291 #define SCSIOP_WRITE_LONG               0x3F
    292 #define SCSIOP_CHANGE_DEFINITION        0x40
    293 #define SCSIOP_WRITE_SAME               0x41
    294 #define SCSIOP_READ_SUB_CHANNEL         0x42
    295 #define SCSIOP_READ_TOC                 0x43
    296 #define SCSIOP_READ_HEADER              0x44
    297 #define SCSIOP_REPORT_DENSITY_SUPPORT   0x44
    298 #define SCSIOP_PLAY_AUDIO               0x45
    299 #define SCSIOP_GET_CONFIGURATION        0x46
    300 #define SCSIOP_PLAY_AUDIO_MSF           0x47
    301 #define SCSIOP_PLAY_TRACK_INDEX         0x48
    302 #define SCSIOP_PLAY_TRACK_RELATIVE      0x49
    303 #define SCSIOP_GET_EVENT_STATUS         0x4A
    304 #define SCSIOP_PAUSE_RESUME             0x4B
    305 #define SCSIOP_LOG_SELECT               0x4C
    306 #define SCSIOP_LOG_SENSE                0x4D
    307 #define SCSIOP_STOP_PLAY_SCAN           0x4E
    308 #define SCSIOP_XDWRITE                  0x50
    309 #define SCSIOP_XPWRITE                  0x51
    310 #define SCSIOP_READ_DISK_INFORMATION    0x51
    311 #define SCSIOP_READ_DISC_INFORMATION    0x51
    312 #define SCSIOP_READ_TRACK_INFORMATION   0x52
    313 #define SCSIOP_XDWRITE_READ             0x53
    314 #define SCSIOP_RESERVE_TRACK_RZONE      0x53
    315 #define SCSIOP_SEND_OPC_INFORMATION     0x54
    316 #define SCSIOP_MODE_SELECT10            0x55
    317 #define SCSIOP_RESERVE_UNIT10           0x56
    318 #define SCSIOP_RESERVE_ELEMENT          0x56
    319 #define SCSIOP_RELEASE_UNIT10           0x57
    320 #define SCSIOP_RELEASE_ELEMENT          0x57
    321 #define SCSIOP_REPAIR_TRACK             0x58
    322 #define SCSIOP_MODE_SENSE10             0x5A
    323 #define SCSIOP_CLOSE_TRACK_SESSION      0x5B
    324 #define SCSIOP_READ_BUFFER_CAPACITY     0x5C
    325 #define SCSIOP_SEND_CUE_SHEET           0x5D
    326 #define SCSIOP_PERSISTENT_RESERVE_IN    0x5E
    327 #define SCSIOP_PERSISTENT_RESERVE_OUT   0x5F
    328 
    329 #define SCSIOP_REPORT_LUNS              0xA0
    330 #define SCSIOP_BLANK                    0xA1
    331 #define SCSIOP_ATA_PASSTHROUGH12        0xA1
    332 #define SCSIOP_SEND_EVENT               0xA2
    333 #define SCSIOP_SEND_KEY                 0xA3
    334 #define SCSIOP_MAINTENANCE_IN           0xA3
    335 #define SCSIOP_REPORT_KEY               0xA4
    336 #define SCSIOP_MAINTENANCE_OUT          0xA4
    337 #define SCSIOP_MOVE_MEDIUM              0xA5
    338 #define SCSIOP_LOAD_UNLOAD_SLOT         0xA6
    339 #define SCSIOP_EXCHANGE_MEDIUM          0xA6
    340 #define SCSIOP_SET_READ_AHEAD           0xA7
    341 #define SCSIOP_MOVE_MEDIUM_ATTACHED     0xA7
    342 #define SCSIOP_READ12                   0xA8
    343 #define SCSIOP_GET_MESSAGE              0xA8
    344 #define SCSIOP_SERVICE_ACTION_OUT12     0xA9
    345 #define SCSIOP_WRITE12                  0xAA
    346 #define SCSIOP_SEND_MESSAGE             0xAB
    347 #define SCSIOP_SERVICE_ACTION_IN12      0xAB
    348 #define SCSIOP_GET_PERFORMANCE          0xAC
    349 #define SCSIOP_READ_DVD_STRUCTURE       0xAD
    350 #define SCSIOP_WRITE_VERIFY12           0xAE
    351 #define SCSIOP_VERIFY12                 0xAF
    352 #define SCSIOP_SEARCH_DATA_HIGH12       0xB0
    353 #define SCSIOP_SEARCH_DATA_EQUAL12      0xB1
    354 #define SCSIOP_SEARCH_DATA_LOW12        0xB2
    355 #define SCSIOP_SET_LIMITS12             0xB3
    356 #define SCSIOP_READ_ELEMENT_STATUS_ATTACHED 0xB4
    357 #define SCSIOP_REQUEST_VOL_ELEMENT      0xB5
    358 #define SCSIOP_SEND_VOLUME_TAG          0xB6
    359 #define SCSIOP_SET_STREAMING            0xB6
    360 #define SCSIOP_READ_DEFECT_DATA         0xB7
    361 #define SCSIOP_READ_ELEMENT_STATUS      0xB8
    362 #define SCSIOP_READ_CD_MSF              0xB9
    363 #define SCSIOP_SCAN_CD                  0xBA
    364 #define SCSIOP_REDUNDANCY_GROUP_IN      0xBA
    365 #define SCSIOP_SET_CD_SPEED             0xBB
    366 #define SCSIOP_REDUNDANCY_GROUP_OUT     0xBB
    367 #define SCSIOP_PLAY_CD                  0xBC
    368 #define SCSIOP_SPARE_IN                 0xBC
    369 #define SCSIOP_MECHANISM_STATUS         0xBD
    370 #define SCSIOP_SPARE_OUT                0xBD
    371 #define SCSIOP_READ_CD                  0xBE
    372 #define SCSIOP_VOLUME_SET_IN            0xBE
    373 #define SCSIOP_SEND_DVD_STRUCTURE       0xBF
    374 #define SCSIOP_VOLUME_SET_OUT           0xBF
    375 #define SCSIOP_INIT_ELEMENT_RANGE       0xE7
    376 
    377 #define SCSIOP_XDWRITE_EXTENDED16       0x80
    378 #define SCSIOP_WRITE_FILEMARKS16        0x80
    379 #define SCSIOP_REBUILD16                0x81
    380 #define SCSIOP_READ_REVERSE16           0x81
    381 #define SCSIOP_REGENERATE16             0x82
    382 #define SCSIOP_EXTENDED_COPY            0x83
    383 #define SCSIOP_RECEIVE_COPY_RESULTS     0x84
    384 #define SCSIOP_ATA_PASSTHROUGH16        0x85
    385 #define SCSIOP_ACCESS_CONTROL_IN        0x86
    386 #define SCSIOP_ACCESS_CONTROL_OUT       0x87
    387 #define SCSIOP_READ16                   0x88
    388 #define SCSIOP_WRITE16                  0x8A
    389 #define SCSIOP_READ_ATTRIBUTES          0x8C
    390 #define SCSIOP_WRITE_ATTRIBUTES         0x8D
    391 #define SCSIOP_WRITE_VERIFY16           0x8E
    392 #define SCSIOP_VERIFY16                 0x8F
    393 #define SCSIOP_PREFETCH16               0x90
    394 #define SCSIOP_SYNCHRONIZE_CACHE16      0x91
    395 #define SCSIOP_SPACE16                  0x91
    396 #define SCSIOP_LOCK_UNLOCK_CACHE16      0x92
    397 #define SCSIOP_LOCATE16                 0x92
    398 #define SCSIOP_WRITE_SAME16             0x93
    399 #define SCSIOP_ERASE16                  0x93
    400 #define SCSIOP_READ_CAPACITY16          0x9E
    401 #define SCSIOP_SERVICE_ACTION_IN16      0x9E
    402 #define SCSIOP_SERVICE_ACTION_OUT16     0x9F
    403 
    404 #define CDB_RETURN_ON_COMPLETION   0
    405 #define CDB_RETURN_IMMEDIATE       1
    406 
    407 #define CDB_FORCE_MEDIA_ACCESS 0x08
    408 
    409 #define SCSIOP_DENON_EJECT_DISC    0xE6
    410 #define SCSIOP_DENON_STOP_AUDIO    0xE7
    411 #define SCSIOP_DENON_PLAY_AUDIO    0xE8
    412 #define SCSIOP_DENON_READ_TOC      0xE9
    413 #define SCSIOP_DENON_READ_SUBCODE  0xEB
    414 
    415 #define SCSIMESS_ABORT                0x06
    416 #define SCSIMESS_ABORT_WITH_TAG       0x0D
    417 #define SCSIMESS_BUS_DEVICE_RESET     0X0C
    418 #define SCSIMESS_CLEAR_QUEUE          0X0E
    419 #define SCSIMESS_COMMAND_COMPLETE     0X00
    420 #define SCSIMESS_DISCONNECT           0X04
    421 #define SCSIMESS_EXTENDED_MESSAGE     0X01
    422 #define SCSIMESS_IDENTIFY             0X80
    423 #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0
    424 #define SCSIMESS_IGNORE_WIDE_RESIDUE  0X23
    425 #define SCSIMESS_INITIATE_RECOVERY    0X0F
    426 #define SCSIMESS_INIT_DETECTED_ERROR  0X05
    427 #define SCSIMESS_LINK_CMD_COMP        0X0A
    428 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B
    429 #define SCSIMESS_MESS_PARITY_ERROR    0X09
    430 #define SCSIMESS_MESSAGE_REJECT       0X07
    431 #define SCSIMESS_NO_OPERATION         0X08
    432 #define SCSIMESS_HEAD_OF_QUEUE_TAG    0X21
    433 #define SCSIMESS_ORDERED_QUEUE_TAG    0X22
    434 #define SCSIMESS_SIMPLE_QUEUE_TAG     0X20
    435 #define SCSIMESS_RELEASE_RECOVERY     0X10
    436 #define SCSIMESS_RESTORE_POINTERS     0X03
    437 #define SCSIMESS_SAVE_DATA_POINTER    0X02
    438 #define SCSIMESS_TERMINATE_IO_PROCESS 0X11
    439 
    440 #define SCSIMESS_MODIFY_DATA_POINTER  0X00
    441 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01
    442 #define SCSIMESS_WIDE_DATA_REQUEST    0X03
    443 
    444 #define SCSIMESS_MODIFY_DATA_LENGTH   5
    445 #define SCSIMESS_SYNCH_DATA_LENGTH    3
    446 #define SCSIMESS_WIDE_DATA_LENGTH     2
    447 
    448 #define CDB_INQUIRY_EVPD           0x01
    449 
    450 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
    451 #define USE_DEFAULTMSB 0
    452 #define USE_DEFAULTLSB 0
    453 
    454 #define START_UNIT_CODE 0x01
    455 #define STOP_UNIT_CODE 0x00
    456 
    457 /* INQUIRYDATA.DeviceType constants */
    458 #define DIRECT_ACCESS_DEVICE              0x00
    459 #define SEQUENTIAL_ACCESS_DEVICE          0x01
    460 #define PRINTER_DEVICE                    0x02
    461 #define PROCESSOR_DEVICE                  0x03
    462 #define WRITE_ONCE_READ_MULTIPLE_DEVICE   0x04
    463 #define READ_ONLY_DIRECT_ACCESS_DEVICE    0x05
    464 #define SCANNER_DEVICE                    0x06
    465 #define OPTICAL_DEVICE                    0x07
    466 #define MEDIUM_CHANGER                    0x08
    467 #define COMMUNICATION_DEVICE              0x09
    468 #define ARRAY_CONTROLLER_DEVICE           0x0C
    469 #define SCSI_ENCLOSURE_DEVICE             0x0D
    470 #define REDUCED_BLOCK_DEVICE              0x0E
    471 #define OPTICAL_CARD_READER_WRITER_DEVICE 0x0F
    472 #define BRIDGE_CONTROLLER_DEVICE          0x10
    473 #define OBJECT_BASED_STORAGE_DEVICE       0x11
    474 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE   0x7F
    475 
    476 #define DEVICE_QUALIFIER_ACTIVE           0x00
    477 #define DEVICE_QUALIFIER_NOT_ACTIVE       0x01
    478 #define DEVICE_QUALIFIER_NOT_SUPPORTED    0x03
    479 
    480 /* INQUIRYDATA.DeviceTypeQualifier constants */
    481 #define DEVICE_CONNECTED 0x00
    482 
    483 #define SCSISTAT_GOOD                     0x00
    484 #define SCSISTAT_CHECK_CONDITION          0x02
    485 #define SCSISTAT_CONDITION_MET            0x04
    486 #define SCSISTAT_BUSY                     0x08
    487 #define SCSISTAT_INTERMEDIATE             0x10
    488 #define SCSISTAT_INTERMEDIATE_COND_MET    0x14
    489 #define SCSISTAT_RESERVATION_CONFLICT     0x18
    490 #define SCSISTAT_COMMAND_TERMINATED       0x22
    491 #define SCSISTAT_QUEUE_FULL               0x28
    492 
    493 #define VPD_MAX_BUFFER_SIZE                 0xff
    494 
    495 #define VPD_SUPPORTED_PAGES                 0x00
    496 #define VPD_SERIAL_NUMBER                   0x80
    497 #define VPD_DEVICE_IDENTIFIERS              0x83
    498 #define VPD_MEDIA_SERIAL_NUMBER             0x84
    499 #define VPD_SOFTWARE_INTERFACE_IDENTIFIERS  0x84
    500 #define VPD_NETWORK_MANAGEMENT_ADDRESSES    0x85
    501 #define VPD_EXTENDED_INQUIRY_DATA           0x86
    502 #define VPD_MODE_PAGE_POLICY                0x87
    503 #define VPD_SCSI_PORTS                      0x88
    504 
    505 #define RESERVATION_ACTION_READ_KEYS                    0x00
    506 #define RESERVATION_ACTION_READ_RESERVATIONS            0x01
    507 
    508 #define RESERVATION_ACTION_REGISTER                     0x00
    509 #define RESERVATION_ACTION_RESERVE                      0x01
    510 #define RESERVATION_ACTION_RELEASE                      0x02
    511 #define RESERVATION_ACTION_CLEAR                        0x03
    512 #define RESERVATION_ACTION_PREEMPT                      0x04
    513 #define RESERVATION_ACTION_PREEMPT_ABORT                0x05
    514 #define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING     0x06
    515 
    516 #define RESERVATION_SCOPE_LU                            0x00
    517 #define RESERVATION_SCOPE_ELEMENT                       0x02
    518 
    519 #define RESERVATION_TYPE_WRITE_EXCLUSIVE                0x01
    520 #define RESERVATION_TYPE_EXCLUSIVE                      0x03
    521 #define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS    0x05
    522 #define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS          0x06
    523 
    524 #define SENSE_BUFFER_SIZE              18
    525 
    526 #define MAX_SENSE_BUFFER_SIZE          255
    527 
    528 #define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE)
    529 
    530 /* Sense codes */
    531 #define SCSI_SENSE_NO_SENSE               0x00
    532 #define SCSI_SENSE_RECOVERED_ERROR        0x01
    533 #define SCSI_SENSE_NOT_READY              0x02
    534 #define SCSI_SENSE_MEDIUM_ERROR           0x03
    535 #define SCSI_SENSE_HARDWARE_ERROR         0x04
    536 #define SCSI_SENSE_ILLEGAL_REQUEST        0x05
    537 #define SCSI_SENSE_UNIT_ATTENTION         0x06
    538 #define SCSI_SENSE_DATA_PROTECT           0x07
    539 #define SCSI_SENSE_BLANK_CHECK            0x08
    540 #define SCSI_SENSE_UNIQUE                 0x09
    541 #define SCSI_SENSE_COPY_ABORTED           0x0A
    542 #define SCSI_SENSE_ABORTED_COMMAND        0x0B
    543 #define SCSI_SENSE_EQUAL                  0x0C
    544 #define SCSI_SENSE_VOL_OVERFLOW           0x0D
    545 #define SCSI_SENSE_MISCOMPARE             0x0E
    546 #define SCSI_SENSE_RESERVED               0x0F
    547 
    548 /* Additional tape bit */
    549 #define SCSI_ILLEGAL_LENGTH               0x20
    550 #define SCSI_EOM                          0x40
    551 #define SCSI_FILE_MARK                    0x80
    552 
    553 /* Additional Sense codes */
    554 #define SCSI_ADSENSE_NO_SENSE                              0x00
    555 #define SCSI_ADSENSE_NO_SEEK_COMPLETE                      0x02
    556 #define SCSI_ADSENSE_LUN_NOT_READY                         0x04
    557 #define SCSI_ADSENSE_LUN_COMMUNICATION                     0x08
    558 #define SCSI_ADSENSE_WRITE_ERROR                           0x0C
    559 #define SCSI_ADSENSE_TRACK_ERROR                           0x14
    560 #define SCSI_ADSENSE_SEEK_ERROR                            0x15
    561 #define SCSI_ADSENSE_REC_DATA_NOECC                        0x17
    562 #define SCSI_ADSENSE_REC_DATA_ECC                          0x18
    563 #define SCSI_ADSENSE_PARAMETER_LIST_LENGTH                 0x1A
    564 #define SCSI_ADSENSE_ILLEGAL_COMMAND                       0x20
    565 #define SCSI_ADSENSE_ILLEGAL_BLOCK                         0x21
    566 #define SCSI_ADSENSE_INVALID_CDB                           0x24
    567 #define SCSI_ADSENSE_INVALID_LUN                           0x25
    568 #define SCSI_ADSENSE_INVALID_FIELD_PARAMETER_LIST          0x26
    569 #define SCSI_ADSENSE_WRITE_PROTECT                         0x27
    570 #define SCSI_ADSENSE_MEDIUM_CHANGED                        0x28
    571 #define SCSI_ADSENSE_BUS_RESET                             0x29
    572 #define SCSI_ADSENSE_PARAMETERS_CHANGED                    0x2A
    573 #define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION       0x2E
    574 #define SCSI_ADSENSE_INVALID_MEDIA                         0x30
    575 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE                    0x3a
    576 #define SCSI_ADSENSE_POSITION_ERROR                        0x3b
    577 #define SCSI_ADSENSE_OPERATING_CONDITIONS_CHANGED          0x3f
    578 #define SCSI_ADSENSE_OPERATOR_REQUEST                      0x5a
    579 #define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
    580 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK           0x64
    581 #define SCSI_ADSENSE_COPY_PROTECTION_FAILURE               0x6f
    582 #define SCSI_ADSENSE_POWER_CALIBRATION_ERROR               0x73
    583 #define SCSI_ADSENSE_VENDOR_UNIQUE                         0x80
    584 #define SCSI_ADSENSE_MUSIC_AREA                            0xA0
    585 #define SCSI_ADSENSE_DATA_AREA                             0xA1
    586 #define SCSI_ADSENSE_VOLUME_OVERFLOW                       0xA7
    587 
    588 #define SCSI_ADWRITE_PROTECT                        SCSI_ADSENSE_WRITE_PROTECT
    589 #define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED  SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED
    590 
    591 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE                   0x00
    592 #define SCSI_SENSEQ_BECOMING_READY                         0x01
    593 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED                  0x02
    594 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED           0x03
    595 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS                     0x04
    596 #define SCSI_SENSEQ_REBUILD_IN_PROGRESS                    0x05
    597 #define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS              0x06
    598 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS                  0x07
    599 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS                 0x08
    600 #define SCSI_SENSEQ_LOSS_OF_STREAMING                      0x09
    601 #define SCSI_SENSEQ_PADDING_BLOCKS_ADDED                   0x0A
    602 
    603 #define SCSI_SENSEQ_COMM_FAILURE                 0x00
    604 #define SCSI_SENSEQ_COMM_TIMEOUT                 0x01
    605 #define SCSI_SENSEQ_COMM_PARITY_ERROR            0x02
    606 #define SCSI_SESNEQ_COMM_CRC_ERROR               0x03
    607 #define SCSI_SENSEQ_UNREACHABLE_TARGET           0x04
    608 
    609 #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
    610 #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
    611 #define SCSI_SENSEQ_SETMARK_DETECTED 0x03
    612 #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
    613 
    614 #define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01
    615 
    616 #define SCSI_SENSEQ_DESTINATION_FULL 0x0d
    617 #define SCSI_SENSEQ_SOURCE_EMPTY     0x0e
    618 
    619 #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
    620 #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
    621 #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
    622 #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
    623 
    624 #define SCSI_SENSEQ_TARGET_OPERATING_CONDITIONS_CHANGED 0x00
    625 #define SCSI_SENSEQ_MICROCODE_CHANGED                   0x01
    626 #define SCSI_SENSEQ_OPERATING_DEFINITION_CHANGED        0x02
    627 #define SCSI_SENSEQ_INQUIRY_DATA_CHANGED                0x03
    628 #define SCSI_SENSEQ_COMPONENT_DEVICE_ATTACHED           0x04
    629 #define SCSI_SENSEQ_DEVICE_IDENTIFIER_CHANGED           0x05
    630 #define SCSI_SENSEQ_REDUNDANCY_GROUP_MODIFIED           0x06
    631 #define SCSI_SENSEQ_REDUNDANCY_GROUP_DELETED            0x07
    632 #define SCSI_SENSEQ_SPARE_MODIFIED                      0x08
    633 #define SCSI_SENSEQ_SPARE_DELETED                       0x09
    634 #define SCSI_SENSEQ_VOLUME_SET_MODIFIED                 0x0A
    635 #define SCSI_SENSEQ_VOLUME_SET_DELETED                  0x0B
    636 #define SCSI_SENSEQ_VOLUME_SET_DEASSIGNED               0x0C
    637 #define SCSI_SENSEQ_VOLUME_SET_REASSIGNED               0x0D
    638 #define SCSI_SENSEQ_REPORTED_LUNS_DATA_CHANGED          0x0E
    639 #define SCSI_SENSEQ_ECHO_BUFFER_OVERWRITTEN             0x0F
    640 #define SCSI_SENSEQ_MEDIUM_LOADABLE                     0x10
    641 #define SCSI_SENSEQ_MEDIUM_AUXILIARY_MEMORY_ACCESSIBLE  0x11
    642 
    643 #define SCSI_SENSEQ_STATE_CHANGE_INPUT     0x00
    644 #define SCSI_SENSEQ_MEDIUM_REMOVAL         0x01
    645 #define SCSI_SENSEQ_WRITE_PROTECT_ENABLE   0x02
    646 #define SCSI_SENSEQ_WRITE_PROTECT_DISABLE  0x03
    647 
    648 #define SCSI_SENSEQ_AUTHENTICATION_FAILURE                          0x00
    649 #define SCSI_SENSEQ_KEY_NOT_PRESENT                                 0x01
    650 #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED                             0x02
    651 #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
    652 #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT           0x04
    653 #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR                  0x05
    654 
    655 #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01
    656 #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL        0x02
    657 #define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR       0x03
    658 #define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE             0x04
    659 #define SCSI_SENSEQ_PMA_RMA_IS_FULL                    0x05
    660 #define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL                0x06
    661 
    662 #define FILE_DEVICE_SCSI 0x0000001b
    663 
    664 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
    665 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
    666 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
    667 
    668 /* SMART support in ATAPI */
    669 #define IOCTL_SCSI_MINIPORT_SMART_VERSION               ((FILE_DEVICE_SCSI << 16) + 0x0500)
    670 #define IOCTL_SCSI_MINIPORT_IDENTIFY                    ((FILE_DEVICE_SCSI << 16) + 0x0501)
    671 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS          ((FILE_DEVICE_SCSI << 16) + 0x0502)
    672 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS       ((FILE_DEVICE_SCSI << 16) + 0x0503)
    673 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART                ((FILE_DEVICE_SCSI << 16) + 0x0504)
    674 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART               ((FILE_DEVICE_SCSI << 16) + 0x0505)
    675 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS               ((FILE_DEVICE_SCSI << 16) + 0x0506)
    676 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE     ((FILE_DEVICE_SCSI << 16) + 0x0507)
    677 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES       ((FILE_DEVICE_SCSI << 16) + 0x0508)
    678 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS       ((FILE_DEVICE_SCSI << 16) + 0x0509)
    679 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
    680 #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG              ((FILE_DEVICE_SCSI << 16) + 0x050b)
    681 #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG             ((FILE_DEVICE_SCSI << 16) + 0x050c)
    682 
    683 /* CLUSTER support */
    684 #define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
    685 #define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
    686 
    687 #define MODE_FD_SINGLE_SIDE               0x01
    688 #define MODE_FD_DOUBLE_SIDE               0x02
    689 #define MODE_FD_MAXIMUM_TYPE              0x1E
    690 #define MODE_DSP_FUA_SUPPORTED            0x10
    691 #define MODE_DSP_WRITE_PROTECT            0x80
    692 
    693 #define CDDA_CHANNEL_MUTED      0x0
    694 #define CDDA_CHANNEL_ZERO       0x1
    695 #define CDDA_CHANNEL_ONE        0x2
    696 #define CDDA_CHANNEL_TWO        0x4
    697 #define CDDA_CHANNEL_THREE      0x8
    698 
    699 #define CDVD_LMT_CADDY              0
    700 #define CDVD_LMT_TRAY               1
    701 #define CDVD_LMT_POPUP              2
    702 #define CDVD_LMT_RESERVED1          3
    703 #define CDVD_LMT_CHANGER_INDIVIDUAL 4
    704 #define CDVD_LMT_CHANGER_CARTRIDGE  5
    705 #define CDVD_LMT_RESERVED2          6
    706 #define CDVD_LMT_RESERVED3          7
    707 
    708 #define LOADING_MECHANISM_CADDY                 0x00
    709 #define LOADING_MECHANISM_TRAY                  0x01
    710 #define LOADING_MECHANISM_POPUP                 0x02
    711 #define LOADING_MECHANISM_INDIVIDUAL_CHANGER    0x04
    712 #define LOADING_MECHANISM_CARTRIDGE_CHANGER     0x05
    713 
    714 #define MODE_BLOCK_DESC_LENGTH        8
    715 #define MODE_HEADER_LENGTH            4
    716 #define MODE_HEADER_LENGTH10          8
    717 
    718 /* CDROM audio control */
    719 #define CDB_AUDIO_PAUSE                   0x00
    720 #define CDB_AUDIO_RESUME                  0x01
    721 #define CDB_DEVICE_START                  0x11
    722 #define CDB_DEVICE_STOP                   0x10
    723 #define CDB_EJECT_MEDIA                   0x10
    724 #define CDB_LOAD_MEDIA                    0x01
    725 #define CDB_SUBCHANNEL_HEADER             0x00
    726 #define CDB_SUBCHANNEL_BLOCK              0x01
    727 
    728 #define CDROM_AUDIO_CONTROL_PAGE          0x0E
    729 #define MODE_SELECT_IMMEDIATE             0x04
    730 #define MODE_SELECT_PFBIT                 0x10
    731 
    732 #define CDB_USE_MSF                       0x01
    733 
    734 /* Multisession CDROMs */
    735 #define GET_LAST_SESSION 0x01
    736 #define GET_SESSION_DATA 0x02
    737 
    738 typedef union _CDB {
    739   struct _CDB6GENERIC {
    740     UCHAR OperationCode;
    741     UCHAR Immediate:1;
    742     UCHAR CommandUniqueBits:4;
    743     UCHAR LogicalUnitNumber:3;
    744     UCHAR CommandUniqueBytes[3];
    745     UCHAR Link:1;
    746     UCHAR Flag:1;
    747     UCHAR Reserved:4;
    748     UCHAR VendorUnique:2;
    749   } CDB6GENERIC, *PCDB6GENERIC;
    750   struct _CDB6READWRITE {
    751     UCHAR OperationCode;
    752     UCHAR LogicalBlockMsb1:5;
    753     UCHAR LogicalUnitNumber:3;
    754     UCHAR LogicalBlockMsb0;
    755     UCHAR LogicalBlockLsb;
    756     UCHAR TransferBlocks;
    757     UCHAR Control;
    758   } CDB6READWRITE, *PCDB6READWRITE;
    759   struct _CDB6INQUIRY {
    760     UCHAR OperationCode;
    761     UCHAR Reserved1:5;
    762     UCHAR LogicalUnitNumber:3;
    763     UCHAR PageCode;
    764     UCHAR IReserved;
    765     UCHAR AllocationLength;
    766     UCHAR Control;
    767   } CDB6INQUIRY, *PCDB6INQUIRY;
    768   struct _CDB6INQUIRY3 {
    769     UCHAR OperationCode;
    770     UCHAR EnableVitalProductData:1;
    771     UCHAR CommandSupportData:1;
    772     UCHAR Reserved1:6;
    773     UCHAR PageCode;
    774     UCHAR Reserved2;
    775     UCHAR AllocationLength;
    776     UCHAR Control;
    777   } CDB6INQUIRY3, *PCDB6INQUIRY3;
    778   struct _CDB6VERIFY {
    779     UCHAR OperationCode;
    780     UCHAR Fixed:1;
    781     UCHAR ByteCompare:1;
    782     UCHAR Immediate:1;
    783     UCHAR Reserved:2;
    784     UCHAR LogicalUnitNumber:3;
    785     UCHAR VerificationLength[3];
    786     UCHAR Control;
    787   } CDB6VERIFY, *PCDB6VERIFY;
    788   struct _CDB6FORMAT {
    789     UCHAR OperationCode;
    790     UCHAR FormatControl:5;
    791     UCHAR LogicalUnitNumber:3;
    792     UCHAR FReserved1;
    793     UCHAR InterleaveMsb;
    794     UCHAR InterleaveLsb;
    795     UCHAR FReserved2;
    796   } CDB6FORMAT, *PCDB6FORMAT;
    797   struct _CDB10 {
    798     UCHAR OperationCode;
    799     UCHAR RelativeAddress:1;
    800     UCHAR Reserved1:2;
    801     UCHAR ForceUnitAccess:1;
    802     UCHAR DisablePageOut:1;
    803     UCHAR LogicalUnitNumber:3;
    804     UCHAR LogicalBlockByte0;
    805     UCHAR LogicalBlockByte1;
    806     UCHAR LogicalBlockByte2;
    807     UCHAR LogicalBlockByte3;
    808     UCHAR Reserved2;
    809     UCHAR TransferBlocksMsb;
    810     UCHAR TransferBlocksLsb;
    811     UCHAR Control;
    812   } CDB10, *PCDB10;
    813   struct _CDB12 {
    814     UCHAR OperationCode;
    815     UCHAR RelativeAddress:1;
    816     UCHAR Reserved1:2;
    817     UCHAR ForceUnitAccess:1;
    818     UCHAR DisablePageOut:1;
    819     UCHAR LogicalUnitNumber:3;
    820     UCHAR LogicalBlock[4];
    821     UCHAR TransferLength[4];
    822     UCHAR Reserved2;
    823     UCHAR Control;
    824   } CDB12, *PCDB12;
    825   struct _CDB16 {
    826      UCHAR OperationCode;
    827      UCHAR Reserved1:3;
    828      UCHAR ForceUnitAccess:1;
    829      UCHAR DisablePageOut:1;
    830      UCHAR Protection:3;
    831      UCHAR LogicalBlock[8];
    832      UCHAR TransferLength[4];
    833      UCHAR Reserved2;
    834      UCHAR Control;
    835   } CDB16, *PCDB16;
    836   struct _PAUSE_RESUME {
    837     UCHAR OperationCode;
    838     UCHAR Reserved1:5;
    839     UCHAR LogicalUnitNumber:3;
    840     UCHAR Reserved2[6];
    841     UCHAR Action;
    842     UCHAR Control;
    843   } PAUSE_RESUME, *PPAUSE_RESUME;
    844   struct _READ_TOC {
    845     UCHAR OperationCode;
    846     UCHAR Reserved0:1;
    847     UCHAR Msf:1;
    848     UCHAR Reserved1:3;
    849     UCHAR LogicalUnitNumber:3;
    850     UCHAR Format2:4;
    851     UCHAR Reserved2:4;
    852     UCHAR Reserved3[3];
    853     UCHAR StartingTrack;
    854     UCHAR AllocationLength[2];
    855     UCHAR Control:6;
    856     UCHAR Format:2;
    857   } READ_TOC, *PREAD_TOC;
    858   struct _READ_DISK_INFORMATION {
    859     UCHAR OperationCode;
    860     UCHAR Reserved1:5;
    861     UCHAR Lun:3;
    862     UCHAR Reserved2[5];
    863     UCHAR AllocationLength[2];
    864     UCHAR Control;
    865   } READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
    866   struct _READ_TRACK_INFORMATION {
    867     UCHAR OperationCode;
    868     UCHAR Track:1;
    869     UCHAR Reserved1:3;
    870     UCHAR Reserved2:1;
    871     UCHAR Lun:3;
    872     UCHAR BlockAddress[4];
    873     UCHAR Reserved3;
    874     UCHAR AllocationLength[2];
    875     UCHAR Control;
    876   } READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
    877   struct _RESERVE_TRACK_RZONE {
    878     UCHAR OperationCode;
    879     UCHAR Reserved1[4];
    880     UCHAR ReservationSize[4];
    881     UCHAR Control;
    882   } RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
    883   struct _SEND_OPC_INFORMATION {
    884     UCHAR OperationCode;
    885     UCHAR DoOpc:1;
    886     UCHAR Reserved1:7;
    887     UCHAR Exclude0:1;
    888     UCHAR Exclude1:1;
    889     UCHAR Reserved2:6;
    890     UCHAR Reserved3[4];
    891     UCHAR ParameterListLength[2];
    892     UCHAR Reserved4;
    893   } SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
    894   struct _REPAIR_TRACK {
    895     UCHAR OperationCode;
    896     UCHAR Immediate:1;
    897     UCHAR Reserved1:7;
    898     UCHAR Reserved2[2];
    899     UCHAR TrackNumber[2];
    900     UCHAR Reserved3[3];
    901     UCHAR Control;
    902   } REPAIR_TRACK, *PREPAIR_TRACK;
    903   struct _CLOSE_TRACK {
    904     UCHAR OperationCode;
    905     UCHAR Immediate:1;
    906     UCHAR Reserved1:7;
    907     UCHAR Track:1;
    908     UCHAR Session:1;
    909     UCHAR Reserved2:6;
    910     UCHAR Reserved3;
    911     UCHAR TrackNumber[2];
    912     UCHAR Reserved4[3];
    913     UCHAR Control;
    914   } CLOSE_TRACK, *PCLOSE_TRACK;
    915   struct _READ_BUFFER_CAPACITY {
    916     UCHAR OperationCode;
    917     UCHAR BlockInfo:1;
    918     UCHAR Reserved1:7;
    919     UCHAR Reserved2[5];
    920     UCHAR AllocationLength[2];
    921     UCHAR Control;
    922   } READ_BUFFER_CAPACITY, *PREAD_BUFFER_CAPACITY;
    923   struct _SEND_CUE_SHEET {
    924     UCHAR OperationCode;
    925     UCHAR Reserved[5];
    926     UCHAR CueSheetSize[3];
    927     UCHAR Control;
    928   } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
    929   struct _READ_HEADER {
    930     UCHAR OperationCode;
    931     UCHAR Reserved1:1;
    932     UCHAR Msf:1;
    933     UCHAR Reserved2:3;
    934     UCHAR Lun:3;
    935     UCHAR LogicalBlockAddress[4];
    936     UCHAR Reserved3;
    937     UCHAR AllocationLength[2];
    938     UCHAR Control;
    939   } READ_HEADER, *PREAD_HEADER;
    940   struct _PLAY_AUDIO {
    941     UCHAR OperationCode;
    942     UCHAR Reserved1:5;
    943     UCHAR LogicalUnitNumber:3;
    944     UCHAR StartingBlockAddress[4];
    945     UCHAR Reserved2;
    946     UCHAR PlayLength[2];
    947     UCHAR Control;
    948   } PLAY_AUDIO, *PPLAY_AUDIO;
    949   struct _PLAY_AUDIO_MSF {
    950     UCHAR OperationCode;
    951     UCHAR Reserved1:5;
    952     UCHAR LogicalUnitNumber:3;
    953     UCHAR Reserved2;
    954     UCHAR StartingM;
    955     UCHAR StartingS;
    956     UCHAR StartingF;
    957     UCHAR EndingM;
    958     UCHAR EndingS;
    959     UCHAR EndingF;
    960     UCHAR Control;
    961   } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
    962   struct _BLANK_MEDIA {
    963     UCHAR OperationCode;
    964     UCHAR BlankType:3;
    965     UCHAR Reserved1:1;
    966     UCHAR Immediate:1;
    967     UCHAR Reserved2:3;
    968     UCHAR AddressOrTrack[4];
    969     UCHAR Reserved3[5];
    970     UCHAR Control;
    971   } BLANK_MEDIA, *PBLANK_MEDIA;
    972   struct _PLAY_CD {
    973     UCHAR OperationCode;
    974     UCHAR Reserved1:1;
    975     UCHAR CMSF:1;
    976     UCHAR ExpectedSectorType:3;
    977     UCHAR Lun:3;
    978     _ANONYMOUS_UNION union {
    979       struct _LBA {
    980         UCHAR StartingBlockAddress[4];
    981         UCHAR PlayLength[4];
    982       } LBA;
    983       struct _MSF {
    984         UCHAR Reserved1;
    985         UCHAR StartingM;
    986         UCHAR StartingS;
    987         UCHAR StartingF;
    988         UCHAR EndingM;
    989         UCHAR EndingS;
    990         UCHAR EndingF;
    991         UCHAR Reserved2;
    992       } MSF;
    993     } DUMMYUNIONNAME;
    994     UCHAR Audio:1;
    995     UCHAR Composite:1;
    996     UCHAR Port1:1;
    997     UCHAR Port2:1;
    998     UCHAR Reserved2:3;
    999     UCHAR Speed:1;
   1000     UCHAR Control;
   1001   } PLAY_CD, *PPLAY_CD;
   1002   struct _SCAN_CD {
   1003     UCHAR OperationCode;
   1004     UCHAR RelativeAddress:1;
   1005     UCHAR Reserved1:3;
   1006     UCHAR Direct:1;
   1007     UCHAR Lun:3;
   1008     UCHAR StartingAddress[4];
   1009     UCHAR Reserved2[3];
   1010     UCHAR Reserved3:6;
   1011     UCHAR Type:2;
   1012     UCHAR Reserved4;
   1013     UCHAR Control;
   1014   } SCAN_CD, *PSCAN_CD;
   1015   struct _STOP_PLAY_SCAN {
   1016     UCHAR OperationCode;
   1017     UCHAR Reserved1:5;
   1018     UCHAR Lun:3;
   1019     UCHAR Reserved2[7];
   1020     UCHAR Control;
   1021   } STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
   1022   struct _SUBCHANNEL {
   1023     UCHAR OperationCode;
   1024     UCHAR Reserved0:1;
   1025     UCHAR Msf:1;
   1026     UCHAR Reserved1:3;
   1027     UCHAR LogicalUnitNumber:3;
   1028     UCHAR Reserved2:6;
   1029     UCHAR SubQ:1;
   1030     UCHAR Reserved3:1;
   1031     UCHAR Format;
   1032     UCHAR Reserved4[2];
   1033     UCHAR TrackNumber;
   1034     UCHAR AllocationLength[2];
   1035     UCHAR Control;
   1036   } SUBCHANNEL, *PSUBCHANNEL;
   1037   struct _READ_CD {
   1038     UCHAR OperationCode;
   1039     UCHAR RelativeAddress:1;
   1040     UCHAR Reserved0:1;
   1041     UCHAR ExpectedSectorType:3;
   1042     UCHAR Lun:3;
   1043     UCHAR StartingLBA[4];
   1044     UCHAR TransferBlocks[3];
   1045     UCHAR Reserved2:1;
   1046     UCHAR ErrorFlags:2;
   1047     UCHAR IncludeEDC:1;
   1048     UCHAR IncludeUserData:1;
   1049     UCHAR HeaderCode:2;
   1050     UCHAR IncludeSyncData:1;
   1051     UCHAR SubChannelSelection:3;
   1052     UCHAR Reserved3:5;
   1053     UCHAR Control;
   1054   } READ_CD, *PREAD_CD;
   1055   struct _READ_CD_MSF {
   1056     UCHAR OperationCode;
   1057     UCHAR RelativeAddress:1;
   1058     UCHAR Reserved1:1;
   1059     UCHAR ExpectedSectorType:3;
   1060     UCHAR Lun:3;
   1061     UCHAR Reserved2;
   1062     UCHAR StartingM;
   1063     UCHAR StartingS;
   1064     UCHAR StartingF;
   1065     UCHAR EndingM;
   1066     UCHAR EndingS;
   1067     UCHAR EndingF;
   1068     UCHAR Reserved3;
   1069     UCHAR Reserved4:1;
   1070     UCHAR ErrorFlags:2;
   1071     UCHAR IncludeEDC:1;
   1072     UCHAR IncludeUserData:1;
   1073     UCHAR HeaderCode:2;
   1074     UCHAR IncludeSyncData:1;
   1075     UCHAR SubChannelSelection:3;
   1076     UCHAR Reserved5:5;
   1077     UCHAR Control;
   1078   } READ_CD_MSF, *PREAD_CD_MSF;
   1079   struct _PLXTR_READ_CDDA {
   1080     UCHAR OperationCode;
   1081     UCHAR Reserved0:5;
   1082     UCHAR LogicalUnitNumber:3;
   1083     UCHAR LogicalBlockByte0;
   1084     UCHAR LogicalBlockByte1;
   1085     UCHAR LogicalBlockByte2;
   1086     UCHAR LogicalBlockByte3;
   1087     UCHAR TransferBlockByte0;
   1088     UCHAR TransferBlockByte1;
   1089     UCHAR TransferBlockByte2;
   1090     UCHAR TransferBlockByte3;
   1091     UCHAR SubCode;
   1092     UCHAR Control;
   1093   } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
   1094   struct _NEC_READ_CDDA {
   1095     UCHAR OperationCode;
   1096     UCHAR Reserved0;
   1097     UCHAR LogicalBlockByte0;
   1098     UCHAR LogicalBlockByte1;
   1099     UCHAR LogicalBlockByte2;
   1100     UCHAR LogicalBlockByte3;
   1101     UCHAR Reserved1;
   1102     UCHAR TransferBlockByte0;
   1103     UCHAR TransferBlockByte1;
   1104     UCHAR Control;
   1105   } NEC_READ_CDDA, *PNEC_READ_CDDA;
   1106   struct _MODE_SENSE {
   1107     UCHAR OperationCode;
   1108     UCHAR Reserved1:3;
   1109     UCHAR Dbd:1;
   1110     UCHAR Reserved2:1;
   1111     UCHAR LogicalUnitNumber:3;
   1112     UCHAR PageCode:6;
   1113     UCHAR Pc:2;
   1114     UCHAR Reserved3;
   1115     UCHAR AllocationLength;
   1116     UCHAR Control;
   1117   } MODE_SENSE, *PMODE_SENSE;
   1118   struct _MODE_SENSE10 {
   1119     UCHAR OperationCode;
   1120     UCHAR Reserved1:3;
   1121     UCHAR Dbd:1;
   1122     UCHAR Reserved2:1;
   1123     UCHAR LogicalUnitNumber:3;
   1124     UCHAR PageCode:6;
   1125     UCHAR Pc:2;
   1126     UCHAR Reserved3[4];
   1127     UCHAR AllocationLength[2];
   1128     UCHAR Control;
   1129   } MODE_SENSE10, *PMODE_SENSE10;
   1130   struct _MODE_SELECT {
   1131     UCHAR OperationCode;
   1132     UCHAR SPBit:1;
   1133     UCHAR Reserved1:3;
   1134     UCHAR PFBit:1;
   1135     UCHAR LogicalUnitNumber:3;
   1136     UCHAR Reserved2[2];
   1137     UCHAR ParameterListLength;
   1138     UCHAR Control;
   1139   } MODE_SELECT, *PMODE_SELECT;
   1140   struct _MODE_SELECT10 {
   1141     UCHAR OperationCode;
   1142     UCHAR SPBit:1;
   1143     UCHAR Reserved1:3;
   1144     UCHAR PFBit:1;
   1145     UCHAR LogicalUnitNumber:3;
   1146     UCHAR Reserved2[5];
   1147     UCHAR ParameterListLength[2];
   1148     UCHAR Control;
   1149   } MODE_SELECT10, *PMODE_SELECT10;
   1150   struct _LOCATE {
   1151     UCHAR OperationCode;
   1152     UCHAR Immediate:1;
   1153     UCHAR CPBit:1;
   1154     UCHAR BTBit:1;
   1155     UCHAR Reserved1:2;
   1156     UCHAR LogicalUnitNumber:3;
   1157     UCHAR Reserved3;
   1158     UCHAR LogicalBlockAddress[4];
   1159     UCHAR Reserved4;
   1160     UCHAR Partition;
   1161     UCHAR Control;
   1162   } LOCATE, *PLOCATE;
   1163   struct _LOGSENSE {
   1164     UCHAR OperationCode;
   1165     UCHAR SPBit:1;
   1166     UCHAR PPCBit:1;
   1167     UCHAR Reserved1:3;
   1168     UCHAR LogicalUnitNumber:3;
   1169     UCHAR PageCode:6;
   1170     UCHAR PCBit:2;
   1171     UCHAR Reserved2;
   1172     UCHAR Reserved3;
   1173     UCHAR ParameterPointer[2];
   1174     UCHAR AllocationLength[2];
   1175     UCHAR Control;
   1176   } LOGSENSE, *PLOGSENSE;
   1177   struct _LOGSELECT {
   1178     UCHAR OperationCode;
   1179     UCHAR SPBit:1;
   1180     UCHAR PCRBit:1;
   1181     UCHAR Reserved1:3;
   1182     UCHAR LogicalUnitNumber:3;
   1183     UCHAR Reserved:6;
   1184     UCHAR PCBit:2;
   1185     UCHAR Reserved2[4];
   1186     UCHAR ParameterListLength[2];
   1187     UCHAR Control;
   1188   } LOGSELECT, *PLOGSELECT;
   1189   struct _PRINT {
   1190     UCHAR OperationCode;
   1191     UCHAR Reserved:5;
   1192     UCHAR LogicalUnitNumber:3;
   1193     UCHAR TransferLength[3];
   1194     UCHAR Control;
   1195   } PRINT, *PPRINT;
   1196   struct _SEEK {
   1197     UCHAR OperationCode;
   1198     UCHAR Reserved1:5;
   1199     UCHAR LogicalUnitNumber:3;
   1200     UCHAR LogicalBlockAddress[4];
   1201     UCHAR Reserved2[3];
   1202     UCHAR Control;
   1203   } SEEK, *PSEEK;
   1204   struct _ERASE {
   1205     UCHAR OperationCode;
   1206     UCHAR Long:1;
   1207     UCHAR Immediate:1;
   1208     UCHAR Reserved1:3;
   1209     UCHAR LogicalUnitNumber:3;
   1210     UCHAR Reserved2[3];
   1211     UCHAR Control;
   1212   } ERASE, *PERASE;
   1213   struct _START_STOP {
   1214     UCHAR OperationCode;
   1215     UCHAR Immediate:1;
   1216     UCHAR Reserved1:4;
   1217     UCHAR LogicalUnitNumber:3;
   1218     UCHAR Reserved2[2];
   1219     UCHAR Start:1;
   1220     UCHAR LoadEject:1;
   1221     UCHAR Reserved3:6;
   1222     UCHAR Control;
   1223   } START_STOP, *PSTART_STOP;
   1224   struct _MEDIA_REMOVAL {
   1225     UCHAR OperationCode;
   1226     UCHAR Reserved1:5;
   1227     UCHAR LogicalUnitNumber:3;
   1228     UCHAR Reserved2[2];
   1229     UCHAR Prevent:1;
   1230     UCHAR Persistant:1;
   1231     UCHAR Reserved3:6;
   1232     UCHAR Control;
   1233   } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
   1234   struct _SEEK_BLOCK {
   1235     UCHAR OperationCode;
   1236     UCHAR Immediate:1;
   1237     UCHAR Reserved1:7;
   1238     UCHAR BlockAddress[3];
   1239     UCHAR Link:1;
   1240     UCHAR Flag:1;
   1241     UCHAR Reserved2:4;
   1242     UCHAR VendorUnique:2;
   1243   } SEEK_BLOCK, *PSEEK_BLOCK;
   1244   struct _REQUEST_BLOCK_ADDRESS {
   1245     UCHAR OperationCode;
   1246     UCHAR Reserved1[3];
   1247     UCHAR AllocationLength;
   1248     UCHAR Link:1;
   1249     UCHAR Flag:1;
   1250     UCHAR Reserved2:4;
   1251     UCHAR VendorUnique:2;
   1252   } REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
   1253   struct _PARTITION {
   1254     UCHAR OperationCode;
   1255     UCHAR Immediate:1;
   1256     UCHAR Sel:1;
   1257     UCHAR PartitionSelect:6;
   1258     UCHAR Reserved1[3];
   1259     UCHAR Control;
   1260   } PARTITION, *PPARTITION;
   1261   struct _WRITE_TAPE_MARKS {
   1262     UCHAR OperationCode;
   1263     UCHAR Immediate:1;
   1264     UCHAR WriteSetMarks:1;
   1265     UCHAR Reserved:3;
   1266     UCHAR LogicalUnitNumber:3;
   1267     UCHAR TransferLength[3];
   1268     UCHAR Control;
   1269   } WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
   1270   struct _SPACE_TAPE_MARKS {
   1271     UCHAR OperationCode;
   1272     UCHAR Code:3;
   1273     UCHAR Reserved:2;
   1274     UCHAR LogicalUnitNumber:3;
   1275     UCHAR NumMarksMSB;
   1276     UCHAR NumMarks;
   1277     UCHAR NumMarksLSB;
   1278   union {
   1279     UCHAR value;
   1280     struct {
   1281       UCHAR Link:1;
   1282       UCHAR Flag:1;
   1283       UCHAR Reserved:4;
   1284       UCHAR VendorUnique:2;
   1285     } Fields;
   1286   } Byte6;
   1287   } SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
   1288   struct _READ_POSITION {
   1289     UCHAR Operation;
   1290     UCHAR BlockType:1;
   1291     UCHAR Reserved1:4;
   1292     UCHAR Lun:3;
   1293     UCHAR Reserved2[7];
   1294     UCHAR Control;
   1295   } READ_POSITION, *PREAD_POSITION;
   1296   struct _CDB6READWRITETAPE {
   1297     UCHAR OperationCode;
   1298     UCHAR VendorSpecific:5;
   1299     UCHAR Reserved:3;
   1300     UCHAR TransferLenMSB;
   1301     UCHAR TransferLen;
   1302     UCHAR TransferLenLSB;
   1303     UCHAR Link:1;
   1304     UCHAR Flag:1;
   1305     UCHAR Reserved1:4;
   1306     UCHAR VendorUnique:2;
   1307   } CDB6READWRITETAPE, *PCDB6READWRITETAPE;
   1308   struct _INIT_ELEMENT_STATUS {
   1309     UCHAR OperationCode;
   1310     UCHAR Reserved1:5;
   1311     UCHAR LogicalUnitNubmer:3;
   1312     UCHAR Reserved2[3];
   1313     UCHAR Reserved3:7;
   1314     UCHAR NoBarCode:1;
   1315   } INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
   1316   struct _INITIALIZE_ELEMENT_RANGE {
   1317     UCHAR OperationCode;
   1318     UCHAR Range:1;
   1319     UCHAR Reserved1:4;
   1320     UCHAR LogicalUnitNubmer:3;
   1321     UCHAR FirstElementAddress[2];
   1322     UCHAR Reserved2[2];
   1323     UCHAR NumberOfElements[2];
   1324     UCHAR Reserved3;
   1325     UCHAR Reserved4:7;
   1326     UCHAR NoBarCode:1;
   1327   } INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
   1328   struct _POSITION_TO_ELEMENT {
   1329     UCHAR OperationCode;
   1330     UCHAR Reserved1:5;
   1331     UCHAR LogicalUnitNumber:3;
   1332     UCHAR TransportElementAddress[2];
   1333     UCHAR DestinationElementAddress[2];
   1334     UCHAR Reserved2[2];
   1335     UCHAR Flip:1;
   1336     UCHAR Reserved3:7;
   1337     UCHAR Control;
   1338   } POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
   1339   struct _MOVE_MEDIUM {
   1340     UCHAR OperationCode;
   1341     UCHAR Reserved1:5;
   1342     UCHAR LogicalUnitNumber:3;
   1343     UCHAR TransportElementAddress[2];
   1344     UCHAR SourceElementAddress[2];
   1345     UCHAR DestinationElementAddress[2];
   1346     UCHAR Reserved2[2];
   1347     UCHAR Flip:1;
   1348     UCHAR Reserved3:7;
   1349     UCHAR Control;
   1350   } MOVE_MEDIUM, *PMOVE_MEDIUM;
   1351   struct _EXCHANGE_MEDIUM {
   1352     UCHAR OperationCode;
   1353     UCHAR Reserved1:5;
   1354     UCHAR LogicalUnitNumber:3;
   1355     UCHAR TransportElementAddress[2];
   1356     UCHAR SourceElementAddress[2];
   1357     UCHAR Destination1ElementAddress[2];
   1358     UCHAR Destination2ElementAddress[2];
   1359     UCHAR Flip1:1;
   1360     UCHAR Flip2:1;
   1361     UCHAR Reserved3:6;
   1362     UCHAR Control;
   1363   } EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
   1364   struct _READ_ELEMENT_STATUS {
   1365     UCHAR OperationCode;
   1366     UCHAR ElementType:4;
   1367     UCHAR VolTag:1;
   1368     UCHAR LogicalUnitNumber:3;
   1369     UCHAR StartingElementAddress[2];
   1370     UCHAR NumberOfElements[2];
   1371     UCHAR Reserved1;
   1372     UCHAR AllocationLength[3];
   1373     UCHAR Reserved2;
   1374     UCHAR Control;
   1375   } READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
   1376   struct _SEND_VOLUME_TAG {
   1377     UCHAR OperationCode;
   1378     UCHAR ElementType:4;
   1379     UCHAR Reserved1:1;
   1380     UCHAR LogicalUnitNumber:3;
   1381     UCHAR StartingElementAddress[2];
   1382     UCHAR Reserved2;
   1383     UCHAR ActionCode:5;
   1384     UCHAR Reserved3:3;
   1385     UCHAR Reserved4[2];
   1386     UCHAR ParameterListLength[2];
   1387     UCHAR Reserved5;
   1388     UCHAR Control;
   1389   } SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
   1390   struct _REQUEST_VOLUME_ELEMENT_ADDRESS {
   1391     UCHAR OperationCode;
   1392     UCHAR ElementType:4;
   1393     UCHAR VolTag:1;
   1394     UCHAR LogicalUnitNumber:3;
   1395     UCHAR StartingElementAddress[2];
   1396     UCHAR NumberElements[2];
   1397     UCHAR Reserved1;
   1398     UCHAR AllocationLength[3];
   1399     UCHAR Reserved2;
   1400     UCHAR Control;
   1401   } REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
   1402   struct _LOAD_UNLOAD {
   1403     UCHAR OperationCode;
   1404     UCHAR Immediate:1;
   1405     UCHAR Reserved1:4;
   1406     UCHAR Lun:3;
   1407     UCHAR Reserved2[2];
   1408     UCHAR Start:1;
   1409     UCHAR LoadEject:1;
   1410     UCHAR Reserved3:6;
   1411     UCHAR Reserved4[3];
   1412     UCHAR Slot;
   1413     UCHAR Reserved5[3];
   1414   } LOAD_UNLOAD, *PLOAD_UNLOAD;
   1415   struct _MECH_STATUS {
   1416     UCHAR OperationCode;
   1417     UCHAR Reserved:5;
   1418     UCHAR Lun:3;
   1419     UCHAR Reserved1[6];
   1420     UCHAR AllocationLength[2];
   1421     UCHAR Reserved2[1];
   1422     UCHAR Control;
   1423   } MECH_STATUS, *PMECH_STATUS;
   1424   struct _SYNCHRONIZE_CACHE10 {
   1425     UCHAR OperationCode;
   1426     UCHAR RelAddr:1;
   1427     UCHAR Immediate:1;
   1428     UCHAR Reserved:3;
   1429     UCHAR Lun:3;
   1430     UCHAR LogicalBlockAddress[4];
   1431     UCHAR Reserved2;
   1432     UCHAR BlockCount[2];
   1433     UCHAR Control;
   1434   } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
   1435   struct _GET_EVENT_STATUS_NOTIFICATION {
   1436     UCHAR OperationCode;
   1437     UCHAR Immediate:1;
   1438     UCHAR Reserved:4;
   1439     UCHAR Lun:3;
   1440     UCHAR Reserved2[2];
   1441     UCHAR NotificationClassRequest;
   1442     UCHAR Reserved3[2];
   1443     UCHAR EventListLength[2];
   1444     UCHAR Control;
   1445   } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
   1446   struct _GET_PERFORMANCE {
   1447     UCHAR OperationCode;
   1448     UCHAR Except:2;
   1449     UCHAR Write:1;
   1450     UCHAR Tolerance:2;
   1451     UCHAR Reserved0:3;
   1452     UCHAR StartingLBA[4];
   1453     UCHAR Reserved1[2];
   1454     UCHAR MaximumNumberOfDescriptors[2];
   1455     UCHAR Type;
   1456     UCHAR Control;
   1457   } GET_PERFORMANCE;
   1458   struct _READ_DVD_STRUCTURE {
   1459     UCHAR OperationCode;
   1460     UCHAR Reserved1:5;
   1461     UCHAR Lun:3;
   1462     UCHAR RMDBlockNumber[4];
   1463     UCHAR LayerNumber;
   1464     UCHAR Format;
   1465     UCHAR AllocationLength[2];
   1466     UCHAR Reserved3:6;
   1467     UCHAR AGID:2;
   1468     UCHAR Control;
   1469   } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
   1470   struct _SET_STREAMING {
   1471     UCHAR OperationCode;
   1472     UCHAR Reserved[8];
   1473     UCHAR ParameterListLength[2];
   1474     UCHAR Control;
   1475   } SET_STREAMING;
   1476   struct _SEND_DVD_STRUCTURE {
   1477     UCHAR OperationCode;
   1478     UCHAR Reserved1:5;
   1479     UCHAR Lun:3;
   1480     UCHAR Reserved2[5];
   1481     UCHAR Format;
   1482     UCHAR ParameterListLength[2];
   1483     UCHAR Reserved3;
   1484     UCHAR Control;
   1485   } SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
   1486   struct _SEND_KEY {
   1487     UCHAR OperationCode;
   1488     UCHAR Reserved1:5;
   1489     UCHAR Lun:3;
   1490     UCHAR Reserved2[6];
   1491     UCHAR ParameterListLength[2];
   1492     UCHAR KeyFormat:6;
   1493     UCHAR AGID:2;
   1494     UCHAR Control;
   1495   } SEND_KEY, *PSEND_KEY;
   1496   struct _REPORT_KEY {
   1497     UCHAR OperationCode;
   1498     UCHAR Reserved1:5;
   1499     UCHAR Lun:3;
   1500     UCHAR LogicalBlockAddress[4];
   1501     UCHAR Reserved2[2];
   1502     UCHAR AllocationLength[2];
   1503     UCHAR KeyFormat:6;
   1504     UCHAR AGID:2;
   1505     UCHAR Control;
   1506   } REPORT_KEY, *PREPORT_KEY;
   1507   struct _SET_READ_AHEAD {
   1508     UCHAR OperationCode;
   1509     UCHAR Reserved1:5;
   1510     UCHAR Lun:3;
   1511     UCHAR TriggerLBA[4];
   1512     UCHAR ReadAheadLBA[4];
   1513     UCHAR Reserved2;
   1514     UCHAR Control;
   1515   } SET_READ_AHEAD, *PSET_READ_AHEAD;
   1516   struct _READ_FORMATTED_CAPACITIES {
   1517     UCHAR OperationCode;
   1518     UCHAR Reserved1:5;
   1519     UCHAR Lun:3;
   1520     UCHAR Reserved2[5];
   1521     UCHAR AllocationLength[2];
   1522     UCHAR Control;
   1523   } READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
   1524   struct _REPORT_LUNS {
   1525     UCHAR OperationCode;
   1526     UCHAR Reserved1[5];
   1527     UCHAR AllocationLength[4];
   1528     UCHAR Reserved2[1];
   1529     UCHAR Control;
   1530   } REPORT_LUNS, *PREPORT_LUNS;
   1531   struct _PERSISTENT_RESERVE_IN {
   1532     UCHAR OperationCode;
   1533     UCHAR ServiceAction:5;
   1534     UCHAR Reserved1:3;
   1535     UCHAR Reserved2[5];
   1536     UCHAR AllocationLength[2];
   1537     UCHAR Control;
   1538   } PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
   1539   struct _PERSISTENT_RESERVE_OUT {
   1540     UCHAR OperationCode;
   1541     UCHAR ServiceAction:5;
   1542     UCHAR Reserved1:3;
   1543     UCHAR Type:4;
   1544     UCHAR Scope:4;
   1545     UCHAR Reserved2[4];
   1546     UCHAR ParameterListLength[2];
   1547     UCHAR Control;
   1548   } PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
   1549   struct _GET_CONFIGURATION {
   1550     UCHAR OperationCode;
   1551     UCHAR RequestType:1;
   1552     UCHAR Reserved1:7;
   1553     UCHAR StartingFeature[2];
   1554     UCHAR Reserved2[3];
   1555     UCHAR AllocationLength[2];
   1556     UCHAR Control;
   1557   } GET_CONFIGURATION, *PGET_CONFIGURATION;
   1558   struct _SET_CD_SPEED {
   1559     UCHAR OperationCode;
   1560     _ANONYMOUS_UNION union {
   1561       UCHAR Reserved1;
   1562       _ANONYMOUS_STRUCT struct {
   1563         UCHAR RotationControl:2;
   1564         UCHAR Reserved3:6;
   1565       } DUMMYSTRUCTNAME;
   1566     } DUMMYUNIONNAME;
   1567     UCHAR ReadSpeed[2];
   1568     UCHAR WriteSpeed[2];
   1569     UCHAR Reserved2[5];
   1570     UCHAR Control;
   1571   } SET_CD_SPEED, *PSET_CD_SPEED;
   1572   struct _READ12 {
   1573     UCHAR OperationCode;
   1574     UCHAR RelativeAddress:1;
   1575     UCHAR Reserved1:2;
   1576     UCHAR ForceUnitAccess:1;
   1577     UCHAR DisablePageOut:1;
   1578     UCHAR LogicalUnitNumber:3;
   1579     UCHAR LogicalBlock[4];
   1580     UCHAR TransferLength[4];
   1581     UCHAR Reserved2:7;
   1582     UCHAR Streaming:1;
   1583     UCHAR Control;
   1584   } READ12;
   1585   struct _WRITE12 {
   1586     UCHAR OperationCode;
   1587     UCHAR RelativeAddress:1;
   1588     UCHAR Reserved1:1;
   1589     UCHAR EBP:1;
   1590     UCHAR ForceUnitAccess:1;
   1591     UCHAR DisablePageOut:1;
   1592     UCHAR LogicalUnitNumber:3;
   1593     UCHAR LogicalBlock[4];
   1594     UCHAR TransferLength[4];
   1595     UCHAR Reserved2:7;
   1596     UCHAR Streaming:1;
   1597     UCHAR Control;
   1598   } WRITE12;
   1599   struct _READ16 {
   1600     UCHAR OperationCode;
   1601     UCHAR Reserved1:3;
   1602     UCHAR ForceUnitAccess:1;
   1603     UCHAR DisablePageOut:1;
   1604     UCHAR ReadProtect:3;
   1605     UCHAR LogicalBlock[8];
   1606     UCHAR TransferLength[4];
   1607     UCHAR Reserved2:7;
   1608     UCHAR Streaming:1;
   1609     UCHAR Control;
   1610   } READ16;
   1611   struct _WRITE16 {
   1612     UCHAR OperationCode;
   1613     UCHAR Reserved1:3;
   1614     UCHAR ForceUnitAccess:1;
   1615     UCHAR DisablePageOut:1;
   1616     UCHAR WriteProtect:3;
   1617     UCHAR LogicalBlock[8];
   1618     UCHAR TransferLength[4];
   1619     UCHAR Reserved2:7;
   1620     UCHAR Streaming:1;
   1621     UCHAR Control;
   1622   } WRITE16;
   1623   struct _VERIFY16 {
   1624     UCHAR OperationCode;
   1625     UCHAR Reserved1:1;
   1626     UCHAR ByteCheck:1;
   1627     UCHAR BlockVerify:1;
   1628     UCHAR Reserved2: 1;
   1629     UCHAR DisablePageOut:1;
   1630     UCHAR VerifyProtect:3;
   1631     UCHAR LogicalBlock[8];
   1632     UCHAR VerificationLength[4];
   1633     UCHAR Reserved3:7;
   1634     UCHAR Streaming:1;
   1635     UCHAR Control;
   1636   } VERIFY16;
   1637   struct _SYNCHRONIZE_CACHE16 {
   1638     UCHAR OperationCode;
   1639     UCHAR Reserved1:1;
   1640     UCHAR Immediate:1;
   1641     UCHAR Reserved2:6;
   1642     UCHAR LogicalBlock[8];
   1643     UCHAR BlockCount[4];
   1644     UCHAR Reserved3;
   1645     UCHAR Control;
   1646   } SYNCHRONIZE_CACHE16;
   1647   struct _READ_CAPACITY16 {
   1648     UCHAR OperationCode;
   1649     UCHAR ServiceAction:5;
   1650     UCHAR Reserved1:3;
   1651     UCHAR LogicalBlock[8];
   1652     UCHAR BlockCount[4];
   1653     UCHAR PMI:1;
   1654     UCHAR Reserved2:7;
   1655     UCHAR Control;
   1656   } READ_CAPACITY16;
   1657   ULONG AsUlong[4];
   1658   UCHAR AsByte[16];
   1659 } CDB, *PCDB;
   1660 
   1661 typedef struct _NOTIFICATION_EVENT_STATUS_HEADER {
   1662   UCHAR EventDataLength[2];
   1663   UCHAR NotificationClass:3;
   1664   UCHAR Reserved:4;
   1665   UCHAR NEA:1;
   1666   UCHAR SupportedEventClasses;
   1667   UCHAR ClassEventData[0];
   1668 } NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER;
   1669 
   1670 typedef struct _NOTIFICATION_OPERATIONAL_STATUS {
   1671   UCHAR OperationalEvent:4;
   1672   UCHAR Reserved1:4;
   1673   UCHAR OperationalStatus:4;
   1674   UCHAR Reserved2:3;
   1675   UCHAR PersistentPrevented:1;
   1676   UCHAR Operation[2];
   1677 } NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS;
   1678 
   1679 typedef struct _NOTIFICATION_POWER_STATUS {
   1680   UCHAR PowerEvent:4;
   1681   UCHAR Reserved:4;
   1682   UCHAR PowerStatus;
   1683   UCHAR Reserved2[2];
   1684 } NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS;
   1685 
   1686 typedef struct _NOTIFICATION_EXTERNAL_STATUS {
   1687   UCHAR ExternalEvent:4;
   1688   UCHAR Reserved1:4;
   1689   UCHAR ExternalStatus:4;
   1690   UCHAR Reserved2:3;
   1691   UCHAR PersistentPrevented:1;
   1692   UCHAR Request[2];
   1693 } NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS;
   1694 
   1695 typedef struct _NOTIFICATION_MEDIA_STATUS {
   1696   UCHAR MediaEvent:4;
   1697   UCHAR Reserved:4;
   1698   _ANONYMOUS_UNION union {
   1699     UCHAR PowerStatus;
   1700     UCHAR MediaStatus;
   1701     _ANONYMOUS_STRUCT struct {
   1702       UCHAR DoorTrayOpen:1;
   1703       UCHAR MediaPresent:1;
   1704       UCHAR ReservedX:6;
   1705     } DUMMYSTRUCTNAME;
   1706   } DUMMYUNIONNAME;
   1707   UCHAR StartSlot;
   1708   UCHAR EndSlot;
   1709 } NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS;
   1710 
   1711 typedef struct _NOTIFICATION_MULTI_HOST_STATUS {
   1712   UCHAR MultiHostEvent:4;
   1713   UCHAR Reserved1:4;
   1714   UCHAR MultiHostStatus:4;
   1715   UCHAR Reserved2:3;
   1716   UCHAR PersistentPrevented:1;
   1717   UCHAR Priority[2];
   1718 } NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS;
   1719 
   1720 typedef struct _NOTIFICATION_BUSY_STATUS {
   1721   UCHAR DeviceBusyEvent:4;
   1722   UCHAR Reserved:4;
   1723   UCHAR DeviceBusyStatus;
   1724   UCHAR Time[2];
   1725 } NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS;
   1726 
   1727 typedef struct _READ_DVD_STRUCTURES_HEADER {
   1728   UCHAR Length[2];
   1729   UCHAR Reserved[2];
   1730   UCHAR Data[0];
   1731 } READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER;
   1732 
   1733 typedef struct _CDVD_KEY_HEADER {
   1734   UCHAR DataLength[2];
   1735   UCHAR Reserved[2];
   1736   UCHAR Data[0];
   1737 } CDVD_KEY_HEADER, *PCDVD_KEY_HEADER;
   1738 
   1739 typedef struct _CDVD_REPORT_AGID_DATA {
   1740   UCHAR Reserved1[3];
   1741   UCHAR Reserved2:6;
   1742   UCHAR AGID:2;
   1743 } CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA;
   1744 
   1745 typedef struct _CDVD_CHALLENGE_KEY_DATA {
   1746   UCHAR ChallengeKeyValue[10];
   1747   UCHAR Reserved[2];
   1748 } CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA;
   1749 
   1750 typedef struct _CDVD_KEY_DATA {
   1751   UCHAR Key[5];
   1752   UCHAR Reserved[3];
   1753 } CDVD_KEY_DATA, *PCDVD_KEY_DATA;
   1754 
   1755 typedef struct _CDVD_REPORT_ASF_DATA {
   1756   UCHAR Reserved1[3];
   1757   UCHAR Success:1;
   1758   UCHAR Reserved2:7;
   1759 } CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA;
   1760 
   1761 typedef struct _CDVD_TITLE_KEY_HEADER {
   1762   UCHAR DataLength[2];
   1763   UCHAR Reserved1[1];
   1764   UCHAR Reserved2:3;
   1765   UCHAR CGMS:2;
   1766   UCHAR CP_SEC:1;
   1767   UCHAR CPM:1;
   1768   UCHAR Zero:1;
   1769   CDVD_KEY_DATA TitleKey;
   1770 } CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER;
   1771 
   1772 typedef struct _FORMAT_DESCRIPTOR {
   1773   UCHAR NumberOfBlocks[4];
   1774   UCHAR FormatSubType:2;
   1775   UCHAR FormatType:6;
   1776   UCHAR BlockLength[3];
   1777 } FORMAT_DESCRIPTOR, *PFORMAT_DESCRIPTOR;
   1778 
   1779 typedef struct _FORMAT_LIST_HEADER {
   1780   UCHAR Reserved;
   1781   UCHAR VendorSpecific:1;
   1782   UCHAR Immediate:1;
   1783   UCHAR TryOut:1;
   1784   UCHAR IP:1;
   1785   UCHAR STPF:1;
   1786   UCHAR DCRT:1;
   1787   UCHAR DPRY:1;
   1788   UCHAR FOV:1;
   1789   UCHAR FormatDescriptorLength[2];
   1790   FORMAT_DESCRIPTOR Descriptors[0];
   1791 } FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER;
   1792 
   1793 typedef struct _FORMATTED_CAPACITY_DESCRIPTOR {
   1794   UCHAR NumberOfBlocks[4];
   1795   UCHAR Maximum:1;
   1796   UCHAR Valid:1;
   1797   UCHAR FormatType:6;
   1798   UCHAR BlockLength[3];
   1799 } FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR;
   1800 
   1801 typedef struct _FORMATTED_CAPACITY_LIST {
   1802   UCHAR Reserved[3];
   1803   UCHAR CapacityListLength;
   1804   FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0];
   1805 } FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST;
   1806 
   1807 typedef struct _OPC_TABLE_ENTRY {
   1808   UCHAR Speed[2];
   1809   UCHAR OPCValue[6];
   1810 } OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY;
   1811 
   1812 typedef struct _DISC_INFORMATION {
   1813   UCHAR Length[2];
   1814   UCHAR DiscStatus:2;
   1815   UCHAR LastSessionStatus:2;
   1816   UCHAR Erasable:1;
   1817   UCHAR Reserved1:3;
   1818   UCHAR FirstTrackNumber;
   1819   UCHAR NumberOfSessionsLsb;
   1820   UCHAR LastSessionFirstTrackLsb;
   1821   UCHAR LastSessionLastTrackLsb;
   1822   UCHAR MrwStatus:2;
   1823   UCHAR MrwDirtyBit:1;
   1824   UCHAR Reserved2:2;
   1825   UCHAR URU:1;
   1826   UCHAR DBC_V:1;
   1827   UCHAR DID_V:1;
   1828   UCHAR DiscType;
   1829   UCHAR NumberOfSessionsMsb;
   1830   UCHAR LastSessionFirstTrackMsb;
   1831   UCHAR LastSessionLastTrackMsb;
   1832   UCHAR DiskIdentification[4];
   1833   UCHAR LastSessionLeadIn[4];
   1834   UCHAR LastPossibleLeadOutStartTime[4];
   1835   UCHAR DiskBarCode[8];
   1836   UCHAR Reserved4;
   1837   UCHAR NumberOPCEntries;
   1838   OPC_TABLE_ENTRY OPCTable[1];
   1839 } DISC_INFORMATION, *PDISC_INFORMATION;
   1840 
   1841 typedef struct _DISK_INFORMATION {
   1842   UCHAR Length[2];
   1843   UCHAR DiskStatus:2;
   1844   UCHAR LastSessionStatus:2;
   1845   UCHAR Erasable:1;
   1846   UCHAR Reserved1:3;
   1847   UCHAR FirstTrackNumber;
   1848   UCHAR NumberOfSessions;
   1849   UCHAR LastSessionFirstTrack;
   1850   UCHAR LastSessionLastTrack;
   1851   UCHAR Reserved2:5;
   1852   UCHAR GEN:1;
   1853   UCHAR DBC_V:1;
   1854   UCHAR DID_V:1;
   1855   UCHAR DiskType;
   1856   UCHAR Reserved3[3];
   1857   UCHAR DiskIdentification[4];
   1858   UCHAR LastSessionLeadIn[4];
   1859   UCHAR LastPossibleStartTime[4];
   1860   UCHAR DiskBarCode[8];
   1861   UCHAR Reserved4;
   1862   UCHAR NumberOPCEntries;
   1863   OPC_TABLE_ENTRY OPCTable[0];
   1864 } DISK_INFORMATION, *PDISK_INFORMATION;
   1865 
   1866 typedef struct _DATA_BLOCK_HEADER {
   1867   UCHAR DataMode;
   1868   UCHAR Reserved[4];
   1869   _ANONYMOUS_UNION union {
   1870     UCHAR LogicalBlockAddress[4];
   1871     struct {
   1872       UCHAR Reserved;
   1873       UCHAR M;
   1874       UCHAR S;
   1875       UCHAR F;
   1876     } MSF;
   1877   } DUMMYUNIONNAME;
   1878 } DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER;
   1879 
   1880 typedef struct _TRACK_INFORMATION {
   1881   UCHAR Length[2];
   1882   UCHAR TrackNumber;
   1883   UCHAR SessionNumber;
   1884   UCHAR Reserved1;
   1885   UCHAR TrackMode:4;
   1886   UCHAR Copy:1;
   1887   UCHAR Damage:1;
   1888   UCHAR Reserved2:2;
   1889   UCHAR DataMode:4;
   1890   UCHAR FP:1;
   1891   UCHAR Packet:1;
   1892   UCHAR Blank:1;
   1893   UCHAR RT:1;
   1894   UCHAR NWA_V:1;
   1895   UCHAR Reserved3:7;
   1896   UCHAR TrackStartAddress[4];
   1897   UCHAR NextWritableAddress[4];
   1898   UCHAR FreeBlocks[4];
   1899   UCHAR FixedPacketSize[4];
   1900 } TRACK_INFORMATION, *PTRACK_INFORMATION;
   1901 
   1902 typedef struct _TRACK_INFORMATION2 {
   1903   UCHAR Length[2];
   1904   UCHAR TrackNumberLsb;
   1905   UCHAR SessionNumberLsb;
   1906   UCHAR Reserved4;
   1907   UCHAR TrackMode:4;
   1908   UCHAR Copy:1;
   1909   UCHAR Damage:1;
   1910   UCHAR Reserved5:2;
   1911   UCHAR DataMode:4;
   1912   UCHAR FixedPacket:1;
   1913   UCHAR Packet:1;
   1914   UCHAR Blank:1;
   1915   UCHAR ReservedTrack:1;
   1916   UCHAR NWA_V:1;
   1917   UCHAR LRA_V:1;
   1918   UCHAR Reserved6:6;
   1919   UCHAR TrackStartAddress[4];
   1920   UCHAR NextWritableAddress[4];
   1921   UCHAR FreeBlocks[4];
   1922   UCHAR FixedPacketSize[4];
   1923   UCHAR TrackSize[4];
   1924   UCHAR LastRecordedAddress[4];
   1925   UCHAR TrackNumberMsb;
   1926   UCHAR SessionNumberMsb;
   1927   UCHAR Reserved7[2];
   1928 } TRACK_INFORMATION2, *PTRACK_INFORMATION2;
   1929 
   1930 typedef struct _TRACK_INFORMATION3 {
   1931   UCHAR Length[2];
   1932   UCHAR TrackNumberLsb;
   1933   UCHAR SessionNumberLsb;
   1934   UCHAR Reserved4;
   1935   UCHAR TrackMode:4;
   1936   UCHAR Copy:1;
   1937   UCHAR Damage:1;
   1938   UCHAR Reserved5:2;
   1939   UCHAR DataMode:4;
   1940   UCHAR FixedPacket:1;
   1941   UCHAR Packet:1;
   1942   UCHAR Blank:1;
   1943   UCHAR ReservedTrack:1;
   1944   UCHAR NWA_V:1;
   1945   UCHAR LRA_V:1;
   1946   UCHAR Reserved6:6;
   1947   UCHAR TrackStartAddress[4];
   1948   UCHAR NextWritableAddress[4];
   1949   UCHAR FreeBlocks[4];
   1950   UCHAR FixedPacketSize[4];
   1951   UCHAR TrackSize[4];
   1952   UCHAR LastRecordedAddress[4];
   1953   UCHAR TrackNumberMsb;
   1954   UCHAR SessionNumberMsb;
   1955   UCHAR Reserved7[2];
   1956   UCHAR ReadCompatibilityLba[4];
   1957 } TRACK_INFORMATION3, *PTRACK_INFORMATION3;
   1958 
   1959 typedef struct _PERFORMANCE_DESCRIPTOR {
   1960   UCHAR RandomAccess:1;
   1961   UCHAR Exact:1;
   1962   UCHAR RestoreDefaults:1;
   1963   UCHAR WriteRotationControl:2;
   1964   UCHAR Reserved1:3;
   1965   UCHAR Reserved[3];
   1966   UCHAR StartLba[4];
   1967   UCHAR EndLba[4];
   1968   UCHAR ReadSize[4];
   1969   UCHAR ReadTime[4];
   1970   UCHAR WriteSize[4];
   1971   UCHAR WriteTime[4];
   1972 } PERFORMANCE_DESCRIPTOR, *PPERFORMANCE_DESCRIPTOR;
   1973 
   1974 typedef struct _SCSI_EXTENDED_MESSAGE {
   1975   UCHAR InitialMessageCode;
   1976   UCHAR MessageLength;
   1977   UCHAR MessageType;
   1978   union _EXTENDED_ARGUMENTS {
   1979     struct {
   1980       UCHAR Modifier[4];
   1981     } Modify;
   1982     struct {
   1983       UCHAR TransferPeriod;
   1984       UCHAR ReqAckOffset;
   1985     } Synchronous;
   1986     struct{
   1987       UCHAR Width;
   1988     } Wide;
   1989   } ExtendedArguments;
   1990 }SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE;
   1991 
   1992 #ifndef _INQUIRYDATA_DEFINED /* also in minitape.h */
   1993 #define _INQUIRYDATA_DEFINED
   1994 
   1995 #define INQUIRYDATABUFFERSIZE 36
   1996 
   1997 #if (NTDDI_VERSION < NTDDI_WINXP)
   1998 typedef struct _INQUIRYDATA {
   1999   UCHAR DeviceType:5;
   2000   UCHAR DeviceTypeQualifier:3;
   2001   UCHAR DeviceTypeModifier:7;
   2002   UCHAR RemovableMedia:1;
   2003   UCHAR Versions;
   2004   UCHAR ResponseDataFormat:4;
   2005   UCHAR HiSupport:1;
   2006   UCHAR NormACA:1;
   2007   UCHAR ReservedBit:1;
   2008   UCHAR AERC:1;
   2009   UCHAR AdditionalLength;
   2010   UCHAR Reserved[2];
   2011   UCHAR SoftReset:1;
   2012   UCHAR CommandQueue:1;
   2013   UCHAR Reserved2:1;
   2014   UCHAR LinkedCommands:1;
   2015   UCHAR Synchronous:1;
   2016   UCHAR Wide16Bit:1;
   2017   UCHAR Wide32Bit:1;
   2018   UCHAR RelativeAddressing:1;
   2019   UCHAR VendorId[8];
   2020   UCHAR ProductId[16];
   2021   UCHAR ProductRevisionLevel[4];
   2022   UCHAR VendorSpecific[20];
   2023   UCHAR Reserved3[40];
   2024 } INQUIRYDATA, *PINQUIRYDATA;
   2025 #else
   2026 typedef struct _INQUIRYDATA {
   2027   UCHAR DeviceType:5;
   2028   UCHAR DeviceTypeQualifier:3;
   2029   UCHAR DeviceTypeModifier:7;
   2030   UCHAR RemovableMedia:1;
   2031   _ANONYMOUS_UNION union {
   2032     UCHAR Versions;
   2033     _ANONYMOUS_STRUCT struct {
   2034       UCHAR ANSIVersion:3;
   2035       UCHAR ECMAVersion:3;
   2036       UCHAR ISOVersion:2;
   2037     } DUMMYSTRUCTNAME;
   2038   } DUMMYUNIONNAME;
   2039   UCHAR ResponseDataFormat:4;
   2040   UCHAR HiSupport:1;
   2041   UCHAR NormACA:1;
   2042   UCHAR TerminateTask:1;
   2043   UCHAR AERC:1;
   2044   UCHAR AdditionalLength;
   2045   UCHAR Reserved;
   2046   UCHAR Addr16:1;
   2047   UCHAR Addr32:1;
   2048   UCHAR AckReqQ:1;
   2049   UCHAR MediumChanger:1;
   2050   UCHAR MultiPort:1;
   2051   UCHAR ReservedBit2:1;
   2052   UCHAR EnclosureServices:1;
   2053   UCHAR ReservedBit3:1;
   2054   UCHAR SoftReset:1;
   2055   UCHAR CommandQueue:1;
   2056   UCHAR TransferDisable:1;
   2057   UCHAR LinkedCommands:1;
   2058   UCHAR Synchronous:1;
   2059   UCHAR Wide16Bit:1;
   2060   UCHAR Wide32Bit:1;
   2061   UCHAR RelativeAddressing:1;
   2062   UCHAR VendorId[8];
   2063   UCHAR ProductId[16];
   2064   UCHAR ProductRevisionLevel[4];
   2065   UCHAR VendorSpecific[20];
   2066   UCHAR Reserved3[40];
   2067 } INQUIRYDATA, *PINQUIRYDATA;
   2068 #endif /* (NTDDI_VERSION < NTDDI_WINXP) */
   2069 
   2070 #endif /* _INQUIRYDATA_DEFINED */
   2071 
   2072 typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE {
   2073   UCHAR DeviceType:5;
   2074   UCHAR DeviceTypeQualifier:3;
   2075   UCHAR PageCode;
   2076   UCHAR Reserved;
   2077   UCHAR PageLength;
   2078   UCHAR SerialNumber[0];
   2079 } VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE;
   2080 
   2081 typedef struct _VPD_SERIAL_NUMBER_PAGE {
   2082   UCHAR DeviceType:5;
   2083   UCHAR DeviceTypeQualifier:3;
   2084   UCHAR PageCode;
   2085   UCHAR Reserved;
   2086   UCHAR PageLength;
   2087   UCHAR SerialNumber[0];
   2088 } VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE;
   2089 
   2090 typedef enum _VPD_CODE_SET {
   2091   VpdCodeSetReserved = 0,
   2092   VpdCodeSetBinary = 1,
   2093   VpdCodeSetAscii = 2,
   2094   VpdCodeSetUTF8 = 3
   2095 } VPD_CODE_SET, *PVPD_CODE_SET;
   2096 
   2097 typedef enum _VPD_ASSOCIATION {
   2098   VpdAssocDevice = 0,
   2099   VpdAssocPort = 1,
   2100   VpdAssocTarget = 2,
   2101   VpdAssocReserved1 = 3,
   2102   VpdAssocReserved2 = 4
   2103 } VPD_ASSOCIATION, *PVPD_ASSOCIATION;
   2104 
   2105 typedef enum _VPD_IDENTIFIER_TYPE {
   2106   VpdIdentifierTypeVendorSpecific = 0,
   2107   VpdIdentifierTypeVendorId = 1,
   2108   VpdIdentifierTypeEUI64 = 2,
   2109   VpdIdentifierTypeFCPHName = 3,
   2110   VpdIdentifierTypePortRelative = 4,
   2111   VpdIdentifierTypeTargetPortGroup = 5,
   2112   VpdIdentifierTypeLogicalUnitGroup = 6,
   2113   VpdIdentifierTypeMD5LogicalUnitId = 7,
   2114   VpdIdentifierTypeSCSINameString = 8
   2115 } VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE;
   2116 
   2117 typedef struct _VPD_IDENTIFICATION_DESCRIPTOR {
   2118   UCHAR CodeSet:4;
   2119   UCHAR Reserved:4;
   2120   UCHAR IdentifierType:4;
   2121   UCHAR Association:2;
   2122   UCHAR Reserved2:2;
   2123   UCHAR Reserved3;
   2124   UCHAR IdentifierLength;
   2125   UCHAR Identifier[0];
   2126 } VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR;
   2127 
   2128 typedef struct _VPD_IDENTIFICATION_PAGE {
   2129   UCHAR DeviceType:5;
   2130   UCHAR DeviceTypeQualifier:3;
   2131   UCHAR PageCode;
   2132   UCHAR Reserved;
   2133   UCHAR PageLength;
   2134   UCHAR Descriptors[0];
   2135 } VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE;
   2136 
   2137 typedef struct _VPD_SUPPORTED_PAGES_PAGE {
   2138   UCHAR DeviceType:5;
   2139   UCHAR DeviceTypeQualifier:3;
   2140   UCHAR PageCode;
   2141   UCHAR Reserved;
   2142   UCHAR PageLength;
   2143   UCHAR SupportedPageList[0];
   2144 } VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE;
   2145 
   2146 typedef struct _PRI_REGISTRATION_LIST {
   2147   UCHAR Generation[4];
   2148   UCHAR AdditionalLength[4];
   2149   UCHAR ReservationKeyList[0][8];
   2150 } PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST;
   2151 
   2152 typedef struct _PRI_RESERVATION_DESCRIPTOR {
   2153   UCHAR ReservationKey[8];
   2154   UCHAR ScopeSpecificAddress[4];
   2155   UCHAR Reserved;
   2156   UCHAR Type:4;
   2157   UCHAR Scope:4;
   2158   UCHAR Obsolete[2];
   2159 } PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR;
   2160 
   2161 typedef struct _PRI_RESERVATION_LIST {
   2162   UCHAR Generation[4];
   2163   UCHAR AdditionalLength[4];
   2164   PRI_RESERVATION_DESCRIPTOR Reservations[0];
   2165 } PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST;
   2166 
   2167 typedef struct _PRO_PARAMETER_LIST {
   2168   UCHAR ReservationKey[8];
   2169   UCHAR ServiceActionReservationKey[8];
   2170   UCHAR ScopeSpecificAddress[4];
   2171   UCHAR ActivatePersistThroughPowerLoss:1;
   2172   UCHAR Reserved1:7;
   2173   UCHAR Reserved2;
   2174   UCHAR Obsolete[2];
   2175 } PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST;
   2176 
   2177 typedef struct _SENSE_DATA {
   2178   UCHAR ErrorCode:7;
   2179   UCHAR Valid:1;
   2180   UCHAR SegmentNumber;
   2181   UCHAR SenseKey:4;
   2182   UCHAR Reserved:1;
   2183   UCHAR IncorrectLength:1;
   2184   UCHAR EndOfMedia:1;
   2185   UCHAR FileMark:1;
   2186   UCHAR Information[4];
   2187   UCHAR AdditionalSenseLength;
   2188   UCHAR CommandSpecificInformation[4];
   2189   UCHAR AdditionalSenseCode;
   2190   UCHAR AdditionalSenseCodeQualifier;
   2191   UCHAR FieldReplaceableUnitCode;
   2192   UCHAR SenseKeySpecific[3];
   2193 } SENSE_DATA, *PSENSE_DATA;
   2194 
   2195 /* Read Capacity Data. Returned in Big Endian format */
   2196 typedef struct _READ_CAPACITY_DATA {
   2197   ULONG LogicalBlockAddress;
   2198   ULONG BytesPerBlock;
   2199 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
   2200 
   2201 typedef struct _READ_CAPACITY_DATA_EX {
   2202   LARGE_INTEGER LogicalBlockAddress;
   2203   ULONG BytesPerBlock;
   2204 } READ_CAPACITY_DATA_EX, *PREAD_CAPACITY_DATA_EX;
   2205 
   2206 /* Read Block Limits Data. Returned in Big Endian format */
   2207 typedef struct _READ_BLOCK_LIMITS {
   2208   UCHAR Reserved;
   2209   UCHAR BlockMaximumSize[3];
   2210   UCHAR BlockMinimumSize[2];
   2211 } READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA;
   2212 
   2213 typedef struct _READ_BUFFER_CAPACITY_DATA {
   2214   UCHAR DataLength[2];
   2215   UCHAR Reserved1;
   2216   UCHAR BlockDataReturned:1;
   2217   UCHAR Reserved4:7;
   2218   UCHAR TotalBufferSize[4];
   2219   UCHAR AvailableBufferSize[4];
   2220 } READ_BUFFER_CAPACITY_DATA, *PREAD_BUFFER_CAPACITY_DATA;
   2221 
   2222 typedef struct _MODE_PARAMETER_HEADER {
   2223   UCHAR ModeDataLength;
   2224   UCHAR MediumType;
   2225   UCHAR DeviceSpecificParameter;
   2226   UCHAR BlockDescriptorLength;
   2227 } MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
   2228 
   2229 typedef struct _MODE_PARAMETER_HEADER10 {
   2230   UCHAR ModeDataLength[2];
   2231   UCHAR MediumType;
   2232   UCHAR DeviceSpecificParameter;
   2233   UCHAR Reserved[2];
   2234   UCHAR BlockDescriptorLength[2];
   2235 } MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
   2236 
   2237 typedef struct _MODE_PARAMETER_BLOCK {
   2238   UCHAR DensityCode;
   2239   UCHAR NumberOfBlocks[3];
   2240   UCHAR Reserved;
   2241   UCHAR BlockLength[3];
   2242 } MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
   2243 
   2244 typedef struct _MODE_DISCONNECT_PAGE {
   2245   UCHAR PageCode:6;
   2246   UCHAR Reserved:1;
   2247   UCHAR PageSavable:1;
   2248   UCHAR PageLength;
   2249   UCHAR BufferFullRatio;
   2250   UCHAR BufferEmptyRatio;
   2251   UCHAR BusInactivityLimit[2];
   2252   UCHAR BusDisconnectTime[2];
   2253   UCHAR BusConnectTime[2];
   2254   UCHAR MaximumBurstSize[2];
   2255   UCHAR DataTransferDisconnect:2;
   2256   UCHAR Reserved2[3];
   2257 } MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
   2258 
   2259 typedef struct _MODE_CACHING_PAGE {
   2260   UCHAR PageCode:6;
   2261   UCHAR Reserved:1;
   2262   UCHAR PageSavable:1;
   2263   UCHAR PageLength;
   2264   UCHAR ReadDisableCache:1;
   2265   UCHAR MultiplicationFactor:1;
   2266   UCHAR WriteCacheEnable:1;
   2267   UCHAR Reserved2:5;
   2268   UCHAR WriteRetensionPriority:4;
   2269   UCHAR ReadRetensionPriority:4;
   2270   UCHAR DisablePrefetchTransfer[2];
   2271   UCHAR MinimumPrefetch[2];
   2272   UCHAR MaximumPrefetch[2];
   2273   UCHAR MaximumPrefetchCeiling[2];
   2274 } MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
   2275 
   2276 typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE2 {
   2277   UCHAR PageCode:6;
   2278   UCHAR Reserved:1;
   2279   UCHAR PageSavable:1;
   2280   UCHAR PageLength;
   2281   UCHAR WriteType:4;
   2282   UCHAR TestWrite:1;
   2283   UCHAR LinkSizeValid:1;
   2284   UCHAR BufferUnderrunFreeEnabled:1;
   2285   UCHAR Reserved2:1;
   2286   UCHAR TrackMode:4;
   2287   UCHAR Copy:1;
   2288   UCHAR FixedPacket:1;
   2289   UCHAR MultiSession:2;
   2290   UCHAR DataBlockType:4;
   2291   UCHAR Reserved3:4;
   2292   UCHAR LinkSize;
   2293   UCHAR Reserved4;
   2294   UCHAR HostApplicationCode:6;
   2295   UCHAR Reserved5:2;
   2296   UCHAR SessionFormat;
   2297   UCHAR Reserved6;
   2298   UCHAR PacketSize[4];
   2299   UCHAR AudioPauseLength[2];
   2300   UCHAR MediaCatalogNumber[16];
   2301   UCHAR ISRC[16];
   2302   UCHAR SubHeaderData[4];
   2303 } MODE_CDROM_WRITE_PARAMETERS_PAGE2, *PMODE_CDROM_WRITE_PARAMETERS_PAGE2;
   2304 
   2305 typedef struct _MODE_MRW_PAGE {
   2306   UCHAR PageCode:6;
   2307   UCHAR Reserved:1;
   2308   UCHAR PageSavable:1;
   2309   UCHAR PageLength;
   2310   UCHAR Reserved1;
   2311   UCHAR LbaSpace:1;
   2312   UCHAR Reserved2:7;
   2313   UCHAR Reserved3[4];
   2314 } MODE_MRW_PAGE, *PMODE_MRW_PAGE;
   2315 
   2316 typedef struct _MODE_FLEXIBLE_DISK_PAGE {
   2317   UCHAR PageCode:6;
   2318   UCHAR Reserved:1;
   2319   UCHAR PageSavable:1;
   2320   UCHAR PageLength;
   2321   UCHAR TransferRate[2];
   2322   UCHAR NumberOfHeads;
   2323   UCHAR SectorsPerTrack;
   2324   UCHAR BytesPerSector[2];
   2325   UCHAR NumberOfCylinders[2];
   2326   UCHAR StartWritePrecom[2];
   2327   UCHAR StartReducedCurrent[2];
   2328   UCHAR StepRate[2];
   2329   UCHAR StepPluseWidth;
   2330   UCHAR HeadSettleDelay[2];
   2331   UCHAR MotorOnDelay;
   2332   UCHAR MotorOffDelay;
   2333   UCHAR Reserved2:5;
   2334   UCHAR MotorOnAsserted:1;
   2335   UCHAR StartSectorNumber:1;
   2336   UCHAR TrueReadySignal:1;
   2337   UCHAR StepPlusePerCyclynder:4;
   2338   UCHAR Reserved3:4;
   2339   UCHAR WriteCompenstation;
   2340   UCHAR HeadLoadDelay;
   2341   UCHAR HeadUnloadDelay;
   2342   UCHAR Pin2Usage:4;
   2343   UCHAR Pin34Usage:4;
   2344   UCHAR Pin1Usage:4;
   2345   UCHAR Pin4Usage:4;
   2346   UCHAR MediumRotationRate[2];
   2347   UCHAR Reserved4[2];
   2348 } MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
   2349 
   2350 typedef struct _MODE_FORMAT_PAGE {
   2351   UCHAR PageCode:6;
   2352   UCHAR Reserved:1;
   2353   UCHAR PageSavable:1;
   2354   UCHAR PageLength;
   2355   UCHAR TracksPerZone[2];
   2356   UCHAR AlternateSectorsPerZone[2];
   2357   UCHAR AlternateTracksPerZone[2];
   2358   UCHAR AlternateTracksPerLogicalUnit[2];
   2359   UCHAR SectorsPerTrack[2];
   2360   UCHAR BytesPerPhysicalSector[2];
   2361   UCHAR Interleave[2];
   2362   UCHAR TrackSkewFactor[2];
   2363   UCHAR CylinderSkewFactor[2];
   2364   UCHAR Reserved2:4;
   2365   UCHAR SurfaceFirst:1;
   2366   UCHAR RemovableMedia:1;
   2367   UCHAR HardSectorFormating:1;
   2368   UCHAR SoftSectorFormating:1;
   2369   UCHAR Reserved3[3];
   2370 } MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
   2371 
   2372 typedef struct _MODE_RIGID_GEOMETRY_PAGE {
   2373   UCHAR PageCode:6;
   2374   UCHAR Reserved:1;
   2375   UCHAR PageSavable:1;
   2376   UCHAR PageLength;
   2377   UCHAR NumberOfCylinders[3];
   2378   UCHAR NumberOfHeads;
   2379   UCHAR StartWritePrecom[3];
   2380   UCHAR StartReducedCurrent[3];
   2381   UCHAR DriveStepRate[2];
   2382   UCHAR LandZoneCyclinder[3];
   2383   UCHAR RotationalPositionLock:2;
   2384   UCHAR Reserved2:6;
   2385   UCHAR RotationOffset;
   2386   UCHAR Reserved3;
   2387   UCHAR RoataionRate[2];
   2388   UCHAR Reserved4[2];
   2389 } MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
   2390 
   2391 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
   2392   UCHAR PageCode:6;
   2393   UCHAR Reserved1:1;
   2394   UCHAR PSBit:1;
   2395   UCHAR PageLength;
   2396   UCHAR DCRBit:1;
   2397   UCHAR DTEBit:1;
   2398   UCHAR PERBit:1;
   2399   UCHAR EERBit:1;
   2400   UCHAR RCBit:1;
   2401   UCHAR TBBit:1;
   2402   UCHAR ARRE:1;
   2403   UCHAR AWRE:1;
   2404   UCHAR ReadRetryCount;
   2405   UCHAR Reserved4[4];
   2406   UCHAR WriteRetryCount;
   2407   UCHAR Reserved5[3];
   2408 } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
   2409 
   2410 typedef struct _MODE_READ_RECOVERY_PAGE {
   2411   UCHAR PageCode:6;
   2412   UCHAR Reserved1:1;
   2413   UCHAR PSBit:1;
   2414   UCHAR PageLength;
   2415   UCHAR DCRBit:1;
   2416   UCHAR DTEBit:1;
   2417   UCHAR PERBit:1;
   2418   UCHAR Reserved2:1;
   2419   UCHAR RCBit:1;
   2420   UCHAR TBBit:1;
   2421   UCHAR Reserved3:2;
   2422   UCHAR ReadRetryCount;
   2423   UCHAR Reserved4[4];
   2424 } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
   2425 
   2426 typedef struct _MODE_INFO_EXCEPTIONS {
   2427   UCHAR PageCode:6;
   2428   UCHAR Reserved1:1;
   2429   UCHAR PSBit:1;
   2430   UCHAR PageLength;
   2431   _ANONYMOUS_UNION union {
   2432     UCHAR Flags;
   2433     _ANONYMOUS_STRUCT struct {
   2434       UCHAR LogErr:1;
   2435       UCHAR Reserved2:1;
   2436       UCHAR Test:1;
   2437       UCHAR Dexcpt:1;
   2438       UCHAR Reserved3:3;
   2439       UCHAR Perf:1;
   2440     } DUMMYSTRUCTNAME;
   2441   } DUMMYUNIONNAME;
   2442   UCHAR ReportMethod:4;
   2443   UCHAR Reserved4:4;
   2444   UCHAR IntervalTimer[4];
   2445   UCHAR ReportCount[4];
   2446 } MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS;
   2447 
   2448 typedef struct _POWER_CONDITION_PAGE {
   2449   UCHAR PageCode:6;
   2450   UCHAR Reserved:1;
   2451   UCHAR PSBit:1;
   2452   UCHAR PageLength;
   2453   UCHAR Reserved2;
   2454   UCHAR Standby:1;
   2455   UCHAR Idle:1;
   2456   UCHAR Reserved3:6;
   2457   UCHAR IdleTimer[4];
   2458   UCHAR StandbyTimer[4];
   2459 } POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE;
   2460 
   2461 typedef struct _CDDA_OUTPUT_PORT {
   2462   UCHAR ChannelSelection:4;
   2463   UCHAR Reserved:4;
   2464   UCHAR Volume;
   2465 } CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT;
   2466 
   2467 typedef struct _CDAUDIO_CONTROL_PAGE {
   2468   UCHAR PageCode:6;
   2469   UCHAR Reserved:1;
   2470   UCHAR PSBit:1;
   2471   UCHAR PageLength;
   2472   UCHAR Reserved2:1;
   2473   UCHAR StopOnTrackCrossing:1;
   2474   UCHAR Immediate:1;
   2475   UCHAR Reserved3:5;
   2476   UCHAR Reserved4[3];
   2477   UCHAR Obsolete[2];
   2478   CDDA_OUTPUT_PORT CDDAOutputPorts[4];
   2479 } CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE;
   2480 
   2481 typedef struct _CDVD_FEATURE_SET_PAGE {
   2482   UCHAR PageCode:6;
   2483   UCHAR Reserved:1;
   2484   UCHAR PSBit:1;
   2485   UCHAR PageLength;
   2486   UCHAR CDAudio[2];
   2487   UCHAR EmbeddedChanger[2];
   2488   UCHAR PacketSMART[2];
   2489   UCHAR PersistantPrevent[2];
   2490   UCHAR EventStatusNotification[2];
   2491   UCHAR DigitalOutput[2];
   2492   UCHAR CDSequentialRecordable[2];
   2493   UCHAR DVDSequentialRecordable[2];
   2494   UCHAR RandomRecordable[2];
   2495   UCHAR KeyExchange[2];
   2496   UCHAR Reserved2[2];
   2497 } CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE;
   2498 
   2499 typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE {
   2500   UCHAR PageCode:6;
   2501   UCHAR Reserved:1;
   2502   UCHAR PSBit:1;
   2503   UCHAR PageLength;
   2504   UCHAR Reserved2[2];
   2505   UCHAR SWPP:1;
   2506   UCHAR DISP:1;
   2507   UCHAR Reserved3:6;
   2508   UCHAR Reserved4;
   2509   UCHAR GroupOneMinimumTimeout[2];
   2510   UCHAR GroupTwoMinimumTimeout[2];
   2511 } CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE;
   2512 
   2513 typedef struct _CDVD_CAPABILITIES_PAGE {
   2514   UCHAR PageCode:6;
   2515   UCHAR Reserved:1;
   2516   UCHAR PSBit:1;
   2517   UCHAR PageLength;
   2518   UCHAR CDRRead:1;
   2519   UCHAR CDERead:1;
   2520   UCHAR Method2:1;
   2521   UCHAR DVDROMRead:1;
   2522   UCHAR DVDRRead:1;
   2523   UCHAR DVDRAMRead:1;
   2524   UCHAR Reserved2:2;
   2525   UCHAR CDRWrite:1;
   2526   UCHAR CDEWrite:1;
   2527   UCHAR TestWrite:1;
   2528   UCHAR Reserved3:1;
   2529   UCHAR DVDRWrite:1;
   2530   UCHAR DVDRAMWrite:1;
   2531   UCHAR Reserved4:2;
   2532   UCHAR AudioPlay:1;
   2533   UCHAR Composite:1;
   2534   UCHAR DigitalPortOne:1;
   2535   UCHAR DigitalPortTwo:1;
   2536   UCHAR Mode2Form1:1;
   2537   UCHAR Mode2Form2:1;
   2538   UCHAR MultiSession:1;
   2539   UCHAR BufferUnderrunFree:1;
   2540   UCHAR CDDA:1;
   2541   UCHAR CDDAAccurate:1;
   2542   UCHAR RWSupported:1;
   2543   UCHAR RWDeinterleaved:1;
   2544   UCHAR C2Pointers:1;
   2545   UCHAR ISRC:1;
   2546   UCHAR UPC:1;
   2547   UCHAR ReadBarCodeCapable:1;
   2548   UCHAR Lock:1;
   2549   UCHAR LockState:1;
   2550   UCHAR PreventJumper:1;
   2551   UCHAR Eject:1;
   2552   UCHAR Reserved6:1;
   2553   UCHAR LoadingMechanismType:3;
   2554   UCHAR SeparateVolume:1;
   2555   UCHAR SeperateChannelMute:1;
   2556   UCHAR SupportsDiskPresent:1;
   2557   UCHAR SWSlotSelection:1;
   2558   UCHAR SideChangeCapable:1;
   2559   UCHAR RWInLeadInReadable:1;
   2560   UCHAR Reserved7:2;
   2561   _ANONYMOUS_UNION union {
   2562     UCHAR ReadSpeedMaximum[2];
   2563     UCHAR ObsoleteReserved[2];
   2564   } DUMMYUNIONNAME;
   2565   UCHAR NumberVolumeLevels[2];
   2566   UCHAR BufferSize[2];
   2567   _ANONYMOUS_UNION union {
   2568     UCHAR ReadSpeedCurrent[2];
   2569     UCHAR ObsoleteReserved2[2];
   2570   } DUMMYUNIONNAME2;
   2571   UCHAR ObsoleteReserved3;
   2572   UCHAR Reserved8:1;
   2573   UCHAR BCK:1;
   2574   UCHAR RCK:1;
   2575   UCHAR LSBF:1;
   2576   UCHAR Length:2;
   2577   UCHAR Reserved9:2;
   2578   _ANONYMOUS_UNION union {
   2579     UCHAR WriteSpeedMaximum[2];
   2580     UCHAR ObsoleteReserved4[2];
   2581   } DUMMYUNIONNAME3;
   2582   _ANONYMOUS_UNION union {
   2583     UCHAR WriteSpeedCurrent[2];
   2584     UCHAR ObsoleteReserved11[2];
   2585   } DUMMYUNIONNAME4;
   2586   _ANONYMOUS_UNION union {
   2587     UCHAR CopyManagementRevision[2];
   2588     UCHAR Reserved10[2];
   2589   } DUMMYUNIONNAME5;
   2590 } CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE;
   2591 
   2592 typedef struct _LUN_LIST {
   2593   UCHAR LunListLength[4];
   2594   UCHAR Reserved[4];
   2595   UCHAR Lun[0][8];
   2596 } LUN_LIST, *PLUN_LIST;
   2597 
   2598 typedef struct _MODE_PARM_READ_WRITE {
   2599   MODE_PARAMETER_HEADER ParameterListHeader;
   2600   MODE_PARAMETER_BLOCK ParameterListBlock;
   2601 } MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA;
   2602 
   2603 typedef struct _PORT_OUTPUT {
   2604   UCHAR ChannelSelection;
   2605   UCHAR Volume;
   2606 } PORT_OUTPUT, *PPORT_OUTPUT;
   2607 
   2608 typedef struct _AUDIO_OUTPUT {
   2609   UCHAR CodePage;
   2610   UCHAR ParameterLength;
   2611   UCHAR Immediate;
   2612   UCHAR Reserved[2];
   2613   UCHAR LbaFormat;
   2614   UCHAR LogicalBlocksPerSecond[2];
   2615   PORT_OUTPUT PortOutput[4];
   2616 } AUDIO_OUTPUT, *PAUDIO_OUTPUT;
   2617 
   2618 /* Atapi 2.5 changers */
   2619 typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER {
   2620   UCHAR CurrentSlot:5;
   2621   UCHAR ChangerState:2;
   2622   UCHAR Fault:1;
   2623   UCHAR Reserved:5;
   2624   UCHAR MechanismState:3;
   2625   UCHAR CurrentLogicalBlockAddress[3];
   2626   UCHAR NumberAvailableSlots;
   2627   UCHAR SlotTableLength[2];
   2628 } MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER;
   2629 
   2630 typedef struct _SLOT_TABLE_INFORMATION {
   2631   UCHAR DiscChanged:1;
   2632   UCHAR Reserved:6;
   2633   UCHAR DiscPresent:1;
   2634   UCHAR Reserved2[3];
   2635 } SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION;
   2636 
   2637 typedef struct _MECHANICAL_STATUS {
   2638   MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader;
   2639   SLOT_TABLE_INFORMATION SlotTableInfo[1];
   2640 } MECHANICAL_STATUS, *PMECHANICAL_STATUS;
   2641 
   2642 /* Tape definitions */
   2643 typedef struct _TAPE_POSITION_DATA {
   2644   UCHAR Reserved1:2;
   2645   UCHAR BlockPositionUnsupported:1;
   2646   UCHAR Reserved2:3;
   2647   UCHAR EndOfPartition:1;
   2648   UCHAR BeginningOfPartition:1;
   2649   UCHAR PartitionNumber;
   2650   USHORT Reserved3;
   2651   UCHAR FirstBlock[4];
   2652   UCHAR LastBlock[4];
   2653   UCHAR Reserved4;
   2654   UCHAR NumberOfBlocks[3];
   2655   UCHAR NumberOfBytes[4];
   2656 } TAPE_POSITION_DATA, *PTAPE_POSITION_DATA;
   2657 
   2658 /* This structure is used to convert little endian ULONGs
   2659    to SCSI CDB big endians values. */
   2660 typedef union _EIGHT_BYTE {
   2661   _ANONYMOUS_STRUCT struct {
   2662     UCHAR Byte0;
   2663     UCHAR Byte1;
   2664     UCHAR Byte2;
   2665     UCHAR Byte3;
   2666     UCHAR Byte4;
   2667     UCHAR Byte5;
   2668     UCHAR Byte6;
   2669     UCHAR Byte7;
   2670   } DUMMYSTRUCTNAME;
   2671   ULONGLONG AsULongLong;
   2672 } EIGHT_BYTE, *PEIGHT_BYTE;
   2673 
   2674 typedef union _FOUR_BYTE {
   2675   _ANONYMOUS_STRUCT struct {
   2676     UCHAR Byte0;
   2677     UCHAR Byte1;
   2678     UCHAR Byte2;
   2679     UCHAR Byte3;
   2680   } DUMMYSTRUCTNAME;
   2681   ULONG AsULong;
   2682 } FOUR_BYTE, *PFOUR_BYTE;
   2683 
   2684 typedef union _TWO_BYTE {
   2685   _ANONYMOUS_STRUCT struct {
   2686     UCHAR Byte0;
   2687     UCHAR Byte1;
   2688   } DUMMYSTRUCTNAME;
   2689   USHORT AsUShort;
   2690 } TWO_BYTE, *PTWO_BYTE;
   2691 
   2692 /* Byte reversing macro for converting between
   2693    big- and little-endian formats */
   2694 #define REVERSE_BYTES_QUAD(Destination, Source) { \
   2695   PEIGHT_BYTE _val1 = (PEIGHT_BYTE)(Destination); \
   2696   PEIGHT_BYTE _val2 = (PEIGHT_BYTE)(Source); \
   2697   _val1->Byte7 = _val2->Byte0; \
   2698   _val1->Byte6 = _val2->Byte1; \
   2699   _val1->Byte5 = _val2->Byte2; \
   2700   _val1->Byte4 = _val2->Byte3; \
   2701   _val1->Byte3 = _val2->Byte4; \
   2702   _val1->Byte2 = _val2->Byte5; \
   2703   _val1->Byte1 = _val2->Byte6; \
   2704   _val1->Byte0 = _val2->Byte7; \
   2705 }
   2706 
   2707 #define REVERSE_BYTES(Destination, Source) { \
   2708   PFOUR_BYTE _val1 = (PFOUR_BYTE)(Destination); \
   2709   PFOUR_BYTE _val2 = (PFOUR_BYTE)(Source); \
   2710   _val1->Byte3 = _val2->Byte0; \
   2711   _val1->Byte2 = _val2->Byte1; \
   2712   _val1->Byte1 = _val2->Byte2; \
   2713   _val1->Byte0 = _val2->Byte3; \
   2714 }
   2715 
   2716 #define REVERSE_BYTES_SHORT(Destination, Source) { \
   2717   PTWO_BYTE _val1 = (PTWO_BYTE)(Destination); \
   2718   PTWO_BYTE _val2 = (PTWO_BYTE)(Source); \
   2719   _val1->Byte1 = _val2->Byte0; \
   2720   _val1->Byte0 = _val2->Byte1; \
   2721 }
   2722 
   2723 #define REVERSE_SHORT(Short) { \
   2724   UCHAR _val; \
   2725   PTWO_BYTE _val2 = (PTWO_BYTE)(Short); \
   2726   _val = _val2->Byte0; \
   2727   _val2->Byte0 = _val2->Byte1; \
   2728   _val2->Byte1 = _val; \
   2729 }
   2730 
   2731 #define REVERSE_LONG(Long) { \
   2732   UCHAR _val; \
   2733   PFOUR_BYTE _val2 = (PFOUR_BYTE)(Long); \
   2734   _val = _val2->Byte3; \
   2735   _val2->Byte3 = _val2->Byte0; \
   2736   _val2->Byte0 = _val; \
   2737   _val = _val2->Byte2; \
   2738   _val2->Byte2 = _val2->Byte1; \
   2739   _val2->Byte1 = _val; \
   2740 }
   2741 
   2742 #define WHICH_BIT(Data, Bit) { \
   2743   UCHAR _val; \
   2744   for (_val = 0; _val < 32; _val++) { \
   2745     if (((Data) >> _val) == 1) { \
   2746       break; \
   2747     } \
   2748   } \
   2749   ASSERT(_val != 32); \
   2750   (Bit) = _val; \
   2751 }
   2752 
   2753 /* FIXME : This structure doesn't exist in the official header */
   2754 typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE {
   2755   UCHAR PageLength;
   2756   UCHAR WriteType:4;
   2757   UCHAR TestWrite:1;
   2758   UCHAR LinkSizeValid:1;
   2759   UCHAR BufferUnderrunFreeEnabled:1;
   2760   UCHAR Reserved2:1;
   2761   UCHAR TrackMode:4;
   2762   UCHAR Copy:1;
   2763   UCHAR FixedPacket:1;
   2764   UCHAR MultiSession:2;
   2765   UCHAR DataBlockType:4;
   2766   UCHAR Reserved3:4;
   2767   UCHAR LinkSize;
   2768   UCHAR Reserved4;
   2769   UCHAR HostApplicationCode:6;
   2770   UCHAR Reserved5:2;
   2771   UCHAR SessionFormat;
   2772   UCHAR Reserved6;
   2773   UCHAR PacketSize[4];
   2774   UCHAR AudioPauseLength[2];
   2775   UCHAR Reserved7:7;
   2776   UCHAR MediaCatalogNumberValid:1;
   2777   UCHAR MediaCatalogNumber[13];
   2778   UCHAR MediaCatalogNumberZero;
   2779   UCHAR MediaCatalogNumberAFrame;
   2780   UCHAR Reserved8:7;
   2781   UCHAR ISRCValid:1;
   2782   UCHAR ISRCCountry[2];
   2783   UCHAR ISRCOwner[3];
   2784   UCHAR ISRCRecordingYear[2];
   2785   UCHAR ISRCSerialNumber[5];
   2786   UCHAR ISRCZero;
   2787   UCHAR ISRCAFrame;
   2788   UCHAR ISRCReserved;
   2789   UCHAR SubHeaderData[4];
   2790 } MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
   2791 
   2792 #ifdef __cplusplus
   2793 }
   2794 #endif
   2795 
   2796 #endif /* _NTSCSI_ */
   2797