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.

311 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. tape.h
  5. Abstract:
  6. These are the structures and defines that are used in the
  7. SCSI tape class drivers. The tape class driver is separated
  8. into two modules. Tape.c contains code common to all tape
  9. class drivers including the driver's major entry points.
  10. The major entry point names each begin with the prefix
  11. 'ScsiTape.' The second module is the device specific code.
  12. It provides support for a set of functions. Each device
  13. specific function name is prefixed by 'Tape.'
  14. Author:
  15. Mike Glass
  16. Revision History:
  17. --*/
  18. #include "scsi.h"
  19. #include "class.h"
  20. //
  21. // Define the maximum inquiry data length.
  22. //
  23. #define MAXIMUM_TAPE_INQUIRY_DATA 252
  24. //
  25. // Tape device data
  26. //
  27. typedef struct _TAPE_DATA {
  28. ULONG Flags;
  29. ULONG CurrentPartition;
  30. PVOID DeviceSpecificExtension;
  31. PSCSI_INQUIRY_DATA InquiryData;
  32. } TAPE_DATA, *PTAPE_DATA;
  33. #define DEVICE_EXTENSION_SIZE sizeof(DEVICE_EXTENSION) + sizeof(TAPE_DATA)
  34. //
  35. // Define Device Configuration Page
  36. //
  37. typedef struct _MODE_DEVICE_CONFIGURATION_PAGE {
  38. UCHAR PageCode : 6;
  39. UCHAR Reserved1 : 1;
  40. UCHAR PS : 1;
  41. UCHAR PageLength;
  42. UCHAR ActiveFormat : 5;
  43. UCHAR CAFBit : 1;
  44. UCHAR CAPBit : 1;
  45. UCHAR Reserved2 : 1;
  46. UCHAR ActivePartition;
  47. UCHAR WriteBufferFullRatio;
  48. UCHAR ReadBufferEmptyRatio;
  49. UCHAR WriteDelayTime[2];
  50. UCHAR REW : 1;
  51. UCHAR RBO : 1;
  52. UCHAR SOCF : 2;
  53. UCHAR AVC : 1;
  54. UCHAR RSmk : 1;
  55. UCHAR BIS : 1;
  56. UCHAR DBR : 1;
  57. UCHAR GapSize;
  58. UCHAR Reserved3 : 3;
  59. UCHAR SEW : 1;
  60. UCHAR EEG : 1;
  61. UCHAR EODdefined : 3;
  62. UCHAR BufferSize[3];
  63. UCHAR DCAlgorithm;
  64. UCHAR Reserved4;
  65. } MODE_DEVICE_CONFIGURATION_PAGE, *PMODE_DEVICE_CONFIGURATION_PAGE;
  66. //
  67. // Define Medium Partition Page
  68. //
  69. typedef struct _MODE_MEDIUM_PARTITION_PAGE {
  70. UCHAR PageCode : 6;
  71. UCHAR Reserved1 : 1;
  72. UCHAR PSBit : 1;
  73. UCHAR PageLength;
  74. UCHAR MaximumAdditionalPartitions;
  75. UCHAR AdditionalPartitionDefined;
  76. UCHAR Reserved2 : 3;
  77. UCHAR PSUMBit : 2;
  78. UCHAR IDPBit : 1;
  79. UCHAR SDPBit : 1;
  80. UCHAR FDPBit : 1;
  81. UCHAR MediumFormatRecognition;
  82. UCHAR Reserved3[2];
  83. UCHAR Partition0Size[2];
  84. UCHAR Partition1Size[2];
  85. } MODE_MEDIUM_PARTITION_PAGE, *PMODE_MEDIUM_PARTITION_PAGE;
  86. //
  87. // Define Data Compression Page
  88. //
  89. typedef struct _MODE_DATA_COMPRESSION_PAGE {
  90. UCHAR PageCode : 6;
  91. UCHAR Reserved1 : 2;
  92. UCHAR PageLength;
  93. UCHAR Reserved2 : 6;
  94. UCHAR DCC : 1;
  95. UCHAR DCE : 1;
  96. UCHAR Reserved3 : 5;
  97. UCHAR RED : 2;
  98. UCHAR DDE : 1;
  99. UCHAR CompressionAlgorithm[4];
  100. UCHAR DecompressionAlgorithm[4];
  101. UCHAR Reserved4[4];
  102. } MODE_DATA_COMPRESSION_PAGE, *PMODE_DATA_COMPRESSION_PAGE;
  103. //
  104. // Mode parameter list header and medium partition page -
  105. // used in creating partitions
  106. //
  107. typedef struct _MODE_MEDIUM_PART_PAGE {
  108. MODE_PARAMETER_HEADER ParameterListHeader;
  109. MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
  110. } MODE_MEDIUM_PART_PAGE, *PMODE_MEDIUM_PART_PAGE;
  111. //
  112. // Mode parameters for retrieving tape or media information
  113. //
  114. typedef struct _MODE_TAPE_MEDIA_INFORMATION {
  115. MODE_PARAMETER_HEADER ParameterListHeader;
  116. MODE_PARAMETER_BLOCK ParameterListBlock;
  117. MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
  118. } MODE_TAPE_MEDIA_INFORMATION, *PMODE_TAPE_MEDIA_INFORMATION;
  119. //
  120. // Mode parameter list header and device configuration page -
  121. // used in retrieving device configuration information
  122. //
  123. typedef struct _MODE_DEVICE_CONFIG_PAGE {
  124. MODE_PARAMETER_HEADER ParameterListHeader;
  125. MODE_DEVICE_CONFIGURATION_PAGE DeviceConfigPage;
  126. } MODE_DEVICE_CONFIG_PAGE, *PMODE_DEVICE_CONFIG_PAGE;
  127. //
  128. // Mode parameter list header and data compression page -
  129. // used in retrieving data compression information
  130. //
  131. typedef struct _MODE_DATA_COMPRESS_PAGE {
  132. MODE_PARAMETER_HEADER ParameterListHeader;
  133. MODE_DATA_COMPRESSION_PAGE DataCompressPage;
  134. } MODE_DATA_COMPRESS_PAGE, *PMODE_DATA_COMPRESS_PAGE;
  135. //
  136. // The following routines are the exported entry points for
  137. // all tape class drivers. Note all these routines name start
  138. // with 'ScsiTape.'
  139. //
  140. NTSTATUS
  141. DriverEntry(
  142. IN PDRIVER_OBJECT DriverObject,
  143. IN PUNICODE_STRING RegistryPath
  144. );
  145. NTSTATUS
  146. ScsiTapeInitialize(
  147. IN PDRIVER_OBJECT DriverObject
  148. );
  149. NTSTATUS
  150. ScsiTapeCreate (
  151. IN PDEVICE_OBJECT DeviceObject,
  152. IN PIRP Irp
  153. );
  154. NTSTATUS
  155. ScsiTapeReadWrite (
  156. IN PDEVICE_OBJECT DeviceObject,
  157. IN PIRP Irp
  158. );
  159. NTSTATUS
  160. ScsiTapeDeviceControl(
  161. IN PDEVICE_OBJECT DeviceObject,
  162. IN PIRP Irp
  163. );
  164. //
  165. // The following routines are provided by the tape
  166. // device-specific module. Each routine name is
  167. // prefixed with 'Tape.'
  168. NTSTATUS
  169. TapeCreatePartition(
  170. IN PDEVICE_OBJECT DeviceObject,
  171. IN PIRP Irp
  172. );
  173. NTSTATUS
  174. TapeErase(
  175. IN PDEVICE_OBJECT DeviceObject,
  176. IN PIRP Irp
  177. );
  178. VOID
  179. TapeError(
  180. PDEVICE_OBJECT DeviceObject,
  181. PSCSI_REQUEST_BLOCK Srb,
  182. NTSTATUS *Status,
  183. BOOLEAN *Retry
  184. );
  185. NTSTATUS
  186. TapeGetDriveParameters(
  187. IN PDEVICE_OBJECT DeviceObject,
  188. IN PIRP Irp
  189. );
  190. NTSTATUS
  191. TapeGetMediaParameters(
  192. IN PDEVICE_OBJECT DeviceObject,
  193. IN PIRP Irp
  194. );
  195. NTSTATUS
  196. TapeGetPosition(
  197. IN PDEVICE_OBJECT DeviceObject,
  198. IN PIRP Irp
  199. );
  200. NTSTATUS
  201. TapeGetStatus(
  202. IN PDEVICE_OBJECT DeviceObject,
  203. IN PIRP Irp
  204. );
  205. NTSTATUS
  206. TapePrepare(
  207. IN PDEVICE_OBJECT DeviceObject,
  208. IN PIRP Irp
  209. );
  210. NTSTATUS
  211. TapeReadWrite(
  212. IN PDEVICE_OBJECT DeviceObject,
  213. IN PIRP Irp
  214. );
  215. NTSTATUS
  216. TapeSetDriveParameters(
  217. IN PDEVICE_OBJECT DeviceObject,
  218. IN PIRP Irp
  219. );
  220. NTSTATUS
  221. TapeSetMediaParameters(
  222. IN PDEVICE_OBJECT DeviceObject,
  223. IN PIRP Irp
  224. );
  225. NTSTATUS
  226. TapeSetPosition(
  227. IN PDEVICE_OBJECT DeviceObject,
  228. IN PIRP Irp
  229. );
  230. BOOLEAN
  231. TapeVerifyInquiry(
  232. IN PSCSI_INQUIRY_DATA LunInfo
  233. );
  234. NTSTATUS
  235. TapeWriteMarks(
  236. IN PDEVICE_OBJECT DeviceObject,
  237. IN PIRP Irp
  238. );
  239.