00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _ATA_INFO_H
00010 #define _ATA_INFO_H
00011
00012 #include <lendian_bitfield.h>
00013 #include <Drivers.h>
00014
00015
00016
00017
00018
00019
00020
00021 enum {
00022 B_ATA_GET_DEVICE_INFO = B_DEVICE_OP_CODES_END + 1,
00023 B_ATA_GET_DEVICE_STATUS
00024 };
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 typedef struct tagdevice_infoblock {
00038 union {
00039 struct {
00040 LBITFIELD8 (
00041 _0_res1 : 1,
00042 _0_ret1 : 1,
00043 response_incomplete : 1,
00044 _0_ret2 : 3,
00045 removable_controller_or_media : 1,
00046 removable_media : 1,
00047 _0_ret3 : 7,
00048 ATA : 1
00049 );
00050 } ata;
00051 struct {
00052 LBITFIELD8 (
00053 packet_size : 2,
00054 response_incomplete : 1,
00055 _0_res2 : 2,
00056 drq_speed : 2,
00057 removable_media : 1,
00058 type : 5,
00059 _0_res13 : 1,
00060 ATAPI : 2
00061 );
00062 } atapi;
00063 } _0;
00064 uint16 cylinders;
00065 uint16 dummy1;
00066 uint16 heads;
00067 uint16 dummy2[2];
00068 uint16 sectors;
00069 uint16 dummy3[3];
00070 char serial_number[20];
00071 uint16 dummy4[3];
00072 char firmware_version[8];
00073 char model_number[40];
00074 uint16 dummy5[2];
00075 LBITFIELD5 (
00076 _49_ret1 : 8,
00077 DMA_supported : 1,
00078 LBA_supported : 1,
00079 IORDY_can_disable : 1,
00080 IORDY_supported : 1
00081 );
00082
00083 uint16 dummy6[1];
00084 LBITFIELD2 (
00085 _51_obs1 : 8,
00086 PIO_mode : 8
00087 );
00088 uint16 dummy7[1];
00089
00090
00091 LBITFIELD3 (
00092 _54_58_valid : 1,
00093 _64_70_valid : 1,
00094 _88_valid : 1
00095 );
00096 uint16 current_cylinders;
00097 uint16 current_heads;
00098 uint16 current_sectors;
00099
00100 uint16 capacity_low;
00101 uint16 capacity_high;
00102
00103 uint16 dummy8[1];
00104
00105 uint32 LBA_total_sectors;
00106 uint16 dummy9[1];
00107
00108 LBITFIELD7 (
00109 MDMA0_supported : 1,
00110 MDMA1_supported : 1,
00111 MDMA2_supported : 1,
00112 _63_res1 : 5,
00113 MDMA0_selected : 1,
00114 MDMA1_selected : 1,
00115 MDMA2_selected : 1
00116 );
00117 uint16 dummy10[11];
00118
00119 LBITFIELD2 (
00120 queue_depth : 5,
00121 _75_res1 : 9
00122 );
00123 uint16 dummy11[6];
00124
00125 LBITFIELD16 (
00126 SMART_supported : 1,
00127 security_mode_supported : 1,
00128 removable_media_supported : 1,
00129 PM_supported : 1,
00130 _82_fixed : 1,
00131 write_cache_supported : 1,
00132 look_ahead_supported : 1,
00133 RELEASE_irq_supported : 1,
00134
00135 SERVICE_irq_supported : 1,
00136 DEVICE_RESET_supported : 1,
00137 HPA_supported : 1,
00138 _82_obs1 : 1,
00139 WRITE_BUFFER_supported : 1,
00140 READ_BUFFER_supported : 1,
00141 NOP_supported : 1,
00142 _82_obs2 : 1
00143 );
00144 LBITFIELD15 (
00145 DOWNLOAD_MICROCODE_supported : 1,
00146 DMA_QUEUED_supported : 1,
00147 CFA_supported : 1,
00148 APM_supported : 1,
00149 RMSN_supported : 1,
00150 power_up_in_stand_by_supported : 1,
00151 SET_FEATURES_on_power_up_required : 1,
00152 reserved_boot_area_supported : 1,
00153 SET_MAX_security_supported : 1,
00154 auto_acustic_managemene_supported : 1,
00155 _48_bit_addresses_supported : 1,
00156 device_conf_overlay_supported : 1,
00157 FLUSH_CACHE_supported : 1,
00158 FLUSH_CACHE_EXT_supported : 1,
00159 _83_fixed : 2
00160 );
00161
00162 uint16 dummy12[4];
00163 LBITFIELD15 (
00164 UDMA0_supported : 1,
00165 UDMA1_supported : 1,
00166 UDMA2_supported : 1,
00167 UDMA3_supported : 1,
00168 UDMA4_supported : 1,
00169 UDMA5_supported : 1,
00170 UDMA6_supported : 1,
00171 _88_res1 : 1,
00172 UDMA0_selected : 1,
00173 UDMA1_selected : 1,
00174 UDMA2_selected : 1,
00175 UDMA3_selected : 1,
00176 UDMA4_selected : 1,
00177 UDMA5_selected : 1,
00178 UDMA6_selected : 1
00179 );
00180
00181 uint16 dummy89[11];
00182 uint64 LBA48_total_sectors;
00183 uint16 dummy102[22];
00184
00185 LBITFIELD2 (
00186 last_lun : 2,
00187 _126_res2 : 14
00188 );
00189 LBITFIELD4 (
00190 _127_RMSN_support : 2,
00191 _127_res2 : 6,
00192 device_write_protect: 2,
00193 _127_res9 : 6
00194 );
00195 uint16 dummy14[128];
00196 } ata_device_infoblock;
00197
00198
00199
00200
00201
00202 enum {
00203 B_ATA_DMA_STATUS_UNSUPPORTED,
00204 B_ATA_DMA_STATUS_ENABLED,
00205 B_ATA_DMA_STATUS_DISABLED_USER,
00206 B_ATA_DMA_STATUS_DISABLED_SAFE_MODE,
00207 B_ATA_DMA_STATUS_UNSUPPORTED_CONTROLLER,
00208 B_ATA_DMA_STATUS_DISABLED_DRIVER_CONFIG,
00209 B_ATA_DMA_STATUS_DISABLED_DRIVER_FAILURE
00210 };
00211
00212 typedef struct tagata_device_status {
00213 uint8 version;
00214 uint8 dma_status;
00215 uint8 pio_mode;
00216 uint8 dma_mode;
00217 } _PACKED ata_device_status;
00218
00219
00220 #endif