Leaked source code of windows server 2003
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.

334 lines
6.6 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1998
  3. Module Name:
  4. mcd.h
  5. Abstract:
  6. These are the structures and defines that are used in the
  7. changer class drivers. The changer class driver is separated
  8. into two modules. Mcd.c contains code common to all medium
  9. changer drivers including the driver's major entry points.
  10. Author:
  11. chuckp (Chuck Park)
  12. Environment:
  13. Kernel mode
  14. Revision History :
  15. --*/
  16. #include "scsi.h"
  17. #include "ntddchgr.h"
  18. #include <classpnp.h>
  19. #ifdef DebugPrint
  20. #undef DebugPrint
  21. #endif
  22. #if DBG
  23. #define DebugPrint(x) MCDebugPrint x
  24. #else
  25. #define DebugPrint(x)
  26. #endif
  27. VOID
  28. MCDebugPrint(
  29. ULONG DebugPrintLevel,
  30. PCCHAR DebugMessage,
  31. ...
  32. );
  33. #define MAXIMUM_CHANGER_INQUIRY_DATA 252
  34. typedef struct _MODE_ELEMENT_ADDRESS_PAGE {
  35. UCHAR PageCode : 6;
  36. UCHAR Reserved1 : 1;
  37. UCHAR PS : 1;
  38. UCHAR PageLength;
  39. UCHAR MediumTransportElementAddress[2];
  40. UCHAR NumberTransportElements[2];
  41. UCHAR FirstStorageElementAddress[2];
  42. UCHAR NumberStorageElements[2];
  43. UCHAR FirstIEPortElementAddress[2];
  44. UCHAR NumberIEPortElements[2];
  45. UCHAR FirstDataXFerElementAddress[2];
  46. UCHAR NumberDataXFerElements[2];
  47. UCHAR Reserved2[2];
  48. } MODE_ELEMENT_ADDRESS_PAGE, *PMODE_ELEMENT_ADDRESS_PAGE;
  49. typedef struct _MODE_TRANSPORT_GEOMETRY_PAGE {
  50. UCHAR PageCode : 6;
  51. UCHAR Reserved1 : 1;
  52. UCHAR PS : 1;
  53. UCHAR PageLength;
  54. UCHAR Flip : 1;
  55. UCHAR Reserved2: 7;
  56. UCHAR TransportElementNumber;
  57. } MODE_TRANSPORT_GEOMETRY_PAGE, *PMODE_TRANSPORT_GEOMETRY_PAGE;
  58. //
  59. // Capabilities page decribes the various functions that the device
  60. // supports. Used in GetParameters.
  61. //
  62. typedef struct _MODE_DEVICE_CAPABILITIES_PAGE {
  63. UCHAR PageCode : 6;
  64. UCHAR Reserved1 : 1;
  65. UCHAR PS : 1;
  66. UCHAR PageLength;
  67. UCHAR MediumTransport : 1;
  68. UCHAR StorageLocation : 1;
  69. UCHAR IEPort : 1;
  70. UCHAR DataXFer : 1;
  71. UCHAR Reserved2 : 4;
  72. UCHAR Reserved3;
  73. UCHAR MTtoMT : 1;
  74. UCHAR MTtoST : 1;
  75. UCHAR MTtoIE : 1;
  76. UCHAR MTtoDT : 1;
  77. UCHAR Reserved4 : 4;
  78. UCHAR STtoMT : 1;
  79. UCHAR STtoST : 1;
  80. UCHAR STtoIE : 1;
  81. UCHAR STtoDT : 1;
  82. UCHAR Reserved5 : 4;
  83. UCHAR IEtoMT : 1;
  84. UCHAR IEtoST : 1;
  85. UCHAR IEtoIE : 1;
  86. UCHAR IEtoDT : 1;
  87. UCHAR Reserved6 : 4;
  88. UCHAR DTtoMT : 1;
  89. UCHAR DTtoST : 1;
  90. UCHAR DTtoIE : 1;
  91. UCHAR DTtoDT : 1;
  92. UCHAR Reserved7 : 4;
  93. UCHAR Reserved8[4];
  94. UCHAR XMTtoMT : 1;
  95. UCHAR XMTtoST : 1;
  96. UCHAR XMTtoIE : 1;
  97. UCHAR XMTtoDT : 1;
  98. UCHAR Reserved9 : 4;
  99. UCHAR XSTtoMT : 1;
  100. UCHAR XSTtoST : 1;
  101. UCHAR XSTtoIE : 1;
  102. UCHAR XSTtoDT : 1;
  103. UCHAR Reserved10 : 4;
  104. UCHAR XIEtoMT : 1;
  105. UCHAR XIEtoST : 1;
  106. UCHAR XIEtoIE : 1;
  107. UCHAR XIEtoDT : 1;
  108. UCHAR Reserved11 : 4;
  109. UCHAR XDTtoMT : 1;
  110. UCHAR XDTtoST : 1;
  111. UCHAR XDTtoIE : 1;
  112. UCHAR XDTtoDT : 1;
  113. UCHAR Reserved12 : 4;
  114. } MODE_DEVICE_CAPABILITIES_PAGE, *PMODE_DEVICE_CAPABILITIES_PAGE;
  115. #define MODE_PAGE_DISPLAY 0x22
  116. //
  117. // Structures describing return data from READ_ELEMENT_STATUS
  118. //
  119. typedef struct _ELEMENT_STATUS_HEADER {
  120. UCHAR FirstElementAddress[2];
  121. UCHAR NumberOfElements[2];
  122. UCHAR Reserved1;
  123. UCHAR ReportByteCount[3];
  124. } ELEMENT_STATUS_HEADER, *PELEMENT_STATUS_HEADER;
  125. typedef struct _ELEMENT_STATUS_PAGE {
  126. UCHAR ElementType;
  127. UCHAR Reserved1 : 6;
  128. UCHAR AVolTag : 1;
  129. UCHAR PVolTag : 1;
  130. UCHAR ElementDescriptorLength[2];
  131. UCHAR Reserved2;
  132. UCHAR DescriptorByteCount[3];
  133. } ELEMENT_STATUS_PAGE, *PELEMENT_STATUS_PAGE;
  134. typedef struct _ELEMENT_DESCRIPTOR {
  135. UCHAR ElementAddress[2];
  136. UCHAR Full : 1;
  137. UCHAR Reserved1 : 1;
  138. UCHAR Exception : 1;
  139. UCHAR Accessible : 1;
  140. UCHAR Reserved2 : 4;
  141. UCHAR Reserved3;
  142. UCHAR AdditionalSenseCode;
  143. UCHAR AddSenseCodeQualifier;
  144. UCHAR Lun : 3;
  145. UCHAR Reserved4 : 1;
  146. UCHAR LunValid : 1;
  147. UCHAR IdValid : 1;
  148. UCHAR Reserved5 : 1;
  149. UCHAR NotThisBus : 1;
  150. UCHAR BusAddress;
  151. UCHAR Reserved6;
  152. UCHAR Reserved7 : 6;
  153. UCHAR Invert : 1;
  154. UCHAR SValid : 1;
  155. UCHAR SourceStorageElementAddress[2];
  156. } ELEMENT_DESCRIPTOR, *PELEMENT_DESCRIPTOR;
  157. //
  158. // The following routines are the exported entry points for
  159. // all changer class drivers.
  160. //
  161. NTSTATUS
  162. DriverEntry(
  163. IN PDRIVER_OBJECT DriverObject,
  164. IN PUNICODE_STRING RegistryPath
  165. );
  166. NTSTATUS
  167. ChangerClassCreate (
  168. IN PDEVICE_OBJECT DeviceObject,
  169. IN PIRP Irp
  170. );
  171. NTSTATUS
  172. ChangerClassDeviceControl(
  173. IN PDEVICE_OBJECT DeviceObject,
  174. IN PIRP Irp
  175. );
  176. PVOID
  177. ChangerClassAllocatePool(
  178. IN POOL_TYPE PoolType,
  179. IN ULONG NumberOfBytes
  180. );
  181. VOID
  182. ChangerClassFreePool(
  183. IN PVOID PoolToFree
  184. );
  185. NTSTATUS
  186. ChangerClassSendSrbSynchronous(
  187. IN PDEVICE_OBJECT DeviceObject,
  188. IN PSCSI_REQUEST_BLOCK Srb,
  189. IN PVOID Buffer,
  190. IN ULONG BufferSize,
  191. IN BOOLEAN WriteToDevice
  192. );
  193. //
  194. // The following routines are provided by the changer
  195. // device-specific module. Each routine name is
  196. // prefixed with 'Changer.'
  197. ULONG
  198. ChangerAdditionalExtensionSize(
  199. VOID
  200. );
  201. BOOLEAN
  202. ChangerVerifyInquiry(
  203. PINQUIRYDATA InquiryData
  204. );
  205. NTSTATUS
  206. ChangerInitialize(
  207. IN PDEVICE_OBJECT DeviceObject
  208. );
  209. VOID
  210. ChangerError(
  211. PDEVICE_OBJECT DeviceObject,
  212. PSCSI_REQUEST_BLOCK Srb,
  213. NTSTATUS *Status,
  214. BOOLEAN *Retry
  215. );
  216. NTSTATUS
  217. ChangerGetParameters(
  218. IN PDEVICE_OBJECT DeviceObject,
  219. IN PIRP Irp
  220. );
  221. NTSTATUS
  222. ChangerGetStatus(
  223. IN PDEVICE_OBJECT DeviceObject,
  224. IN PIRP Irp
  225. );
  226. NTSTATUS
  227. ChangerGetProductData(
  228. IN PDEVICE_OBJECT DeviceObject,
  229. IN PIRP Irp
  230. );
  231. NTSTATUS
  232. ChangerSetAccess(
  233. IN PDEVICE_OBJECT DeviceObject,
  234. IN PIRP Irp
  235. );
  236. NTSTATUS
  237. ChangerGetElementStatus(
  238. IN PDEVICE_OBJECT DeviceObject,
  239. IN PIRP Irp
  240. );
  241. NTSTATUS
  242. ChangerInitializeElementStatus(
  243. IN PDEVICE_OBJECT DeviceObject,
  244. IN PIRP Irp
  245. );
  246. NTSTATUS
  247. ChangerSetPosition(
  248. IN PDEVICE_OBJECT DeviceObject,
  249. IN PIRP Irp
  250. );
  251. NTSTATUS
  252. ChangerExchangeMedium(
  253. IN PDEVICE_OBJECT DeviceObject,
  254. IN PIRP Irp
  255. );
  256. NTSTATUS
  257. ChangerMoveMedium(
  258. IN PDEVICE_OBJECT DeviceObject,
  259. IN PIRP Irp
  260. );
  261. NTSTATUS
  262. ChangerReinitializeUnit(
  263. IN PDEVICE_OBJECT DeviceObject,
  264. IN PIRP Irp
  265. );
  266. NTSTATUS
  267. ChangerQueryVolumeTags(
  268. IN PDEVICE_OBJECT DeviceObject,
  269. IN PIRP Irp
  270. );