Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Using io_remap_pfn_range

The remap_pfn_range() function discussed does not apply anymore when it comes to mapping I/O memory to user space. In this case, the appropriate function is io_remap_pfn_range(), whose parameters are the same. The only thing that changes is where the PFN comes from. Its prototype looks like:

int io_remap_page_range(struct vm_area_struct *vma, 
                        unsigned long virt_addr, 
                        unsigned long phys_addr, 
                        unsigned long size, pgprot_t prot); 

There is no need to use ioremap() when attempting to map I/O memory to user space. ioremap() is intended for kernel purposes (mapping I/O memory into the kernel address space), whereas io_remap_pfn_range is for user space purposes.

Just pass your real physical I/O address (downshifted by

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content