__pci_read_base(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __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:

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