]> git.ipfire.org Git - thirdparty/u-boot.git/blob - include/efi_loader.h
Merge tag 'u-boot-dfu-20240419' of https://source.denx.de/u-boot/custodians/u-boot-dfu
[thirdparty/u-boot.git] / include / efi_loader.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * EFI application loader
4 *
5 * Copyright (c) 2016 Alexander Graf
6 */
7
8 #ifndef _EFI_LOADER_H
9 #define _EFI_LOADER_H 1
10
11 #include <blk.h>
12 #include <event.h>
13 #include <log.h>
14 #include <part_efi.h>
15 #include <efi_api.h>
16 #include <image.h>
17 #include <pe.h>
18 #include <linux/list.h>
19 #include <linux/oid_registry.h>
20
21 struct blk_desc;
22 struct jmp_buf_data;
23
24 static inline int guidcmp(const void *g1, const void *g2)
25 {
26 return memcmp(g1, g2, sizeof(efi_guid_t));
27 }
28
29 static inline void *guidcpy(void *dst, const void *src)
30 {
31 return memcpy(dst, src, sizeof(efi_guid_t));
32 }
33
34 #if CONFIG_IS_ENABLED(EFI_LOADER)
35
36 /**
37 * __efi_runtime_data - declares a non-const variable for EFI runtime section
38 *
39 * This macro indicates that a variable is non-const and should go into the
40 * EFI runtime section, and thus still be available when the OS is running.
41 *
42 * Only use on variables not declared const.
43 *
44 * Example:
45 *
46 * ::
47 *
48 * static __efi_runtime_data my_computed_table[256];
49 */
50 #define __efi_runtime_data __section(".data.efi_runtime")
51
52 /**
53 * __efi_runtime_rodata - declares a read-only variable for EFI runtime section
54 *
55 * This macro indicates that a variable is read-only (const) and should go into
56 * the EFI runtime section, and thus still be available when the OS is running.
57 *
58 * Only use on variables also declared const.
59 *
60 * Example:
61 *
62 * ::
63 *
64 * static const __efi_runtime_rodata my_const_table[] = { 1, 2, 3 };
65 */
66 #define __efi_runtime_rodata __section(".rodata.efi_runtime")
67
68 /**
69 * __efi_runtime - declares a function for EFI runtime section
70 *
71 * This macro indicates that a function should go into the EFI runtime section,
72 * and thus still be available when the OS is running.
73 *
74 * Example:
75 *
76 * ::
77 *
78 * static __efi_runtime compute_my_table(void);
79 */
80 #define __efi_runtime __section(".text.efi_runtime")
81
82 /*
83 * Call this with mmio_ptr as the _pointer_ to a pointer to an MMIO region
84 * to make it available at runtime
85 */
86 efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len);
87
88 /*
89 * Special case handler for error/abort that just tries to dtrt to get
90 * back to u-boot world
91 */
92 void efi_restore_gd(void);
93
94 /* Called by networking code to memorize the dhcp ack package */
95 void efi_net_set_dhcp_ack(void *pkt, int len);
96 /* Print information about all loaded images */
97 void efi_print_image_infos(void *pc);
98
99 /* Hook at initialization */
100 efi_status_t efi_launch_capsules(void);
101
102 #else /* CONFIG_IS_ENABLED(EFI_LOADER) */
103
104 /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
105 #define __efi_runtime_data
106 #define __efi_runtime_rodata
107 #define __efi_runtime
108 static inline efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
109 {
110 return EFI_SUCCESS;
111 }
112
113 /* No loader configured, stub out EFI_ENTRY */
114 static inline void efi_restore_gd(void) { }
115 static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
116 static inline void efi_print_image_infos(void *pc) { }
117 static inline efi_status_t efi_launch_capsules(void)
118 {
119 return EFI_SUCCESS;
120 }
121
122 #endif /* CONFIG_IS_ENABLED(EFI_LOADER) */
123
124 #if CONFIG_IS_ENABLED(EFI_BINARY_EXEC)
125 /* Call this to unset the current device name */
126 void efi_clear_bootdev(void);
127 /* Call this to set the current device name */
128 void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
129 void *buffer, size_t buffer_size);
130 #else
131 static inline void efi_clear_bootdev(void) { }
132
133 static inline void efi_set_bootdev(const char *dev, const char *devnr,
134 const char *path, void *buffer,
135 size_t buffer_size) { }
136 #endif
137
138 /* Maximum number of configuration tables */
139 #define EFI_MAX_CONFIGURATION_TABLES 16
140
141 /* GUID used by the root node */
142 #define U_BOOT_GUID \
143 EFI_GUID(0xe61d73b9, 0xa384, 0x4acc, \
144 0xae, 0xab, 0x82, 0xe8, 0x28, 0xf3, 0x62, 0x8b)
145 /* GUID used as root for blkmap devices */
146 #define U_BOOT_BLKMAP_DEV_GUID \
147 EFI_GUID(0x4cad859d, 0xd644, 0x42ff, \
148 0x87, 0x0b, 0xc0, 0x2e, 0xac, 0x05, 0x58, 0x63)
149 /* GUID used as host device on sandbox */
150 #define U_BOOT_HOST_DEV_GUID \
151 EFI_GUID(0xbbe4e671, 0x5773, 0x4ea1, \
152 0x9a, 0xab, 0x3a, 0x7d, 0xbf, 0x40, 0xc4, 0x82)
153 /* GUID used as root for virtio devices */
154 #define U_BOOT_VIRTIO_DEV_GUID \
155 EFI_GUID(0x63293792, 0xadf5, 0x9325, \
156 0xb9, 0x9f, 0x4e, 0x0e, 0x45, 0x5c, 0x1b, 0x1e)
157
158 /* GUID for the auto generated boot menu entry */
159 #define EFICONFIG_AUTO_GENERATED_ENTRY_GUID \
160 EFI_GUID(0x8108ac4e, 0x9f11, 0x4d59, \
161 0x85, 0x0e, 0xe2, 0x1a, 0x52, 0x2c, 0x59, 0xb2)
162
163 /* Use internal device tree when starting UEFI application */
164 #define EFI_FDT_USE_INTERNAL NULL
165
166 /* Root node */
167 extern efi_handle_t efi_root;
168
169 /* Set to EFI_SUCCESS when initialized */
170 extern efi_status_t efi_obj_list_initialized;
171
172 /* Flag used by the selftest to avoid detaching devices in ExitBootServices() */
173 extern bool efi_st_keep_devices;
174
175 /* EFI system partition */
176 extern struct efi_system_partition {
177 enum uclass_id uclass_id;
178 int devnum;
179 u8 part;
180 } efi_system_partition;
181
182 int __efi_entry_check(void);
183 int __efi_exit_check(void);
184 const char *__efi_nesting(void);
185 const char *__efi_nesting_inc(void);
186 const char *__efi_nesting_dec(void);
187
188 /*
189 * Enter the u-boot world from UEFI:
190 */
191 #define EFI_ENTRY(format, ...) do { \
192 assert(__efi_entry_check()); \
193 debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
194 __func__, ##__VA_ARGS__); \
195 } while(0)
196
197 /*
198 * Exit the u-boot world back to UEFI:
199 */
200 #define EFI_EXIT(ret) ({ \
201 typeof(ret) _r = ret; \
202 debug("%sEFI: Exit: %s: %u\n", __efi_nesting_dec(), \
203 __func__, (u32)((uintptr_t) _r & ~EFI_ERROR_MASK)); \
204 assert(__efi_exit_check()); \
205 _r; \
206 })
207
208 /*
209 * Call non-void UEFI function from u-boot and retrieve return value:
210 */
211 #define EFI_CALL(exp) ({ \
212 debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \
213 assert(__efi_exit_check()); \
214 typeof(exp) _r = exp; \
215 assert(__efi_entry_check()); \
216 debug("%sEFI: %lu returned by %s\n", __efi_nesting_dec(), \
217 (unsigned long)((uintptr_t)_r & ~EFI_ERROR_MASK), #exp); \
218 _r; \
219 })
220
221 /*
222 * Call void UEFI function from u-boot:
223 */
224 #define EFI_CALL_VOID(exp) do { \
225 debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \
226 assert(__efi_exit_check()); \
227 exp; \
228 assert(__efi_entry_check()); \
229 debug("%sEFI: Return From: %s\n", __efi_nesting_dec(), #exp); \
230 } while(0)
231
232 /*
233 * Write an indented message with EFI prefix
234 */
235 #define EFI_PRINT(format, ...) ({ \
236 debug("%sEFI: " format, __efi_nesting(), \
237 ##__VA_ARGS__); \
238 })
239
240 #ifdef CONFIG_SYS_CACHELINE_SIZE
241 #define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE
242 #else
243 /* Just use the greatest cache flush alignment requirement I'm aware of */
244 #define EFI_CACHELINE_SIZE 128
245 #endif
246
247 /* max bootmenu title size for volume selection */
248 #define BOOTMENU_DEVICE_NAME_MAX 16
249
250 /* Key identifying current memory map */
251 extern efi_uintn_t efi_memory_map_key;
252
253 extern struct efi_runtime_services efi_runtime_services;
254 extern struct efi_system_table systab;
255
256 extern struct efi_simple_text_output_protocol efi_con_out;
257 extern struct efi_simple_text_input_protocol efi_con_in;
258 extern struct efi_console_control_protocol efi_console_control;
259 extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
260 /* implementation of the EFI_DEVICE_PATH_UTILITIES_PROTOCOL */
261 extern const struct efi_device_path_utilities_protocol
262 efi_device_path_utilities;
263 /* current version of the EFI_UNICODE_COLLATION_PROTOCOL */
264 extern const struct efi_unicode_collation_protocol
265 efi_unicode_collation_protocol2;
266 extern const struct efi_hii_config_routing_protocol efi_hii_config_routing;
267 extern const struct efi_hii_config_access_protocol efi_hii_config_access;
268 extern const struct efi_hii_database_protocol efi_hii_database;
269 extern const struct efi_hii_string_protocol efi_hii_string;
270
271 uint16_t *efi_dp_str(struct efi_device_path *dp);
272
273 /* GUID for the auto generated boot menu entry */
274 extern const efi_guid_t efi_guid_bootmenu_auto_generated;
275
276 /* GUID of the U-Boot root node */
277 extern const efi_guid_t efi_u_boot_guid;
278 #ifdef CONFIG_SANDBOX
279 /* GUID of U-Boot host device on sandbox */
280 extern const efi_guid_t efi_guid_host_dev;
281 #endif
282 /* GUID of the EFI_BLOCK_IO_PROTOCOL */
283 extern const efi_guid_t efi_block_io_guid;
284 extern const efi_guid_t efi_global_variable_guid;
285 extern const efi_guid_t efi_guid_console_control;
286 extern const efi_guid_t efi_guid_device_path;
287 /* GUID of the EFI system partition */
288 extern const efi_guid_t efi_system_partition_guid;
289 /* GUID of the EFI_DRIVER_BINDING_PROTOCOL */
290 extern const efi_guid_t efi_guid_driver_binding_protocol;
291 /* event group ExitBootServices() invoked */
292 extern const efi_guid_t efi_guid_event_group_exit_boot_services;
293 /* event group SetVirtualAddressMap() invoked */
294 extern const efi_guid_t efi_guid_event_group_virtual_address_change;
295 /* event group memory map changed */
296 extern const efi_guid_t efi_guid_event_group_memory_map_change;
297 /* event group boot manager about to boot */
298 extern const efi_guid_t efi_guid_event_group_ready_to_boot;
299 /* event group ResetSystem() invoked (before ExitBootServices) */
300 extern const efi_guid_t efi_guid_event_group_reset_system;
301 /* event group return to efibootmgr */
302 extern const efi_guid_t efi_guid_event_group_return_to_efibootmgr;
303 /* GUID of the device tree table */
304 extern const efi_guid_t efi_guid_fdt;
305 extern const efi_guid_t efi_guid_loaded_image;
306 extern const efi_guid_t efi_guid_loaded_image_device_path;
307 extern const efi_guid_t efi_guid_device_path_to_text_protocol;
308 extern const efi_guid_t efi_simple_file_system_protocol_guid;
309 extern const efi_guid_t efi_file_info_guid;
310 /* GUID for file system information */
311 extern const efi_guid_t efi_file_system_info_guid;
312 extern const efi_guid_t efi_guid_device_path_utilities_protocol;
313 /* GUID of the deprecated Unicode collation protocol */
314 extern const efi_guid_t efi_guid_unicode_collation_protocol;
315 /* GUIDs of the Load File and Load File2 protocol */
316 extern const efi_guid_t efi_guid_load_file_protocol;
317 extern const efi_guid_t efi_guid_load_file2_protocol;
318 /* GUID of the Unicode collation protocol */
319 extern const efi_guid_t efi_guid_unicode_collation_protocol2;
320 extern const efi_guid_t efi_guid_hii_config_routing_protocol;
321 extern const efi_guid_t efi_guid_hii_config_access_protocol;
322 extern const efi_guid_t efi_guid_hii_database_protocol;
323 extern const efi_guid_t efi_guid_hii_string_protocol;
324 /* GUIDs for authentication */
325 extern const efi_guid_t efi_guid_image_security_database;
326 extern const efi_guid_t efi_guid_sha256;
327 extern const efi_guid_t efi_guid_cert_x509;
328 extern const efi_guid_t efi_guid_cert_x509_sha256;
329 extern const efi_guid_t efi_guid_cert_x509_sha384;
330 extern const efi_guid_t efi_guid_cert_x509_sha512;
331 extern const efi_guid_t efi_guid_cert_type_pkcs7;
332
333 /* GUID of RNG protocol */
334 extern const efi_guid_t efi_guid_rng_protocol;
335 /* GUID of capsule update result */
336 extern const efi_guid_t efi_guid_capsule_report;
337 /* GUID of firmware management protocol */
338 extern const efi_guid_t efi_guid_firmware_management_protocol;
339 /* GUID for the ESRT */
340 extern const efi_guid_t efi_esrt_guid;
341 /* GUID of the SMBIOS table */
342 extern const efi_guid_t smbios_guid;
343 extern const efi_guid_t smbios3_guid;
344 /*GUID of console */
345 extern const efi_guid_t efi_guid_text_input_protocol;
346 extern const efi_guid_t efi_guid_text_output_protocol;
347
348 /**
349 * struct efi_open_protocol_info_item - open protocol info item
350 *
351 * When a protocol is opened a open protocol info entry is created.
352 * These are maintained in a list.
353 *
354 * @link: link to the list of open protocol info entries of a protocol
355 * @info: information about the opening of a protocol
356 */
357 struct efi_open_protocol_info_item {
358 struct list_head link;
359 struct efi_open_protocol_info_entry info;
360 };
361
362 /**
363 * struct efi_handler - single protocol interface of a handle
364 *
365 * When the UEFI payload wants to open a protocol on an object to get its
366 * interface (usually a struct with callback functions), this struct maps the
367 * protocol GUID to the respective protocol interface
368 *
369 * @link: link to the list of protocols of a handle
370 * @guid: GUID of the protocol
371 * @protocol_interface: protocol interface
372 * @open_infos: link to the list of open protocol info items
373 */
374 struct efi_handler {
375 struct list_head link;
376 const efi_guid_t guid;
377 void *protocol_interface;
378 struct list_head open_infos;
379 };
380
381 /**
382 * enum efi_object_type - type of EFI object
383 *
384 * In UnloadImage we must be able to identify if the handle relates to a
385 * started image.
386 */
387 enum efi_object_type {
388 /** @EFI_OBJECT_TYPE_UNDEFINED: undefined image type */
389 EFI_OBJECT_TYPE_UNDEFINED = 0,
390 /** @EFI_OBJECT_TYPE_U_BOOT_FIRMWARE: U-Boot firmware */
391 EFI_OBJECT_TYPE_U_BOOT_FIRMWARE,
392 /** @EFI_OBJECT_TYPE_LOADED_IMAGE: loaded image (not started) */
393 EFI_OBJECT_TYPE_LOADED_IMAGE,
394 /** @EFI_OBJECT_TYPE_STARTED_IMAGE: started image */
395 EFI_OBJECT_TYPE_STARTED_IMAGE,
396 };
397
398 /**
399 * struct efi_object - dereferenced EFI handle
400 *
401 * @link: pointers to put the handle into a linked list
402 * @protocols: linked list with the protocol interfaces installed on this
403 * handle
404 * @type: image type if the handle relates to an image
405 * @dev: pointer to the DM device which is associated with this EFI handle
406 *
407 * UEFI offers a flexible and expandable object model. The objects in the UEFI
408 * API are devices, drivers, and loaded images. struct efi_object is our storage
409 * structure for these objects.
410 *
411 * When including this structure into a larger structure always put it first so
412 * that when deleting a handle the whole encompassing structure can be freed.
413 *
414 * A pointer to this structure is referred to as a handle. Typedef efi_handle_t
415 * has been created for such pointers.
416 */
417 struct efi_object {
418 /* Every UEFI object is part of a global object list */
419 struct list_head link;
420 /* The list of protocols */
421 struct list_head protocols;
422 enum efi_object_type type;
423 struct udevice *dev;
424 };
425
426 enum efi_image_auth_status {
427 EFI_IMAGE_AUTH_FAILED = 0,
428 EFI_IMAGE_AUTH_PASSED,
429 };
430
431 /**
432 * struct efi_loaded_image_obj - handle of a loaded image
433 *
434 * @header: EFI object header
435 * @exit_status: exit status passed to Exit()
436 * @exit_data_size: exit data size passed to Exit()
437 * @exit_data: exit data passed to Exit()
438 * @exit_jmp: long jump buffer for returning from started image
439 * @entry: entry address of the relocated image
440 * @image_type: indicates if the image is an applicition or a driver
441 * @auth_status: indicates if the image is authenticated
442 */
443 struct efi_loaded_image_obj {
444 struct efi_object header;
445 efi_status_t *exit_status;
446 efi_uintn_t *exit_data_size;
447 u16 **exit_data;
448 struct jmp_buf_data *exit_jmp;
449 EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
450 struct efi_system_table *st);
451 u16 image_type;
452 enum efi_image_auth_status auth_status;
453 };
454
455 /**
456 * struct efi_event
457 *
458 * @link: Link to list of all events
459 * @queue_link: Link to the list of queued events
460 * @type: Type of event, see efi_create_event
461 * @notify_tpl: Task priority level of notifications
462 * @notify_function: Function to call when the event is triggered
463 * @notify_context: Data to be passed to the notify function
464 * @group: Event group
465 * @trigger_time: Period of the timer
466 * @trigger_next: Next time to trigger the timer
467 * @trigger_type: Type of timer, see efi_set_timer
468 * @is_signaled: The event occurred. The event is in the signaled state.
469 */
470 struct efi_event {
471 struct list_head link;
472 struct list_head queue_link;
473 uint32_t type;
474 efi_uintn_t notify_tpl;
475 void (EFIAPI *notify_function)(struct efi_event *event, void *context);
476 void *notify_context;
477 const efi_guid_t *group;
478 u64 trigger_next;
479 u64 trigger_time;
480 enum efi_timer_delay trigger_type;
481 bool is_signaled;
482 };
483
484 /* This list contains all UEFI objects we know of */
485 extern struct list_head efi_obj_list;
486 /* List of all events */
487 extern struct list_head efi_events;
488
489 /**
490 * struct efi_protocol_notification - handle for notified protocol
491 *
492 * When a protocol interface is installed for which an event was registered with
493 * the RegisterProtocolNotify() service this structure is used to hold the
494 * handle on which the protocol interface was installed.
495 *
496 * @link: link to list of all handles notified for this event
497 * @handle: handle on which the notified protocol interface was installed
498 */
499 struct efi_protocol_notification {
500 struct list_head link;
501 efi_handle_t handle;
502 };
503
504 /**
505 * struct efi_register_notify_event - event registered by
506 * RegisterProtocolNotify()
507 *
508 * The address of this structure serves as registration value.
509 *
510 * @link: link to list of all registered events
511 * @event: registered event. The same event may registered for multiple
512 * GUIDs.
513 * @protocol: protocol for which the event is registered
514 * @handles: linked list of all handles on which the notified protocol was
515 * installed
516 */
517 struct efi_register_notify_event {
518 struct list_head link;
519 struct efi_event *event;
520 efi_guid_t protocol;
521 struct list_head handles;
522 };
523
524 /* called at pre-initialization */
525 int efi_init_early(void);
526 /* Initialize efi execution environment */
527 efi_status_t efi_init_obj_list(void);
528 /* Append new boot option in BootOrder variable */
529 efi_status_t efi_bootmgr_append_bootorder(u16 index);
530 /* Get unused "Boot####" index */
531 efi_status_t efi_bootmgr_get_unused_bootoption(u16 *buf,
532 efi_uintn_t buf_size, u32 *index);
533 /* Generate the media device boot option */
534 efi_status_t efi_bootmgr_update_media_device_boot_option(void);
535 /* Delete selected boot option */
536 efi_status_t efi_bootmgr_delete_boot_option(u16 boot_index);
537 /* Invoke EFI boot manager */
538 efi_status_t efi_bootmgr_run(void *fdt);
539 /* search the boot option index in BootOrder */
540 bool efi_search_bootorder(u16 *bootorder, efi_uintn_t num, u32 target, u32 *index);
541 /* Set up console modes */
542 void efi_setup_console_size(void);
543 /* Set up load options from environment variable */
544 efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var,
545 u16 **load_options);
546 /* Get EFI configuration table */
547 void *efi_get_configuration_table(const efi_guid_t *guid);
548 /* Install device tree */
549 efi_status_t efi_install_fdt(void *fdt);
550 /* Execute loaded UEFI image */
551 efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options);
552 /* Run loaded UEFI image with given fdt */
553 efi_status_t efi_binary_run(void *image, size_t size, void *fdt);
554 /* Initialize variable services */
555 efi_status_t efi_init_variables(void);
556 /* Notify ExitBootServices() is called */
557 void efi_variables_boot_exit_notify(void);
558 efi_status_t efi_tcg2_notify_exit_boot_services_failed(void);
559 /* Measure efi application invocation */
560 efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj *handle);
561 /* Measure efi application exit */
562 efi_status_t efi_tcg2_measure_efi_app_exit(void);
563 /* Measure DTB */
564 efi_status_t efi_tcg2_measure_dtb(void *dtb);
565 /* Called by bootefi to initialize root node */
566 efi_status_t efi_root_node_register(void);
567 /* Called by bootefi to initialize runtime */
568 efi_status_t efi_initialize_system_table(void);
569 /* efi_runtime_detach() - detach unimplemented runtime functions */
570 void efi_runtime_detach(void);
571 /* efi_convert_pointer() - convert pointer to virtual address */
572 efi_status_t EFIAPI efi_convert_pointer(efi_uintn_t debug_disposition,
573 void **address);
574 /* Carve out DT reserved memory ranges */
575 void efi_carve_out_dt_rsv(void *fdt);
576 /* Purge unused kaslr-seed */
577 void efi_try_purge_kaslr_seed(void *fdt);
578 /* Called by bootefi to make console interface available */
579 efi_status_t efi_console_register(void);
580 /* Called by efi_init_obj_list() to proble all block devices */
581 efi_status_t efi_disks_register(void);
582 /* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */
583 efi_status_t efi_rng_register(void);
584 /* Called by efi_init_obj_list() to install EFI_TCG2_PROTOCOL */
585 efi_status_t efi_tcg2_register(void);
586 /* Called by efi_init_obj_list() to install RISCV_EFI_BOOT_PROTOCOL */
587 efi_status_t efi_riscv_register(void);
588 /* Called by efi_init_obj_list() to do initial measurement */
589 efi_status_t efi_tcg2_do_initial_measurement(void);
590 /* measure the pe-coff image, extend PCR and add Event Log */
591 efi_status_t tcg2_measure_pe_image(void *efi, u64 efi_size,
592 struct efi_loaded_image_obj *handle,
593 struct efi_loaded_image *loaded_image_info);
594 /* Create handles and protocols for the partitions of a block device */
595 int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
596 const char *uclass_idname, int diskid,
597 const char *pdevname);
598 /* Called by bootefi to make GOP (graphical) interface available */
599 efi_status_t efi_gop_register(void);
600 /* Called by bootefi to make the network interface available */
601 efi_status_t efi_net_register(void);
602 /* Called by bootefi to make the watchdog available */
603 efi_status_t efi_watchdog_register(void);
604 efi_status_t efi_initrd_register(void);
605 efi_status_t efi_initrd_deregister(void);
606 /* Called by bootefi to make SMBIOS tables available */
607 /**
608 * efi_acpi_register() - write out ACPI tables
609 *
610 * Called by bootefi to make ACPI tables available
611 *
612 * Return: 0 if OK, -ENOMEM if no memory is available for the tables
613 */
614 efi_status_t efi_acpi_register(void);
615 /**
616 * efi_smbios_register() - write out SMBIOS tables
617 *
618 * Called by bootefi to make SMBIOS tables available
619 *
620 * Return: 0 if OK, -ENOMEM if no memory is available for the tables
621 */
622 efi_status_t efi_smbios_register(void);
623
624 struct efi_simple_file_system_protocol *
625 efi_fs_from_path(struct efi_device_path *fp);
626
627 /* Called by efi_set_watchdog_timer to reset the timer */
628 efi_status_t efi_set_watchdog(unsigned long timeout);
629
630 /* Called from places to check whether a timer expired */
631 void efi_timer_check(void);
632 /* Check if a buffer contains a PE-COFF image */
633 efi_status_t efi_check_pe(void *buffer, size_t size, void **nt_header);
634 /* PE loader implementation */
635 efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle,
636 void *efi, size_t efi_size,
637 struct efi_loaded_image *loaded_image_info);
638 /* Called once to store the pristine gd pointer */
639 void efi_save_gd(void);
640 /* Call this to relocate the runtime section to an address space */
641 void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map);
642 /* Call this to get image parameters */
643 void efi_get_image_parameters(void **img_addr, size_t *img_size);
644 /* Add a new object to the object list. */
645 void efi_add_handle(efi_handle_t obj);
646 /* Create handle */
647 efi_status_t efi_create_handle(efi_handle_t *handle);
648 /* Delete handle */
649 efi_status_t efi_delete_handle(efi_handle_t obj);
650 /* Call this to validate a handle and find the EFI object for it */
651 struct efi_object *efi_search_obj(const efi_handle_t handle);
652 /* Locate device_path handle */
653 efi_status_t EFIAPI efi_locate_device_path(const efi_guid_t *protocol,
654 struct efi_device_path **device_path,
655 efi_handle_t *device);
656 /* Load image */
657 efi_status_t EFIAPI efi_load_image(bool boot_policy,
658 efi_handle_t parent_image,
659 struct efi_device_path *file_path,
660 void *source_buffer,
661 efi_uintn_t source_size,
662 efi_handle_t *image_handle);
663 /* Start image */
664 efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
665 efi_uintn_t *exit_data_size,
666 u16 **exit_data);
667 /* Unload image */
668 efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle);
669 /* Find a protocol on a handle */
670 efi_status_t efi_search_protocol(const efi_handle_t handle,
671 const efi_guid_t *protocol_guid,
672 struct efi_handler **handler);
673 /* Install new protocol on a handle */
674 efi_status_t efi_add_protocol(const efi_handle_t handle,
675 const efi_guid_t *protocol,
676 void *protocol_interface);
677 /* Open protocol */
678 efi_status_t efi_protocol_open(struct efi_handler *handler,
679 void **protocol_interface, void *agent_handle,
680 void *controller_handle, uint32_t attributes);
681
682 /* Install multiple protocol interfaces */
683 efi_status_t EFIAPI
684 efi_install_multiple_protocol_interfaces(efi_handle_t *handle, ...);
685 efi_status_t EFIAPI
686 efi_uninstall_multiple_protocol_interfaces(efi_handle_t handle, ...);
687 /* Get handles that support a given protocol */
688 efi_status_t EFIAPI efi_locate_handle_buffer(
689 enum efi_locate_search_type search_type,
690 const efi_guid_t *protocol, void *search_key,
691 efi_uintn_t *no_handles, efi_handle_t **buffer);
692 /* Close a previously opened protocol interface */
693 efi_status_t efi_close_protocol(efi_handle_t handle, const efi_guid_t *protocol,
694 efi_handle_t agent_handle,
695 efi_handle_t controller_handle);
696 /* Open a protocol interface */
697 efi_status_t EFIAPI efi_handle_protocol(efi_handle_t handle,
698 const efi_guid_t *protocol,
699 void **protocol_interface);
700 /* Call this to create an event */
701 efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
702 void (EFIAPI *notify_function) (
703 struct efi_event *event,
704 void *context),
705 void *notify_context, const efi_guid_t *group,
706 struct efi_event **event);
707 /* Call this to set a timer */
708 efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
709 uint64_t trigger_time);
710 /* Call this to signal an event */
711 void efi_signal_event(struct efi_event *event);
712
713 /* return true if the device is removable */
714 bool efi_disk_is_removable(efi_handle_t handle);
715
716 /**
717 * efi_create_simple_file_system() - create simple file system protocol
718 *
719 * Create a simple file system protocol for a partition.
720 *
721 * @desc: block device descriptor
722 * @part: partition number
723 * @dp: device path
724 * @fsp: simple file system protocol
725 * Return: status code
726 */
727 efi_status_t
728 efi_create_simple_file_system(struct blk_desc *desc, int part,
729 struct efi_device_path *dp,
730 struct efi_simple_file_system_protocol **fsp);
731
732 /* open file from device-path: */
733 struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp);
734
735 /* Registers a callback function for a notification event. */
736 efi_status_t EFIAPI efi_register_protocol_notify(const efi_guid_t *protocol,
737 struct efi_event *event,
738 void **registration);
739 efi_status_t efi_file_size(struct efi_file_handle *fh, efi_uintn_t *size);
740
741 /* get a device path from a Boot#### option */
742 struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid);
743
744 /* get len, string (used in u-boot crypto from a guid */
745 const char *guid_to_sha_str(const efi_guid_t *guid);
746 int algo_to_len(const char *algo);
747
748 int efi_link_dev(efi_handle_t handle, struct udevice *dev);
749 int efi_unlink_dev(efi_handle_t handle);
750 bool efi_varname_is_load_option(u16 *var_name16, int *index);
751 efi_status_t efi_next_variable_name(efi_uintn_t *size, u16 **buf,
752 efi_guid_t *guid);
753
754 /**
755 * efi_size_in_pages() - convert size in bytes to size in pages
756 *
757 * This macro returns the number of EFI memory pages required to hold 'size'
758 * bytes.
759 *
760 * @size: size in bytes
761 * Return: size in pages
762 */
763 #define efi_size_in_pages(size) (((size) + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT)
764 /* Allocate boot service data pool memory */
765 void *efi_alloc(size_t len);
766 /* Allocate pages on the specified alignment */
767 void *efi_alloc_aligned_pages(u64 len, int memory_type, size_t align);
768 /* More specific EFI memory allocator, called by EFI payloads */
769 efi_status_t efi_allocate_pages(enum efi_allocate_type type,
770 enum efi_memory_type memory_type,
771 efi_uintn_t pages, uint64_t *memory);
772 /* EFI memory free function. */
773 efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages);
774 /* EFI memory allocator for small allocations */
775 efi_status_t efi_allocate_pool(enum efi_memory_type pool_type,
776 efi_uintn_t size, void **buffer);
777 /* EFI pool memory free function. */
778 efi_status_t efi_free_pool(void *buffer);
779 /* Allocate and retrieve EFI memory map */
780 efi_status_t efi_get_memory_map_alloc(efi_uintn_t *map_size,
781 struct efi_mem_desc **memory_map);
782 /* Returns the EFI memory map */
783 efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
784 struct efi_mem_desc *memory_map,
785 efi_uintn_t *map_key,
786 efi_uintn_t *descriptor_size,
787 uint32_t *descriptor_version);
788 /* Adds a range into the EFI memory map */
789 efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type);
790 /* Adds a conventional range into the EFI memory map */
791 efi_status_t efi_add_conventional_memory_map(u64 ram_start, u64 ram_end,
792 u64 ram_top);
793
794 /* Called by board init to initialize the EFI drivers */
795 efi_status_t efi_driver_init(void);
796 /* Called when a block device is added */
797 int efi_disk_probe(void *ctx, struct event *event);
798 /* Called when a block device is removed */
799 int efi_disk_remove(void *ctx, struct event *event);
800 /* Called by board init to initialize the EFI memory map */
801 int efi_memory_init(void);
802 /* Adds new or overrides configuration table entry to the system table */
803 efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table);
804 /* Sets up a loaded image */
805 efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
806 struct efi_device_path *file_path,
807 struct efi_loaded_image_obj **handle_ptr,
808 struct efi_loaded_image **info_ptr);
809
810 #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
811 extern void *efi_bounce_buffer;
812 #define EFI_LOADER_BOUNCE_BUFFER_SIZE (64 * 1024 * 1024)
813 #endif
814
815 /* shorten device path */
816 struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp);
817 struct efi_device_path *efi_dp_next(const struct efi_device_path *dp);
818 int efi_dp_match(const struct efi_device_path *a,
819 const struct efi_device_path *b);
820 efi_handle_t efi_dp_find_obj(struct efi_device_path *dp,
821 const efi_guid_t *guid,
822 struct efi_device_path **rem);
823 /* get size of the first device path instance excluding end node */
824 efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp);
825 /* size of multi-instance device path excluding end node */
826 efi_uintn_t efi_dp_size(const struct efi_device_path *dp);
827 struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp);
828 struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
829 const struct efi_device_path *node);
830 /* Create a device path node of given type, sub-type, length */
831 struct efi_device_path *efi_dp_create_device_node(const u8 type,
832 const u8 sub_type,
833 const u16 length);
834 /* Append device path instance */
835 struct efi_device_path *efi_dp_append_instance(
836 const struct efi_device_path *dp,
837 const struct efi_device_path *dpi);
838 /* Get next device path instance */
839 struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp,
840 efi_uintn_t *size);
841 /* Check if a device path contains muliple instances */
842 bool efi_dp_is_multi_instance(const struct efi_device_path *dp);
843
844 struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part);
845 /* Create a device node for a block device partition. */
846 struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part);
847 struct efi_device_path *efi_dp_from_file(const struct efi_device_path *dp,
848 const char *path);
849 struct efi_device_path *efi_dp_from_eth(void);
850 struct efi_device_path *efi_dp_from_mem(uint32_t mem_type,
851 uint64_t start_address,
852 uint64_t end_address);
853 /* Determine the last device path node that is not the end node. */
854 const struct efi_device_path *efi_dp_last_node(
855 const struct efi_device_path *dp);
856 efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path,
857 struct efi_device_path **device_path,
858 struct efi_device_path **file_path);
859 struct efi_device_path *efi_dp_from_uart(void);
860 efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
861 const char *path,
862 struct efi_device_path **device,
863 struct efi_device_path **file);
864 ssize_t efi_dp_check_length(const struct efi_device_path *dp,
865 const size_t maxlen);
866
867 #define EFI_DP_TYPE(_dp, _type, _subtype) \
868 (((_dp)->type == DEVICE_PATH_TYPE_##_type) && \
869 ((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype))
870
871 /* template END node: */
872 extern const struct efi_device_path END;
873
874 /* Indicate supported runtime services */
875 efi_status_t efi_init_runtime_supported(void);
876
877 /* Update CRC32 in table header */
878 void __efi_runtime efi_update_table_header_crc32(struct efi_table_hdr *table);
879
880 /* Boards may provide the functions below to implement RTS functionality */
881
882 void __efi_runtime EFIAPI efi_reset_system(
883 enum efi_reset_type reset_type,
884 efi_status_t reset_status,
885 unsigned long data_size, void *reset_data);
886
887 /* Architecture specific initialization of the EFI subsystem */
888 efi_status_t efi_reset_system_init(void);
889
890 efi_status_t __efi_runtime EFIAPI efi_get_time(
891 struct efi_time *time,
892 struct efi_time_cap *capabilities);
893
894 efi_status_t __efi_runtime EFIAPI efi_set_time(struct efi_time *time);
895
896 /*
897 * Entry point for the tests of the EFI API.
898 * It is called by 'bootefi selftest'
899 */
900 efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
901 struct efi_system_table *systab);
902
903 efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
904 const efi_guid_t *vendor, u32 *attributes,
905 efi_uintn_t *data_size, void *data);
906 efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
907 u16 *variable_name,
908 efi_guid_t *vendor);
909 efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
910 const efi_guid_t *vendor, u32 attributes,
911 efi_uintn_t data_size, const void *data);
912
913 efi_status_t EFIAPI efi_query_variable_info(
914 u32 attributes, u64 *maximum_variable_storage_size,
915 u64 *remaining_variable_storage_size,
916 u64 *maximum_variable_size);
917
918 void *efi_get_var(const u16 *name, const efi_guid_t *vendor, efi_uintn_t *size);
919
920 /*
921 * See section 3.1.3 in the v2.7 UEFI spec for more details on
922 * the layout of EFI_LOAD_OPTION. In short it is:
923 *
924 * typedef struct _EFI_LOAD_OPTION {
925 * UINT32 Attributes;
926 * UINT16 FilePathListLength;
927 * // CHAR16 Description[]; <-- variable length, NULL terminated
928 * // EFI_DEVICE_PATH_PROTOCOL FilePathList[];
929 * <-- FilePathListLength bytes
930 * // UINT8 OptionalData[];
931 * } EFI_LOAD_OPTION;
932 */
933 struct efi_load_option {
934 u32 attributes;
935 u16 file_path_length;
936 u16 *label;
937 struct efi_device_path *file_path;
938 const u8 *optional_data;
939 };
940
941 struct efi_device_path *efi_dp_from_lo(struct efi_load_option *lo,
942 const efi_guid_t *guid);
943 struct efi_device_path *efi_dp_concat(const struct efi_device_path *dp1,
944 const struct efi_device_path *dp2,
945 bool split_end_node);
946 struct efi_device_path *search_gpt_dp_node(struct efi_device_path *device_path);
947 efi_status_t efi_deserialize_load_option(struct efi_load_option *lo, u8 *data,
948 efi_uintn_t *size);
949 unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data);
950 efi_status_t efi_set_load_options(efi_handle_t handle,
951 efi_uintn_t load_options_size,
952 void *load_options);
953 efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options);
954
955 /**
956 * struct efi_image_regions - A list of memory regions
957 *
958 * @max: Maximum number of regions
959 * @num: Number of regions
960 * @reg: array of regions
961 */
962 struct efi_image_regions {
963 int max;
964 int num;
965 struct image_region reg[];
966 };
967
968 /**
969 * struct efi_sig_data - A decoded data of struct efi_signature_data
970 *
971 * This structure represents an internal form of signature in
972 * signature database. A listed list may represent a signature list.
973 *
974 * @next: Pointer to next entry
975 * @owner: Signature owner
976 * @data: Pointer to signature data
977 * @size: Size of signature data
978 */
979 struct efi_sig_data {
980 struct efi_sig_data *next;
981 efi_guid_t owner;
982 void *data;
983 size_t size;
984 };
985
986 /**
987 * struct efi_signature_store - A decoded data of signature database
988 *
989 * This structure represents an internal form of signature database.
990 *
991 * @next: Pointer to next entry
992 * @sig_type: Signature type
993 * @sig_data_list: Pointer to signature list
994 */
995 struct efi_signature_store {
996 struct efi_signature_store *next;
997 efi_guid_t sig_type;
998 struct efi_sig_data *sig_data_list;
999 };
1000
1001 struct x509_certificate;
1002 struct pkcs7_message;
1003
1004 /**
1005 * struct eficonfig_media_boot_option - boot option for (removable) media device
1006 *
1007 * This structure is used to enumerate possible boot option
1008 *
1009 * @lo: Serialized load option data
1010 * @size: Size of serialized load option data
1011 * @exist: Flag to indicate the load option already exists
1012 * in Non-volatile load option
1013 */
1014 struct eficonfig_media_boot_option {
1015 void *lo;
1016 efi_uintn_t size;
1017 bool exist;
1018 };
1019
1020 bool efi_hash_regions(struct image_region *regs, int count,
1021 void **hash, const char *hash_algo, int *len);
1022 bool efi_signature_lookup_digest(struct efi_image_regions *regs,
1023 struct efi_signature_store *db,
1024 bool dbx);
1025 bool efi_signature_verify(struct efi_image_regions *regs,
1026 struct pkcs7_message *msg,
1027 struct efi_signature_store *db,
1028 struct efi_signature_store *dbx);
1029 static inline bool efi_signature_verify_one(struct efi_image_regions *regs,
1030 struct pkcs7_message *msg,
1031 struct efi_signature_store *db)
1032 {
1033 return efi_signature_verify(regs, msg, db, NULL);
1034 }
1035 bool efi_signature_check_signers(struct pkcs7_message *msg,
1036 struct efi_signature_store *dbx);
1037
1038 efi_status_t efi_image_region_add(struct efi_image_regions *regs,
1039 const void *start, const void *end,
1040 int nocheck);
1041
1042 void efi_sigstore_free(struct efi_signature_store *sigstore);
1043 struct efi_signature_store *efi_build_signature_store(void *sig_list,
1044 efi_uintn_t size);
1045 struct efi_signature_store *efi_sigstore_parse_sigdb(u16 *name);
1046
1047 bool efi_secure_boot_enabled(void);
1048
1049 bool efi_capsule_auth_enabled(void);
1050
1051 void *efi_prepare_aligned_image(void *efi, u64 *efi_size);
1052
1053 bool efi_image_parse(void *efi, size_t len, struct efi_image_regions **regp,
1054 WIN_CERTIFICATE **auth, size_t *auth_len);
1055
1056 struct pkcs7_message *efi_parse_pkcs7_header(const void *buf,
1057 size_t buflen,
1058 u8 **tmpbuf);
1059
1060 /* runtime implementation of memcpy() */
1061 void efi_memcpy_runtime(void *dest, const void *src, size_t n);
1062
1063 /* commonly used helper functions */
1064 u16 *efi_create_indexed_name(u16 *buffer, size_t buffer_size, const char *name,
1065 unsigned int index);
1066 efi_string_t efi_convert_string(const char *str);
1067
1068 extern const struct efi_firmware_management_protocol efi_fmp_fit;
1069 extern const struct efi_firmware_management_protocol efi_fmp_raw;
1070
1071 /* Capsule update */
1072 efi_status_t EFIAPI efi_update_capsule(
1073 struct efi_capsule_header **capsule_header_array,
1074 efi_uintn_t capsule_count,
1075 u64 scatter_gather_list);
1076 efi_status_t EFIAPI efi_query_capsule_caps(
1077 struct efi_capsule_header **capsule_header_array,
1078 efi_uintn_t capsule_count,
1079 u64 *maximum_capsule_size,
1080 u32 *reset_type);
1081
1082 efi_status_t efi_capsule_authenticate(const void *capsule,
1083 efi_uintn_t capsule_size,
1084 void **image, efi_uintn_t *image_size);
1085
1086 #define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\"
1087
1088 /**
1089 * struct efi_fw_image - Information on firmware images updatable through
1090 * capsule update
1091 *
1092 * This structure gives information about the firmware images on the platform
1093 * which can be updated through the capsule update mechanism
1094 *
1095 * @image_type_id: Image GUID. Same value is to be used in the capsule
1096 * @fw_name: Name of the firmware image
1097 * @image_index: Image Index, same as value passed to SetImage FMP
1098 * function
1099 */
1100 struct efi_fw_image {
1101 efi_guid_t image_type_id;
1102 u16 *fw_name;
1103 u8 image_index;
1104 };
1105
1106 /**
1107 * struct efi_capsule_update_info - Information needed for capsule updates
1108 *
1109 * This structure provides information needed for performing firmware
1110 * updates. The structure needs to be initialised per platform, for all
1111 * platforms which enable capsule updates
1112 *
1113 * @dfu_string: String used to populate dfu_alt_info
1114 * @num_images: The number of images array entries
1115 * @images: Pointer to an array of updatable images
1116 */
1117 struct efi_capsule_update_info {
1118 const char *dfu_string;
1119 int num_images;
1120 struct efi_fw_image *images;
1121 };
1122
1123 extern struct efi_capsule_update_info update_info;
1124
1125 /**
1126 * Install the ESRT system table.
1127 *
1128 * Return: status code
1129 */
1130 efi_status_t efi_esrt_register(void);
1131
1132 /**
1133 * efi_ecpt_register() - Install the ECPT system table.
1134 *
1135 * Return: status code
1136 */
1137 efi_status_t efi_ecpt_register(void);
1138
1139 /**
1140 * efi_esrt_populate() - Populates the ESRT entries from the FMP instances
1141 * present in the system.
1142 * If an ESRT already exists, the old ESRT is replaced in the system table.
1143 * The memory of the old ESRT is deallocated.
1144 *
1145 * Return:
1146 * - EFI_SUCCESS if the ESRT is correctly created
1147 * - error code otherwise.
1148 */
1149 efi_status_t efi_esrt_populate(void);
1150 efi_status_t efi_load_capsule_drivers(void);
1151
1152 efi_status_t platform_get_eventlog(struct udevice *dev, u64 *addr, u32 *sz);
1153
1154 efi_status_t efi_locate_handle_buffer_int(enum efi_locate_search_type search_type,
1155 const efi_guid_t *protocol, void *search_key,
1156 efi_uintn_t *no_handles, efi_handle_t **buffer);
1157
1158 efi_status_t efi_open_volume_int(struct efi_simple_file_system_protocol *this,
1159 struct efi_file_handle **root);
1160 efi_status_t efi_file_open_int(struct efi_file_handle *this,
1161 struct efi_file_handle **new_handle,
1162 u16 *file_name, u64 open_mode,
1163 u64 attributes);
1164 efi_status_t efi_file_close_int(struct efi_file_handle *file);
1165 efi_status_t efi_file_read_int(struct efi_file_handle *this,
1166 efi_uintn_t *buffer_size, void *buffer);
1167 efi_status_t efi_file_setpos_int(struct efi_file_handle *file, u64 pos);
1168
1169 typedef efi_status_t (*efi_console_filter_func)(struct efi_input_key *key);
1170 efi_status_t efi_console_get_u16_string
1171 (struct efi_simple_text_input_protocol *cin,
1172 u16 *buf, efi_uintn_t count, efi_console_filter_func filer_func,
1173 int row, int col);
1174
1175 efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int size);
1176
1177 /**
1178 * efi_add_known_memory() - add memory banks to EFI memory map
1179 *
1180 * This weak function may be overridden for specific architectures.
1181 */
1182 void efi_add_known_memory(void);
1183
1184 #endif /* _EFI_LOADER_H */