Merge tag 'irqchip-fixes-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/maz...
[linux-2.6-microblaze.git] / drivers / crypto / ccp / psp-dev.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * AMD Platform Security Processor (PSP) interface driver
4  *
5  * Copyright (C) 2017-2018 Advanced Micro Devices, Inc.
6  *
7  * Author: Brijesh Singh <brijesh.singh@amd.com>
8  */
9
10 #ifndef __PSP_DEV_H__
11 #define __PSP_DEV_H__
12
13 #include <linux/device.h>
14 #include <linux/pci.h>
15 #include <linux/spinlock.h>
16 #include <linux/mutex.h>
17 #include <linux/list.h>
18 #include <linux/wait.h>
19 #include <linux/dmapool.h>
20 #include <linux/hw_random.h>
21 #include <linux/bitops.h>
22 #include <linux/interrupt.h>
23 #include <linux/irqreturn.h>
24 #include <linux/dmaengine.h>
25 #include <linux/psp-sev.h>
26 #include <linux/miscdevice.h>
27
28 #include "sp-dev.h"
29
30 #define PSP_CMD_COMPLETE                BIT(1)
31
32 #define PSP_CMDRESP_CMD_SHIFT           16
33 #define PSP_CMDRESP_IOC                 BIT(0)
34 #define PSP_CMDRESP_RESP                BIT(31)
35 #define PSP_CMDRESP_ERR_MASK            0xffff
36
37 #define MAX_PSP_NAME_LEN                16
38
39 struct sev_misc_dev {
40         struct kref refcount;
41         struct miscdevice misc;
42 };
43
44 struct psp_device {
45         struct list_head entry;
46
47         struct psp_vdata *vdata;
48         char name[MAX_PSP_NAME_LEN];
49
50         struct device *dev;
51         struct sp_device *sp;
52
53         void __iomem *io_regs;
54
55         int sev_state;
56         unsigned int sev_int_rcvd;
57         wait_queue_head_t sev_int_queue;
58         struct sev_misc_dev *sev_misc;
59         struct sev_user_data_status status_cmd_buf;
60         struct sev_data_init init_cmd_buf;
61
62         u8 api_major;
63         u8 api_minor;
64         u8 build;
65 };
66
67 #endif /* __PSP_DEV_H */