xref: /freebsd/sys/dev/isci/scil/intel_ata.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
4  * This file is provided under a dual BSD/GPLv2 license.  When using or
5  * redistributing this file, you may do so under either license.
6  *
7  * GPL LICENSE SUMMARY
8  *
9  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of version 2 of the GNU General Public License as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23  * The full GNU General Public License is included in this distribution
24  * in the file called LICENSE.GPL.
25  *
26  * BSD LICENSE
27  *
28  * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions
33  * are met:
34  *
35  *   * Redistributions of source code must retain the above copyright
36  *     notice, this list of conditions and the following disclaimer.
37  *   * Redistributions in binary form must reproduce the above copyright
38  *     notice, this list of conditions and the following disclaimer in
39  *     the documentation and/or other materials provided with the
40  *     distribution.
41  *
42  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  */
54 /**
55  * @file
56  * @brief This file defines all of the ATA related constants, enumerations,
57  *        and types.  Please note that this file does not necessarily contain
58  *        an exhaustive list of all constants, commands, sub-commands, etc.
59  */
60 
61 #ifndef _ATA_H_
62 #define _ATA_H_
63 
64 #include <dev/isci/types.h>
65 
66 /**
67  * @name ATA_COMMAND_CODES
68  *
69  * These constants depict the various ATA command codes defined
70  * in the ATA/ATAPI specification.
71  */
72 /*@{*/
73 #define ATA_IDENTIFY_DEVICE            0xEC
74 #define ATA_CHECK_POWER_MODE           0xE5
75 #define ATA_STANDBY                    0xE2
76 #define ATA_STANDBY_IMMED              0xE0
77 #define ATA_IDLE_IMMED                 0xE1
78 #define ATA_IDLE                       0xE3
79 #define ATA_FLUSH_CACHE                0xE7
80 #define ATA_FLUSH_CACHE_EXT            0xEA
81 #define ATA_READ_DMA_EXT               0x25
82 #define ATA_READ_DMA                   0xC8
83 #define ATA_READ_SECTORS_EXT           0x24
84 #define ATA_READ_SECTORS               0x20
85 #define ATA_WRITE_DMA_EXT              0x35
86 #define ATA_WRITE_DMA                  0xCA
87 #define ATA_WRITE_SECTORS_EXT          0x34
88 #define ATA_WRITE_SECTORS              0x30
89 #define ATA_WRITE_UNCORRECTABLE        0x45
90 #define ATA_READ_VERIFY_SECTORS        0x40
91 #define ATA_READ_VERIFY_SECTORS_EXT    0x42
92 #define ATA_READ_BUFFER                0xE4
93 #define ATA_WRITE_BUFFER               0xE8
94 #define ATA_EXECUTE_DEVICE_DIAG        0x90
95 #define ATA_SET_FEATURES               0xEF
96 #define ATA_SMART                      0xB0
97 #define ATA_PACKET_IDENTIFY            0xA1
98 #define ATA_PACKET                     0xA0
99 #define ATA_READ_FPDMA                 0x60
100 #define ATA_WRITE_FPDMA                0x61
101 #define ATA_READ_LOG_EXT               0x2F
102 #define ATA_NOP                        0x00
103 #define ATA_DEVICE_RESET               0x08
104 #define ATA_MEDIA_EJECT                0xED
105 #define ATA_SECURITY_UNLOCK            0xF2
106 #define ATA_SECURITY_FREEZE_LOCK       0xF5
107 #define ATA_DATA_SET_MANAGEMENT        0x06
108 #define ATA_DOWNLOAD_MICROCODE         0x92
109 #define ATA_WRITE_STREAM_DMA_EXT       0x3A
110 #define ATA_READ_LOG_DMA_EXT           0x47
111 #define ATA_READ_STREAM_DMA_EXT        0x2A
112 #define ATA_WRITE_DMA_FUA              0x3D
113 #define ATA_WRITE_LOG_DMA_EXT          0x57
114 #define ATA_READ_DMA_QUEUED            0xC7
115 #define ATA_READ_DMA_QUEUED_EXT        0x26
116 #define ATA_WRITE_DMA_QUEUED           0xCC
117 #define ATA_WRITE_DMA_QUEUED_EXT       0x36
118 #define ATA_WRITE_DMA_QUEUED_FUA_EXT   0x3E
119 #define ATA_READ_MULTIPLE              0xC4
120 #define ATA_READ_MULTIPLE_EXT          0x29
121 #define ATA_WRITE_MULTIPLE             0xC5
122 #define ATA_WRITE_MULTIPLE_EXT         0x39
123 #define ATA_WRITE_MULTIPLE_FUA_EXT     0xCE
124 
125 
126 /*@}*/
127 
128 /**
129  * @name ATA_SMART_SUB_COMMAND_CODES
130  *
131  * These constants define the ATA SMART command sub-codes that can be
132  * executed.
133  */
134 /*@{*/
135 #define ATA_SMART_SUB_CMD_ENABLE        0xD8
136 #define ATA_SMART_SUB_CMD_DISABLE       0xD9
137 #define ATA_SMART_SUB_CMD_RETURN_STATUS 0xDA
138 #define ATA_SMART_SUB_CMD_READ_LOG      0xD5
139 /*@}*/
140 
141 /**
142  * @name ATA_SET_FEATURES_SUB_COMMAND_CODES
143  *
144  * These constants define the ATA SET FEATURES command sub-codes that can
145  * be executed.
146  */
147 /*@{*/
148 #define ATA_SET_FEATURES_SUB_CMD_ENABLE_CACHE       0x02
149 #define ATA_SET_FEATURES_SUB_CMD_DISABLE_CACHE      0x82
150 #define ATA_SET_FEATURES_SUB_CMD_DISABLE_READ_AHEAD 0x55
151 #define ATA_SET_FEATURES_SUB_CMD_ENABLE_READ_AHEAD  0xAA
152 #define ATA_SET_FEATURES_SUB_CMD_SET_TRANSFER_MODE  0x3
153 /*@}*/
154 
155 /**
156  * @name ATA_READ_LOG_EXT_PAGE_CODES
157  *
158  * This is a list of log page codes available for use.
159  */
160 /*@{*/
161 #define ATA_LOG_PAGE_NCQ_ERROR                  0x10
162 #define ATA_LOG_PAGE_SMART_SELF_TEST            0x06
163 #define ATA_LOG_PAGE_EXTENDED_SMART_SELF_TEST   0x07
164 /*@}*/
165 
166 /**
167  * @name ATA_LOG_PAGE_NCQ_ERROR_CONSTANTS
168  *
169  * These constants define standard values for use when requesting the NCQ
170  * error log page.
171  */
172 /*@{*/
173 #define ATA_LOG_PAGE_NCQ_ERROR_SECTOR        0
174 #define ATA_LOG_PAGE_NCQ_ERROR_SECTOR_COUNT  1
175 /*@}*/
176 
177 /**
178  * @name ATA_STATUS_REGISTER_BITS
179  *
180  * The following are status register bit definitions per ATA/ATAPI-7.
181  */
182 /*@{*/
183 #define ATA_STATUS_REG_BSY_BIT          0x80
184 #define ATA_STATUS_REG_DEVICE_FAULT_BIT 0x20
185 #define ATA_STATUS_REG_ERROR_BIT        0x01
186 /*@}*/
187 
188 /**
189  * @name ATA_ERROR_REGISTER_BITS
190  *
191  * The following are error register bit definitions per ATA/ATAPI-7.
192  */
193 /*@{*/
194 #define ATA_ERROR_REG_NO_MEDIA_BIT              0x02
195 #define ATA_ERROR_REG_ABORT_BIT                 0x04
196 #define ATA_ERROR_REG_MEDIA_CHANGE_REQUEST_BIT  0x08
197 #define ATA_ERROR_REG_ID_NOT_FOUND_BIT          0x10
198 #define ATA_ERROR_REG_MEDIA_CHANGE_BIT          0x20
199 #define ATA_ERROR_REG_UNCORRECTABLE_BIT         0x40
200 #define ATA_ERROR_REG_WRITE_PROTECTED_BIT       0x40
201 #define ATA_ERROR_REG_ICRC_BIT                  0x80
202 /*@}*/
203 
204 /**
205  * @name ATA_CONTROL_REGISTER_BITS
206  *
207  * The following are control register bit definitions per ATA/ATAPI-7
208  */
209 /*@{*/
210 #define ATA_CONTROL_REG_INTERRUPT_ENABLE_BIT 0x02
211 #define ATA_CONTROL_REG_SOFT_RESET_BIT       0x04
212 #define ATA_CONTROL_REG_HIGH_ORDER_BYTE_BIT  0x80
213 /*@}*/
214 
215 /**
216  * @name ATA_DEVICE_HEAD_REGISTER_BITS
217  *
218  * The following are device/head register bit definitions per ATA/ATAPI-7.
219  */
220 /*@{*/
221 #define ATA_DEV_HEAD_REG_LBA_MODE_ENABLE  0x40
222 #define ATA_DEV_HEAD_REG_FUA_ENABLE       0x80
223 /*@}*/
224 
225 /**
226  * @name ATA_IDENTIFY_DEVICE_FIELD_LENGTHS
227  *
228  * The following constants define the number of bytes contained in various
229  * fields found in the IDENTIFY DEVICE data structure.
230  */
231 /*@{*/
232 #define ATA_IDENTIFY_SERIAL_NUMBER_LEN        20
233 #define ATA_IDENTIFY_MODEL_NUMBER_LEN         40
234 #define ATA_IDENTIFY_FW_REVISION_LEN          8
235 #define ATA_IDENTIFY_48_LBA_LEN               8
236 #define ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN  30
237 #define ATA_IDENTIFY_WWN_LEN                  8
238 /*@}*/
239 
240 /**
241  * @name ATA_IDENTIFY_DEVICE_FIELD_MASKS
242  *
243  * The following constants define bit masks utilized to determine if a
244  * feature is supported/enabled or if a bit is simply set inside of the
245  * IDENTIFY DEVICE data structure.
246  */
247 /*@{*/
248 #define ATA_IDENTIFY_REMOVABLE_MEDIA_ENABLE              0x0080
249 #define ATA_IDENTIFY_CAPABILITIES1_NORMAL_DMA_ENABLE     0x0100
250 #define ATA_IDENTIFY_CAPABILITIES1_STANDBY_ENABLE        0x2000
251 #define ATA_IDENTIFY_COMMAND_SET_SUPPORTED0_SMART_ENABLE 0x0001
252 #define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE 0x0400
253 #define ATA_IDENTIFY_COMMAND_SET_WWN_SUPPORT_ENABLE      0x0100
254 #define ATA_IDENTIFY_COMMAND_SET_ENABLED0_SMART_ENABLE   0x0001
255 #define ATA_IDENTIFY_SATA_CAPABILITIES_NCQ_ENABLE        0x0100
256 #define ATA_IDENTIFY_NCQ_QUEUE_DEPTH_ENABLE              0x001F
257 #define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE       0x0100
258 #define ATA_IDENTIFY_LOGICAL_SECTOR_PER_PHYSICAL_SECTOR_MASK   0x000F
259 #define ATA_IDENTIFY_LOGICAL_SECTOR_PER_PHYSICAL_SECTOR_ENABLE 0x2000
260 #define ATA_IDENTIFY_WRITE_UNCORRECTABLE_SUPPORT         0x0004
261 #define ATA_IDENTIFY_COMMAND_SET_SMART_SELF_TEST_SUPPORTED     0x0002
262 #define ATA_IDENTIFY_COMMAND_SET_DSM_TRIM_SUPPORTED            0x0001
263 #define ATA_IDENTIFY_COMMAND_ADDL_SUPPORTED_DETERMINISTIC_READ 0x4000
264 #define ATA_IDENTIFY_COMMAND_ADDL_SUPPORTED_READ_ZERO          0x0020
265 /*@}*/
266 
267 /**
268  * @name ATAPI_IDENTIFY_DEVICE_FIELD_MASKS
269  *
270  * These constants define the various bit definitions for the
271  * fields in the PACKET IDENTIFY DEVICE data structure.
272  */
273 /*@{*/
274 #define ATAPI_IDENTIFY_16BYTE_CMD_PCKT_ENABLE       0x01
275 /*@}*/
276 
277 /**
278  * @name ATA_PACKET_FEATURE_BITS
279  *
280  * These constants define the various bit definitions for the
281  * ATA PACKET feature register.
282  */
283 /*@{*/
284 #define ATA_PACKET_FEATURE_DMA     0x01
285 #define ATA_PACKET_FEATURE_OVL     0x02
286 #define ATA_PACKET_FEATURE_DMADIR  0x04
287 /*@}*/
288 
289 /**
290  * @name ATA_Device_Power_Mode_Values
291  *
292  * These constants define the power mode values returned by
293  * ATA_Check_Power_Mode
294  */
295 /*@{*/
296 #define ATA_STANDBY_POWER_MODE    0x00
297 #define ATA_IDLE_POWER_MODE       0x80
298 #define ATA_ACTIVE_POWER_MODE     0xFF
299 /*@}*/
300 
301 /**
302  * @name ATA_WRITE_UNCORRECTABLE feature field values
303  *
304  * These constants define the Write Uncorrectable feature values
305  * used with the SATI translation.
306  */
307 /*@{*/
308 #define ATA_WRITE_UNCORRECTABLE_PSEUDO    0x55
309 #define ATA_WRITE_UNCORRECTABLE_FLAGGED   0xAA
310 /*@}*/
311 
312 
313 
314 /**
315  * @name ATA_SECURITY_STATUS field values
316  *
317  * These constants define the mask of the securityStatus field and the various bits within it
318  */
319 /*@{*/
320 #define ATA_SECURITY_STATUS_SUPPORTED      0x0001
321 #define ATA_SECURITY_STATUS_ENABLED        0x0002
322 #define ATA_SECURITY_STATUS_LOCKED         0x0004
323 #define ATA_SECURITY_STATUS_FROZEN         0x0008
324 #define ATA_SECURITY_STATUS_EXPIRED        0x0010
325 #define ATA_SECURITY_STATUS_ERASESUPPORTED 0x0020
326 #define ATA_SECURITY_STATUS_RESERVED       0xFEC0
327 #define ATA_SECURITY_STATUS_SECURITYLEVEL  0x0100
328 /*@}*/
329 
330 /**
331  * @struct ATA_IDENTIFY_DEVICE
332  *
333  * @brief This structure depicts the ATA IDENTIFY DEVICE data format.
334  */
335 typedef struct ATA_IDENTIFY_DEVICE_DATA
336 {
337    U16   general_config_bits;                             // word  00
338    U16   obsolete0;                                       // word  01 (num cylinders)
339    U16   vendor_specific_config_bits;                     // word  02
340    U16   obsolete1;                                       // word  03 (num heads)
341    U16   retired1[2];                                     // words 04-05
342    U16   obsolete2;                                       // word  06 (sectors / track)
343    U16   reserved_for_compact_flash1[2];                  // words 07-08
344    U16   retired0;                                        // word  09
345    U8    serial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN];   // word 10-19
346    U16   retired2[2];                                     // words 20-21
347    U16   obsolete4;                                       // word  22
348    U8    firmware_revision[ATA_IDENTIFY_FW_REVISION_LEN]; // words 23-26
349    U8    model_number[ATA_IDENTIFY_MODEL_NUMBER_LEN];     // words 27-46
350    U16   max_sectors_per_multiple;                        // word  47
351    U16   reserved0;                                       // word  48
352    U16   capabilities1;                                   // word  49
353    U16   capabilities2;                                   // word  50
354    U16   obsolete5[2];                                    // words 51-52
355    U16   validity_bits;                                   // word  53
356    U16   obsolete6[5];                                    // words 54-58 Used to be:
357                                                           // current cylinders,
358                                                           // current heads,
359                                                           // current sectors/Track,
360                                                           // current capacity
361    U16   current_max_sectors_per_multiple;                // word  59
362    U8    total_num_sectors[4];                            // words 60-61
363    U16   obsolete7;                                       // word  62
364    U16   multi_word_dma_mode;                             // word  63
365    U16   pio_modes_supported;                             // word  64
366    U16   min_multiword_dma_transfer_cycle;                // word  65
367    U16   rec_min_multiword_dma_transfer_cycle;            // word  66
368    U16   min_pio_transfer_no_flow_ctrl;                   // word  67
369    U16   min_pio_transfer_with_flow_ctrl;                 // word  68
370    U16   additional_supported;                            // word  69
371    U16   reserved1;                                       // word  70
372    U16   reserved2[4];                                    // words 71-74
373    U16   queue_depth;                                     // word  75
374    U16   serial_ata_capabilities;                         // word  76
375    U16   serial_ata_reserved;                             // word  77
376    U16   serial_ata_features_supported;                   // word  78
377    U16   serial_ata_features_enabled;                     // word  79
378    U16   major_version_number;                            // word  80
379    U16   minor_version_number;                            // word  81
380    U16   command_set_supported0;                          // word  82
381    U16   command_set_supported1;                          // word  83
382    U16   command_set_supported_extention;                 // word  84
383    U16   command_set_enabled0;                            // word  85
384    U16   command_set_enabled1;                            // word  86
385    U16   command_set_default;                             // word  87
386    U16   ultra_dma_mode;                                  // word  88
387    U16   security_erase_completion_time;                  // word  89
388    U16   enhanced_security_erase_time;                    // word  90
389    U16   current_power_mgmt_value;                        // word  91
390    U16   master_password_revision;                        // word  92
391    U16   hardware_reset_result;                           // word  93
392    U16   current_acoustic_management_value;               // word  94
393    U16   stream_min_request_size;                         // word  95
394    U16   stream_transfer_time;                            // word  96
395    U16   stream_access_latency;                           // word  97
396    U16   stream_performance_granularity[2];               // words 98-99
397    U8    max_48bit_lba[ATA_IDENTIFY_48_LBA_LEN];          // words 100-103
398    U16   streaming_transfer_time;                         // word  104
399    U16   max_lba_range_entry_blocks;                      // word  105
400    U16   physical_logical_sector_info;                    // word  106
401    U16   acoustic_test_interseek_delay;                   // word  107
402    U8    world_wide_name[ATA_IDENTIFY_WWN_LEN];           // words 108-111
403    U8    reserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN];// words 112-115
404    U16   reserved4;                                       // word  116
405    U8    words_per_logical_sector[4];                     // words 117-118
406    U16   command_set_supported2;                          // word  119
407    U16   reserved5[7];                                    // words 120-126
408    U16   removable_media_status;                          // word  127
409    U16   security_status;                                 // word  128
410    U16   vendor_specific1[31];                            // words 129-159
411    U16   cfa_power_mode1;                                 // word  160
412    U16   reserved_for_compact_flash2[7];                  // words 161-167
413    U16   device_nominal_form_factor;                      // word  168
414    U16   data_set_management;                             // word  169
415    U16   reserved_for_compact_flash3[6];                  // words 170-175
416    U16   current_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN];//words 176-205
417    U16   reserved6[3];                                    // words 206-208
418    U16   logical_sector_alignment;                        // words 209
419    U16   reserved7[7];                                    // words 210-216
420    U16   nominal_media_rotation_rate;                     // word  217
421    U16   reserved8[16];                                   // words 218-233
422    U16   min_num_blocks_per_microcode;                    // word  234
423    U16   max_num_blocks_per_microcode;                    // word  235
424    U16   reserved9[19];                                   // words 236-254
425    U16   integrity_word;                                  // word  255
426 
427 } ATA_IDENTIFY_DEVICE_DATA_T;
428 
429 #define ATA_IDENTIFY_DEVICE_GET_OFFSET(field_name) \
430    ((POINTER_UINT)&(((ATA_IDENTIFY_DEVICE_DATA_T*)0)->field_name))
431 #define ATA_IDENTIFY_DEVICE_WCE_ENABLE  0x20
432 #define ATA_IDENTIFY_DEVICE_RA_ENABLE   0x40
433 
434 /**
435  * @struct ATAPI_IDENTIFY_PACKET_DATA
436  *
437  * @brief The following structure depicts the ATA-ATAPI 7 version of the
438  *        IDENTIFY PACKET DEVICE data structure.
439  */
440 typedef struct ATAPI_IDENTIFY_PACKET_DEVICE
441 {
442    U16   generalConfigBits;                      // word  00
443    U16   reserved0;                              // word  01 (num cylinders)
444    U16   uniqueConfigBits;                       // word  02
445    U16   reserved1[7];                           // words 03 - 09
446    U8    serialNumber[ATA_IDENTIFY_SERIAL_NUMBER_LEN];  // word 10-19
447    U16   reserved2[3];                           // words 20-22
448    U8    firmwareRevision[ATA_IDENTIFY_FW_REVISION_LEN];// words 23-26
449    U8    modelNumber[ATA_IDENTIFY_MODEL_NUMBER_LEN];    // words 27-46
450    U16   reserved4[2];                           // words 47-48
451    U16   capabilities1;                          // word  49
452    U16   capabilities2;                          // word  50
453    U16   obsolete0[2];                           // words 51-52
454    U16   validityBits;                           // word  53
455    U16   reserved[8];                            // words 54-61
456 
457    U16   DMADIRBitRequired;                      // word  62, page2
458    U16   multiWordDmaMode;                       // word  63
459    U16   pioModesSupported;                      // word  64
460    U16   minMultiwordDmaTransferCycle;           // word  65
461    U16   recMinMultiwordDmaTransferCycle;        // word  66
462    U16   minPioTransferNoFlowCtrl;               // word  67
463    U16   minPioTransferWithFlowCtrl;             // word  68
464    U16   reserved6[2];                           // words 69-70
465    U16   nsFromPACKETReceiptToBusRelease;        // word  71
466    U16   nsFromSERVICEReceiptToBSYreset;         // wore  72
467    U16   reserved7[2];                           // words 73-74
468    U16   queueDepth;                             // word  75
469    U16   serialAtaCapabilities;                  // word  76
470    U16   serialAtaReserved;                      // word  77
471    U16   serialAtaFeaturesSupported;             // word  78
472    U16   serialAtaFeaturesEnabled;               // word  79
473 
474    U16   majorVersionNumber;                     // word  80, page3
475    U16   minorVersionNumber;                     // word  81
476    U16   commandSetSupported0;                   // word  82
477    U16   commandSetSupported1;                   // word  83
478 
479    U16   commandSetSupportedExtention;           // word  84, page4
480    U16   commandSetEnabled0;                     // word  85
481    U16   commandSetEnabled1;                     // word  86
482    U16   commandSetDefault;                      // word  87
483 
484    U16   ultraDmaMode;                           // word  88, page5
485    U16   reserved8[4];                           // words 89 - 92
486 
487    U16   hardwareResetResult;                    // word  93, page6
488    U16   currentAcousticManagementValue;         // word  94
489    U16   reserved9[30];                          // words 95-124
490    U16   ATAPIByteCount0Behavior;                // word  125
491    U16   obsolete1;                              // word  126
492    U16   removableMediaStatus;                   // word  127,
493 
494    U16   securityStatus;                         // word  128, page7
495    U16   vendorSpecific1[31];                    // words 129-159
496    U16   reservedForCompactFlash[16];            // words 160-175
497    U16   reserved10[79];                         // words 176-254
498    U16   integrityWord;                          // word  255
499 } ATAPI_IDENTIFY_PACKET_DEVICE_T;
500 
501 /**
502 * @struct ATA_EXTENDED_SMART_SELF_TEST_LOG
503 *
504 * @brief The following structure depicts the ATA-8 version of the
505 *        Extended SMART self test log page descriptor entry.
506 */
507 typedef union ATA_DESCRIPTOR_ENTRY
508 {
509       struct DESCRIPTOR_ENTRY
510       {
511          U8 lba_field;
512          U8 status_byte;
513          U8 time_stamp_low;
514          U8 time_stamp_high;
515          U8 checkpoint_byte;
516          U8 failing_lba_low;
517          U8 failing_lba_mid;
518          U8 failing_lba_high;
519          U8 failing_lba_low_ext;
520          U8 failing_lba_mid_ext;
521          U8 failing_lba_high_ext;
522 
523          U8 vendor_specific1;
524          U8 vendor_specific2;
525          U8 vendor_specific3;
526          U8 vendor_specific4;
527          U8 vendor_specific5;
528          U8 vendor_specific6;
529          U8 vendor_specific7;
530          U8 vendor_specific8;
531          U8 vendor_specific9;
532          U8 vendor_specific10;
533          U8 vendor_specific11;
534          U8 vendor_specific12;
535          U8 vendor_specific13;
536          U8 vendor_specific14;
537          U8 vendor_specific15;
538       } DESCRIPTOR_ENTRY;
539 
540       U8 descriptor_entry[26];
541 
542 } ATA_DESCRIPTOR_ENTRY_T;
543 
544 /**
545 * @struct ATA_EXTENDED_SMART_SELF_TEST_LOG
546 *
547 * @brief The following structure depicts the ATA-8 version of the
548 *        SMART self test log page descriptor entry.
549 */
550 typedef union ATA_SMART_DESCRIPTOR_ENTRY
551 {
552       struct SMART_DESCRIPTOR_ENTRY
553       {
554          U8 lba_field;
555          U8 status_byte;
556          U8 time_stamp_low;
557          U8 time_stamp_high;
558          U8 checkpoint_byte;
559          U8 failing_lba_low;
560          U8 failing_lba_mid;
561          U8 failing_lba_high;
562          U8 failing_lba_low_ext;
563 
564          U8 vendor_specific1;
565          U8 vendor_specific2;
566          U8 vendor_specific3;
567          U8 vendor_specific4;
568          U8 vendor_specific5;
569          U8 vendor_specific6;
570          U8 vendor_specific7;
571          U8 vendor_specific8;
572          U8 vendor_specific9;
573          U8 vendor_specific10;
574          U8 vendor_specific11;
575          U8 vendor_specific12;
576          U8 vendor_specific13;
577          U8 vendor_specific14;
578          U8 vendor_specific15;
579       } SMART_DESCRIPTOR_ENTRY;
580 
581       U8 smart_descriptor_entry[24];
582 
583 } ATA_SMART_DESCRIPTOR_ENTRY_T;
584 
585 /**
586 * @struct ATA_EXTENDED_SMART_SELF_TEST_LOG
587 *
588 * @brief The following structure depicts the ATA-8 version of the
589 *        Extended SMART self test log page.
590 */
591 typedef struct ATA_EXTENDED_SMART_SELF_TEST_LOG
592 {
593    U8    self_test_log_data_structure_revision_number;   //byte 0
594    U8    reserved0;                                      //byte 1
595    U8    self_test_descriptor_index[2];                  //byte 2-3
596 
597    ATA_DESCRIPTOR_ENTRY_T descriptor_entrys[19];         //bytes 4-497
598 
599    U8    vendor_specific[2];                             //byte 498-499
600    U8    reserved1[11];                                  //byte 500-510
601    U8    data_structure_checksum;                        //byte 511
602 
603 } ATA_EXTENDED_SMART_SELF_TEST_LOG_T;
604 
605 /**
606 * @struct ATA_EXTENDED_SMART_SELF_TEST_LOG
607 *
608 * @brief The following structure depicts the ATA-8 version of the
609 *        SMART self test log page.
610 */
611 typedef struct ATA_SMART_SELF_TEST_LOG
612 {
613    U8    self_test_log_data_structure_revision_number[2];   //bytes 0-1
614 
615    ATA_SMART_DESCRIPTOR_ENTRY_T descriptor_entrys[21];      //bytes 2-505
616 
617    U8    vendor_specific[2];                                //byte 506-507
618    U8    self_test_index;                                   //byte 508
619    U8    reserved1[2];                                      //byte 509-510
620    U8    data_structure_checksum;                           //byte 511
621 
622 } ATA_SMART_SELF_TEST_LOG_T;
623 
624 /**
625 * @struct ATA_NCQ_COMMAND_ERROR_LOG
626 *
627 * @brief The following structure depicts the ATA-8 version of the
628 *        NCQ command error log page.
629 */
630 typedef struct ATA_NCQ_COMMAND_ERROR_LOG
631 {
632    U8    ncq_tag   : 5;
633    U8    reserved1 : 2;
634    U8    nq        : 1;
635    U8    reserved2;
636    U8    status;
637    U8    error;
638    U8    lba_7_0;
639    U8    lba_15_8;
640    U8    lba_23_16;
641    U8    device;
642    U8    lba_31_24;
643    U8    lba_39_32;
644    U8    lba_47_40;
645    U8    reserved3;
646    U8    count_7_0;
647    U8    count_15_8;
648    U8    reserved4[242];
649    U8    vendor_specific[255];
650    U8    checksum;
651 } ATA_NCQ_COMMAND_ERROR_LOG_T;
652 
653 #endif // _ATA_H_
654 
655