diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:15 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:15 -0500 |
commit | 59b5ec21446b9239d706ab237fb261d525b75e81 (patch) | |
tree | a437a354e84d311104829ca0e8b00b0ec8cb05c4 /include/linux/dmaengine.h | |
parent | f67b45999205164958de4ec0658d51fa4bee066d (diff) |
dmaengine: introduce dma_request_channel and private channels
This interface is primarily for device-to-memory clients which need to
search for dma channels with platform-specific characteristics. The
prototype is:
struct dma_chan *dma_request_channel(dma_cap_mask_t mask,
dma_filter_fn filter_fn,
void *filter_param);
When the optional 'filter_fn' parameter is set to NULL
dma_request_channel simply returns the first channel that satisfies the
capability mask. Otherwise, when the mask parameter is insufficient for
specifying the necessary channel, the filter_fn routine can be used to
disposition the available channels in the system. The filter_fn routine
is called once for each free channel in the system. Upon seeing a
suitable channel filter_fn returns DMA_ACK which flags that channel to
be the return value from dma_request_channel. A channel allocated via
this interface is exclusive to the caller, until dma_release_channel()
is called.
To ensure that all channels are not consumed by the general-purpose
allocator the DMA_PRIVATE capability is provided to exclude a dma_device
from general-purpose (memory-to-memory) consideration.
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/dmaengine.h')
-rw-r--r-- | include/linux/dmaengine.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 57a43adfc39e..fe40bc020af6 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -89,6 +89,7 @@ enum dma_transaction_type { | |||
89 | DMA_MEMSET, | 89 | DMA_MEMSET, |
90 | DMA_MEMCPY_CRC32C, | 90 | DMA_MEMCPY_CRC32C, |
91 | DMA_INTERRUPT, | 91 | DMA_INTERRUPT, |
92 | DMA_PRIVATE, | ||
92 | DMA_SLAVE, | 93 | DMA_SLAVE, |
93 | }; | 94 | }; |
94 | 95 | ||
@@ -224,6 +225,18 @@ typedef enum dma_state_client (*dma_event_callback) (struct dma_client *client, | |||
224 | struct dma_chan *chan, enum dma_state state); | 225 | struct dma_chan *chan, enum dma_state state); |
225 | 226 | ||
226 | /** | 227 | /** |
228 | * typedef dma_filter_fn - callback filter for dma_request_channel | ||
229 | * @chan: channel to be reviewed | ||
230 | * @filter_param: opaque parameter passed through dma_request_channel | ||
231 | * | ||
232 | * When this optional parameter is specified in a call to dma_request_channel a | ||
233 | * suitable channel is passed to this routine for further dispositioning before | ||
234 | * being returned. Where 'suitable' indicates a non-busy channel that | ||
235 | * satisfies the given capability mask. | ||
236 | */ | ||
237 | typedef enum dma_state_client (*dma_filter_fn)(struct dma_chan *chan, void *filter_param); | ||
238 | |||
239 | /** | ||
227 | * struct dma_client - info on the entity making use of DMA services | 240 | * struct dma_client - info on the entity making use of DMA services |
228 | * @event_callback: func ptr to call when something happens | 241 | * @event_callback: func ptr to call when something happens |
229 | * @cap_mask: only return channels that satisfy the requested capabilities | 242 | * @cap_mask: only return channels that satisfy the requested capabilities |
@@ -472,6 +485,9 @@ void dma_async_device_unregister(struct dma_device *device); | |||
472 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 485 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
473 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); | 486 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); |
474 | void dma_issue_pending_all(void); | 487 | void dma_issue_pending_all(void); |
488 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | ||
489 | struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); | ||
490 | void dma_release_channel(struct dma_chan *chan); | ||
475 | 491 | ||
476 | /* --- Helper iov-locking functions --- */ | 492 | /* --- Helper iov-locking functions --- */ |
477 | 493 | ||