xref: /kvm-unit-tests/lib/linux/efi.h (revision 529ab889e44dbd55ae42ba1d68a20567a531ead7)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Relevant definitions from linux/efi.h. */
3 
4 #ifndef __LINUX_UEFI_H
5 #define __LINUX_UEFI_H
6 
7 #include "libcflat.h"
8 
9 #ifndef __packed
10 # define __packed		__attribute__((__packed__))
11 #endif
12 
13 #define BITS_PER_LONG 64
14 
15 #define EFI_ERROR(a)		(((int64_t) a) < 0)
16 #define EFI_SUCCESS		0
17 #define EFI_LOAD_ERROR		( 1 | (1UL << (BITS_PER_LONG-1)))
18 #define EFI_INVALID_PARAMETER	( 2 | (1UL << (BITS_PER_LONG-1)))
19 #define EFI_UNSUPPORTED		( 3 | (1UL << (BITS_PER_LONG-1)))
20 #define EFI_BAD_BUFFER_SIZE	( 4 | (1UL << (BITS_PER_LONG-1)))
21 #define EFI_BUFFER_TOO_SMALL	( 5 | (1UL << (BITS_PER_LONG-1)))
22 #define EFI_NOT_READY		( 6 | (1UL << (BITS_PER_LONG-1)))
23 #define EFI_DEVICE_ERROR	( 7 | (1UL << (BITS_PER_LONG-1)))
24 #define EFI_WRITE_PROTECTED	( 8 | (1UL << (BITS_PER_LONG-1)))
25 #define EFI_OUT_OF_RESOURCES	( 9 | (1UL << (BITS_PER_LONG-1)))
26 #define EFI_NOT_FOUND		(14 | (1UL << (BITS_PER_LONG-1)))
27 #define EFI_TIMEOUT		(18 | (1UL << (BITS_PER_LONG-1)))
28 #define EFI_ABORTED		(21 | (1UL << (BITS_PER_LONG-1)))
29 #define EFI_SECURITY_VIOLATION	(26 | (1UL << (BITS_PER_LONG-1)))
30 
31 typedef unsigned long efi_status_t;
32 typedef u8 efi_bool_t;
33 typedef u16 efi_char16_t;		/* UNICODE character */
34 typedef u64 efi_physical_addr_t;
35 typedef void *efi_handle_t;
36 
37 #define __efiapi __attribute__((ms_abi))
38 
39 /*
40  * The UEFI spec and EDK2 reference implementation both define EFI_GUID as
41  * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment
42  * is 32 bits not 8 bits like our guid_t. In some cases (i.e., on 32-bit ARM),
43  * this means that firmware services invoked by the kernel may assume that
44  * efi_guid_t* arguments are 32-bit aligned, and use memory accessors that
45  * do not tolerate misalignment. So let's set the minimum alignment to 32 bits.
46  *
47  * Note that the UEFI spec as well as some comments in the EDK2 code base
48  * suggest that EFI_GUID should be 64-bit aligned, but this appears to be
49  * a mistake, given that no code seems to exist that actually enforces that
50  * or relies on it.
51  */
52 typedef struct {
53 	u8 b[16];
54 } guid_t __attribute__((aligned(__alignof__(u32))));
55 typedef guid_t efi_guid_t;
56 
57 #define EFI_GUID(a, b, c, d...) (efi_guid_t){ {					\
58 	(a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff,	\
59 	(b) & 0xff, ((b) >> 8) & 0xff,						\
60 	(c) & 0xff, ((c) >> 8) & 0xff, d } }
61 
62 #define ACPI_TABLE_GUID EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
63 
64 #define LOADED_IMAGE_PROTOCOL_GUID EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2,  0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
65 
66 typedef struct {
67 	efi_guid_t guid;
68 	void *table;
69 } efi_config_table_t;
70 
71 /*
72  * Generic EFI table header
73  */
74 typedef	struct {
75 	u64 signature;
76 	u32 revision;
77 	u32 headersize;
78 	u32 crc32;
79 	u32 reserved;
80 } efi_table_hdr_t;
81 
82 /*
83  * Memory map descriptor:
84  */
85 
86 /* Memory types: */
87 #define EFI_RESERVED_TYPE		 0
88 #define EFI_LOADER_CODE			 1
89 #define EFI_LOADER_DATA			 2
90 #define EFI_BOOT_SERVICES_CODE		 3
91 #define EFI_BOOT_SERVICES_DATA		 4
92 #define EFI_RUNTIME_SERVICES_CODE	 5
93 #define EFI_RUNTIME_SERVICES_DATA	 6
94 #define EFI_CONVENTIONAL_MEMORY		 7
95 #define EFI_UNUSABLE_MEMORY		 8
96 #define EFI_ACPI_RECLAIM_MEMORY		 9
97 #define EFI_ACPI_MEMORY_NVS		10
98 #define EFI_MEMORY_MAPPED_IO		11
99 #define EFI_MEMORY_MAPPED_IO_PORT_SPACE	12
100 #define EFI_PAL_CODE			13
101 #define EFI_PERSISTENT_MEMORY		14
102 #define EFI_MAX_MEMORY_TYPE		15
103 
104 /* Attribute values: */
105 #define EFI_MEMORY_UC		((u64)0x0000000000000001ULL)	/* uncached */
106 #define EFI_MEMORY_WC		((u64)0x0000000000000002ULL)	/* write-coalescing */
107 #define EFI_MEMORY_WT		((u64)0x0000000000000004ULL)	/* write-through */
108 #define EFI_MEMORY_WB		((u64)0x0000000000000008ULL)	/* write-back */
109 #define EFI_MEMORY_UCE		((u64)0x0000000000000010ULL)	/* uncached, exported */
110 #define EFI_MEMORY_WP		((u64)0x0000000000001000ULL)	/* write-protect */
111 #define EFI_MEMORY_RP		((u64)0x0000000000002000ULL)	/* read-protect */
112 #define EFI_MEMORY_XP		((u64)0x0000000000004000ULL)	/* execute-protect */
113 #define EFI_MEMORY_NV		((u64)0x0000000000008000ULL)	/* non-volatile */
114 #define EFI_MEMORY_MORE_RELIABLE \
115 				((u64)0x0000000000010000ULL)	/* higher reliability */
116 #define EFI_MEMORY_RO		((u64)0x0000000000020000ULL)	/* read-only */
117 #define EFI_MEMORY_SP		((u64)0x0000000000040000ULL)	/* soft reserved */
118 #define EFI_MEMORY_CPU_CRYPTO	((u64)0x0000000000080000ULL)	/* supports encryption */
119 #define EFI_MEMORY_RUNTIME	((u64)0x8000000000000000ULL)	/* range requires runtime mapping */
120 #define EFI_MEMORY_DESCRIPTOR_VERSION	1
121 
122 #define EFI_PAGE_SHIFT		12
123 #define EFI_PAGE_SIZE		(1UL << EFI_PAGE_SHIFT)
124 #define EFI_PAGES_MAX		(U64_MAX >> EFI_PAGE_SHIFT)
125 
126 typedef struct {
127 	u32 type;
128 	u32 pad;
129 	u64 phys_addr;
130 	u64 virt_addr;
131 	u64 num_pages;
132 	u64 attribute;
133 } efi_memory_desc_t;
134 
135 typedef struct {
136 	efi_guid_t guid;
137 	u32 headersize;
138 	u32 flags;
139 	u32 imagesize;
140 } efi_capsule_header_t;
141 
142 /*
143  * EFI capsule flags
144  */
145 #define EFI_CAPSULE_PERSIST_ACROSS_RESET	0x00010000
146 #define EFI_CAPSULE_POPULATE_SYSTEM_TABLE	0x00020000
147 #define EFI_CAPSULE_INITIATE_RESET		0x00040000
148 
149 struct capsule_info {
150 	efi_capsule_header_t	header;
151 	efi_capsule_header_t	*capsule;
152 	int			reset_type;
153 	long			index;
154 	size_t			count;
155 	size_t			total_size;
156 	struct page		**pages;
157 	phys_addr_t		*phys;
158 	size_t			page_bytes_remain;
159 };
160 
161 int __efi_capsule_setup_info(struct capsule_info *cap_info);
162 
163 /*
164  * Types and defines for Time Services
165  */
166 #define EFI_TIME_ADJUST_DAYLIGHT 0x1
167 #define EFI_TIME_IN_DAYLIGHT     0x2
168 #define EFI_UNSPECIFIED_TIMEZONE 0x07ff
169 
170 typedef struct {
171 	u16 year;
172 	u8 month;
173 	u8 day;
174 	u8 hour;
175 	u8 minute;
176 	u8 second;
177 	u8 pad1;
178 	u32 nanosecond;
179 	s16 timezone;
180 	u8 daylight;
181 	u8 pad2;
182 } efi_time_t;
183 
184 typedef struct {
185 	u32 resolution;
186 	u32 accuracy;
187 	u8 sets_to_zero;
188 } efi_time_cap_t;
189 
190 typedef void *efi_event_t;
191 /* Note that notifications won't work in mixed mode */
192 typedef void (__efiapi *efi_event_notify_t)(efi_event_t, void *);
193 
194 typedef enum {
195 	EfiTimerCancel,
196 	EfiTimerPeriodic,
197 	EfiTimerRelative
198 } EFI_TIMER_DELAY;
199 
200 /*
201  * EFI Device Path information
202  */
203 #define EFI_DEV_HW			0x01
204 #define  EFI_DEV_PCI				 1
205 #define  EFI_DEV_PCCARD				 2
206 #define  EFI_DEV_MEM_MAPPED			 3
207 #define  EFI_DEV_VENDOR				 4
208 #define  EFI_DEV_CONTROLLER			 5
209 #define EFI_DEV_ACPI			0x02
210 #define   EFI_DEV_BASIC_ACPI			 1
211 #define   EFI_DEV_EXPANDED_ACPI			 2
212 #define EFI_DEV_MSG			0x03
213 #define   EFI_DEV_MSG_ATAPI			 1
214 #define   EFI_DEV_MSG_SCSI			 2
215 #define   EFI_DEV_MSG_FC			 3
216 #define   EFI_DEV_MSG_1394			 4
217 #define   EFI_DEV_MSG_USB			 5
218 #define   EFI_DEV_MSG_USB_CLASS			15
219 #define   EFI_DEV_MSG_I20			 6
220 #define   EFI_DEV_MSG_MAC			11
221 #define   EFI_DEV_MSG_IPV4			12
222 #define   EFI_DEV_MSG_IPV6			13
223 #define   EFI_DEV_MSG_INFINIBAND		 9
224 #define   EFI_DEV_MSG_UART			14
225 #define   EFI_DEV_MSG_VENDOR			10
226 #define EFI_DEV_MEDIA			0x04
227 #define   EFI_DEV_MEDIA_HARD_DRIVE		 1
228 #define   EFI_DEV_MEDIA_CDROM			 2
229 #define   EFI_DEV_MEDIA_VENDOR			 3
230 #define   EFI_DEV_MEDIA_FILE			 4
231 #define   EFI_DEV_MEDIA_PROTOCOL		 5
232 #define EFI_DEV_BIOS_BOOT		0x05
233 #define EFI_DEV_END_PATH		0x7F
234 #define EFI_DEV_END_PATH2		0xFF
235 #define   EFI_DEV_END_INSTANCE			0x01
236 #define   EFI_DEV_END_ENTIRE			0xFF
237 
238 struct efi_generic_dev_path {
239 	u8				type;
240 	u8				sub_type;
241 	u16				length;
242 } __packed;
243 
244 typedef struct efi_generic_dev_path efi_device_path_protocol_t;
245 
246 /*
247  * EFI Boot Services table
248  */
249 typedef struct {
250 	efi_table_hdr_t hdr;
251 	void *raise_tpl;
252 	void *restore_tpl;
253 	efi_status_t(__efiapi *allocate_pages)(int, int, unsigned long,
254 					       efi_physical_addr_t *);
255 	efi_status_t(__efiapi *free_pages)(efi_physical_addr_t,
256 					   unsigned long);
257 	efi_status_t(__efiapi *get_memory_map)(unsigned long *, void *,
258 					       unsigned long *,
259 					       unsigned long *, u32 *);
260 	efi_status_t(__efiapi *allocate_pool)(int, unsigned long,
261 					      void **);
262 	efi_status_t(__efiapi *free_pool)(void *);
263 	efi_status_t(__efiapi *create_event)(u32, unsigned long,
264 					     efi_event_notify_t, void *,
265 					     efi_event_t *);
266 	efi_status_t(__efiapi *set_timer)(efi_event_t,
267 					  EFI_TIMER_DELAY, u64);
268 	efi_status_t(__efiapi *wait_for_event)(unsigned long,
269 					       efi_event_t *,
270 					       unsigned long *);
271 	void *signal_event;
272 	efi_status_t(__efiapi *close_event)(efi_event_t);
273 	void *check_event;
274 	void *install_protocol_interface;
275 	void *reinstall_protocol_interface;
276 	void *uninstall_protocol_interface;
277 	efi_status_t(__efiapi *handle_protocol)(efi_handle_t,
278 						efi_guid_t *, void **);
279 	void *__reserved;
280 	void *register_protocol_notify;
281 	efi_status_t(__efiapi *locate_handle)(int, efi_guid_t *,
282 					      void *, unsigned long *,
283 					      efi_handle_t *);
284 	efi_status_t(__efiapi *locate_device_path)(efi_guid_t *,
285 						   efi_device_path_protocol_t **,
286 						   efi_handle_t *);
287 	efi_status_t(__efiapi *install_configuration_table)(efi_guid_t *,
288 							    void *);
289 	void *load_image;
290 	void *start_image;
291 	efi_status_t(__efiapi *exit)(efi_handle_t,
292 				     efi_status_t,
293 				     unsigned long,
294 				     efi_char16_t *);
295 	void *unload_image;
296 	efi_status_t(__efiapi *exit_boot_services)(efi_handle_t,
297 						   unsigned long);
298 	void *get_next_monotonic_count;
299 	efi_status_t(__efiapi *stall)(unsigned long);
300 	void *set_watchdog_timer;
301 	void *connect_controller;
302 	efi_status_t(__efiapi *disconnect_controller)(efi_handle_t,
303 						      efi_handle_t,
304 						      efi_handle_t);
305 	void *open_protocol;
306 	void *close_protocol;
307 	void *open_protocol_information;
308 	void *protocols_per_handle;
309 	void *locate_handle_buffer;
310 	efi_status_t(__efiapi *locate_protocol)(efi_guid_t *, void *,
311 						void **);
312 	void *install_multiple_protocol_interfaces;
313 	void *uninstall_multiple_protocol_interfaces;
314 	void *calculate_crc32;
315 	void *copy_mem;
316 	void *set_mem;
317 	void *create_event_ex;
318 } efi_boot_services_t;
319 
320 /*
321  * Types and defines for EFI ResetSystem
322  */
323 #define EFI_RESET_COLD 0
324 #define EFI_RESET_WARM 1
325 #define EFI_RESET_SHUTDOWN 2
326 
327 /*
328  * EFI Runtime Services table
329  */
330 #define EFI_RUNTIME_SERVICES_SIGNATURE ((u64)0x5652453544e5552ULL)
331 #define EFI_RUNTIME_SERVICES_REVISION  0x00010000
332 
333 typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
334 typedef efi_status_t efi_set_time_t (efi_time_t *tm);
335 typedef efi_status_t efi_get_wakeup_time_t (efi_bool_t *enabled, efi_bool_t *pending,
336 					    efi_time_t *tm);
337 typedef efi_status_t efi_set_wakeup_time_t (efi_bool_t enabled, efi_time_t *tm);
338 typedef efi_status_t efi_get_variable_t (efi_char16_t *name, efi_guid_t *vendor, u32 *attr,
339 					 unsigned long *data_size, void *data);
340 typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char16_t *name,
341 					      efi_guid_t *vendor);
342 typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor,
343 					 u32 attr, unsigned long data_size,
344 					 void *data);
345 typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
346 typedef void efi_reset_system_t (int reset_type, efi_status_t status,
347 				 unsigned long data_size, efi_char16_t *data);
348 typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_size,
349 						unsigned long descriptor_size,
350 						u32 descriptor_version,
351 						efi_memory_desc_t *virtual_map);
352 typedef efi_status_t efi_query_variable_info_t(u32 attr,
353 					       u64 *storage_space,
354 					       u64 *remaining_space,
355 					       u64 *max_variable_size);
356 typedef efi_status_t efi_update_capsule_t(efi_capsule_header_t **capsules,
357 					  unsigned long count,
358 					  unsigned long sg_list);
359 typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
360 					      unsigned long count,
361 					      u64 *max_size,
362 					      int *reset_type);
363 typedef efi_status_t efi_query_variable_store_t(u32 attributes,
364 						unsigned long size,
365 						bool nonblocking);
366 
367 typedef struct {
368 	efi_table_hdr_t				hdr;
369 	efi_get_time_t __efiapi			*get_time;
370 	efi_set_time_t __efiapi			*set_time;
371 	efi_get_wakeup_time_t __efiapi		*get_wakeup_time;
372 	efi_set_wakeup_time_t __efiapi		*set_wakeup_time;
373 	efi_set_virtual_address_map_t __efiapi	*set_virtual_address_map;
374 	void					*convert_pointer;
375 	efi_get_variable_t __efiapi		*get_variable;
376 	efi_get_next_variable_t __efiapi	*get_next_variable;
377 	efi_set_variable_t __efiapi		*set_variable;
378 	efi_get_next_high_mono_count_t __efiapi	*get_next_high_mono_count;
379 	efi_reset_system_t __efiapi		*reset_system;
380 	efi_update_capsule_t __efiapi		*update_capsule;
381 	efi_query_capsule_caps_t __efiapi	*query_capsule_caps;
382 	efi_query_variable_info_t __efiapi	*query_variable_info;
383 } efi_runtime_services_t;
384 
385 #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
386 
387 #define EFI_2_30_SYSTEM_TABLE_REVISION  ((2 << 16) | (30))
388 #define EFI_2_20_SYSTEM_TABLE_REVISION  ((2 << 16) | (20))
389 #define EFI_2_10_SYSTEM_TABLE_REVISION  ((2 << 16) | (10))
390 #define EFI_2_00_SYSTEM_TABLE_REVISION  ((2 << 16) | (00))
391 #define EFI_1_10_SYSTEM_TABLE_REVISION  ((1 << 16) | (10))
392 #define EFI_1_02_SYSTEM_TABLE_REVISION  ((1 << 16) | (02))
393 
394 typedef union efi_simple_text_input_protocol efi_simple_text_input_protocol_t;
395 typedef union efi_simple_text_output_protocol efi_simple_text_output_protocol_t;
396 
397 typedef struct {
398 	efi_table_hdr_t hdr;
399 	unsigned long fw_vendor;	/* physical addr of CHAR16 vendor string */
400 	u32 fw_revision;
401 	unsigned long con_in_handle;
402 	efi_simple_text_input_protocol_t *con_in;
403 	unsigned long con_out_handle;
404 	efi_simple_text_output_protocol_t *con_out;
405 	unsigned long stderr_handle;
406 	unsigned long stderr;
407 	efi_runtime_services_t *runtime;
408 	efi_boot_services_t *boottime;
409 	unsigned long nr_tables;
410 	unsigned long tables;
411 } efi_system_table_t;
412 
413 struct efi_boot_memmap {
414 	efi_memory_desc_t       **map;
415 	unsigned long           *map_size;
416 	unsigned long           *desc_size;
417 	u32                     *desc_ver;
418 	unsigned long           *key_ptr;
419 	unsigned long           *buff_size;
420 };
421 
422 #define __aligned_u64 u64 __attribute__((aligned(8)))
423 
424 struct efi_loaded_image_64 {
425 	u32			revision;
426 	efi_handle_t		parent_handle;
427 	efi_system_table_t	*system_table;
428 	efi_handle_t		device_handle;
429 	void			*file_path;
430 	void			*reserved;
431 	u32			load_options_size;
432 	void			*load_options;
433 	void			*image_base;
434 	__aligned_u64		image_size;
435 	unsigned int		image_code_type;
436 	unsigned int		image_data_type;
437 	efi_status_t		(__efiapi * unload)(efi_handle_t image_handle);
438 };
439 
440 
441 typedef struct _efi_simple_file_system_protocol efi_simple_file_system_protocol_t;
442 typedef struct _efi_file_protocol efi_file_protocol_t;
443 typedef efi_simple_file_system_protocol_t efi_file_io_interface_t;
444 typedef efi_file_protocol_t efi_file_t;
445 
446 typedef efi_status_t efi_simple_file_system_protocol_open_volume(
447 	efi_simple_file_system_protocol_t *this,
448 	efi_file_protocol_t **root);
449 
450 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID EFI_GUID(0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
451 
452 struct _efi_simple_file_system_protocol {
453 	uint64_t						revision;
454 	efi_simple_file_system_protocol_open_volume __efiapi	*open_volume;
455 };
456 
457 /* Open modes */
458 #define EFI_FILE_MODE_READ    0x0000000000000001ULL
459 #define EFI_FILE_MODE_WRITE   0x0000000000000002ULL
460 #define EFI_FILE_MODE_CREATE  0x8000000000000000ULL
461 
462 typedef efi_status_t efi_file_open(efi_file_protocol_t *this,
463 				   efi_file_protocol_t **new_handle,
464 				   efi_char16_t *file_name,
465 				   uint64_t open_mode,
466 				   uint64_t attributes);
467 typedef efi_status_t efi_file_close(efi_file_protocol_t *this);
468 typedef efi_status_t efi_file_delete(efi_file_protocol_t *this);
469 typedef efi_status_t efi_file_read(efi_file_protocol_t *this,
470 				   uint64_t *buffer_size,
471 				   void *buffer);
472 typedef efi_status_t efi_file_write(efi_file_protocol_t *this,
473 				    uint64_t *buffer_size,
474 				    void *buffer);
475 typedef efi_status_t efi_file_set_position(efi_file_protocol_t *this,
476 					   uint64_t position);
477 typedef efi_status_t efi_file_get_position(efi_file_protocol_t *this,
478 					   uint64_t *position);
479 typedef efi_status_t efi_file_get_info(efi_file_protocol_t *this,
480 				       efi_guid_t *information_type,
481 				       uint64_t *buffer_size,
482 				       void *buffer);
483 typedef efi_status_t efi_file_set_info(efi_file_protocol_t *this,
484 				       efi_guid_t *information_type,
485 				       uint64_t *buffer_size,
486 				       void *buffer);
487 typedef efi_status_t efi_file_flush(efi_file_protocol_t *this);
488 
489 typedef struct {
490 	efi_event_t event;
491 	efi_status_t status;
492 	uint64_t buffer_size;
493 	void *buffer;
494 } efi_file_io_open_t;
495 
496 typedef efi_status_t efi_file_open_ex(efi_file_protocol_t *this,
497 				      efi_file_protocol_t **new_handle,
498 				      efi_char16_t *file_name,
499 				      uint64_t open_mode,
500 				      uint64_t attributes,
501 				      efi_file_io_open_t *token);
502 typedef efi_status_t efi_file_read_ex(efi_file_protocol_t *this,
503 				      efi_file_io_open_t *token);
504 typedef efi_status_t efi_file_write_ex(efi_file_protocol_t *this,
505 				       efi_file_io_open_t *token);
506 typedef efi_status_t efi_file_flush_ex(efi_file_protocol_t *this,
507 				       efi_file_io_open_t *token);
508 
509 struct _efi_file_protocol {
510 	uint64_t			revision;
511 	efi_file_open __efiapi		*open;
512 	efi_file_close __efiapi		*close;
513 	efi_file_delete __efiapi	*delete;
514 	efi_file_read __efiapi		*read;
515 	efi_file_write __efiapi		*write;
516 	efi_file_get_position __efiapi	*get_position;
517 	efi_file_set_position __efiapi	*set_position;
518 	efi_file_get_info __efiapi	*get_info;
519 	efi_file_set_info __efiapi	*set_info;
520 	efi_file_flush __efiapi		*flush;
521 	efi_file_open_ex __efiapi	*open_ex;
522 	efi_file_read_ex __efiapi	*read_ex;
523 	efi_file_write_ex __efiapi	*write_ex;
524 	efi_file_flush_ex __efiapi	*flush_ex;
525 };
526 
527 #define EFI_FILE_INFO_ID EFI_GUID(0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
528 
529 typedef struct {
530 	uint64_t	size;
531 	uint64_t	file_size;
532 	uint64_t	physical_size;
533 	efi_time_t	create_time;
534 	efi_time_t	last_access_time;
535 	efi_time_t	modification_time;
536 	uint64_t	attributes;
537 	efi_char16_t	file_name[1];
538 } efi_file_info_t;
539 
540 #define efi_bs_call(func, ...) efi_system_table->boottime->func(__VA_ARGS__)
541 #define efi_rs_call(func, ...) efi_system_table->runtime->func(__VA_ARGS__)
542 
543 #endif /* __LINUX_UEFI_H */
544