1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * EFI Test driver Header
4  *
5  * Copyright(C) 2012-2016 Canonical Ltd.
6  *
7  */
8 
9 #ifndef _DRIVERS_FIRMWARE_EFI_TEST_H_
10 #define _DRIVERS_FIRMWARE_EFI_TEST_H_
11 
12 #include <linux/efi.h>
13 
14 struct efi_getvariable {
15 	efi_char16_t	*variable_name;
16 	efi_guid_t	*vendor_guid;
17 	u32		*attributes;
18 	unsigned long	*data_size;
19 	void		*data;
20 	efi_status_t	*status;
21 } __packed;
22 
23 struct efi_setvariable {
24 	efi_char16_t	*variable_name;
25 	efi_guid_t	*vendor_guid;
26 	u32		attributes;
27 	unsigned long	data_size;
28 	void		*data;
29 	efi_status_t	*status;
30 } __packed;
31 
32 struct efi_getnextvariablename {
33 	unsigned long	*variable_name_size;
34 	efi_char16_t	*variable_name;
35 	efi_guid_t	*vendor_guid;
36 	efi_status_t	*status;
37 } __packed;
38 
39 struct efi_queryvariableinfo {
40 	u32		attributes;
41 	u64		*maximum_variable_storage_size;
42 	u64		*remaining_variable_storage_size;
43 	u64		*maximum_variable_size;
44 	efi_status_t	*status;
45 } __packed;
46 
47 struct efi_gettime {
48 	efi_time_t	*time;
49 	efi_time_cap_t	*capabilities;
50 	efi_status_t	*status;
51 } __packed;
52 
53 struct efi_settime {
54 	efi_time_t	*time;
55 	efi_status_t	*status;
56 } __packed;
57 
58 struct efi_getwakeuptime {
59 	efi_bool_t	*enabled;
60 	efi_bool_t	*pending;
61 	efi_time_t	*time;
62 	efi_status_t	*status;
63 } __packed;
64 
65 struct efi_setwakeuptime {
66 	efi_bool_t	enabled;
67 	efi_time_t	*time;
68 	efi_status_t	*status;
69 } __packed;
70 
71 struct efi_getnexthighmonotoniccount {
72 	u32		*high_count;
73 	efi_status_t	*status;
74 } __packed;
75 
76 struct efi_querycapsulecapabilities {
77 	efi_capsule_header_t	**capsule_header_array;
78 	unsigned long		capsule_count;
79 	u64			*maximum_capsule_size;
80 	int			*reset_type;
81 	efi_status_t		*status;
82 } __packed;
83 
84 #define EFI_RUNTIME_GET_VARIABLE \
85 	_IOWR('p', 0x01, struct efi_getvariable)
86 #define EFI_RUNTIME_SET_VARIABLE \
87 	_IOW('p', 0x02, struct efi_setvariable)
88 
89 #define EFI_RUNTIME_GET_TIME \
90 	_IOR('p', 0x03, struct efi_gettime)
91 #define EFI_RUNTIME_SET_TIME \
92 	_IOW('p', 0x04, struct efi_settime)
93 
94 #define EFI_RUNTIME_GET_WAKETIME \
95 	_IOR('p', 0x05, struct efi_getwakeuptime)
96 #define EFI_RUNTIME_SET_WAKETIME \
97 	_IOW('p', 0x06, struct efi_setwakeuptime)
98 
99 #define EFI_RUNTIME_GET_NEXTVARIABLENAME \
100 	_IOWR('p', 0x07, struct efi_getnextvariablename)
101 
102 #define EFI_RUNTIME_QUERY_VARIABLEINFO \
103 	_IOR('p', 0x08, struct efi_queryvariableinfo)
104 
105 #define EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT \
106 	_IOR('p', 0x09, struct efi_getnexthighmonotoniccount)
107 
108 #define EFI_RUNTIME_QUERY_CAPSULECAPABILITIES \
109 	_IOR('p', 0x0A, struct efi_querycapsulecapabilities)
110 
111 #endif /* _DRIVERS_FIRMWARE_EFI_TEST_H_ */
112