d_sync_mem Kernel Service

Purpose

Allows a device driver to indicate that previously mapped buffers may need to be refreshed.

Syntax

int d_sync_mem(d_handle_t handle, dio_t blist)

Description

The d_sync_mem service allows a device driver to indicate that previously mapped buffers may need to be refreshed, either because a new DMA is about to start or a previous DMA has now completed. d_sync_mem is not an exported kernel service, but a bus-specific utility determined by d_map_init based on platform characteristics and provided to the caller through the d_handle structure. d_sync_mem allows the driver to identify additional coherency points beyond those of the initial mapping (d_map_list) and termination of the mapping (d_unmap_list). Thus d_sync_mem provides a way to long-term map buffers and still handle potential data consistency problems.

The blist parameter is a pointer to the dio structure that describes the initial mapping, as returned by d_map_list. Note that for bounce buffering, the data direction is also implicitly defined by this initial mapping.
  • If the map_list call describes a transfer from system memory to a device, subsequent d_sync_mem calls using the corresponding blist will synchronize the memory view. This assumes that the original system memory pages contain the correct data.
  • If the map_list call describes a transfer from a device to system memory, then subsequent d_sync_mem calls will synchronize the memory view. This assumes that the bounce pages the device directly accessed contained the correct data.
Note: You can use the D_SYNC_MEM macro provided in the /usr/include/sys/dma.h file to code calls to the d_sync_mem kernel service.

Parameters

Item Description
d_handle_t Indicates the unique dma handle returned by d_map_init.
dio_t blist List of vectors returned by original d_map_list.

Return Values

Item Description
DMA_SUCC Buffers described by the blist have been synchronized.
DMA_FAIL Buffers could not be synchronized.