xref: /linux/drivers/firmware/qcom/qcom_pas.h (revision 8d0620d47dad641ab2874aa2e9b2803cd66f2118)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4  */
5 
6 #ifndef __QCOM_PAS_INT_H
7 #define __QCOM_PAS_INT_H
8 
9 struct device;
10 
11 /**
12  * struct qcom_pas_ops - Qcom Peripheral Authentication Service (PAS) ops
13  * @drv_name:			PAS driver name.
14  * @dev:			PAS device pointer.
15  * @supported:			Peripheral supported callback.
16  * @init_image:			Peripheral image initialization callback.
17  * @mem_setup:			Peripheral memory setup callback.
18  * @get_rsc_table:		Peripheral get resource table callback.
19  * @prepare_and_auth_reset:	Peripheral prepare firmware authentication and
20  *				reset callback.
21  * @auth_and_reset:		Peripheral firmware authentication and reset
22  *				callback.
23  * @set_remote_state:		Peripheral set remote state callback.
24  * @shutdown:			Peripheral shutdown callback.
25  * @metadata_release:		Image metadata release callback.
26  */
27 struct qcom_pas_ops {
28 	const char *drv_name;
29 	struct device *dev;
30 	bool (*supported)(struct device *dev, u32 pas_id);
31 	int (*init_image)(struct device *dev, u32 pas_id, const void *metadata,
32 			  size_t size, struct qcom_pas_context *ctx);
33 	int (*mem_setup)(struct device *dev, u32 pas_id, phys_addr_t addr,
34 			 phys_addr_t size);
35 	void *(*get_rsc_table)(struct device *dev, struct qcom_pas_context *ctx,
36 			       void *input_rt, size_t input_rt_size,
37 			       size_t *output_rt_size);
38 	int (*prepare_and_auth_reset)(struct device *dev,
39 				      struct qcom_pas_context *ctx);
40 	int (*auth_and_reset)(struct device *dev, u32 pas_id);
41 	int (*set_remote_state)(struct device *dev, u32 state, u32 pas_id);
42 	int (*shutdown)(struct device *dev, u32 pas_id);
43 	void (*metadata_release)(struct device *dev,
44 				 struct qcom_pas_context *ctx);
45 };
46 
47 void qcom_pas_ops_register(struct qcom_pas_ops *ops);
48 void qcom_pas_ops_unregister(void);
49 
50 #endif /* __QCOM_PAS_INT_H */
51