xref: /openbmc/linux/drivers/crypto/ccp/dbc.h (revision 0a7c9d1f)
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 
24 	union dbc_buffer *mbox;
25 
26 	struct mutex ioctl_mutex;
27 
28 	struct miscdevice char_dev;
29 };
30 
31 struct dbc_nonce {
32 	struct psp_req_buffer_hdr	header;
33 	struct dbc_user_nonce		user;
34 } __packed;
35 
36 struct dbc_set_uid {
37 	struct psp_req_buffer_hdr	header;
38 	struct dbc_user_setuid		user;
39 } __packed;
40 
41 struct dbc_param {
42 	struct psp_req_buffer_hdr	header;
43 	struct dbc_user_param		user;
44 } __packed;
45 
46 union dbc_buffer {
47 	struct psp_request		req;
48 	struct dbc_nonce		dbc_nonce;
49 	struct dbc_set_uid		dbc_set_uid;
50 	struct dbc_param		dbc_param;
51 };
52 
53 void dbc_dev_destroy(struct psp_device *psp);
54 int dbc_dev_init(struct psp_device *psp);
55 
56 #endif /* __DBC_H */
57