Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 
0003 #ifndef __QCOM_FASTRPC_H__
0004 #define __QCOM_FASTRPC_H__
0005 
0006 #include <linux/types.h>
0007 
0008 #define FASTRPC_IOCTL_ALLOC_DMA_BUFF    _IOWR('R', 1, struct fastrpc_alloc_dma_buf)
0009 #define FASTRPC_IOCTL_FREE_DMA_BUFF _IOWR('R', 2, __u32)
0010 #define FASTRPC_IOCTL_INVOKE        _IOWR('R', 3, struct fastrpc_invoke)
0011 #define FASTRPC_IOCTL_INIT_ATTACH   _IO('R', 4)
0012 #define FASTRPC_IOCTL_INIT_CREATE   _IOWR('R', 5, struct fastrpc_init_create)
0013 #define FASTRPC_IOCTL_MMAP      _IOWR('R', 6, struct fastrpc_req_mmap)
0014 #define FASTRPC_IOCTL_MUNMAP        _IOWR('R', 7, struct fastrpc_req_munmap)
0015 #define FASTRPC_IOCTL_INIT_ATTACH_SNS   _IO('R', 8)
0016 #define FASTRPC_IOCTL_MEM_MAP       _IOWR('R', 10, struct fastrpc_mem_map)
0017 #define FASTRPC_IOCTL_MEM_UNMAP     _IOWR('R', 11, struct fastrpc_mem_unmap)
0018 #define FASTRPC_IOCTL_GET_DSP_INFO  _IOWR('R', 13, struct fastrpc_ioctl_capability)
0019 
0020 /**
0021  * enum fastrpc_map_flags - control flags for mapping memory on DSP user process
0022  * @FASTRPC_MAP_STATIC: Map memory pages with RW- permission and CACHE WRITEBACK.
0023  * The driver is responsible for cache maintenance when passed
0024  * the buffer to FastRPC calls. Same virtual address will be
0025  * assigned for subsequent FastRPC calls.
0026  * @FASTRPC_MAP_RESERVED: Reserved
0027  * @FASTRPC_MAP_FD: Map memory pages with RW- permission and CACHE WRITEBACK.
0028  * Mapping tagged with a file descriptor. User is responsible for
0029  * CPU and DSP cache maintenance for the buffer. Get virtual address
0030  * of buffer on DSP using HAP_mmap_get() and HAP_mmap_put() APIs.
0031  * @FASTRPC_MAP_FD_DELAYED: Mapping delayed until user call HAP_mmap() and HAP_munmap()
0032  * functions on DSP. It is useful to map a buffer with cache modes
0033  * other than default modes. User is responsible for CPU and DSP
0034  * cache maintenance for the buffer.
0035  * @FASTRPC_MAP_FD_NOMAP: This flag is used to skip CPU mapping,
0036  * otherwise behaves similar to FASTRPC_MAP_FD_DELAYED flag.
0037  * @FASTRPC_MAP_MAX: max count for flags
0038  *
0039  */
0040 enum fastrpc_map_flags {
0041     FASTRPC_MAP_STATIC = 0,
0042     FASTRPC_MAP_RESERVED,
0043     FASTRPC_MAP_FD = 2,
0044     FASTRPC_MAP_FD_DELAYED,
0045     FASTRPC_MAP_FD_NOMAP = 16,
0046     FASTRPC_MAP_MAX,
0047 };
0048 
0049 enum fastrpc_proc_attr {
0050     /* Macro for Debug attr */
0051     FASTRPC_MODE_DEBUG      = (1 << 0),
0052     /* Macro for Ptrace */
0053     FASTRPC_MODE_PTRACE     = (1 << 1),
0054     /* Macro for CRC Check */
0055     FASTRPC_MODE_CRC        = (1 << 2),
0056     /* Macro for Unsigned PD */
0057     FASTRPC_MODE_UNSIGNED_MODULE    = (1 << 3),
0058     /* Macro for Adaptive QoS */
0059     FASTRPC_MODE_ADAPTIVE_QOS   = (1 << 4),
0060     /* Macro for System Process */
0061     FASTRPC_MODE_SYSTEM_PROCESS = (1 << 5),
0062     /* Macro for Prvileged Process */
0063     FASTRPC_MODE_PRIVILEGED     = (1 << 6),
0064 };
0065 
0066 /* Fastrpc attribute for memory protection of buffers */
0067 #define FASTRPC_ATTR_SECUREMAP  (1)
0068 
0069 struct fastrpc_invoke_args {
0070     __u64 ptr;
0071     __u64 length;
0072     __s32 fd;
0073     __u32 attr;
0074 };
0075 
0076 struct fastrpc_invoke {
0077     __u32 handle;
0078     __u32 sc;
0079     __u64 args;
0080 };
0081 
0082 struct fastrpc_init_create {
0083     __u32 filelen;  /* elf file length */
0084     __s32 filefd;   /* fd for the file */
0085     __u32 attrs;
0086     __u32 siglen;
0087     __u64 file; /* pointer to elf file */
0088 };
0089 
0090 struct fastrpc_alloc_dma_buf {
0091     __s32 fd;   /* fd */
0092     __u32 flags;    /* flags to map with */
0093     __u64 size; /* size */
0094 };
0095 
0096 struct fastrpc_req_mmap {
0097     __s32 fd;
0098     __u32 flags;    /* flags for dsp to map with */
0099     __u64 vaddrin;  /* optional virtual address */
0100     __u64 size; /* size */
0101     __u64 vaddrout; /* dsp virtual address */
0102 };
0103 
0104 struct fastrpc_mem_map {
0105     __s32 version;
0106     __s32 fd;       /* fd */
0107     __s32 offset;       /* buffer offset */
0108     __u32 flags;        /* flags defined in enum fastrpc_map_flags */
0109     __u64 vaddrin;      /* buffer virtual address */
0110     __u64 length;       /* buffer length */
0111     __u64 vaddrout;     /* [out] remote virtual address */
0112     __s32 attrs;        /* buffer attributes used for SMMU mapping */
0113     __s32 reserved[4];
0114 };
0115 
0116 struct fastrpc_req_munmap {
0117     __u64 vaddrout; /* address to unmap */
0118     __u64 size; /* size */
0119 };
0120 
0121 struct fastrpc_mem_unmap {
0122     __s32 vesion;
0123     __s32 fd;       /* fd */
0124     __u64 vaddr;        /* remote process (dsp) virtual address */
0125     __u64 length;       /* buffer size */
0126     __s32 reserved[5];
0127 };
0128 
0129 struct fastrpc_ioctl_capability {
0130     __u32 domain;
0131     __u32 attribute_id;
0132     __u32 capability;   /* dsp capability */
0133     __u32 reserved[4];
0134 };
0135 
0136 #endif /* __QCOM_FASTRPC_H__ */