hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/crypto/ccp/psp-dev.h
....@@ -1,48 +1,30 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * AMD Platform Security Processor (PSP) interface driver
34 *
4
- * Copyright (C) 2017 Advanced Micro Devices, Inc.
5
+ * Copyright (C) 2017-2019 Advanced Micro Devices, Inc.
56 *
67 * Author: Brijesh Singh <brijesh.singh@amd.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #ifndef __PSP_DEV_H__
1411 #define __PSP_DEV_H__
1512
1613 #include <linux/device.h>
17
-#include <linux/pci.h>
18
-#include <linux/spinlock.h>
19
-#include <linux/mutex.h>
2014 #include <linux/list.h>
21
-#include <linux/wait.h>
22
-#include <linux/dmapool.h>
23
-#include <linux/hw_random.h>
24
-#include <linux/bitops.h>
15
+#include <linux/bits.h>
2516 #include <linux/interrupt.h>
26
-#include <linux/irqreturn.h>
27
-#include <linux/dmaengine.h>
28
-#include <linux/psp-sev.h>
29
-#include <linux/miscdevice.h>
3017
3118 #include "sp-dev.h"
3219
33
-#define PSP_CMD_COMPLETE BIT(1)
34
-
35
-#define PSP_CMDRESP_CMD_SHIFT 16
36
-#define PSP_CMDRESP_IOC BIT(0)
3720 #define PSP_CMDRESP_RESP BIT(31)
3821 #define PSP_CMDRESP_ERR_MASK 0xffff
3922
4023 #define MAX_PSP_NAME_LEN 16
4124
42
-struct sev_misc_dev {
43
- struct kref refcount;
44
- struct miscdevice misc;
45
-};
25
+extern struct psp_device *psp_master;
26
+
27
+typedef void (*psp_irq_handler_t)(int, void *, unsigned int);
4628
4729 struct psp_device {
4830 struct list_head entry;
....@@ -55,16 +37,24 @@
5537
5638 void __iomem *io_regs;
5739
58
- int sev_state;
59
- unsigned int sev_int_rcvd;
60
- wait_queue_head_t sev_int_queue;
61
- struct sev_misc_dev *sev_misc;
62
- struct sev_user_data_status status_cmd_buf;
63
- struct sev_data_init init_cmd_buf;
40
+ psp_irq_handler_t sev_irq_handler;
41
+ void *sev_irq_data;
6442
65
- u8 api_major;
66
- u8 api_minor;
67
- u8 build;
43
+ psp_irq_handler_t tee_irq_handler;
44
+ void *tee_irq_data;
45
+
46
+ void *sev_data;
47
+ void *tee_data;
6848 };
6949
50
+void psp_set_sev_irq_handler(struct psp_device *psp, psp_irq_handler_t handler,
51
+ void *data);
52
+void psp_clear_sev_irq_handler(struct psp_device *psp);
53
+
54
+void psp_set_tee_irq_handler(struct psp_device *psp, psp_irq_handler_t handler,
55
+ void *data);
56
+void psp_clear_tee_irq_handler(struct psp_device *psp);
57
+
58
+struct psp_device *psp_get_master_device(void);
59
+
7060 #endif /* __PSP_DEV_H */