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