23 #include "pedigree/kernel/compiler.h" 24 #include "pedigree/kernel/processor/IoBase.h" 25 #include "pedigree/kernel/processor/Processor.h" 26 #include "pedigree/kernel/processor/types.h" 55 uint8_t packet_sz : 2;
57 uint8_t is_removable : 1;
58 uint8_t packet_cmdset : 6;
85 char serial_number[20];
94 char firmware_revision[8];
97 char model_number[40];
101 uint8_t max_sectors_per_irq;
116 uint8_t iordy_disabled : 1;
118 uint8_t iordy_supported : 1;
122 uint8_t std_standby : 1;
137 uint8_t multiword_dma_valid : 1;
138 uint8_t ultra_dma_valid : 1;
149 uint8_t curr_sectors_per_irq : 8;
150 uint8_t is_valid : 1;
155 uint32_t sector_count;
167 uint8_t sel_mode0 : 1;
168 uint8_t sel_mode1 : 1;
169 uint8_t sel_mode2 : 1;
174 uint8_t pio_modes_supported;
178 uint16_t minimum_multiword_dma_cycle;
181 uint16_t recommended_multiword_dma_cycle;
184 uint16_t minimum_pio_cycle;
187 uint16_t minimum_pio_cycle_iordy;
196 uint8_t max_queue_depth : 5;
221 uint8_t security : 1;
222 uint8_t removable : 1;
226 uint8_t lookahead : 1;
227 uint8_t release_int : 1;
228 uint8_t service_int : 1;
229 uint8_t device_reset : 1;
230 uint8_t is_protected : 1;
232 uint8_t write_buffer : 1;
233 uint8_t read_buffer : 1;
236 }
PACKED command_set_support;
241 uint8_t microcode : 1;
242 uint8_t rw_dma_queued : 1;
244 uint8_t adv_power : 1;
245 uint8_t removable_notify : 1;
246 uint8_t powerup_standby : 1;
247 uint8_t set_features_spinup : 1;
250 uint8_t acoustic : 1;
251 uint8_t address48 : 1;
252 uint8_t config_overlay : 1;
253 uint8_t flush_cache : 1;
254 uint8_t flush_cache_ext : 1;
257 }
PACKED command_sets_support;
262 uint8_t smart_logging : 1;
263 uint8_t smart_selftest : 1;
264 uint8_t media_serial : 1;
265 uint8_t media_passthrough : 1;
266 uint8_t streaming : 1;
268 uint8_t write_mult_fua_ext : 1;
269 uint8_t write_dma_fua_ext : 1;
271 uint8_t read_dma_ext_urg : 1;
272 uint8_t write_dma_ext_urg : 1;
274 uint8_t idle_immediate : 1;
277 }
PACKED command_set_ext_support;
283 uint8_t security : 1;
284 uint8_t removable : 1;
288 uint8_t lookahead : 1;
289 uint8_t release_int : 1;
290 uint8_t service_int : 1;
291 uint8_t device_reset : 1;
292 uint8_t is_protected : 1;
294 uint8_t write_buffer : 1;
295 uint8_t read_buffer : 1;
298 }
PACKED command_set_enabled;
303 uint8_t microcode : 1;
304 uint8_t rw_dma_queued : 1;
306 uint8_t adv_power : 1;
307 uint8_t removable_notify : 1;
308 uint8_t powerup_standby : 1;
309 uint8_t set_features_spinup : 1;
312 uint8_t acoustic : 1;
313 uint8_t address48 : 1;
314 uint8_t config_overlay : 1;
315 uint8_t flush_cache : 1;
316 uint8_t flush_cache_ext : 1;
319 }
PACKED command_sets_enabled;
324 uint8_t smart_logging : 1;
325 uint8_t smart_selftest : 1;
326 uint8_t media_serial : 1;
327 uint8_t media_passthrough : 1;
328 uint8_t streaming : 1;
330 uint8_t write_mult_fua_ext : 1;
331 uint8_t write_dma_fua_ext : 1;
333 uint8_t read_dma_ext_urg : 1;
334 uint8_t write_dma_ext_urg : 1;
336 uint8_t idle_immediate : 1;
339 }
PACKED command_set_ext_default;
344 uint8_t supp_mode0 : 1;
345 uint8_t supp_mode1 : 1;
346 uint8_t supp_mode2 : 1;
347 uint8_t supp_mode3 : 1;
348 uint8_t supp_mode4 : 1;
349 uint8_t supp_mode5 : 1;
350 uint8_t supp_mode6 : 1;
352 uint8_t sel_mode0 : 1;
353 uint8_t sel_mode1 : 1;
354 uint8_t sel_mode2 : 1;
355 uint8_t sel_mode3 : 1;
356 uint8_t sel_mode4 : 1;
357 uint8_t sel_mode5 : 1;
358 uint8_t sel_mode6 : 1;
363 uint16_t secure_erase_time;
366 uint16_t enhanced_secure_erase_time;
369 uint16_t curr_adv_power;
372 uint16_t master_password_revision;
383 uint8_t diagnostics : 1;
384 uint8_t pdiag_assert : 1;
385 uint8_t dasp_assert : 1;
387 uint8_t responds_to_other : 1;
394 uint8_t d1_method : 2;
395 uint8_t d1_pdiag_assert : 1;
399 uint8_t cbild_level : 1;
405 uint8_t current_acoustic;
406 uint8_t vendor_acoustic;
409 uint16_t stream_min_size;
412 uint16_t dma_streaming_time;
415 uint16_t streaming_latency;
418 uint32_t streaming_granularity;
421 uint64_t max_user_lba48;
424 uint16_t pio_streaming_time;
433 uint8_t logical_per_physical : 4;
435 uint8_t logical_larger_than_512b : 1;
436 uint8_t multiple_logical_per_physical : 1;
442 uint16_t iso9779_delay;
462 uint32_t words_per_logical;
469 uint16_t removable_notify_support;
474 uint8_t supported : 1;
478 uint8_t count_expired : 1;
479 uint8_t ehanced_erase_support : 1;
489 uint16_t cfa_power_mode1;
495 char media_serial[60];
509 inline void ataLoadSwapped(
char *out,
char *in,
size_t N)
511 uint16_t *in16 =
reinterpret_cast<uint16_t *
>(in);
512 for (
size_t i = 0; i < N; ++i)
514 #ifdef TARGET_IS_LITTLE_ENDIAN 515 out[i * 2] = in16[i] >> 8;
516 out[(i * 2) + 1] = in16[i] & 0xFF;
518 out[i * 2] = in16[i] & 0xFF;
519 out[(i * 2) + 1] = in16[i] >> 8;
530 for (
size_t i = 0; i < 4; ++i)
536 uint8_t status = pBase->
read8(7);
545 while (status & 0x80)
548 status = pBase->
read8(7);
560 while (!(status & 0x41))
563 status = pBase->
read8(7);
581 inline void logAtaStatus(
AtaStatus &status)
588 s.append(status.
reg.err);
590 s.append(status.
reg.drq);
592 s.append(status.
reg.drdy);
594 s.append(status.
reg.bsy);
595 NOTICE(static_cast<const char *>(s));
Abstrace base class for hardware I/O capabilities.
uint8_t __reg_contents
"Hidden" integer which contains the actual register contents
virtual uint8_t read8(size_t offset=0)=0