1 /** @file
2   This file contains just some basic definitions that are needed by drivers
3   that dealing with ATA/ATAPI interface.
4 
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8 **/
9 
10 #ifndef _ATAPI_H_
11 #define _ATAPI_H_
12 
13 #pragma pack(1)
14 
15 ///
16 /// ATA5_IDENTIFY_DATA is defined in ATA-5.
17 /// (This structure is provided mainly for backward-compatibility support.
18 /// Old drivers may reference fields that are marked "obsolete" in
19 /// ATA_IDENTIFY_DATA, which currently conforms to ATA-8.)
20 ///
21 typedef struct {
22   UINT16  config;             ///< General Configuration.
23   UINT16  cylinders;          ///< Number of Cylinders.
24   UINT16  reserved_2;
25   UINT16  heads;              ///< Number of logical heads.
26   UINT16  vendor_data1;
27   UINT16  vendor_data2;
28   UINT16  sectors_per_track;
29   UINT16  vendor_specific_7_9[3];
30   CHAR8   SerialNo[20];       ///< ASCII
31   UINT16  vendor_specific_20_21[2];
32   UINT16  ecc_bytes_available;
33   CHAR8   FirmwareVer[8];     ///< ASCII
34   CHAR8   ModelName[40];      ///< ASCII
35   UINT16  multi_sector_cmd_max_sct_cnt;
36   UINT16  reserved_48;
37   UINT16  capabilities;
38   UINT16  reserved_50;
39   UINT16  pio_cycle_timing;
40   UINT16  reserved_52;
41   UINT16  field_validity;
42   UINT16  current_cylinders;
43   UINT16  current_heads;
44   UINT16  current_sectors;
45   UINT16  CurrentCapacityLsb;
46   UINT16  CurrentCapacityMsb;
47   UINT16  reserved_59;
48   UINT16  user_addressable_sectors_lo;
49   UINT16  user_addressable_sectors_hi;
50   UINT16  reserved_62;
51   UINT16  multi_word_dma_mode;
52   UINT16  advanced_pio_modes;
53   UINT16  min_multi_word_dma_cycle_time;
54   UINT16  rec_multi_word_dma_cycle_time;
55   UINT16  min_pio_cycle_time_without_flow_control;
56   UINT16  min_pio_cycle_time_with_flow_control;
57   UINT16  reserved_69_79[11];
58   UINT16  major_version_no;
59   UINT16  minor_version_no;
60   UINT16  command_set_supported_82;    ///< word 82
61   UINT16  command_set_supported_83;    ///< word 83
62   UINT16  command_set_feature_extn;    ///< word 84
63   UINT16  command_set_feature_enb_85;  ///< word 85
64   UINT16  command_set_feature_enb_86;  ///< word 86
65   UINT16  command_set_feature_default; ///< word 87
66   UINT16  ultra_dma_mode;              ///< word 88
67   UINT16  reserved_89_127[39];
68   UINT16  security_status;
69   UINT16  vendor_data_129_159[31];
70   UINT16  reserved_160_255[96];
71 } ATA5_IDENTIFY_DATA;
72 
73 ///
74 /// ATA_IDENTIFY_DATA strictly complies with ATA/ATAPI-8 Spec
75 /// to define the data returned by an ATA device upon successful
76 /// completion of the ATA IDENTIFY_DEVICE command.
77 ///
78 typedef struct {
79   UINT16  config;                                  ///< General Configuration.
80   UINT16  obsolete_1;
81   UINT16  specific_config;                         ///< Specific Configuration.
82   UINT16  obsolete_3;
83   UINT16  retired_4_5[2];
84   UINT16  obsolete_6;
85   UINT16  cfa_reserved_7_8[2];
86   UINT16  retired_9;
87   CHAR8   SerialNo[20];                            ///< word 10~19
88   UINT16  retired_20_21[2];
89   UINT16  obsolete_22;
90   CHAR8   FirmwareVer[8];                          ///< word 23~26
91   CHAR8   ModelName[40];                           ///< word 27~46
92   UINT16  multi_sector_cmd_max_sct_cnt;
93   UINT16  trusted_computing_support;
94   UINT16  capabilities_49;
95   UINT16  capabilities_50;
96   UINT16  obsolete_51_52[2];
97   UINT16  field_validity;
98   UINT16  obsolete_54_58[5];
99   UINT16  multi_sector_setting;
100   UINT16  user_addressable_sectors_lo;
101   UINT16  user_addressable_sectors_hi;
102   UINT16  obsolete_62;
103   UINT16  multi_word_dma_mode;
104   UINT16  advanced_pio_modes;
105   UINT16  min_multi_word_dma_cycle_time;
106   UINT16  rec_multi_word_dma_cycle_time;
107   UINT16  min_pio_cycle_time_without_flow_control;
108   UINT16  min_pio_cycle_time_with_flow_control;
109   UINT16  additional_supported;                    ///< word 69
110   UINT16  reserved_70;
111   UINT16  reserved_71_74[4];                       ///< Reserved for IDENTIFY PACKET DEVICE cmd.
112   UINT16  queue_depth;
113   UINT16  serial_ata_capabilities;
114   UINT16  reserved_77;                             ///< Reserved for Serial ATA
115   UINT16  serial_ata_features_supported;
116   UINT16  serial_ata_features_enabled;
117   UINT16  major_version_no;
118   UINT16  minor_version_no;
119   UINT16  command_set_supported_82;                ///< word 82
120   UINT16  command_set_supported_83;                ///< word 83
121   UINT16  command_set_feature_extn;                ///< word 84
122   UINT16  command_set_feature_enb_85;              ///< word 85
123   UINT16  command_set_feature_enb_86;              ///< word 86
124   UINT16  command_set_feature_default;             ///< word 87
125   UINT16  ultra_dma_mode;                          ///< word 88
126   UINT16  time_for_security_erase_unit;
127   UINT16  time_for_enhanced_security_erase_unit;
128   UINT16  advanced_power_management_level;
129   UINT16  master_password_identifier;
130   UINT16  hardware_configuration_test_result;
131   UINT16  obsolete_94;
132   UINT16  stream_minimum_request_size;
133   UINT16  streaming_transfer_time_for_dma;
134   UINT16  streaming_access_latency_for_dma_and_pio;
135   UINT16  streaming_performance_granularity[2];    ///< word 98~99
136   UINT16  maximum_lba_for_48bit_addressing[4];     ///< word 100~103
137   UINT16  streaming_transfer_time_for_pio;
138   UINT16  max_no_of_512byte_blocks_per_data_set_cmd;
139   UINT16  phy_logic_sector_support;                ///< word 106
140   UINT16  interseek_delay_for_iso7779;
141   UINT16  world_wide_name[4];                      ///< word 108~111
142   UINT16  reserved_for_128bit_wwn_112_115[4];
143   UINT16  reserved_for_technical_report;
144   UINT16  logic_sector_size_lo;                    ///< word 117
145   UINT16  logic_sector_size_hi;                    ///< word 118
146   UINT16  features_and_command_sets_supported_ext; ///< word 119
147   UINT16  features_and_command_sets_enabled_ext;   ///< word 120
148   UINT16  reserved_121_126[6];
149   UINT16  obsolete_127;
150   UINT16  security_status;                         ///< word 128
151   UINT16  vendor_specific_129_159[31];
152   UINT16  cfa_power_mode;                          ///< word 160
153   UINT16  reserved_for_compactflash_161_167[7];
154   UINT16  device_nominal_form_factor;
155   UINT16  is_data_set_cmd_supported;
156   CHAR8   additional_product_identifier[8];
157   UINT16  reserved_174_175[2];
158   CHAR8   media_serial_number[60];                 ///< word 176~205
159   UINT16  sct_command_transport;                   ///< word 206
160   UINT16  reserved_207_208[2];
161   UINT16  alignment_logic_in_phy_blocks;           ///< word 209
162   UINT16  write_read_verify_sector_count_mode3[2]; ///< word 210~211
163   UINT16  verify_sector_count_mode2[2];
164   UINT16  nv_cache_capabilities;
165   UINT16  nv_cache_size_in_logical_block_lsw;      ///< word 215
166   UINT16  nv_cache_size_in_logical_block_msw;      ///< word 216
167   UINT16  nominal_media_rotation_rate;
168   UINT16  reserved_218;
169   UINT16  nv_cache_options;                        ///< word 219
170   UINT16  write_read_verify_mode;                  ///< word 220
171   UINT16  reserved_221;
172   UINT16  transport_major_revision_number;
173   UINT16  transport_minor_revision_number;
174   UINT16  reserved_224_229[6];
175   UINT64  extended_no_of_addressable_sectors;
176   UINT16  min_number_per_download_microcode_mode3; ///< word 234
177   UINT16  max_number_per_download_microcode_mode3; ///< word 235
178   UINT16  reserved_236_254[19];
179   UINT16  integrity_word;
180 } ATA_IDENTIFY_DATA;
181 
182 ///
183 /// ATAPI_IDENTIFY_DATA strictly complies with ATA/ATAPI-8 Spec
184 /// to define the data returned by an ATAPI device upon successful
185 /// completion of the ATA IDENTIFY_PACKET_DEVICE command.
186 ///
187 typedef struct {
188   UINT16  config;                                  ///< General Configuration.
189   UINT16  reserved_1;
190   UINT16  specific_config;                         ///< Specific Configuration.
191   UINT16  reserved_3_9[7];
192   CHAR8   SerialNo[20];                            ///< word 10~19
193   UINT16  reserved_20_22[3];
194   CHAR8   FirmwareVer[8];                          ///< word 23~26
195   CHAR8   ModelName[40];                           ///< word 27~46
196   UINT16  reserved_47_48[2];
197   UINT16  capabilities_49;
198   UINT16  capabilities_50;
199   UINT16  obsolete_51;
200   UINT16  reserved_52;
201   UINT16  field_validity;                          ///< word 53
202   UINT16  reserved_54_61[8];
203   UINT16  dma_dir;
204   UINT16  multi_word_dma_mode;                     ///< word 63
205   UINT16  advanced_pio_modes;                      ///< word 64
206   UINT16  min_multi_word_dma_cycle_time;
207   UINT16  rec_multi_word_dma_cycle_time;
208   UINT16  min_pio_cycle_time_without_flow_control;
209   UINT16  min_pio_cycle_time_with_flow_control;
210   UINT16  reserved_69_70[2];
211   UINT16  obsolete_71_72[2];
212   UINT16  reserved_73_74[2];
213   UINT16  obsolete_75;
214   UINT16  serial_ata_capabilities;
215   UINT16  reserved_77;                             ///< Reserved for Serial ATA
216   UINT16  serial_ata_features_supported;
217   UINT16  serial_ata_features_enabled;
218   UINT16  major_version_no;                        ///< word 80
219   UINT16  minor_version_no;                        ///< word 81
220   UINT16  cmd_set_support_82;
221   UINT16  cmd_set_support_83;
222   UINT16  cmd_feature_support;
223   UINT16  cmd_feature_enable_85;
224   UINT16  cmd_feature_enable_86;
225   UINT16  cmd_feature_default;
226   UINT16  ultra_dma_select;
227   UINT16  time_required_for_sec_erase;             ///< word 89
228   UINT16  time_required_for_enhanced_sec_erase;    ///< word 90
229   UINT16  advanced_power_management_level;
230   UINT16  master_pwd_revison_code;
231   UINT16  hardware_reset_result;                   ///< word 93
232   UINT16  obsolete_94;
233   UINT16  reserved_95_107[13];
234   UINT16  world_wide_name[4];                      ///< word 108~111
235   UINT16  reserved_for_128bit_wwn_112_115[4];
236   UINT16  reserved_116_118[3];
237   UINT16  command_and_feature_sets_supported;      ///< word 119
238   UINT16  command_and_feature_sets_supported_enabled;
239   UINT16  reserved_121_124[4];
240   UINT16  atapi_byte_count_0_behavior;             ///< word 125
241   UINT16  obsolete_126_127[2];
242   UINT16  security_status;
243   UINT16  reserved_129_159[31];
244   UINT16  cfa_reserved_160_175[16];
245   UINT16  reserved_176_221[46];
246   UINT16  transport_major_version;
247   UINT16  transport_minor_version;
248   UINT16  reserved_224_254[31];
249   UINT16  integrity_word;
250 } ATAPI_IDENTIFY_DATA;
251 
252 
253 ///
254 /// Standard Quiry Data format, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
255 ///
256 typedef struct {
257   UINT8 peripheral_type;
258   UINT8 RMB;
259   UINT8 version;
260   UINT8 response_data_format;
261   UINT8 addnl_length;     ///< n - 4, Numbers of bytes following this one.
262   UINT8 reserved_5;
263   UINT8 reserved_6;
264   UINT8 reserved_7;
265   UINT8 vendor_info[8];
266   UINT8 product_id[16];
267   UINT8 product_revision_level[4];
268   UINT8 vendor_specific_36_55[55 - 36 + 1];
269   UINT8 reserved_56_95[95 - 56 + 1];
270   ///
271   /// Vendor-specific parameters fields. The sizeof (ATAPI_INQUIRY_DATA) is 254
272   /// since allocation_length is one byte in ATAPI_INQUIRY_CMD.
273   ///
274   UINT8 vendor_specific_96_253[253 - 96 + 1];
275 } ATAPI_INQUIRY_DATA;
276 
277 ///
278 /// Request Sense Standard Data, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
279 ///
280 typedef struct {
281   UINT8 error_code : 7;
282   UINT8 valid : 1;
283   UINT8 reserved_1;
284   UINT8 sense_key : 4;
285   UINT8 reserved_2 : 1;
286   UINT8 Vendor_specifc_1 : 3;
287   UINT8 vendor_specific_3;
288   UINT8 vendor_specific_4;
289   UINT8 vendor_specific_5;
290   UINT8 vendor_specific_6;
291   UINT8 addnl_sense_length;           ///< n - 7
292   UINT8 vendor_specific_8;
293   UINT8 vendor_specific_9;
294   UINT8 vendor_specific_10;
295   UINT8 vendor_specific_11;
296   UINT8 addnl_sense_code;             ///< mandatory
297   UINT8 addnl_sense_code_qualifier;   ///< mandatory
298   UINT8 field_replaceable_unit_code;  ///< optional
299   UINT8 sense_key_specific_15 : 7;
300   UINT8 SKSV : 1;
301   UINT8 sense_key_specific_16;
302   UINT8 sense_key_specific_17;
303 } ATAPI_REQUEST_SENSE_DATA;
304 
305 ///
306 /// READ CAPACITY Data, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
307 ///
308 typedef struct {
309   UINT8 LastLba3;
310   UINT8 LastLba2;
311   UINT8 LastLba1;
312   UINT8 LastLba0;
313   UINT8 BlockSize3;
314   UINT8 BlockSize2;
315   UINT8 BlockSize1;
316   UINT8 BlockSize0;
317 } ATAPI_READ_CAPACITY_DATA;
318 
319 ///
320 /// Capacity List Header + Current/Maximum Capacity Descriptor,
321 /// defined in SFF-8070i(ATAPI Removable Rewritable Specification).
322 ///
323 typedef struct {
324   UINT8 reserved_0;
325   UINT8 reserved_1;
326   UINT8 reserved_2;
327   UINT8 Capacity_Length;
328   UINT8 LastLba3;
329   UINT8 LastLba2;
330   UINT8 LastLba1;
331   UINT8 LastLba0;
332   UINT8 DesCode : 2;
333   UINT8 reserved_9 : 6;
334   UINT8 BlockSize2;
335   UINT8 BlockSize1;
336   UINT8 BlockSize0;
337 } ATAPI_READ_FORMAT_CAPACITY_DATA;
338 
339 ///
340 /// Test Unit Ready Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
341 ///
342 typedef struct {
343   UINT8 opcode;
344   UINT8 reserved_1;
345   UINT8 reserved_2;
346   UINT8 reserved_3;
347   UINT8 reserved_4;
348   UINT8 reserved_5;
349   UINT8 reserved_6;
350   UINT8 reserved_7;
351   UINT8 reserved_8;
352   UINT8 reserved_9;
353   UINT8 reserved_10;
354   UINT8 reserved_11;
355 } ATAPI_TEST_UNIT_READY_CMD;
356 
357 ///
358 /// INQUIRY Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
359 ///
360 typedef struct {
361   UINT8 opcode;
362   UINT8 reserved_1 : 5;
363   UINT8 lun : 3;
364   UINT8 page_code;        ///< defined in SFF8090i, V6
365   UINT8 reserved_3;
366   UINT8 allocation_length;
367   UINT8 reserved_5;
368   UINT8 reserved_6;
369   UINT8 reserved_7;
370   UINT8 reserved_8;
371   UINT8 reserved_9;
372   UINT8 reserved_10;
373   UINT8 reserved_11;
374 } ATAPI_INQUIRY_CMD;
375 
376 ///
377 /// REQUEST SENSE Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
378 ///
379 typedef struct {
380   UINT8 opcode;
381   UINT8 reserved_1 : 5;
382   UINT8 lun : 3;
383   UINT8 reserved_2;
384   UINT8 reserved_3;
385   UINT8 allocation_length;
386   UINT8 reserved_5;
387   UINT8 reserved_6;
388   UINT8 reserved_7;
389   UINT8 reserved_8;
390   UINT8 reserved_9;
391   UINT8 reserved_10;
392   UINT8 reserved_11;
393 } ATAPI_REQUEST_SENSE_CMD;
394 
395 ///
396 /// READ (10) Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
397 ///
398 typedef struct {
399   UINT8 opcode;
400   UINT8 reserved_1 : 5;
401   UINT8 lun : 3;
402   UINT8 Lba0;
403   UINT8 Lba1;
404   UINT8 Lba2;
405   UINT8 Lba3;
406   UINT8 reserved_6;
407   UINT8 TranLen0;
408   UINT8 TranLen1;
409   UINT8 reserved_9;
410   UINT8 reserved_10;
411   UINT8 reserved_11;
412 } ATAPI_READ10_CMD;
413 
414 ///
415 /// READ Format Capacity Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
416 ///
417 typedef struct {
418   UINT8 opcode;
419   UINT8 reserved_1 : 5;
420   UINT8 lun : 3;
421   UINT8 reserved_2;
422   UINT8 reserved_3;
423   UINT8 reserved_4;
424   UINT8 reserved_5;
425   UINT8 reserved_6;
426   UINT8 allocation_length_hi;
427   UINT8 allocation_length_lo;
428   UINT8 reserved_9;
429   UINT8 reserved_10;
430   UINT8 reserved_11;
431 } ATAPI_READ_FORMAT_CAP_CMD;
432 
433 ///
434 /// MODE SENSE Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
435 ///
436 typedef struct {
437   UINT8 opcode;
438   UINT8 reserved_1 : 5;
439   UINT8 lun : 3;
440   UINT8 page_code : 6;
441   UINT8 page_control : 2;
442   UINT8 reserved_3;
443   UINT8 reserved_4;
444   UINT8 reserved_5;
445   UINT8 reserved_6;
446   UINT8 parameter_list_length_hi;
447   UINT8 parameter_list_length_lo;
448   UINT8 reserved_9;
449   UINT8 reserved_10;
450   UINT8 reserved_11;
451 } ATAPI_MODE_SENSE_CMD;
452 
453 ///
454 /// ATAPI_PACKET_COMMAND is not defined in the ATA specification.
455 /// We add it here for the convenience of ATA/ATAPI module writers.
456 ///
457 typedef union {
458   UINT16                    Data16[6];
459   ATAPI_TEST_UNIT_READY_CMD TestUnitReady;
460   ATAPI_READ10_CMD          Read10;
461   ATAPI_REQUEST_SENSE_CMD   RequestSence;
462   ATAPI_INQUIRY_CMD         Inquiry;
463   ATAPI_MODE_SENSE_CMD      ModeSense;
464   ATAPI_READ_FORMAT_CAP_CMD ReadFormatCapacity;
465 } ATAPI_PACKET_COMMAND;
466 
467 #pragma pack()
468 
469 
470 #define ATAPI_MAX_DMA_EXT_CMD_SECTORS                   0x10000
471 #define ATAPI_MAX_DMA_CMD_SECTORS                       0x100
472 
473 //  ATA/ATAPI Signature equates
474 #define ATA_SIGNATURE                                   0x0101       ///< defined in ACS-3
475 #define ATAPI_SIGNATURE                                 0xeb14       ///< defined in ACS-3
476 #define ATAPI_SIGNATURE_32                              0xeb140101   ///< defined in ACS-3
477 
478 //  Spin Up Configuration definitions
479 #define ATA_SPINUP_CFG_REQUIRED_IDD_INCOMPLETE          0x37c8   ///< defined in ACS-3
480 #define ATA_SPINUP_CFG_REQUIRED_IDD_COMPLETE            0x738c   ///< defined in ACS-3
481 #define ATA_SPINUP_CFG_NOT_REQUIRED_IDD_INCOMPLETE      0x8c73   ///< defined in ACS-3
482 #define ATA_SPINUP_CFG_NOT_REQUIRED_IDD_COMPLETE        0xc837   ///< defined in ACS-3
483 
484 //
485 // ATA Packet Command Code
486 //
487 #define ATA_CMD_FORMAT_UNIT                             0x04   ///< defined in ATAPI Removable Rewritable Media Devcies
488 #define ATA_CMD_SOFT_RESET                              0x08   ///< defined from ATA-3
489 #define ATA_CMD_PACKET                                  0xA0   ///< defined from ATA-3
490 #define ATA_CMD_IDENTIFY_DEVICE                         0xA1   ///< defined from ATA-3
491 #define ATA_CMD_SERVICE                                 0xA2   ///< defined from ATA-3
492 #define ATA_CMD_TEST_UNIT_READY                         0x00   ///< defined from ATA-1
493 #define ATA_CMD_REQUEST_SENSE                           0x03   ///< defined from ATA-4
494 #define ATA_CMD_INQUIRY                                 0x12   ///< defined in ATAPI Removable Rewritable Media Devcies
495 #define ATA_CMD_READ_FORMAT_CAPACITY                    0x23   ///< defined in ATAPI Removable Rewritable Media Devcies
496 #define ATA_CMD_READ_CAPACITY                           0x25   ///< defined in ATAPI Removable Rewritable Media Devcies
497 #define ATA_CMD_READ_10                                 0x28   ///< defined in ATAPI Removable Rewritable Media Devcies
498 #define ATA_CMD_WRITE_10                                0x2A   ///< defined in ATAPI Removable Rewritable Media Devcies
499 #define ATA_CMD_ATAPI_SEEK                              0x2B   ///< defined in ATAPI Removable Rewritable Media Devcies
500 #define ATA_CMD_WRITE_AND_VERIFY                        0x2E   ///< defined in ATAPI Removable Rewritable Media Devcies
501 #define ATA_CMD_VERIFY                                  0x2F   ///< defined in ATAPI Removable Rewritable Media Devcies
502 #define ATA_CMD_READ_12                                 0xA8   ///< defined in ATAPI Removable Rewritable Media Devcies
503 #define ATA_CMD_WRITE_12                                0xAA   ///< defined in ATAPI Removable Rewritable Media Devcies
504 #define ATA_CMD_START_STOP_UNIT                         0x1B   ///< defined in ATAPI Removable Rewritable Media Devcies
505 #define ATA_CMD_PREVENT_ALLOW_MEDIA_REMOVAL             0x1E   ///< defined in ATAPI Removable Rewritable Media Devcies
506 #define ATA_CMD_MODE_SELECT                             0x55   ///< defined in ATAPI Removable Rewritable Media Devcies
507 
508 #define ATA_CMD_MODE_SENSE                              0x5A   ///< defined in ATAPI Removable Rewritable Media Devcies
509     #define ATA_PAGE_CODE_READ_WRITE_ERROR                  0x01   ///< defined in ATAPI Removable Rewritable Media Devcies
510     #define ATA_PAGE_CODE_CACHING_PAGE                      0x08   ///< defined in ATAPI Removable Rewritable Media Devcies
511     #define ATA_PAGE_CODE_REMOVABLE_BLOCK_CAPABILITIES      0x1B   ///< defined in ATAPI Removable Rewritable Media Devcies
512     #define ATA_PAGE_CODE_TIMER_PROTECT_PAGE                0x1C   ///< defined in ATAPI Removable Rewritable Media Devcies
513     #define ATA_PAGE_CODE_RETURN_ALL_PAGES                  0x3F   ///< defined in ATAPI Removable Rewritable Media Devcies
514 
515 #define ATA_CMD_GET_CONFIGURATION                       0x46   ///< defined in ATAPI Multimedia Devices
516    #define ATA_GCCD_RT_FIELD_VALUE_ALL                      0x00   ///< defined in ATAPI Multimedia Devices
517    #define ATA_GCCD_RT_FIELD_VALUE_CURRENT                  0x01   ///< defined in ATAPI Multimedia Devices
518    #define ATA_GCCD_RT_FIELD_VALUE_SINGLE                   0x02   ///< defined in ATAPI Multimedia Devices
519    #define ATA_GCCD_RT_FIELD_VALUE_RESERVED                 0x03   ///< defined in ATAPI Multimedia Devices
520 
521    #define ATA_FEATURE_LIST_PROFILE_LIST                    0x0000   ///< defined in ATAPI Multimedia Devices
522    #define ATA_FEATURE_LIST_CORE                            0x0001   ///< defined in ATAPI Multimedia Devices
523    #define ATA_FEATURE_LIST_MORPHING                        0x0002   ///< defined in ATAPI Multimedia Devices
524    #define ATA_FEATURE_LIST_REMOVEABLE_MEDIUM               0x0003   ///< defined in ATAPI Multimedia Devices
525    #define ATA_FEATURE_LIST_WRITE_PROTECT                   0x0004   ///< defined in ATAPI Multimedia Devices
526 
527 ///
528 /// Start/Stop and Eject Operations
529 ///
530 ///@{
531 #define ATA_CMD_SUBOP_STOP_DISC                         0x00   ///< Stop the Disc
532 #define ATA_CMD_SUBOP_START_DISC                        0x01   ///< Start the Disc and acquire the format type
533 #define ATA_CMD_SUBOP_EJECT_DISC                        0x02   ///< Eject the Disc if possible
534 #define ATA_CMD_SUBOP_CLOSE_TRAY                        0x03   ///< Load the Disc (Close Tray)
535 ///@}
536 
537 //
538 // ATA Commands Code
539 //
540 
541 //
542 // Class 1: PIO Data-In Commands
543 //
544 #define ATA_CMD_IDENTIFY_DRIVE                          0xec   ///< defined from ATA-3
545 #define ATA_CMD_READ_BUFFER                             0xe4   ///< defined from ATA-1
546 #define ATA_CMD_READ_SECTORS                            0x20   ///< defined from ATA-1
547 #define ATA_CMD_READ_SECTORS_WITH_RETRY                 0x21   ///< defined from ATA-1, obsoleted from ATA-5
548 #define ATA_CMD_READ_LONG                               0x22   ///< defined from ATA-1, obsoleted from ATA-5
549 #define ATA_CMD_READ_LONG_WITH_RETRY                    0x23   ///< defined from ATA-1, obsoleted from ATA-5
550 #define ATA_CMD_READ_SECTORS_EXT                        0x24   ///< defined from ATA-6
551 #define ATA_CMD_READ_MULTIPLE                           0xc4   ///< defined in ACS-3
552 #define ATA_CMD_READ_MULTIPLE_EXT                       0x29   ///< defined in ACS-3
553 #define ATA_CMD_READ_LOG_EXT                            0x2f   ///< defined in ACS-3
554 
555 //
556 // Class 2: PIO Data-Out Commands
557 //
558 #define ATA_CMD_FORMAT_TRACK                            0x50  ///< defined from ATA-1, obsoleted from ATA-4
559 #define ATA_CMD_WRITE_BUFFER                            0xe8  ///< defined from ATA-1
560 #define ATA_CMD_WRITE_SECTORS                           0x30  ///< defined from ATA-1
561 #define ATA_CMD_WRITE_SECTORS_WITH_RETRY                0x31  ///< defined from ATA-1, obsoleted from ATA-5
562 #define ATA_CMD_WRITE_LONG                              0x32  ///< defined from ATA-1, obsoleted from ATA-5
563 #define ATA_CMD_WRITE_LONG_WITH_RETRY                   0x33  ///< defined from ATA-1, obsoleted from ATA-5
564 #define ATA_CMD_WRITE_VERIFY                            0x3c  ///< defined from ATA-1, obsoleted from ATA-5
565 #define ATA_CMD_WRITE_SECTORS_EXT                       0x34  ///< defined from ATA-6
566 #define ATA_CMD_WRITE_MULTIPLE                          0xc5  ///< defined in ACS-3
567 #define ATA_CMD_WRITE_MULTIPLE_EXT                      0x39  ///< defined in ACS-3
568 
569 //
570 // Class 3 No Data Command
571 //
572 #define ATA_CMD_ACK_MEDIA_CHANGE                        0xdb  ///< defined from ATA-1, obsoleted from ATA-5
573 #define ATA_CMD_BOOT_POST_BOOT                          0xdc  ///< defined from ATA-1, obsoleted from ATA-3
574 #define ATA_CMD_BOOT_PRE_BOOT                           0xdd  ///< defined from ATA-1, obsoleted from ATA-3
575 #define ATA_CMD_CHECK_POWER_MODE                        0x98  ///< defined from ATA-1, obsoleted from ATA-4
576 #define ATA_CMD_CHECK_POWER_MODE_ALIAS                  0xe5  ///< defined from ATA-1
577 #define ATA_CMD_DOOR_LOCK                               0xde  ///< defined from ATA-1
578 #define ATA_CMD_DOOR_UNLOCK                             0xdf  ///< defined from ATA-1
579 #define ATA_CMD_EXEC_DRIVE_DIAG                         0x90  ///< defined from ATA-1
580 #define ATA_CMD_IDLE_ALIAS                              0x97  ///< defined from ATA-1, obsoleted from ATA-4
581 #define ATA_CMD_IDLE                                    0xe3  ///< defined from ATA-1
582 #define ATA_CMD_IDLE_IMMEDIATE                          0x95  ///< defined from ATA-1, obsoleted from ATA-4
583 #define ATA_CMD_IDLE_IMMEDIATE_ALIAS                    0xe1  ///< defined from ATA-1
584 #define ATA_CMD_INIT_DRIVE_PARAM                        0x91  ///< defined from ATA-1, obsoleted from ATA-6
585 #define ATA_CMD_RECALIBRATE                             0x10  ///< defined from ATA-1, obsoleted from ATA-4
586 #define ATA_CMD_READ_DRIVE_STATE                        0xe9  ///< defined from ATA-1, obsoleted from ATA-3
587 #define ATA_CMD_SET_MULTIPLE_MODE                       0xC6  ///< defined from ATA-2
588 #define ATA_CMD_READ_VERIFY                             0x40  ///< defined from ATA-1
589 #define ATA_CMD_READ_VERIFY_WITH_RETRY                  0x41  ///< defined from ATA-1, obsoleted from ATA-5
590 #define ATA_CMD_SEEK                                    0x70  ///< defined from ATA-1
591 #define ATA_CMD_SET_FEATURES                            0xef  ///< defined from ATA-1
592 #define ATA_CMD_STANDBY                                 0x96  ///< defined from ATA-1, obsoleted from ATA-4
593 #define ATA_CMD_STANDBY_ALIAS                           0xe2  ///< defined from ATA-1
594 #define ATA_CMD_STANDBY_IMMEDIATE                       0x94  ///< defined from ATA-1, obsoleted from ATA-4
595 #define ATA_CMD_STANDBY_IMMEDIATE_ALIAS                 0xe0  ///< defined from ATA-1
596 #define ATA_CMD_SLEEP                                   0xe6  ///< defined in ACS-3
597 #define ATA_CMD_READ_NATIVE_MAX_ADDRESS                 0xf8  ///< defined in ATA-6
598 #define ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT             0x27  ///< defined in ATA-6
599 
600 //
601 // Set Features Sub Command
602 //
603 #define ATA_SUB_CMD_ENABLE_VOLATILE_WRITE_CACHE             0x02   ///< defined in ACS-3
604 #define ATA_SUB_CMD_SET_TRANSFER_MODE                       0x03   ///< defined in ACS-3
605 #define ATA_SUB_CMD_ENABLE_APM                              0x05   ///< defined in ACS-3
606 #define ATA_SUB_CMD_ENABLE_PUIS                             0x06   ///< defined in ACS-3
607 #define ATA_SUB_CMD_PUIS_SET_DEVICE_SPINUP                  0x07   ///< defined in ACS-3
608 #define ATA_SUB_CMD_ENABLE_WRITE_READ_VERIFY                0x0b   ///< defined in ACS-3
609 #define ATA_SUB_CMD_ENABLE_SATA_FEATURE                     0x10   ///< defined in ACS-3
610 #define ATA_SUB_CMD_DISABLE_MEDIA_STATUS_NOTIFICATION       0x31   ///< defined in ACS-3
611 #define ATA_SUB_CMD_ENABLE_FREE_FALL_CONTROL                0x41   ///< defined in ACS-3
612 #define ATA_SUB_CMD_ACOUSTIC_MANAGEMENT_ENABLE              0x42   ///< defined in ACS-3
613 #define ATA_SUB_CMD_SET_MAX_HOST_INTERFACE_SECTOR_TIMES     0x43   ///< defined in ACS-3
614 #define ATA_SUB_CMD_EXTENDED_POWER_CONDITIONS               0x4a   ///< defined in ACS-3
615 #define ATA_SUB_CMD_DISABLE_READ_LOOK_AHEAD                 0x55   ///< defined in ACS-3
616 #define ATA_SUB_CMD_EN_DIS_DSN_FEATURE                      0x63   ///< defined in ACS-3
617 #define ATA_SUB_CMD_DISABLE_REVERT_TO_POWER_ON_DEFAULTS     0x66   ///< defined in ACS-3
618 #define ATA_SUB_CMD_DISABLE_VOLATILE_WRITE_CACHE            0x82   ///< defined in ACS-3
619 #define ATA_SUB_CMD_DISABLE_APM                             0x85   ///< defined in ACS-3
620 #define ATA_SUB_CMD_DISABLE_PUIS                            0x86   ///< defined in ACS-3
621 #define ATA_SUB_CMD_DISABLE_WRITE_READ_VERIFY               0x8b   ///< defined in ACS-3
622 #define ATA_SUB_CMD_DISABLE_SATA_FEATURE                    0x90   ///< defined in ACS-3
623 #define ATA_SUB_CMD_ENABLE_MEDIA_STATUS_NOTIFICATION        0x95   ///< defined in ACS-3
624 #define ATA_SUB_CMD_ENABLE_READ_LOOK_AHEAD                  0xaa   ///< defined in ACS-3
625 #define ATA_SUB_CMD_DISABLE_FREE_FALL_CONTROL               0xc1   ///< defined in ACS-3
626 #define ATA_SUB_CMD_ACOUSTIC_MANAGEMENT_DISABLE             0xc2   ///< defined in ACS-3
627 #define ATA_SUB_CMD_EN_DIS_SENSE_DATA_REPORTING             0xc3   ///< defined in ACS-3
628 #define ATA_SUB_CMD_ENABLE_REVERT_TO_POWER_ON_DEFAULTS      0xcc   ///< defined in ACS-3
629 
630 //
631 // S.M.A.R.T
632 //
633 #define ATA_CMD_SMART                                   0xb0  ///< defined from ATA-3
634 #define ATA_CONSTANT_C2                                 0xc2  ///< reserved
635 #define ATA_CONSTANT_4F                                 0x4f  ///< reserved
636 
637 #define ATA_SMART_READ_DATA                             0xd0   ///< defined in ACS-3
638 
639 #define ATA_SMART_AUTOSAVE                              0xd2  ///< defined in ACS-3
640     #define ATA_AUTOSAVE_DISABLE_ATTR                       0x00
641     #define ATA_AUTOSAVE_ENABLE_ATTR                        0xf1
642 
643 #define ATA_SMART_EXECUTE_OFFLINE_IMMEDIATE             0xd4  ///< defined in ACS-3
644     #define ATA_EXECUTE_SMART_OFFLINE_ROUTINE               0x00  ///< defined in ACS-3
645     #define ATA_EXECUTE_SMART_OFFLINE_SHORT_SELFTEST        0x01  ///< defined in ACS-3
646     #define ATA_EXECUTE_SMART_OFFLINE_EXTENDED_SELFTEST     0x02  ///< defined in ACS-3
647     #define ATA_EXECUTE_SMART_OFFLINE_CONVEYANCE_SELFTEST   0x03  ///< defined in ACS-3
648     #define ATA_EXECUTE_SMART_OFFLINE_SELECTIVE_SELFTEST    0x04  ///< defined in ACS-3
649     #define ATA_SMART_ABORT_SELF_TEST_SUBROUTINE            0x7f  ///< defined in ACS-3
650     #define ATA_EXECUTE_SMART_CAPTIVE_SHORT_SELFTEST        0x81  ///< defined in ACS-3
651     #define ATA_EXECUTE_SMART_CAPTIVE_EXTENDED_SELFTEST     0x82  ///< defined in ACS-3
652     #define ATA_EXECUTE_SMART_CAPTIVE_CONVEYANCE_SELFTEST   0x83  ///< defined in ACS-3
653     #define ATA_EXECUTE_SMART_CAPTIVE_SELECTIVE_SELFTEST    0x84  ///< defined in ACS-3
654 
655 #define ATA_SMART_READLOG                               0xd5  ///< defined in ACS-3
656 #define ATA_SMART_WRITELOG                              0xd6  ///< defined in ACS-3
657 #define ATA_SMART_ENABLE_OPERATION                      0xd8  ///< reserved
658 #define ATA_SMART_DISABLE_OPERATION                     0xd9  ///< defined in ACS-3
659 #define ATA_SMART_RETURN_STATUS                         0xda  ///< defined from ATA-3
660 
661 #define ATA_SMART_THRESHOLD_NOT_EXCEEDED_VALUE              0xc24f  ///< defined in ACS-3
662 #define ATA_SMART_THRESHOLD_EXCEEDED_VALUE                  0x2cf4  ///< defined in ACS-3
663 
664 // SMART Log Definitions
665 #define ATA_SMART_LOG_DIRECTORY                             0x00  ///< defined in ACS-3
666 #define ATA_SMART_SUM_SMART_ERROR_LOG                       0x01  ///< defined in ACS-3
667 #define ATA_SMART_COMP_SMART_ERROR_LOG                      0x02  ///< defined in ACS-3
668 #define ATA_SMART_EXT_COMP_SMART_ERROR_LOG                  0x03  ///< defined in ACS-3
669 #define ATA_SMART_SMART_SELFTEST_LOG                        0x06  ///< defined in ACS-3
670 #define ATA_SMART_EXT_SMART_SELFTEST_LOG                    0x07  ///< defined in ACS-3
671 #define ATA_SMART_SELECTIVE_SELFTEST_LOG                    0x09  ///< defined in ACS-3
672 #define ATA_SMART_HOST_VENDOR_SPECIFIC                      0x80  ///< defined in ACS-3
673 #define ATA_SMART_DEVICE_VENDOR_SPECIFIC                    0xa0  ///< defined in ACS-3
674 
675 //
676 // Class 4: DMA Command
677 //
678 #define ATA_CMD_READ_DMA                                0xc8   ///< defined from ATA-1
679 #define ATA_CMD_READ_DMA_WITH_RETRY                     0xc9   ///< defined from ATA-1, obsoleted from ATA-5
680 #define ATA_CMD_READ_DMA_EXT                            0x25   ///< defined from ATA-6
681 #define ATA_CMD_WRITE_DMA                               0xca   ///< defined from ATA-1
682 #define ATA_CMD_WRITE_DMA_WITH_RETRY                    0xcb   ///< defined from ATA-1, obsoleted from ATA-
683 #define ATA_CMD_WRITE_DMA_EXT                           0x35   ///< defined from ATA-6
684 
685 //
686 //  ATA Security commands
687 //
688 #define ATA_CMD_SECURITY_SET_PASSWORD                   0xf1  ///< defined in ACS-3
689 #define ATA_CMD_SECURITY_UNLOCK                         0xf2  ///< defined in ACS-3
690 #define ATA_CMD_SECURITY_ERASE_PREPARE                  0xf3  ///< defined in ACS-3
691 #define ATA_CMD_SECURITY_ERASE_UNIT                     0xf4  ///< defined in ACS-3
692 #define ATA_CMD_SECURITY_FREEZE_LOCK                    0xf5  ///< defined in ACS-3
693 #define ATA_CMD_SECURITY_DISABLE_PASSWORD               0xf6  ///< defined in ACS-3
694 
695 #define ATA_SECURITY_BUFFER_LENGTH                          512  ///< defined in ACS-3
696 
697 //
698 //  ATA Device Config Overlay
699 //
700 #define ATA_CMD_DEV_CONFIG_OVERLAY                      0xb1   ///< defined from ATA-6
701     #define ATA_CMD_DEV_CONFIG_RESTORE_FEATURE              0xc0   ///< defined from ATA-6
702     #define ATA_CMD_DEV_CONFIG_FREEZELOCK_FEATURE           0xc1   ///< defined from ATA-6
703     #define ATA_CMD_DEV_CONFIG_IDENTIFY_FEATURE             0xc2   ///< defined from ATA-6
704     #define ATA_CMD_DEV_CONFIG_SET_FEATURE                  0xc3   ///< defined from ATA-6
705 
706 //
707 //  ATA Trusted Computing Feature Set Commands
708 //
709 #define ATA_CMD_TRUSTED_NON_DATA                        0x5b  ///< defined in ACS-3
710 #define ATA_CMD_TRUSTED_RECEIVE                         0x5c  ///< defined in ACS-3
711 #define ATA_CMD_TRUSTED_RECEIVE_DMA                     0x5d  ///< defined in ACS-3
712 #define ATA_CMD_TRUSTED_SEND                            0x5e  ///< defined in ACS-3
713 #define ATA_CMD_TRUSTED_SEND_DMA                        0x5f  ///< defined in ACS-3
714 
715 //
716 //  ATA Trusted Receive Fields
717 //
718 #define ATA_TR_RETURN_SECURITY_PROTOCOL_INFORMATION     0x00  ///< defined in ACS-3
719 #define ATA_TR_SECURITY_PROTOCOL_JEDEC_RESERVED         0xec  ///< defined in ACS-3
720 #define ATA_TR_SECURITY_PROTOCOL_SDCARD_RESERVED        0xed  ///< defined in ACS-3
721 #define ATA_TR_SECURITY_PROTOCOL_IEEE1667_RESERVED      0xee  ///< defined in ACS-3
722 
723 //
724 //  Equates used for Acoustic Flags
725 //
726 #define ATA_ACOUSTIC_LEVEL_BYPASS                       0xff   ///< defined from ATA-6
727 #define ATA_ACOUSTIC_LEVEL_MAXIMUM_PERFORMANCE          0xfe   ///< defined from ATA-6
728 #define ATA_ACOUSTIC_LEVEL_QUIET                        0x80   ///< defined from ATA-6
729 
730 //
731 //  Equates used for DiPM Support
732 //
733 #define ATA_CMD_DIPM_SUB                                0x03   // defined in ACS-3 : Count value in SetFeature identification : 03h  Device-initiated interface power state transitions
734     #define ATA_DIPM_ENABLE                                 0x10   // defined in ACS-3
735     #define ATA_DIPM_DISABLE                                0x90   // defined in ACS-3
736 
737 //
738 //  Equates used for DevSleep Support
739 //
740 #define ATA_CMD_DEVSLEEP_SUB                            0x09   // defined in SATA 3.2 Gold Spec :  Count value in SetFeature identification : 09h  Device Sleep
741     #define ATA_DEVSLEEP_ENABLE                             0x10   // defined in SATA 3.2 Gold Spec
742     #define ATA_DEVSLEEP_DISABLE                            0x90   // defined in SATA 3.2 Gold Spec
743 
744 #define ATA_DEVSLP_EXIT_TIMEOUT                             20 // MDAT - 20 ms
745 #define ATA_DEVSLP_MINIMUM_DETECTION_TIME                   10 // DMDT - 10 us
746 #define ATA_DEVSLP_MINIMUM_ASSERTION_TIME                   10 // DETO - 10 ms
747 
748 //
749 //  Set MAX Commands
750 //
751 #define ATA_CMD_SET_MAX_ADDRESS_EXT                     0x37   ///< defined from ATA-6
752 #define ATA_CMD_SET_MAX_ADDRESS                         0xf9   ///< defined from ATA-6
753     #define ATA_SET_MAX_SET_PASSWORD                        0x01   ///< defined from ATA-6
754     #define ATA_SET_MAX_LOCK                                0x02   ///< defined from ATA-6
755     #define ATA_SET_MAX_UNLOCK                              0x03   ///< defined from ATA-6
756     #define ATA_SET_MAX_FREEZE_LOCK                         0x04   ///< defined from ATA-6
757 
758 ///
759 /// Default content of device control register, disable INT,
760 /// Bit3 is set to 1 according ATA-1
761 ///
762 #define ATA_DEFAULT_CTL                                 (0x0a)
763 ///
764 /// Default context of Device/Head Register,
765 /// Bit7 and Bit5 are set to 1 for back-compatibilities.
766 ///
767 #define ATA_DEFAULT_CMD                                 (0xa0)
768 
769 #define ATAPI_MAX_BYTE_COUNT                            (0xfffe)
770 
771 #define ATA_REQUEST_SENSE_ERROR                         (0x70) ///< defined in SFF-8070i
772 
773 //
774 // Sense Key, Additional Sense Codes and Additional Sense Code Qualifier
775 // defined in MultiMedia Commands (MMC, MMC-2)
776 //
777 // Sense Key
778 //
779 #define ATA_SK_NO_SENSE                                 (0x0)
780 #define ATA_SK_RECOVERY_ERROR                           (0x1)
781 #define ATA_SK_NOT_READY                                (0x2)
782 #define ATA_SK_MEDIUM_ERROR                             (0x3)
783 #define ATA_SK_HARDWARE_ERROR                           (0x4)
784 #define ATA_SK_ILLEGAL_REQUEST                          (0x5)
785 #define ATA_SK_UNIT_ATTENTION                           (0x6)
786 #define ATA_SK_DATA_PROTECT                             (0x7)
787 #define ATA_SK_BLANK_CHECK                              (0x8)
788 #define ATA_SK_VENDOR_SPECIFIC                          (0x9)
789 #define ATA_SK_RESERVED_A                               (0xA)
790 #define ATA_SK_ABORT                                    (0xB)
791 #define ATA_SK_RESERVED_C                               (0xC)
792 #define ATA_SK_OVERFLOW                                 (0xD)
793 #define ATA_SK_MISCOMPARE                               (0xE)
794 #define ATA_SK_RESERVED_F                               (0xF)
795 
796 //
797 // Additional Sense Codes
798 //
799 #define ATA_ASC_NOT_READY                               (0x04)
800 #define ATA_ASC_MEDIA_ERR1                              (0x10)
801 #define ATA_ASC_MEDIA_ERR2                              (0x11)
802 #define ATA_ASC_MEDIA_ERR3                              (0x14)
803 #define ATA_ASC_MEDIA_ERR4                              (0x30)
804 #define ATA_ASC_MEDIA_UPSIDE_DOWN                       (0x06)
805 #define ATA_ASC_INVALID_CMD                             (0x20)
806 #define ATA_ASC_LBA_OUT_OF_RANGE                        (0x21)
807 #define ATA_ASC_INVALID_FIELD                           (0x24)
808 #define ATA_ASC_WRITE_PROTECTED                         (0x27)
809 #define ATA_ASC_MEDIA_CHANGE                            (0x28)
810 #define ATA_ASC_RESET                                   (0x29)  ///< Power On Reset or Bus Reset occurred.
811 #define ATA_ASC_ILLEGAL_FIELD                           (0x26)
812 #define ATA_ASC_NO_MEDIA                                (0x3A)
813 #define ATA_ASC_ILLEGAL_MODE_FOR_THIS_TRACK             (0x64)
814 
815 //
816 // Additional Sense Code Qualifier
817 //
818 #define ATA_ASCQ_IN_PROGRESS                            (0x01)
819 
820 //
821 // Error Register
822 //
823 #define ATA_ERRREG_BBK                                  BIT7  ///< Bad block detected      defined from ATA-1, obsoleted from ATA-2
824 #define ATA_ERRREG_UNC                                  BIT6  ///< Uncorrectable Data      defined from ATA-1, obsoleted from ATA-4
825 #define ATA_ERRREG_MC                                   BIT5  ///< Media Change            defined from ATA-1, obsoleted from ATA-4
826 #define ATA_ERRREG_IDNF                                 BIT4  ///< ID Not Found            defined from ATA-1, obsoleted from ATA-4
827 #define ATA_ERRREG_MCR                                  BIT3  ///< Media Change Requested  defined from ATA-1, obsoleted from ATA-4
828 #define ATA_ERRREG_ABRT                                 BIT2  ///< Aborted Command         defined from ATA-1
829 #define ATA_ERRREG_TK0NF                                BIT1  ///< Track 0 Not Found       defined from ATA-1, obsoleted from ATA-4
830 #define ATA_ERRREG_AMNF                                 BIT0  ///< Address Mark Not Found  defined from ATA-1, obsoleted from ATA-4
831 
832 //
833 // Status Register
834 //
835 #define ATA_STSREG_BSY                                  BIT7  ///< Controller Busy         defined from ATA-1
836 #define ATA_STSREG_DRDY                                 BIT6  ///< Drive Ready             defined from ATA-1
837 #define ATA_STSREG_DWF                                  BIT5  ///< Drive Write Fault       defined from ATA-1, obsoleted from ATA-4
838 #define ATA_STSREG_DF                                   BIT5  ///< Drive Fault             defined from ATA-6
839 #define ATA_STSREG_DSC                                  BIT4  ///< Disk Seek Complete      defined from ATA-1, obsoleted from ATA-4
840 #define ATA_STSREG_DRQ                                  BIT3  ///< Data Request            defined from ATA-1
841 #define ATA_STSREG_CORR                                 BIT2  ///< Corrected Data          defined from ATA-1, obsoleted from ATA-4
842 #define ATA_STSREG_IDX                                  BIT1  ///< Index                   defined from ATA-1, obsoleted from ATA-4
843 #define ATA_STSREG_ERR                                  BIT0  ///< Error                   defined from ATA-1
844 
845 //
846 // Device Control Register
847 //
848 #define ATA_CTLREG_SRST                                 BIT2  ///< Software Reset.
849 #define ATA_CTLREG_IEN_L                                BIT1  ///< Interrupt Enable #.
850 
851 #endif
852