xref: /openbmc/u-boot/include/efi_loader.h (revision 152cade32643fdbdd73614db4cfb159876b58262)
1cb149c66SAlexander Graf /*
2cb149c66SAlexander Graf  *  EFI application loader
3cb149c66SAlexander Graf  *
4cb149c66SAlexander Graf  *  Copyright (c) 2016 Alexander Graf
5cb149c66SAlexander Graf  *
6cb149c66SAlexander Graf  *  SPDX-License-Identifier:     GPL-2.0+
7cb149c66SAlexander Graf  */
8cb149c66SAlexander Graf 
9cd9e18deSHeinrich Schuchardt #ifndef _EFI_LOADER_H
10cd9e18deSHeinrich Schuchardt #define _EFI_LOADER_H 1
11cd9e18deSHeinrich Schuchardt 
12bee91169SAlexander Graf #include <common.h>
13cb149c66SAlexander Graf #include <part_efi.h>
14cb149c66SAlexander Graf #include <efi_api.h>
15bee91169SAlexander Graf 
16bee91169SAlexander Graf /* No need for efi loader support in SPL */
17bee91169SAlexander Graf #if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD)
18bee91169SAlexander Graf 
19cb149c66SAlexander Graf #include <linux/list.h>
20cb149c66SAlexander Graf 
21c160d2f5SRob Clark int __efi_entry_check(void);
22c160d2f5SRob Clark int __efi_exit_check(void);
23ae0bd3a9SHeinrich Schuchardt const char *__efi_nesting(void);
24af65db85SRob Clark const char *__efi_nesting_inc(void);
25af65db85SRob Clark const char *__efi_nesting_dec(void);
26c160d2f5SRob Clark 
27a095aadfSRob Clark /*
28a095aadfSRob Clark  * Enter the u-boot world from UEFI:
29a095aadfSRob Clark  */
30bee91169SAlexander Graf #define EFI_ENTRY(format, ...) do { \
31c160d2f5SRob Clark 	assert(__efi_entry_check()); \
32af65db85SRob Clark 	debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
33af65db85SRob Clark 		__func__, ##__VA_ARGS__); \
34bee91169SAlexander Graf 	} while(0)
35bee91169SAlexander Graf 
36a095aadfSRob Clark /*
37a095aadfSRob Clark  * Exit the u-boot world back to UEFI:
38a095aadfSRob Clark  */
39804b1d73SRob Clark #define EFI_EXIT(ret) ({ \
40c81883dfSxypron.glpk@gmx.de 	typeof(ret) _r = ret; \
41af65db85SRob Clark 	debug("%sEFI: Exit: %s: %u\n", __efi_nesting_dec(), \
42c81883dfSxypron.glpk@gmx.de 		__func__, (u32)((uintptr_t) _r & ~EFI_ERROR_MASK)); \
43c160d2f5SRob Clark 	assert(__efi_exit_check()); \
44c160d2f5SRob Clark 	_r; \
45804b1d73SRob Clark 	})
46bee91169SAlexander Graf 
47a095aadfSRob Clark /*
48ea630ce9SHeinrich Schuchardt  * Call non-void UEFI function from u-boot and retrieve return value:
49a095aadfSRob Clark  */
50ea630ce9SHeinrich Schuchardt #define EFI_CALL(exp) ({ \
51ea630ce9SHeinrich Schuchardt 	debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \
52ea630ce9SHeinrich Schuchardt 	assert(__efi_exit_check()); \
53ea630ce9SHeinrich Schuchardt 	typeof(exp) _r = exp; \
54ea630ce9SHeinrich Schuchardt 	assert(__efi_entry_check()); \
55ea630ce9SHeinrich Schuchardt 	debug("%sEFI: %lu returned by %s\n", __efi_nesting_dec(), \
56ea630ce9SHeinrich Schuchardt 	      (unsigned long)((uintptr_t)_r & ~EFI_ERROR_MASK), #exp); \
57ea630ce9SHeinrich Schuchardt 	_r; \
58ea630ce9SHeinrich Schuchardt })
59ea630ce9SHeinrich Schuchardt 
60ea630ce9SHeinrich Schuchardt /*
61ea630ce9SHeinrich Schuchardt  * Call void UEFI function from u-boot:
62ea630ce9SHeinrich Schuchardt  */
63ea630ce9SHeinrich Schuchardt #define EFI_CALL_VOID(exp) do { \
64af65db85SRob Clark 	debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \
65c160d2f5SRob Clark 	assert(__efi_exit_check()); \
66a095aadfSRob Clark 	exp; \
67c160d2f5SRob Clark 	assert(__efi_entry_check()); \
68af65db85SRob Clark 	debug("%sEFI: Return From: %s\n", __efi_nesting_dec(), #exp); \
69a095aadfSRob Clark 	} while(0)
70a095aadfSRob Clark 
71ae0bd3a9SHeinrich Schuchardt /*
72ae0bd3a9SHeinrich Schuchardt  * Write GUID
73ae0bd3a9SHeinrich Schuchardt  */
74ae0bd3a9SHeinrich Schuchardt #define EFI_PRINT_GUID(txt, guid) ({ \
75ae0bd3a9SHeinrich Schuchardt 	debug("%sEFI: %s %pUl\n", __efi_nesting(), txt, guid); \
76ae0bd3a9SHeinrich Schuchardt 	})
77ae0bd3a9SHeinrich Schuchardt 
7850149ea3SAlexander Graf extern struct efi_runtime_services efi_runtime_services;
79bee91169SAlexander Graf extern struct efi_system_table systab;
80bee91169SAlexander Graf 
81c1311ad4SAlexander Graf extern const struct efi_simple_text_output_protocol efi_con_out;
8291be9a77Sxypron.glpk@gmx.de extern struct efi_simple_input_interface efi_con_in;
83c1311ad4SAlexander Graf extern const struct efi_console_control_protocol efi_console_control;
84cc5b7081Sxypron.glpk@gmx.de extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
85c1311ad4SAlexander Graf 
86adae4313SRob Clark uint16_t *efi_dp_str(struct efi_device_path *dp);
87adae4313SRob Clark 
889975fe96SRob Clark extern const efi_guid_t efi_global_variable_guid;
89c1311ad4SAlexander Graf extern const efi_guid_t efi_guid_console_control;
90cb149c66SAlexander Graf extern const efi_guid_t efi_guid_device_path;
91cb149c66SAlexander Graf extern const efi_guid_t efi_guid_loaded_image;
92cc5b7081Sxypron.glpk@gmx.de extern const efi_guid_t efi_guid_device_path_to_text_protocol;
932a92080dSRob Clark extern const efi_guid_t efi_simple_file_system_protocol_guid;
942a92080dSRob Clark extern const efi_guid_t efi_file_info_guid;
95cb149c66SAlexander Graf 
9650149ea3SAlexander Graf extern unsigned int __efi_runtime_start, __efi_runtime_stop;
9750149ea3SAlexander Graf extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
9850149ea3SAlexander Graf 
99bee91169SAlexander Graf /*
100bee91169SAlexander Graf  * When the UEFI payload wants to open a protocol on an object to get its
101bee91169SAlexander Graf  * interface (usually a struct with callback functions), this struct maps the
102b5349f74Sxypron.glpk@gmx.de  * protocol GUID to the respective protocol interface */
103bee91169SAlexander Graf struct efi_handler {
104bee91169SAlexander Graf 	const efi_guid_t *guid;
105b5349f74Sxypron.glpk@gmx.de 	void *protocol_interface;
106bee91169SAlexander Graf };
107bee91169SAlexander Graf 
108bee91169SAlexander Graf /*
109bee91169SAlexander Graf  * UEFI has a poor man's OO model where one "object" can be polymorphic and have
110bee91169SAlexander Graf  * multiple different protocols (classes) attached to it.
111bee91169SAlexander Graf  *
112bee91169SAlexander Graf  * This struct is the parent struct for all of our actual implementation objects
113bee91169SAlexander Graf  * that can include it to make themselves an EFI object
114bee91169SAlexander Graf  */
115bee91169SAlexander Graf struct efi_object {
116bee91169SAlexander Graf 	/* Every UEFI object is part of a global object list */
117bee91169SAlexander Graf 	struct list_head link;
118842a8e43SHeinrich Schuchardt 	/* We support up to 16 "protocols" an object can be accessed through */
119842a8e43SHeinrich Schuchardt 	struct efi_handler protocols[16];
120bee91169SAlexander Graf 	/* The object spawner can either use this for data or as identifier */
121bee91169SAlexander Graf 	void *handle;
122bee91169SAlexander Graf };
123bee91169SAlexander Graf 
124641833dbSRob Clark #define EFI_PROTOCOL_OBJECT(_guid, _protocol) (struct efi_object){	\
125641833dbSRob Clark 	.protocols = {{							\
126641833dbSRob Clark 		.guid = &(_guid),	 				\
127641833dbSRob Clark 		.protocol_interface = (void *)(_protocol), 		\
128641833dbSRob Clark 	}},								\
129641833dbSRob Clark 	.handle = (void *)(_protocol),					\
130641833dbSRob Clark }
131641833dbSRob Clark 
132c6841592Sxypron.glpk@gmx.de /**
133c6841592Sxypron.glpk@gmx.de  * struct efi_event
134c6841592Sxypron.glpk@gmx.de  *
135c6841592Sxypron.glpk@gmx.de  * @type:		Type of event, see efi_create_event
136c6841592Sxypron.glpk@gmx.de  * @notify_tpl:		Task priority level of notifications
137c6841592Sxypron.glpk@gmx.de  * @trigger_time:	Period of the timer
138c6841592Sxypron.glpk@gmx.de  * @trigger_next:	Next time to trigger the timer
139c6841592Sxypron.glpk@gmx.de  * @nofify_function:	Function to call when the event is triggered
140c6841592Sxypron.glpk@gmx.de  * @notify_context:	Data to be passed to the notify function
141c6841592Sxypron.glpk@gmx.de  * @trigger_type:	Type of timer, see efi_set_timer
142ca62a4f5SHeinrich Schuchardt  * @queued:		The notification function is queued
143e190e897SHeinrich Schuchardt  * @signaled:		The event occurred. The event is in the signaled state.
144c6841592Sxypron.glpk@gmx.de  */
145c6841592Sxypron.glpk@gmx.de struct efi_event {
146b521d29eSxypron.glpk@gmx.de 	uint32_t type;
147*152cade3SHeinrich Schuchardt 	efi_uintn_t notify_tpl;
148c6841592Sxypron.glpk@gmx.de 	void (EFIAPI *notify_function)(struct efi_event *event, void *context);
149c6841592Sxypron.glpk@gmx.de 	void *notify_context;
150c6841592Sxypron.glpk@gmx.de 	u64 trigger_next;
151c6841592Sxypron.glpk@gmx.de 	u64 trigger_time;
152b521d29eSxypron.glpk@gmx.de 	enum efi_timer_delay trigger_type;
153e190e897SHeinrich Schuchardt 	bool is_queued;
154e190e897SHeinrich Schuchardt 	bool is_signaled;
155c6841592Sxypron.glpk@gmx.de };
156c6841592Sxypron.glpk@gmx.de 
157c6841592Sxypron.glpk@gmx.de 
158bee91169SAlexander Graf /* This list contains all UEFI objects we know of */
159bee91169SAlexander Graf extern struct list_head efi_obj_list;
160bee91169SAlexander Graf 
16191be9a77Sxypron.glpk@gmx.de /* Called by bootefi to make console interface available */
16291be9a77Sxypron.glpk@gmx.de int efi_console_register(void);
1632a22d05dSAlexander Graf /* Called by bootefi to make all disk storage accessible as EFI objects */
1642a22d05dSAlexander Graf int efi_disk_register(void);
165be8d3241SAlexander Graf /* Called by bootefi to make GOP (graphical) interface available */
166be8d3241SAlexander Graf int efi_gop_register(void);
1670efe1bcfSAlexander Graf /* Called by bootefi to make the network interface available */
16895c5553eSRob Clark int efi_net_register(void);
169b3d60900SHeinrich Schuchardt /* Called by bootefi to make the watchdog available */
170b3d60900SHeinrich Schuchardt int efi_watchdog_register(void);
171e663b350SAlexander Graf /* Called by bootefi to make SMBIOS tables available */
172e663b350SAlexander Graf void efi_smbios_register(void);
1730efe1bcfSAlexander Graf 
1742a92080dSRob Clark struct efi_simple_file_system_protocol *
1752a92080dSRob Clark efi_fs_from_path(struct efi_device_path *fp);
1762a92080dSRob Clark 
1770efe1bcfSAlexander Graf /* Called by networking code to memorize the dhcp ack package */
1780efe1bcfSAlexander Graf void efi_net_set_dhcp_ack(void *pkt, int len);
179b3d60900SHeinrich Schuchardt /* Called by efi_set_watchdog_timer to reset the timer */
180b3d60900SHeinrich Schuchardt efi_status_t efi_set_watchdog(unsigned long timeout);
1810efe1bcfSAlexander Graf 
182bee91169SAlexander Graf /* Called from places to check whether a timer expired */
183bee91169SAlexander Graf void efi_timer_check(void);
184bee91169SAlexander Graf /* PE loader implementation */
185cb149c66SAlexander Graf void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info);
186bee91169SAlexander Graf /* Called once to store the pristine gd pointer */
187bee91169SAlexander Graf void efi_save_gd(void);
188c160d2f5SRob Clark /* Special case handler for error/abort that just tries to dtrt to get
189c160d2f5SRob Clark  * back to u-boot world */
190bee91169SAlexander Graf void efi_restore_gd(void);
19150149ea3SAlexander Graf /* Call this to relocate the runtime section to an address space */
19250149ea3SAlexander Graf void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map);
1930f4060ebSAlexander Graf /* Call this to set the current device name */
194c07ad7c0SAlexander Graf void efi_set_bootdev(const char *dev, const char *devnr, const char *path);
19549deb455Sxypron.glpk@gmx.de /* Call this to create an event */
196*152cade3SHeinrich Schuchardt efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
19749deb455Sxypron.glpk@gmx.de 			      void (EFIAPI *notify_function) (
19849deb455Sxypron.glpk@gmx.de 					struct efi_event *event,
19949deb455Sxypron.glpk@gmx.de 					void *context),
20049deb455Sxypron.glpk@gmx.de 			      void *notify_context, struct efi_event **event);
201bfc72462Sxypron.glpk@gmx.de /* Call this to set a timer */
202b521d29eSxypron.glpk@gmx.de efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
203bfc72462Sxypron.glpk@gmx.de 			   uint64_t trigger_time);
20491be9a77Sxypron.glpk@gmx.de /* Call this to signal an event */
20591be9a77Sxypron.glpk@gmx.de void efi_signal_event(struct efi_event *event);
20650149ea3SAlexander Graf 
2072a92080dSRob Clark /* open file system: */
2082a92080dSRob Clark struct efi_simple_file_system_protocol *efi_simple_file_system(
2092a92080dSRob Clark 		struct blk_desc *desc, int part, struct efi_device_path *dp);
2102a92080dSRob Clark 
2112a92080dSRob Clark /* open file from device-path: */
2122a92080dSRob Clark struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp);
2132a92080dSRob Clark 
2142a92080dSRob Clark 
2155d00995cSAlexander Graf /* Generic EFI memory allocator, call this to get memory */
2165d00995cSAlexander Graf void *efi_alloc(uint64_t len, int memory_type);
2175d00995cSAlexander Graf /* More specific EFI memory allocator, called by EFI payloads */
2185d00995cSAlexander Graf efi_status_t efi_allocate_pages(int type, int memory_type, unsigned long pages,
2195d00995cSAlexander Graf 				uint64_t *memory);
220b61d857bSStefan Brüns /* EFI memory free function. */
2215d00995cSAlexander Graf efi_status_t efi_free_pages(uint64_t memory, unsigned long pages);
222ead1274bSStefan Brüns /* EFI memory allocator for small allocations */
223ead1274bSStefan Brüns efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
224ead1274bSStefan Brüns 			       void **buffer);
22542417bc8SStefan Brüns /* EFI pool memory free function. */
22642417bc8SStefan Brüns efi_status_t efi_free_pool(void *buffer);
2275d00995cSAlexander Graf /* Returns the EFI memory map */
2285d00995cSAlexander Graf efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
2295d00995cSAlexander Graf 				struct efi_mem_desc *memory_map,
2305d00995cSAlexander Graf 				unsigned long *map_key,
2315d00995cSAlexander Graf 				unsigned long *descriptor_size,
2325d00995cSAlexander Graf 				uint32_t *descriptor_version);
2335d00995cSAlexander Graf /* Adds a range into the EFI memory map */
2345d00995cSAlexander Graf uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
2355d00995cSAlexander Graf 			    bool overlap_only_ram);
2365d00995cSAlexander Graf /* Called by board init to initialize the EFI memory map */
2375d00995cSAlexander Graf int efi_memory_init(void);
238488bf12dSAlexander Graf /* Adds new or overrides configuration table entry to the system table */
239488bf12dSAlexander Graf efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table);
24095c5553eSRob Clark void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *obj,
24195c5553eSRob Clark 			    struct efi_device_path *device_path,
24295c5553eSRob Clark 			    struct efi_device_path *file_path);
2439975fe96SRob Clark efi_status_t efi_load_image_from_path(struct efi_device_path *file_path,
2449975fe96SRob Clark 				      void **buffer);
2455d00995cSAlexander Graf 
24651735ae0SAlexander Graf #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
24751735ae0SAlexander Graf extern void *efi_bounce_buffer;
24851735ae0SAlexander Graf #define EFI_LOADER_BOUNCE_BUFFER_SIZE (64 * 1024 * 1024)
24951735ae0SAlexander Graf #endif
25051735ae0SAlexander Graf 
251b66c60ddSRob Clark 
252b66c60ddSRob Clark struct efi_device_path *efi_dp_next(const struct efi_device_path *dp);
253b66c60ddSRob Clark int efi_dp_match(struct efi_device_path *a, struct efi_device_path *b);
254b66c60ddSRob Clark struct efi_object *efi_dp_find_obj(struct efi_device_path *dp,
255b66c60ddSRob Clark 				   struct efi_device_path **rem);
256b66c60ddSRob Clark unsigned efi_dp_size(const struct efi_device_path *dp);
257b66c60ddSRob Clark struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp);
258b66c60ddSRob Clark struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1,
259b66c60ddSRob Clark 				      const struct efi_device_path *dp2);
260b66c60ddSRob Clark struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
261b66c60ddSRob Clark 					   const struct efi_device_path *node);
262b66c60ddSRob Clark 
263b66c60ddSRob Clark 
264b66c60ddSRob Clark struct efi_device_path *efi_dp_from_dev(struct udevice *dev);
265b66c60ddSRob Clark struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part);
266b66c60ddSRob Clark struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
267b66c60ddSRob Clark 					 const char *path);
268b66c60ddSRob Clark struct efi_device_path *efi_dp_from_eth(void);
269bf19273eSRob Clark struct efi_device_path *efi_dp_from_mem(uint32_t mem_type,
270bf19273eSRob Clark 					uint64_t start_address,
271bf19273eSRob Clark 					uint64_t end_address);
272b66c60ddSRob Clark void efi_dp_split_file_path(struct efi_device_path *full_path,
273b66c60ddSRob Clark 			    struct efi_device_path **device_path,
274b66c60ddSRob Clark 			    struct efi_device_path **file_path);
275b66c60ddSRob Clark 
276b66c60ddSRob Clark #define EFI_DP_TYPE(_dp, _type, _subtype) \
277b66c60ddSRob Clark 	(((_dp)->type == DEVICE_PATH_TYPE_##_type) && \
278b66c60ddSRob Clark 	 ((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype))
279b66c60ddSRob Clark 
2800f4060ebSAlexander Graf /* Convert strings from normal C strings to uEFI strings */
281487d756fSSimon Glass static inline void ascii2unicode(u16 *unicode, const char *ascii)
2820f4060ebSAlexander Graf {
2830f4060ebSAlexander Graf 	while (*ascii)
2840f4060ebSAlexander Graf 		*(unicode++) = *(ascii++);
2850f4060ebSAlexander Graf }
2860f4060ebSAlexander Graf 
2873e094c59SRob Clark static inline int guidcmp(const efi_guid_t *g1, const efi_guid_t *g2)
2883e094c59SRob Clark {
2893e094c59SRob Clark 	return memcmp(g1, g2, sizeof(efi_guid_t));
2903e094c59SRob Clark }
2913e094c59SRob Clark 
29250149ea3SAlexander Graf /*
29350149ea3SAlexander Graf  * Use these to indicate that your code / data should go into the EFI runtime
29450149ea3SAlexander Graf  * section and thus still be available when the OS is running
29550149ea3SAlexander Graf  */
2963c63db9cSAlexander Graf #define __efi_runtime_data __attribute__ ((section ("efi_runtime_data")))
2973c63db9cSAlexander Graf #define __efi_runtime __attribute__ ((section ("efi_runtime_text")))
298bee91169SAlexander Graf 
29980a4800eSAlexander Graf /* Call this with mmio_ptr as the _pointer_ to a pointer to an MMIO region
30080a4800eSAlexander Graf  * to make it available at runtime */
30180a4800eSAlexander Graf void efi_add_runtime_mmio(void *mmio_ptr, u64 len);
30280a4800eSAlexander Graf 
30380a4800eSAlexander Graf /* Boards may provide the functions below to implement RTS functionality */
30480a4800eSAlexander Graf 
3053c63db9cSAlexander Graf void __efi_runtime EFIAPI efi_reset_system(
30680a4800eSAlexander Graf 			enum efi_reset_type reset_type,
30780a4800eSAlexander Graf 			efi_status_t reset_status,
30880a4800eSAlexander Graf 			unsigned long data_size, void *reset_data);
30980a4800eSAlexander Graf void efi_reset_system_init(void);
31080a4800eSAlexander Graf 
3113c63db9cSAlexander Graf efi_status_t __efi_runtime EFIAPI efi_get_time(
31280a4800eSAlexander Graf 			struct efi_time *time,
31380a4800eSAlexander Graf 			struct efi_time_cap *capabilities);
31480a4800eSAlexander Graf void efi_get_time_init(void);
31580a4800eSAlexander Graf 
316623b3a57SHeinrich Schuchardt #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
317623b3a57SHeinrich Schuchardt /*
318623b3a57SHeinrich Schuchardt  * Entry point for the tests of the EFI API.
319623b3a57SHeinrich Schuchardt  * It is called by 'bootefi selftest'
320623b3a57SHeinrich Schuchardt  */
321623b3a57SHeinrich Schuchardt efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
322623b3a57SHeinrich Schuchardt 				 struct efi_system_table *systab);
323623b3a57SHeinrich Schuchardt #endif
324623b3a57SHeinrich Schuchardt 
325ad644e7cSRob Clark efi_status_t EFIAPI efi_get_variable(s16 *variable_name,
326ad644e7cSRob Clark 		efi_guid_t *vendor, u32 *attributes,
327ad644e7cSRob Clark 		unsigned long *data_size, void *data);
328ad644e7cSRob Clark efi_status_t EFIAPI efi_get_next_variable(
329ad644e7cSRob Clark 		unsigned long *variable_name_size,
330ad644e7cSRob Clark 		s16 *variable_name, efi_guid_t *vendor);
331ad644e7cSRob Clark efi_status_t EFIAPI efi_set_variable(s16 *variable_name,
332ad644e7cSRob Clark 		efi_guid_t *vendor, u32 attributes,
333ad644e7cSRob Clark 		unsigned long data_size, void *data);
334ad644e7cSRob Clark 
3359975fe96SRob Clark void *efi_bootmgr_load(struct efi_device_path **device_path,
3369975fe96SRob Clark 		       struct efi_device_path **file_path);
3379975fe96SRob Clark 
338bee91169SAlexander Graf #else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */
339bee91169SAlexander Graf 
34050149ea3SAlexander Graf /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
3413c63db9cSAlexander Graf #define __efi_runtime_data
3423c63db9cSAlexander Graf #define __efi_runtime
34397d01444SAlexander Graf static inline void efi_add_runtime_mmio(void *mmio_ptr, u64 len) { }
34450149ea3SAlexander Graf 
345bee91169SAlexander Graf /* No loader configured, stub out EFI_ENTRY */
346bee91169SAlexander Graf static inline void efi_restore_gd(void) { }
347c07ad7c0SAlexander Graf static inline void efi_set_bootdev(const char *dev, const char *devnr,
348c07ad7c0SAlexander Graf 				   const char *path) { }
3490efe1bcfSAlexander Graf static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
350bee91169SAlexander Graf 
351cd9e18deSHeinrich Schuchardt #endif /* CONFIG_EFI_LOADER && !CONFIG_SPL_BUILD */
352cd9e18deSHeinrich Schuchardt 
353cd9e18deSHeinrich Schuchardt #endif /* _EFI_LOADER_H */
354