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.

312 lines
7.2 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddscsi.h
  5. Abstract:
  6. This is the include file that defines all constants and types for
  7. accessing the SCSI port adapters.
  8. Author:
  9. Jeff Havens
  10. Revision History:
  11. --*/
  12. //
  13. // Interface GUIDs
  14. //
  15. // need these GUIDs outside conditional includes so that user can
  16. // #include <ntddscsi.h> in precompiled header
  17. // #include <initguid.h> in a single source file
  18. // #include <ntddscsi.h> in that source file a second time to instantiate the GUIDs
  19. //
  20. #ifdef DEFINE_GUID
  21. //
  22. // Make sure FAR is defined...
  23. //
  24. #ifndef FAR
  25. #ifdef _WIN32
  26. #define FAR
  27. #else
  28. #define FAR _far
  29. #endif
  30. #endif
  31. DEFINE_GUID(ScsiRawInterfaceGuid, 0x53f56309L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  32. DEFINE_GUID(WmiScsiAddressGuid, 0x53f5630fL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  33. #endif
  34. #ifndef _NTDDSCSIH_
  35. #define _NTDDSCSIH_
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. //
  40. // Device Name - this string is the name of the device. It is the name
  41. // that should be passed to NtOpenFile when accessing the device.
  42. //
  43. // Note: For devices that support multiple units, it should be suffixed
  44. // with the Ascii representation of the unit number.
  45. //
  46. #define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER
  47. #define DD_SCSI_DEVICE_NAME "\\Device\\ScsiPort"
  48. //
  49. // NtDeviceIoControlFile IoControlCode values for this device.
  50. //
  51. // Warning: Remember that the low two bits of the code specify how the
  52. // buffers are passed to the driver!
  53. //
  54. #define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  55. #define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  56. #define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
  57. #define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
  58. #define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  59. #define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS)
  60. #define IOCTL_SCSI_RESCAN_BUS CTL_CODE(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS)
  61. #define IOCTL_SCSI_GET_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0408, METHOD_BUFFERED, FILE_ANY_ACCESS)
  62. #define IOCTL_SCSI_FREE_DUMP_POINTERS CTL_CODE(IOCTL_SCSI_BASE, 0x0409, METHOD_BUFFERED, FILE_ANY_ACCESS)
  63. #define IOCTL_IDE_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x040a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  64. //
  65. // Define the SCSI pass through structure.
  66. //
  67. typedef struct _SCSI_PASS_THROUGH {
  68. USHORT Length;
  69. UCHAR ScsiStatus;
  70. UCHAR PathId;
  71. UCHAR TargetId;
  72. UCHAR Lun;
  73. UCHAR CdbLength;
  74. UCHAR SenseInfoLength;
  75. UCHAR DataIn;
  76. ULONG DataTransferLength;
  77. ULONG TimeOutValue;
  78. ULONG_PTR DataBufferOffset;
  79. ULONG SenseInfoOffset;
  80. UCHAR Cdb[16];
  81. }SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
  82. //
  83. // Define the SCSI pass through direct structure.
  84. //
  85. typedef struct _SCSI_PASS_THROUGH_DIRECT {
  86. USHORT Length;
  87. UCHAR ScsiStatus;
  88. UCHAR PathId;
  89. UCHAR TargetId;
  90. UCHAR Lun;
  91. UCHAR CdbLength;
  92. UCHAR SenseInfoLength;
  93. UCHAR DataIn;
  94. ULONG DataTransferLength;
  95. ULONG TimeOutValue;
  96. PVOID DataBuffer;
  97. ULONG SenseInfoOffset;
  98. UCHAR Cdb[16];
  99. }SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
  100. //
  101. // Define the SCSI pass through direct structure for Win64 (thunking).
  102. //
  103. #if defined(_WIN64)
  104. typedef struct _SCSI_PASS_THROUGH32 {
  105. USHORT Length;
  106. UCHAR ScsiStatus;
  107. UCHAR PathId;
  108. UCHAR TargetId;
  109. UCHAR Lun;
  110. UCHAR CdbLength;
  111. UCHAR SenseInfoLength;
  112. UCHAR DataIn;
  113. ULONG DataTransferLength;
  114. ULONG TimeOutValue;
  115. ULONG32 DataBufferOffset;
  116. ULONG SenseInfoOffset;
  117. UCHAR Cdb[16];
  118. }SCSI_PASS_THROUGH32, *PSCSI_PASS_THROUGH32;
  119. //
  120. // Define the SCSI pass through direct structure.
  121. //
  122. typedef struct _SCSI_PASS_THROUGH_DIRECT32 {
  123. USHORT Length;
  124. UCHAR ScsiStatus;
  125. UCHAR PathId;
  126. UCHAR TargetId;
  127. UCHAR Lun;
  128. UCHAR CdbLength;
  129. UCHAR SenseInfoLength;
  130. UCHAR DataIn;
  131. ULONG DataTransferLength;
  132. ULONG TimeOutValue;
  133. VOID * POINTER_32 DataBuffer;
  134. ULONG SenseInfoOffset;
  135. UCHAR Cdb[16];
  136. }SCSI_PASS_THROUGH_DIRECT32, *PSCSI_PASS_THROUGH_DIRECT32;
  137. #endif
  138. //
  139. // Define SCSI information.
  140. // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
  141. //
  142. typedef struct _SCSI_BUS_DATA {
  143. UCHAR NumberOfLogicalUnits;
  144. UCHAR InitiatorBusId;
  145. ULONG InquiryDataOffset;
  146. }SCSI_BUS_DATA, *PSCSI_BUS_DATA;
  147. //
  148. // Define SCSI adapter bus information structure..
  149. // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
  150. //
  151. typedef struct _SCSI_ADAPTER_BUS_INFO {
  152. UCHAR NumberOfBuses;
  153. SCSI_BUS_DATA BusData[1];
  154. } SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
  155. //
  156. // Define SCSI adapter bus information.
  157. // Used with the IOCTL_SCSI_GET_INQUIRY_DATA IOCTL.
  158. //
  159. typedef struct _SCSI_INQUIRY_DATA {
  160. UCHAR PathId;
  161. UCHAR TargetId;
  162. UCHAR Lun;
  163. BOOLEAN DeviceClaimed;
  164. ULONG InquiryDataLength;
  165. ULONG NextInquiryDataOffset;
  166. UCHAR InquiryData[1];
  167. }SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
  168. //
  169. // Define header for I/O control SRB.
  170. //
  171. typedef struct _SRB_IO_CONTROL {
  172. ULONG HeaderLength;
  173. UCHAR Signature[8];
  174. ULONG Timeout;
  175. ULONG ControlCode;
  176. ULONG ReturnCode;
  177. ULONG Length;
  178. } SRB_IO_CONTROL, *PSRB_IO_CONTROL;
  179. //
  180. // SCSI port driver capabilities structure.
  181. //
  182. typedef struct _IO_SCSI_CAPABILITIES {
  183. //
  184. // Length of this structure
  185. //
  186. ULONG Length;
  187. //
  188. // Maximum transfer size in single SRB
  189. //
  190. ULONG MaximumTransferLength;
  191. //
  192. // Maximum number of physical pages per data buffer
  193. //
  194. ULONG MaximumPhysicalPages;
  195. //
  196. // Async calls from port to class
  197. //
  198. ULONG SupportedAsynchronousEvents;
  199. //
  200. // Alignment mask for data transfers.
  201. //
  202. ULONG AlignmentMask;
  203. //
  204. // Supports tagged queuing
  205. //
  206. BOOLEAN TaggedQueuing;
  207. //
  208. // Host adapter scans down for bios devices.
  209. //
  210. BOOLEAN AdapterScansDown;
  211. //
  212. // The host adapter uses programmed I/O.
  213. //
  214. BOOLEAN AdapterUsesPio;
  215. } IO_SCSI_CAPABILITIES, *PIO_SCSI_CAPABILITIES;
  216. typedef struct _SCSI_ADDRESS {
  217. ULONG Length;
  218. UCHAR PortNumber;
  219. UCHAR PathId;
  220. UCHAR TargetId;
  221. UCHAR Lun;
  222. }SCSI_ADDRESS, *PSCSI_ADDRESS;
  223. //
  224. // Define structure for returning crash dump pointers.
  225. //
  226. struct _ADAPTER_OBJECT;
  227. typedef struct _DUMP_POINTERS {
  228. struct _ADAPTER_OBJECT *AdapterObject;
  229. PVOID MappedRegisterBase;
  230. PVOID DumpData;
  231. PVOID CommonBufferVa;
  232. LARGE_INTEGER CommonBufferPa;
  233. ULONG CommonBufferSize;
  234. BOOLEAN AllocateCommonBuffers;
  235. BOOLEAN UseDiskDump;
  236. UCHAR Spare1[2];
  237. PVOID DeviceObject;
  238. } DUMP_POINTERS, *PDUMP_POINTERS;
  239. //
  240. // Define values for pass-through DataIn field.
  241. //
  242. #define SCSI_IOCTL_DATA_OUT 0
  243. #define SCSI_IOCTL_DATA_IN 1
  244. #define SCSI_IOCTL_DATA_UNSPECIFIED 2
  245. #ifdef __cplusplus
  246. }
  247. #endif
  248. #endif