pciehp_card_..._link_active(9)
π pciehp_card_..._link_active(9) β Kernel API Manual π
okay bestie, so this is a page from the Linux Kernel API Manual, and it's about one very specific little helper function. it's short, it's iconic, and honestly it's doing the most for those cursed hotplug ports. let's get into it π
β¨ NAME β¨
pciehp_card_present_or_link_active β tells you whether a given slot is occupied or not, no cap π«Ά
πΈ SYNOPSIS πΈ
int pciehp_card_present_or_link_active (struct controller *ctrl );
π¦ ARGUMENTS π¦
ctrlβ the PCIe hotplug controller, aka the main character of this whole situation π
π DESCRIPTION π
so here's the teaaaa π. there's this other function, pciehp_card_present, and the way that one figures out if a card is there is by looking at the Presence Detect State bit, and only that bit. like, that's its whole personality.
but this helper? she's built different. pciehp_card_present_or_link_active also returns true if the Link Active bit is set. highkey generous of her.
and why, you ask? because some hotplug ports are lowkey broken π β they hardwire Presence Detect State to zero, so it's always like "nobody's home" even when somebody absolutely is. the page literally calls this a concession to broken hotplug ports, and gives Wilocity's [1ae9:0200] as the example of one of these messy ports. so yeah, she checks both because somebody has to π
β RETURN β
1β the slot is occupied, we love to see it π0β the slot is not occupied, nothing to see here π-ENODEVβ returned if the hotplug port is not present anymore π«
π₯ SEE ALSO π₯
Kernel file ./drivers/pci/hotplug/pciehp_hpc.c, plus her besties:
pcie_write_cmd(9)pciehp_check_link_active(9)pciehp_card_present(9)pciehp_set_indicators(9)pciehp_slot_reset(9)
and that's the whole page, bestie, you ate that π§β¨. this one lives over in ./drivers/pci/hotplug and it's dated October 2026 β so go forth, check that link, and slay π
π
π¦ 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