1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef _I915_PXP_TEE_INTERFACE_H_
7 #define _I915_PXP_TEE_INTERFACE_H_
8 
9 #include <linux/mutex.h>
10 #include <linux/device.h>
11 struct scatterlist;
12 
13 /**
14  * struct i915_pxp_component_ops - ops for PXP services.
15  * @owner: Module providing the ops
16  * @send: sends data to PXP
17  * @receive: receives data from PXP
18  */
19 struct i915_pxp_component_ops {
20 	/**
21 	 * @owner: owner of the module provding the ops
22 	 */
23 	struct module *owner;
24 
25 	int (*send)(struct device *dev, const void *message, size_t size);
26 	int (*recv)(struct device *dev, void *buffer, size_t size);
27 	ssize_t (*gsc_command)(struct device *dev, u8 client_id, u32 fence_id,
28 			       struct scatterlist *sg_in, size_t total_in_len,
29 			       struct scatterlist *sg_out);
30 
31 };
32 
33 /**
34  * struct i915_pxp_component - Used for communication between i915 and TEE
35  * drivers for the PXP services
36  * @tee_dev: device that provide the PXP service from TEE Bus.
37  * @pxp_ops: Ops implemented by TEE driver, used by i915 driver.
38  */
39 struct i915_pxp_component {
40 	struct device *tee_dev;
41 	const struct i915_pxp_component_ops *ops;
42 
43 	/* To protect the above members. */
44 	struct mutex mutex;
45 };
46 
47 #endif /* _I915_TEE_PXP_INTERFACE_H_ */
48