[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

d_map_page Kernel Service

Purpose

Performs platform-specific DMA mapping for a single page.

Syntax

#include <sys/dma.h>
#include <sys/xmem.h>
   
int d_map_page(*handle, flags, baddr, *busaddr, *xmp)
struct d_handle *handle;
int flags;
caddr_t baddr;
uint *busaddr;
struct xmem *xmp;
Note: The following is the interface definition for d_map_page when the DMA_ADDRESS_64 and DMA_ENABLE_64 flags are set on the d_map_init call.
int d_map_page(*handle, flags, baddr, *busaddr, *xmp)
struct d_handle *handle;
int flags;
unsigned long long baddr;
unsigned long long *busaddr;
struct xmem *xmp;

Parameters

handle Indicates the unique handle returned by the d_map_init kernel service.
flags Specifies one of the following flags:
DMA_READ Transfers from a device to memory.
BUS_DMA Transfers from one device to another device.
DMA_BYPASS Do not check page access.
baddr Specifies the buffer address.
busaddr Points to the busaddr field.
xmp Cross-memory descriptor for the buffer.

Description

The d_map_page kernel service is a bus-specific utility routine determined by the d_map_init kernel service that performs platform specific mapping of a single 4KB or less transfer for DMA master devices. The d_map_page kernel service is a fast-path version of the d_map_list service. The entire transfer amount must fit within a single page in order to use this service. This service accepts a virtual address and completes the appropriate bus address for the device to use in the DMA transfer. Unless the DMA_BYPASS flag is set, this service also verifies access permissions to the page.

If the buffer is a global kernel space buffer, the cross-memory descriptor can be set to point to the exported GLOBAL cross-memory descriptor, xmem_global.

If the transfer is unable to be mapped due to resource restrictions, the d_map_page service returns DMA_NORES. If the transfer is unable to be mapped due to page access violations, this service returns DMA_NOACC.

Note: You can use the D_MAP_PAGE macro provided in the /usr/include/sys/dma.h file to code calls to the d_map_page kernel service.

Return Values

DMA_NORES Indicates that resources are unavailable.
Note: d_map_page no mapping is done, device driver must wait until resources are freed and attempt the d_map_page call again.
DMA_NOACC Indicates no access permission to the page.
Note: d_map_page no mapping is done, device driver must fail the corresponding I/O request.
DMA_SUCC Indicates that the busaddr parameter contains the bus address to use for the device transfer.
Note: d_map_page successful mapping was done, device driver must call d_unmap_page when I/O is complete, or when device driver is finished with the mapped area in the case of a long-term mapping.

Implementation Specifics

The d_map_page kernel service is part of the base device package of your platform.

Related Information

The d_map_init kernel service, d_map_list kernel service.


[ Previous | Next | Contents | Home | Search ]