Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2924 lines
82 KiB

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