#define pr_fmt(fmt) …
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/hardirq.h>
#include <linux/spinlock.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/mutex.h>
#include <linux/jiffies.h>
#include <linux/rculist.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/acpi_dma.h>
#include <linux/of_dma.h>
#include <linux/mempool.h>
#include <linux/numa.h>
#include "dmaengine.h"
static DEFINE_MUTEX(dma_list_mutex);
static DEFINE_IDA(dma_ida);
static LIST_HEAD(dma_device_list);
static long dmaengine_ref_count;
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
static struct dentry *rootdir;
static void dmaengine_debug_register(struct dma_device *dma_dev)
{ … }
static void dmaengine_debug_unregister(struct dma_device *dma_dev)
{ … }
static void dmaengine_dbg_summary_show(struct seq_file *s,
struct dma_device *dma_dev)
{ … }
static int dmaengine_summary_show(struct seq_file *s, void *data)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
static void __init dmaengine_debugfs_init(void)
{ … }
#else
static inline void dmaengine_debugfs_init(void) { }
static inline int dmaengine_debug_register(struct dma_device *dma_dev)
{
return 0;
}
static inline void dmaengine_debug_unregister(struct dma_device *dma_dev) { }
#endif
#define DMA_SLAVE_NAME …
static struct dma_chan *dev_to_dma_chan(struct device *dev)
{ … }
static ssize_t memcpy_count_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(memcpy_count);
static ssize_t bytes_transferred_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(bytes_transferred);
static ssize_t in_use_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(in_use);
static struct attribute *dma_dev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void chan_dev_release(struct device *dev)
{ … }
static struct class dma_devclass = …;
static dma_cap_mask_t dma_cap_mask_all;
struct dma_chan_tbl_ent { … };
static struct dma_chan_tbl_ent __percpu *channel_table[DMA_TX_TYPE_END];
static int __init dma_channel_table_init(void)
{ … }
arch_initcall(dma_channel_table_init);
static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
{ … }
static struct dma_chan *min_chan(enum dma_transaction_type cap, int cpu)
{ … }
static void dma_channel_rebalance(void)
{ … }
static int dma_device_satisfies_mask(struct dma_device *device,
const dma_cap_mask_t *want)
{ … }
static struct module *dma_chan_to_owner(struct dma_chan *chan)
{ … }
static void balance_ref_count(struct dma_chan *chan)
{ … }
static void dma_device_release(struct kref *ref)
{ … }
static void dma_device_put(struct dma_device *device)
{ … }
static int dma_chan_get(struct dma_chan *chan)
{ … }
static void dma_chan_put(struct dma_chan *chan)
{ … }
enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
{ … }
EXPORT_SYMBOL(…);
struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
{ … }
EXPORT_SYMBOL(…);
void dma_issue_pending_all(void)
{ … }
EXPORT_SYMBOL(…);
int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct dma_chan *private_candidate(const dma_cap_mask_t *mask,
struct dma_device *dev,
dma_filter_fn fn, void *fn_param)
{ … }
static struct dma_chan *find_candidate(struct dma_device *device,
const dma_cap_mask_t *mask,
dma_filter_fn fn, void *fn_param)
{ … }
struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
{ … }
EXPORT_SYMBOL_GPL(…);
struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
{ … }
EXPORT_SYMBOL_GPL(…);
struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
dma_filter_fn fn, void *fn_param,
struct device_node *np)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
const char *name,
struct device *dev)
{ … }
struct dma_chan *dma_request_chan(struct device *dev, const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask)
{ … }
EXPORT_SYMBOL_GPL(…);
void dma_release_channel(struct dma_chan *chan)
{ … }
EXPORT_SYMBOL_GPL(…);
void dmaengine_get(void)
{ … }
EXPORT_SYMBOL(…);
void dmaengine_put(void)
{ … }
EXPORT_SYMBOL(…);
static bool device_has_all_tx_types(struct dma_device *device)
{ … }
static int get_dma_id(struct dma_device *device)
{ … }
static int __dma_async_device_channel_register(struct dma_device *device,
struct dma_chan *chan,
const char *name)
{ … }
int dma_async_device_channel_register(struct dma_device *device,
struct dma_chan *chan,
const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
static void __dma_async_device_channel_unregister(struct dma_device *device,
struct dma_chan *chan)
{ … }
void dma_async_device_channel_unregister(struct dma_device *device,
struct dma_chan *chan)
{ … }
EXPORT_SYMBOL_GPL(…);
int dma_async_device_register(struct dma_device *device)
{ … }
EXPORT_SYMBOL(…);
void dma_async_device_unregister(struct dma_device *device)
{ … }
EXPORT_SYMBOL(…);
static void dmaenginem_async_device_unregister(void *device)
{ … }
int dmaenginem_async_device_register(struct dma_device *device)
{ … }
EXPORT_SYMBOL(…);
struct dmaengine_unmap_pool { … };
#define __UNMAP_POOL(x) …
static struct dmaengine_unmap_pool unmap_pool[] = …;
static struct dmaengine_unmap_pool *__get_unmap_pool(int nr)
{ … }
static void dmaengine_unmap(struct kref *kref)
{ … }
void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap)
{ … }
EXPORT_SYMBOL_GPL(…);
static void dmaengine_destroy_unmap_pool(void)
{ … }
static int __init dmaengine_init_unmap_pool(void)
{ … }
struct dmaengine_unmap_data *
dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags)
{ … }
EXPORT_SYMBOL(…);
void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
struct dma_chan *chan)
{ … }
EXPORT_SYMBOL(…);
static inline int desc_check_and_set_metadata_mode(
struct dma_async_tx_descriptor *desc, enum dma_desc_metadata_mode mode)
{ … }
int dmaengine_desc_attach_metadata(struct dma_async_tx_descriptor *desc,
void *data, size_t len)
{ … }
EXPORT_SYMBOL_GPL(…);
void *dmaengine_desc_get_metadata_ptr(struct dma_async_tx_descriptor *desc,
size_t *payload_len, size_t *max_len)
{ … }
EXPORT_SYMBOL_GPL(…);
int dmaengine_desc_set_metadata_len(struct dma_async_tx_descriptor *desc,
size_t payload_len)
{ … }
EXPORT_SYMBOL_GPL(…);
enum dma_status
dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
{ … }
EXPORT_SYMBOL_GPL(…);
void dma_run_dependencies(struct dma_async_tx_descriptor *tx)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init dma_bus_init(void)
{ … }
arch_initcall(dma_bus_init);