pci_epc_get_next_free_bar(9)
β¨ pci_epc_get_next_free_bar(9) β¨
Okay bestie, so this is a page from the Kernel API Manual and honestly? It's a little baby function but it's doing main character work in the PCI endpoint world, so let's get into it π
πΈ NAME πΈ
pci_epc_get_next_free_bar β it's literally the helper that finds you the next unreserved BAR, starting from @bar π
π¦ SYNOPSIS π¦
enum pci_barno pci_epc_get_next_free_bar (const struct pci_epc_features
*epc_features , enum pci_barno bar );
That's the whole signature, no cap. It hands you back an enum pci_barno, periodt β¨
π ARGUMENTS π
epc_featuresβ thepci_epc_featuresstructure that's holding the reserved bar bitmap. Like, it's the one who actually knows which BARs are already taken πbarβ the starting BAR number, aka where the search for an unreserved BAR kicks off from. You pick the starting line, it does the looking π
π₯ DESCRIPTION π₯
So you invoke this when you wanna get the next unreserved BAR starting from bar β the one that's actually usable for an endpoint function. That's it, that's the vibe π«Ά
It's giving "personal assistant for BAR hunting" and honestly I'm obsessed.
Lowkey important: the reserved-ness comes from that bitmap sitting inside epc_features, so don't go handing it a struct that doesn't know what's reserved, bestie π
β SEE ALSO β
Peep the kernel file ./drivers/pci/endpoint/pci-epc-core.c for the full lore, and then go say hi to the whole friend group:
pci_epc_put(9), pci_epc_get(9), pci_epc_get_first_free_bar(9), pci_epc_get_features(9), pci_epc_get_aux_resources_count(9), pci_epc_get_aux_resources(9), pci_epc_stop(9), pci_epc_start(9), pci_epc_raise_irq(9), pci_epc_map_msi_irq(9), pci_epc_get_msi(9), pci_epc_set_msi(9), pci_epc_get_msix(9), pci_epc_set_msix(9), pci_epc_unmap_addr(9), pci_epc_map_addr(9), pci_epc_mem_map(9), pci_epc_mem_unmap(9), pci_epc_clear_bar(9), pci_epc_set_bar(9), pci_epc_bar_size_to_rebar_cap(9), pci_epc_write_header(9), pci_epc_add_epf(9), pci_epc_remove_epf(9), pci_epc_linkup(9), pci_epc_linkdown(9), pci_epc_init_notify(9), pci_epc_notify_pending_init(9), pci_epc_deinit_notify(9), pci_epc_bus_master_enable_notify(9), pci_epc_destroy(9), __pci_epc_create(9), __devm_pci_epc_create(9)
Like, that's the entire group chat and every single one of them is iconic in their own way π
Mwah π that's the page! It lives over in ./drivers/pci/endpoint, dated October 2026 β see you there, bestie π§ββοΈπ
π¦ 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