__pci_read_base(9)
π
__pci_read_base β read a PCI BAR, bestie
okay so this is a page from the Kernel API Manual (the 9 section, kernel internals zone β¨) and it's all about __pci_read_base. it's short, it's sweet, and it's literally the little guy that goes and reads a PCI BAR for you. let's get into it π«Ά
πΈ NAME πΈ
__pci_read_base β Read a PCI BAR π
like. that's the whole job. read the BAR. iconic behaviour honestly π
β¨ SYNOPSIS β¨
int __pci_read_base (struct pci_dev *dev , enum pci_bar_type type ,
struct resource *res , unsigned int pos , u32 *sizes );
yes she takes five arguments, yes she returns an int, no we are not scared of her π
π ARGUMENTS π
devβ the PCI device. the main character of this whole situation π¦typeβ type of the BAR. gotta know what flavour we're dealing with πresβ resource buffer to be filled in. she gets filled in, that's her whole arc β¨posβ BAR position in the config space. the address of where the magic happens πsizesβ array of one or more pre-read BAR masks. plural! array! no cap π
π DESCRIPTION π
Returns 1 if the BAR is 64-bit, or 0 if 32-bit.
that's it. that's the description. one line and she ATE π₯ like honestly the whole function is a vibe check on how wide your BAR is and then it tells you with a 1 or a 0, bestie. maths is mathing π
ngl the manpage really just says this and dips. short queen energy π
π SEE ALSO π
the kernel file ./drivers/pci/probe.c is where all this lives, and these are the siblings/friends-of-the-family you should also go look at:
__pci_size_bars(9)pcie_get_link_speed(9)pci_ea_fixed_busnrs(9)pci_ext_cfg_is_aliased(9)pci_cfg_space_size_ext(9)pci_intx_mask_broken(9)pci_setup_device(9)pcie_relaxed_ordering_enabled(9)pci_release_dev(9)pci_scan_slot(9)pci_scan_child_bus_extend(9)pci_scan_child_bus(9)pcibios_root_bridge_prepare(9)pci_rescan_bus_bridge_resize(9)pci_rescan_bus(9)
that's a whole friend group and every single one of them is invited to the group chat π β¨
and that's the page!! this one came out of ./drivers/pci with a date stamp of October 2026, filed under __pci_read_base(9) in the Kernel API Manual. go read a BAR, bestie, you've got this π«Άππ
π¦ 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