xref: /linux/arch/powerpc/include/asm/secvar.h (revision 69050f8d6d075dc01af7a5f2f550a8067510366f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2019 IBM Corporation
4  * Author: Nayna Jain
5  *
6  * PowerPC secure variable operations.
7  */
8 #ifndef SECVAR_OPS_H
9 #define SECVAR_OPS_H
10 
11 #include <linux/types.h>
12 #include <linux/errno.h>
13 #include <linux/sysfs.h>
14 
15 extern const struct secvar_operations *secvar_ops;
16 
17 struct secvar_operations {
18 	int (*get)(const char *key, u64 key_len, u8 *data, u64 *data_size);
19 	int (*get_next)(const char *key, u64 *key_len, u64 keybufsize);
20 	int (*set)(const char *key, u64 key_len, u8 *data, u64 data_size);
21 	ssize_t (*format)(char *buf, size_t bufsize);
22 	int (*max_size)(u64 *max_size);
23 
24 	// NULL-terminated array of fixed variable names
25 	// Only used if get_next() isn't provided
26 	const char * const *var_names;
27 };
28 
29 #ifdef CONFIG_PPC_SECURE_BOOT
30 
31 int set_secvar_ops(const struct secvar_operations *ops);
32 
33 #else
34 
35 static inline int set_secvar_ops(const struct secvar_operations *ops) { return 0; }
36 
37 #endif
38 
39 #endif
40