Writing Device Drivers

Memory Allocation and Deallocation Functions

The memory allocation and deallocation functions are:

kmem_alloc()

Allocate kernel memory

kmem_free()

Free kernel memory

kmem_zalloc()

Allocate zero-filled kernel memory

The following functions allocate and free memory intended to be used for DMA. See Direct Memory Access (DMA) Functions.

ddi_dma_mem_alloc()

Allocate memory for DMA transfer

ddi_dma_mem_free()

Free previously allocated DMA memory

The following functions allocate and free memory intended to be exported to user space. See User Space Access Functions.

ddi_umem_alloc()

Allocate page-aligned kernel memory

ddi_umem_free()

Free page-aligned kernel memory

Table B–2 Deprecated Memory Allocation and Deallocation Functions

Deprecated Function 

Replacement 

ddi_iopb_alloc()

ddi_dma_mem_alloc()

ddi_iopb_free()

ddi_dma_mem_free()

ddi_mem_alloc()

ddi_dma_mem_alloc()

ddi_mem_free()

ddi_dma_mem_free()