sata_link_debounce(9)
π sata_link_debounce(9) β like, the SATA phy status debounce thing, from the Kernel API Manual
okay bestie, so there's this little function called sata_link_debounce and honestly? it's giving "quietly keeping your SATA link from having a whole meltdown." let's get into it π«Ά
β¨ NAME β¨
sata_link_debounce β debounce SATA phy status. that's it, that's the vibe π
π¦ SYNOPSIS π¦
int sata_link_debounce (struct ata_link *link , const unsigned int
*params , unsigned long deadline );
π ARGUMENTS π
linkβ the ATA link you're debouncing the SATA phy status for. main character of this whole operation tbh.paramsβ the timing parameters, and they come in a little trio:{ interval, duration, timeout }, all in msec. like the holy trinity but make it milliseconds βdeadlineβ the deadline in jiffies for the operation. yes, jiffies. no, i will not explain that here, go read another manpage π
πΈ DESCRIPTION πΈ
so like, the whole goal here is to make sure the SStatus of link actually reaches a stable state. and how do we know it's stable? by holding the same value where DET is not 1 for duration, polling every interval, all before timeout hits. that's the vibe check β¨
and here's the tea on timeout: it constrains the beginning of the stable state. not the whole thing, just the start. periodt.
now, real talk β because DET gets stuck at 1 on some controllers after hot unplugging (iconic bug behavior, honestly π), this function just waits until timeout, then returns 0 if DET is stable at 1. so like, it's not a failure, it's just... the controller being dramatic and the function going "okay bestie, we move."
also, timeout is further limited by deadline. whichever one is sooner? that's the one we use. the earlier one wins, no cap π
LOCKING: Kernel thread context (may sleep). so like, it CAN sleep β don't you dare call it from somewhere that can't ππ€
π₯ RETURN π₯
0on success β slay π-errnoon failure β not slay π
π SEE ALSO π
Kernel file ./drivers/ata/libata-sata.c β plus this whole friend group right here:
sata_scr_valid(9)sata_scr_read(9)sata_scr_write(9)sata_scr_write_flush(9)ata_tf_to_fis(9)ata_tf_from_fis(9)sata_link_resume(9)sata_link_scr_lpm(9)sata_set_spd_needed(9)sata_set_spd(9)sata_down_spd_limit(9)sata_link_hardreset(9)sata_std_hardreset(9)ata_qc_complete_multiple(9)ata_slave_link_init(9)sata_lpm_ignore_phy_events(9)ata_ncq_prio_supported(9)ata_ncq_prio_enabled(9)ata_ncq_prio_enable(9)ata_change_queue_depth(9)ata_scsi_change_queue_depth(9)ata_sas_sdev_configure(9)ata_sas_queuecmd(9)sata_async_notification(9)ata_eh_read_log_10h(9)ata_eh_get_ncq_success_sense(9)ata_eh_analyze_ncq_error(9)
and that's a wrap, bestie π§ this whole page lives in ./drivers/ata, dated October 2026, and it landed here courtesy of the Kernel API Manual. go debounce something. responsibly. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms