xref: /reactos/sdk/include/ddk/ata.h (revision c2c66aff)
1 #ifndef _NTATA_
2 #define _NTATA_
3 
4 #include <pshpack1.h>
5 typedef struct _IDENTIFY_DEVICE_DATA {
6   struct {
7     USHORT Reserved1  :1;
8     USHORT Retired3  :1;
9     USHORT ResponseIncomplete  :1;
10     USHORT Retired2  :3;
11     USHORT FixedDevice  :1;
12     USHORT RemovableMedia  :1;
13     USHORT Retired1  :7;
14     USHORT DeviceType  :1;
15   } GeneralConfiguration;
16   USHORT NumCylinders;
17   USHORT ReservedWord2;
18   USHORT NumHeads;
19   USHORT Retired1[2];
20   USHORT NumSectorsPerTrack;
21   USHORT VendorUnique1[3];
22   UCHAR  SerialNumber[20];
23   USHORT Retired2[2];
24   USHORT Obsolete1;
25   UCHAR  FirmwareRevision[8];
26   UCHAR  ModelNumber[40];
27   UCHAR  MaximumBlockTransfer;
28   UCHAR  VendorUnique2;
29   USHORT ReservedWord48;
30   struct {
31     UCHAR  ReservedByte49;
32     UCHAR  DmaSupported  :1;
33     UCHAR  LbaSupported  :1;
34     UCHAR  IordyDisable  :1;
35     UCHAR  IordySupported  :1;
36     UCHAR  Reserved1  :1;
37     UCHAR  StandybyTimerSupport  :1;
38     UCHAR  Reserved2  :2;
39     USHORT ReservedWord50;
40   } Capabilities;
41   USHORT ObsoleteWords51[2];
42   USHORT TranslationFieldsValid  :3;
43   USHORT Reserved3  :13;
44   USHORT NumberOfCurrentCylinders;
45   USHORT NumberOfCurrentHeads;
46   USHORT CurrentSectorsPerTrack;
47   ULONG  CurrentSectorCapacity;
48   UCHAR  CurrentMultiSectorSetting;
49   UCHAR  MultiSectorSettingValid  :1;
50   UCHAR  ReservedByte59  :7;
51   ULONG  UserAddressableSectors;
52   USHORT ObsoleteWord62;
53   USHORT MultiWordDMASupport  :8;
54   USHORT MultiWordDMAActive  :8;
55   USHORT AdvancedPIOModes  :8;
56   USHORT ReservedByte64  :8;
57   USHORT MinimumMWXferCycleTime;
58   USHORT RecommendedMWXferCycleTime;
59   USHORT MinimumPIOCycleTime;
60   USHORT MinimumPIOCycleTimeIORDY;
61   USHORT ReservedWords69[6];
62   USHORT QueueDepth  :5;
63   USHORT ReservedWord75  :11;
64   USHORT ReservedWords76[4];
65   USHORT MajorRevision;
66   USHORT MinorRevision;
67   struct {
68     USHORT SmartCommands  :1;
69     USHORT SecurityMode  :1;
70     USHORT RemovableMediaFeature  :1;
71     USHORT PowerManagement  :1;
72     USHORT Reserved1  :1;
73     USHORT WriteCache  :1;
74     USHORT LookAhead  :1;
75     USHORT ReleaseInterrupt  :1;
76     USHORT ServiceInterrupt  :1;
77     USHORT DeviceReset  :1;
78     USHORT HostProtectedArea  :1;
79     USHORT Obsolete1  :1;
80     USHORT WriteBuffer  :1;
81     USHORT ReadBuffer  :1;
82     USHORT Nop  :1;
83     USHORT Obsolete2  :1;
84     USHORT DownloadMicrocode  :1;
85     USHORT DmaQueued  :1;
86     USHORT Cfa  :1;
87     USHORT AdvancedPm  :1;
88     USHORT Msn  :1;
89     USHORT PowerUpInStandby  :1;
90     USHORT ManualPowerUp  :1;
91     USHORT Reserved2  :1;
92     USHORT SetMax  :1;
93     USHORT Acoustics  :1;
94     USHORT BigLba  :1;
95     USHORT DeviceConfigOverlay  :1;
96     USHORT FlushCache  :1;
97     USHORT FlushCacheExt  :1;
98     USHORT Resrved3  :2;
99     USHORT SmartErrorLog  :1;
100     USHORT SmartSelfTest  :1;
101     USHORT MediaSerialNumber  :1;
102     USHORT MediaCardPassThrough  :1;
103     USHORT StreamingFeature  :1;
104     USHORT GpLogging  :1;
105     USHORT WriteFua  :1;
106     USHORT WriteQueuedFua  :1;
107     USHORT WWN64Bit  :1;
108     USHORT URGReadStream  :1;
109     USHORT URGWriteStream  :1;
110     USHORT ReservedForTechReport  :2;
111     USHORT IdleWithUnloadFeature  :1;
112     USHORT Reserved4  :2;
113   } CommandSetSupport;
114   struct {
115     USHORT SmartCommands  :1;
116     USHORT SecurityMode  :1;
117     USHORT RemovableMediaFeature  :1;
118     USHORT PowerManagement  :1;
119     USHORT Reserved1  :1;
120     USHORT WriteCache  :1;
121     USHORT LookAhead  :1;
122     USHORT ReleaseInterrupt  :1;
123     USHORT ServiceInterrupt  :1;
124     USHORT DeviceReset  :1;
125     USHORT HostProtectedArea  :1;
126     USHORT Obsolete1  :1;
127     USHORT WriteBuffer  :1;
128     USHORT ReadBuffer  :1;
129     USHORT Nop  :1;
130     USHORT Obsolete2  :1;
131     USHORT DownloadMicrocode  :1;
132     USHORT DmaQueued  :1;
133     USHORT Cfa  :1;
134     USHORT AdvancedPm  :1;
135     USHORT Msn  :1;
136     USHORT PowerUpInStandby  :1;
137     USHORT ManualPowerUp  :1;
138     USHORT Reserved2  :1;
139     USHORT SetMax  :1;
140     USHORT Acoustics  :1;
141     USHORT BigLba  :1;
142     USHORT DeviceConfigOverlay  :1;
143     USHORT FlushCache  :1;
144     USHORT FlushCacheExt  :1;
145     USHORT Resrved3  :2;
146     USHORT SmartErrorLog  :1;
147     USHORT SmartSelfTest  :1;
148     USHORT MediaSerialNumber  :1;
149     USHORT MediaCardPassThrough  :1;
150     USHORT StreamingFeature  :1;
151     USHORT GpLogging  :1;
152     USHORT WriteFua  :1;
153     USHORT WriteQueuedFua  :1;
154     USHORT WWN64Bit  :1;
155     USHORT URGReadStream  :1;
156     USHORT URGWriteStream  :1;
157     USHORT ReservedForTechReport  :2;
158     USHORT IdleWithUnloadFeature  :1;
159     USHORT Reserved4  :2;
160   } CommandSetActive;
161   USHORT UltraDMASupport  :8;
162   USHORT UltraDMAActive  :8;
163   USHORT ReservedWord89[4];
164   USHORT HardwareResetResult;
165   USHORT CurrentAcousticValue  :8;
166   USHORT RecommendedAcousticValue  :8;
167   USHORT ReservedWord95[5];
168   ULONG  Max48BitLBA[2];
169   USHORT StreamingTransferTime;
170   USHORT ReservedWord105;
171   struct {
172     USHORT LogicalSectorsPerPhysicalSector  :4;
173     USHORT Reserved0  :8;
174     USHORT LogicalSectorLongerThan256Words  :1;
175     USHORT MultipleLogicalSectorsPerPhysicalSector  :1;
176     USHORT Reserved1  :2;
177   } PhysicalLogicalSectorSize;
178   USHORT InterSeekDelay;
179   USHORT WorldWideName[4];
180   USHORT ReservedForWorldWideName128[4];
181   USHORT ReservedForTlcTechnicalReport;
182   USHORT WordsPerLogicalSector[2];
183   struct {
184     USHORT ReservedForDrqTechnicalReport  :1;
185     USHORT WriteReadVerifySupported  :1;
186     USHORT Reserved01  :11;
187     USHORT Reserved1  :2;
188   } CommandSetSupportExt;
189   struct {
190     USHORT ReservedForDrqTechnicalReport  :1;
191     USHORT WriteReadVerifyEnabled  :1;
192     USHORT Reserved01  :11;
193     USHORT Reserved1  :2;
194   } CommandSetActiveExt;
195   USHORT ReservedForExpandedSupportandActive[6];
196   USHORT MsnSupport  :2;
197   USHORT ReservedWord1274  :14;
198   struct {
199     USHORT SecuritySupported  :1;
200     USHORT SecurityEnabled  :1;
201     USHORT SecurityLocked  :1;
202     USHORT SecurityFrozen  :1;
203     USHORT SecurityCountExpired  :1;
204     USHORT EnhancedSecurityEraseSupported  :1;
205     USHORT Reserved0  :2;
206     USHORT SecurityLevel  :1;
207     USHORT Reserved1  :7;
208   } SecurityStatus;
209   USHORT ReservedWord129[31];
210   struct {
211     USHORT MaximumCurrentInMA2  :12;
212     USHORT CfaPowerMode1Disabled  :1;
213     USHORT CfaPowerMode1Required  :1;
214     USHORT Reserved0  :1;
215     USHORT Word160Supported  :1;
216   } CfaPowerModel;
217   USHORT ReservedForCfaWord161[8];
218   struct {
219     USHORT SupportsTrim  :1;
220     USHORT Reserved0  :15;
221   } DataSetManagementFeature;
222   USHORT ReservedForCfaWord170[6];
223   USHORT CurrentMediaSerialNumber[30];
224   USHORT ReservedWord206;
225   USHORT ReservedWord207[2];
226   struct {
227     USHORT AlignmentOfLogicalWithinPhysical  :14;
228     USHORT Word209Supported  :1;
229     USHORT Reserved0  :1;
230   } BlockAlignment;
231   USHORT WriteReadVerifySectorCountMode3Only[2];
232   USHORT WriteReadVerifySectorCountMode2Only[2];
233   struct {
234     USHORT NVCachePowerModeEnabled  :1;
235     USHORT Reserved0  :3;
236     USHORT NVCacheFeatureSetEnabled  :1;
237     USHORT Reserved1  :3;
238     USHORT NVCachePowerModeVersion  :4;
239     USHORT NVCacheFeatureSetVersion  :4;
240   } NVCacheCapabilities;
241   USHORT NVCacheSizeLSW;
242   USHORT NVCacheSizeMSW;
243   USHORT NominalMediaRotationRate;
244   USHORT ReservedWord218;
245   struct {
246     UCHAR NVCacheEstimatedTimeToSpinUpInSeconds;
247     UCHAR Reserved;
248   } NVCacheOptions;
249   USHORT ReservedWord220[35];
250   USHORT Signature  :8;
251   USHORT CheckSum  :8;
252 } IDENTIFY_DEVICE_DATA, *PIDENTIFY_DEVICE_DATA;
253 #include <poppack.h>
254 
255 #define IDE_LBA_MODE                          (1 << 6)
256 
257 #define IDE_COMMAND_NOP                       0x00
258 #define IDE_COMMAND_DATA_SET_MANAGEMENT       0x06
259 #define IDE_COMMAND_ATAPI_RESET               0x08
260 #define IDE_COMMAND_READ                      0x20
261 #define IDE_COMMAND_READ_EXT                  0x24
262 #define IDE_COMMAND_READ_DMA_EXT              0x25
263 #define IDE_COMMAND_READ_DMA_QUEUED_EXT       0x26
264 #define IDE_COMMAND_READ_MULTIPLE_EXT         0x29
265 #define IDE_COMMAND_WRITE                     0x30
266 #define IDE_COMMAND_WRITE_EXT                 0x34
267 #define IDE_COMMAND_WRITE_DMA_EXT             0x35
268 #define IDE_COMMAND_WRITE_DMA_QUEUED_EXT      0x36
269 #define IDE_COMMAND_WRITE_MULTIPLE_EXT        0x39
270 #define IDE_COMMAND_WRITE_DMA_FUA_EXT         0x3D
271 #define IDE_COMMAND_WRITE_DMA_QUEUED_FUA_EXT  0x3E
272 #define IDE_COMMAND_VERIFY                    0x40
273 #define IDE_COMMAND_VERIFY_EXT                0x42
274 #define IDE_COMMAND_EXECUTE_DEVICE_DIAGNOSTIC 0x90
275 #define IDE_COMMAND_SET_DRIVE_PARAMETERS      0x91
276 #define IDE_COMMAND_ATAPI_PACKET              0xA0
277 #define IDE_COMMAND_ATAPI_IDENTIFY            0xA1
278 #define IDE_COMMAND_SMART                     0xB0
279 #define IDE_COMMAND_READ_MULTIPLE             0xC4
280 #define IDE_COMMAND_WRITE_MULTIPLE            0xC5
281 #define IDE_COMMAND_SET_MULTIPLE              0xC6
282 #define IDE_COMMAND_READ_DMA                  0xC8
283 #define IDE_COMMAND_WRITE_DMA                 0xCA
284 #define IDE_COMMAND_WRITE_DMA_QUEUED          0xCC
285 #define IDE_COMMAND_WRITE_MULTIPLE_FUA_EXT    0xCE
286 #define IDE_COMMAND_GET_MEDIA_STATUS          0xDA
287 #define IDE_COMMAND_DOOR_LOCK                 0xDE
288 #define IDE_COMMAND_DOOR_UNLOCK               0xDF
289 #define IDE_COMMAND_STANDBY_IMMEDIATE         0xE0
290 #define IDE_COMMAND_IDLE_IMMEDIATE            0xE1
291 #define IDE_COMMAND_CHECK_POWER               0xE5
292 #define IDE_COMMAND_SLEEP                     0xE6
293 #define IDE_COMMAND_FLUSH_CACHE               0xE7
294 #define IDE_COMMAND_FLUSH_CACHE_EXT           0xEA
295 #define IDE_COMMAND_IDENTIFY                  0xEC
296 #define IDE_COMMAND_MEDIA_EJECT               0xED
297 #define IDE_COMMAND_SET_FEATURE               0xEF
298 #define IDE_COMMAND_SECURITY_FREEZE_LOCK      0xF5
299 #define IDE_COMMAND_NOT_VALID                 0xFF
300 
301 #endif
302