xref: /linux/drivers/crypto/ccp/dbc.h (revision dbcedec3a31119d7594baacc743300d127c99c56)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * AMD Platform Security Processor (PSP) Dynamic Boost Control support
4  *
5  * Copyright (C) 2023 Advanced Micro Devices, Inc.
6  *
7  * Author: Mario Limonciello <mario.limonciello@amd.com>
8  */
9 
10 #ifndef __DBC_H__
11 #define __DBC_H__
12 
13 #include <uapi/linux/psp-dbc.h>
14 
15 #include <linux/device.h>
16 #include <linux/miscdevice.h>
17 #include <linux/psp-platform-access.h>
18 
19 #include "psp-dev.h"
20 
21 struct psp_dbc_device {
22 	struct device *dev;
23 	struct psp_device *psp;
24 
25 	union dbc_buffer *mbox;
26 
27 	struct mutex ioctl_mutex;
28 
29 	struct miscdevice char_dev;
30 
31 	/* used to abstract communication path */
32 	bool	use_ext;
33 	u32	header_size;
34 	u32	*payload_size;
35 	u32	*result;
36 	void	*payload;
37 };
38 
39 union dbc_buffer {
40 	struct psp_request		pa_req;
41 	struct psp_ext_request		ext_req;
42 };
43 
44 void dbc_dev_destroy(struct psp_device *psp);
45 int dbc_dev_init(struct psp_device *psp);
46 
47 #endif /* __DBC_H */
48