ata_timing_cycle2mode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ata_timing_cycle2mode

okay so bestie, we're in the Kernel API Manual today and this little function is literally the matchmaker of the ATA world πŸ’– you hand it a cycle duration and it finds you the xfer mode that goes with it. no cap, that's the whole job.


✨ SYNOPSIS ✨

u8 ata_timing_cycle2mode (unsigned int xfer_shift , int cycle );

πŸŽ€ ARGUMENTS πŸŽ€

  • xfer_shift β€” an ATA_SHIFT_* value, aka which transfer type you're asking about πŸ‘€ like, tell it what flavor of transfer you want examined.
  • cycle β€” the cycle duration, in ns ⏱️

πŸ¦‹ DESCRIPTION πŸ¦‹

So it returns the matching xfer mode for cycle, and the mode it gives you back is of the transfer type specified by xfer_shift. iconic behavior honestly.

Two little plot twists though:

  • if cycle is too slow for xfer_shift, you get 0xff back πŸ™ˆ
  • if cycle is faster than the fastest known mode, you get the fastest mode. (yes, the original page says "fasted mode" β€” we love a typo moment, but the meaning is fastest, periodt) ⚑
LOCKING: None. literally none. no locks, no drama, it's giving very low-maintenance 🫢

πŸ‘‘ RETURN πŸ‘‘

Matching xfer_mode, or 0xff if no match found. that's it, that's the return πŸ’€


🌈 SEE ALSO 🌈

the main character file is ./drivers/ata/libata-core.c, and then there's this absolute friend group of related functions β€” all of them, no skips, no cap:

ata_link_next(9), ata_dev_next(9), ata_dev_phys_link(9), ata_force_cbl(9),
ata_force_pflags(9), ata_force_link_limits(9), ata_force_xfermask(9),
ata_force_quirks(9), atapi_cmd_type(9), ata_set_rwcmd_protocol(9),
ata_tf_read_block(9), ata_build_rw_tf(9), ata_pack_xfermask(9),
ata_unpack_xfermask(9), ata_xfer_mask2mode(9), ata_xfer_mode2mask(9),
ata_xfer_mode2shift(9), ata_mode_string(9), ata_dev_classify(9),
ata_id_string(9), ata_id_c_string(9), ata_read_native_max_address(9),
ata_set_max_sectors(9), ata_hpa_resize(9), ata_dump_id(9),
ata_id_xfermask(9), ata_exec_internal(9), ata_pio_need_iordy(9),
ata_pio_mask_no_iordy(9), ata_do_dev_read_id(9), ata_dev_read_id(9),
ata_dev_power_set_standby(9), ata_dev_power_set_active(9),
ata_read_log_page(9), ata_dev_configure(9), ata_cable_40wire(9),
ata_cable_80wire(9), ata_cable_unknown(9), ata_cable_ignore(9),
ata_cable_sata(9), sata_print_link_status(9), ata_dev_pair(9),
ata_down_xfermask_limit(9), ata_set_mode(9), ata_wait_ready(9),
ata_wait_after_reset(9), ata_std_prereset(9), ata_std_postreset(9),
ata_dev_same_device(9), ata_dev_reread_id(9), ata_dev_revalidate(9),
ata_is_40wire(9), cable_is_40wire(9), ata_dev_xfermask(9),
ata_dev_set_xfermode(9), ata_dev_set_feature(9), ata_dev_init_params(9),
atapi_check_dma(9), ata_std_qc_defer(9), ata_sg_init(9),
ata_sg_clean(9), ata_sg_setup(9), swap_buf_le16(9), ata_qc_free(9),
ata_qc_complete(9), ata_qc_get_active(9), ata_qc_issue(9),
ata_phys_link_online(9), ata_phys_link_offline(9), ata_link_online(9),
ata_link_offline(9), ata_host_suspend(9), ata_host_resume(9),
ata_dev_init(9), ata_link_init(9), sata_link_init_spd(9),
ata_port_alloc(9), ata_host_alloc(9), ata_host_alloc_pinfo(9),
ata_finalize_port_ops(9), ata_host_start(9), ata_host_init(9),
ata_host_register(9), ata_host_activate(9), ata_dev_free_resources(9),
ata_port_detach(9), ata_host_detach(9), ata_pci_remove_one(9),
ata_platform_remove_one(9), ata_msleep(9), ata_wait_register(9)

🌸 okay that's the whole page, bestie. this one came out of ./drivers/ata and it's dated October 2026 β€” so go forth, match those cycle durations to their xfer modes, and slay πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from