xref: /illumos-gate/usr/src/boot/efi/include/IndustryStandard/Atapi.h (revision f334afcfaebea1b7dc3430015651d8d748fa8a3e)
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 /// Standard Quiry Data format, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
254 ///
255 typedef struct {
256   UINT8    peripheral_type;
257   UINT8    RMB;
258   UINT8    version;
259   UINT8    response_data_format;
260   UINT8    addnl_length;  ///< n - 4, Numbers of bytes following this one.
261   UINT8    reserved_5;
262   UINT8    reserved_6;
263   UINT8    reserved_7;
264   UINT8    vendor_info[8];
265   UINT8    product_id[16];
266   UINT8    product_revision_level[4];
267   UINT8    vendor_specific_36_55[55 - 36 + 1];
268   UINT8    reserved_56_95[95 - 56 + 1];
269   ///
270   /// Vendor-specific parameters fields. The sizeof (ATAPI_INQUIRY_DATA) is 254
271   /// since allocation_length is one byte in ATAPI_INQUIRY_CMD.
272   ///
273   UINT8    vendor_specific_96_253[253 - 96 + 1];
274 } ATAPI_INQUIRY_DATA;
275 
276 ///
277 /// Request Sense Standard Data, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
278 ///
279 typedef struct {
280   UINT8    error_code       : 7;
281   UINT8    valid            : 1;
282   UINT8    reserved_1;
283   UINT8    sense_key        : 4;
284   UINT8    reserved_2       : 1;
285   UINT8    Vendor_specifc_1 : 3;
286   UINT8    vendor_specific_3;
287   UINT8    vendor_specific_4;
288   UINT8    vendor_specific_5;
289   UINT8    vendor_specific_6;
290   UINT8    addnl_sense_length;        ///< n - 7
291   UINT8    vendor_specific_8;
292   UINT8    vendor_specific_9;
293   UINT8    vendor_specific_10;
294   UINT8    vendor_specific_11;
295   UINT8    addnl_sense_code;            ///< mandatory
296   UINT8    addnl_sense_code_qualifier;  ///< mandatory
297   UINT8    field_replaceable_unit_code; ///< optional
298   UINT8    sense_key_specific_15 : 7;
299   UINT8    SKSV                  : 1;
300   UINT8    sense_key_specific_16;
301   UINT8    sense_key_specific_17;
302 } ATAPI_REQUEST_SENSE_DATA;
303 
304 ///
305 /// READ CAPACITY Data, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
306 ///
307 typedef struct {
308   UINT8    LastLba3;
309   UINT8    LastLba2;
310   UINT8    LastLba1;
311   UINT8    LastLba0;
312   UINT8    BlockSize3;
313   UINT8    BlockSize2;
314   UINT8    BlockSize1;
315   UINT8    BlockSize0;
316 } ATAPI_READ_CAPACITY_DATA;
317 
318 ///
319 /// Capacity List Header + Current/Maximum Capacity Descriptor,
320 /// defined in SFF-8070i(ATAPI Removable Rewritable Specification).
321 ///
322 typedef struct {
323   UINT8    reserved_0;
324   UINT8    reserved_1;
325   UINT8    reserved_2;
326   UINT8    Capacity_Length;
327   UINT8    LastLba3;
328   UINT8    LastLba2;
329   UINT8    LastLba1;
330   UINT8    LastLba0;
331   UINT8    DesCode    : 2;
332   UINT8    reserved_9 : 6;
333   UINT8    BlockSize2;
334   UINT8    BlockSize1;
335   UINT8    BlockSize0;
336 } ATAPI_READ_FORMAT_CAPACITY_DATA;
337 
338 ///
339 /// Test Unit Ready Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
340 ///
341 typedef struct {
342   UINT8    opcode;
343   UINT8    reserved_1;
344   UINT8    reserved_2;
345   UINT8    reserved_3;
346   UINT8    reserved_4;
347   UINT8    reserved_5;
348   UINT8    reserved_6;
349   UINT8    reserved_7;
350   UINT8    reserved_8;
351   UINT8    reserved_9;
352   UINT8    reserved_10;
353   UINT8    reserved_11;
354 } ATAPI_TEST_UNIT_READY_CMD;
355 
356 ///
357 /// INQUIRY Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
358 ///
359 typedef struct {
360   UINT8    opcode;
361   UINT8    reserved_1 : 5;
362   UINT8    lun        : 3;
363   UINT8    page_code;     ///< defined in SFF8090i, V6
364   UINT8    reserved_3;
365   UINT8    allocation_length;
366   UINT8    reserved_5;
367   UINT8    reserved_6;
368   UINT8    reserved_7;
369   UINT8    reserved_8;
370   UINT8    reserved_9;
371   UINT8    reserved_10;
372   UINT8    reserved_11;
373 } ATAPI_INQUIRY_CMD;
374 
375 ///
376 /// REQUEST SENSE Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
377 ///
378 typedef struct {
379   UINT8    opcode;
380   UINT8    reserved_1 : 5;
381   UINT8    lun        : 3;
382   UINT8    reserved_2;
383   UINT8    reserved_3;
384   UINT8    allocation_length;
385   UINT8    reserved_5;
386   UINT8    reserved_6;
387   UINT8    reserved_7;
388   UINT8    reserved_8;
389   UINT8    reserved_9;
390   UINT8    reserved_10;
391   UINT8    reserved_11;
392 } ATAPI_REQUEST_SENSE_CMD;
393 
394 ///
395 /// READ (10) Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
396 ///
397 typedef struct {
398   UINT8    opcode;
399   UINT8    reserved_1 : 5;
400   UINT8    lun        : 3;
401   UINT8    Lba0;
402   UINT8    Lba1;
403   UINT8    Lba2;
404   UINT8    Lba3;
405   UINT8    reserved_6;
406   UINT8    TranLen0;
407   UINT8    TranLen1;
408   UINT8    reserved_9;
409   UINT8    reserved_10;
410   UINT8    reserved_11;
411 } ATAPI_READ10_CMD;
412 
413 ///
414 /// READ Format Capacity Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
415 ///
416 typedef struct {
417   UINT8    opcode;
418   UINT8    reserved_1 : 5;
419   UINT8    lun        : 3;
420   UINT8    reserved_2;
421   UINT8    reserved_3;
422   UINT8    reserved_4;
423   UINT8    reserved_5;
424   UINT8    reserved_6;
425   UINT8    allocation_length_hi;
426   UINT8    allocation_length_lo;
427   UINT8    reserved_9;
428   UINT8    reserved_10;
429   UINT8    reserved_11;
430 } ATAPI_READ_FORMAT_CAP_CMD;
431 
432 ///
433 /// MODE SENSE Command, defined in SFF-8070i(ATAPI Removable Rewritable Specification).
434 ///
435 typedef struct {
436   UINT8    opcode;
437   UINT8    reserved_1   : 5;
438   UINT8    lun          : 3;
439   UINT8    page_code    : 6;
440   UINT8    page_control : 2;
441   UINT8    reserved_3;
442   UINT8    reserved_4;
443   UINT8    reserved_5;
444   UINT8    reserved_6;
445   UINT8    parameter_list_length_hi;
446   UINT8    parameter_list_length_lo;
447   UINT8    reserved_9;
448   UINT8    reserved_10;
449   UINT8    reserved_11;
450 } ATAPI_MODE_SENSE_CMD;
451 
452 ///
453 /// ATAPI_PACKET_COMMAND is not defined in the ATA specification.
454 /// We add it here for the convenience of ATA/ATAPI module writers.
455 ///
456 typedef union {
457   UINT16                       Data16[6];
458   ATAPI_TEST_UNIT_READY_CMD    TestUnitReady;
459   ATAPI_READ10_CMD             Read10;
460   ATAPI_REQUEST_SENSE_CMD      RequestSence;
461   ATAPI_INQUIRY_CMD            Inquiry;
462   ATAPI_MODE_SENSE_CMD         ModeSense;
463   ATAPI_READ_FORMAT_CAP_CMD    ReadFormatCapacity;
464 } ATAPI_PACKET_COMMAND;
465 
466 #pragma pack()
467 
468 #define ATAPI_MAX_DMA_EXT_CMD_SECTORS  0x10000
469 #define ATAPI_MAX_DMA_CMD_SECTORS      0x100
470 
471 //  ATA/ATAPI Signature equates
472 #define ATA_SIGNATURE       0x0101                                   ///< defined in ACS-3
473 #define ATAPI_SIGNATURE     0xeb14                                   ///< defined in ACS-3
474 #define ATAPI_SIGNATURE_32  0xeb140101                               ///< defined in ACS-3
475 
476 //  Spin Up Configuration definitions
477 #define ATA_SPINUP_CFG_REQUIRED_IDD_INCOMPLETE      0x37c8       ///< defined in ACS-3
478 #define ATA_SPINUP_CFG_REQUIRED_IDD_COMPLETE        0x738c       ///< defined in ACS-3
479 #define ATA_SPINUP_CFG_NOT_REQUIRED_IDD_INCOMPLETE  0x8c73       ///< defined in ACS-3
480 #define ATA_SPINUP_CFG_NOT_REQUIRED_IDD_COMPLETE    0xc837       ///< defined in ACS-3
481 
482 //
483 // ATA Packet Command Code
484 //
485 #define ATA_CMD_FORMAT_UNIT                  0x04              ///< defined in ATAPI Removable Rewritable Media Devices
486 #define ATA_CMD_SOFT_RESET                   0x08              ///< defined from ATA-3
487 #define ATA_CMD_PACKET                       0xA0              ///< defined from ATA-3
488 #define ATA_CMD_IDENTIFY_DEVICE              0xA1              ///< defined from ATA-3
489 #define ATA_CMD_SERVICE                      0xA2              ///< defined from ATA-3
490 #define ATA_CMD_TEST_UNIT_READY              0x00              ///< defined from ATA-1
491 #define ATA_CMD_REQUEST_SENSE                0x03              ///< defined from ATA-4
492 #define ATA_CMD_INQUIRY                      0x12              ///< defined in ATAPI Removable Rewritable Media Devices
493 #define ATA_CMD_READ_FORMAT_CAPACITY         0x23              ///< defined in ATAPI Removable Rewritable Media Devices
494 #define ATA_CMD_READ_CAPACITY                0x25              ///< defined in ATAPI Removable Rewritable Media Devices
495 #define ATA_CMD_READ_10                      0x28              ///< defined in ATAPI Removable Rewritable Media Devices
496 #define ATA_CMD_WRITE_10                     0x2A              ///< defined in ATAPI Removable Rewritable Media Devices
497 #define ATA_CMD_ATAPI_SEEK                   0x2B              ///< defined in ATAPI Removable Rewritable Media Devices
498 #define ATA_CMD_WRITE_AND_VERIFY             0x2E              ///< defined in ATAPI Removable Rewritable Media Devices
499 #define ATA_CMD_VERIFY                       0x2F              ///< defined in ATAPI Removable Rewritable Media Devices
500 #define ATA_CMD_READ_12                      0xA8              ///< defined in ATAPI Removable Rewritable Media Devices
501 #define ATA_CMD_WRITE_12                     0xAA              ///< defined in ATAPI Removable Rewritable Media Devices
502 #define ATA_CMD_START_STOP_UNIT              0x1B              ///< defined in ATAPI Removable Rewritable Media Devices
503 #define ATA_CMD_PREVENT_ALLOW_MEDIA_REMOVAL  0x1E              ///< defined in ATAPI Removable Rewritable Media Devices
504 #define ATA_CMD_MODE_SELECT                  0x55              ///< defined in ATAPI Removable Rewritable Media Devices
505 
506 #define ATA_CMD_MODE_SENSE                          0x5A       ///< defined in ATAPI Removable Rewritable Media Devices
507 #define ATA_PAGE_CODE_READ_WRITE_ERROR              0x01       ///< defined in ATAPI Removable Rewritable Media Devices
508 #define ATA_PAGE_CODE_CACHING_PAGE                  0x08       ///< defined in ATAPI Removable Rewritable Media Devices
509 #define ATA_PAGE_CODE_REMOVABLE_BLOCK_CAPABILITIES  0x1B       ///< defined in ATAPI Removable Rewritable Media Devices
510 #define ATA_PAGE_CODE_TIMER_PROTECT_PAGE            0x1C       ///< defined in ATAPI Removable Rewritable Media Devices
511 #define ATA_PAGE_CODE_RETURN_ALL_PAGES              0x3F       ///< defined in ATAPI Removable Rewritable Media Devices
512 
513 #define ATA_CMD_GET_CONFIGURATION         0x46                 ///< defined in ATAPI Multimedia Devices
514 #define ATA_GCCD_RT_FIELD_VALUE_ALL       0x00                 ///< defined in ATAPI Multimedia Devices
515 #define ATA_GCCD_RT_FIELD_VALUE_CURRENT   0x01                 ///< defined in ATAPI Multimedia Devices
516 #define ATA_GCCD_RT_FIELD_VALUE_SINGLE    0x02                 ///< defined in ATAPI Multimedia Devices
517 #define ATA_GCCD_RT_FIELD_VALUE_RESERVED  0x03                 ///< defined in ATAPI Multimedia Devices
518 
519 #define ATA_FEATURE_LIST_PROFILE_LIST       0x0000                   ///< defined in ATAPI Multimedia Devices
520 #define ATA_FEATURE_LIST_CORE               0x0001                   ///< defined in ATAPI Multimedia Devices
521 #define ATA_FEATURE_LIST_MORPHING           0x0002                   ///< defined in ATAPI Multimedia Devices
522 #define ATA_FEATURE_LIST_REMOVEABLE_MEDIUM  0x0003                   ///< defined in ATAPI Multimedia Devices
523 #define ATA_FEATURE_LIST_WRITE_PROTECT      0x0004                   ///< defined in ATAPI Multimedia Devices
524 
525 ///
526 /// Start/Stop and Eject Operations
527 ///
528 ///@{
529 #define ATA_CMD_SUBOP_STOP_DISC   0x00                         ///< Stop the Disc
530 #define ATA_CMD_SUBOP_START_DISC  0x01                         ///< Start the Disc and acquire the format type
531 #define ATA_CMD_SUBOP_EJECT_DISC  0x02                         ///< Eject the Disc if possible
532 #define ATA_CMD_SUBOP_CLOSE_TRAY  0x03                         ///< Load the Disc (Close Tray)
533 ///@}
534 
535 //
536 // ATA Commands Code
537 //
538 
539 //
540 // Class 1: PIO Data-In Commands
541 //
542 #define ATA_CMD_IDENTIFY_DRIVE           0xec                  ///< defined from ATA-3
543 #define ATA_CMD_READ_BUFFER              0xe4                  ///< defined from ATA-1
544 #define ATA_CMD_READ_SECTORS             0x20                  ///< defined from ATA-1
545 #define ATA_CMD_READ_SECTORS_WITH_RETRY  0x21                  ///< defined from ATA-1, obsoleted from ATA-5
546 #define ATA_CMD_READ_LONG                0x22                  ///< defined from ATA-1, obsoleted from ATA-5
547 #define ATA_CMD_READ_LONG_WITH_RETRY     0x23                  ///< defined from ATA-1, obsoleted from ATA-5
548 #define ATA_CMD_READ_SECTORS_EXT         0x24                  ///< defined from ATA-6
549 #define ATA_CMD_READ_MULTIPLE            0xc4                  ///< defined in ACS-3
550 #define ATA_CMD_READ_MULTIPLE_EXT        0x29                  ///< defined in ACS-3
551 #define ATA_CMD_READ_LOG_EXT             0x2f                  ///< defined in ACS-3
552 
553 //
554 // Class 2: PIO Data-Out Commands
555 //
556 #define ATA_CMD_FORMAT_TRACK              0x50                ///< defined from ATA-1, obsoleted from ATA-4
557 #define ATA_CMD_WRITE_BUFFER              0xe8                ///< defined from ATA-1
558 #define ATA_CMD_WRITE_SECTORS             0x30                ///< defined from ATA-1
559 #define ATA_CMD_WRITE_SECTORS_WITH_RETRY  0x31                ///< defined from ATA-1, obsoleted from ATA-5
560 #define ATA_CMD_WRITE_LONG                0x32                ///< defined from ATA-1, obsoleted from ATA-5
561 #define ATA_CMD_WRITE_LONG_WITH_RETRY     0x33                ///< defined from ATA-1, obsoleted from ATA-5
562 #define ATA_CMD_WRITE_VERIFY              0x3c                ///< defined from ATA-1, obsoleted from ATA-5
563 #define ATA_CMD_WRITE_SECTORS_EXT         0x34                ///< defined from ATA-6
564 #define ATA_CMD_WRITE_MULTIPLE            0xc5                ///< defined in ACS-3
565 #define ATA_CMD_WRITE_MULTIPLE_EXT        0x39                ///< defined in ACS-3
566 
567 //
568 // Class 3 No Data Command
569 //
570 #define ATA_CMD_ACK_MEDIA_CHANGE             0xdb             ///< defined from ATA-1, obsoleted from ATA-5
571 #define ATA_CMD_BOOT_POST_BOOT               0xdc             ///< defined from ATA-1, obsoleted from ATA-3
572 #define ATA_CMD_BOOT_PRE_BOOT                0xdd             ///< defined from ATA-1, obsoleted from ATA-3
573 #define ATA_CMD_CHECK_POWER_MODE             0x98             ///< defined from ATA-1, obsoleted from ATA-4
574 #define ATA_CMD_CHECK_POWER_MODE_ALIAS       0xe5             ///< defined from ATA-1
575 #define ATA_CMD_DOOR_LOCK                    0xde             ///< defined from ATA-1
576 #define ATA_CMD_DOOR_UNLOCK                  0xdf             ///< defined from ATA-1
577 #define ATA_CMD_EXEC_DRIVE_DIAG              0x90             ///< defined from ATA-1
578 #define ATA_CMD_IDLE_ALIAS                   0x97             ///< defined from ATA-1, obsoleted from ATA-4
579 #define ATA_CMD_IDLE                         0xe3             ///< defined from ATA-1
580 #define ATA_CMD_IDLE_IMMEDIATE               0x95             ///< defined from ATA-1, obsoleted from ATA-4
581 #define ATA_CMD_IDLE_IMMEDIATE_ALIAS         0xe1             ///< defined from ATA-1
582 #define ATA_CMD_INIT_DRIVE_PARAM             0x91             ///< defined from ATA-1, obsoleted from ATA-6
583 #define ATA_CMD_RECALIBRATE                  0x10             ///< defined from ATA-1, obsoleted from ATA-4
584 #define ATA_CMD_READ_DRIVE_STATE             0xe9             ///< defined from ATA-1, obsoleted from ATA-3
585 #define ATA_CMD_SET_MULTIPLE_MODE            0xC6             ///< defined from ATA-2
586 #define ATA_CMD_READ_VERIFY                  0x40             ///< defined from ATA-1
587 #define ATA_CMD_READ_VERIFY_WITH_RETRY       0x41             ///< defined from ATA-1, obsoleted from ATA-5
588 #define ATA_CMD_SEEK                         0x70             ///< defined from ATA-1
589 #define ATA_CMD_SET_FEATURES                 0xef             ///< defined from ATA-1
590 #define ATA_CMD_STANDBY                      0x96             ///< defined from ATA-1, obsoleted from ATA-4
591 #define ATA_CMD_STANDBY_ALIAS                0xe2             ///< defined from ATA-1
592 #define ATA_CMD_STANDBY_IMMEDIATE            0x94             ///< defined from ATA-1, obsoleted from ATA-4
593 #define ATA_CMD_STANDBY_IMMEDIATE_ALIAS      0xe0             ///< defined from ATA-1
594 #define ATA_CMD_SLEEP                        0xe6             ///< defined in ACS-3
595 #define ATA_CMD_READ_NATIVE_MAX_ADDRESS      0xf8             ///< defined in ATA-6
596 #define ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT  0x27             ///< defined in ATA-6
597 
598 //
599 // Set Features Sub Command
600 //
601 #define ATA_SUB_CMD_ENABLE_VOLATILE_WRITE_CACHE          0x02      ///< defined in ACS-3
602 #define ATA_SUB_CMD_SET_TRANSFER_MODE                    0x03      ///< defined in ACS-3
603 #define ATA_SUB_CMD_ENABLE_APM                           0x05      ///< defined in ACS-3
604 #define ATA_SUB_CMD_ENABLE_PUIS                          0x06      ///< defined in ACS-3
605 #define ATA_SUB_CMD_PUIS_SET_DEVICE_SPINUP               0x07      ///< defined in ACS-3
606 #define ATA_SUB_CMD_ENABLE_WRITE_READ_VERIFY             0x0b      ///< defined in ACS-3
607 #define ATA_SUB_CMD_ENABLE_SATA_FEATURE                  0x10      ///< defined in ACS-3
608 #define ATA_SUB_CMD_DISABLE_MEDIA_STATUS_NOTIFICATION    0x31      ///< defined in ACS-3
609 #define ATA_SUB_CMD_ENABLE_FREE_FALL_CONTROL             0x41      ///< defined in ACS-3
610 #define ATA_SUB_CMD_ACOUSTIC_MANAGEMENT_ENABLE           0x42      ///< defined in ACS-3
611 #define ATA_SUB_CMD_SET_MAX_HOST_INTERFACE_SECTOR_TIMES  0x43      ///< defined in ACS-3
612 #define ATA_SUB_CMD_EXTENDED_POWER_CONDITIONS            0x4a      ///< defined in ACS-3
613 #define ATA_SUB_CMD_DISABLE_READ_LOOK_AHEAD              0x55      ///< defined in ACS-3
614 #define ATA_SUB_CMD_EN_DIS_DSN_FEATURE                   0x63      ///< defined in ACS-3
615 #define ATA_SUB_CMD_DISABLE_REVERT_TO_POWER_ON_DEFAULTS  0x66      ///< defined in ACS-3
616 #define ATA_SUB_CMD_DISABLE_VOLATILE_WRITE_CACHE         0x82      ///< defined in ACS-3
617 #define ATA_SUB_CMD_DISABLE_APM                          0x85      ///< defined in ACS-3
618 #define ATA_SUB_CMD_DISABLE_PUIS                         0x86      ///< defined in ACS-3
619 #define ATA_SUB_CMD_DISABLE_WRITE_READ_VERIFY            0x8b      ///< defined in ACS-3
620 #define ATA_SUB_CMD_DISABLE_SATA_FEATURE                 0x90      ///< defined in ACS-3
621 #define ATA_SUB_CMD_ENABLE_MEDIA_STATUS_NOTIFICATION     0x95      ///< defined in ACS-3
622 #define ATA_SUB_CMD_ENABLE_READ_LOOK_AHEAD               0xaa      ///< defined in ACS-3
623 #define ATA_SUB_CMD_DISABLE_FREE_FALL_CONTROL            0xc1      ///< defined in ACS-3
624 #define ATA_SUB_CMD_ACOUSTIC_MANAGEMENT_DISABLE          0xc2      ///< defined in ACS-3
625 #define ATA_SUB_CMD_EN_DIS_SENSE_DATA_REPORTING          0xc3      ///< defined in ACS-3
626 #define ATA_SUB_CMD_ENABLE_REVERT_TO_POWER_ON_DEFAULTS   0xcc      ///< defined in ACS-3
627 
628 //
629 // S.M.A.R.T
630 //
631 #define ATA_CMD_SMART    0xb0                                 ///< defined from ATA-3
632 #define ATA_CONSTANT_C2  0xc2                                 ///< reserved
633 #define ATA_CONSTANT_4F  0x4f                                 ///< reserved
634 
635 #define ATA_SMART_READ_DATA  0xd0                              ///< defined in ACS-3
636 
637 #define ATA_SMART_AUTOSAVE         0xd2                       ///< defined in ACS-3
638 #define ATA_AUTOSAVE_DISABLE_ATTR  0x00
639 #define ATA_AUTOSAVE_ENABLE_ATTR   0xf1
640 
641 #define ATA_SMART_EXECUTE_OFFLINE_IMMEDIATE            0xd4   ///< defined in ACS-3
642 #define ATA_EXECUTE_SMART_OFFLINE_ROUTINE              0x00   ///< defined in ACS-3
643 #define ATA_EXECUTE_SMART_OFFLINE_SHORT_SELFTEST       0x01   ///< defined in ACS-3
644 #define ATA_EXECUTE_SMART_OFFLINE_EXTENDED_SELFTEST    0x02   ///< defined in ACS-3
645 #define ATA_EXECUTE_SMART_OFFLINE_CONVEYANCE_SELFTEST  0x03   ///< defined in ACS-3
646 #define ATA_EXECUTE_SMART_OFFLINE_SELECTIVE_SELFTEST   0x04   ///< defined in ACS-3
647 #define ATA_SMART_ABORT_SELF_TEST_SUBROUTINE           0x7f   ///< defined in ACS-3
648 #define ATA_EXECUTE_SMART_CAPTIVE_SHORT_SELFTEST       0x81   ///< defined in ACS-3
649 #define ATA_EXECUTE_SMART_CAPTIVE_EXTENDED_SELFTEST    0x82   ///< defined in ACS-3
650 #define ATA_EXECUTE_SMART_CAPTIVE_CONVEYANCE_SELFTEST  0x83   ///< defined in ACS-3
651 #define ATA_EXECUTE_SMART_CAPTIVE_SELECTIVE_SELFTEST   0x84   ///< defined in ACS-3
652 
653 #define ATA_SMART_READLOG            0xd5                     ///< defined in ACS-3
654 #define ATA_SMART_WRITELOG           0xd6                     ///< defined in ACS-3
655 #define ATA_SMART_ENABLE_OPERATION   0xd8                     ///< reserved
656 #define ATA_SMART_DISABLE_OPERATION  0xd9                     ///< defined in ACS-3
657 #define ATA_SMART_RETURN_STATUS      0xda                     ///< defined from ATA-3
658 
659 #define ATA_SMART_THRESHOLD_NOT_EXCEEDED_VALUE  0xc24f              ///< defined in ACS-3
660 #define ATA_SMART_THRESHOLD_EXCEEDED_VALUE      0x2cf4              ///< defined in ACS-3
661 
662 // SMART Log Definitions
663 #define ATA_SMART_LOG_DIRECTORY             0x00                  ///< defined in ACS-3
664 #define ATA_SMART_SUM_SMART_ERROR_LOG       0x01                  ///< defined in ACS-3
665 #define ATA_SMART_COMP_SMART_ERROR_LOG      0x02                  ///< defined in ACS-3
666 #define ATA_SMART_EXT_COMP_SMART_ERROR_LOG  0x03                  ///< defined in ACS-3
667 #define ATA_SMART_SMART_SELFTEST_LOG        0x06                  ///< defined in ACS-3
668 #define ATA_SMART_EXT_SMART_SELFTEST_LOG    0x07                  ///< defined in ACS-3
669 #define ATA_SMART_SELECTIVE_SELFTEST_LOG    0x09                  ///< defined in ACS-3
670 #define ATA_SMART_HOST_VENDOR_SPECIFIC      0x80                  ///< defined in ACS-3
671 #define ATA_SMART_DEVICE_VENDOR_SPECIFIC    0xa0                  ///< defined in ACS-3
672 
673 //
674 // Class 4: DMA Command
675 //
676 #define ATA_CMD_READ_DMA              0xc8                     ///< defined from ATA-1
677 #define ATA_CMD_READ_DMA_WITH_RETRY   0xc9                     ///< defined from ATA-1, obsoleted from ATA-5
678 #define ATA_CMD_READ_DMA_EXT          0x25                     ///< defined from ATA-6
679 #define ATA_CMD_WRITE_DMA             0xca                     ///< defined from ATA-1
680 #define ATA_CMD_WRITE_DMA_WITH_RETRY  0xcb                     ///< defined from ATA-1, obsoleted from ATA-
681 #define ATA_CMD_WRITE_DMA_EXT         0x35                     ///< defined from ATA-6
682 
683 //
684 //  ATA Security commands
685 //
686 #define ATA_CMD_SECURITY_SET_PASSWORD      0xf1               ///< defined in ACS-3
687 #define ATA_CMD_SECURITY_UNLOCK            0xf2               ///< defined in ACS-3
688 #define ATA_CMD_SECURITY_ERASE_PREPARE     0xf3               ///< defined in ACS-3
689 #define ATA_CMD_SECURITY_ERASE_UNIT        0xf4               ///< defined in ACS-3
690 #define ATA_CMD_SECURITY_FREEZE_LOCK       0xf5               ///< defined in ACS-3
691 #define ATA_CMD_SECURITY_DISABLE_PASSWORD  0xf6               ///< defined in ACS-3
692 
693 #define ATA_SECURITY_BUFFER_LENGTH  512                          ///< defined in ACS-3
694 
695 //
696 //  ATA Device Config Overlay
697 //
698 #define ATA_CMD_DEV_CONFIG_OVERLAY             0xb1            ///< defined from ATA-6
699 #define ATA_CMD_DEV_CONFIG_RESTORE_FEATURE     0xc0            ///< defined from ATA-6
700 #define ATA_CMD_DEV_CONFIG_FREEZELOCK_FEATURE  0xc1            ///< defined from ATA-6
701 #define ATA_CMD_DEV_CONFIG_IDENTIFY_FEATURE    0xc2            ///< defined from ATA-6
702 #define ATA_CMD_DEV_CONFIG_SET_FEATURE         0xc3            ///< defined from ATA-6
703 
704 //
705 //  ATA Trusted Computing Feature Set Commands
706 //
707 #define ATA_CMD_TRUSTED_NON_DATA     0x5b                     ///< defined in ACS-3
708 #define ATA_CMD_TRUSTED_RECEIVE      0x5c                     ///< defined in ACS-3
709 #define ATA_CMD_TRUSTED_RECEIVE_DMA  0x5d                     ///< defined in ACS-3
710 #define ATA_CMD_TRUSTED_SEND         0x5e                     ///< defined in ACS-3
711 #define ATA_CMD_TRUSTED_SEND_DMA     0x5f                     ///< defined in ACS-3
712 
713 //
714 //  ATA Trusted Receive Fields
715 //
716 #define ATA_TR_RETURN_SECURITY_PROTOCOL_INFORMATION  0x00     ///< defined in ACS-3
717 #define ATA_TR_SECURITY_PROTOCOL_JEDEC_RESERVED      0xec     ///< defined in ACS-3
718 #define ATA_TR_SECURITY_PROTOCOL_SDCARD_RESERVED     0xed     ///< defined in ACS-3
719 #define ATA_TR_SECURITY_PROTOCOL_IEEE1667_RESERVED   0xee     ///< defined in ACS-3
720 
721 //
722 //  Equates used for Acoustic Flags
723 //
724 #define ATA_ACOUSTIC_LEVEL_BYPASS               0xff           ///< defined from ATA-6
725 #define ATA_ACOUSTIC_LEVEL_MAXIMUM_PERFORMANCE  0xfe           ///< defined from ATA-6
726 #define ATA_ACOUSTIC_LEVEL_QUIET                0x80           ///< defined from ATA-6
727 
728 //
729 //  Equates used for DiPM Support
730 //
731 #define ATA_CMD_DIPM_SUB  0x03                                 // defined in ACS-3 : Count value in SetFeature identification : 03h  Device-initiated interface power state transitions
732 #define ATA_DIPM_ENABLE   0x10                                 // defined in ACS-3
733 #define ATA_DIPM_DISABLE  0x90                                 // defined in ACS-3
734 
735 //
736 //  Equates used for DevSleep Support
737 //
738 #define ATA_CMD_DEVSLEEP_SUB  0x09                             // defined in SATA 3.2 Gold Spec :  Count value in SetFeature identification : 09h  Device Sleep
739 #define ATA_DEVSLEEP_ENABLE   0x10                             // defined in SATA 3.2 Gold Spec
740 #define ATA_DEVSLEEP_DISABLE  0x90                             // defined in SATA 3.2 Gold Spec
741 
742 #define ATA_DEVSLP_EXIT_TIMEOUT            20                  // MDAT - 20 ms
743 #define ATA_DEVSLP_MINIMUM_DETECTION_TIME  10                  // DMDT - 10 us
744 #define ATA_DEVSLP_MINIMUM_ASSERTION_TIME  10                  // DETO - 10 ms
745 
746 //
747 //  Set MAX Commands
748 //
749 #define ATA_CMD_SET_MAX_ADDRESS_EXT  0x37                      ///< defined from ATA-6
750 #define ATA_CMD_SET_MAX_ADDRESS      0xf9                      ///< defined from ATA-6
751 #define ATA_SET_MAX_SET_PASSWORD     0x01                      ///< defined from ATA-6
752 #define ATA_SET_MAX_LOCK             0x02                      ///< defined from ATA-6
753 #define ATA_SET_MAX_UNLOCK           0x03                      ///< defined from ATA-6
754 #define ATA_SET_MAX_FREEZE_LOCK      0x04                      ///< defined from ATA-6
755 
756 ///
757 /// Default content of device control register, disable INT,
758 /// Bit3 is set to 1 according ATA-1
759 ///
760 #define ATA_DEFAULT_CTL  (0x0a)
761 ///
762 /// Default context of Device/Head Register,
763 /// Bit7 and Bit5 are set to 1 for back-compatibilities.
764 ///
765 #define ATA_DEFAULT_CMD  (0xa0)
766 
767 #define ATAPI_MAX_BYTE_COUNT  (0xfffe)
768 
769 #define ATA_REQUEST_SENSE_ERROR  (0x70)                        ///< defined in SFF-8070i
770 
771 //
772 // Sense Key, Additional Sense Codes and Additional Sense Code Qualifier
773 // defined in MultiMedia Commands (MMC, MMC-2)
774 //
775 // Sense Key
776 //
777 #define ATA_SK_NO_SENSE         (0x0)
778 #define ATA_SK_RECOVERY_ERROR   (0x1)
779 #define ATA_SK_NOT_READY        (0x2)
780 #define ATA_SK_MEDIUM_ERROR     (0x3)
781 #define ATA_SK_HARDWARE_ERROR   (0x4)
782 #define ATA_SK_ILLEGAL_REQUEST  (0x5)
783 #define ATA_SK_UNIT_ATTENTION   (0x6)
784 #define ATA_SK_DATA_PROTECT     (0x7)
785 #define ATA_SK_BLANK_CHECK      (0x8)
786 #define ATA_SK_VENDOR_SPECIFIC  (0x9)
787 #define ATA_SK_RESERVED_A       (0xA)
788 #define ATA_SK_ABORT            (0xB)
789 #define ATA_SK_RESERVED_C       (0xC)
790 #define ATA_SK_OVERFLOW         (0xD)
791 #define ATA_SK_MISCOMPARE       (0xE)
792 #define ATA_SK_RESERVED_F       (0xF)
793 
794 //
795 // Additional Sense Codes
796 //
797 #define ATA_ASC_NOT_READY                    (0x04)
798 #define ATA_ASC_MEDIA_ERR1                   (0x10)
799 #define ATA_ASC_MEDIA_ERR2                   (0x11)
800 #define ATA_ASC_MEDIA_ERR3                   (0x14)
801 #define ATA_ASC_MEDIA_ERR4                   (0x30)
802 #define ATA_ASC_MEDIA_UPSIDE_DOWN            (0x06)
803 #define ATA_ASC_INVALID_CMD                  (0x20)
804 #define ATA_ASC_LBA_OUT_OF_RANGE             (0x21)
805 #define ATA_ASC_INVALID_FIELD                (0x24)
806 #define ATA_ASC_WRITE_PROTECTED              (0x27)
807 #define ATA_ASC_MEDIA_CHANGE                 (0x28)
808 #define ATA_ASC_RESET                        (0x29)             ///< Power On Reset or Bus Reset occurred.
809 #define ATA_ASC_ILLEGAL_FIELD                (0x26)
810 #define ATA_ASC_NO_MEDIA                     (0x3A)
811 #define ATA_ASC_ILLEGAL_MODE_FOR_THIS_TRACK  (0x64)
812 
813 //
814 // Additional Sense Code Qualifier
815 //
816 #define ATA_ASCQ_IN_PROGRESS  (0x01)
817 
818 //
819 // Error Register
820 //
821 #define ATA_ERRREG_BBK    BIT7                                ///< Bad block detected      defined from ATA-1, obsoleted from ATA-2
822 #define ATA_ERRREG_UNC    BIT6                                ///< Uncorrectable Data      defined from ATA-1, obsoleted from ATA-4
823 #define ATA_ERRREG_MC     BIT5                                ///< Media Change            defined from ATA-1, obsoleted from ATA-4
824 #define ATA_ERRREG_IDNF   BIT4                                ///< ID Not Found            defined from ATA-1, obsoleted from ATA-4
825 #define ATA_ERRREG_MCR    BIT3                                ///< Media Change Requested  defined from ATA-1, obsoleted from ATA-4
826 #define ATA_ERRREG_ABRT   BIT2                                ///< Aborted Command         defined from ATA-1
827 #define ATA_ERRREG_TK0NF  BIT1                                ///< Track 0 Not Found       defined from ATA-1, obsoleted from ATA-4
828 #define ATA_ERRREG_AMNF   BIT0                                ///< Address Mark Not Found  defined from ATA-1, obsoleted from ATA-4
829 
830 //
831 // Status Register
832 //
833 #define ATA_STSREG_BSY   BIT7                                 ///< Controller Busy         defined from ATA-1
834 #define ATA_STSREG_DRDY  BIT6                                 ///< Drive Ready             defined from ATA-1
835 #define ATA_STSREG_DWF   BIT5                                 ///< Drive Write Fault       defined from ATA-1, obsoleted from ATA-4
836 #define ATA_STSREG_DF    BIT5                                 ///< Drive Fault             defined from ATA-6
837 #define ATA_STSREG_DSC   BIT4                                 ///< Disk Seek Complete      defined from ATA-1, obsoleted from ATA-4
838 #define ATA_STSREG_DRQ   BIT3                                 ///< Data Request            defined from ATA-1
839 #define ATA_STSREG_CORR  BIT2                                 ///< Corrected Data          defined from ATA-1, obsoleted from ATA-4
840 #define ATA_STSREG_IDX   BIT1                                 ///< Index                   defined from ATA-1, obsoleted from ATA-4
841 #define ATA_STSREG_ERR   BIT0                                 ///< Error                   defined from ATA-1
842 
843 //
844 // Device Control Register
845 //
846 #define ATA_CTLREG_SRST   BIT2                                ///< Software Reset.
847 #define ATA_CTLREG_IEN_L  BIT1                                ///< Interrupt Enable #.
848 
849 #endif
850