#include <linux/completion.h>
#include <linux/device.h>
#include <linux/dma-buf.h>
#include <linux/dma-mapping.h>
#include <linux/dma-resv.h>
#include <linux/idr.h>
#include <linux/list.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/sort.h>
#include <linux/of_platform.h>
#include <linux/rpmsg.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/firmware/qcom/qcom_scm.h>
#include <uapi/misc/fastrpc.h>
#include <linux/of_reserved_mem.h>
#define ADSP_DOMAIN_ID …
#define MDSP_DOMAIN_ID …
#define SDSP_DOMAIN_ID …
#define CDSP_DOMAIN_ID …
#define FASTRPC_DEV_MAX …
#define FASTRPC_MAX_SESSIONS …
#define FASTRPC_MAX_VMIDS …
#define FASTRPC_ALIGN …
#define FASTRPC_MAX_FDLIST …
#define FASTRPC_MAX_CRCLIST …
#define FASTRPC_PHYS(p) …
#define FASTRPC_CTX_MAX …
#define FASTRPC_INIT_HANDLE …
#define FASTRPC_DSP_UTILITIES_HANDLE …
#define FASTRPC_CTXID_MASK …
#define INIT_FILELEN_MAX …
#define INIT_FILE_NAMELEN_MAX …
#define FASTRPC_DEVICE_NAME …
#define ADSP_MMAP_HEAP_ADDR …
#define ADSP_MMAP_DMA_BUFFER …
#define ADSP_MMAP_REMOTE_HEAP_ADDR …
#define ADSP_MMAP_ADD_PAGES …
#define ADSP_MMAP_ADD_PAGES_LLC …
#define DSP_UNSUPPORTED_API …
#define FASTRPC_MAX_DSP_ATTRIBUTES …
#define FASTRPC_MAX_DSP_ATTRIBUTES_LEN …
#define REMOTE_SCALARS_INBUFS(sc) …
#define REMOTE_SCALARS_OUTBUFS(sc) …
#define REMOTE_SCALARS_INHANDLES(sc) …
#define REMOTE_SCALARS_OUTHANDLES(sc) …
#define REMOTE_SCALARS_LENGTH(sc) …
#define FASTRPC_BUILD_SCALARS(attr, method, in, out, oin, oout) …
#define FASTRPC_SCALARS(method, in, out) …
#define FASTRPC_CREATE_PROCESS_NARGS …
#define FASTRPC_CREATE_STATIC_PROCESS_NARGS …
#define FASTRPC_RMID_INIT_ATTACH …
#define FASTRPC_RMID_INIT_RELEASE …
#define FASTRPC_RMID_INIT_MMAP …
#define FASTRPC_RMID_INIT_MUNMAP …
#define FASTRPC_RMID_INIT_CREATE …
#define FASTRPC_RMID_INIT_CREATE_ATTR …
#define FASTRPC_RMID_INIT_CREATE_STATIC …
#define FASTRPC_RMID_INIT_MEM_MAP …
#define FASTRPC_RMID_INIT_MEM_UNMAP …
#define ROOT_PD …
#define USER_PD …
#define SENSORS_PD …
#define miscdev_to_fdevice(d) …
static const char *domains[FASTRPC_DEV_MAX] = …;
struct fastrpc_phy_page { … };
struct fastrpc_invoke_buf { … };
struct fastrpc_remote_dmahandle { … };
struct fastrpc_remote_buf { … };
fastrpc_remote_arg;
struct fastrpc_mmap_rsp_msg { … };
struct fastrpc_mmap_req_msg { … };
struct fastrpc_mem_map_req_msg { … };
struct fastrpc_munmap_req_msg { … };
struct fastrpc_mem_unmap_req_msg { … };
struct fastrpc_msg { … };
struct fastrpc_invoke_rsp { … };
struct fastrpc_buf_overlap { … };
struct fastrpc_buf { … };
struct fastrpc_dma_buf_attachment { … };
struct fastrpc_map { … };
struct fastrpc_invoke_ctx { … };
struct fastrpc_session_ctx { … };
struct fastrpc_channel_ctx { … };
struct fastrpc_device { … };
struct fastrpc_user { … };
static void fastrpc_free_map(struct kref *ref)
{ … }
static void fastrpc_map_put(struct fastrpc_map *map)
{ … }
static int fastrpc_map_get(struct fastrpc_map *map)
{ … }
static int fastrpc_map_lookup(struct fastrpc_user *fl, int fd,
struct fastrpc_map **ppmap, bool take_ref)
{ … }
static void fastrpc_buf_free(struct fastrpc_buf *buf)
{ … }
static int __fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,
u64 size, struct fastrpc_buf **obuf)
{ … }
static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,
u64 size, struct fastrpc_buf **obuf)
{ … }
static int fastrpc_remote_heap_alloc(struct fastrpc_user *fl, struct device *dev,
u64 size, struct fastrpc_buf **obuf)
{ … }
static void fastrpc_channel_ctx_free(struct kref *ref)
{ … }
static void fastrpc_channel_ctx_get(struct fastrpc_channel_ctx *cctx)
{ … }
static void fastrpc_channel_ctx_put(struct fastrpc_channel_ctx *cctx)
{ … }
static void fastrpc_context_free(struct kref *ref)
{ … }
static void fastrpc_context_get(struct fastrpc_invoke_ctx *ctx)
{ … }
static void fastrpc_context_put(struct fastrpc_invoke_ctx *ctx)
{ … }
static void fastrpc_context_put_wq(struct work_struct *work)
{ … }
#define CMP(aa, bb) …
static int olaps_cmp(const void *a, const void *b)
{ … }
static void fastrpc_get_buff_overlaps(struct fastrpc_invoke_ctx *ctx)
{ … }
static struct fastrpc_invoke_ctx *fastrpc_context_alloc(
struct fastrpc_user *user, u32 kernel, u32 sc,
struct fastrpc_invoke_args *args)
{ … }
static struct sg_table *
fastrpc_map_dma_buf(struct dma_buf_attachment *attachment,
enum dma_data_direction dir)
{ … }
static void fastrpc_unmap_dma_buf(struct dma_buf_attachment *attach,
struct sg_table *table,
enum dma_data_direction dir)
{ … }
static void fastrpc_release(struct dma_buf *dmabuf)
{ … }
static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf,
struct dma_buf_attachment *attachment)
{ … }
static void fastrpc_dma_buf_detatch(struct dma_buf *dmabuf,
struct dma_buf_attachment *attachment)
{ … }
static int fastrpc_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
{ … }
static int fastrpc_mmap(struct dma_buf *dmabuf,
struct vm_area_struct *vma)
{ … }
static const struct dma_buf_ops fastrpc_dma_buf_ops = …;
static int fastrpc_map_create(struct fastrpc_user *fl, int fd,
u64 len, u32 attr, struct fastrpc_map **ppmap)
{ … }
static int fastrpc_get_meta_size(struct fastrpc_invoke_ctx *ctx)
{ … }
static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen)
{ … }
static int fastrpc_create_maps(struct fastrpc_invoke_ctx *ctx)
{ … }
static struct fastrpc_invoke_buf *fastrpc_invoke_buf_start(union fastrpc_remote_arg *pra, int len)
{ … }
static struct fastrpc_phy_page *fastrpc_phy_page_start(struct fastrpc_invoke_buf *buf, int len)
{ … }
static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
{ … }
static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
u32 kernel)
{ … }
static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx,
struct fastrpc_invoke_ctx *ctx,
u32 kernel, uint32_t handle)
{ … }
static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
u32 handle, u32 sc,
struct fastrpc_invoke_args *args)
{ … }
static bool is_session_rejected(struct fastrpc_user *fl, bool unsigned_pd_request)
{ … }
static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
char __user *argp)
{ … }
static int fastrpc_init_create_process(struct fastrpc_user *fl,
char __user *argp)
{ … }
static struct fastrpc_session_ctx *fastrpc_session_alloc(
struct fastrpc_channel_ctx *cctx)
{ … }
static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx,
struct fastrpc_session_ctx *session)
{ … }
static int fastrpc_release_current_dsp_process(struct fastrpc_user *fl)
{ … }
static int fastrpc_device_release(struct inode *inode, struct file *file)
{ … }
static int fastrpc_device_open(struct inode *inode, struct file *filp)
{ … }
static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp)
{ … }
static int fastrpc_init_attach(struct fastrpc_user *fl, int pd)
{ … }
static int fastrpc_invoke(struct fastrpc_user *fl, char __user *argp)
{ … }
static int fastrpc_get_info_from_dsp(struct fastrpc_user *fl, uint32_t *dsp_attr_buf,
uint32_t dsp_attr_buf_len)
{ … }
static int fastrpc_get_info_from_kernel(struct fastrpc_ioctl_capability *cap,
struct fastrpc_user *fl)
{ … }
static int fastrpc_get_dsp_info(struct fastrpc_user *fl, char __user *argp)
{ … }
static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, struct fastrpc_buf *buf)
{ … }
static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp)
{ … }
static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
{ … }
static int fastrpc_req_mem_unmap_impl(struct fastrpc_user *fl, struct fastrpc_mem_unmap *req)
{ … }
static int fastrpc_req_mem_unmap(struct fastrpc_user *fl, char __user *argp)
{ … }
static int fastrpc_req_mem_map(struct fastrpc_user *fl, char __user *argp)
{ … }
static int is_attach_rejected(struct fastrpc_user *fl)
{ … }
static long fastrpc_device_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations fastrpc_fops = …;
static int fastrpc_cb_probe(struct platform_device *pdev)
{ … }
static void fastrpc_cb_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id fastrpc_match_table[] = …;
static struct platform_driver fastrpc_cb_driver = …;
static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ctx *cctx,
bool is_secured, const char *domain)
{ … }
static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
{ … }
static void fastrpc_notify_users(struct fastrpc_user *user)
{ … }
static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev)
{ … }
static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
int len, void *priv, u32 addr)
{ … }
static const struct of_device_id fastrpc_rpmsg_of_match[] = …;
MODULE_DEVICE_TABLE(of, fastrpc_rpmsg_of_match);
static struct rpmsg_driver fastrpc_driver = …;
static int fastrpc_init(void)
{ … }
module_init(…) …;
static void fastrpc_exit(void)
{ … }
module_exit(fastrpc_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);