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.

1244 lines
36 KiB

  1. #if !defined (___atapi_h___)
  2. #define ___atapi_h___
  3. /*++
  4. Copyright (C) Microsoft Corporation, 1993 - 1999
  5. Module Name:
  6. atapi.h
  7. Abstract:
  8. This module contains the structures and definitions for the ATAPI
  9. IDE miniport driver.
  10. Author:
  11. Mike Glass
  12. Revision History:
  13. --*/
  14. #include "scsi.h"
  15. #include "stdio.h"
  16. #include "string.h"
  17. ULONG
  18. AtapiParseArgumentString(
  19. IN PCHAR String,
  20. IN PCHAR KeyWord
  21. );
  22. //
  23. // IDE register definition
  24. //
  25. typedef struct _IDE_REGISTERS_3 {
  26. ULONG Data;
  27. UCHAR Others[4];
  28. } IDE_REGISTERS_3, *PIDE_REGISTERS_3;
  29. typedef struct _ATA_COMMAND_BLOCK_READ_REGISTERS {
  30. union {
  31. struct {
  32. PUSHORT Data16;
  33. } w;
  34. struct {
  35. PUCHAR Data8;
  36. PUCHAR Error;
  37. PUCHAR SectorCount;
  38. PUCHAR SectorNumber;
  39. PUCHAR CylinderLow;
  40. PUCHAR CylinderHigh;
  41. PUCHAR DriveSelect;
  42. PUCHAR Status;
  43. } b;
  44. } size;
  45. } ATA_COMMAND_BLOCK_READ_REGISTERS, *PATA_COMMAND_BLOCK_READ_REGISTERS;
  46. typedef struct _ATA_COMMAND_BLOCK_WRITE_REGISTERS {
  47. union {
  48. struct {
  49. PUSHORT Data16;
  50. } w;
  51. struct {
  52. PUCHAR Data8;
  53. PUCHAR Feature;
  54. PUCHAR SectorCount;
  55. PUCHAR SectorNumber;
  56. PUCHAR CylinderLow;
  57. PUCHAR CylinderHigh;
  58. PUCHAR DriveSelect;
  59. PUCHAR Command;
  60. } b;
  61. } size;
  62. } ATA_COMMAND_BLOCK_WRITE_REGISTERS, *PATA_COMMAND_BLOCK_WRITE_REGISTERS;
  63. typedef struct _ATAPI_COMMAND_BLOCK_READ_REGISTERS {
  64. union {
  65. struct {
  66. PUSHORT Data16;
  67. } w;
  68. struct {
  69. PUCHAR Data8;
  70. PUCHAR Error;
  71. PUCHAR InterruptReason;
  72. PUCHAR Reserved;
  73. PUCHAR ByteCountLow;
  74. PUCHAR ByteCountHigh;
  75. PUCHAR DriveSelect;
  76. PUCHAR Status;
  77. } b;
  78. } size;
  79. } ATAPI_COMMAND_BLOCK_READ_REGISTERS, *PATAPI_COMMAND_BLOCK_READ_REGISTERS;
  80. typedef struct _ATAPI_COMMAND_BLOCK_WRITE_REGISTERS {
  81. union {
  82. struct {
  83. PUSHORT Data16;
  84. } w;
  85. struct {
  86. PUCHAR Data8;
  87. PUCHAR Feature;
  88. PUCHAR Resereved0;
  89. PUCHAR Resereved1;
  90. PUCHAR ByteCountLow;
  91. PUCHAR ByteCountHigh;
  92. PUCHAR DriveSelect;
  93. PUCHAR Command;
  94. } b;
  95. } size;
  96. } ATAPI_COMMAND_BLOCK_WRITE_REGISTERS, *PATAPI_COMMAND_BLOCK_WRITE_REGISTERS;
  97. typedef struct _IDE_COMMAND_BLOCK_WRITE_REGISTERS {
  98. PUCHAR RegistersBaseAddress;
  99. union {
  100. union {
  101. ATA_COMMAND_BLOCK_READ_REGISTERS r;
  102. ATA_COMMAND_BLOCK_WRITE_REGISTERS w;
  103. } ata;
  104. union {
  105. ATAPI_COMMAND_BLOCK_READ_REGISTERS r;
  106. ATAPI_COMMAND_BLOCK_WRITE_REGISTERS w;
  107. } atapi;
  108. } type;
  109. } IDE_COMMAND_BLOCK_WRITE_REGISTERS, *PIDE_COMMAND_BLOCK_WRITE_REGISTERS;
  110. //
  111. // handy ata macros
  112. //
  113. #define ATA_DATA16_REG(baseAddress) (baseAddress)->type.ata.r.size.w.Data16
  114. #define ATA_ERROR_REG(baseAddress) (baseAddress)->type.ata.r.size.b.Error
  115. #define ATA_SECTOR_COUNT_REG(baseAddress) (baseAddress)->type.ata.r.size.b.SectorCount
  116. #define ATA_SECTOR_NUMBER_REG(baseAddress) (baseAddress)->type.ata.r.size.b.SectorNumber
  117. #define ATA_CYLINDER_LOW_REG(baseAddress) (baseAddress)->type.ata.r.size.b.CylinderLow
  118. #define ATA_CYLINDER_HIGH_REG(baseAddress) (baseAddress)->type.ata.r.size.b.CylinderHigh
  119. #define ATA_DRIVE_SELECT_REG(baseAddress) (baseAddress)->type.ata.r.size.b.DriveSelect
  120. #define ATA_STATUS_REG(baseAddress) (baseAddress)->type.ata.r.size.b.Status
  121. #define ATA_FEATURE_REG(baseAddress) (baseAddress)->type.ata.w.size.b.Feature
  122. #define ATA_COMMAND_REG(baseAddress) (baseAddress)->type.ata.w.size.b.Command
  123. //
  124. // handy atapi macros
  125. //
  126. #define ATAPI_DATA16_REG(baseAddress) (baseAddress)->type.atapi.r.size.w.Data16
  127. #define ATAPI_ERROR_REG(baseAddress) (baseAddress)->type.atapi.r.size.b.Error
  128. #define ATAPI_INTERRUPT_REASON_REG(baseAddress) (baseAddress)->type.atapi.r.size.b.InterruptReason
  129. #define ATAPI_BYTECOUNT_LOW_REG(baseAddress) (baseAddress)->type.atapi.r.size.b.ByteCountLow
  130. #define ATAPI_BYTECOUNT_HIGH_REG(baseAddress) (baseAddress)->type.atapi.r.size.b.ByteCountHigh
  131. #define ATAPI_DRIVE_SELECT_REG(baseAddress) (baseAddress)->type.atapi.r.size.b.DriveSelect
  132. #define ATAPI_STATUS_REG(baseAddress) (baseAddress)->type.atapi.r.size.b.Status
  133. #define ATAPI_FEATURE_REG(baseAddress) (baseAddress)->type.atapi.w.size.b.Feature
  134. #define ATAPI_COMMAND_REG(baseAddress) (baseAddress)->type.atapi.w.size.b.Command
  135. //
  136. // Device Extension Device Flags
  137. //
  138. #define DFLAGS_DEVICE_PRESENT (1 << 0) // Indicates that some device is present.
  139. #define DFLAGS_ATAPI_DEVICE (1 << 1) // Indicates whether Atapi commands can be used.
  140. #define DFLAGS_TAPE_DEVICE (1 << 2) // Indicates whether this is a tape device.
  141. #define DFLAGS_INT_DRQ (1 << 3) // Indicates whether device interrupts as DRQ is set after
  142. // receiving Atapi Packet Command
  143. #define DFLAGS_REMOVABLE_DRIVE (1 << 4) // Indicates that the drive has the 'removable' bit set in
  144. // identify data (offset 128)
  145. #define DFLAGS_MEDIA_STATUS_ENABLED (1 << 5) // Media status notification enabled
  146. #define DFLAGS_USE_DMA (1 << 9) // Indicates whether device can use DMA
  147. #define DFLAGS_LBA (1 << 10) // support LBA addressing
  148. #define DFLAGS_MULTI_LUN_INITED (1 << 11) // Indicates that the init path for multi-lun has already been done.
  149. #define DFLAGS_MSN_SUPPORT (1 << 12) // Device support media status notification
  150. #define DFLAGS_AUTO_EJECT_ZIP (1 << 13) // bootup default enables auto eject
  151. #define DFLAGS_WD_MODE (1 << 14) // Indicates that unit is WD-Mode(not SFF-Mode).
  152. #define DFLAGS_LS120_FORMAT (1 << 15) // Indicates that unit uses ATAPI_LS120_FORMAT_UNIT to format
  153. #define DFLAGS_USE_UDMA (1 << 16) // Indicates whether device can use UDMA
  154. #define DFLAGS_IDENTIFY_VALID (1 << 17) // Indicates whether the Identify data is valid or not
  155. #define DFLAGS_IDENTIFY_INVALID (1 << 18) // Indicates whether the Identify data is valid or not
  156. #define DFLAGS_RDP_SET (1 << 19) // If the srb is for RDP
  157. #define DFLAGS_SONY_MEMORYSTICK (1 << 20) // If the device is a Sony Memorystick
  158. #define DFLAGS_48BIT_LBA (1 << 21) // If the device supports 48-bit LBA
  159. #define DFLAGS_DEVICE_ERASED (1 << 22) // Indicates that some device is temporarily blocked for access.
  160. //
  161. // Used to disable 'advanced' features.
  162. //
  163. #define MAX_ERRORS 4
  164. //
  165. // ATAPI command definitions
  166. //
  167. #define ATAPI_MODE_SENSE 0x5A
  168. #define ATAPI_MODE_SELECT 0x55
  169. #define ATAPI_LS120_FORMAT_UNIT 0x24
  170. //
  171. // ATAPI mode page page code
  172. //
  173. #define ATAPI_NON_CD_DRIVE_OPERATION_MODE_PAGE_PAGECODE (0x00)
  174. #define ATAPI_REMOVABLE_BLOCK_ACCESS_CAPABILITIES_PAGECODE (0x1b)
  175. //
  176. // ATAPI Command Descriptor Block
  177. //
  178. typedef struct _MODE_PARAMETER_HEADER_10 {
  179. UCHAR ModeDataLengthMsb;
  180. UCHAR ModeDataLengthLsb;
  181. UCHAR MediumType;
  182. UCHAR Reserved[5];
  183. }MODE_PARAMETER_HEADER_10, *PMODE_PARAMETER_HEADER_10;
  184. typedef struct _ATAPI_REMOVABLE_BLOCK_ACCESS_CAPABILITIES {
  185. UCHAR PageCode : 6;
  186. UCHAR Reserved0 : 1;
  187. UCHAR PSBit : 1;
  188. UCHAR PageLength;
  189. UCHAR Reserved2:6;
  190. UCHAR SRFP:1;
  191. UCHAR SFLP:1;
  192. UCHAR TotalLun:3;
  193. UCHAR Reserved3:3;
  194. UCHAR SML:1;
  195. UCHAR NCD:1;
  196. UCHAR Reserved[8];
  197. } ATAPI_REMOVABLE_BLOCK_ACCESS_CAPABILITIES, *PATAPI_REMOVABLE_BLOCK_ACCESS_CAPABILITIES;
  198. typedef struct _ATAPI_NON_CD_DRIVE_OPERATION_MODE_PAGE {
  199. UCHAR PageCode : 6;
  200. UCHAR Reserved0 : 1;
  201. UCHAR PSBit : 1;
  202. UCHAR PageLength;
  203. UCHAR Reserved2:5;
  204. UCHAR DVW:1;
  205. UCHAR SLR:1;
  206. UCHAR SLM:1;
  207. UCHAR Reserved3:4;
  208. UCHAR DDE:1;
  209. UCHAR Reserved4:3;
  210. } ATAPI_NON_CD_DRIVE_OPERATION_MODE_PAGE, *PATAPI_NON_CD_DRIVE_OPERATION_MODE_PAGE;
  211. //
  212. // IDE command definitions
  213. //
  214. #define IDE_COMMAND_NOP 0x00
  215. #define IDE_COMMAND_ATAPI_RESET 0x08
  216. #define IDE_COMMAND_RECALIBRATE 0x10
  217. #define IDE_COMMAND_READ 0x20
  218. #define IDE_COMMAND_READ_EXT 0x24
  219. #define IDE_COMMAND_READ_DMA_EXT 0x25
  220. #define IDE_COMMAND_READ_DMA_QUEUED_EXT 0x26
  221. #define IDE_COMMAND_READ_MULTIPLE_EXT 0x29
  222. #define IDE_COMMAND_WRITE 0x30
  223. #define IDE_COMMAND_WRITE_EXT 0x34
  224. #define IDE_COMMAND_WRITE_DMA_EXT 0x35
  225. #define IDE_COMMAND_WRITE_DMA_QUEUED_EXT 0x36
  226. #define IDE_COMMAND_WRITE_MULTIPLE_EXT 0x39
  227. #define IDE_COMMAND_VERIFY 0x40
  228. #define IDE_COMMAND_VERIFY_EXT 0x42
  229. #define IDE_COMMAND_SEEK 0x70
  230. #define IDE_COMMAND_EXECUTE_DEVICE_DIAGNOSTIC 0x90
  231. #define IDE_COMMAND_SET_DRIVE_PARAMETERS 0x91
  232. #define IDE_COMMAND_ATAPI_PACKET 0xA0
  233. #define IDE_COMMAND_ATAPI_IDENTIFY 0xA1
  234. #define IDE_COMMAND_READ_MULTIPLE 0xC4
  235. #define IDE_COMMAND_WRITE_MULTIPLE 0xC5
  236. #define IDE_COMMAND_SET_MULTIPLE 0xC6
  237. #define IDE_COMMAND_READ_DMA 0xC8
  238. #define IDE_COMMAND_WRITE_DMA 0xCA
  239. #define IDE_COMMAND_GET_MEDIA_STATUS 0xDA
  240. #define IDE_COMMAND_STANDBY_IMMEDIATE 0xE0
  241. #define IDE_COMMAND_IDLE_IMMEDIATE 0xE1
  242. #define IDE_COMMAND_CHECK_POWER 0xE5
  243. #define IDE_COMMAND_SLEEP 0xE6
  244. #define IDE_COMMAND_FLUSH_CACHE 0xE7
  245. #define IDE_COMMAND_FLUSH_CACHE_EXT 0xEA
  246. #define IDE_COMMAND_IDENTIFY 0xEC
  247. #define IDE_COMMAND_MEDIA_EJECT 0xED
  248. #define IDE_COMMAND_SET_FEATURE 0xEF
  249. #define IDE_COMMAND_DOOR_LOCK 0xDE
  250. #define IDE_COMMAND_DOOR_UNLOCK 0xDF
  251. #define IDE_COMMAND_NO_FLUSH 0xFF // Commmand value to indicate the target device can't handle any flush command
  252. //
  253. // IDE Set Transfer Mode
  254. //
  255. #define IDE_SET_DEFAULT_PIO_MODE(mode) ((UCHAR) 1) // disable I/O Ready
  256. #define IDE_SET_ADVANCE_PIO_MODE(mode) ((UCHAR) ((1 << 3) | (mode)))
  257. #define IDE_SET_SWDMA_MODE(mode) ((UCHAR) ((1 << 4) | (mode)))
  258. #define IDE_SET_MWDMA_MODE(mode) ((UCHAR) ((1 << 5) | (mode)))
  259. #define IDE_SET_UDMA_MODE(mode) ((UCHAR) ((1 << 6) | (mode)))
  260. #define IDE_SET_FEATURE_SET_TRANSFER_MODE 0x3
  261. #define IDE_SET_FEATURE_ENABLE_WRITE_CACHE 0x2
  262. #define IDE_SET_FEATURE_DISABLE_WRITE_CACHE 0x82
  263. //
  264. // Media Status Set Feature
  265. //
  266. #define IDE_SET_FEATURE_ENABLE_MSN 0x95
  267. #define IDE_SET_FEATURE_DISABLE_MSN 0x31
  268. #define IDE_SET_FEATURE_DISABLE_REVERT_TO_POWER_ON 0x66
  269. //
  270. // IDE drive select/head definitions
  271. //
  272. #define IDE_DRIVE_SELECT_1 0xA0
  273. #define IDE_DRIVE_SELECT_2 0x10
  274. //
  275. // IDE error definitions
  276. //
  277. #define IDE_ERROR_BAD_BLOCK 0x80
  278. #define IDE_ERROR_CRC_ERROR IDE_ERROR_BAD_BLOCK
  279. #define IDE_ERROR_DATA_ERROR 0x40
  280. #define IDE_ERROR_MEDIA_CHANGE 0x20
  281. #define IDE_ERROR_ID_NOT_FOUND 0x10
  282. #define IDE_ERROR_MEDIA_CHANGE_REQ 0x08
  283. #define IDE_ERROR_COMMAND_ABORTED 0x04
  284. #define IDE_ERROR_END_OF_MEDIA 0x02
  285. #define IDE_ERROR_ILLEGAL_LENGTH 0x01
  286. //
  287. // ATAPI register definition
  288. //
  289. typedef struct _ATAPI_REGISTERS_1 {
  290. PUCHAR RegistersBaseAddress;
  291. PUSHORT Data;
  292. PUCHAR Error;
  293. PUCHAR InterruptReason;
  294. PUCHAR Unused1;
  295. PUCHAR ByteCountLow;
  296. PUCHAR ByteCountHigh;
  297. PUCHAR DriveSelect;
  298. PUCHAR Command;
  299. } ATAPI_REGISTERS_1, *PATAPI_REGISTERS_1;
  300. typedef struct _ATAPI_REGISTERS_2 {
  301. PUCHAR RegistersBaseAddress;
  302. PUCHAR DeviceControl;
  303. PUCHAR DriveAddress;
  304. } ATAPI_REGISTERS_2, *PATAPI_REGISTERS_2;
  305. //
  306. // ATAPI interrupt reasons
  307. //
  308. #define ATAPI_IR_COD 0x01
  309. #define ATAPI_IR_IO 0x02
  310. //
  311. // IDENTIFY data
  312. //
  313. /**************** Moved to ide.h *************
  314. #pragma pack (1)
  315. typedef struct _IDENTIFY_DATA {
  316. USHORT GeneralConfiguration; // 00 00
  317. USHORT NumCylinders; // 02 1
  318. USHORT Reserved1; // 04 2
  319. USHORT NumHeads; // 06 3
  320. USHORT UnformattedBytesPerTrack; // 08 4
  321. USHORT UnformattedBytesPerSector; // 0A 5
  322. USHORT NumSectorsPerTrack; // 0C 6
  323. USHORT VendorUnique1[3]; // 0E 7-9
  324. UCHAR SerialNumber[20]; // 14 10-19
  325. USHORT BufferType; // 28 20
  326. USHORT BufferSectorSize; // 2A 21
  327. USHORT NumberOfEccBytes; // 2C 22
  328. UCHAR FirmwareRevision[8]; // 2E 23-26
  329. UCHAR ModelNumber[40]; // 36 27-46
  330. UCHAR MaximumBlockTransfer; // 5E 47
  331. UCHAR VendorUnique2; // 5F
  332. USHORT DoubleWordIo; // 60 48
  333. USHORT Capabilities; // 62 49
  334. USHORT Reserved2; // 64 50
  335. UCHAR VendorUnique3; // 66 51
  336. UCHAR PioCycleTimingMode; // 67
  337. UCHAR VendorUnique4; // 68 52
  338. UCHAR DmaCycleTimingMode; // 69
  339. USHORT TranslationFieldsValid:3; // 6A 53
  340. USHORT Reserved3:13;
  341. USHORT NumberOfCurrentCylinders; // 6C 54
  342. USHORT NumberOfCurrentHeads; // 6E 55
  343. USHORT CurrentSectorsPerTrack; // 70 56
  344. ULONG CurrentSectorCapacity; // 72 57-58
  345. USHORT CurrentMultiSectorSetting; // 59
  346. ULONG UserAddressableSectors; // 60-61
  347. USHORT SingleWordDMASupport : 8; // 62
  348. USHORT SingleWordDMAActive : 8;
  349. USHORT MultiWordDMASupport : 8; // 63
  350. USHORT MultiWordDMAActive : 8;
  351. USHORT AdvancedPIOModes : 8; // 64
  352. USHORT Reserved4 : 8;
  353. USHORT MinimumMWXferCycleTime; // 65
  354. USHORT RecommendedMWXferCycleTime; // 66
  355. USHORT MinimumPIOCycleTime; // 67
  356. USHORT MinimumPIOCycleTimeIORDY; // 68
  357. USHORT Reserved5[11]; // 69-79
  358. USHORT MajorRevision; // 80
  359. USHORT MinorRevision; // 81
  360. USHORT Reserved6[6]; // 82-87
  361. USHORT UltraDMASupport : 8; // 88
  362. USHORT UltraDMAActive : 8; //
  363. USHORT Reserved7[37]; // 89-125
  364. USHORT LastLun:3; // 126
  365. USHORT Reserved8:13;
  366. USHORT MediaStatusNotification:2; // 127
  367. USHORT Reserved9:6;
  368. USHORT DeviceWriteProtect:1;
  369. USHORT Reserved10:7;
  370. USHORT Reserved11[128]; // 128-255
  371. } IDENTIFY_DATA, *PIDENTIFY_DATA;
  372. //
  373. // Identify data without the Reserved4.
  374. //
  375. //typedef struct _IDENTIFY_DATA2 {
  376. // USHORT GeneralConfiguration; // 00 00
  377. // USHORT NumCylinders; // 02 1
  378. // USHORT Reserved1; // 04 2
  379. // USHORT NumHeads; // 06 3
  380. // USHORT UnformattedBytesPerTrack; // 08 4
  381. // USHORT UnformattedBytesPerSector; // 0A 5
  382. // USHORT NumSectorsPerTrack; // 0C 6
  383. // USHORT VendorUnique1[3]; // 0E 7-9
  384. // UCHAR SerialNumber[20]; // 14 10-19
  385. // USHORT BufferType; // 28 20
  386. // USHORT BufferSectorSize; // 2A 21
  387. // USHORT NumberOfEccBytes; // 2C 22
  388. // UCHAR FirmwareRevision[8]; // 2E 23-26
  389. // UCHAR ModelNumber[40]; // 36 27-46
  390. // UCHAR MaximumBlockTransfer; // 5E 47
  391. // UCHAR VendorUnique2; // 5F
  392. // USHORT DoubleWordIo; // 60 48
  393. // USHORT Capabilities; // 62 49
  394. // USHORT Reserved2; // 64 50
  395. // UCHAR VendorUnique3; // 66 51
  396. // UCHAR PioCycleTimingMode; // 67
  397. // UCHAR VendorUnique4; // 68 52
  398. // UCHAR DmaCycleTimingMode; // 69
  399. // USHORT TranslationFieldsValid:3; // 6A 53
  400. // USHORT Reserved3:13;
  401. // USHORT NumberOfCurrentCylinders; // 6C 54
  402. // USHORT NumberOfCurrentHeads; // 6E 55
  403. // USHORT CurrentSectorsPerTrack; // 70 56
  404. // ULONG CurrentSectorCapacity; // 72 57-58
  405. // USHORT CurrentMultiSectorSetting; // 59
  406. // ULONG UserAddressableSectors; // 60-61
  407. // USHORT SingleWordDMASupport : 8; // 62
  408. // USHORT SingleWordDMAActive : 8;
  409. // USHORT MultiWordDMASupport : 8; // 63
  410. // USHORT MultiWordDMAActive : 8;
  411. // USHORT AdvancedPIOModes : 8; // 64
  412. // USHORT Reserved4 : 8;
  413. // USHORT MinimumMWXferCycleTime; // 65
  414. // USHORT RecommendedMWXferCycleTime; // 66
  415. // USHORT MinimumPIOCycleTime; // 67
  416. // USHORT MinimumPIOCycleTimeIORDY; // 68
  417. // USHORT Reserved5[11]; // 69-79
  418. // USHORT MajorRevision; // 80
  419. // USHORT MinorRevision; // 81
  420. // USHORT Reserved6[6]; // 82-87
  421. // USHORT UltraDMASupport : 8; // 88
  422. // USHORT UltraDMAActive : 8; //
  423. // USHORT Reserved7[37]; // 89-125
  424. // USHORT LastLun:3; // 126
  425. // USHORT Reserved8:13;
  426. // USHORT MediaStatusNotification:2; // 127
  427. // USHORT Reserved9:6;
  428. // USHORT DeviceWriteProtect:1;
  429. // USHORT Reserved10:7;
  430. //} IDENTIFY_DATA2, *PIDENTIFY_DATA2;
  431. #pragma pack ()
  432. #define IDENTIFY_DATA_SIZE sizeof(IDENTIFY_DATA)
  433. ******************************************************/
  434. //
  435. // Identify Data General Configuration Bit Definition
  436. //
  437. #define IDE_IDDATA_DEVICE_TYPE_MASK ((1 << 15) | (1 << 14))
  438. #define IDE_IDDATA_ATAPI_DEVICE ((1 << 15 | (0 << 14))
  439. #define IDE_IDDATA_ATAPI_DEVICE_MASK ((1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8))
  440. #define IDE_IDDATA_REMOVABLE (1 << 7)
  441. #define IDE_IDDATA_DRQ_TYPE_MASK ((1 << 6) | (1 << 5))
  442. #define IDE_IDDATA_INTERRUPT_DRQ ((1 << 6) | (0 << 5))
  443. //
  444. // Identify Data 48 bit lba support
  445. //
  446. #define IDE_IDDATA_48BIT_LBA_SUPPORT (1<<10)
  447. //
  448. // IDENTIFY capability bit definitions.
  449. //
  450. #define IDENTIFY_CAPABILITIES_DMA_SUPPORTED (1 << 8)
  451. #define IDENTIFY_CAPABILITIES_LBA_SUPPORTED (1 << 9)
  452. #define IDENTIFY_CAPABILITIES_IOREADY_CAN_BE_DISABLED (1 << 10)
  453. #define IDENTIFY_CAPABILITIES_IOREADY_SUPPORTED (1 << 11)
  454. //
  455. // Identify MediaStatusNotification
  456. //
  457. #define IDENTIFY_MEDIA_STATUS_NOTIFICATION_SUPPORTED (0x1)
  458. //
  459. // Select LBA mode when progran IDE device
  460. //
  461. #define IDE_LBA_MODE (1 << 6)
  462. //
  463. // ID DATA
  464. //
  465. /********** Not needed ****************
  466. #define IDD_UDMA_MODE0_ACTIVE (1 << 0)
  467. #define IDD_UDMA_MODE1_ACTIVE (1 << 1)
  468. #define IDD_UDMA_MODE2_ACTIVE (1 << 2)
  469. #define IDD_UDMA_MODE3_ACTIVE (1 << 3)
  470. #define IDD_UDMA_MODE4_ACTIVE (1 << 4)
  471. #define IDD_UDMA_MODE5_ACTIVE (1 << 5)
  472. #define IDD_MWDMA_MODE0_ACTIVE (1 << 0)
  473. #define IDD_MWDMA_MODE1_ACTIVE (1 << 1)
  474. #define IDD_MWDMA_MODE2_ACTIVE (1 << 2)
  475. #define IDD_SWDMA_MODE0_ACTIVE (1 << 0)
  476. #define IDD_SWDMA_MODE1_ACTIVE (1 << 1)
  477. #define IDD_SWDMA_MODE2_ACTIVE (1 << 2)
  478. #define IDD_UDMA_MODE0_SUPPORTED (1 << 0)
  479. #define IDD_UDMA_MODE1_SUPPORTED (1 << 1)
  480. #define IDD_UDMA_MODE2_SUPPORTED (1 << 2)
  481. #define IDD_MWDMA_MODE0_SUPPORTED (1 << 0)
  482. #define IDD_MWDMA_MODE1_SUPPORTED (1 << 1)
  483. #define IDD_MWDMA_MODE2_SUPPORTED (1 << 2)
  484. #define IDD_SWDMA_MODE0_SUPPORTED (1 << 0)
  485. #define IDD_SWDMA_MODE1_SUPPORTED (1 << 1)
  486. #define IDD_SWDMA_MODE2_SUPPORTED (1 << 2)
  487. ************/
  488. //
  489. // Beautification macros
  490. //
  491. #define HasSlaveDevice(HwExt, Target) (HwExt->DeviceFlags[(Target+1)%MAX_IDE_DEVICE] & DFLAGS_DEVICE_PRESENT)
  492. #ifdef ENABLE_ATAPI_VERIFIER
  493. #define GetBaseStatus(BaseIoAddress, Status) \
  494. Status = ViIdeGetBaseStatus((PIDE_REGISTERS_1)BaseIoAddress);
  495. #define GetErrorByte(BaseIoAddress, ErrorByte) \
  496. ErrorByte = ViIdeGetErrorByte((PIDE_REGISTERS_1)BaseIoAddress);
  497. #else
  498. #define GetBaseStatus(BaseIoAddress, Status) \
  499. Status = IdePortInPortByte((BaseIoAddress)->Command);
  500. #define GetErrorByte(BaseIoAddress, ErrorByte) \
  501. ErrorByte = IdePortInPortByte((BaseIoAddress)->Error);
  502. #endif
  503. #define WriteCommand(BaseIoAddress, Command) \
  504. IdePortOutPortByte((BaseIoAddress)->Command, Command);
  505. #define ReadBuffer(BaseIoAddress, Buffer, Count) \
  506. IdePortInPortWordBuffer((PUSHORT)(BaseIoAddress)->Data, Buffer, Count);
  507. #define WriteBuffer(BaseIoAddress, Buffer, Count) \
  508. IdePortOutPortWordBuffer((PUSHORT)(BaseIoAddress)->Data, Buffer, Count);
  509. #define WaitOnBusy(BaseIoAddress, Status) \
  510. { \
  511. ULONG stallTime; \
  512. ULONG sec; \
  513. ULONG i; \
  514. for (sec=0; sec<10; sec++) { \
  515. /**/ \
  516. /* one second loop */ \
  517. /**/ \
  518. for (i=0; i<25000; i++) { \
  519. GetStatus(BaseIoAddress, Status); \
  520. if (Status & IDE_STATUS_BUSY) { \
  521. stallTime = 40; \
  522. KeStallExecutionProcessor(stallTime); \
  523. continue; \
  524. } else { \
  525. break; \
  526. } \
  527. } \
  528. if (Status & IDE_STATUS_BUSY) { \
  529. DebugPrint ((1, "ATAPI: after 1 sec wait, device is still busy with 0x%x status = 0x%x\n", (BaseIoAddress)->RegistersBaseAddress, (ULONG) (Status))); \
  530. } else { \
  531. break; \
  532. } \
  533. } \
  534. if (Status & IDE_STATUS_BUSY) { \
  535. DebugPrint ((0, "WaitOnBusy failed in %s line %u. 0x%x status = 0x%x\n", __FILE__, __LINE__, (BaseIoAddress)->RegistersBaseAddress, (ULONG) (Status))); \
  536. } \
  537. }
  538. #define WaitForDRDY(BaseIoAddress, Status) \
  539. { \
  540. ULONG i; \
  541. WaitOnBusy(BaseIoAddress, Status);\
  542. for (i=0; i<20000; i++) { \
  543. GetStatus(BaseIoAddress, Status); \
  544. if (!(Status & IDE_STATUS_IDLE)) { \
  545. KeStallExecutionProcessor(150); \
  546. continue; \
  547. } else { \
  548. break; \
  549. } \
  550. } \
  551. if (i == 20000) \
  552. DebugPrint ((0, "WaitForDRDY failed in %s line %u. 0x%x status = 0x%x\n", __FILE__, __LINE__, (BaseIoAddress)->RegistersBaseAddress, (ULONG) (Status))); \
  553. }
  554. #define WaitOnBusyUntil(BaseIoAddress, Status, Millisec) \
  555. { \
  556. ULONG i; \
  557. ULONG maxCount = Millisec * 10;\
  558. for (i=0; i<maxCount; i++) { \
  559. GetStatus(BaseIoAddress, Status); \
  560. if (Status & IDE_STATUS_BUSY) { \
  561. KeStallExecutionProcessor(100); \
  562. continue; \
  563. } else { \
  564. break; \
  565. } \
  566. } \
  567. if (i == maxCount) \
  568. DebugPrint ((0, "WaitOnBusyUntil failed in %s line %u. status = 0x%x\n", __FILE__, __LINE__, (ULONG) (Status))); \
  569. }
  570. #define WaitOnBaseBusy(BaseIoAddress, Status) \
  571. { \
  572. ULONG i; \
  573. for (i=0; i<20000; i++) { \
  574. GetBaseStatus(BaseIoAddress, Status); \
  575. if (Status & IDE_STATUS_BUSY) { \
  576. KeStallExecutionProcessor(150); \
  577. continue; \
  578. } else { \
  579. break; \
  580. } \
  581. } \
  582. }
  583. #define WaitForDrq(BaseIoAddress, Status) \
  584. { \
  585. ULONG i; \
  586. for (i=0; i<1000; i++) { \
  587. GetStatus(BaseIoAddress, Status); \
  588. if (Status & IDE_STATUS_BUSY) { \
  589. KeStallExecutionProcessor(100); \
  590. } else if (Status & IDE_STATUS_DRQ) { \
  591. break; \
  592. } else { \
  593. KeStallExecutionProcessor(200); \
  594. } \
  595. } \
  596. }
  597. #define WaitShortForDrq(BaseIoAddress, Status) \
  598. { \
  599. ULONG i; \
  600. for (i=0; i<2; i++) { \
  601. GetStatus(BaseIoAddress, Status); \
  602. if (Status & IDE_STATUS_BUSY) { \
  603. KeStallExecutionProcessor(100); \
  604. } else if (Status & IDE_STATUS_DRQ) { \
  605. break; \
  606. } else { \
  607. KeStallExecutionProcessor(100); \
  608. } \
  609. } \
  610. }
  611. #define AtapiSoftReset(BaseIoAddress1, BaseIoAddress2, DeviceNumber, interruptOff) \
  612. {\
  613. ULONG __i;\
  614. UCHAR statusByte; \
  615. SelectIdeDevice(BaseIoAddress1, DeviceNumber, 0); \
  616. KeStallExecutionProcessor(500);\
  617. IdePortOutPortByte((BaseIoAddress1)->Command, IDE_COMMAND_ATAPI_RESET); \
  618. KeStallExecutionProcessor(500);\
  619. SelectIdeDevice(BaseIoAddress1, DeviceNumber, 0); \
  620. WaitOnBusy(BaseIoAddress1, statusByte); \
  621. if ( !Is98LegacyIde(BaseIoAddress1) ) { \
  622. KeStallExecutionProcessor(500); \
  623. } else { \
  624. for (__i = 0; __i < 20; __i++) { \
  625. KeStallExecutionProcessor(500); \
  626. } \
  627. } \
  628. if (interruptOff) { \
  629. IdePortOutPortByte(BaseIoAddress2->DeviceControl, IDE_DC_DISABLE_INTERRUPTS); \
  630. } \
  631. }
  632. #define SAVE_ORIGINAL_CDB(DeviceExtension, Srb) \
  633. RtlCopyMemory(DeviceExtension->OriginalCdb, Srb->Cdb, sizeof(CDB));
  634. #define RESTORE_ORIGINAL_CDB(DeviceExtension, Srb) \
  635. RtlCopyMemory(Srb->Cdb, DeviceExtension->OriginalCdb, sizeof(CDB));
  636. //
  637. // NEC 98: Buffer size of mode sense data.
  638. //
  639. #define MODE_DATA_SIZE 192
  640. typedef enum {
  641. IdeResetBegin = 0,
  642. ideResetBusResetInProgress,
  643. ideResetAtapiReset,
  644. ideResetAtapiResetInProgress,
  645. ideResetAtapiIdentifyData,
  646. ideResetAtaIDP,
  647. ideResetAtaIDPInProgress,
  648. ideResetAtaMSN,
  649. ideResetFinal
  650. } IDE_RESET_STATE;
  651. //
  652. // Definition in ide.h
  653. //
  654. struct IDENTIFY_DATA;
  655. //
  656. // Device extension
  657. //
  658. typedef struct _HW_DEVICE_EXTENSION {
  659. //
  660. // Current request on controller.
  661. //
  662. PSCSI_REQUEST_BLOCK CurrentSrb;
  663. //
  664. // Base register locations
  665. //
  666. IDE_REGISTERS_1 BaseIoAddress1;
  667. IDE_REGISTERS_2 BaseIoAddress2;
  668. //
  669. // Register length.
  670. //
  671. ULONG BaseIoAddress1Length;
  672. ULONG BaseIoAddress2Length;
  673. //
  674. // Max ide device/target-id
  675. //
  676. ULONG MaxIdeDevice;
  677. ULONG MaxIdeTargetId;
  678. //
  679. // Variables to check empty channel
  680. //
  681. #ifdef DPC_FOR_EMPTY_CHANNEL
  682. ULONG CurrentIdeDevice;
  683. ULONG MoreWait;
  684. ULONG NoRetry;
  685. #endif
  686. //
  687. // Drive Geometry
  688. //
  689. ULONG NumberOfCylinders[MAX_IDE_DEVICE * MAX_IDE_LINE];
  690. ULONG NumberOfHeads[MAX_IDE_DEVICE * MAX_IDE_LINE];
  691. ULONG SectorsPerTrack[MAX_IDE_DEVICE * MAX_IDE_LINE];
  692. //
  693. // Interrupt Mode (Level or Edge)
  694. //
  695. ULONG InterruptMode;
  696. //
  697. // Data buffer pointer.
  698. //
  699. PUCHAR DataBuffer;
  700. //
  701. // Data words left.
  702. //
  703. ULONG BytesLeft;
  704. //
  705. // Count of errors. Used to turn off features.
  706. //
  707. ULONG ErrorCount;
  708. //
  709. // Count of timeouts. Used to turn off features.
  710. //
  711. ULONG TimeoutCount[MAX_IDE_DEVICE * MAX_IDE_LINE];
  712. //
  713. // Indicates number of platters on changer-ish devices.
  714. //
  715. ULONG LastLun[MAX_IDE_DEVICE * MAX_IDE_LINE];
  716. //
  717. // Flags word for each possible device.
  718. //
  719. ULONG DeviceFlags[MAX_IDE_DEVICE * MAX_IDE_LINE];
  720. //
  721. // Indicates the number of blocks transferred per int. according to the
  722. // identify data.
  723. //
  724. UCHAR MaximumBlockXfer[MAX_IDE_DEVICE * MAX_IDE_LINE];
  725. //
  726. // Indicates expecting an interrupt
  727. //
  728. BOOLEAN ExpectingInterrupt;
  729. //
  730. // Indicates DMA is in progress
  731. //
  732. BOOLEAN DMAInProgress;
  733. //
  734. // Keep track of whether we convert a SCSI command to ATAPI on the fly
  735. //
  736. BOOLEAN scsi2atapi;
  737. //
  738. // Indicate last tape command was DSC Restrictive.
  739. //
  740. BOOLEAN RDP;
  741. //
  742. // Driver is being used by the crash dump utility or ntldr.
  743. //
  744. BOOLEAN DriverMustPoll;
  745. //
  746. // Indicates whether '0x1f0' is the base address. Used
  747. // in SMART Ioctl calls.
  748. //
  749. BOOLEAN PrimaryAddress;
  750. BOOLEAN SecondaryAddress;
  751. //
  752. // No IDE_SET_FEATURE_SET_TRANSFER_MODE
  753. //
  754. BOOLEAN NoPioSetTransferMode;
  755. //
  756. // Placeholder for the original cdb
  757. //
  758. UCHAR OriginalCdb[16];
  759. //
  760. // Placeholder for the sub-command value of the last
  761. // SMART command.
  762. //
  763. UCHAR SmartCommand;
  764. //
  765. // Placeholder for status register after a GET_MEDIA_STATUS command
  766. //
  767. UCHAR ReturningMediaStatus;
  768. //
  769. // Identify data for device
  770. //
  771. IDENTIFY_DATA IdentifyData[MAX_IDE_DEVICE * MAX_IDE_LINE];
  772. //
  773. // PCI IDE Parent bus master interface
  774. //
  775. PCIIDE_BUSMASTER_INTERFACE BusMasterInterface;
  776. //
  777. // Device Specific Info.
  778. //
  779. struct _DEVICE_PARAMETERS {
  780. ULONG MaxBytePerPioInterrupt;
  781. UCHAR IdePioReadCommand;
  782. UCHAR IdePioWriteCommand;
  783. UCHAR IdeFlushCommand;
  784. UCHAR IdePioReadCommandExt;
  785. UCHAR IdePioWriteCommandExt;
  786. UCHAR IdeFlushCommandExt;
  787. //
  788. // Timing Stuff
  789. //
  790. BOOLEAN IoReadyEnabled;
  791. ULONG BestPioCycleTime;
  792. ULONG BestSwDmaCycleTime;
  793. ULONG BestMwDmaCycleTime;
  794. ULONG BestUDmaCycleTime;
  795. ULONG TransferModeSupported;
  796. ULONG BestPioMode;
  797. ULONG BestSwDmaMode;
  798. ULONG BestMwDmaMode;
  799. ULONG BestUDmaMode;
  800. ULONG TransferModeCurrent;
  801. ULONG TransferModeSelected;
  802. ULONG TransferModeMask;
  803. } DeviceParameters[MAX_IDE_DEVICE * MAX_IDE_LINE];
  804. #define RESET_STATE_TABLE_LEN (((2 + 3 * MAX_IDE_DEVICE) * MAX_IDE_LINE) + 1)
  805. struct RESET_STATE {
  806. ULONG WaitBusyCount;
  807. IDE_RESET_STATE State[RESET_STATE_TABLE_LEN];
  808. IDE_RESET_STATE DeviceNumber[RESET_STATE_TABLE_LEN];
  809. } ResetState;
  810. } HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;
  811. //
  812. // max number of CHS addressable sectors
  813. //
  814. //#define MAX_NUM_CHS_ADDRESSABLE_SECTORS ((ULONG) (16515072 - 1))
  815. #define MAX_NUM_CHS_ADDRESSABLE_SECTORS ((ULONG) (16514064))
  816. #define MAX_28BIT_LBA ((ULONG) (1<<28))
  817. //
  818. // IDE Cycle Timing
  819. //
  820. /****************************Moved to idep.h****************
  821. #define PIO_MODE0_CYCLE_TIME 600
  822. #define PIO_MODE1_CYCLE_TIME 383
  823. #define PIO_MODE2_CYCLE_TIME 240
  824. #define PIO_MODE3_CYCLE_TIME 180
  825. #define PIO_MODE4_CYCLE_TIME 120
  826. #define SWDMA_MODE0_CYCLE_TIME 960
  827. #define SWDMA_MODE1_CYCLE_TIME 480
  828. #define SWDMA_MODE2_CYCLE_TIME 240
  829. #define MWDMA_MODE0_CYCLE_TIME 480
  830. #define MWDMA_MODE1_CYCLE_TIME 150
  831. #define MWDMA_MODE2_CYCLE_TIME 120
  832. #define UDMA_MODE0_CYCLE_TIME 120
  833. #define UDMA_MODE1_CYCLE_TIME 80
  834. #define UDMA_MODE2_CYCLE_TIME 60
  835. #define UDMA_MODE3_CYCLE_TIME 45
  836. #define UDMA_MODE4_CYCLE_TIME 30
  837. #define UDMA_MODE5_CYCLE_TIME 15
  838. #define UNINITIALIZED_CYCLE_TIME 0xffffffff
  839. #define UNINITIALIZED_TRANSFER_MODE 0xffffffff
  840. */
  841. BOOLEAN
  842. AtapiInterrupt(
  843. IN PVOID HwDeviceExtension
  844. );
  845. BOOLEAN
  846. AtapiHwInitialize(
  847. IN PVOID HwDeviceExtension,
  848. IN UCHAR FlushCommand[MAX_IDE_DEVICE * MAX_IDE_LINE]
  849. );
  850. BOOLEAN
  851. AtapiStartIo(
  852. IN PVOID HwDeviceExtension,
  853. IN PSCSI_REQUEST_BLOCK Srb
  854. );
  855. BOOLEAN
  856. AtapiResetController(
  857. IN PVOID HwDeviceExtension,
  858. IN ULONG PathId,
  859. IN PULONG CallAgain
  860. );
  861. VOID
  862. InitDeviceParameters (
  863. IN PVOID HwDeviceExtension,
  864. IN UCHAR FlushCommand[MAX_IDE_DEVICE * MAX_IDE_LINE]
  865. );
  866. VOID
  867. AtapiProgramTransferMode (
  868. PHW_DEVICE_EXTENSION DeviceExtension
  869. );
  870. VOID
  871. AtapiHwInitializeMultiLun (
  872. IN PVOID HwDeviceExtension,
  873. IN ULONG TargetId,
  874. IN ULONG numSlot
  875. );
  876. ULONG
  877. AtapiSendCommand(
  878. IN PVOID HwDeviceExtension,
  879. IN PSCSI_REQUEST_BLOCK Srb
  880. );
  881. ULONG
  882. IdeBuildSenseBuffer(
  883. IN PVOID HwDeviceExtension,
  884. IN PSCSI_REQUEST_BLOCK Srb
  885. );
  886. VOID
  887. IdeMediaStatus(
  888. IN BOOLEAN EnableMSN,
  889. IN PVOID HwDeviceExtension,
  890. IN ULONG DeviceNumber
  891. );
  892. VOID
  893. DeviceSpecificInitialize(
  894. IN PVOID HwDeviceExtension
  895. );
  896. BOOLEAN
  897. EnableBusMasterController (
  898. IN PVOID HwDeviceExtension,
  899. IN PCHAR userArgumentString
  900. );
  901. BOOLEAN
  902. AtapiDeviceDMACapable (
  903. IN PVOID HwDeviceExtension,
  904. IN ULONG deviceNumber
  905. );
  906. BOOLEAN
  907. GetAtapiIdentifyQuick (
  908. PIDE_REGISTERS_1 BaseIoAddress1,
  909. PIDE_REGISTERS_2 BaseIoAddress2,
  910. IN ULONG DeviceNumber,
  911. OUT PIDENTIFY_DATA IdentifyData
  912. );
  913. BOOLEAN
  914. IssueIdentify(
  915. PIDE_REGISTERS_1 CmdBaseAddr,
  916. PIDE_REGISTERS_2 CtrlBaseAddr,
  917. IN ULONG DeviceNumber,
  918. IN UCHAR Command,
  919. IN BOOLEAN InterruptOff,
  920. OUT PIDENTIFY_DATA IdentifyData
  921. );
  922. VOID
  923. InitDeviceGeometry(
  924. PHW_DEVICE_EXTENSION HwDeviceExtension,
  925. ULONG Device,
  926. ULONG NumberOfCylinders,
  927. ULONG NumberOfHeads,
  928. ULONG SectorsPerTrack
  929. );
  930. VOID
  931. InitHwExtWithIdentify(
  932. IN PVOID HwDeviceExtension,
  933. IN ULONG DeviceNumber,
  934. IN UCHAR Command,
  935. IN PIDENTIFY_DATA IdentifyData,
  936. IN BOOLEAN RemovableMedia
  937. );
  938. BOOLEAN
  939. SetDriveParameters(
  940. IN PVOID HwDeviceExtension,
  941. IN ULONG DeviceNumber,
  942. IN BOOLEAN Sync
  943. );
  944. BOOLEAN
  945. FindDevices(
  946. IN PVOID HwDeviceExtension,
  947. IN BOOLEAN AtapiOnly
  948. );
  949. ULONG
  950. IdeSendPassThroughCommand(
  951. IN PVOID HwDeviceExtension,
  952. IN PSCSI_REQUEST_BLOCK Srb
  953. );
  954. ULONG
  955. IdeSendAtaPassThroughExCommand(
  956. IN PVOID HwDeviceExtension,
  957. IN PSCSI_REQUEST_BLOCK Srb
  958. );
  959. BOOLEAN
  960. AtapiSyncResetController(
  961. IN PVOID HwDeviceExtension,
  962. IN ULONG PathId
  963. );
  964. NTSTATUS
  965. IdeHardReset (
  966. PIDE_REGISTERS_1 BaseIoAddress1,
  967. PIDE_REGISTERS_2 BaseIoAddress2,
  968. BOOLEAN InterruptOff,
  969. BOOLEAN Sync
  970. );
  971. ULONG
  972. IdeReadWriteExt(
  973. IN PVOID HwDeviceExtension,
  974. IN PSCSI_REQUEST_BLOCK Srb
  975. );
  976. ULONG
  977. IdeReadWrite(
  978. IN PVOID HwDeviceExtension,
  979. IN PSCSI_REQUEST_BLOCK Srb
  980. );
  981. VOID
  982. AtapiTaskRegisterSnapshot (
  983. IN PIDE_REGISTERS_1 CmdRegBase,
  984. IN OUT PIDEREGS IdeReg
  985. );
  986. NTSTATUS
  987. AtapiSetTransferMode (
  988. PHW_DEVICE_EXTENSION DeviceExtension,
  989. ULONG DeviceNumber,
  990. UCHAR ModeValue
  991. );
  992. #define ATA_VERSION_MASK (0xfffe)
  993. #define ATA1_COMPLIANCE (1 << 1)
  994. #define ATA2_COMPLIANCE (1 << 2)
  995. #define ATA3_COMPLIANCE (1 << 3)
  996. #define ATA4_COMPLIANCE (1 << 4)
  997. #endif // ___atapi_h___