Index Index for
Section 9
Index Alphabetical
listing for D
Bottom of page Bottom of
page

dma_kmap_buffer(9r)

NAME

dma_kmap_buffer - General: Returns a kernel segment (kseg) address of a DMA buffer

SYNOPSIS

#include <io/common/devdriver.h> vm_offset_t dma_kmap_buffer( dma_handle_t dma_handle, u_long offset );

ARGUMENTS

dma_handle Specifies a handle to DMA resources associated with the mapping of an in-memory I/O buffer onto a controller's I/O bus. This handle provides the information to access bus address/byte count pairs. A bus address/byte count pair is represented by the ba and bc members of an sg_entry structure pointer. Device driver writers can view the DMA handle as the tag to the allocated system resources needed to perform a DMA operation. offset Specifies a byte count offset from the virtual address passed as the virt_addr argument of the dma_map_load interface. This virtual address specifies the beginning of a process's (or kernel) buffer that a DMA transfer operation is done to or from. A device driver determines the smallest DMA transfer size by calling the dma_min_boundary interface. The offset specifies the number of bytes a DMA engine moved. This number is less than the number of bytes the dma_map_load interface loaded.

DESCRIPTION

The dma_kmap_buffer interface takes an offset variable and returns a kseg address. The device driver can use this kseg address to copy and save the data at the offset in the buffer. A device driver calls dma_kmap_buffer when the following occurs: · A DMA device on a CPU or bus interrupts a transfer before the full transfer has completed · The value returned by dma_min_boundary is greater than 1 · The transfer is interrupted within the region of the value returned by dma_min_boundary. For example, a SCSI device performs a disconnect in the second byte of a longword on a TURBOchannel-based SCSI subsystem. The device driver uses the kseg address to read the valid data transferred so far, saves it in a dma_min_boundary sized buffer, and merges it back into the DMA buffer once the rest of the transfer has completed.

EXAMPLE

See Writing Device Drivers: Tutorial for a code example of the dma_kmap_buffer interface.

RETURN VALUES

Upon successful completion, dma_kmap_buffer returns a kseg address of the byte offset pointed to by the addition of the following two values: virt_addr + offset where: · virt_addr is the virtual address passed to the virt_addr argument of dma_map_load · offset is the offset passed to the offset argument of dma_kmap_buffer The dma_kmap_buffer interface returns the value zero (0) to indicate failure to retrieve the kseg address.

SEE ALSO

Kernel Interfaces: dma_map_load(9r), dma_min_boundary(9r) Data Structures: sg_entry(9s)

Index Index for
Section 9
Index Alphabetical
listing for D
Top of page Top of
page