0001
0002
0003
0004
0005 #ifndef TEE_PRIVATE_H
0006 #define TEE_PRIVATE_H
0007
0008 #include <linux/cdev.h>
0009 #include <linux/completion.h>
0010 #include <linux/device.h>
0011 #include <linux/kref.h>
0012 #include <linux/mutex.h>
0013 #include <linux/types.h>
0014
0015 #define TEE_DEVICE_FLAG_REGISTERED 0x1
0016 #define TEE_MAX_DEV_NAME_LEN 32
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 struct tee_device {
0034 char name[TEE_MAX_DEV_NAME_LEN];
0035 const struct tee_desc *desc;
0036 int id;
0037 unsigned int flags;
0038
0039 struct device dev;
0040 struct cdev cdev;
0041
0042 size_t num_users;
0043 struct completion c_no_users;
0044 struct mutex mutex;
0045
0046 struct idr idr;
0047 struct tee_shm_pool *pool;
0048 };
0049
0050 int tee_shm_init(void);
0051
0052 int tee_shm_get_fd(struct tee_shm *shm);
0053
0054 bool tee_device_get(struct tee_device *teedev);
0055 void tee_device_put(struct tee_device *teedev);
0056
0057 void teedev_ctx_get(struct tee_context *ctx);
0058 void teedev_ctx_put(struct tee_context *ctx);
0059
0060 struct tee_shm *tee_shm_alloc_user_buf(struct tee_context *ctx, size_t size);
0061 struct tee_shm *tee_shm_register_user_buf(struct tee_context *ctx,
0062 unsigned long addr, size_t length);
0063
0064 #endif