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 struct efi_resetsystem {
85 	int			reset_type;
86 	efi_status_t		status;
87 	unsigned long		data_size;
88 	efi_char16_t		*data;
89 } __packed;
90 
91 #define EFI_RUNTIME_GET_VARIABLE \
92 	_IOWR('p', 0x01, struct efi_getvariable)
93 #define EFI_RUNTIME_SET_VARIABLE \
94 	_IOW('p', 0x02, struct efi_setvariable)
95 
96 #define EFI_RUNTIME_GET_TIME \
97 	_IOR('p', 0x03, struct efi_gettime)
98 #define EFI_RUNTIME_SET_TIME \
99 	_IOW('p', 0x04, struct efi_settime)
100 
101 #define EFI_RUNTIME_GET_WAKETIME \
102 	_IOR('p', 0x05, struct efi_getwakeuptime)
103 #define EFI_RUNTIME_SET_WAKETIME \
104 	_IOW('p', 0x06, struct efi_setwakeuptime)
105 
106 #define EFI_RUNTIME_GET_NEXTVARIABLENAME \
107 	_IOWR('p', 0x07, struct efi_getnextvariablename)
108 
109 #define EFI_RUNTIME_QUERY_VARIABLEINFO \
110 	_IOR('p', 0x08, struct efi_queryvariableinfo)
111 
112 #define EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT \
113 	_IOR('p', 0x09, struct efi_getnexthighmonotoniccount)
114 
115 #define EFI_RUNTIME_QUERY_CAPSULECAPABILITIES \
116 	_IOR('p', 0x0A, struct efi_querycapsulecapabilities)
117 
118 #define EFI_RUNTIME_RESET_SYSTEM \
119 	_IOW('p', 0x0B, struct efi_resetsystem)
120 
121 #endif /* _DRIVERS_FIRMWARE_EFI_TEST_H_ */
122