pcim_iomap_range(9)
π pcim_iomap_range(9) π
okay so bestie, this is a page straight out of the Kernel API Manual β yes, the actual kernel manual, and yes, we're gonna make it make sense π«Ά
β¨ NAME β¨
pcim_iomap_range β creates a ranged __iomap mapping, like, inside a PCI BAR. that's the whole vibe π
πΈ SYNOPSIS πΈ
void __iomem * pcim_iomap_range (struct pci_dev *pdev , int bar ,
unsigned long offset , unsigned long len );
π ARGUMENTS π
pdevβ the PCI device you're mapping IO resources for. the main character, basically πbarβ the index of the BAR. just the number index, nothing deeper, don't overthink it πoffsetβ how far from the begin of the BAR you're starting. your little starting point β¨lenβ length in bytes for the mapping. how much you're taking, in bytes, no cap π
π¦ RETURN π¦
a __iomem pointer on success π β and on failure you get an IOMEM_ERR_PTR π (so like, check that bad boy, fr fr).
π DESCRIPTION π
so it creates a new IO-Mapping within the specified bar, ranging from offset to offset + len. cute, tidy, exactly what it says π―
and here's the slay part: the mapping will automatically get unmapped on driver detach β¨ like it handles its own cleanup, icon behaviour honestly.
but lowkey listen β if you desired, you can release manually, and only with pcim_iounmap. that's the one. don't get creative π
β SEE ALSO β
- the kernel file
./drivers/pci/devres.cβ that's where the lore lives π devm_pci_remap_iospace(9)devm_pci_remap_cfgspace(9)devm_pci_remap_cfg_resource(9)pcim_set_mwi(9)pcim_intx(9)pcim_enable_device(9)pcim_pin_device(9)pcim_iomap_table(9)pcim_iomap(9)pcim_iounmap(9)pcim_iomap_region(9)pcim_iounmap_region(9)pcim_iomap_regions(9)pcim_request_region(9)pcim_release_region(9)pcim_release_all_regions(9)pcim_request_all_regions(9)
like, the whole friend group, iykyk π
and that's the page!! brought to you by ./drivers/pci, dated October 2026 πΈπ¦ β mwah, go map responsibly, 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