Quick Reference

This chapter introduced the following symbols related to memory handling. The list doesn’t include the symbols introduced in the first section, as that section is a huge list in itself and those symbols are rarely useful to device drivers.

#include <linux/mm.h>

All the functions and structures related to memory management are prototyped and defined in this header.

int remap_page_range(unsigned long virt_add, ,                      unsigned long phys_add, ,                      unsigned long size, ,                      pgprot_t prot);

This function sits at the heart of mmap. It maps size bytes of physical addresses, starting at phys_addr, to the virtual address virt_add. The protection bits associated with the virtual space are specified in prot.

#include <asm/io.h> , unsigned long virt_to_bus(volatile void * address); , void * bus_to_virt(unsigned long address); , unsigned long virt_to_phys(volatile void * address); , void * phys_to_virt(unsigned long address);

These functions convert between virtual and physical addresses. Bus addresses must be used to talk to peripheral devices, phys addresses to talk to MMU circuits.

/proc/dma

This file contains a textual snapshot of the allocated channels in the DMA controllers. PCI-based DMA is not shown, as each board works independently, without the need to allocate a channel in the DMA controller.

#include <asm/dma.h>

This header defines or prototypes all the functions and macros related to DMA. It must be included ...

Get Linux Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.