[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

d_alloc_dmamem Kernel Service

Purpose

Allocates an area of "dma-able" memory.

Syntax

void * 
 d_alloc_dmamem(d_handle_t  device_handle, size_t size,int align)

Description

Exported, documented kernel service supported on PCI-based systems only. The d_alloc_dmamem kernel service allocates an area of "dma-able" memory which satisfies the constraints associated with a DMA handle, specified via the device_handle parameter. The constraints (such as need for contiguous physical pages or need for 32-bit physical address) are intended to guarantee that a given adapter will be able to access the physical pages associated with the allocated memory. A driver associates such constraints with a dma handle via the flags parameter on its d_map_init call.

The area to be allocated is the number of bytes in length specified by the size parameter, and is aligned on the byte boundary specified by the align parameter. The align parameter is actually the log base 2 of the desired address boundary. For example, an align value of 12 requests that the allocated area be aligned on a 4096 byte boundary.

d_alloc_dmamem is appropriate to be used for long-term mappings. Depending on the system configuration and the constraints encoded in the device_handle, the underlying storage will come from either the real_heap (rmalloc service) or pinned_heap (xmalloc service).

Notes:
  1. The d_free_dmamem service should be called to free allocation from a previous d_alloc_dmamem call.
  2. The d_alloc_dmamem kernel service can be called from the process environment only.

Parameters

device_handle Indicates the dma handle.
align Specifies alignment characteristics.
size_t size Specifies number of bytes to allocate.

Return Values

Address of allocated area Indicates that d_alloc_dmamem was successful.
NULL Requested memory could not be allocated.

Related Information

The d_free_dmamem kernel service, d_map_init kernel service, rmalloc kernel service, xmalloc kernel service.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]