| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AMD Secure Processor driver |
|---|
| 3 | 4 | * |
|---|
| 4 | | - * Copyright (C) 2017 Advanced Micro Devices, Inc. |
|---|
| 5 | + * Copyright (C) 2017-2019 Advanced Micro Devices, Inc. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Tom Lendacky <thomas.lendacky@amd.com> |
|---|
| 7 | 8 | * Author: Gary R Hook <gary.hook@amd.com> |
|---|
| 8 | 9 | * Author: Brijesh Singh <brijesh.singh@amd.com> |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #ifndef __SP_DEV_H__ |
|---|
| 16 | 13 | #define __SP_DEV_H__ |
|---|
| 17 | 14 | |
|---|
| 18 | 15 | #include <linux/device.h> |
|---|
| 19 | | -#include <linux/pci.h> |
|---|
| 20 | 16 | #include <linux/spinlock.h> |
|---|
| 21 | 17 | #include <linux/mutex.h> |
|---|
| 22 | 18 | #include <linux/list.h> |
|---|
| .. | .. |
|---|
| 43 | 39 | const unsigned int rsamax; |
|---|
| 44 | 40 | }; |
|---|
| 45 | 41 | |
|---|
| 46 | | -struct psp_vdata { |
|---|
| 42 | +struct sev_vdata { |
|---|
| 47 | 43 | const unsigned int cmdresp_reg; |
|---|
| 48 | 44 | const unsigned int cmdbuff_addr_lo_reg; |
|---|
| 49 | 45 | const unsigned int cmdbuff_addr_hi_reg; |
|---|
| 46 | +}; |
|---|
| 47 | + |
|---|
| 48 | +struct tee_vdata { |
|---|
| 49 | + const unsigned int cmdresp_reg; |
|---|
| 50 | + const unsigned int cmdbuff_addr_lo_reg; |
|---|
| 51 | + const unsigned int cmdbuff_addr_hi_reg; |
|---|
| 52 | + const unsigned int ring_wptr_reg; |
|---|
| 53 | + const unsigned int ring_rptr_reg; |
|---|
| 54 | +}; |
|---|
| 55 | + |
|---|
| 56 | +struct psp_vdata { |
|---|
| 57 | + const struct sev_vdata *sev; |
|---|
| 58 | + const struct tee_vdata *tee; |
|---|
| 50 | 59 | const unsigned int feature_reg; |
|---|
| 51 | 60 | const unsigned int inten_reg; |
|---|
| 52 | 61 | const unsigned int intsts_reg; |
|---|
| .. | .. |
|---|
| 81 | 90 | /* get and set master device */ |
|---|
| 82 | 91 | struct sp_device*(*get_psp_master_device)(void); |
|---|
| 83 | 92 | void (*set_psp_master_device)(struct sp_device *); |
|---|
| 93 | + void (*clear_psp_master_device)(struct sp_device *); |
|---|
| 84 | 94 | |
|---|
| 85 | 95 | bool irq_registered; |
|---|
| 86 | 96 | bool use_tasklet; |
|---|
| .. | .. |
|---|
| 109 | 119 | void sp_destroy(struct sp_device *sp); |
|---|
| 110 | 120 | struct sp_device *sp_get_master(void); |
|---|
| 111 | 121 | |
|---|
| 112 | | -int sp_suspend(struct sp_device *sp, pm_message_t state); |
|---|
| 122 | +int sp_suspend(struct sp_device *sp); |
|---|
| 113 | 123 | int sp_resume(struct sp_device *sp); |
|---|
| 114 | 124 | int sp_request_ccp_irq(struct sp_device *sp, irq_handler_t handler, |
|---|
| 115 | 125 | const char *name, void *data); |
|---|
| .. | .. |
|---|
| 124 | 134 | int ccp_dev_init(struct sp_device *sp); |
|---|
| 125 | 135 | void ccp_dev_destroy(struct sp_device *sp); |
|---|
| 126 | 136 | |
|---|
| 127 | | -int ccp_dev_suspend(struct sp_device *sp, pm_message_t state); |
|---|
| 137 | +int ccp_dev_suspend(struct sp_device *sp); |
|---|
| 128 | 138 | int ccp_dev_resume(struct sp_device *sp); |
|---|
| 129 | 139 | |
|---|
| 130 | 140 | #else /* !CONFIG_CRYPTO_DEV_SP_CCP */ |
|---|
| .. | .. |
|---|
| 135 | 145 | } |
|---|
| 136 | 146 | static inline void ccp_dev_destroy(struct sp_device *sp) { } |
|---|
| 137 | 147 | |
|---|
| 138 | | -static inline int ccp_dev_suspend(struct sp_device *sp, pm_message_t state) |
|---|
| 148 | +static inline int ccp_dev_suspend(struct sp_device *sp) |
|---|
| 139 | 149 | { |
|---|
| 140 | 150 | return 0; |
|---|
| 141 | 151 | } |
|---|