pci_iomap_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

Okay so this page is pci_iomap_range, and it lives in the Kernel API Manual. Its whole thing? Creating a virtual mapping cookie for a PCI BAR. Iconic behavior, honestly. πŸ’…


✨ SYNOPSIS ✨

void __iomem * pci_iomap_range (struct pci_dev *dev , int bar , unsigned long offset , unsigned long maxlen );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the PCI device that owns the BAR. Like, whose BAR is this? This one. 🫢
  • bar β€” the BAR number. Just the number, bestie.
  • offset β€” map memory at the given offset in the BAR. So you're not starting at the very beginning unless you say so.
  • maxlen β€” max length of the memory to map. The limit, the cap, the "don't get carried away" number. ✨

πŸ’– DESCRIPTION πŸ’–

Using this function, you get a __iomem address to your device BAR. That's the prize. 🎁

You can access it using ioread*() and iowrite*(). These functions hide the details if this is a MMIO or PIO address space, and they will just do what you expect from them in the correct way. No cap, they really do handle the vibe check for you. πŸ”₯

maxlen specifies the maximum length to map. If you want to get access to the complete BAR from offset to the end, pass 0 here. That's the little shortcut, iykyk. πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/pci/iomap.c:


πŸ’œ That's the page, bestie. Cute little footer crumbs: source/version is ./drivers/pci, dated October 2026, and it's all about pci_iomap_range(9). Slay. πŸŽ€
πŸ“¦ where this page comes from