11bb76ff1Sjsg /* SPDX-License-Identifier: MIT */
21bb76ff1Sjsg /*
31bb76ff1Sjsg  * Copyright © 2020 Intel Corporation
41bb76ff1Sjsg  */
51bb76ff1Sjsg 
61bb76ff1Sjsg #ifndef _I915_PXP_TEE_INTERFACE_H_
71bb76ff1Sjsg #define _I915_PXP_TEE_INTERFACE_H_
81bb76ff1Sjsg 
91bb76ff1Sjsg #include <linux/mutex.h>
101bb76ff1Sjsg #include <linux/device.h>
11*f005ef32Sjsg struct scatterlist;
121bb76ff1Sjsg 
131bb76ff1Sjsg /**
141bb76ff1Sjsg  * struct i915_pxp_component_ops - ops for PXP services.
151bb76ff1Sjsg  * @owner: Module providing the ops
161bb76ff1Sjsg  * @send: sends data to PXP
171bb76ff1Sjsg  * @receive: receives data from PXP
181bb76ff1Sjsg  */
191bb76ff1Sjsg struct i915_pxp_component_ops {
201bb76ff1Sjsg 	/**
211bb76ff1Sjsg 	 * @owner: owner of the module provding the ops
221bb76ff1Sjsg 	 */
231bb76ff1Sjsg 	struct module *owner;
241bb76ff1Sjsg 
251bb76ff1Sjsg 	int (*send)(struct device *dev, const void *message, size_t size);
261bb76ff1Sjsg 	int (*recv)(struct device *dev, void *buffer, size_t size);
27*f005ef32Sjsg 	ssize_t (*gsc_command)(struct device *dev, u8 client_id, u32 fence_id,
28*f005ef32Sjsg 			       struct scatterlist *sg_in, size_t total_in_len,
29*f005ef32Sjsg 			       struct scatterlist *sg_out);
30*f005ef32Sjsg 
311bb76ff1Sjsg };
321bb76ff1Sjsg 
331bb76ff1Sjsg /**
341bb76ff1Sjsg  * struct i915_pxp_component - Used for communication between i915 and TEE
351bb76ff1Sjsg  * drivers for the PXP services
361bb76ff1Sjsg  * @tee_dev: device that provide the PXP service from TEE Bus.
371bb76ff1Sjsg  * @pxp_ops: Ops implemented by TEE driver, used by i915 driver.
381bb76ff1Sjsg  */
391bb76ff1Sjsg struct i915_pxp_component {
401bb76ff1Sjsg 	struct device *tee_dev;
411bb76ff1Sjsg 	const struct i915_pxp_component_ops *ops;
421bb76ff1Sjsg 
431bb76ff1Sjsg 	/* To protect the above members. */
441bb76ff1Sjsg 	struct mutex mutex;
451bb76ff1Sjsg };
461bb76ff1Sjsg 
471bb76ff1Sjsg #endif /* _I915_TEE_PXP_INTERFACE_H_ */
48