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.

4266 lines
110 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. storport.h
  5. Abstract:
  6. These are the structures and defines that are included by STORPORT miniport
  7. drivers.
  8. Authors:
  9. Revision History:
  10. --*/
  11. #ifdef _NTSCSI_
  12. #error "STORPORT.H must be included instead of SCSI.H"
  13. #endif
  14. #ifdef _NTSRB_
  15. #error "STORPORT.H must be included instead of SRB.H"
  16. #endif
  17. #ifndef _NTSTORPORT_
  18. #define _NTSTORPORT_
  19. #if _MSC_VER >= 1200
  20. #pragma warning(push)
  21. #endif
  22. #pragma warning(disable:4200) // array[0] is not a warning for this file
  23. //
  24. // For backwards compatability, use SCSIPORT definitions.
  25. //
  26. #define STOR_USE_SCSI_ALIASES (1)
  27. #if DBG
  28. #define DebugPrint(x) StorPortDebugPrint x
  29. #else
  30. #define DebugPrint(x)
  31. #endif
  32. //
  33. // Define SCSI maximum configuration parameters.
  34. //
  35. #define SCSI_MAXIMUM_LOGICAL_UNITS 8
  36. #define SCSI_MAXIMUM_TARGETS_PER_BUS 128
  37. #define SCSI_MAXIMUM_LUNS_PER_TARGET 255
  38. #define SCSI_MAXIMUM_BUSES 8
  39. #define SCSI_MINIMUM_PHYSICAL_BREAKS 16
  40. #define SCSI_MAXIMUM_PHYSICAL_BREAKS 255
  41. #define SCSI_COMBINE_BUS_TARGET( Bus, Target ) ( \
  42. ((((UCHAR) (Target)) & ~(0x20 - 1)) << 8) | \
  43. (((UCHAR) (Bus)) << 5) | \
  44. (((UCHAR) (Target)) & (0x20 - 1)))
  45. #define SCSI_DECODE_BUS_TARGET( Value, Bus, Target ) ( \
  46. Bus = (UCHAR) ((Value) >> 5), \
  47. Target = (UCHAR) ((((Value) >> 8) & ~(0x20 - 1)) | ((Value) & (0x20 - 1))))
  48. //
  49. // This constant is for backward compatibility.
  50. // This use to be the maximum number of targets supported.
  51. //
  52. #define SCSI_MAXIMUM_TARGETS 8
  53. typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS, *PSTOR_PHYSICAL_ADDRESS;
  54. typedef struct _ACCESS_RANGE {
  55. STOR_PHYSICAL_ADDRESS RangeStart;
  56. ULONG RangeLength;
  57. BOOLEAN RangeInMemory;
  58. } ACCESS_RANGE, *PACCESS_RANGE;
  59. typedef enum _STOR_SYNCHRONIZATION_MODEL {
  60. StorSynchronizeHalfDuplex,
  61. StorSynchronizeFullDuplex
  62. } STOR_SYNCHRONIZATION_MODEL;
  63. #define STOR_MAP_NO_BUFFERS (0)
  64. #define STOR_MAP_ALL_BUFFERS (1)
  65. #define STOR_MAP_NON_READ_WRITE_BUFFERS (2)
  66. //
  67. // Configuration information structure. Contains the information necessary
  68. // to initialize the adapter. NOTE: This structure must be a multiple of
  69. // quadwords.
  70. //
  71. typedef struct _PORT_CONFIGURATION_INFORMATION {
  72. //
  73. // Length of port configuation information strucuture.
  74. //
  75. ULONG Length;
  76. //
  77. // IO bus number (0 for machines that have only 1 IO bus
  78. //
  79. ULONG SystemIoBusNumber;
  80. //
  81. // EISA, MCA or ISA
  82. //
  83. INTERFACE_TYPE AdapterInterfaceType;
  84. //
  85. // Interrupt request level for device
  86. //
  87. ULONG BusInterruptLevel;
  88. //
  89. // Bus interrupt vector used with hardware buses which use as vector as
  90. // well as level, such as internal buses.
  91. //
  92. ULONG BusInterruptVector;
  93. //
  94. // Interrupt mode (level-sensitive or edge-triggered)
  95. //
  96. KINTERRUPT_MODE InterruptMode;
  97. //
  98. // Maximum number of bytes that can be transferred in a single SRB
  99. //
  100. ULONG MaximumTransferLength;
  101. //
  102. // Number of contiguous blocks of physical memory
  103. //
  104. ULONG NumberOfPhysicalBreaks;
  105. //
  106. // DMA channel for devices using system DMA
  107. //
  108. ULONG DmaChannel;
  109. ULONG DmaPort;
  110. DMA_WIDTH DmaWidth;
  111. DMA_SPEED DmaSpeed;
  112. //
  113. // Alignment masked required by the adapter for data transfers.
  114. //
  115. ULONG AlignmentMask;
  116. //
  117. // Number of access range elements which have been allocated.
  118. //
  119. ULONG NumberOfAccessRanges;
  120. //
  121. // Pointer to array of access range elements.
  122. //
  123. ACCESS_RANGE (*AccessRanges)[];
  124. //
  125. // Reserved field.
  126. //
  127. PVOID Reserved;
  128. //
  129. // Number of SCSI buses attached to the adapter.
  130. //
  131. UCHAR NumberOfBuses;
  132. //
  133. // SCSI bus ID for adapter
  134. //
  135. CCHAR InitiatorBusId[8];
  136. //
  137. // Indicates that the adapter does scatter/gather
  138. //
  139. BOOLEAN ScatterGather;
  140. //
  141. // Indicates that the adapter is a bus master
  142. //
  143. BOOLEAN Master;
  144. //
  145. // Host caches data or state.
  146. //
  147. BOOLEAN CachesData;
  148. //
  149. // Host adapter scans down for bios devices.
  150. //
  151. BOOLEAN AdapterScansDown;
  152. //
  153. // Primary at disk address (0x1F0) claimed.
  154. //
  155. BOOLEAN AtdiskPrimaryClaimed;
  156. //
  157. // Secondary at disk address (0x170) claimed.
  158. //
  159. BOOLEAN AtdiskSecondaryClaimed;
  160. //
  161. // The master uses 32-bit DMA addresses.
  162. //
  163. BOOLEAN Dma32BitAddresses;
  164. //
  165. // Use Demand Mode DMA rather than Single Request.
  166. //
  167. BOOLEAN DemandMode;
  168. //
  169. // Data buffers must be mapped into virtual address space.
  170. //
  171. UCHAR MapBuffers;
  172. //
  173. // The driver will need to tranlate virtual to physical addresses.
  174. //
  175. BOOLEAN NeedPhysicalAddresses;
  176. //
  177. // Supports tagged queuing
  178. //
  179. BOOLEAN TaggedQueuing;
  180. //
  181. // Supports auto request sense.
  182. //
  183. BOOLEAN AutoRequestSense;
  184. //
  185. // Supports multiple requests per logical unit.
  186. //
  187. BOOLEAN MultipleRequestPerLu;
  188. //
  189. // Support receive event function.
  190. //
  191. BOOLEAN ReceiveEvent;
  192. //
  193. // Indicates the real-mode driver has initialized the card.
  194. //
  195. BOOLEAN RealModeInitialized;
  196. //
  197. // Indicate that the miniport will not touch the data buffers directly.
  198. //
  199. BOOLEAN BufferAccessScsiPortControlled;
  200. //
  201. // Indicator for wide scsi.
  202. //
  203. UCHAR MaximumNumberOfTargets;
  204. //
  205. // Ensure quadword alignment.
  206. //
  207. UCHAR ReservedUchars[2];
  208. //
  209. // Adapter slot number
  210. //
  211. ULONG SlotNumber;
  212. //
  213. // Interrupt information for a second IRQ.
  214. //
  215. ULONG BusInterruptLevel2;
  216. ULONG BusInterruptVector2;
  217. KINTERRUPT_MODE InterruptMode2;
  218. //
  219. // DMA information for a second channel.
  220. //
  221. ULONG DmaChannel2;
  222. ULONG DmaPort2;
  223. DMA_WIDTH DmaWidth2;
  224. DMA_SPEED DmaSpeed2;
  225. //
  226. // Fields added to allow for the miniport
  227. // to update these sizes based on requirements
  228. // for large transfers ( > 64K);
  229. //
  230. ULONG DeviceExtensionSize;
  231. ULONG SpecificLuExtensionSize;
  232. ULONG SrbExtensionSize;
  233. //
  234. // Used to determine whether the system and/or the miniport support
  235. // 64-bit physical addresses. See SCSI_DMA64_* flags below.
  236. //
  237. UCHAR Dma64BitAddresses; /* New */
  238. //
  239. // Indicates that the miniport can accept a SRB_FUNCTION_RESET_DEVICE
  240. // to clear all requests to a particular LUN.
  241. //
  242. BOOLEAN ResetTargetSupported; /* New */
  243. //
  244. // Indicates that the miniport can support more than 8 logical units per
  245. // target (maximum LUN number is one less than this field).
  246. //
  247. UCHAR MaximumNumberOfLogicalUnits; /* New */
  248. //
  249. // Supports WMI?
  250. //
  251. BOOLEAN WmiDataProvider;
  252. //
  253. // STORPORT synchronization model, either half or full duplex
  254. // depending on whether the driver supports async-with-interrupt
  255. // model or not.
  256. //
  257. STOR_SYNCHRONIZATION_MODEL SynchronizationModel; // STORPORT New
  258. } PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
  259. //
  260. // Version control for ConfigInfo structure.
  261. //
  262. #define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION)
  263. //
  264. // Flags for controlling 64-bit DMA use (PORT_CONFIGURATION_INFORMATION field
  265. // Dma64BitAddresses)
  266. //
  267. //
  268. // Set by scsiport on entering HwFindAdapter if the system can support 64-bit
  269. // physical addresses. The miniport can use this information before calling
  270. // ScsiPortGetUncachedExtension to modify the DeviceExtensionSize,
  271. // SpecificLuExtensionSize & SrbExtensionSize fields to account for the extra
  272. // size of the scatter gather list.
  273. //
  274. #define SCSI_DMA64_SYSTEM_SUPPORTED 0x80
  275. //
  276. // Set by the miniport before calling ScsiPortGetUncachedExtension to indicate
  277. // that scsiport should provide it with 64-bit physical addresses. If the
  278. // system does not support 64-bit PA's then this bit will be ignored.
  279. //
  280. #define SCSI_DMA64_MINIPORT_SUPPORTED 0x01
  281. //
  282. // Command type (and parameter) definition(s) for AdapterControl requests.
  283. //
  284. typedef enum _SCSI_ADAPTER_CONTROL_TYPE {
  285. ScsiQuerySupportedControlTypes = 0,
  286. ScsiStopAdapter,
  287. ScsiRestartAdapter,
  288. ScsiSetBootConfig,
  289. ScsiSetRunningConfig,
  290. ScsiAdapterControlMax,
  291. MakeAdapterControlTypeSizeOfUlong = 0xffffffff
  292. } SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE;
  293. //
  294. // Adapter control status values
  295. //
  296. typedef enum _SCSI_ADAPTER_CONTROL_STATUS {
  297. ScsiAdapterControlSuccess = 0,
  298. ScsiAdapterControlUnsuccessful
  299. } SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS;
  300. //
  301. // Parameters for Adapter Control Functions:
  302. //
  303. //
  304. // ScsiQuerySupportedControlTypes:
  305. //
  306. typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST {
  307. //
  308. // Specifies the number of entries in the adapter control type list.
  309. //
  310. IN ULONG MaxControlType;
  311. //
  312. // The miniport will set TRUE for each control type it supports.
  313. // The number of entries in this array is defined by MaxAdapterControlType
  314. // - the miniport must not attempt to set any AC types beyond the maximum
  315. // value specified.
  316. //
  317. OUT BOOLEAN SupportedTypeList[0];
  318. } SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST;
  319. //
  320. // Uninitialized flag value.
  321. //
  322. #define SP_UNINITIALIZED_VALUE ((ULONG) ~0)
  323. #define SP_UNTAGGED ((UCHAR) ~0)
  324. //
  325. // Set asynchronous events.
  326. //
  327. #define SRBEV_BUS_RESET 0x0001
  328. #define SRBEV_SCSI_ASYNC_NOTIFICATION 0x0002
  329. #define MAXIMUM_CDB_SIZE 12
  330. //
  331. // SCSI I/O Request Block
  332. //
  333. typedef struct _SCSI_REQUEST_BLOCK {
  334. USHORT Length; // offset 0
  335. UCHAR Function; // offset 2
  336. UCHAR SrbStatus; // offset 3
  337. UCHAR ScsiStatus; // offset 4
  338. UCHAR PathId; // offset 5
  339. UCHAR TargetId; // offset 6
  340. UCHAR Lun; // offset 7
  341. UCHAR QueueTag; // offset 8
  342. UCHAR QueueAction; // offset 9
  343. UCHAR CdbLength; // offset a
  344. UCHAR SenseInfoBufferLength; // offset b
  345. ULONG SrbFlags; // offset c
  346. ULONG DataTransferLength; // offset 10
  347. ULONG TimeOutValue; // offset 14
  348. PVOID DataBuffer; // offset 18
  349. PVOID SenseInfoBuffer; // offset 1c
  350. struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20
  351. PVOID OriginalRequest; // offset 24
  352. PVOID SrbExtension; // offset 28
  353. union {
  354. ULONG InternalStatus; // offset 2c
  355. ULONG QueueSortKey; // offset 2c
  356. };
  357. #if defined(_WIN64)
  358. //
  359. // Force PVOID alignment of Cdb
  360. //
  361. ULONG Reserved;
  362. #endif
  363. UCHAR Cdb[16]; // offset 30
  364. } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
  365. #define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
  366. //
  367. // SCSI I/O Request Block for WMI Requests
  368. //
  369. typedef struct _SCSI_WMI_REQUEST_BLOCK {
  370. USHORT Length;
  371. UCHAR Function; // SRB_FUNCTION_WMI
  372. UCHAR SrbStatus;
  373. UCHAR WMISubFunction;
  374. UCHAR PathId; // If SRB_WMI_FLAGS_ADAPTER_REQUEST is set in
  375. UCHAR TargetId; // WMIFlags then PathId, TargetId and Lun are
  376. UCHAR Lun; // reserved fields.
  377. UCHAR Reserved1;
  378. UCHAR WMIFlags;
  379. UCHAR Reserved2[2];
  380. ULONG SrbFlags;
  381. ULONG DataTransferLength;
  382. ULONG TimeOutValue;
  383. PVOID DataBuffer;
  384. PVOID DataPath;
  385. PVOID Reserved3;
  386. PVOID OriginalRequest;
  387. PVOID SrbExtension;
  388. ULONG Reserved4;
  389. UCHAR Reserved5[16];
  390. } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
  391. //
  392. // SRB Functions
  393. //
  394. #define SRB_FUNCTION_EXECUTE_SCSI 0x00
  395. #define SRB_FUNCTION_CLAIM_DEVICE 0x01
  396. #define SRB_FUNCTION_IO_CONTROL 0x02
  397. #define SRB_FUNCTION_RECEIVE_EVENT 0x03
  398. #define SRB_FUNCTION_RELEASE_QUEUE 0x04
  399. #define SRB_FUNCTION_ATTACH_DEVICE 0x05
  400. #define SRB_FUNCTION_RELEASE_DEVICE 0x06
  401. #define SRB_FUNCTION_SHUTDOWN 0x07
  402. #define SRB_FUNCTION_FLUSH 0x08
  403. #define SRB_FUNCTION_ABORT_COMMAND 0x10
  404. #define SRB_FUNCTION_RELEASE_RECOVERY 0x11
  405. #define SRB_FUNCTION_RESET_BUS 0x12
  406. #define SRB_FUNCTION_RESET_DEVICE 0x13
  407. #define SRB_FUNCTION_TERMINATE_IO 0x14
  408. #define SRB_FUNCTION_FLUSH_QUEUE 0x15
  409. #define SRB_FUNCTION_REMOVE_DEVICE 0x16
  410. #define SRB_FUNCTION_WMI 0x17
  411. #define SRB_FUNCTION_LOCK_QUEUE 0x18
  412. #define SRB_FUNCTION_UNLOCK_QUEUE 0x19
  413. //
  414. // SRB Status
  415. //
  416. #define SRB_STATUS_PENDING 0x00
  417. #define SRB_STATUS_SUCCESS 0x01
  418. #define SRB_STATUS_ABORTED 0x02
  419. #define SRB_STATUS_ABORT_FAILED 0x03
  420. #define SRB_STATUS_ERROR 0x04
  421. #define SRB_STATUS_BUSY 0x05
  422. #define SRB_STATUS_INVALID_REQUEST 0x06
  423. #define SRB_STATUS_INVALID_PATH_ID 0x07
  424. #define SRB_STATUS_NO_DEVICE 0x08
  425. #define SRB_STATUS_TIMEOUT 0x09
  426. #define SRB_STATUS_SELECTION_TIMEOUT 0x0A
  427. #define SRB_STATUS_COMMAND_TIMEOUT 0x0B
  428. #define SRB_STATUS_MESSAGE_REJECTED 0x0D
  429. #define SRB_STATUS_BUS_RESET 0x0E
  430. #define SRB_STATUS_PARITY_ERROR 0x0F
  431. #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
  432. #define SRB_STATUS_NO_HBA 0x11
  433. #define SRB_STATUS_DATA_OVERRUN 0x12
  434. #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
  435. #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
  436. #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
  437. #define SRB_STATUS_REQUEST_FLUSHED 0x16
  438. #define SRB_STATUS_INVALID_LUN 0x20
  439. #define SRB_STATUS_INVALID_TARGET_ID 0x21
  440. #define SRB_STATUS_BAD_FUNCTION 0x22
  441. #define SRB_STATUS_ERROR_RECOVERY 0x23
  442. #define SRB_STATUS_NOT_POWERED 0x24
  443. //
  444. // This value is used by the port driver to indicate that a non-scsi-related
  445. // error occured. Miniports must never return this status.
  446. //
  447. #define SRB_STATUS_INTERNAL_ERROR 0x30
  448. //
  449. // Srb status values 0x38 through 0x3f are reserved for internal port driver
  450. // use.
  451. //
  452. //
  453. // SRB Status Masks
  454. //
  455. #define SRB_STATUS_QUEUE_FROZEN 0x40
  456. #define SRB_STATUS_AUTOSENSE_VALID 0x80
  457. #define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
  458. //
  459. // SRB Flag Bits
  460. //
  461. #define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002
  462. #define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004
  463. #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
  464. #define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010
  465. #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
  466. #define SRB_FLAGS_DATA_IN 0x00000040
  467. #define SRB_FLAGS_DATA_OUT 0x00000080
  468. #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
  469. #define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
  470. #define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100
  471. #define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200
  472. #define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400
  473. #define SRB_FLAGS_IS_ACTIVE 0x00010000
  474. #define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000
  475. #define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000
  476. #define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000
  477. #define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000
  478. #define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000
  479. #define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000
  480. #define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000
  481. #define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000
  482. #define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000
  483. #if DBG==1
  484. //
  485. // A signature used to validate the scsi port number
  486. // at the end of a sense buffer.
  487. //
  488. #define SCSI_PORT_SIGNATURE 0x54524f50
  489. #endif
  490. //
  491. // Queue Action
  492. //
  493. #define SRB_SIMPLE_TAG_REQUEST 0x20
  494. #define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21
  495. #define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22
  496. #define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01
  497. //
  498. // SCSI Adapter Dependent Routines
  499. //
  500. typedef
  501. BOOLEAN
  502. (*PHW_INITIALIZE) (
  503. IN PVOID DeviceExtension
  504. );
  505. typedef
  506. BOOLEAN
  507. (*PHW_BUILDIO) (
  508. IN PVOID DeviceExtension,
  509. IN PSCSI_REQUEST_BLOCK Srb
  510. );
  511. typedef
  512. BOOLEAN
  513. (*PHW_STARTIO) (
  514. IN PVOID DeviceExtension,
  515. IN PSCSI_REQUEST_BLOCK Srb
  516. );
  517. typedef
  518. BOOLEAN
  519. (*PHW_INTERRUPT) (
  520. IN PVOID DeviceExtension
  521. );
  522. typedef
  523. VOID
  524. (*PHW_TIMER) (
  525. IN PVOID DeviceExtension
  526. );
  527. typedef
  528. VOID
  529. (*PHW_DMA_STARTED) (
  530. IN PVOID DeviceExtension
  531. );
  532. typedef
  533. ULONG
  534. (*PHW_FIND_ADAPTER) (
  535. IN PVOID DeviceExtension,
  536. IN PVOID HwContext,
  537. IN PVOID BusInformation,
  538. IN PCHAR ArgumentString,
  539. IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
  540. OUT PBOOLEAN Again
  541. );
  542. typedef
  543. BOOLEAN
  544. (*PHW_RESET_BUS) (
  545. IN PVOID DeviceExtension,
  546. IN ULONG PathId
  547. );
  548. typedef
  549. BOOLEAN
  550. (*PHW_ADAPTER_STATE) (
  551. IN PVOID DeviceExtension,
  552. IN PVOID Context,
  553. IN BOOLEAN SaveState
  554. );
  555. typedef
  556. SCSI_ADAPTER_CONTROL_STATUS
  557. (*PHW_ADAPTER_CONTROL) (
  558. IN PVOID DeviceExtension,
  559. IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
  560. IN PVOID Parameters
  561. );
  562. //
  563. // Port driver error codes
  564. //
  565. #define SP_BUS_PARITY_ERROR 0x0001
  566. #define SP_UNEXPECTED_DISCONNECT 0x0002
  567. #define SP_INVALID_RESELECTION 0x0003
  568. #define SP_BUS_TIME_OUT 0x0004
  569. #define SP_PROTOCOL_ERROR 0x0005
  570. #define SP_INTERNAL_ADAPTER_ERROR 0x0006
  571. #define SP_REQUEST_TIMEOUT 0x0007
  572. #define SP_IRQ_NOT_RESPONDING 0x0008
  573. #define SP_BAD_FW_WARNING 0x0009
  574. #define SP_BAD_FW_ERROR 0x000a
  575. #define SP_LOST_WMI_MINIPORT_REQUEST 0x000b
  576. //
  577. // Return values for SCSI_HW_FIND_ADAPTER.
  578. //
  579. #define SP_RETURN_NOT_FOUND 0
  580. #define SP_RETURN_FOUND 1
  581. #define SP_RETURN_ERROR 2
  582. #define SP_RETURN_BAD_CONFIG 3
  583. //
  584. // Notification Event Types
  585. //
  586. typedef enum _SCSI_NOTIFICATION_TYPE {
  587. RequestComplete,
  588. NextRequest,
  589. NextLuRequest,
  590. ResetDetected,
  591. _obsolete1, // STORPORT: CallDisableInterrupts has been removed
  592. _obsolete2, // STORPORT: CallEnableInterrupts has been removed
  593. RequestTimerCall,
  594. BusChangeDetected,
  595. WMIEvent,
  596. WMIReregister
  597. } SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE;
  598. //
  599. // Structure passed between miniport initialization
  600. // and SCSI port initialization
  601. //
  602. typedef struct _HW_INITIALIZATION_DATA {
  603. ULONG HwInitializationDataSize;
  604. //
  605. // Adapter interface type:
  606. //
  607. // Internal
  608. // Isa
  609. // Eisa
  610. // MicroChannel
  611. // TurboChannel
  612. // PCIBus
  613. // VMEBus
  614. // NuBus
  615. // PCMCIABus
  616. // CBus
  617. // MPIBus
  618. // MPSABus
  619. //
  620. INTERFACE_TYPE AdapterInterfaceType;
  621. //
  622. // Miniport driver routines
  623. //
  624. PHW_INITIALIZE HwInitialize;
  625. PHW_STARTIO HwStartIo;
  626. PHW_INTERRUPT HwInterrupt;
  627. PHW_FIND_ADAPTER HwFindAdapter;
  628. PHW_RESET_BUS HwResetBus;
  629. PHW_DMA_STARTED HwDmaStarted;
  630. PHW_ADAPTER_STATE HwAdapterState;
  631. //
  632. // Miniport driver resources
  633. //
  634. ULONG DeviceExtensionSize;
  635. ULONG SpecificLuExtensionSize;
  636. ULONG SrbExtensionSize;
  637. ULONG NumberOfAccessRanges;
  638. PVOID Reserved;
  639. //
  640. // Data buffers must be mapped into virtual address space.
  641. //
  642. UCHAR MapBuffers;
  643. //
  644. // The driver will need to tranlate virtual to physical addresses.
  645. //
  646. BOOLEAN NeedPhysicalAddresses;
  647. //
  648. // Supports tagged queuing
  649. //
  650. BOOLEAN TaggedQueuing;
  651. //
  652. // Supports auto request sense.
  653. //
  654. BOOLEAN AutoRequestSense;
  655. //
  656. // Supports multiple requests per logical unit.
  657. //
  658. BOOLEAN MultipleRequestPerLu;
  659. //
  660. // Support receive event function.
  661. //
  662. BOOLEAN ReceiveEvent;
  663. //
  664. // Vendor identification length
  665. //
  666. USHORT VendorIdLength;
  667. //
  668. // Vendor identification
  669. //
  670. PVOID VendorId;
  671. //
  672. // Pad for alignment and future use.
  673. //
  674. USHORT ReservedUshort;
  675. //
  676. // Device identification length
  677. //
  678. USHORT DeviceIdLength;
  679. //
  680. // Device identification
  681. //
  682. PVOID DeviceId;
  683. //
  684. // Stop adapter routine.
  685. //
  686. PHW_ADAPTER_CONTROL HwAdapterControl;
  687. //
  688. // Initialize to the Build IO routine if one is supported, otherwise
  689. // should be NULL.
  690. //
  691. PHW_BUILDIO HwBuildIo; // STORPORT New
  692. } HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
  693. //
  694. // Scatter/gather lists
  695. //
  696. typedef struct _STOR_SCATTER_GATHER_ELEMENT {
  697. STOR_PHYSICAL_ADDRESS PhysicalAddress;
  698. ULONG Length;
  699. ULONG_PTR Reserved;
  700. } STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT;
  701. typedef struct _STOR_SCATTER_GATHER_LIST {
  702. ULONG NumberOfElements;
  703. ULONG_PTR Reserved;
  704. STOR_SCATTER_GATHER_ELEMENT List[];
  705. } STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST;
  706. typedef
  707. BOOLEAN
  708. (*PSTOR_SYNCHRONIZED_ACCESS)(
  709. IN PVOID HwDeviceExtension,
  710. IN PVOID Context
  711. );
  712. #ifndef _NTDDK_
  713. #define STORPORT_API DECLSPEC_IMPORT
  714. #else
  715. #define STORPORT_API
  716. #endif
  717. //
  718. // Port driver routines called by miniport driver
  719. //
  720. STORPORT_API
  721. ULONG
  722. StorPortInitialize(
  723. IN PVOID Argument1,
  724. IN PVOID Argument2,
  725. IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
  726. IN PVOID HwContext
  727. );
  728. STORPORT_API
  729. VOID
  730. StorPortFreeDeviceBase(
  731. IN PVOID HwDeviceExtension,
  732. IN PVOID MappedAddress
  733. );
  734. STORPORT_API
  735. ULONG
  736. StorPortGetBusData(
  737. IN PVOID DeviceExtension,
  738. IN ULONG BusDataType,
  739. IN ULONG SystemIoBusNumber,
  740. IN ULONG SlotNumber,
  741. IN PVOID Buffer,
  742. IN ULONG Length
  743. );
  744. STORPORT_API
  745. ULONG
  746. StorPortSetBusDataByOffset(
  747. IN PVOID DeviceExtension,
  748. IN ULONG BusDataType,
  749. IN ULONG SystemIoBusNumber,
  750. IN ULONG SlotNumber,
  751. IN PVOID Buffer,
  752. IN ULONG Offset,
  753. IN ULONG Length
  754. );
  755. STORPORT_API
  756. PVOID
  757. StorPortGetDeviceBase(
  758. IN PVOID HwDeviceExtension,
  759. IN INTERFACE_TYPE BusType,
  760. IN ULONG SystemIoBusNumber,
  761. IN STOR_PHYSICAL_ADDRESS IoAddress,
  762. IN ULONG NumberOfBytes,
  763. IN BOOLEAN InIoSpace
  764. );
  765. STORPORT_API
  766. PVOID
  767. StorPortGetLogicalUnit(
  768. IN PVOID HwDeviceExtension,
  769. IN UCHAR PathId,
  770. IN UCHAR TargetId,
  771. IN UCHAR Lun
  772. );
  773. STORPORT_API
  774. PSTOR_SCATTER_GATHER_LIST
  775. StorPortGetScatterGatherList(
  776. IN PVOID HwDeviceExtension,
  777. IN PSCSI_REQUEST_BLOCK Srb
  778. );
  779. STORPORT_API
  780. STOR_PHYSICAL_ADDRESS
  781. StorPortGetPhysicalAddress(
  782. IN PVOID HwDeviceExtension,
  783. IN PSCSI_REQUEST_BLOCK Srb,
  784. IN PVOID VirtualAddress,
  785. OUT ULONG *Length
  786. );
  787. STORPORT_API
  788. PVOID
  789. StorPortGetVirtualAddress(
  790. IN PVOID HwDeviceExtension,
  791. IN STOR_PHYSICAL_ADDRESS PhysicalAddress
  792. );
  793. STORPORT_API
  794. PVOID
  795. StorPortGetUncachedExtension(
  796. IN PVOID HwDeviceExtension,
  797. IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
  798. IN ULONG NumberOfBytes
  799. );
  800. STORPORT_API
  801. BOOLEAN
  802. StorPortPauseDevice(
  803. IN PVOID HwDeviceExtension,
  804. IN UCHAR PathId,
  805. IN UCHAR TargetId,
  806. IN UCHAR Lun,
  807. IN ULONG Timeout
  808. );
  809. STORPORT_API
  810. BOOLEAN
  811. StorPortResumeDevice(
  812. IN PVOID HwDeviceExtension,
  813. IN UCHAR PathId,
  814. IN UCHAR TargetId,
  815. IN UCHAR Lun
  816. );
  817. STORPORT_API
  818. BOOLEAN
  819. StorPortPause(
  820. IN PVOID HwDeviceExtension,
  821. IN ULONG Timeout
  822. );
  823. STORPORT_API
  824. BOOLEAN
  825. StorPortResume(
  826. IN PVOID HwDeviceExtension
  827. );
  828. STORPORT_API
  829. BOOLEAN
  830. StorPortDeviceBusy(
  831. IN PVOID HwDeviceExtension,
  832. IN UCHAR PathId,
  833. IN UCHAR TargetId,
  834. IN UCHAR Lun,
  835. IN ULONG RequestsToComplete
  836. );
  837. STORPORT_API
  838. BOOLEAN
  839. StorPortDeviceReady(
  840. IN PVOID HwDeviceExtension,
  841. IN UCHAR PathId,
  842. IN UCHAR TargetId,
  843. IN UCHAR Lun
  844. );
  845. STORPORT_API
  846. BOOLEAN
  847. StorPortBusy(
  848. IN PVOID HwDeviceExtension,
  849. IN ULONG RequestsToComplete
  850. );
  851. STORPORT_API
  852. BOOLEAN
  853. RaidPortReady(
  854. IN PVOID HwDeviceExtension
  855. );
  856. STORPORT_API
  857. VOID
  858. StorPortNotification(
  859. IN SCSI_NOTIFICATION_TYPE NotificationType,
  860. IN PVOID HwDeviceExtension,
  861. ...
  862. );
  863. STORPORT_API
  864. VOID
  865. StorPortLogError(
  866. IN PVOID HwDeviceExtension,
  867. IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
  868. IN UCHAR PathId,
  869. IN UCHAR TargetId,
  870. IN UCHAR Lun,
  871. IN ULONG ErrorCode,
  872. IN ULONG UniqueId
  873. );
  874. STORPORT_API
  875. VOID
  876. StorPortCompleteRequest(
  877. IN PVOID HwDeviceExtension,
  878. IN UCHAR PathId,
  879. IN UCHAR TargetId,
  880. IN UCHAR Lun,
  881. IN UCHAR SrbStatus
  882. );
  883. STORPORT_API
  884. VOID
  885. StorPortMoveMemory(
  886. IN PVOID WriteBuffer,
  887. IN PVOID ReadBuffer,
  888. IN ULONG Length
  889. );
  890. STORPORT_API
  891. UCHAR
  892. StorPortReadPortUchar(
  893. IN PUCHAR Port
  894. );
  895. STORPORT_API
  896. USHORT
  897. StorPortReadPortUshort(
  898. IN PUSHORT Port
  899. );
  900. STORPORT_API
  901. ULONG
  902. StorPortReadPortUlong(
  903. IN PULONG Port
  904. );
  905. STORPORT_API
  906. VOID
  907. StorPortReadPortBufferUchar(
  908. IN PUCHAR Port,
  909. IN PUCHAR Buffer,
  910. IN ULONG Count
  911. );
  912. STORPORT_API
  913. VOID
  914. StorPortReadPortBufferUshort(
  915. IN PUSHORT Port,
  916. IN PUSHORT Buffer,
  917. IN ULONG Count
  918. );
  919. STORPORT_API
  920. VOID
  921. StorPortReadPortBufferUlong(
  922. IN PULONG Port,
  923. IN PULONG Buffer,
  924. IN ULONG Count
  925. );
  926. STORPORT_API
  927. UCHAR
  928. StorPortReadRegisterUchar(
  929. IN PUCHAR Register
  930. );
  931. STORPORT_API
  932. USHORT
  933. StorPortReadRegisterUshort(
  934. IN PUSHORT Register
  935. );
  936. STORPORT_API
  937. ULONG
  938. StorPortReadRegisterUlong(
  939. IN PULONG Register
  940. );
  941. STORPORT_API
  942. VOID
  943. StorPortReadRegisterBufferUchar(
  944. IN PUCHAR Register,
  945. IN PUCHAR Buffer,
  946. IN ULONG Count
  947. );
  948. STORPORT_API
  949. VOID
  950. StorPortReadRegisterBufferUshort(
  951. IN PUSHORT Register,
  952. IN PUSHORT Buffer,
  953. IN ULONG Count
  954. );
  955. STORPORT_API
  956. VOID
  957. StorPortReadRegisterBufferUlong(
  958. IN PULONG Register,
  959. IN PULONG Buffer,
  960. IN ULONG Count
  961. );
  962. STORPORT_API
  963. VOID
  964. StorPortStallExecution(
  965. IN ULONG Delay
  966. );
  967. STORPORT_API
  968. BOOLEAN
  969. StorPortSynchronizeAccess(
  970. IN PVOID HwDeviceExtension,
  971. IN PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine,
  972. IN PVOID Context
  973. );
  974. STORPORT_API
  975. VOID
  976. StorPortWritePortUchar(
  977. IN PUCHAR Port,
  978. IN UCHAR Value
  979. );
  980. STORPORT_API
  981. VOID
  982. StorPortWritePortUshort(
  983. IN PUSHORT Port,
  984. IN USHORT Value
  985. );
  986. STORPORT_API
  987. VOID
  988. StorPortWritePortUlong(
  989. IN PULONG Port,
  990. IN ULONG Value
  991. );
  992. STORPORT_API
  993. VOID
  994. StorPortWritePortBufferUchar(
  995. IN PUCHAR Port,
  996. IN PUCHAR Buffer,
  997. IN ULONG Count
  998. );
  999. STORPORT_API
  1000. VOID
  1001. StorPortWritePortBufferUshort(
  1002. IN PUSHORT Port,
  1003. IN PUSHORT Buffer,
  1004. IN ULONG Count
  1005. );
  1006. STORPORT_API
  1007. VOID
  1008. StorPortWritePortBufferUlong(
  1009. IN PULONG Port,
  1010. IN PULONG Buffer,
  1011. IN ULONG Count
  1012. );
  1013. STORPORT_API
  1014. VOID
  1015. StorPortWriteRegisterUchar(
  1016. IN PUCHAR Register,
  1017. IN UCHAR Value
  1018. );
  1019. STORPORT_API
  1020. VOID
  1021. StorPortWriteRegisterUshort(
  1022. IN PUSHORT Register,
  1023. IN USHORT Value
  1024. );
  1025. STORPORT_API
  1026. VOID
  1027. StorPortWriteRegisterUlong(
  1028. IN PULONG Register,
  1029. IN ULONG Value
  1030. );
  1031. STORPORT_API
  1032. VOID
  1033. StorPortWriteRegisterBufferUchar(
  1034. IN PUCHAR Register,
  1035. IN PUCHAR Buffer,
  1036. IN ULONG Count
  1037. );
  1038. STORPORT_API
  1039. VOID
  1040. StorPortWriteRegisterBufferUshort(
  1041. IN PUSHORT Register,
  1042. IN PUSHORT Buffer,
  1043. IN ULONG Count
  1044. );
  1045. STORPORT_API
  1046. VOID
  1047. StorPortWriteRegisterBufferUlong(
  1048. IN PULONG Register,
  1049. IN PULONG Buffer,
  1050. IN ULONG Count
  1051. );
  1052. STORPORT_API
  1053. STOR_PHYSICAL_ADDRESS
  1054. StorPortConvertUlongToPhysicalAddress(
  1055. ULONG_PTR UlongAddress
  1056. );
  1057. STORPORT_API
  1058. ULONG
  1059. StorPortConvertPhysicalAddressToUlong(
  1060. STOR_PHYSICAL_ADDRESS Address
  1061. );
  1062. STORPORT_API
  1063. VOID
  1064. StorPortQuerySystemTime(
  1065. OUT PLARGE_INTEGER CurrentTime
  1066. );
  1067. #define StorPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
  1068. #define StorPortConvertPhysicalAddressToULong64(Address) ((Address).QuadPart)
  1069. STORPORT_API
  1070. BOOLEAN
  1071. StorPortValidateRange(
  1072. IN PVOID HwDeviceExtension,
  1073. IN INTERFACE_TYPE BusType,
  1074. IN ULONG SystemIoBusNumber,
  1075. IN STOR_PHYSICAL_ADDRESS IoAddress,
  1076. IN ULONG NumberOfBytes,
  1077. IN BOOLEAN InIoSpace
  1078. );
  1079. STORPORT_API
  1080. VOID
  1081. StorPortDebugPrint(
  1082. ULONG DebugPrintLevel,
  1083. PCCHAR DebugMessage,
  1084. ...
  1085. );
  1086. //
  1087. // Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus
  1088. //
  1089. typedef union _CDB {
  1090. //
  1091. // Generic 6-Byte CDB
  1092. //
  1093. struct _CDB6GENERIC {
  1094. UCHAR OperationCode;
  1095. UCHAR Immediate : 1;
  1096. UCHAR CommandUniqueBits : 4;
  1097. UCHAR LogicalUnitNumber : 3;
  1098. UCHAR CommandUniqueBytes[3];
  1099. UCHAR Link : 1;
  1100. UCHAR Flag : 1;
  1101. UCHAR Reserved : 4;
  1102. UCHAR VendorUnique : 2;
  1103. } CDB6GENERIC, *PCDB6GENERIC;
  1104. //
  1105. // Standard 6-byte CDB
  1106. //
  1107. struct _CDB6READWRITE {
  1108. UCHAR OperationCode; // 0x08, 0x0A - SCSIOP_READ, SCSIOP_WRITE
  1109. UCHAR LogicalBlockMsb1 : 5;
  1110. UCHAR LogicalUnitNumber : 3;
  1111. UCHAR LogicalBlockMsb0;
  1112. UCHAR LogicalBlockLsb;
  1113. UCHAR TransferBlocks;
  1114. UCHAR Control;
  1115. } CDB6READWRITE, *PCDB6READWRITE;
  1116. //
  1117. // SCSI-1 Inquiry CDB
  1118. //
  1119. struct _CDB6INQUIRY {
  1120. UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY
  1121. UCHAR Reserved1 : 5;
  1122. UCHAR LogicalUnitNumber : 3;
  1123. UCHAR PageCode;
  1124. UCHAR IReserved;
  1125. UCHAR AllocationLength;
  1126. UCHAR Control;
  1127. } CDB6INQUIRY, *PCDB6INQUIRY;
  1128. //
  1129. // SCSI-3 Inquiry CDB
  1130. //
  1131. struct _CDB6INQUIRY3 {
  1132. UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY
  1133. UCHAR EnableVitalProductData : 1;
  1134. UCHAR CommandSupportData : 1;
  1135. UCHAR Reserved1 : 6;
  1136. UCHAR PageCode;
  1137. UCHAR Reserved2;
  1138. UCHAR AllocationLength;
  1139. UCHAR Control;
  1140. } CDB6INQUIRY3, *PCDB6INQUIRY3;
  1141. struct _CDB6VERIFY {
  1142. UCHAR OperationCode; // 0x13 - SCSIOP_VERIFY
  1143. UCHAR Fixed : 1;
  1144. UCHAR ByteCompare : 1;
  1145. UCHAR Immediate : 1;
  1146. UCHAR Reserved : 2;
  1147. UCHAR LogicalUnitNumber : 3;
  1148. UCHAR VerificationLength[3];
  1149. UCHAR Control;
  1150. } CDB6VERIFY, *PCDB6VERIFY;
  1151. //
  1152. // SCSI Format CDB
  1153. //
  1154. struct _CDB6FORMAT {
  1155. UCHAR OperationCode; // 0x04 - SCSIOP_FORMAT_UNIT
  1156. UCHAR FormatControl : 5;
  1157. UCHAR LogicalUnitNumber : 3;
  1158. UCHAR FReserved1;
  1159. UCHAR InterleaveMsb;
  1160. UCHAR InterleaveLsb;
  1161. UCHAR FReserved2;
  1162. } CDB6FORMAT, *PCDB6FORMAT;
  1163. //
  1164. // Standard 10-byte CDB
  1165. struct _CDB10 {
  1166. UCHAR OperationCode;
  1167. UCHAR RelativeAddress : 1;
  1168. UCHAR Reserved1 : 2;
  1169. UCHAR ForceUnitAccess : 1;
  1170. UCHAR DisablePageOut : 1;
  1171. UCHAR LogicalUnitNumber : 3;
  1172. UCHAR LogicalBlockByte0;
  1173. UCHAR LogicalBlockByte1;
  1174. UCHAR LogicalBlockByte2;
  1175. UCHAR LogicalBlockByte3;
  1176. UCHAR Reserved2;
  1177. UCHAR TransferBlocksMsb;
  1178. UCHAR TransferBlocksLsb;
  1179. UCHAR Control;
  1180. } CDB10, *PCDB10;
  1181. //
  1182. // Standard 12-byte CDB
  1183. //
  1184. struct _CDB12 {
  1185. UCHAR OperationCode;
  1186. UCHAR RelativeAddress : 1;
  1187. UCHAR Reserved1 : 2;
  1188. UCHAR ForceUnitAccess : 1;
  1189. UCHAR DisablePageOut : 1;
  1190. UCHAR LogicalUnitNumber : 3;
  1191. UCHAR LogicalBlock[4];
  1192. UCHAR TransferLength[4];
  1193. UCHAR Reserved2;
  1194. UCHAR Control;
  1195. } CDB12, *PCDB12;
  1196. //
  1197. // CD Rom Audio CDBs
  1198. //
  1199. struct _PAUSE_RESUME {
  1200. UCHAR OperationCode; // 0x4B - SCSIOP_PAUSE_RESUME
  1201. UCHAR Reserved1 : 5;
  1202. UCHAR LogicalUnitNumber : 3;
  1203. UCHAR Reserved2[6];
  1204. UCHAR Action;
  1205. UCHAR Control;
  1206. } PAUSE_RESUME, *PPAUSE_RESUME;
  1207. //
  1208. // Read Table of Contents
  1209. //
  1210. struct _READ_TOC {
  1211. UCHAR OperationCode; // 0x43 - SCSIOP_READ_TOC
  1212. UCHAR Reserved0 : 1;
  1213. UCHAR Msf : 1;
  1214. UCHAR Reserved1 : 3;
  1215. UCHAR LogicalUnitNumber : 3;
  1216. UCHAR Format2 : 4;
  1217. UCHAR Reserved2 : 4;
  1218. UCHAR Reserved3[3];
  1219. UCHAR StartingTrack;
  1220. UCHAR AllocationLength[2];
  1221. UCHAR Control : 6;
  1222. UCHAR Format : 2;
  1223. } READ_TOC, *PREAD_TOC;
  1224. struct _READ_DISK_INFORMATION {
  1225. UCHAR OperationCode; // 0x51 - SCSIOP_READ_DISC_INFORMATION
  1226. UCHAR Reserved1 : 5;
  1227. UCHAR Lun : 3;
  1228. UCHAR Reserved2[5];
  1229. UCHAR AllocationLength[2];
  1230. UCHAR Control;
  1231. } READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
  1232. struct _READ_TRACK_INFORMATION {
  1233. UCHAR OperationCode; // 0x52 - SCSIOP_READ_TRACK_INFORMATION
  1234. UCHAR Track : 1;
  1235. UCHAR Reserved1 : 3;
  1236. UCHAR Reserved2 : 1;
  1237. UCHAR Lun : 3;
  1238. UCHAR BlockAddress[4]; // or Track Number
  1239. UCHAR Reserved3;
  1240. UCHAR AllocationLength[2];
  1241. UCHAR Control;
  1242. } READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
  1243. struct _RESERVE_TRACK_RZONE {
  1244. UCHAR OperationCode; // 0x53 - SCSIOP_RESERVE_TRACK_RZONE
  1245. UCHAR Reserved1[4];
  1246. UCHAR ReservationSize[4];
  1247. UCHAR Control;
  1248. } RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
  1249. struct _SEND_OPC_INFORMATION {
  1250. UCHAR OperationCode; // 0x54 - SCSIOP_SEND_OPC_INFORMATION
  1251. UCHAR DoOpc : 1; // perform OPC
  1252. UCHAR Reserved : 7;
  1253. UCHAR Reserved1[5];
  1254. UCHAR ParameterListLength[2];
  1255. UCHAR Reserved2;
  1256. } SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
  1257. struct _CLOSE_TRACK {
  1258. UCHAR OperationCode; // 0x5B - SCSIOP_CLOSE_TRACK_SESSION
  1259. UCHAR Immediate : 1;
  1260. UCHAR Reserved1 : 7;
  1261. UCHAR Track : 1;
  1262. UCHAR Session : 1;
  1263. UCHAR Reserved2 : 6;
  1264. UCHAR Reserved3;
  1265. UCHAR TrackNumber[2];
  1266. UCHAR Reserved4[3];
  1267. UCHAR Control;
  1268. } CLOSE_TRACK, *PCLOSE_TRACK;
  1269. struct _SEND_CUE_SHEET {
  1270. UCHAR OperationCode; // 0x5D - SCSIOP_SEND_CUE_SHEET
  1271. UCHAR Reserved[5];
  1272. UCHAR CueSheetSize[3];
  1273. UCHAR Control;
  1274. } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
  1275. struct _READ_HEADER {
  1276. UCHAR OperationCode; // 0x44 - SCSIOP_READ_HEADER
  1277. UCHAR Reserved1 : 1;
  1278. UCHAR Msf : 1;
  1279. UCHAR Reserved2 : 3;
  1280. UCHAR Lun : 3;
  1281. UCHAR LogicalBlockAddress[4];
  1282. UCHAR Reserved3;
  1283. UCHAR AllocationLength[2];
  1284. UCHAR Control;
  1285. } READ_HEADER, *PREAD_HEADER;
  1286. struct _PLAY_AUDIO {
  1287. UCHAR OperationCode; // 0x45 - SCSIOP_PLAY_AUDIO
  1288. UCHAR Reserved1 : 5;
  1289. UCHAR LogicalUnitNumber : 3;
  1290. UCHAR StartingBlockAddress[4];
  1291. UCHAR Reserved2;
  1292. UCHAR PlayLength[2];
  1293. UCHAR Control;
  1294. } PLAY_AUDIO, *PPLAY_AUDIO;
  1295. struct _PLAY_AUDIO_MSF {
  1296. UCHAR OperationCode; // 0x47 - SCSIOP_PLAY_AUDIO_MSF
  1297. UCHAR Reserved1 : 5;
  1298. UCHAR LogicalUnitNumber : 3;
  1299. UCHAR Reserved2;
  1300. UCHAR StartingM;
  1301. UCHAR StartingS;
  1302. UCHAR StartingF;
  1303. UCHAR EndingM;
  1304. UCHAR EndingS;
  1305. UCHAR EndingF;
  1306. UCHAR Control;
  1307. } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
  1308. struct _PLAY_CD {
  1309. UCHAR OperationCode; // 0xBC - SCSIOP_PLAY_CD
  1310. UCHAR Reserved1 : 1;
  1311. UCHAR CMSF : 1; // LBA = 0, MSF = 1
  1312. UCHAR ExpectedSectorType : 3;
  1313. UCHAR Lun : 3;
  1314. union {
  1315. struct _LBA {
  1316. UCHAR StartingBlockAddress[4];
  1317. UCHAR PlayLength[4];
  1318. } LBA;
  1319. struct _MSF {
  1320. UCHAR Reserved1;
  1321. UCHAR StartingM;
  1322. UCHAR StartingS;
  1323. UCHAR StartingF;
  1324. UCHAR EndingM;
  1325. UCHAR EndingS;
  1326. UCHAR EndingF;
  1327. UCHAR Reserved2;
  1328. } MSF;
  1329. };
  1330. UCHAR Audio : 1;
  1331. UCHAR Composite : 1;
  1332. UCHAR Port1 : 1;
  1333. UCHAR Port2 : 1;
  1334. UCHAR Reserved2 : 3;
  1335. UCHAR Speed : 1;
  1336. UCHAR Control;
  1337. } PLAY_CD, *PPLAY_CD;
  1338. struct _SCAN_CD {
  1339. UCHAR OperationCode; // 0xBA - SCSIOP_SCAN_CD
  1340. UCHAR RelativeAddress : 1;
  1341. UCHAR Reserved1 : 3;
  1342. UCHAR Direct : 1;
  1343. UCHAR Lun : 3;
  1344. UCHAR StartingAddress[4];
  1345. UCHAR Reserved2[3];
  1346. UCHAR Reserved3 : 6;
  1347. UCHAR Type : 2;
  1348. UCHAR Reserved4;
  1349. UCHAR Control;
  1350. } SCAN_CD, *PSCAN_CD;
  1351. struct _STOP_PLAY_SCAN {
  1352. UCHAR OperationCode; // 0x4E - SCSIOP_STOP_PLAY_SCAN
  1353. UCHAR Reserved1 : 5;
  1354. UCHAR Lun : 3;
  1355. UCHAR Reserved2[7];
  1356. UCHAR Control;
  1357. } STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
  1358. //
  1359. // Read SubChannel Data
  1360. //
  1361. struct _SUBCHANNEL {
  1362. UCHAR OperationCode; // 0x42 - SCSIOP_READ_SUB_CHANNEL
  1363. UCHAR Reserved0 : 1;
  1364. UCHAR Msf : 1;
  1365. UCHAR Reserved1 : 3;
  1366. UCHAR LogicalUnitNumber : 3;
  1367. UCHAR Reserved2 : 6;
  1368. UCHAR SubQ : 1;
  1369. UCHAR Reserved3 : 1;
  1370. UCHAR Format;
  1371. UCHAR Reserved4[2];
  1372. UCHAR TrackNumber;
  1373. UCHAR AllocationLength[2];
  1374. UCHAR Control;
  1375. } SUBCHANNEL, *PSUBCHANNEL;
  1376. //
  1377. // Read CD. Used by Atapi for raw sector reads.
  1378. //
  1379. struct _READ_CD {
  1380. UCHAR OperationCode; // 0xBE - SCSIOP_READ_CD
  1381. UCHAR RelativeAddress : 1;
  1382. UCHAR Reserved0 : 1;
  1383. UCHAR ExpectedSectorType : 3;
  1384. UCHAR Lun : 3;
  1385. UCHAR StartingLBA[4];
  1386. UCHAR TransferBlocks[3];
  1387. UCHAR Reserved2 : 1;
  1388. UCHAR ErrorFlags : 2;
  1389. UCHAR IncludeEDC : 1;
  1390. UCHAR IncludeUserData : 1;
  1391. UCHAR HeaderCode : 2;
  1392. UCHAR IncludeSyncData : 1;
  1393. UCHAR SubChannelSelection : 3;
  1394. UCHAR Reserved3 : 5;
  1395. UCHAR Control;
  1396. } READ_CD, *PREAD_CD;
  1397. struct _READ_CD_MSF {
  1398. UCHAR OperationCode; // 0xB9 - SCSIOP_READ_CD_MSF
  1399. UCHAR RelativeAddress : 1;
  1400. UCHAR Reserved1 : 1;
  1401. UCHAR ExpectedSectorType : 3;
  1402. UCHAR Lun : 3;
  1403. UCHAR Reserved2;
  1404. UCHAR StartingM;
  1405. UCHAR StartingS;
  1406. UCHAR StartingF;
  1407. UCHAR EndingM;
  1408. UCHAR EndingS;
  1409. UCHAR EndingF;
  1410. UCHAR Reserved3;
  1411. UCHAR Reserved4 : 1;
  1412. UCHAR ErrorFlags : 2;
  1413. UCHAR IncludeEDC : 1;
  1414. UCHAR IncludeUserData : 1;
  1415. UCHAR HeaderCode : 2;
  1416. UCHAR IncludeSyncData : 1;
  1417. UCHAR SubChannelSelection : 3;
  1418. UCHAR Reserved5 : 5;
  1419. UCHAR Control;
  1420. } READ_CD_MSF, *PREAD_CD_MSF;
  1421. //
  1422. // Plextor Read CD-DA
  1423. //
  1424. struct _PLXTR_READ_CDDA {
  1425. UCHAR OperationCode; // Unknown -- vendor-unique?
  1426. UCHAR Reserved0 : 5;
  1427. UCHAR LogicalUnitNumber :3;
  1428. UCHAR LogicalBlockByte0;
  1429. UCHAR LogicalBlockByte1;
  1430. UCHAR LogicalBlockByte2;
  1431. UCHAR LogicalBlockByte3;
  1432. UCHAR TransferBlockByte0;
  1433. UCHAR TransferBlockByte1;
  1434. UCHAR TransferBlockByte2;
  1435. UCHAR TransferBlockByte3;
  1436. UCHAR SubCode;
  1437. UCHAR Control;
  1438. } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
  1439. //
  1440. // NEC Read CD-DA
  1441. //
  1442. struct _NEC_READ_CDDA {
  1443. UCHAR OperationCode; // Unknown -- vendor-unique?
  1444. UCHAR Reserved0;
  1445. UCHAR LogicalBlockByte0;
  1446. UCHAR LogicalBlockByte1;
  1447. UCHAR LogicalBlockByte2;
  1448. UCHAR LogicalBlockByte3;
  1449. UCHAR Reserved1;
  1450. UCHAR TransferBlockByte0;
  1451. UCHAR TransferBlockByte1;
  1452. UCHAR Control;
  1453. } NEC_READ_CDDA, *PNEC_READ_CDDA;
  1454. //
  1455. // Mode sense
  1456. //
  1457. struct _MODE_SENSE {
  1458. UCHAR OperationCode; // 0x1A - SCSIOP_MODE_SENSE
  1459. UCHAR Reserved1 : 3;
  1460. UCHAR Dbd : 1;
  1461. UCHAR Reserved2 : 1;
  1462. UCHAR LogicalUnitNumber : 3;
  1463. UCHAR PageCode : 6;
  1464. UCHAR Pc : 2;
  1465. UCHAR Reserved3;
  1466. UCHAR AllocationLength;
  1467. UCHAR Control;
  1468. } MODE_SENSE, *PMODE_SENSE;
  1469. struct _MODE_SENSE10 {
  1470. UCHAR OperationCode; // 0x5A - SCSIOP_MODE_SENSE10
  1471. UCHAR Reserved1 : 3;
  1472. UCHAR Dbd : 1;
  1473. UCHAR Reserved2 : 1;
  1474. UCHAR LogicalUnitNumber : 3;
  1475. UCHAR PageCode : 6;
  1476. UCHAR Pc : 2;
  1477. UCHAR Reserved3[4];
  1478. UCHAR AllocationLength[2];
  1479. UCHAR Control;
  1480. } MODE_SENSE10, *PMODE_SENSE10;
  1481. //
  1482. // Mode select
  1483. //
  1484. struct _MODE_SELECT {
  1485. UCHAR OperationCode; // 0x15 - SCSIOP_MODE_SELECT
  1486. UCHAR SPBit : 1;
  1487. UCHAR Reserved1 : 3;
  1488. UCHAR PFBit : 1;
  1489. UCHAR LogicalUnitNumber : 3;
  1490. UCHAR Reserved2[2];
  1491. UCHAR ParameterListLength;
  1492. UCHAR Control;
  1493. } MODE_SELECT, *PMODE_SELECT;
  1494. struct _MODE_SELECT10 {
  1495. UCHAR OperationCode; // 0x55 - SCSIOP_MODE_SELECT10
  1496. UCHAR SPBit : 1;
  1497. UCHAR Reserved1 : 3;
  1498. UCHAR PFBit : 1;
  1499. UCHAR LogicalUnitNumber : 3;
  1500. UCHAR Reserved2[5];
  1501. UCHAR ParameterListLength[2];
  1502. UCHAR Control;
  1503. } MODE_SELECT10, *PMODE_SELECT10;
  1504. struct _LOCATE {
  1505. UCHAR OperationCode; // 0x2B - SCSIOP_LOCATE
  1506. UCHAR Immediate : 1;
  1507. UCHAR CPBit : 1;
  1508. UCHAR BTBit : 1;
  1509. UCHAR Reserved1 : 2;
  1510. UCHAR LogicalUnitNumber : 3;
  1511. UCHAR Reserved3;
  1512. UCHAR LogicalBlockAddress[4];
  1513. UCHAR Reserved4;
  1514. UCHAR Partition;
  1515. UCHAR Control;
  1516. } LOCATE, *PLOCATE;
  1517. struct _LOGSENSE {
  1518. UCHAR OperationCode; // 0x4D - SCSIOP_LOG_SENSE
  1519. UCHAR SPBit : 1;
  1520. UCHAR PPCBit : 1;
  1521. UCHAR Reserved1 : 3;
  1522. UCHAR LogicalUnitNumber : 3;
  1523. UCHAR PageCode : 6;
  1524. UCHAR PCBit : 2;
  1525. UCHAR Reserved2;
  1526. UCHAR Reserved3;
  1527. UCHAR ParameterPointer[2];
  1528. UCHAR AllocationLength[2];
  1529. UCHAR Control;
  1530. } LOGSENSE, *PLOGSENSE;
  1531. struct _LOGSELECT {
  1532. UCHAR OperationCode; // 0x4C - SCSIOP_LOG_SELECT
  1533. UCHAR SPBit : 1;
  1534. UCHAR PCRBit : 1;
  1535. UCHAR Reserved1 : 3;
  1536. UCHAR LogicalUnitNumber : 3;
  1537. UCHAR Reserved : 6;
  1538. UCHAR PCBit : 2;
  1539. UCHAR Reserved2[4];
  1540. UCHAR ParameterListLength[2];
  1541. UCHAR Control;
  1542. } LOGSELECT, *PLOGSELECT;
  1543. struct _PRINT {
  1544. UCHAR OperationCode; // 0x0A - SCSIOP_PRINT
  1545. UCHAR Reserved : 5;
  1546. UCHAR LogicalUnitNumber : 3;
  1547. UCHAR TransferLength[3];
  1548. UCHAR Control;
  1549. } PRINT, *PPRINT;
  1550. struct _SEEK {
  1551. UCHAR OperationCode; // 0x2B - SCSIOP_SEEK
  1552. UCHAR Reserved1 : 5;
  1553. UCHAR LogicalUnitNumber : 3;
  1554. UCHAR LogicalBlockAddress[4];
  1555. UCHAR Reserved2[3];
  1556. UCHAR Control;
  1557. } SEEK, *PSEEK;
  1558. struct _ERASE {
  1559. UCHAR OperationCode; // 0x19 - SCSIOP_ERASE
  1560. UCHAR Long : 1;
  1561. UCHAR Immediate : 1;
  1562. UCHAR Reserved1 : 3;
  1563. UCHAR LogicalUnitNumber : 3;
  1564. UCHAR Reserved2[3];
  1565. UCHAR Control;
  1566. } ERASE, *PERASE;
  1567. struct _START_STOP {
  1568. UCHAR OperationCode; // 0x1B - SCSIOP_START_STOP_UNIT
  1569. UCHAR Immediate: 1;
  1570. UCHAR Reserved1 : 4;
  1571. UCHAR LogicalUnitNumber : 3;
  1572. UCHAR Reserved2[2];
  1573. UCHAR Start : 1;
  1574. UCHAR LoadEject : 1;
  1575. UCHAR Reserved3 : 6;
  1576. UCHAR Control;
  1577. } START_STOP, *PSTART_STOP;
  1578. struct _MEDIA_REMOVAL {
  1579. UCHAR OperationCode; // 0x1E - SCSIOP_MEDIUM_REMOVAL
  1580. UCHAR Reserved1 : 5;
  1581. UCHAR LogicalUnitNumber : 3;
  1582. UCHAR Reserved2[2];
  1583. UCHAR Prevent : 1;
  1584. UCHAR Persistant : 1;
  1585. UCHAR Reserved3 : 6;
  1586. UCHAR Control;
  1587. } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
  1588. //
  1589. // Tape CDBs
  1590. //
  1591. struct _SEEK_BLOCK {
  1592. UCHAR OperationCode; // 0x0C - SCSIOP_SEEK_BLOCK
  1593. UCHAR Immediate : 1;
  1594. UCHAR Reserved1 : 7;
  1595. UCHAR BlockAddress[3];
  1596. UCHAR Link : 1;
  1597. UCHAR Flag : 1;
  1598. UCHAR Reserved2 : 4;
  1599. UCHAR VendorUnique : 2;
  1600. } SEEK_BLOCK, *PSEEK_BLOCK;
  1601. struct _REQUEST_BLOCK_ADDRESS {
  1602. UCHAR OperationCode; // 0x02 - SCSIOP_REQUEST_BLOCK_ADDR
  1603. UCHAR Reserved1[3];
  1604. UCHAR AllocationLength;
  1605. UCHAR Link : 1;
  1606. UCHAR Flag : 1;
  1607. UCHAR Reserved2 : 4;
  1608. UCHAR VendorUnique : 2;
  1609. } REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
  1610. struct _PARTITION {
  1611. UCHAR OperationCode; // 0x0D - SCSIOP_PARTITION
  1612. UCHAR Immediate : 1;
  1613. UCHAR Sel: 1;
  1614. UCHAR PartitionSelect : 6;
  1615. UCHAR Reserved1[3];
  1616. UCHAR Control;
  1617. } PARTITION, *PPARTITION;
  1618. struct _WRITE_TAPE_MARKS {
  1619. UCHAR OperationCode; // Unknown -- vendor-unique?
  1620. UCHAR Immediate : 1;
  1621. UCHAR WriteSetMarks: 1;
  1622. UCHAR Reserved : 3;
  1623. UCHAR LogicalUnitNumber : 3;
  1624. UCHAR TransferLength[3];
  1625. UCHAR Control;
  1626. } WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
  1627. struct _SPACE_TAPE_MARKS {
  1628. UCHAR OperationCode; // Unknown -- vendor-unique?
  1629. UCHAR Code : 3;
  1630. UCHAR Reserved : 2;
  1631. UCHAR LogicalUnitNumber : 3;
  1632. UCHAR NumMarksMSB ;
  1633. UCHAR NumMarks;
  1634. UCHAR NumMarksLSB;
  1635. union {
  1636. UCHAR value;
  1637. struct {
  1638. UCHAR Link : 1;
  1639. UCHAR Flag : 1;
  1640. UCHAR Reserved : 4;
  1641. UCHAR VendorUnique : 2;
  1642. } Fields;
  1643. } Byte6;
  1644. } SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
  1645. //
  1646. // Read tape position
  1647. //
  1648. struct _READ_POSITION {
  1649. UCHAR Operation; // 0x43 - SCSIOP_READ_POSITION
  1650. UCHAR BlockType:1;
  1651. UCHAR Reserved1:4;
  1652. UCHAR Lun:3;
  1653. UCHAR Reserved2[7];
  1654. UCHAR Control;
  1655. } READ_POSITION, *PREAD_POSITION;
  1656. //
  1657. // ReadWrite for Tape
  1658. //
  1659. struct _CDB6READWRITETAPE {
  1660. UCHAR OperationCode; // Unknown -- vendor-unique?
  1661. UCHAR VendorSpecific : 5;
  1662. UCHAR Reserved : 3;
  1663. UCHAR TransferLenMSB;
  1664. UCHAR TransferLen;
  1665. UCHAR TransferLenLSB;
  1666. UCHAR Link : 1;
  1667. UCHAR Flag : 1;
  1668. UCHAR Reserved1 : 4;
  1669. UCHAR VendorUnique : 2;
  1670. } CDB6READWRITETAPE, *PCDB6READWRITETAPE;
  1671. //
  1672. // Medium changer CDB's
  1673. //
  1674. struct _INIT_ELEMENT_STATUS {
  1675. UCHAR OperationCode; // 0x07 - SCSIOP_INIT_ELEMENT_STATUS
  1676. UCHAR Reserved1 : 5;
  1677. UCHAR LogicalUnitNubmer : 3;
  1678. UCHAR Reserved2[3];
  1679. UCHAR Reserved3 : 7;
  1680. UCHAR NoBarCode : 1;
  1681. } INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
  1682. struct _INITIALIZE_ELEMENT_RANGE {
  1683. UCHAR OperationCode; // 0xE7 - SCSIOP_INIT_ELEMENT_RANGE
  1684. UCHAR Range : 1;
  1685. UCHAR Reserved1 : 4;
  1686. UCHAR LogicalUnitNubmer : 3;
  1687. UCHAR FirstElementAddress[2];
  1688. UCHAR Reserved2[2];
  1689. UCHAR NumberOfElements[2];
  1690. UCHAR Reserved3;
  1691. UCHAR Reserved4 : 7;
  1692. UCHAR NoBarCode : 1;
  1693. } INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
  1694. struct _POSITION_TO_ELEMENT {
  1695. UCHAR OperationCode; // 0x2B - SCSIOP_POSITION_TO_ELEMENT
  1696. UCHAR Reserved1 : 5;
  1697. UCHAR LogicalUnitNumber : 3;
  1698. UCHAR TransportElementAddress[2];
  1699. UCHAR DestinationElementAddress[2];
  1700. UCHAR Reserved2[2];
  1701. UCHAR Flip : 1;
  1702. UCHAR Reserved3 : 7;
  1703. UCHAR Control;
  1704. } POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
  1705. struct _MOVE_MEDIUM {
  1706. UCHAR OperationCode; // 0xA5 - SCSIOP_MOVE_MEDIUM
  1707. UCHAR Reserved1 : 5;
  1708. UCHAR LogicalUnitNumber : 3;
  1709. UCHAR TransportElementAddress[2];
  1710. UCHAR SourceElementAddress[2];
  1711. UCHAR DestinationElementAddress[2];
  1712. UCHAR Reserved2[2];
  1713. UCHAR Flip : 1;
  1714. UCHAR Reserved3 : 7;
  1715. UCHAR Control;
  1716. } MOVE_MEDIUM, *PMOVE_MEDIUM;
  1717. struct _EXCHANGE_MEDIUM {
  1718. UCHAR OperationCode; // 0xA6 - SCSIOP_EXCHANGE_MEDIUM
  1719. UCHAR Reserved1 : 5;
  1720. UCHAR LogicalUnitNumber : 3;
  1721. UCHAR TransportElementAddress[2];
  1722. UCHAR SourceElementAddress[2];
  1723. UCHAR Destination1ElementAddress[2];
  1724. UCHAR Destination2ElementAddress[2];
  1725. UCHAR Flip1 : 1;
  1726. UCHAR Flip2 : 1;
  1727. UCHAR Reserved3 : 6;
  1728. UCHAR Control;
  1729. } EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
  1730. struct _READ_ELEMENT_STATUS {
  1731. UCHAR OperationCode; // 0xB8 - SCSIOP_READ_ELEMENT_STATUS
  1732. UCHAR ElementType : 4;
  1733. UCHAR VolTag : 1;
  1734. UCHAR LogicalUnitNumber : 3;
  1735. UCHAR StartingElementAddress[2];
  1736. UCHAR NumberOfElements[2];
  1737. UCHAR Reserved1;
  1738. UCHAR AllocationLength[3];
  1739. UCHAR Reserved2;
  1740. UCHAR Control;
  1741. } READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
  1742. struct _SEND_VOLUME_TAG {
  1743. UCHAR OperationCode; // 0xB6 - SCSIOP_SEND_VOLUME_TAG
  1744. UCHAR ElementType : 4;
  1745. UCHAR Reserved1 : 1;
  1746. UCHAR LogicalUnitNumber : 3;
  1747. UCHAR StartingElementAddress[2];
  1748. UCHAR Reserved2;
  1749. UCHAR ActionCode : 5;
  1750. UCHAR Reserved3 : 3;
  1751. UCHAR Reserved4[2];
  1752. UCHAR ParameterListLength[2];
  1753. UCHAR Reserved5;
  1754. UCHAR Control;
  1755. } SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
  1756. struct _REQUEST_VOLUME_ELEMENT_ADDRESS {
  1757. UCHAR OperationCode; // Unknown -- vendor-unique?
  1758. UCHAR ElementType : 4;
  1759. UCHAR VolTag : 1;
  1760. UCHAR LogicalUnitNumber : 3;
  1761. UCHAR StartingElementAddress[2];
  1762. UCHAR NumberElements[2];
  1763. UCHAR Reserved1;
  1764. UCHAR AllocationLength[3];
  1765. UCHAR Reserved2;
  1766. UCHAR Control;
  1767. } REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
  1768. //
  1769. // Atapi 2.5 Changer 12-byte CDBs
  1770. //
  1771. struct _LOAD_UNLOAD {
  1772. UCHAR OperationCode; // 0xA6 - SCSIOP_LOAD_UNLOAD_SLOT
  1773. UCHAR Immediate : 1;
  1774. UCHAR Reserved1 : 4;
  1775. UCHAR Lun : 3;
  1776. UCHAR Reserved2[2];
  1777. UCHAR Start : 1;
  1778. UCHAR LoadEject : 1;
  1779. UCHAR Reserved3: 6;
  1780. UCHAR Reserved4[3];
  1781. UCHAR Slot;
  1782. UCHAR Reserved5[3];
  1783. } LOAD_UNLOAD, *PLOAD_UNLOAD;
  1784. struct _MECH_STATUS {
  1785. UCHAR OperationCode; // 0xBD - SCSIOP_MECHANISM_STATUS
  1786. UCHAR Reserved : 5;
  1787. UCHAR Lun : 3;
  1788. UCHAR Reserved1[6];
  1789. UCHAR AllocationLength[2];
  1790. UCHAR Reserved2[1];
  1791. UCHAR Control;
  1792. } MECH_STATUS, *PMECH_STATUS;
  1793. //
  1794. // C/DVD 0.9 CDBs
  1795. //
  1796. struct _SYNCHRONIZE_CACHE10 {
  1797. UCHAR OperationCode; // 0x35 - SCSIOP_SYNCHRONIZE_CACHE
  1798. UCHAR RelAddr : 1;
  1799. UCHAR Immediate : 1;
  1800. UCHAR Reserved : 3;
  1801. UCHAR Lun : 3;
  1802. UCHAR LogicalBlockAddress[4]; // Unused - set to zero
  1803. UCHAR Reserved2;
  1804. UCHAR BlockCount[2]; // Unused - set to zero
  1805. UCHAR Control;
  1806. } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
  1807. struct _GET_EVENT_STATUS_NOTIFICATION {
  1808. UCHAR OperationCode; // 0x4A - SCSIOP_GET_EVENT_STATUS_NOTIFICATION
  1809. UCHAR Immediate : 1;
  1810. UCHAR Reserved : 4;
  1811. UCHAR Lun : 3;
  1812. UCHAR Reserved2[2];
  1813. UCHAR NotificationClassRequest;
  1814. UCHAR Reserved3[2];
  1815. UCHAR EventListLength[2];
  1816. UCHAR Control;
  1817. } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
  1818. struct _READ_DVD_STRUCTURE {
  1819. UCHAR OperationCode; // 0xAD - SCSIOP_READ_DVD_STRUCTURE
  1820. UCHAR Reserved1 : 5;
  1821. UCHAR Lun : 3;
  1822. UCHAR RMDBlockNumber[4];
  1823. UCHAR LayerNumber;
  1824. UCHAR Format;
  1825. UCHAR AllocationLength[2];
  1826. UCHAR Reserved3 : 6;
  1827. UCHAR AGID : 2;
  1828. UCHAR Control;
  1829. } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
  1830. struct _SEND_DVD_STRUCTURE {
  1831. UCHAR OperationCode; // 0xBF - SCSIOP_SEND_DVD_STRUCTURE
  1832. UCHAR Reserved1 : 5;
  1833. UCHAR Lun : 3;
  1834. UCHAR Reserved2[5];
  1835. UCHAR Format;
  1836. UCHAR ParameterListLength[2];
  1837. UCHAR Reserved3;
  1838. UCHAR Control;
  1839. } SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
  1840. struct _SEND_KEY {
  1841. UCHAR OperationCode; // 0xA3 - SCSIOP_SEND_KEY
  1842. UCHAR Reserved1 : 5;
  1843. UCHAR Lun : 3;
  1844. UCHAR Reserved2[6];
  1845. UCHAR ParameterListLength[2];
  1846. UCHAR KeyFormat : 6;
  1847. UCHAR AGID : 2;
  1848. UCHAR Control;
  1849. } SEND_KEY, *PSEND_KEY;
  1850. struct _REPORT_KEY {
  1851. UCHAR OperationCode; // 0xA4 - SCSIOP_REPORT_KEY
  1852. UCHAR Reserved1 : 5;
  1853. UCHAR Lun : 3;
  1854. UCHAR LogicalBlockAddress[4]; // for title key
  1855. UCHAR Reserved2[2];
  1856. UCHAR AllocationLength[2];
  1857. UCHAR KeyFormat : 6;
  1858. UCHAR AGID : 2;
  1859. UCHAR Control;
  1860. } REPORT_KEY, *PREPORT_KEY;
  1861. struct _SET_READ_AHEAD {
  1862. UCHAR OperationCode; // 0xA7 - SCSIOP_SET_READ_AHEAD
  1863. UCHAR Reserved1 : 5;
  1864. UCHAR Lun : 3;
  1865. UCHAR TriggerLBA[4];
  1866. UCHAR ReadAheadLBA[4];
  1867. UCHAR Reserved2;
  1868. UCHAR Control;
  1869. } SET_READ_AHEAD, *PSET_READ_AHEAD;
  1870. struct _READ_FORMATTED_CAPACITIES {
  1871. UCHAR OperationCode; // 0x23 - SCSIOP_READ_FORMATTED_CAPACITY
  1872. UCHAR Reserved1 : 5;
  1873. UCHAR Lun : 3;
  1874. UCHAR Reserved2[5];
  1875. UCHAR AllocationLength[2];
  1876. UCHAR Control;
  1877. } READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
  1878. //
  1879. // SCSI-3
  1880. //
  1881. struct _REPORT_LUNS {
  1882. UCHAR OperationCode; // 0xA0 - SCSIOP_REPORT_LUNS
  1883. UCHAR Reserved1[5];
  1884. UCHAR AllocationLength[4];
  1885. UCHAR Reserved2[1];
  1886. UCHAR Control;
  1887. } REPORT_LUNS, *PREPORT_LUNS;
  1888. struct _PERSISTENT_RESERVE_IN {
  1889. UCHAR OperationCode; // 0x5E - SCSIOP_PERSISTENT_RESERVE_IN
  1890. UCHAR ServiceAction : 5;
  1891. UCHAR Reserved1 : 3;
  1892. UCHAR Reserved2[5];
  1893. UCHAR AllocationLength[2];
  1894. UCHAR Control;
  1895. } PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
  1896. struct _PERSISTENT_RESERVE_OUT {
  1897. UCHAR OperationCode; // 0x5F - SCSIOP_PERSISTENT_RESERVE_OUT
  1898. UCHAR ServiceAction : 5;
  1899. UCHAR Reserved1 : 3;
  1900. UCHAR Type : 4;
  1901. UCHAR Scope : 4;
  1902. UCHAR Reserved2[4];
  1903. UCHAR ParameterListLength[2]; // 0x18
  1904. UCHAR Control;
  1905. } PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
  1906. //
  1907. // MMC / SFF-8090 commands
  1908. //
  1909. struct _GET_CONFIGURATION {
  1910. UCHAR OperationCode; // 0x46 - SCSIOP_GET_CONFIGURATION
  1911. UCHAR RequestType : 1; // SCSI_GET_CONFIGURATION_REQUEST_TYPE_*
  1912. UCHAR Reserved1 : 7; // includes obsolete LUN field
  1913. UCHAR StartingFeature[2];
  1914. UCHAR Reserved2[3];
  1915. UCHAR AllocationLength[2];
  1916. UCHAR Control;
  1917. } GET_CONFIGURATION, *PGET_CONFIGURATION;
  1918. struct _SET_CD_SPEED {
  1919. UCHAR OperationCode; // 0xB8 - SCSIOP_SET_CD_SPEED
  1920. UCHAR Reserved1;
  1921. UCHAR ReadSpeed[2]; // 1x == (75 * 2352)
  1922. UCHAR WriteSpeed[2]; // 1x == (75 * 2352)
  1923. UCHAR Reserved2[5];
  1924. UCHAR Control;
  1925. } SET_CD_SPEED, *PSET_CD_SPEED;
  1926. ULONG AsUlong[4];
  1927. UCHAR AsByte[16];
  1928. } CDB, *PCDB;
  1929. ////////////////////////////////////////////////////////////////////////////////
  1930. //
  1931. // GET_EVENT_STATUS_NOTIFICATION
  1932. //
  1933. #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02
  1934. #define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04
  1935. #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08
  1936. #define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10
  1937. #define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20
  1938. #define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40
  1939. #define NOTIFICATION_NO_CLASS_EVENTS 0x0
  1940. #define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1
  1941. #define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2
  1942. #define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3
  1943. #define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4
  1944. #define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5
  1945. #define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6
  1946. typedef struct _NOTIFICATION_EVENT_STATUS_HEADER {
  1947. UCHAR EventDataLength[2];
  1948. UCHAR NotificationClass : 3;
  1949. UCHAR Reserved : 4;
  1950. UCHAR NEA : 1;
  1951. UCHAR SupportedEventClasses;
  1952. UCHAR ClassEventData[0];
  1953. } NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER;
  1954. #define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0
  1955. #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1
  1956. #define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2
  1957. #define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0
  1958. #define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1
  1959. #define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2
  1960. #define NOTIFICATION_OPERATIONAL_OPCODE_NONE
  1961. #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1
  1962. #define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2
  1963. #define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3
  1964. #define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4
  1965. #define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5
  1966. //
  1967. // Class event data may be one (or none) of the following:
  1968. //
  1969. typedef struct _NOTIFICATION_OPERATIONAL_STATUS { // event class == 0x1
  1970. UCHAR OperationalEvent : 4;
  1971. UCHAR Reserved1 : 4;
  1972. UCHAR OperationalStatus : 4;
  1973. UCHAR Reserved2 : 3;
  1974. UCHAR PersistentPrevented : 1;
  1975. UCHAR Operation[2];
  1976. } NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS;
  1977. #define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0
  1978. #define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1
  1979. #define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2
  1980. #define NOTIFICATION_POWER_STATUS_ACTIVE 0x1
  1981. #define NOTIFICATION_POWER_STATUS_IDLE 0x2
  1982. #define NOTIFICATION_POWER_STATUS_STANDBY 0x3
  1983. #define NOTIFICATION_POWER_STATUS_SLEEP 0x4
  1984. typedef struct _NOTIFICATION_POWER_STATUS { // event class == 0x2
  1985. UCHAR PowerEvent : 4;
  1986. UCHAR Reserved : 4;
  1987. UCHAR PowerStatus;
  1988. UCHAR Reserved2[2];
  1989. } NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS;
  1990. #define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0
  1991. #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1
  1992. #define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2
  1993. #define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3 // respond with GET_CONFIGURATION?
  1994. #define NOTIFICATION_EXTERNAL_STATUS_READY 0x0
  1995. #define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1
  1996. #define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000
  1997. #define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001
  1998. #define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101
  1999. #define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102
  2000. #define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103
  2001. #define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104
  2002. #define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106
  2003. #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200
  2004. #define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff
  2005. typedef struct _NOTIFICATION_EXTERNAL_STATUS { // event class == 0x3
  2006. UCHAR ExternalEvent : 4;
  2007. UCHAR Reserved1 : 4;
  2008. UCHAR ExternalStatus : 4;
  2009. UCHAR Reserved2 : 3;
  2010. UCHAR PersistentPrevented : 1;
  2011. UCHAR Request[2];
  2012. } NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS;
  2013. #define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0
  2014. #define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1
  2015. #define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2
  2016. #define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3
  2017. #define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4
  2018. typedef struct _NOTIFICATION_MEDIA_STATUS { // event class == 0x4
  2019. UCHAR MediaEvent : 4;
  2020. UCHAR Reserved : 4;
  2021. union {
  2022. UCHAR PowerStatus; // OBSOLETE -- was improperly named in NT5 headers
  2023. UCHAR MediaStatus; // Use this for currently reserved fields
  2024. struct {
  2025. UCHAR DoorTrayOpen : 1;
  2026. UCHAR MediaPresent : 1;
  2027. UCHAR ReservedX : 6; // do not reference this directly!
  2028. };
  2029. };
  2030. UCHAR StartSlot;
  2031. UCHAR EndSlot;
  2032. } NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS;
  2033. #define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0
  2034. #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1
  2035. #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2
  2036. #define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3
  2037. #define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0
  2038. #define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1
  2039. #define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0
  2040. #define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1
  2041. #define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2
  2042. #define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3
  2043. typedef struct _NOTIFICATION_MULTI_HOST_STATUS { // event class == 0x5
  2044. UCHAR MultiHostEvent : 4;
  2045. UCHAR Reserved1 : 4;
  2046. UCHAR MultiHostStatus : 4;
  2047. UCHAR Reserved2 : 3;
  2048. UCHAR PersistentPrevented : 1;
  2049. UCHAR Priority[2];
  2050. } NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS;
  2051. #define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0
  2052. #define NOTIFICATION_BUSY_EVENT_BUSY 0x1
  2053. #define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0
  2054. #define NOTIFICATION_BUSY_STATUS_POWER 0x1
  2055. #define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2
  2056. #define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3
  2057. typedef struct _NOTIFICATION_BUSY_STATUS { // event class == 0x6
  2058. UCHAR DeviceBusyEvent : 4;
  2059. UCHAR Reserved : 4;
  2060. UCHAR DeviceBusyStatus;
  2061. UCHAR Time[2];
  2062. } NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS;
  2063. ////////////////////////////////////////////////////////////////////////////////
  2064. //
  2065. // Read DVD Structure Definitions and Constants
  2066. //
  2067. #define DVD_FORMAT_LEAD_IN 0x00
  2068. #define DVD_FORMAT_COPYRIGHT 0x01
  2069. #define DVD_FORMAT_DISK_KEY 0x02
  2070. #define DVD_FORMAT_BCA 0x03
  2071. #define DVD_FORMAT_MANUFACTURING 0x04
  2072. typedef struct _READ_DVD_STRUCTURES_HEADER {
  2073. UCHAR Length[2];
  2074. UCHAR Reserved[2];
  2075. UCHAR Data[0];
  2076. } READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER;
  2077. //
  2078. // DiskKey, BCA & Manufacturer information will provide byte arrays as their
  2079. // data.
  2080. //
  2081. //
  2082. // CDVD 0.9 Send & Report Key Definitions and Structures
  2083. //
  2084. #define DVD_REPORT_AGID 0x00
  2085. #define DVD_CHALLENGE_KEY 0x01
  2086. #define DVD_KEY_1 0x02
  2087. #define DVD_KEY_2 0x03
  2088. #define DVD_TITLE_KEY 0x04
  2089. #define DVD_REPORT_ASF 0x05
  2090. #define DVD_INVALIDATE_AGID 0x3F
  2091. typedef struct _CDVD_KEY_HEADER {
  2092. UCHAR DataLength[2];
  2093. UCHAR Reserved[2];
  2094. UCHAR Data[0];
  2095. } CDVD_KEY_HEADER, *PCDVD_KEY_HEADER;
  2096. typedef struct _CDVD_REPORT_AGID_DATA {
  2097. UCHAR Reserved1[3];
  2098. UCHAR Reserved2 : 6;
  2099. UCHAR AGID : 2;
  2100. } CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA;
  2101. typedef struct _CDVD_CHALLENGE_KEY_DATA {
  2102. UCHAR ChallengeKeyValue[10];
  2103. UCHAR Reserved[2];
  2104. } CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA;
  2105. typedef struct _CDVD_KEY_DATA {
  2106. UCHAR Key[5];
  2107. UCHAR Reserved[3];
  2108. } CDVD_KEY_DATA, *PCDVD_KEY_DATA;
  2109. typedef struct _CDVD_REPORT_ASF_DATA {
  2110. UCHAR Reserved1[3];
  2111. UCHAR Success : 1;
  2112. UCHAR Reserved2 : 7;
  2113. } CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA;
  2114. typedef struct _CDVD_TITLE_KEY_HEADER {
  2115. UCHAR DataLength[2];
  2116. UCHAR Reserved1[1];
  2117. UCHAR Reserved2 : 3;
  2118. UCHAR CGMS : 2;
  2119. UCHAR CP_SEC : 1;
  2120. UCHAR CPM : 1;
  2121. UCHAR Zero : 1;
  2122. CDVD_KEY_DATA TitleKey;
  2123. } CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER;
  2124. //
  2125. // Read Formatted Capacity Data - returned in Big Endian Format
  2126. //
  2127. typedef struct _FORMATTED_CAPACITY_DESCRIPTOR {
  2128. UCHAR NumberOfBlocks[4];
  2129. UCHAR Maximum : 1;
  2130. UCHAR Valid : 1;
  2131. UCHAR BlockLength[3];
  2132. } FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR;
  2133. typedef struct _FORMATTED_CAPACITY_LIST {
  2134. UCHAR Reserved[3];
  2135. UCHAR CapacityListLength;
  2136. FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0];
  2137. } FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST;
  2138. //
  2139. // PLAY_CD definitions and constants
  2140. //
  2141. #define CD_EXPECTED_SECTOR_ANY 0x0
  2142. #define CD_EXPECTED_SECTOR_CDDA 0x1
  2143. #define CD_EXPECTED_SECTOR_MODE1 0x2
  2144. #define CD_EXPECTED_SECTOR_MODE2 0x3
  2145. #define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4
  2146. #define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5
  2147. //
  2148. // Read Disk Information Definitions and Capabilities
  2149. //
  2150. #define DISK_STATUS_EMPTY 0x00
  2151. #define DISK_STATUS_INCOMPLETE 0x01
  2152. #define DISK_STATUS_COMPLETE 0x02
  2153. #define LAST_SESSION_EMPTY 0x00
  2154. #define LAST_SESSION_INCOMPLETE 0x01
  2155. #define LAST_SESSION_COMPLETE 0x03
  2156. #define DISK_TYPE_CDDA 0x01
  2157. #define DISK_TYPE_CDI 0x10
  2158. #define DISK_TYPE_XA 0x20
  2159. #define DISK_TYPE_UNDEFINED 0xFF
  2160. typedef struct _OPC_TABLE_ENTRY {
  2161. UCHAR Speed[2];
  2162. UCHAR OPCValue[6];
  2163. } OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY;
  2164. typedef struct _DISK_INFORMATION {
  2165. UCHAR Length[2];
  2166. UCHAR DiskStatus : 2;
  2167. UCHAR LastSessionStatus : 2;
  2168. UCHAR Erasable : 1;
  2169. UCHAR Reserved1 : 3;
  2170. UCHAR FirstTrackNumber;
  2171. UCHAR NumberOfSessions;
  2172. UCHAR LastSessionFirstTrack;
  2173. UCHAR LastSessionLastTrack;
  2174. UCHAR Reserved2 : 5;
  2175. UCHAR GEN : 1;
  2176. UCHAR DBC_V : 1;
  2177. UCHAR DID_V : 1;
  2178. UCHAR DiskType;
  2179. UCHAR Reserved3[3];
  2180. UCHAR DiskIdentification[4];
  2181. UCHAR LastSessionLeadIn[4]; // MSF
  2182. UCHAR LastPossibleStartTime[4]; // MSF
  2183. UCHAR DiskBarCode[8];
  2184. UCHAR Reserved4;
  2185. UCHAR NumberOPCEntries;
  2186. OPC_TABLE_ENTRY OPCTable[0];
  2187. } DISK_INFORMATION, *PDISK_INFORMATION;
  2188. //
  2189. // Read Header definitions and structures
  2190. //
  2191. typedef struct _DATA_BLOCK_HEADER {
  2192. UCHAR DataMode;
  2193. UCHAR Reserved[4];
  2194. union {
  2195. UCHAR LogicalBlockAddress[4];
  2196. struct {
  2197. UCHAR Reserved;
  2198. UCHAR M;
  2199. UCHAR S;
  2200. UCHAR F;
  2201. } MSF;
  2202. };
  2203. } DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER;
  2204. #define DATA_BLOCK_MODE0 0x0
  2205. #define DATA_BLOCK_MODE1 0x1
  2206. #define DATA_BLOCK_MODE2 0x2
  2207. //
  2208. // Read TOC Format Codes
  2209. //
  2210. #define READ_TOC_FORMAT_TOC 0x00
  2211. #define READ_TOC_FORMAT_SESSION 0x01
  2212. #define READ_TOC_FORMAT_FULL_TOC 0x02
  2213. #define READ_TOC_FORMAT_PMA 0x03
  2214. #define READ_TOC_FORMAT_ATIP 0x04
  2215. typedef struct _TRACK_INFORMATION {
  2216. UCHAR Length[2];
  2217. UCHAR TrackNumber;
  2218. UCHAR SessionNumber;
  2219. UCHAR Reserved1;
  2220. UCHAR TrackMode : 4;
  2221. UCHAR Copy : 1;
  2222. UCHAR Damage : 1;
  2223. UCHAR Reserved2 : 2;
  2224. UCHAR DataMode : 4;
  2225. UCHAR FP : 1;
  2226. UCHAR Packet : 1;
  2227. UCHAR Blank : 1;
  2228. UCHAR RT : 1;
  2229. UCHAR NWA_V : 1;
  2230. UCHAR Reserved3 : 7;
  2231. UCHAR TrackStartAddress[4];
  2232. UCHAR NextWritableAddress[4];
  2233. UCHAR FreeBlocks[4];
  2234. UCHAR FixedPacketSize[4];
  2235. } TRACK_INFORMATION, *PTRACK_INFORMATION;
  2236. //
  2237. // Command Descriptor Block constants.
  2238. //
  2239. #define CDB6GENERIC_LENGTH 6
  2240. #define CDB10GENERIC_LENGTH 10
  2241. #define CDB12GENERIC_LENGTH 12
  2242. #define SETBITON 1
  2243. #define SETBITOFF 0
  2244. //
  2245. // Mode Sense/Select page constants.
  2246. //
  2247. #define MODE_PAGE_ERROR_RECOVERY 0x01
  2248. #define MODE_PAGE_DISCONNECT 0x02
  2249. #define MODE_PAGE_FORMAT_DEVICE 0x03
  2250. #define MODE_PAGE_RIGID_GEOMETRY 0x04
  2251. #define MODE_PAGE_FLEXIBILE 0x05 // disk
  2252. #define MODE_PAGE_WRITE_PARAMETERS 0x05 // cdrom
  2253. #define MODE_PAGE_VERIFY_ERROR 0x07
  2254. #define MODE_PAGE_CACHING 0x08
  2255. #define MODE_PAGE_PERIPHERAL 0x09
  2256. #define MODE_PAGE_CONTROL 0x0A
  2257. #define MODE_PAGE_MEDIUM_TYPES 0x0B
  2258. #define MODE_PAGE_NOTCH_PARTITION 0x0C
  2259. #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
  2260. #define MODE_PAGE_DATA_COMPRESS 0x0F
  2261. #define MODE_PAGE_DEVICE_CONFIG 0x10
  2262. #define MODE_PAGE_MEDIUM_PARTITION 0x11
  2263. #define MODE_PAGE_CDVD_FEATURE_SET 0x18
  2264. #define MODE_PAGE_POWER_CONDITION 0x1A
  2265. #define MODE_PAGE_FAULT_REPORTING 0x1C
  2266. #define MODE_PAGE_CDVD_INACTIVITY 0x1D // cdrom
  2267. #define MODE_PAGE_ELEMENT_ADDRESS 0x1D
  2268. #define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
  2269. #define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
  2270. #define MODE_PAGE_CAPABILITIES 0x2A // cdrom
  2271. #define MODE_SENSE_RETURN_ALL 0x3f
  2272. #define MODE_SENSE_CURRENT_VALUES 0x00
  2273. #define MODE_SENSE_CHANGEABLE_VALUES 0x40
  2274. #define MODE_SENSE_DEFAULT_VAULES 0x80
  2275. #define MODE_SENSE_SAVED_VALUES 0xc0
  2276. //
  2277. // SCSI CDB operation codes
  2278. //
  2279. // 6-byte commands:
  2280. #define SCSIOP_TEST_UNIT_READY 0x00
  2281. #define SCSIOP_REZERO_UNIT 0x01
  2282. #define SCSIOP_REWIND 0x01
  2283. #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
  2284. #define SCSIOP_REQUEST_SENSE 0x03
  2285. #define SCSIOP_FORMAT_UNIT 0x04
  2286. #define SCSIOP_READ_BLOCK_LIMITS 0x05
  2287. #define SCSIOP_REASSIGN_BLOCKS 0x07
  2288. #define SCSIOP_INIT_ELEMENT_STATUS 0x07
  2289. #define SCSIOP_READ6 0x08
  2290. #define SCSIOP_RECEIVE 0x08
  2291. #define SCSIOP_WRITE6 0x0A
  2292. #define SCSIOP_PRINT 0x0A
  2293. #define SCSIOP_SEND 0x0A
  2294. #define SCSIOP_SEEK6 0x0B
  2295. #define SCSIOP_TRACK_SELECT 0x0B
  2296. #define SCSIOP_SLEW_PRINT 0x0B
  2297. #define SCSIOP_SEEK_BLOCK 0x0C
  2298. #define SCSIOP_PARTITION 0x0D
  2299. #define SCSIOP_READ_REVERSE 0x0F
  2300. #define SCSIOP_WRITE_FILEMARKS 0x10
  2301. #define SCSIOP_FLUSH_BUFFER 0x10
  2302. #define SCSIOP_SPACE 0x11
  2303. #define SCSIOP_INQUIRY 0x12
  2304. #define SCSIOP_VERIFY6 0x13
  2305. #define SCSIOP_RECOVER_BUF_DATA 0x14
  2306. #define SCSIOP_MODE_SELECT 0x15
  2307. #define SCSIOP_RESERVE_UNIT 0x16
  2308. #define SCSIOP_RELEASE_UNIT 0x17
  2309. #define SCSIOP_COPY 0x18
  2310. #define SCSIOP_ERASE 0x19
  2311. #define SCSIOP_MODE_SENSE 0x1A
  2312. #define SCSIOP_START_STOP_UNIT 0x1B
  2313. #define SCSIOP_STOP_PRINT 0x1B
  2314. #define SCSIOP_LOAD_UNLOAD 0x1B
  2315. #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
  2316. #define SCSIOP_SEND_DIAGNOSTIC 0x1D
  2317. #define SCSIOP_MEDIUM_REMOVAL 0x1E
  2318. // 10-byte commands
  2319. #define SCSIOP_READ_FORMATTED_CAPACITY 0x23
  2320. #define SCSIOP_READ_CAPACITY 0x25
  2321. #define SCSIOP_READ 0x28
  2322. #define SCSIOP_WRITE 0x2A
  2323. #define SCSIOP_SEEK 0x2B
  2324. #define SCSIOP_LOCATE 0x2B
  2325. #define SCSIOP_POSITION_TO_ELEMENT 0x2B
  2326. #define SCSIOP_WRITE_VERIFY 0x2E
  2327. #define SCSIOP_VERIFY 0x2F
  2328. #define SCSIOP_SEARCH_DATA_HIGH 0x30
  2329. #define SCSIOP_SEARCH_DATA_EQUAL 0x31
  2330. #define SCSIOP_SEARCH_DATA_LOW 0x32
  2331. #define SCSIOP_SET_LIMITS 0x33
  2332. #define SCSIOP_READ_POSITION 0x34
  2333. #define SCSIOP_SYNCHRONIZE_CACHE 0x35
  2334. #define SCSIOP_COMPARE 0x39
  2335. #define SCSIOP_COPY_COMPARE 0x3A
  2336. #define SCSIOP_WRITE_DATA_BUFF 0x3B
  2337. #define SCSIOP_READ_DATA_BUFF 0x3C
  2338. #define SCSIOP_CHANGE_DEFINITION 0x40
  2339. #define SCSIOP_READ_SUB_CHANNEL 0x42
  2340. #define SCSIOP_READ_TOC 0x43
  2341. #define SCSIOP_READ_HEADER 0x44
  2342. #define SCSIOP_PLAY_AUDIO 0x45
  2343. #define SCSIOP_GET_CONFIGURATION 0x46
  2344. #define SCSIOP_PLAY_AUDIO_MSF 0x47
  2345. #define SCSIOP_PLAY_TRACK_INDEX 0x48
  2346. #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
  2347. #define SCSIOP_GET_EVENT_STATUS 0x4A
  2348. #define SCSIOP_PAUSE_RESUME 0x4B
  2349. #define SCSIOP_LOG_SELECT 0x4C
  2350. #define SCSIOP_LOG_SENSE 0x4D
  2351. #define SCSIOP_STOP_PLAY_SCAN 0x4E
  2352. #define SCSIOP_READ_DISK_INFORMATION 0x51
  2353. #define SCSIOP_READ_TRACK_INFORMATION 0x52
  2354. #define SCSIOP_RESERVE_TRACK_RZONE 0x53
  2355. #define SCSIOP_SEND_OPC_INFORMATION 0x54 // optimum power calibration
  2356. #define SCSIOP_MODE_SELECT10 0x55
  2357. #define SCSIOP_MODE_SENSE10 0x5A
  2358. #define SCSIOP_CLOSE_TRACK_SESSION 0x5B
  2359. #define SCSIOP_READ_BUFFER_CAPACITY 0x5C
  2360. #define SCSIOP_SEND_CUE_SHEET 0x5D
  2361. #define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
  2362. #define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
  2363. // 12-byte commands
  2364. #define SCSIOP_REPORT_LUNS 0xA0
  2365. #define SCSIOP_BLANK 0xA1
  2366. #define SCSIOP_SEND_KEY 0xA3
  2367. #define SCSIOP_REPORT_KEY 0xA4
  2368. #define SCSIOP_MOVE_MEDIUM 0xA5
  2369. #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
  2370. #define SCSIOP_EXCHANGE_MEDIUM 0xA6
  2371. #define SCSIOP_SET_READ_AHEAD 0xA7
  2372. #define SCSIOP_READ_DVD_STRUCTURE 0xAD
  2373. #define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
  2374. #define SCSIOP_SEND_VOLUME_TAG 0xB6
  2375. #define SCSIOP_READ_ELEMENT_STATUS 0xB8
  2376. #define SCSIOP_READ_CD_MSF 0xB9
  2377. #define SCSIOP_SCAN_CD 0xBA
  2378. #define SCSIOP_SET_CD_SPEED 0xBB
  2379. #define SCSIOP_PLAY_CD 0xBC
  2380. #define SCSIOP_MECHANISM_STATUS 0xBD
  2381. #define SCSIOP_READ_CD 0xBE
  2382. #define SCSIOP_SEND_DVD_STRUCTURE 0xBF
  2383. #define SCSIOP_INIT_ELEMENT_RANGE 0xE7
  2384. //
  2385. // If the IMMED bit is 1, status is returned as soon
  2386. // as the operation is initiated. If the IMMED bit
  2387. // is 0, status is not returned until the operation
  2388. // is completed.
  2389. //
  2390. #define CDB_RETURN_ON_COMPLETION 0
  2391. #define CDB_RETURN_IMMEDIATE 1
  2392. // end_ntminitape
  2393. //
  2394. // CDB Force media access used in extended read and write commands.
  2395. //
  2396. #define CDB_FORCE_MEDIA_ACCESS 0x08
  2397. //
  2398. // Denon CD ROM operation codes
  2399. //
  2400. #define SCSIOP_DENON_EJECT_DISC 0xE6
  2401. #define SCSIOP_DENON_STOP_AUDIO 0xE7
  2402. #define SCSIOP_DENON_PLAY_AUDIO 0xE8
  2403. #define SCSIOP_DENON_READ_TOC 0xE9
  2404. #define SCSIOP_DENON_READ_SUBCODE 0xEB
  2405. //
  2406. // SCSI Bus Messages
  2407. //
  2408. #define SCSIMESS_ABORT 0x06
  2409. #define SCSIMESS_ABORT_WITH_TAG 0x0D
  2410. #define SCSIMESS_BUS_DEVICE_RESET 0X0C
  2411. #define SCSIMESS_CLEAR_QUEUE 0X0E
  2412. #define SCSIMESS_COMMAND_COMPLETE 0X00
  2413. #define SCSIMESS_DISCONNECT 0X04
  2414. #define SCSIMESS_EXTENDED_MESSAGE 0X01
  2415. #define SCSIMESS_IDENTIFY 0X80
  2416. #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0
  2417. #define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23
  2418. #define SCSIMESS_INITIATE_RECOVERY 0X0F
  2419. #define SCSIMESS_INIT_DETECTED_ERROR 0X05
  2420. #define SCSIMESS_LINK_CMD_COMP 0X0A
  2421. #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B
  2422. #define SCSIMESS_MESS_PARITY_ERROR 0X09
  2423. #define SCSIMESS_MESSAGE_REJECT 0X07
  2424. #define SCSIMESS_NO_OPERATION 0X08
  2425. #define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21
  2426. #define SCSIMESS_ORDERED_QUEUE_TAG 0X22
  2427. #define SCSIMESS_SIMPLE_QUEUE_TAG 0X20
  2428. #define SCSIMESS_RELEASE_RECOVERY 0X10
  2429. #define SCSIMESS_RESTORE_POINTERS 0X03
  2430. #define SCSIMESS_SAVE_DATA_POINTER 0X02
  2431. #define SCSIMESS_TERMINATE_IO_PROCESS 0X11
  2432. //
  2433. // SCSI Extended Message operation codes
  2434. //
  2435. #define SCSIMESS_MODIFY_DATA_POINTER 0X00
  2436. #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01
  2437. #define SCSIMESS_WIDE_DATA_REQUEST 0X03
  2438. //
  2439. // SCSI Extended Message Lengths
  2440. //
  2441. #define SCSIMESS_MODIFY_DATA_LENGTH 5
  2442. #define SCSIMESS_SYNCH_DATA_LENGTH 3
  2443. #define SCSIMESS_WIDE_DATA_LENGTH 2
  2444. //
  2445. // SCSI extended message structure
  2446. //
  2447. #pragma pack (1)
  2448. typedef struct _SCSI_EXTENDED_MESSAGE {
  2449. UCHAR InitialMessageCode;
  2450. UCHAR MessageLength;
  2451. UCHAR MessageType;
  2452. union _EXTENDED_ARGUMENTS {
  2453. struct {
  2454. UCHAR Modifier[4];
  2455. } Modify;
  2456. struct {
  2457. UCHAR TransferPeriod;
  2458. UCHAR ReqAckOffset;
  2459. } Synchronous;
  2460. struct{
  2461. UCHAR Width;
  2462. } Wide;
  2463. }ExtendedArguments;
  2464. }SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE;
  2465. #pragma pack ()
  2466. //
  2467. // SCSI bus status codes.
  2468. //
  2469. #define SCSISTAT_GOOD 0x00
  2470. #define SCSISTAT_CHECK_CONDITION 0x02
  2471. #define SCSISTAT_CONDITION_MET 0x04
  2472. #define SCSISTAT_BUSY 0x08
  2473. #define SCSISTAT_INTERMEDIATE 0x10
  2474. #define SCSISTAT_INTERMEDIATE_COND_MET 0x14
  2475. #define SCSISTAT_RESERVATION_CONFLICT 0x18
  2476. #define SCSISTAT_COMMAND_TERMINATED 0x22
  2477. #define SCSISTAT_QUEUE_FULL 0x28
  2478. //
  2479. // Enable Vital Product Data Flag (EVPD)
  2480. // used with INQUIRY command.
  2481. //
  2482. #define CDB_INQUIRY_EVPD 0x01
  2483. //
  2484. // Defines for format CDB
  2485. //
  2486. #define LUN0_FORMAT_SAVING_DEFECT_LIST 0
  2487. #define USE_DEFAULTMSB 0
  2488. #define USE_DEFAULTLSB 0
  2489. #define START_UNIT_CODE 0x01
  2490. #define STOP_UNIT_CODE 0x00
  2491. //
  2492. // Inquiry buffer structure. This is the data returned from the target
  2493. // after it receives an inquiry.
  2494. //
  2495. // This structure may be extended by the number of bytes specified
  2496. // in the field AdditionalLength. The defined size constant only
  2497. // includes fields through ProductRevisionLevel.
  2498. //
  2499. // The NT SCSI drivers are only interested in the first 36 bytes of data.
  2500. //
  2501. #define INQUIRYDATABUFFERSIZE 36
  2502. typedef struct _INQUIRYDATA {
  2503. UCHAR DeviceType : 5;
  2504. UCHAR DeviceTypeQualifier : 3;
  2505. UCHAR DeviceTypeModifier : 7;
  2506. UCHAR RemovableMedia : 1;
  2507. union {
  2508. UCHAR Versions;
  2509. struct {
  2510. UCHAR ANSIVersion : 3;
  2511. UCHAR ECMAVersion : 3;
  2512. UCHAR ISOVersion : 2;
  2513. };
  2514. };
  2515. UCHAR ResponseDataFormat : 4;
  2516. UCHAR HiSupport : 1;
  2517. UCHAR NormACA : 1;
  2518. UCHAR TerminateTask : 1;
  2519. UCHAR AERC : 1;
  2520. UCHAR AdditionalLength;
  2521. UCHAR Reserved;
  2522. UCHAR Addr16 : 1; // defined only for SIP devices.
  2523. UCHAR Addr32 : 1; // defined only for SIP devices.
  2524. UCHAR AckReqQ: 1; // defined only for SIP devices.
  2525. UCHAR MediumChanger : 1;
  2526. UCHAR MultiPort : 1;
  2527. UCHAR ReservedBit2 : 1;
  2528. UCHAR EnclosureServices : 1;
  2529. UCHAR ReservedBit3 : 1;
  2530. UCHAR SoftReset : 1;
  2531. UCHAR CommandQueue : 1;
  2532. UCHAR TransferDisable : 1; // defined only for SIP devices.
  2533. UCHAR LinkedCommands : 1;
  2534. UCHAR Synchronous : 1; // defined only for SIP devices.
  2535. UCHAR Wide16Bit : 1; // defined only for SIP devices.
  2536. UCHAR Wide32Bit : 1; // defined only for SIP devices.
  2537. UCHAR RelativeAddressing : 1;
  2538. UCHAR VendorId[8];
  2539. UCHAR ProductId[16];
  2540. UCHAR ProductRevisionLevel[4];
  2541. UCHAR VendorSpecific[20];
  2542. UCHAR Reserved3[40];
  2543. } INQUIRYDATA, *PINQUIRYDATA;
  2544. //
  2545. // Inquiry defines. Used to interpret data returned from target as result
  2546. // of inquiry command.
  2547. //
  2548. // DeviceType field
  2549. //
  2550. #define DIRECT_ACCESS_DEVICE 0x00 // disks
  2551. #define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes
  2552. #define PRINTER_DEVICE 0x02 // printers
  2553. #define PROCESSOR_DEVICE 0x03 // scanners, printers, etc
  2554. #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms
  2555. #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms
  2556. #define SCANNER_DEVICE 0x06 // scanners
  2557. #define OPTICAL_DEVICE 0x07 // optical disks
  2558. #define MEDIUM_CHANGER 0x08 // jukebox
  2559. #define COMMUNICATION_DEVICE 0x09 // network
  2560. #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
  2561. #define DEVICE_QUALIFIER_ACTIVE 0x00
  2562. #define DEVICE_QUALIFIER_NOT_ACTIVE 0x01
  2563. #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
  2564. //
  2565. // DeviceTypeQualifier field
  2566. //
  2567. #define DEVICE_CONNECTED 0x00
  2568. //
  2569. // Vital Product Data Pages
  2570. //
  2571. //
  2572. // Unit Serial Number Page (page code 0x80)
  2573. //
  2574. // Provides a product serial number for the target or the logical unit.
  2575. //
  2576. typedef struct _VPD_SERIAL_NUMBER_PAGE {
  2577. UCHAR DeviceType : 5;
  2578. UCHAR DeviceTypeQualifier : 3;
  2579. UCHAR PageCode;
  2580. UCHAR Reserved;
  2581. UCHAR PageLength;
  2582. UCHAR SerialNumber[0];
  2583. } VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE;
  2584. //
  2585. // Device Identification Page (page code 0x83)
  2586. // Provides the means to retrieve zero or more identification descriptors
  2587. // applying to the logical unit.
  2588. //
  2589. typedef enum _VPD_CODE_SET {
  2590. VpdCodeSetReserved = 0,
  2591. VpdCodeSetBinary = 1,
  2592. VpdCodeSetAscii = 2
  2593. } VPD_CODE_SET, *PVPD_CODE_SET;
  2594. typedef enum _VPD_IDENTIFIER_TYPE {
  2595. VpdIdentifierTypeVendorSpecific = 0,
  2596. VpdIdentifierTypeVendorId = 1,
  2597. VpdIdentifierTypeEUI64 = 2,
  2598. VpdIdentifierTypeFCPHName = 3
  2599. } VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE;
  2600. typedef struct _VPD_IDENTIFICATION_DESCRIPTOR {
  2601. UCHAR CodeSet : 4; // VPD_CODE_SET
  2602. UCHAR Reserved : 4;
  2603. UCHAR IdentifierType : 4; // VPD_IDENTIFIER_TYPE
  2604. UCHAR Reserved2 : 4;
  2605. UCHAR Reserved3;
  2606. UCHAR IdentifierLength;
  2607. UCHAR Identifier[0];
  2608. } VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR;
  2609. typedef struct _VPD_IDENTIFICATION_PAGE {
  2610. UCHAR DeviceType : 5;
  2611. UCHAR DeviceTypeQualifier : 3;
  2612. UCHAR PageCode;
  2613. UCHAR Reserved;
  2614. UCHAR PageLength;
  2615. //
  2616. // The following field is actually a variable length array of identification
  2617. // descriptors. Unfortunately there's no C notation for an array of
  2618. // variable length structures so we're forced to just pretend.
  2619. //
  2620. // VPD_IDENTIFICATION_DESCRIPTOR Descriptors[0];
  2621. UCHAR Descriptors[0];
  2622. } VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE;
  2623. //
  2624. // Supported Vital Product Data Pages Page (page code 0x00)
  2625. // Contains a list of the vital product data page cods supported by the target
  2626. // or logical unit.
  2627. //
  2628. typedef struct _VPD_SUPPORTED_PAGES_PAGE {
  2629. UCHAR DeviceType : 5;
  2630. UCHAR DeviceTypeQualifier : 3;
  2631. UCHAR PageCode;
  2632. UCHAR Reserved;
  2633. UCHAR PageLength;
  2634. UCHAR SupportedPageList[0];
  2635. } VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE;
  2636. #define VPD_MAX_BUFFER_SIZE 0xff
  2637. #define VPD_SUPPORTED_PAGES 0x00
  2638. #define VPD_SERIAL_NUMBER 0x80
  2639. #define VPD_DEVICE_IDENTIFIERS 0x83
  2640. //
  2641. // Persistent Reservation Definitions.
  2642. //
  2643. //
  2644. // PERSISTENT_RESERVE_* definitions
  2645. //
  2646. #define RESERVATION_ACTION_READ_KEYS 0x00
  2647. #define RESERVATION_ACTION_READ_RESERVATIONS 0x01
  2648. #define RESERVATION_ACTION_REGISTER 0x00
  2649. #define RESERVATION_ACTION_RESERVE 0x01
  2650. #define RESERVATION_ACTION_RELEASE 0x02
  2651. #define RESERVATION_ACTION_CLEAR 0x03
  2652. #define RESERVATION_ACTION_PREEMPT 0x04
  2653. #define RESERVATION_ACTION_PREEMPT_ABORT 0x05
  2654. #define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06
  2655. #define RESERVATION_SCOPE_LU 0x00
  2656. #define RESERVATION_SCOPE_ELEMENT 0x02
  2657. #define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01
  2658. #define RESERVATION_TYPE_EXCLUSIVE 0x03
  2659. #define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05
  2660. #define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06
  2661. //
  2662. // Structures for reserve in command.
  2663. //
  2664. typedef struct {
  2665. UCHAR Generation[4];
  2666. UCHAR AdditionalLength[4];
  2667. UCHAR ReservationKeyList[0][8];
  2668. } PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST;
  2669. typedef struct {
  2670. UCHAR ReservationKey[8];
  2671. UCHAR ScopeSpecificAddress[4];
  2672. UCHAR Reserved;
  2673. UCHAR Type : 4;
  2674. UCHAR Scope : 4;
  2675. UCHAR Obsolete[2];
  2676. } PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR;
  2677. typedef struct {
  2678. UCHAR Generation[4];
  2679. UCHAR AdditionalLength[4];
  2680. PRI_RESERVATION_DESCRIPTOR Reservations[0];
  2681. } PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST;
  2682. //
  2683. // Structures for reserve out command.
  2684. //
  2685. typedef struct {
  2686. UCHAR ReservationKey[8];
  2687. UCHAR ServiceActionReservationKey[8];
  2688. UCHAR ScopeSpecificAddress[4];
  2689. UCHAR ActivatePersistThroughPowerLoss : 1;
  2690. UCHAR Reserved1 : 7;
  2691. UCHAR Reserved2;
  2692. UCHAR Obsolete[2];
  2693. } PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST;
  2694. //
  2695. // Sense Data Format
  2696. //
  2697. typedef struct _SENSE_DATA {
  2698. UCHAR ErrorCode:7;
  2699. UCHAR Valid:1;
  2700. UCHAR SegmentNumber;
  2701. UCHAR SenseKey:4;
  2702. UCHAR Reserved:1;
  2703. UCHAR IncorrectLength:1;
  2704. UCHAR EndOfMedia:1;
  2705. UCHAR FileMark:1;
  2706. UCHAR Information[4];
  2707. UCHAR AdditionalSenseLength;
  2708. UCHAR CommandSpecificInformation[4];
  2709. UCHAR AdditionalSenseCode;
  2710. UCHAR AdditionalSenseCodeQualifier;
  2711. UCHAR FieldReplaceableUnitCode;
  2712. UCHAR SenseKeySpecific[3];
  2713. } SENSE_DATA, *PSENSE_DATA;
  2714. //
  2715. // Default request sense buffer size
  2716. //
  2717. #define SENSE_BUFFER_SIZE 18
  2718. //
  2719. // Maximum request sense buffer size
  2720. //
  2721. #define MAX_SENSE_BUFFER_SIZE 255
  2722. //
  2723. // Maximum number of additional sense bytes.
  2724. //
  2725. #define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE)
  2726. //
  2727. // Sense codes
  2728. //
  2729. #define SCSI_SENSE_NO_SENSE 0x00
  2730. #define SCSI_SENSE_RECOVERED_ERROR 0x01
  2731. #define SCSI_SENSE_NOT_READY 0x02
  2732. #define SCSI_SENSE_MEDIUM_ERROR 0x03
  2733. #define SCSI_SENSE_HARDWARE_ERROR 0x04
  2734. #define SCSI_SENSE_ILLEGAL_REQUEST 0x05
  2735. #define SCSI_SENSE_UNIT_ATTENTION 0x06
  2736. #define SCSI_SENSE_DATA_PROTECT 0x07
  2737. #define SCSI_SENSE_BLANK_CHECK 0x08
  2738. #define SCSI_SENSE_UNIQUE 0x09
  2739. #define SCSI_SENSE_COPY_ABORTED 0x0A
  2740. #define SCSI_SENSE_ABORTED_COMMAND 0x0B
  2741. #define SCSI_SENSE_EQUAL 0x0C
  2742. #define SCSI_SENSE_VOL_OVERFLOW 0x0D
  2743. #define SCSI_SENSE_MISCOMPARE 0x0E
  2744. #define SCSI_SENSE_RESERVED 0x0F
  2745. //
  2746. // Additional tape bit
  2747. //
  2748. #define SCSI_ILLEGAL_LENGTH 0x20
  2749. #define SCSI_EOM 0x40
  2750. #define SCSI_FILE_MARK 0x80
  2751. //
  2752. // Additional Sense codes
  2753. //
  2754. #define SCSI_ADSENSE_NO_SENSE 0x00
  2755. #define SCSI_ADSENSE_LUN_NOT_READY 0x04
  2756. #define SCSI_ADSENSE_TRACK_ERROR 0x14
  2757. #define SCSI_ADSENSE_SEEK_ERROR 0x15
  2758. #define SCSI_ADSENSE_REC_DATA_NOECC 0x17
  2759. #define SCSI_ADSENSE_REC_DATA_ECC 0x18
  2760. #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
  2761. #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
  2762. #define SCSI_ADSENSE_INVALID_CDB 0x24
  2763. #define SCSI_ADSENSE_INVALID_LUN 0x25
  2764. #define SCSI_ADSENSE_WRITE_PROTECT 0x27
  2765. #define SCSI_ADWRITE_PROTECT 0x27 // Legacy define
  2766. #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
  2767. #define SCSI_ADSENSE_BUS_RESET 0x29
  2768. #define SCSI_ADSENSE_INVALID_MEDIA 0x30
  2769. #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
  2770. #define SCSI_ADSENSE_POSITION_ERROR 0x3b
  2771. #define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a // see below
  2772. // the second is for legacy apps.
  2773. #define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
  2774. #define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED
  2775. #define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
  2776. #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
  2777. #define SCSI_ADSENSE_MUSIC_AREA 0xA0
  2778. #define SCSI_ADSENSE_DATA_AREA 0xA1
  2779. #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
  2780. //
  2781. // SCSI_ADSENSE_LUN_NOT_READY (0x04) qualifiers
  2782. //
  2783. #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
  2784. #define SCSI_SENSEQ_BECOMING_READY 0x01
  2785. #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
  2786. #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
  2787. #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
  2788. #define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
  2789. #define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
  2790. #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
  2791. #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
  2792. //
  2793. // SCSI_ADSENSE_NO_SENSE (0x00) qualifiers
  2794. //
  2795. #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
  2796. #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
  2797. #define SCSI_SENSEQ_SETMARK_DETECTED 0x03
  2798. #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
  2799. //
  2800. // SCSI_ADSENSE_ILLEGAL_BLOCK (0x21) qualifiers
  2801. //
  2802. #define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01
  2803. //
  2804. // SCSI_ADSENSE_POSITION_ERROR (0x3b) qualifiers
  2805. //
  2806. #define SCSI_SENSEQ_DESTINATION_FULL 0x0d
  2807. #define SCSI_SENSEQ_SOURCE_EMPTY 0x0e
  2808. //
  2809. // SCSI_ADSENSE_INVALID_MEDIA (0x30) qualifiers
  2810. //
  2811. #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
  2812. #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
  2813. #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
  2814. #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
  2815. //
  2816. // SCSI_ADSENSE_OPERATOR_REQUEST (0x5a) qualifiers
  2817. //
  2818. #define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00 // generic request
  2819. #define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01
  2820. #define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02
  2821. #define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03
  2822. //
  2823. // SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f) qualifiers
  2824. //
  2825. #define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00
  2826. #define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01
  2827. #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02
  2828. #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
  2829. #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04
  2830. #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05
  2831. // end_ntminitape
  2832. //
  2833. // SCSI IO Device Control Codes
  2834. //
  2835. #define FILE_DEVICE_SCSI 0x0000001b
  2836. #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
  2837. #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
  2838. #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
  2839. //
  2840. // SMART support in atapi
  2841. //
  2842. #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
  2843. #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
  2844. #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
  2845. #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
  2846. #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
  2847. #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
  2848. #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
  2849. #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
  2850. #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
  2851. #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
  2852. #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
  2853. #define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b)
  2854. #define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c)
  2855. //
  2856. // CLUSTER support
  2857. // deliberately skipped some values to allow for expansion above.
  2858. //
  2859. #define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
  2860. #define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
  2861. //
  2862. // Read Capacity Data - returned in Big Endian format
  2863. //
  2864. typedef struct _READ_CAPACITY_DATA {
  2865. ULONG LogicalBlockAddress;
  2866. ULONG BytesPerBlock;
  2867. } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
  2868. //
  2869. // Read Block Limits Data - returned in Big Endian format
  2870. // This structure returns the maximum and minimum block
  2871. // size for a TAPE device.
  2872. //
  2873. typedef struct _READ_BLOCK_LIMITS {
  2874. UCHAR Reserved;
  2875. UCHAR BlockMaximumSize[3];
  2876. UCHAR BlockMinimumSize[2];
  2877. } READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA;
  2878. //
  2879. // Mode data structures.
  2880. //
  2881. //
  2882. // Define Mode parameter header.
  2883. //
  2884. typedef struct _MODE_PARAMETER_HEADER {
  2885. UCHAR ModeDataLength;
  2886. UCHAR MediumType;
  2887. UCHAR DeviceSpecificParameter;
  2888. UCHAR BlockDescriptorLength;
  2889. }MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
  2890. typedef struct _MODE_PARAMETER_HEADER10 {
  2891. UCHAR ModeDataLength[2];
  2892. UCHAR MediumType;
  2893. UCHAR DeviceSpecificParameter;
  2894. UCHAR Reserved[2];
  2895. UCHAR BlockDescriptorLength[2];
  2896. }MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
  2897. #define MODE_FD_SINGLE_SIDE 0x01
  2898. #define MODE_FD_DOUBLE_SIDE 0x02
  2899. #define MODE_FD_MAXIMUM_TYPE 0x1E
  2900. #define MODE_DSP_FUA_SUPPORTED 0x10
  2901. #define MODE_DSP_WRITE_PROTECT 0x80
  2902. //
  2903. // Define the mode parameter block.
  2904. //
  2905. typedef struct _MODE_PARAMETER_BLOCK {
  2906. UCHAR DensityCode;
  2907. UCHAR NumberOfBlocks[3];
  2908. UCHAR Reserved;
  2909. UCHAR BlockLength[3];
  2910. }MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
  2911. //
  2912. // Define Disconnect-Reconnect page.
  2913. //
  2914. typedef struct _MODE_DISCONNECT_PAGE {
  2915. UCHAR PageCode : 6;
  2916. UCHAR Reserved : 1;
  2917. UCHAR PageSavable : 1;
  2918. UCHAR PageLength;
  2919. UCHAR BufferFullRatio;
  2920. UCHAR BufferEmptyRatio;
  2921. UCHAR BusInactivityLimit[2];
  2922. UCHAR BusDisconnectTime[2];
  2923. UCHAR BusConnectTime[2];
  2924. UCHAR MaximumBurstSize[2];
  2925. UCHAR DataTransferDisconnect : 2;
  2926. UCHAR Reserved2[3];
  2927. }MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
  2928. //
  2929. // Define mode caching page.
  2930. //
  2931. typedef struct _MODE_CACHING_PAGE {
  2932. UCHAR PageCode : 6;
  2933. UCHAR Reserved : 1;
  2934. UCHAR PageSavable : 1;
  2935. UCHAR PageLength;
  2936. UCHAR ReadDisableCache : 1;
  2937. UCHAR MultiplicationFactor : 1;
  2938. UCHAR WriteCacheEnable : 1;
  2939. UCHAR Reserved2 : 5;
  2940. UCHAR WriteRetensionPriority : 4;
  2941. UCHAR ReadRetensionPriority : 4;
  2942. UCHAR DisablePrefetchTransfer[2];
  2943. UCHAR MinimumPrefetch[2];
  2944. UCHAR MaximumPrefetch[2];
  2945. UCHAR MaximumPrefetchCeiling[2];
  2946. }MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
  2947. //
  2948. // Define write parameters cdrom page
  2949. //
  2950. typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE {
  2951. UCHAR PageLength; // 0x32 ??
  2952. UCHAR WriteType : 4;
  2953. UCHAR TestWrite : 1;
  2954. UCHAR LinkSizeValid : 1;
  2955. UCHAR BufferUnderrunFreeEnabled : 1;
  2956. UCHAR Reserved2 : 1;
  2957. UCHAR TrackMode : 4;
  2958. UCHAR Copy : 1;
  2959. UCHAR FixedPacket : 1;
  2960. UCHAR MultiSession : 2;
  2961. UCHAR DataBlockType : 4;
  2962. UCHAR Reserved3 : 4;
  2963. UCHAR LinkSize;
  2964. UCHAR Reserved4;
  2965. UCHAR HostApplicationCode : 6;
  2966. UCHAR Reserved5 : 2;
  2967. UCHAR SessionFormat;
  2968. UCHAR Reserved6;
  2969. UCHAR PacketSize[4];
  2970. UCHAR AudioPauseLength[2];
  2971. UCHAR Reserved7 : 7;
  2972. UCHAR MediaCatalogNumberValid : 1;
  2973. UCHAR MediaCatalogNumber[13];
  2974. UCHAR MediaCatalogNumberZero;
  2975. UCHAR MediaCatalogNumberAFrame;
  2976. UCHAR Reserved8 : 7;
  2977. UCHAR ISRCValid : 1;
  2978. UCHAR ISRCCountry[2];
  2979. UCHAR ISRCOwner[3];
  2980. UCHAR ISRCRecordingYear[2];
  2981. UCHAR ISRCSerialNumber[5];
  2982. UCHAR ISRCZero;
  2983. UCHAR ISRCAFrame;
  2984. UCHAR ISRCReserved;
  2985. UCHAR SubHeaderData[4];
  2986. } MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
  2987. //
  2988. // Define mode flexible disk page.
  2989. //
  2990. typedef struct _MODE_FLEXIBLE_DISK_PAGE {
  2991. UCHAR PageCode : 6;
  2992. UCHAR Reserved : 1;
  2993. UCHAR PageSavable : 1;
  2994. UCHAR PageLength;
  2995. UCHAR TransferRate[2];
  2996. UCHAR NumberOfHeads;
  2997. UCHAR SectorsPerTrack;
  2998. UCHAR BytesPerSector[2];
  2999. UCHAR NumberOfCylinders[2];
  3000. UCHAR StartWritePrecom[2];
  3001. UCHAR StartReducedCurrent[2];
  3002. UCHAR StepRate[2];
  3003. UCHAR StepPluseWidth;
  3004. UCHAR HeadSettleDelay[2];
  3005. UCHAR MotorOnDelay;
  3006. UCHAR MotorOffDelay;
  3007. UCHAR Reserved2 : 5;
  3008. UCHAR MotorOnAsserted : 1;
  3009. UCHAR StartSectorNumber : 1;
  3010. UCHAR TrueReadySignal : 1;
  3011. UCHAR StepPlusePerCyclynder : 4;
  3012. UCHAR Reserved3 : 4;
  3013. UCHAR WriteCompenstation;
  3014. UCHAR HeadLoadDelay;
  3015. UCHAR HeadUnloadDelay;
  3016. UCHAR Pin2Usage : 4;
  3017. UCHAR Pin34Usage : 4;
  3018. UCHAR Pin1Usage : 4;
  3019. UCHAR Pin4Usage : 4;
  3020. UCHAR MediumRotationRate[2];
  3021. UCHAR Reserved4[2];
  3022. }MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
  3023. //
  3024. // Define mode format page.
  3025. //
  3026. typedef struct _MODE_FORMAT_PAGE {
  3027. UCHAR PageCode : 6;
  3028. UCHAR Reserved : 1;
  3029. UCHAR PageSavable : 1;
  3030. UCHAR PageLength;
  3031. UCHAR TracksPerZone[2];
  3032. UCHAR AlternateSectorsPerZone[2];
  3033. UCHAR AlternateTracksPerZone[2];
  3034. UCHAR AlternateTracksPerLogicalUnit[2];
  3035. UCHAR SectorsPerTrack[2];
  3036. UCHAR BytesPerPhysicalSector[2];
  3037. UCHAR Interleave[2];
  3038. UCHAR TrackSkewFactor[2];
  3039. UCHAR CylinderSkewFactor[2];
  3040. UCHAR Reserved2 : 4;
  3041. UCHAR SurfaceFirst : 1;
  3042. UCHAR RemovableMedia : 1;
  3043. UCHAR HardSectorFormating : 1;
  3044. UCHAR SoftSectorFormating : 1;
  3045. UCHAR Reserved3[3];
  3046. }MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
  3047. //
  3048. // Define rigid disk driver geometry page.
  3049. //
  3050. typedef struct _MODE_RIGID_GEOMETRY_PAGE {
  3051. UCHAR PageCode : 6;
  3052. UCHAR Reserved : 1;
  3053. UCHAR PageSavable : 1;
  3054. UCHAR PageLength;
  3055. UCHAR NumberOfCylinders[3];
  3056. UCHAR NumberOfHeads;
  3057. UCHAR StartWritePrecom[3];
  3058. UCHAR StartReducedCurrent[3];
  3059. UCHAR DriveStepRate[2];
  3060. UCHAR LandZoneCyclinder[3];
  3061. UCHAR RotationalPositionLock : 2;
  3062. UCHAR Reserved2 : 6;
  3063. UCHAR RotationOffset;
  3064. UCHAR Reserved3;
  3065. UCHAR RoataionRate[2];
  3066. UCHAR Reserved4[2];
  3067. }MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
  3068. //
  3069. // Define read write recovery page
  3070. //
  3071. typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
  3072. UCHAR PageCode : 6;
  3073. UCHAR Reserved1 : 1;
  3074. UCHAR PSBit : 1;
  3075. UCHAR PageLength;
  3076. UCHAR DCRBit : 1;
  3077. UCHAR DTEBit : 1;
  3078. UCHAR PERBit : 1;
  3079. UCHAR EERBit : 1;
  3080. UCHAR RCBit : 1;
  3081. UCHAR TBBit : 1;
  3082. UCHAR ARRE : 1;
  3083. UCHAR AWRE : 1;
  3084. UCHAR ReadRetryCount;
  3085. UCHAR Reserved4[4];
  3086. UCHAR WriteRetryCount;
  3087. UCHAR Reserved5[3];
  3088. } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
  3089. //
  3090. // Define read recovery page - cdrom
  3091. //
  3092. typedef struct _MODE_READ_RECOVERY_PAGE {
  3093. UCHAR PageCode : 6;
  3094. UCHAR Reserved1 : 1;
  3095. UCHAR PSBit : 1;
  3096. UCHAR PageLength;
  3097. UCHAR DCRBit : 1;
  3098. UCHAR DTEBit : 1;
  3099. UCHAR PERBit : 1;
  3100. UCHAR Reserved2 : 1;
  3101. UCHAR RCBit : 1;
  3102. UCHAR TBBit : 1;
  3103. UCHAR Reserved3 : 2;
  3104. UCHAR ReadRetryCount;
  3105. UCHAR Reserved4[4];
  3106. } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
  3107. //
  3108. // Define Informational Exception Control Page. Used for failure prediction
  3109. //
  3110. typedef struct _MODE_INFO_EXCEPTIONS
  3111. {
  3112. UCHAR PageCode : 6;
  3113. UCHAR Reserved1 : 1;
  3114. UCHAR PSBit : 1;
  3115. UCHAR PageLength;
  3116. union
  3117. {
  3118. UCHAR Flags;
  3119. struct
  3120. {
  3121. UCHAR LogErr : 1;
  3122. UCHAR Reserved2 : 1;
  3123. UCHAR Test : 1;
  3124. UCHAR Dexcpt : 1;
  3125. UCHAR Reserved3 : 3;
  3126. UCHAR Perf : 1;
  3127. };
  3128. };
  3129. UCHAR ReportMethod : 4;
  3130. UCHAR Reserved4 : 4;
  3131. UCHAR IntervalTimer[4];
  3132. UCHAR ReportCount[4];
  3133. } MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS;
  3134. //
  3135. // Begin C/DVD 0.9 definitions
  3136. //
  3137. //
  3138. // Power Condition Mode Page Format
  3139. //
  3140. typedef struct _POWER_CONDITION_PAGE {
  3141. UCHAR PageCode : 6; // 0x1A
  3142. UCHAR Reserved : 1;
  3143. UCHAR PSBit : 1;
  3144. UCHAR PageLength; // 0x0A
  3145. UCHAR Reserved2;
  3146. UCHAR Standby : 1;
  3147. UCHAR Idle : 1;
  3148. UCHAR Reserved3 : 6;
  3149. UCHAR IdleTimer[4];
  3150. UCHAR StandbyTimer[4];
  3151. } POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE;
  3152. //
  3153. // CD-Audio Control Mode Page Format
  3154. //
  3155. typedef struct _CDDA_OUTPUT_PORT {
  3156. UCHAR ChannelSelection : 4;
  3157. UCHAR Reserved : 4;
  3158. UCHAR Volume;
  3159. } CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT;
  3160. typedef struct _CDAUDIO_CONTROL_PAGE {
  3161. UCHAR PageCode : 6; // 0x0E
  3162. UCHAR Reserved : 1;
  3163. UCHAR PSBit : 1;
  3164. UCHAR PageLength; // 0x0E
  3165. UCHAR Reserved2 : 1;
  3166. UCHAR StopOnTrackCrossing : 1; // Default 0
  3167. UCHAR Immediate : 1; // Always 1
  3168. UCHAR Reserved3 : 5;
  3169. UCHAR Reserved4[3];
  3170. UCHAR Obsolete[2];
  3171. CDDA_OUTPUT_PORT CDDAOutputPorts[4];
  3172. } CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE;
  3173. #define CDDA_CHANNEL_MUTED 0x0
  3174. #define CDDA_CHANNEL_ZERO 0x1
  3175. #define CDDA_CHANNEL_ONE 0x2
  3176. #define CDDA_CHANNEL_TWO 0x4
  3177. #define CDDA_CHANNEL_THREE 0x8
  3178. //
  3179. // C/DVD Feature Set Support & Version Page
  3180. //
  3181. typedef struct _CDVD_FEATURE_SET_PAGE {
  3182. UCHAR PageCode : 6; // 0x18
  3183. UCHAR Reserved : 1;
  3184. UCHAR PSBit : 1;
  3185. UCHAR PageLength; // 0x16
  3186. UCHAR CDAudio[2];
  3187. UCHAR EmbeddedChanger[2];
  3188. UCHAR PacketSMART[2];
  3189. UCHAR PersistantPrevent[2];
  3190. UCHAR EventStatusNotification[2];
  3191. UCHAR DigitalOutput[2];
  3192. UCHAR CDSequentialRecordable[2];
  3193. UCHAR DVDSequentialRecordable[2];
  3194. UCHAR RandomRecordable[2];
  3195. UCHAR KeyExchange[2];
  3196. UCHAR Reserved2[2];
  3197. } CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE;
  3198. //
  3199. // CDVD Inactivity Time-out Page Format
  3200. //
  3201. typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE {
  3202. UCHAR PageCode : 6; // 0x1D
  3203. UCHAR Reserved : 1;
  3204. UCHAR PSBit : 1;
  3205. UCHAR PageLength; // 0x08
  3206. UCHAR Reserved2[2];
  3207. UCHAR SWPP : 1;
  3208. UCHAR DISP : 1;
  3209. UCHAR Reserved3 : 6;
  3210. UCHAR Reserved4;
  3211. UCHAR GroupOneMinimumTimeout[2];
  3212. UCHAR GroupTwoMinimumTimeout[2];
  3213. } CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE;
  3214. //
  3215. // CDVD Capabilities & Mechanism Status Page
  3216. //
  3217. #define CDVD_LMT_CADDY 0
  3218. #define CDVD_LMT_TRAY 1
  3219. #define CDVD_LMT_POPUP 2
  3220. #define CDVD_LMT_RESERVED1 3
  3221. #define CDVD_LMT_CHANGER_INDIVIDUAL 4
  3222. #define CDVD_LMT_CHANGER_CARTRIDGE 5
  3223. #define CDVD_LMT_RESERVED2 6
  3224. #define CDVD_LMT_RESERVED3 7
  3225. typedef struct _CDVD_CAPABILITIES_PAGE {
  3226. UCHAR PageCode : 6; // 0x2A
  3227. UCHAR Reserved : 1;
  3228. UCHAR PSBit : 1; // offset 0
  3229. UCHAR PageLength; // 0x18 // offset 1
  3230. UCHAR CDRRead : 1;
  3231. UCHAR CDERead : 1;
  3232. UCHAR Method2 : 1;
  3233. UCHAR DVDROMRead : 1;
  3234. UCHAR DVDRRead : 1;
  3235. UCHAR DVDRAMRead : 1;
  3236. UCHAR Reserved2 : 2; // offset 2
  3237. UCHAR CDRWrite : 1;
  3238. UCHAR CDEWrite : 1;
  3239. UCHAR TestWrite : 1;
  3240. UCHAR Reserved3 : 1;
  3241. UCHAR DVDRWrite : 1;
  3242. UCHAR DVDRAMWrite : 1;
  3243. UCHAR Reserved4 : 2; // offset 3
  3244. UCHAR AudioPlay : 1;
  3245. UCHAR Composite : 1;
  3246. UCHAR DigitalPortOne : 1;
  3247. UCHAR DigitalPortTwo : 1;
  3248. UCHAR Mode2Form1 : 1;
  3249. UCHAR Mode2Form2 : 1;
  3250. UCHAR MultiSession : 1;
  3251. UCHAR Reserved5 : 1; // offset 4
  3252. UCHAR CDDA : 1;
  3253. UCHAR CDDAAccurate : 1;
  3254. UCHAR RWSupported : 1;
  3255. UCHAR RWDeinterleaved : 1;
  3256. UCHAR C2Pointers : 1;
  3257. UCHAR ISRC : 1;
  3258. UCHAR UPC : 1;
  3259. UCHAR ReadBarCodeCapable : 1; // offset 5
  3260. UCHAR Lock : 1;
  3261. UCHAR LockState : 1;
  3262. UCHAR PreventJumper : 1;
  3263. UCHAR Eject : 1;
  3264. UCHAR Reserved6 : 1;
  3265. UCHAR LoadingMechanismType : 3; // offset 6
  3266. UCHAR SeparateVolume : 1;
  3267. UCHAR SeperateChannelMute : 1;
  3268. UCHAR SupportsDiskPresent : 1;
  3269. UCHAR SWSlotSelection : 1;
  3270. UCHAR SideChangeCapable : 1;
  3271. UCHAR RWInLeadInReadable : 1;
  3272. UCHAR Reserved7 : 2; // offset 7
  3273. UCHAR ObsoleteReserved[2]; // offset 8
  3274. UCHAR NumberVolumeLevels[2]; // offset 10
  3275. UCHAR BufferSize[2]; // offset 12
  3276. UCHAR ObsoleteReserved2[2]; // offset 14
  3277. UCHAR ObsoleteReserved3; // offset 16
  3278. UCHAR Reserved8 : 1;
  3279. UCHAR BCK : 1;
  3280. UCHAR RCK : 1;
  3281. UCHAR LSBF : 1;
  3282. UCHAR Length : 2;
  3283. UCHAR Reserved9 : 2; // offset 17
  3284. UCHAR ObsoleteReserved4[2]; // offset 18
  3285. UCHAR ObsoleteReserved11[2]; // offset 20
  3286. //
  3287. // NOTE: This mode page is two bytes too small in the release
  3288. // version of the Windows2000 DDK. it also incorrectly
  3289. // put the CopyManagementRevision at offset 20 instead
  3290. // of offset 22, so fix that with a nameless union (for
  3291. // backwards-compatibility with those who "fixed" it on
  3292. // their own by looking at Reserved10[]).
  3293. //
  3294. union {
  3295. UCHAR CopyManagementRevision[2]; // offset 22
  3296. UCHAR Reserved10[2];
  3297. };
  3298. //UCHAR Reserved12[2]; // offset 24
  3299. } CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE;
  3300. typedef struct _LUN_LIST {
  3301. UCHAR LunListLength[4]; // sizeof LunSize * 8
  3302. UCHAR Reserved[4];
  3303. UCHAR Lun[0][8]; // 4 level of addressing. 2 bytes each.
  3304. } LUN_LIST, *PLUN_LIST;
  3305. #define LOADING_MECHANISM_CADDY 0x00
  3306. #define LOADING_MECHANISM_TRAY 0x01
  3307. #define LOADING_MECHANISM_POPUP 0x02
  3308. #define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04
  3309. #define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05
  3310. //
  3311. // end C/DVD 0.9 mode page definitions
  3312. //
  3313. // Mode parameter list block descriptor -
  3314. // set the block length for reading/writing
  3315. //
  3316. //
  3317. #define MODE_BLOCK_DESC_LENGTH 8
  3318. #define MODE_HEADER_LENGTH 4
  3319. #define MODE_HEADER_LENGTH10 8
  3320. typedef struct _MODE_PARM_READ_WRITE {
  3321. MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format
  3322. MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor
  3323. } MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA;
  3324. //
  3325. // CDROM audio control (0x0E)
  3326. //
  3327. #define CDB_AUDIO_PAUSE 0
  3328. #define CDB_AUDIO_RESUME 1
  3329. #define CDB_DEVICE_START 0x11
  3330. #define CDB_DEVICE_STOP 0x10
  3331. #define CDB_EJECT_MEDIA 0x10
  3332. #define CDB_LOAD_MEDIA 0x01
  3333. #define CDB_SUBCHANNEL_HEADER 0x00
  3334. #define CDB_SUBCHANNEL_BLOCK 0x01
  3335. #define CDROM_AUDIO_CONTROL_PAGE 0x0E
  3336. #define MODE_SELECT_IMMEDIATE 0x04
  3337. #define MODE_SELECT_PFBIT 0x10
  3338. #define CDB_USE_MSF 0x01
  3339. typedef struct _PORT_OUTPUT {
  3340. UCHAR ChannelSelection;
  3341. UCHAR Volume;
  3342. } PORT_OUTPUT, *PPORT_OUTPUT;
  3343. typedef struct _AUDIO_OUTPUT {
  3344. UCHAR CodePage;
  3345. UCHAR ParameterLength;
  3346. UCHAR Immediate;
  3347. UCHAR Reserved[2];
  3348. UCHAR LbaFormat;
  3349. UCHAR LogicalBlocksPerSecond[2];
  3350. PORT_OUTPUT PortOutput[4];
  3351. } AUDIO_OUTPUT, *PAUDIO_OUTPUT;
  3352. //
  3353. // Multisession CDROM
  3354. //
  3355. #define GET_LAST_SESSION 0x01
  3356. #define GET_SESSION_DATA 0x02;
  3357. //
  3358. // Atapi 2.5 changer
  3359. //
  3360. typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER {
  3361. UCHAR CurrentSlot : 5;
  3362. UCHAR ChangerState : 2;
  3363. UCHAR Fault : 1;
  3364. UCHAR Reserved : 5;
  3365. UCHAR MechanismState : 3;
  3366. UCHAR CurrentLogicalBlockAddress[3];
  3367. UCHAR NumberAvailableSlots;
  3368. UCHAR SlotTableLength[2];
  3369. } MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER;
  3370. typedef struct _SLOT_TABLE_INFORMATION {
  3371. UCHAR DiscChanged : 1;
  3372. UCHAR Reserved : 6;
  3373. UCHAR DiscPresent : 1;
  3374. UCHAR Reserved2[3];
  3375. } SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION;
  3376. typedef struct _MECHANICAL_STATUS {
  3377. MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader;
  3378. SLOT_TABLE_INFORMATION SlotTableInfo[1];
  3379. } MECHANICAL_STATUS, *PMECHANICAL_STATUS;
  3380. //
  3381. // This structure is used to convert little endian
  3382. // ULONGs to SCSI CDB big endians values.
  3383. //
  3384. typedef union _EIGHT_BYTE {
  3385. struct {
  3386. UCHAR Byte0;
  3387. UCHAR Byte1;
  3388. UCHAR Byte2;
  3389. UCHAR Byte3;
  3390. UCHAR Byte4;
  3391. UCHAR Byte5;
  3392. UCHAR Byte6;
  3393. UCHAR Byte7;
  3394. };
  3395. ULONGLONG AsULongLong;
  3396. } EIGHT_BYTE, *PEIGHT_BYTE;
  3397. typedef union _FOUR_BYTE {
  3398. struct {
  3399. UCHAR Byte0;
  3400. UCHAR Byte1;
  3401. UCHAR Byte2;
  3402. UCHAR Byte3;
  3403. };
  3404. ULONG AsULong;
  3405. } FOUR_BYTE, *PFOUR_BYTE;
  3406. typedef union _TWO_BYTE {
  3407. struct {
  3408. UCHAR Byte0;
  3409. UCHAR Byte1;
  3410. };
  3411. USHORT AsUShort;
  3412. } TWO_BYTE, *PTWO_BYTE;
  3413. //
  3414. // Byte reversing macro for converting
  3415. // between big- and little-endian formats
  3416. //
  3417. #define REVERSE_BYTES_QUAD(Destination, Source) { \
  3418. PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination); \
  3419. PEIGHT_BYTE s = (PEIGHT_BYTE)(Source); \
  3420. d->Byte7 = s->Byte0; \
  3421. d->Byte6 = s->Byte1; \
  3422. d->Byte5 = s->Byte2; \
  3423. d->Byte4 = s->Byte3; \
  3424. d->Byte3 = s->Byte4; \
  3425. d->Byte2 = s->Byte5; \
  3426. d->Byte1 = s->Byte6; \
  3427. d->Byte0 = s->Byte7; \
  3428. }
  3429. #define REVERSE_BYTES(Destination, Source) { \
  3430. PFOUR_BYTE d = (PFOUR_BYTE)(Destination); \
  3431. PFOUR_BYTE s = (PFOUR_BYTE)(Source); \
  3432. d->Byte3 = s->Byte0; \
  3433. d->Byte2 = s->Byte1; \
  3434. d->Byte1 = s->Byte2; \
  3435. d->Byte0 = s->Byte3; \
  3436. }
  3437. #define REVERSE_BYTES_SHORT(Destination, Source) { \
  3438. PTWO_BYTE d = (PTWO_BYTE)(Destination); \
  3439. PTWO_BYTE s = (PTWO_BYTE)(Source); \
  3440. d->Byte1 = s->Byte0; \
  3441. d->Byte0 = s->Byte1; \
  3442. }
  3443. //
  3444. // Byte reversing macro for converting
  3445. // USHORTS from big to little endian in place
  3446. //
  3447. #define REVERSE_SHORT(Short) { \
  3448. UCHAR tmp; \
  3449. PTWO_BYTE w = (PTWO_BYTE)(Short); \
  3450. tmp = w->Byte0; \
  3451. w->Byte0 = w->Byte1; \
  3452. w->Byte1 = tmp; \
  3453. }
  3454. //
  3455. // Byte reversing macro for convering
  3456. // ULONGS between big & little endian in place
  3457. //
  3458. #define REVERSE_LONG(Long) { \
  3459. UCHAR tmp; \
  3460. PFOUR_BYTE l = (PFOUR_BYTE)(Long); \
  3461. tmp = l->Byte3; \
  3462. l->Byte3 = l->Byte0; \
  3463. l->Byte0 = tmp; \
  3464. tmp = l->Byte2; \
  3465. l->Byte2 = l->Byte1; \
  3466. l->Byte1 = tmp; \
  3467. }
  3468. //
  3469. // This macro has the effect of Bit = log2(Data)
  3470. //
  3471. #define WHICH_BIT(Data, Bit) { \
  3472. UCHAR tmp; \
  3473. for (tmp = 0; tmp < 32; tmp++) { \
  3474. if (((Data) >> tmp) == 1) { \
  3475. break; \
  3476. } \
  3477. } \
  3478. ASSERT(tmp != 32); \
  3479. (Bit) = tmp; \
  3480. }
  3481. //
  3482. // Include SCSIPORT definitions for backwards compatability.
  3483. //
  3484. #if defined (STOR_USE_SCSI_ALIASES)
  3485. #define ScsiPortInitialize StorPortInitialize
  3486. #define ScsiPortFreeDeviceBase StorPortFreeDeviceBase
  3487. #define ScsiPortGetBusData StorPortGetBusData
  3488. #define ScsiPortSetBusDataByOffset StorPortSetBusDataByOffset
  3489. #define ScsiPortGetDeviceBase StorPortGetDeviceBase
  3490. #define ScsiPortGetLogicalUnit StorPortGetLogicalUnit
  3491. #define ScsiPortGetSrb StorPortGetSrb
  3492. #define ScsiPortGetPhysicalAddress StorPortGetPhysicalAddress
  3493. #define ScsiPortGetVirtualAddress StorPortGetVirtualAddress
  3494. #define ScsiPortGetUncachedExtension StorPortGetUncachedExtension
  3495. #define ScsiPortFlushDma StorPortFlushDma
  3496. #define ScsiPortIoMapTransfer StorPortIoMapTransfer
  3497. #define ScsiPortNotification StorPortNotification
  3498. #define ScsiPortLogError StorPortLogError
  3499. #define ScsiPortCompleteRequest StorPortCompleteRequest
  3500. #define ScsiPortMoveMemory StorPortMoveMemory
  3501. #define ScsiPortReadPortUchar StorPortReadPortUchar
  3502. #define ScsiPortReadPortUshort StorPortReadPortUshort
  3503. #define ScsiPortReadPortUlong StorPortReadPortUlong
  3504. #define ScsiPortReadPortBufferUchar StorPortReadPortBufferUchar
  3505. #define ScsiPortReadPortBufferUshort StorPortReadPortBufferUshort
  3506. #define ScsiPortReadPortBufferUlong StorPortReadPortBufferUlong
  3507. #define ScsiPortReadRegisterUchar StorPortReadRegisterUchar
  3508. #define ScsiPortReadRegisterUshort StorPortReadRegisterUshort
  3509. #define ScsiPortReadRegisterUlong StorPortReadRegisterUlong
  3510. #define ScsiPortReadRegisterBufferUchar StorPortReadRegisterBufferUchar
  3511. #define ScsiPortReadRegisterBufferUshort StorPortReadRegisterBufferUshort
  3512. #define ScsiPortReadRegisterBufferUlong StorPortReadRegisterBufferUlong
  3513. #define ScsiPortStallExecution StorPortStallExecution
  3514. #define ScsiPortWritePortUchar StorPortWritePortUchar
  3515. #define ScsiPortWritePortUshort StorPortWritePortUshort
  3516. #define ScsiPortWritePortUlong StorPortWritePortUlong
  3517. #define ScsiPortWritePortBufferUchar StorPortWritePortBufferUchar
  3518. #define ScsiPortWritePortBufferUshort StorPortWritePortBufferUshort
  3519. #define ScsiPortWritePortBufferUlong StorPortWritePortBufferUlong
  3520. #define ScsiPortWriteRegisterUchar StorPortWriteRegisterUchar
  3521. #define ScsiPortWriteRegisterUshort StorPortWriteRegisterUshort
  3522. #define ScsiPortWriteRegisterUlong StorPortWriteRegisterUlong
  3523. #define ScsiPortWriteRegisterBufferUchar StorPortWriteRegisterBufferUchar
  3524. #define ScsiPortWriteRegisterBufferUshort StorPortWriteRegisterBufferUshort
  3525. #define ScsiPortWriteRegisterBufferUlong StorPortWriteRegisterBufferUlong
  3526. #define ScsiPortConvertUlongToPhysicalAddress StorPortConvertUlongToPhysicalAddress
  3527. #define ScsiPortConvertPhysicalAddressToUlong StorPortConvertPhysicalAddressToUlong
  3528. #define ScsiPortQuerySystemTime StorPortQuerySystemTime
  3529. #define ScsiPortValidateRange StorPortValidateRange
  3530. #define ScsiDebugPrint StorPortDebugPrint
  3531. typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS;
  3532. #endif // STOR_USE_SCSI_ALIASES
  3533. #if _MSC_VER >= 1200
  3534. #pragma warning(pop) // un-sets any local warning changes
  3535. #else
  3536. #pragma warning(default:4200) // array[0] is not a warning for this file
  3537. #endif
  3538. #endif // !defined _NTSTORPORT_