PCI_FIND_NEXT_EXT_CAP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… PCI_FIND_NEXT_EXT_CAP(9) β€” like, the extended capability hunter

okay so bestie, welcome to the Kernel API Manual ✨ this one's a function-style macro situation and honestly? she's iconic. her whole job is finding a PCI extended capability for you. no cap. πŸŽ€


🌸 NAME 🌸

PCI_FIND_NEXT_EXT_CAP β€” the girl who goes and finds a PCI extended capability for you πŸ’–


✨ SYNOPSIS ✨

PCI_FIND_NEXT_EXT_CAP (read_cfg , start , cap , prev_ptr , args... );

like, that's the whole call. yes it's a macro, yes it takes varargs, yes we're living. πŸ¦‹


πŸŽ€ ARGUMENTS πŸŽ€

  • read_cfg β€” a function pointer for reading PCI config space. that's your little reader helper, she does the actual reading 🫢
  • start β€” where to begin the search. pass 0 for the very first search, like starting a fresh scroll πŸ’…
  • cap β€” the extended capability ID you're hunting for. the one. the main character πŸ‘‘
  • prev_ptr β€” pointer where we stash the position of the preceding capability. it's optional, no pressure 😌
  • args β€” extra arguments you pass along to read_cfg. hand 'em over πŸ“

πŸ”₯ DESCRIPTION πŸ”₯

so what she does is: search the extended capability list in PCI config space to find cap πŸ’–

if she finds it, she updates *prev_ptr with the position of the preceding capability β€” but only if prev_ptr != NULL, like, don't be passing garbage bestie 🫢

and the part that ate: she implements TTL protection against infinite loops using a calculated maximum search count. so no matter how cursed the config space is, she is NOT looping forever. periodt. πŸ’€βœ¨


⭐ RETURN ⭐

the position of the capability if it's found β€” otherwise 0. that's it, that's the vibe check 🌈

fr fr: 0 means not found, not "found at zero". don't get it twisted bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹

like, go read those too, iykyk πŸ“šπŸ’œ


and that's the page!! this little icon lives in ./drivers/pci and the version/date stamp says October 2026 β€” so yeah, she's from the future and she's still slaying πŸ§šβ€β™€οΈπŸ’– mwah, ily, go find those capabilities βœ¨πŸŽ€

πŸ“¦ where this page comes from