TianoCore EDK2 master
Loading...
Searching...
No Matches
Atapi.h
Go to the documentation of this file.
1
10#ifndef _ATAPI_H_
11#define _ATAPI_H_
12
13#pragma pack(1)
14
21typedef struct {
22 UINT16 config;
23 UINT16 cylinders;
24 UINT16 reserved_2;
25 UINT16 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];
31 UINT16 vendor_specific_20_21[2];
32 UINT16 ecc_bytes_available;
33 CHAR8 FirmwareVer[8];
34 CHAR8 ModelName[40];
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;
67 UINT16 reserved_89_127[39];
68 UINT16 security_status;
69 UINT16 vendor_data_129_159[31];
70 UINT16 reserved_160_255[96];
72
78typedef struct {
79 UINT16 config;
80 UINT16 obsolete_1;
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];
88 UINT16 retired_20_21[2];
89 UINT16 obsolete_22;
90 CHAR8 FirmwareVer[8];
91 CHAR8 ModelName[40];
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;
110 UINT16 reserved_70;
111 UINT16 reserved_71_74[4];
112 UINT16 queue_depth;
113 UINT16 serial_ata_capabilities;
114 UINT16 reserved_77;
115 UINT16 serial_ata_features_supported;
116 UINT16 serial_ata_features_enabled;
117 UINT16 major_version_no;
118 UINT16 minor_version_no;
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];
136 UINT16 maximum_lba_for_48bit_addressing[4];
137 UINT16 streaming_transfer_time_for_pio;
138 UINT16 max_no_of_512byte_blocks_per_data_set_cmd;
140 UINT16 interseek_delay_for_iso7779;
141 UINT16 world_wide_name[4];
142 UINT16 reserved_for_128bit_wwn_112_115[4];
143 UINT16 reserved_for_technical_report;
148 UINT16 reserved_121_126[6];
149 UINT16 obsolete_127;
151 UINT16 vendor_specific_129_159[31];
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];
160 UINT16 reserved_207_208[2];
162 UINT16 write_read_verify_sector_count_mode3[2];
163 UINT16 verify_sector_count_mode2[2];
164 UINT16 nv_cache_capabilities;
167 UINT16 nominal_media_rotation_rate;
168 UINT16 reserved_218;
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;
178 UINT16 reserved_236_254[19];
179 UINT16 integrity_word;
181
187typedef struct {
188 UINT16 config;
189 UINT16 reserved_1;
191 UINT16 reserved_3_9[7];
192 CHAR8 SerialNo[20];
193 UINT16 reserved_20_22[3];
194 CHAR8 FirmwareVer[8];
195 CHAR8 ModelName[40];
196 UINT16 reserved_47_48[2];
197 UINT16 capabilities_49;
198 UINT16 capabilities_50;
199 UINT16 obsolete_51;
200 UINT16 reserved_52;
202 UINT16 reserved_54_61[8];
203 UINT16 dma_dir;
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;
216 UINT16 serial_ata_features_supported;
217 UINT16 serial_ata_features_enabled;
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;
229 UINT16 advanced_power_management_level;
230 UINT16 master_pwd_revison_code;
232 UINT16 obsolete_94;
233 UINT16 reserved_95_107[13];
234 UINT16 world_wide_name[4];
235 UINT16 reserved_for_128bit_wwn_112_115[4];
236 UINT16 reserved_116_118[3];
238 UINT16 command_and_feature_sets_supported_enabled;
239 UINT16 reserved_121_124[4];
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;
251
255typedef struct {
256 UINT8 peripheral_type;
257 UINT8 RMB;
258 UINT8 version;
259 UINT8 response_data_format;
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];
273 UINT8 vendor_specific_96_253[253 - 96 + 1];
275
279typedef 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;
291 UINT8 vendor_specific_8;
292 UINT8 vendor_specific_9;
293 UINT8 vendor_specific_10;
294 UINT8 vendor_specific_11;
298 UINT8 sense_key_specific_15 : 7;
299 UINT8 SKSV : 1;
300 UINT8 sense_key_specific_16;
301 UINT8 sense_key_specific_17;
303
307typedef 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;
317
322typedef 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;
337
341typedef 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;
355
359typedef struct {
360 UINT8 opcode;
361 UINT8 reserved_1 : 5;
362 UINT8 lun : 3;
363 UINT8 page_code;
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;
374
378typedef 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;
393
397typedef 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;
412
416typedef 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;
431
435typedef 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;
451
456typedef union {
457 UINT16 Data16[6];
459 ATAPI_READ10_CMD Read10;
460 ATAPI_REQUEST_SENSE_CMD RequestSence;
462 ATAPI_MODE_SENSE_CMD ModeSense;
463 ATAPI_READ_FORMAT_CAP_CMD ReadFormatCapacity;
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
473#define ATAPI_SIGNATURE 0xeb14
474#define ATAPI_SIGNATURE_32 0xeb140101
475
476// Spin Up Configuration definitions
477#define ATA_SPINUP_CFG_REQUIRED_IDD_INCOMPLETE 0x37c8
478#define ATA_SPINUP_CFG_REQUIRED_IDD_COMPLETE 0x738c
479#define ATA_SPINUP_CFG_NOT_REQUIRED_IDD_INCOMPLETE 0x8c73
480#define ATA_SPINUP_CFG_NOT_REQUIRED_IDD_COMPLETE 0xc837
481
482//
483// ATA Packet Command Code
484//
485#define ATA_CMD_FORMAT_UNIT 0x04
486#define ATA_CMD_SOFT_RESET 0x08
487#define ATA_CMD_PACKET 0xA0
488#define ATA_CMD_IDENTIFY_DEVICE 0xA1
489#define ATA_CMD_SERVICE 0xA2
490#define ATA_CMD_TEST_UNIT_READY 0x00
491#define ATA_CMD_REQUEST_SENSE 0x03
492#define ATA_CMD_INQUIRY 0x12
493#define ATA_CMD_READ_FORMAT_CAPACITY 0x23
494#define ATA_CMD_READ_CAPACITY 0x25
495#define ATA_CMD_READ_10 0x28
496#define ATA_CMD_WRITE_10 0x2A
497#define ATA_CMD_ATAPI_SEEK 0x2B
498#define ATA_CMD_WRITE_AND_VERIFY 0x2E
499#define ATA_CMD_VERIFY 0x2F
500#define ATA_CMD_READ_12 0xA8
501#define ATA_CMD_WRITE_12 0xAA
502#define ATA_CMD_START_STOP_UNIT 0x1B
503#define ATA_CMD_PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
504#define ATA_CMD_MODE_SELECT 0x55
505
506#define ATA_CMD_MODE_SENSE 0x5A
507#define ATA_PAGE_CODE_READ_WRITE_ERROR 0x01
508#define ATA_PAGE_CODE_CACHING_PAGE 0x08
509#define ATA_PAGE_CODE_REMOVABLE_BLOCK_CAPABILITIES 0x1B
510#define ATA_PAGE_CODE_TIMER_PROTECT_PAGE 0x1C
511#define ATA_PAGE_CODE_RETURN_ALL_PAGES 0x3F
512
513#define ATA_CMD_GET_CONFIGURATION 0x46
514#define ATA_GCCD_RT_FIELD_VALUE_ALL 0x00
515#define ATA_GCCD_RT_FIELD_VALUE_CURRENT 0x01
516#define ATA_GCCD_RT_FIELD_VALUE_SINGLE 0x02
517#define ATA_GCCD_RT_FIELD_VALUE_RESERVED 0x03
518
519#define ATA_FEATURE_LIST_PROFILE_LIST 0x0000
520#define ATA_FEATURE_LIST_CORE 0x0001
521#define ATA_FEATURE_LIST_MORPHING 0x0002
522#define ATA_FEATURE_LIST_REMOVEABLE_MEDIUM 0x0003
523#define ATA_FEATURE_LIST_WRITE_PROTECT 0x0004
524
529#define ATA_CMD_SUBOP_STOP_DISC 0x00
530#define ATA_CMD_SUBOP_START_DISC 0x01
531#define ATA_CMD_SUBOP_EJECT_DISC 0x02
532#define ATA_CMD_SUBOP_CLOSE_TRAY 0x03
534
535//
536// ATA Commands Code
537//
538
539//
540// Class 1: PIO Data-In Commands
541//
542#define ATA_CMD_IDENTIFY_DRIVE 0xec
543#define ATA_CMD_READ_BUFFER 0xe4
544#define ATA_CMD_READ_SECTORS 0x20
545#define ATA_CMD_READ_SECTORS_WITH_RETRY 0x21
546#define ATA_CMD_READ_LONG 0x22
547#define ATA_CMD_READ_LONG_WITH_RETRY 0x23
548#define ATA_CMD_READ_SECTORS_EXT 0x24
549#define ATA_CMD_READ_MULTIPLE 0xc4
550#define ATA_CMD_READ_MULTIPLE_EXT 0x29
551#define ATA_CMD_READ_LOG_EXT 0x2f
552
553//
554// Class 2: PIO Data-Out Commands
555//
556#define ATA_CMD_FORMAT_TRACK 0x50
557#define ATA_CMD_WRITE_BUFFER 0xe8
558#define ATA_CMD_WRITE_SECTORS 0x30
559#define ATA_CMD_WRITE_SECTORS_WITH_RETRY 0x31
560#define ATA_CMD_WRITE_LONG 0x32
561#define ATA_CMD_WRITE_LONG_WITH_RETRY 0x33
562#define ATA_CMD_WRITE_VERIFY 0x3c
563#define ATA_CMD_WRITE_SECTORS_EXT 0x34
564#define ATA_CMD_WRITE_MULTIPLE 0xc5
565#define ATA_CMD_WRITE_MULTIPLE_EXT 0x39
566
567//
568// Class 3 No Data Command
569//
570#define ATA_CMD_ACK_MEDIA_CHANGE 0xdb
571#define ATA_CMD_BOOT_POST_BOOT 0xdc
572#define ATA_CMD_BOOT_PRE_BOOT 0xdd
573#define ATA_CMD_CHECK_POWER_MODE 0x98
574#define ATA_CMD_CHECK_POWER_MODE_ALIAS 0xe5
575#define ATA_CMD_DOOR_LOCK 0xde
576#define ATA_CMD_DOOR_UNLOCK 0xdf
577#define ATA_CMD_EXEC_DRIVE_DIAG 0x90
578#define ATA_CMD_IDLE_ALIAS 0x97
579#define ATA_CMD_IDLE 0xe3
580#define ATA_CMD_IDLE_IMMEDIATE 0x95
581#define ATA_CMD_IDLE_IMMEDIATE_ALIAS 0xe1
582#define ATA_CMD_INIT_DRIVE_PARAM 0x91
583#define ATA_CMD_RECALIBRATE 0x10
584#define ATA_CMD_READ_DRIVE_STATE 0xe9
585#define ATA_CMD_SET_MULTIPLE_MODE 0xC6
586#define ATA_CMD_READ_VERIFY 0x40
587#define ATA_CMD_READ_VERIFY_WITH_RETRY 0x41
588#define ATA_CMD_SEEK 0x70
589#define ATA_CMD_SET_FEATURES 0xef
590#define ATA_CMD_STANDBY 0x96
591#define ATA_CMD_STANDBY_ALIAS 0xe2
592#define ATA_CMD_STANDBY_IMMEDIATE 0x94
593#define ATA_CMD_STANDBY_IMMEDIATE_ALIAS 0xe0
594#define ATA_CMD_SLEEP 0xe6
595#define ATA_CMD_READ_NATIVE_MAX_ADDRESS 0xf8
596#define ATA_CMD_READ_NATIVE_MAX_ADDRESS_EXT 0x27
597
598//
599// Set Features Sub Command
600//
601#define ATA_SUB_CMD_ENABLE_VOLATILE_WRITE_CACHE 0x02
602#define ATA_SUB_CMD_SET_TRANSFER_MODE 0x03
603#define ATA_SUB_CMD_ENABLE_APM 0x05
604#define ATA_SUB_CMD_ENABLE_PUIS 0x06
605#define ATA_SUB_CMD_PUIS_SET_DEVICE_SPINUP 0x07
606#define ATA_SUB_CMD_ENABLE_WRITE_READ_VERIFY 0x0b
607#define ATA_SUB_CMD_ENABLE_SATA_FEATURE 0x10
608#define ATA_SUB_CMD_DISABLE_MEDIA_STATUS_NOTIFICATION 0x31
609#define ATA_SUB_CMD_ENABLE_FREE_FALL_CONTROL 0x41
610#define ATA_SUB_CMD_ACOUSTIC_MANAGEMENT_ENABLE 0x42
611#define ATA_SUB_CMD_SET_MAX_HOST_INTERFACE_SECTOR_TIMES 0x43
612#define ATA_SUB_CMD_EXTENDED_POWER_CONDITIONS 0x4a
613#define ATA_SUB_CMD_DISABLE_READ_LOOK_AHEAD 0x55
614#define ATA_SUB_CMD_EN_DIS_DSN_FEATURE 0x63
615#define ATA_SUB_CMD_DISABLE_REVERT_TO_POWER_ON_DEFAULTS 0x66
616#define ATA_SUB_CMD_DISABLE_VOLATILE_WRITE_CACHE 0x82
617#define ATA_SUB_CMD_DISABLE_APM 0x85
618#define ATA_SUB_CMD_DISABLE_PUIS 0x86
619#define ATA_SUB_CMD_DISABLE_WRITE_READ_VERIFY 0x8b
620#define ATA_SUB_CMD_DISABLE_SATA_FEATURE 0x90
621#define ATA_SUB_CMD_ENABLE_MEDIA_STATUS_NOTIFICATION 0x95
622#define ATA_SUB_CMD_ENABLE_READ_LOOK_AHEAD 0xaa
623#define ATA_SUB_CMD_DISABLE_FREE_FALL_CONTROL 0xc1
624#define ATA_SUB_CMD_ACOUSTIC_MANAGEMENT_DISABLE 0xc2
625#define ATA_SUB_CMD_EN_DIS_SENSE_DATA_REPORTING 0xc3
626#define ATA_SUB_CMD_ENABLE_REVERT_TO_POWER_ON_DEFAULTS 0xcc
627
628//
629// S.M.A.R.T
630//
631#define ATA_CMD_SMART 0xb0
632#define ATA_CONSTANT_C2 0xc2
633#define ATA_CONSTANT_4F 0x4f
634
635#define ATA_SMART_READ_DATA 0xd0
636
637#define ATA_SMART_AUTOSAVE 0xd2
638#define ATA_AUTOSAVE_DISABLE_ATTR 0x00
639#define ATA_AUTOSAVE_ENABLE_ATTR 0xf1
640
641#define ATA_SMART_EXECUTE_OFFLINE_IMMEDIATE 0xd4
642#define ATA_EXECUTE_SMART_OFFLINE_ROUTINE 0x00
643#define ATA_EXECUTE_SMART_OFFLINE_SHORT_SELFTEST 0x01
644#define ATA_EXECUTE_SMART_OFFLINE_EXTENDED_SELFTEST 0x02
645#define ATA_EXECUTE_SMART_OFFLINE_CONVEYANCE_SELFTEST 0x03
646#define ATA_EXECUTE_SMART_OFFLINE_SELECTIVE_SELFTEST 0x04
647#define ATA_SMART_ABORT_SELF_TEST_SUBROUTINE 0x7f
648#define ATA_EXECUTE_SMART_CAPTIVE_SHORT_SELFTEST 0x81
649#define ATA_EXECUTE_SMART_CAPTIVE_EXTENDED_SELFTEST 0x82
650#define ATA_EXECUTE_SMART_CAPTIVE_CONVEYANCE_SELFTEST 0x83
651#define ATA_EXECUTE_SMART_CAPTIVE_SELECTIVE_SELFTEST 0x84
652
653#define ATA_SMART_READLOG 0xd5
654#define ATA_SMART_WRITELOG 0xd6
655#define ATA_SMART_ENABLE_OPERATION 0xd8
656#define ATA_SMART_DISABLE_OPERATION 0xd9
657#define ATA_SMART_RETURN_STATUS 0xda
658
659#define ATA_SMART_THRESHOLD_NOT_EXCEEDED_VALUE 0xc24f
660#define ATA_SMART_THRESHOLD_EXCEEDED_VALUE 0x2cf4
661
662// SMART Log Definitions
663#define ATA_SMART_LOG_DIRECTORY 0x00
664#define ATA_SMART_SUM_SMART_ERROR_LOG 0x01
665#define ATA_SMART_COMP_SMART_ERROR_LOG 0x02
666#define ATA_SMART_EXT_COMP_SMART_ERROR_LOG 0x03
667#define ATA_SMART_SMART_SELFTEST_LOG 0x06
668#define ATA_SMART_EXT_SMART_SELFTEST_LOG 0x07
669#define ATA_SMART_SELECTIVE_SELFTEST_LOG 0x09
670#define ATA_SMART_HOST_VENDOR_SPECIFIC 0x80
671#define ATA_SMART_DEVICE_VENDOR_SPECIFIC 0xa0
672
673//
674// Class 4: DMA Command
675//
676#define ATA_CMD_READ_DMA 0xc8
677#define ATA_CMD_READ_DMA_WITH_RETRY 0xc9
678#define ATA_CMD_READ_DMA_EXT 0x25
679#define ATA_CMD_WRITE_DMA 0xca
680#define ATA_CMD_WRITE_DMA_WITH_RETRY 0xcb
681#define ATA_CMD_WRITE_DMA_EXT 0x35
682
683//
684// ATA Security commands
685//
686#define ATA_CMD_SECURITY_SET_PASSWORD 0xf1
687#define ATA_CMD_SECURITY_UNLOCK 0xf2
688#define ATA_CMD_SECURITY_ERASE_PREPARE 0xf3
689#define ATA_CMD_SECURITY_ERASE_UNIT 0xf4
690#define ATA_CMD_SECURITY_FREEZE_LOCK 0xf5
691#define ATA_CMD_SECURITY_DISABLE_PASSWORD 0xf6
692
693#define ATA_SECURITY_BUFFER_LENGTH 512
694
695//
696// ATA Device Config Overlay
697//
698#define ATA_CMD_DEV_CONFIG_OVERLAY 0xb1
699#define ATA_CMD_DEV_CONFIG_RESTORE_FEATURE 0xc0
700#define ATA_CMD_DEV_CONFIG_FREEZELOCK_FEATURE 0xc1
701#define ATA_CMD_DEV_CONFIG_IDENTIFY_FEATURE 0xc2
702#define ATA_CMD_DEV_CONFIG_SET_FEATURE 0xc3
703
704//
705// ATA Trusted Computing Feature Set Commands
706//
707#define ATA_CMD_TRUSTED_NON_DATA 0x5b
708#define ATA_CMD_TRUSTED_RECEIVE 0x5c
709#define ATA_CMD_TRUSTED_RECEIVE_DMA 0x5d
710#define ATA_CMD_TRUSTED_SEND 0x5e
711#define ATA_CMD_TRUSTED_SEND_DMA 0x5f
712
713//
714// ATA Trusted Receive Fields
715//
716#define ATA_TR_RETURN_SECURITY_PROTOCOL_INFORMATION 0x00
717#define ATA_TR_SECURITY_PROTOCOL_JEDEC_RESERVED 0xec
718#define ATA_TR_SECURITY_PROTOCOL_SDCARD_RESERVED 0xed
719#define ATA_TR_SECURITY_PROTOCOL_IEEE1667_RESERVED 0xee
720
721//
722// Equates used for Acoustic Flags
723//
724#define ATA_ACOUSTIC_LEVEL_BYPASS 0xff
725#define ATA_ACOUSTIC_LEVEL_MAXIMUM_PERFORMANCE 0xfe
726#define ATA_ACOUSTIC_LEVEL_QUIET 0x80
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
750#define ATA_CMD_SET_MAX_ADDRESS 0xf9
751#define ATA_SET_MAX_SET_PASSWORD 0x01
752#define ATA_SET_MAX_LOCK 0x02
753#define ATA_SET_MAX_UNLOCK 0x03
754#define ATA_SET_MAX_FREEZE_LOCK 0x04
755
760#define ATA_DEFAULT_CTL (0x0a)
765#define ATA_DEFAULT_CMD (0xa0)
766
767#define ATAPI_MAX_BYTE_COUNT (0xfffe)
768
769#define ATA_REQUEST_SENSE_ERROR (0x70)
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)
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
822#define ATA_ERRREG_UNC BIT6
823#define ATA_ERRREG_MC BIT5
824#define ATA_ERRREG_IDNF BIT4
825#define ATA_ERRREG_MCR BIT3
826#define ATA_ERRREG_ABRT BIT2
827#define ATA_ERRREG_TK0NF BIT1
828#define ATA_ERRREG_AMNF BIT0
829
830//
831// Status Register
832//
833#define ATA_STSREG_BSY BIT7
834#define ATA_STSREG_DRDY BIT6
835#define ATA_STSREG_DWF BIT5
836#define ATA_STSREG_DF BIT5
837#define ATA_STSREG_DSC BIT4
838#define ATA_STSREG_DRQ BIT3
839#define ATA_STSREG_CORR BIT2
840#define ATA_STSREG_IDX BIT1
841#define ATA_STSREG_ERR BIT0
842
843//
844// Device Control Register
845//
846#define ATA_CTLREG_SRST BIT2
847#define ATA_CTLREG_IEN_L BIT1
848
849#endif
EFI_STATUS TestUnitReady(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
Definition: AtapiPeim.c:1379
EFI_STATUS Inquiry(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
Definition: AtapiPeim.c:1623
UINT16 ultra_dma_mode
word 88
Definition: Atapi.h:66
UINT16 command_set_supported_83
word 83
Definition: Atapi.h:61
UINT16 command_set_feature_extn
word 84
Definition: Atapi.h:62
UINT16 command_set_feature_enb_86
word 86
Definition: Atapi.h:64
UINT16 config
General Configuration.
Definition: Atapi.h:22
UINT16 command_set_feature_enb_85
word 85
Definition: Atapi.h:63
UINT16 cylinders
Number of Cylinders.
Definition: Atapi.h:23
UINT16 command_set_feature_default
word 87
Definition: Atapi.h:65
UINT16 command_set_supported_82
word 82
Definition: Atapi.h:60
UINT16 heads
Number of logical heads.
Definition: Atapi.h:25
UINT16 features_and_command_sets_enabled_ext
word 120
Definition: Atapi.h:147
UINT16 ultra_dma_mode
word 88
Definition: Atapi.h:125
UINT16 command_set_feature_enb_85
word 85
Definition: Atapi.h:122
UINT16 max_number_per_download_microcode_mode3
word 235
Definition: Atapi.h:177
UINT16 specific_config
Specific Configuration.
Definition: Atapi.h:81
UINT16 reserved_77
Reserved for Serial ATA.
Definition: Atapi.h:114
UINT16 config
General Configuration.
Definition: Atapi.h:79
UINT16 additional_supported
word 69
Definition: Atapi.h:109
UINT16 command_set_feature_enb_86
word 86
Definition: Atapi.h:123
UINT16 security_status
word 128
Definition: Atapi.h:150
UINT16 command_set_feature_extn
word 84
Definition: Atapi.h:121
UINT16 command_set_feature_default
word 87
Definition: Atapi.h:124
UINT16 alignment_logic_in_phy_blocks
word 209
Definition: Atapi.h:161
UINT16 write_read_verify_mode
word 220
Definition: Atapi.h:170
UINT16 command_set_supported_83
word 83
Definition: Atapi.h:120
UINT16 nv_cache_size_in_logical_block_msw
word 216
Definition: Atapi.h:166
UINT16 cfa_power_mode
word 160
Definition: Atapi.h:152
UINT16 logic_sector_size_lo
word 117
Definition: Atapi.h:144
UINT16 phy_logic_sector_support
word 106
Definition: Atapi.h:139
UINT16 logic_sector_size_hi
word 118
Definition: Atapi.h:145
UINT16 nv_cache_size_in_logical_block_lsw
word 215
Definition: Atapi.h:165
UINT16 sct_command_transport
word 206
Definition: Atapi.h:159
UINT16 command_set_supported_82
word 82
Definition: Atapi.h:119
UINT16 min_number_per_download_microcode_mode3
word 234
Definition: Atapi.h:176
UINT16 features_and_command_sets_supported_ext
word 119
Definition: Atapi.h:146
UINT16 nv_cache_options
word 219
Definition: Atapi.h:169
UINT16 reserved_77
Reserved for Serial ATA.
Definition: Atapi.h:215
UINT16 command_and_feature_sets_supported
word 119
Definition: Atapi.h:237
UINT16 advanced_pio_modes
word 64
Definition: Atapi.h:205
UINT16 specific_config
Specific Configuration.
Definition: Atapi.h:190
UINT16 field_validity
word 53
Definition: Atapi.h:201
UINT16 major_version_no
word 80
Definition: Atapi.h:218
UINT16 time_required_for_sec_erase
word 89
Definition: Atapi.h:227
UINT16 hardware_reset_result
word 93
Definition: Atapi.h:231
UINT16 multi_word_dma_mode
word 63
Definition: Atapi.h:204
UINT16 atapi_byte_count_0_behavior
word 125
Definition: Atapi.h:240
UINT16 time_required_for_enhanced_sec_erase
word 90
Definition: Atapi.h:228
UINT16 minor_version_no
word 81
Definition: Atapi.h:219
UINT16 config
General Configuration.
Definition: Atapi.h:188
UINT8 page_code
defined in SFF8090i, V6
Definition: Atapi.h:363
UINT8 addnl_length
n - 4, Numbers of bytes following this one.
Definition: Atapi.h:260
UINT8 addnl_sense_length
n - 7
Definition: Atapi.h:290
UINT8 addnl_sense_code
mandatory
Definition: Atapi.h:295
UINT8 field_replaceable_unit_code
optional
Definition: Atapi.h:297
UINT8 addnl_sense_code_qualifier
mandatory
Definition: Atapi.h:296