xref: /linux/drivers/crypto/ccp/sfs.h (revision 22bdd6e68bbe270a916233ec5f34a13ae5e80ed9)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * AMD Platform Security Processor (PSP) Seamless Firmware (SFS) Support.
4  *
5  * Copyright (C) 2025 Advanced Micro Devices, Inc.
6  *
7  * Author: Ashish Kalra <ashish.kalra@amd.com>
8  */
9 
10 #ifndef __SFS_H__
11 #define __SFS_H__
12 
13 #include <uapi/linux/psp-sfs.h>
14 
15 #include <linux/device.h>
16 #include <linux/miscdevice.h>
17 #include <linux/psp-sev.h>
18 #include <linux/psp-platform-access.h>
19 #include <linux/set_memory.h>
20 
21 #include "psp-dev.h"
22 
23 struct sfs_misc_dev {
24 	struct kref refcount;
25 	struct miscdevice misc;
26 };
27 
28 struct sfs_command {
29 	struct psp_ext_req_buffer_hdr hdr;
30 	u8 buf[PAGE_SIZE - sizeof(struct psp_ext_req_buffer_hdr)];
31 	u8 sfs_buffer[];
32 } __packed;
33 
34 struct sfs_device {
35 	struct device *dev;
36 	struct psp_device *psp;
37 
38 	struct page *page;
39 	struct sfs_command *command_buf;
40 
41 	struct sfs_misc_dev *misc;
42 };
43 
44 void sfs_dev_destroy(struct psp_device *psp);
45 int sfs_dev_init(struct psp_device *psp);
46 
47 #endif /* __SFS_H__ */
48