OSDN Git Service

crypto: ccp - Add support for setting user ID for dynamic boost control
[tomoyo/tomoyo-test1.git] / drivers / crypto / ccp / dbc.h
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 union dbc_buffer {
42         struct psp_request              req;
43         struct dbc_nonce                dbc_nonce;
44         struct dbc_set_uid              dbc_set_uid;
45 };
46
47 void dbc_dev_destroy(struct psp_device *psp);
48 int dbc_dev_init(struct psp_device *psp);
49
50 #endif /* __DBC_H */