pcim_iomap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pcim_iomap(9) β€” like, the managed iomap one

okay bestie, welcome to the Kernel API Manual entry for pcim_iomap, aka the function that maps a PCI BAR for you and then quietly cleans up after itself like the responsible main character it is πŸŽ€


✨ NAME ✨

pcim_iomap β€” the managed version of pcim_iomap(), no cap πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

void __iomem * pcim_iomap (struct pci_dev *pdev , int bar , unsigned
       long maxlen );

🌸 ARGUMENTS 🌸

  • pdev β€” the PCI device you're iomapping for, your little guy 🫢
  • bar β€” which BAR you wanna iomap, pick one bestie
  • maxlen β€” the maximum length of the iomap, aka how much you're asking for

⭐ RETURN ⭐

you get a __iomem pointer on success, and NULL on failure. that's it, that's the deal ✨


πŸ’œ DESCRIPTION πŸ’œ

so this is the managed pci_iomap. the map gets automatically unmapped on driver detach β€” the kernel handles the cleanup for you, obsessed 😭

but like, if you really want to unmap it manually? you can, but only with pcim_iounmap. literally only that one, iykyk πŸ’…

also this SHOULD only be used once per BAR. once. per BAR. don't be weird about it πŸ™ˆ


πŸŽ€ NOTE πŸŽ€

okay this is important so listen up πŸ”₯ contrary to all the other pcim_* functions, this one does NOT return an IOMEM_ERR_PTR on failure β€” it returns a simple NULL instead. and why? for backwards compatibility, bestie. that's the whole reason. periodt πŸ’€


🌈 SEE ALSO 🌈

kernel file ./drivers/pci/devres.c plus all these iconic neighbors:

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_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), pcim_iomap_range(9) πŸ¦‹


and that's the whole page, bestie! this one lives in ./drivers/pci and it's dated October 2026 β€” go forth and map responsibly, mwah πŸ’‹πŸ‘‘

πŸ“¦ where this page comes from