Blame view
include/efi_loader.h
25 KB
f739fcd83 SPDX: Convert a f... |
1 |
/* SPDX-License-Identifier: GPL-2.0+ */ |
cb149c663 efi_loader: Add P... |
2 3 4 5 |
/* * EFI application loader * * Copyright (c) 2016 Alexander Graf |
cb149c663 efi_loader: Add P... |
6 |
*/ |
cd9e18dee efi_loader: guard... |
7 8 |
#ifndef _EFI_LOADER_H #define _EFI_LOADER_H 1 |
bee91169f efi_loader: Add b... |
9 |
#include <common.h> |
cb149c663 efi_loader: Add P... |
10 11 |
#include <part_efi.h> #include <efi_api.h> |
bee91169f efi_loader: Add b... |
12 |
|
fdeb6f7dc efi: Move inline ... |
13 14 15 16 |
static inline int guidcmp(const void *g1, const void *g2) { return memcmp(g1, g2, sizeof(efi_guid_t)); } |
61e42d946 efi_loader: Add g... |
17 18 19 20 |
static inline void *guidcpy(void *dst, const void *src) { return memcpy(dst, src, sizeof(efi_guid_t)); } |
bee91169f efi_loader: Add b... |
21 |
/* No need for efi loader support in SPL */ |
9b5e6396b efi_loader: simpl... |
22 |
#if CONFIG_IS_ENABLED(EFI_LOADER) |
bee91169f efi_loader: Add b... |
23 |
|
cb149c663 efi_loader: Add P... |
24 |
#include <linux/list.h> |
4182a129e efi_loader: alloc... |
25 26 |
/* Maximum number of configuration tables */ #define EFI_MAX_CONFIGURATION_TABLES 16 |
4e6b5d650 efi_loader: creat... |
27 28 29 30 |
/* GUID used by the root node */ #define U_BOOT_GUID \ EFI_GUID(0xe61d73b9, 0xa384, 0x4acc, \ 0xae, 0xab, 0x82, 0xe8, 0x28, 0xf3, 0x62, 0x8b) |
23ad52fff efi_loader: devic... |
31 32 33 34 |
/* GUID used as host device on sandbox */ #define U_BOOT_HOST_DEV_GUID \ EFI_GUID(0xbbe4e671, 0x5773, 0x4ea1, \ 0x9a, 0xab, 0x3a, 0x7d, 0xbf, 0x40, 0xc4, 0x82) |
4e6b5d650 efi_loader: creat... |
35 |
|
7a597259d efi_loader: pass ... |
36 |
/* Use internal device tree when starting UEFI application */ |
f64f22325 efi_loader: expor... |
37 |
#define EFI_FDT_USE_INTERNAL NULL |
7a597259d efi_loader: pass ... |
38 |
|
a2a4bc3b0 efi_loader: expor... |
39 40 |
/* Root node */ extern efi_handle_t efi_root; |
c160d2f5e efi_loader: add c... |
41 42 |
int __efi_entry_check(void); int __efi_exit_check(void); |
ae0bd3a98 efi_loader: write... |
43 |
const char *__efi_nesting(void); |
af65db85b efi_loader: inden... |
44 45 |
const char *__efi_nesting_inc(void); const char *__efi_nesting_dec(void); |
c160d2f5e efi_loader: add c... |
46 |
|
a095aadff efi_loader: Add a... |
47 48 49 |
/* * Enter the u-boot world from UEFI: */ |
bee91169f efi_loader: Add b... |
50 |
#define EFI_ENTRY(format, ...) do { \ |
c160d2f5e efi_loader: add c... |
51 |
assert(__efi_entry_check()); \ |
af65db85b efi_loader: inden... |
52 53 54 |
debug("%sEFI: Entry %s(" format ") ", __efi_nesting_inc(), \ __func__, ##__VA_ARGS__); \ |
bee91169f efi_loader: Add b... |
55 |
} while(0) |
bee91169f efi_loader: Add b... |
56 |
|
a095aadff efi_loader: Add a... |
57 58 59 |
/* * Exit the u-boot world back to UEFI: */ |
804b1d737 efi_loader: log E... |
60 |
#define EFI_EXIT(ret) ({ \ |
c81883dfc efi_loader: do no... |
61 |
typeof(ret) _r = ret; \ |
af65db85b efi_loader: inden... |
62 63 |
debug("%sEFI: Exit: %s: %u ", __efi_nesting_dec(), \ |
c81883dfc efi_loader: do no... |
64 |
__func__, (u32)((uintptr_t) _r & ~EFI_ERROR_MASK)); \ |
c160d2f5e efi_loader: add c... |
65 66 |
assert(__efi_exit_check()); \ _r; \ |
804b1d737 efi_loader: log E... |
67 |
}) |
bee91169f efi_loader: Add b... |
68 |
|
a095aadff efi_loader: Add a... |
69 |
/* |
ea630ce9e efi_loader: allow... |
70 |
* Call non-void UEFI function from u-boot and retrieve return value: |
a095aadff efi_loader: Add a... |
71 |
*/ |
ea630ce9e efi_loader: allow... |
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
#define EFI_CALL(exp) ({ \ debug("%sEFI: Call: %s ", __efi_nesting_inc(), #exp); \ assert(__efi_exit_check()); \ typeof(exp) _r = exp; \ assert(__efi_entry_check()); \ debug("%sEFI: %lu returned by %s ", __efi_nesting_dec(), \ (unsigned long)((uintptr_t)_r & ~EFI_ERROR_MASK), #exp); \ _r; \ }) /* * Call void UEFI function from u-boot: */ #define EFI_CALL_VOID(exp) do { \ |
af65db85b efi_loader: inden... |
88 89 |
debug("%sEFI: Call: %s ", __efi_nesting_inc(), #exp); \ |
c160d2f5e efi_loader: add c... |
90 |
assert(__efi_exit_check()); \ |
a095aadff efi_loader: Add a... |
91 |
exp; \ |
c160d2f5e efi_loader: add c... |
92 |
assert(__efi_entry_check()); \ |
af65db85b efi_loader: inden... |
93 94 |
debug("%sEFI: Return From: %s ", __efi_nesting_dec(), #exp); \ |
a095aadff efi_loader: Add a... |
95 |
} while(0) |
ae0bd3a98 efi_loader: write... |
96 |
/* |
d55041443 efi_loader: debug... |
97 |
* Write an indented message with EFI prefix |
ae0bd3a98 efi_loader: write... |
98 |
*/ |
d55041443 efi_loader: debug... |
99 100 101 |
#define EFI_PRINT(format, ...) ({ \ debug("%sEFI: " format, __efi_nesting(), \ ##__VA_ARGS__); \ |
ae0bd3a98 efi_loader: write... |
102 |
}) |
89aea4364 efi_loader: Use E... |
103 104 105 106 107 108 |
#ifdef CONFIG_SYS_CACHELINE_SIZE #define EFI_CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE #else /* Just use the greatest cache flush alignment requirement I'm aware of */ #define EFI_CACHELINE_SIZE 128 #endif |
1fcb7ea28 efi_loader: check... |
109 110 |
/* Key identifying current memory map */ extern efi_uintn_t efi_memory_map_key; |
50149ea37 efi_loader: Add r... |
111 |
extern struct efi_runtime_services efi_runtime_services; |
bee91169f efi_loader: Add b... |
112 |
extern struct efi_system_table systab; |
ebb4dd5bc efi_loader: efi_c... |
113 |
extern struct efi_simple_text_output_protocol efi_con_out; |
3e603ec75 efi_loader: struc... |
114 |
extern struct efi_simple_text_input_protocol efi_con_in; |
ebb4dd5bc efi_loader: efi_c... |
115 |
extern struct efi_console_control_protocol efi_console_control; |
cc5b70812 efi_loader: imple... |
116 |
extern const struct efi_device_path_to_text_protocol efi_device_path_to_text; |
e70f8dfa2 efi_loader: Initi... |
117 118 119 |
/* implementation of the EFI_DEVICE_PATH_UTILITIES_PROTOCOL */ extern const struct efi_device_path_utilities_protocol efi_device_path_utilities; |
b1b782d30 efi_loader: imple... |
120 121 122 123 |
/* deprecated version of the EFI_UNICODE_COLLATION_PROTOCOL */ extern const struct efi_unicode_collation_protocol efi_unicode_collation_protocol; /* current version of the EFI_UNICODE_COLLATION_PROTOCOL */ |
0bc4b0da7 efi_loader: EFI_U... |
124 |
extern const struct efi_unicode_collation_protocol |
95ab38167 efi_loader: renam... |
125 |
efi_unicode_collation_protocol2; |
cb728e51a efi: hii: add HII... |
126 127 |
extern const struct efi_hii_config_routing_protocol efi_hii_config_routing; extern const struct efi_hii_config_access_protocol efi_hii_config_access; |
c9bfb2229 efi_loader: Initi... |
128 129 |
extern const struct efi_hii_database_protocol efi_hii_database; extern const struct efi_hii_string_protocol efi_hii_string; |
33c37d978 efi_rng_protocol:... |
130 |
extern const struct efi_rng_protocol efi_rng_protocol; |
c1311ad4e efi_loader: Add c... |
131 |
|
adae4313c efi_loader: flesh... |
132 |
uint16_t *efi_dp_str(struct efi_device_path *dp); |
4e6b5d650 efi_loader: creat... |
133 134 |
/* GUID of the U-Boot root node */ extern const efi_guid_t efi_u_boot_guid; |
23ad52fff efi_loader: devic... |
135 136 137 138 |
#ifdef CONFIG_SANDBOX /* GUID of U-Boot host device on sandbox */ extern const efi_guid_t efi_guid_host_dev; #endif |
b3dd14b6b efi_loader: make ... |
139 140 |
/* GUID of the EFI_BLOCK_IO_PROTOCOL */ extern const efi_guid_t efi_block_io_guid; |
9975fe96b efi_loader: add b... |
141 |
extern const efi_guid_t efi_global_variable_guid; |
c1311ad4e efi_loader: Add c... |
142 |
extern const efi_guid_t efi_guid_console_control; |
cb149c663 efi_loader: Add P... |
143 |
extern const efi_guid_t efi_guid_device_path; |
f0959dbee efi_loader: imple... |
144 145 |
/* GUID of the EFI_DRIVER_BINDING_PROTOCOL */ extern const efi_guid_t efi_guid_driver_binding_protocol; |
a3a28f5f0 efi_loader: defin... |
146 147 148 149 150 151 152 153 154 155 |
/* event group ExitBootServices() invoked */ extern const efi_guid_t efi_guid_event_group_exit_boot_services; /* event group SetVirtualAddressMap() invoked */ extern const efi_guid_t efi_guid_event_group_virtual_address_change; /* event group memory map changed */ extern const efi_guid_t efi_guid_event_group_memory_map_change; /* event group boot manager about to boot */ extern const efi_guid_t efi_guid_event_group_ready_to_boot; /* event group ResetSystem() invoked (before ExitBootServices) */ extern const efi_guid_t efi_guid_event_group_reset_system; |
bc4f9133e efi_loader: suppo... |
156 157 |
/* GUID of the device tree table */ extern const efi_guid_t efi_guid_fdt; |
cb149c663 efi_loader: Add P... |
158 |
extern const efi_guid_t efi_guid_loaded_image; |
bc8fc3285 efi_loader: boott... |
159 |
extern const efi_guid_t efi_guid_loaded_image_device_path; |
cc5b70812 efi_loader: imple... |
160 |
extern const efi_guid_t efi_guid_device_path_to_text_protocol; |
2a92080d8 efi_loader: add f... |
161 162 |
extern const efi_guid_t efi_simple_file_system_protocol_guid; extern const efi_guid_t efi_file_info_guid; |
9e6835e6b efi_loader: imple... |
163 164 |
/* GUID for file system information */ extern const efi_guid_t efi_file_system_info_guid; |
e70f8dfa2 efi_loader: Initi... |
165 |
extern const efi_guid_t efi_guid_device_path_utilities_protocol; |
b1b782d30 efi_loader: imple... |
166 167 |
/* GUID of the deprecated Unicode collation protocol */ extern const efi_guid_t efi_guid_unicode_collation_protocol; |
0bc4b0da7 efi_loader: EFI_U... |
168 |
/* GUID of the Unicode collation protocol */ |
95ab38167 efi_loader: renam... |
169 |
extern const efi_guid_t efi_guid_unicode_collation_protocol2; |
cb728e51a efi: hii: add HII... |
170 171 |
extern const efi_guid_t efi_guid_hii_config_routing_protocol; extern const efi_guid_t efi_guid_hii_config_access_protocol; |
c9bfb2229 efi_loader: Initi... |
172 173 |
extern const efi_guid_t efi_guid_hii_database_protocol; extern const efi_guid_t efi_guid_hii_string_protocol; |
cb149c663 efi_loader: Add P... |
174 |
|
33c37d978 efi_rng_protocol:... |
175 176 |
/* GUID of RNG protocol */ extern const efi_guid_t efi_guid_rng_protocol; |
50149ea37 efi_loader: Add r... |
177 178 |
extern unsigned int __efi_runtime_start, __efi_runtime_stop; extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; |
1f1075c6e efi_loader: comme... |
179 180 181 |
/** * struct efi_open_protocol_info_item - open protocol info item * |
fe1599daf efi_loader: list ... |
182 183 |
* When a protocol is opened a open protocol info entry is created. * These are maintained in a list. |
1f1075c6e efi_loader: comme... |
184 185 186 |
* * @link: link to the list of open protocol info entries of a protocol * @info: information about the opening of a protocol |
fe1599daf efi_loader: list ... |
187 188 |
*/ struct efi_open_protocol_info_item { |
fe1599daf efi_loader: list ... |
189 190 191 |
struct list_head link; struct efi_open_protocol_info_entry info; }; |
1f1075c6e efi_loader: comme... |
192 193 194 |
/** * struct efi_handler - single protocol interface of a handle * |
bee91169f efi_loader: Add b... |
195 196 |
* When the UEFI payload wants to open a protocol on an object to get its * interface (usually a struct with callback functions), this struct maps the |
fe1599daf efi_loader: list ... |
197 |
* protocol GUID to the respective protocol interface |
1f1075c6e efi_loader: comme... |
198 199 200 201 202 |
* * @link: link to the list of protocols of a handle * @guid: GUID of the protocol * @protocol_interface: protocol interface * @open_infos link to the list of open protocol info items |
fe1599daf efi_loader: list ... |
203 |
*/ |
bee91169f efi_loader: Add b... |
204 |
struct efi_handler { |
69fb6b1af efi_loader: manag... |
205 |
struct list_head link; |
bee91169f efi_loader: Add b... |
206 |
const efi_guid_t *guid; |
b5349f742 efi_loader: refac... |
207 |
void *protocol_interface; |
fe1599daf efi_loader: list ... |
208 |
struct list_head open_infos; |
bee91169f efi_loader: Add b... |
209 |
}; |
fae0118e7 efi_loader: elimi... |
210 |
/** |
cd73aba65 efi_loader: mark ... |
211 212 213 214 215 216 217 |
* enum efi_object_type - type of EFI object * * In UnloadImage we must be able to identify if the handle relates to a * started image. */ enum efi_object_type { EFI_OBJECT_TYPE_UNDEFINED = 0, |
84a918e8c efi_loader: LoadI... |
218 |
EFI_OBJECT_TYPE_U_BOOT_FIRMWARE, |
cd73aba65 efi_loader: mark ... |
219 220 221 222 223 |
EFI_OBJECT_TYPE_LOADED_IMAGE, EFI_OBJECT_TYPE_STARTED_IMAGE, }; /** |
fae0118e7 efi_loader: elimi... |
224 225 226 227 228 229 230 231 232 233 234 235 |
* struct efi_object - dereferenced EFI handle * * @link: pointers to put the handle into a linked list * @protocols: linked list with the protocol interfaces installed on this * handle * * UEFI offers a flexible and expandable object model. The objects in the UEFI * API are devices, drivers, and loaded images. struct efi_object is our storage * structure for these objects. * * When including this structure into a larger structure always put it first so * that when deleting a handle the whole encompassing structure can be freed. |
bee91169f efi_loader: Add b... |
236 |
* |
fae0118e7 efi_loader: elimi... |
237 238 |
* A pointer to this structure is referred to as a handle. Typedef efi_handle_t * has been created for such pointers. |
bee91169f efi_loader: Add b... |
239 240 241 242 |
*/ struct efi_object { /* Every UEFI object is part of a global object list */ struct list_head link; |
69fb6b1af efi_loader: manag... |
243 244 |
/* The list of protocols */ struct list_head protocols; |
cd73aba65 efi_loader: mark ... |
245 |
enum efi_object_type type; |
bee91169f efi_loader: Add b... |
246 |
}; |
c68415922 efi_loader: imple... |
247 |
/** |
c982874e9 efi_loader: refac... |
248 |
* struct efi_loaded_image_obj - handle of a loaded image |
d39646a38 efi_loader: renam... |
249 250 |
* * @header: EFI object header |
556d8dc93 efi_loader: imple... |
251 252 253 |
* @exit_status: exit status passed to Exit() * @exit_data_size: exit data size passed to Exit() * @exit_data: exit data passed to Exit() |
d39646a38 efi_loader: renam... |
254 255 |
* @exit_jmp: long jump buffer for returning form started image * @entry: entry address of the relocated image |
c982874e9 efi_loader: refac... |
256 257 |
*/ struct efi_loaded_image_obj { |
d39646a38 efi_loader: renam... |
258 |
struct efi_object header; |
c982874e9 efi_loader: refac... |
259 |
efi_status_t exit_status; |
556d8dc93 efi_loader: imple... |
260 261 |
efi_uintn_t *exit_data_size; u16 **exit_data; |
c982874e9 efi_loader: refac... |
262 263 264 |
struct jmp_buf_data exit_jmp; EFIAPI efi_status_t (*entry)(efi_handle_t image_handle, struct efi_system_table *st); |
126a43f15 efi_loader: unloa... |
265 |
u16 image_type; |
c982874e9 efi_loader: refac... |
266 267 268 |
}; /** |
c68415922 efi_loader: imple... |
269 270 |
* struct efi_event * |
43bce4426 efi_loader: manag... |
271 |
* @link: Link to list of all events |
7a69e97ba efi_loader: imple... |
272 |
* @queue_link: Link to the list of queued events |
c68415922 efi_loader: imple... |
273 274 |
* @type: Type of event, see efi_create_event * @notify_tpl: Task priority level of notifications |
c68415922 efi_loader: imple... |
275 276 |
* @nofify_function: Function to call when the event is triggered * @notify_context: Data to be passed to the notify function |
b095f3c85 efi_loader: imple... |
277 |
* @group: Event group |
43bce4426 efi_loader: manag... |
278 279 |
* @trigger_time: Period of the timer * @trigger_next: Next time to trigger the timer |
c68415922 efi_loader: imple... |
280 |
* @trigger_type: Type of timer, see efi_set_timer |
43bce4426 efi_loader: manag... |
281 |
* @is_signaled: The event occurred. The event is in the signaled state. |
c68415922 efi_loader: imple... |
282 283 |
*/ struct efi_event { |
43bce4426 efi_loader: manag... |
284 |
struct list_head link; |
7a69e97ba efi_loader: imple... |
285 |
struct list_head queue_link; |
b521d29eb efi_loader: param... |
286 |
uint32_t type; |
152cade32 efi_loader: repla... |
287 |
efi_uintn_t notify_tpl; |
c68415922 efi_loader: imple... |
288 289 |
void (EFIAPI *notify_function)(struct efi_event *event, void *context); void *notify_context; |
b095f3c85 efi_loader: imple... |
290 |
const efi_guid_t *group; |
c68415922 efi_loader: imple... |
291 292 |
u64 trigger_next; u64 trigger_time; |
b521d29eb efi_loader: param... |
293 |
enum efi_timer_delay trigger_type; |
e190e8972 efi_loader: use t... |
294 |
bool is_signaled; |
c68415922 efi_loader: imple... |
295 |
}; |
bee91169f efi_loader: Add b... |
296 297 |
/* This list contains all UEFI objects we know of */ extern struct list_head efi_obj_list; |
b095f3c85 efi_loader: imple... |
298 299 |
/* List of all events */ extern struct list_head efi_events; |
bee91169f efi_loader: Add b... |
300 |
|
ab15d4149 efi_loader: imple... |
301 |
/** |
f09cea36c efi_loader: corre... |
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
* struct efi_protocol_notification - handle for notified protocol * * When a protocol interface is installed for which an event was registered with * the RegisterProtocolNotify() service this structure is used to hold the * handle on which the protocol interface was installed. * * @link: link to list of all handles notified for this event * @handle: handle on which the notified protocol interface was installed */ struct efi_protocol_notification { struct list_head link; efi_handle_t handle; }; /** |
ab15d4149 efi_loader: imple... |
317 318 319 320 |
* efi_register_notify_event - event registered by RegisterProtocolNotify() * * The address of this structure serves as registration value. * |
f09cea36c efi_loader: corre... |
321 322 323 324 325 326 |
* @link: link to list of all registered events * @event: registered event. The same event may registered for multiple * GUIDs. * @protocol: protocol for which the event is registered * @handles: linked list of all handles on which the notified protocol was * installed |
ab15d4149 efi_loader: imple... |
327 328 329 330 331 |
*/ struct efi_register_notify_event { struct list_head link; struct efi_event *event; efi_guid_t protocol; |
f09cea36c efi_loader: corre... |
332 |
struct list_head handles; |
ab15d4149 efi_loader: imple... |
333 334 335 336 |
}; /* List of all events registered by RegisterProtocolNotify() */ extern struct list_head efi_register_notify_events; |
056b45bc5 efi_loader: move ... |
337 338 |
/* Initialize efi execution environment */ efi_status_t efi_init_obj_list(void); |
f64f22325 efi_loader: expor... |
339 340 |
/* Install device tree */ efi_status_t efi_install_fdt(void *fdt); |
f9ceb6ac1 efi_loader: carve... |
341 342 |
/* Run loaded UEFI image */ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size); |
88192098d efi_loader: initi... |
343 344 |
/* Initialize variable services */ efi_status_t efi_init_variables(void); |
29018abb0 efi_loader: let t... |
345 346 |
/* Notify ExitBootServices() is called */ void efi_variables_boot_exit_notify(void); |
4e6b5d650 efi_loader: creat... |
347 348 |
/* Called by bootefi to initialize root node */ efi_status_t efi_root_node_register(void); |
640adadf8 efi_loader: calcu... |
349 350 |
/* Called by bootefi to initialize runtime */ efi_status_t efi_initialize_system_table(void); |
7f95104d9 efi_loader: detac... |
351 352 |
/* efi_runtime_detach() - detach unimplemented runtime functions */ void efi_runtime_detach(void); |
91be9a77b efi_console: set ... |
353 |
/* Called by bootefi to make console interface available */ |
6f566c231 efi_loader: retur... |
354 |
efi_status_t efi_console_register(void); |
2a22d05d3 efi_loader: Add d... |
355 |
/* Called by bootefi to make all disk storage accessible as EFI objects */ |
df9cf561b efi_loader: corre... |
356 |
efi_status_t efi_disk_register(void); |
64e4db0f1 efi_loader: make ... |
357 358 359 360 |
/* Create handles and protocols for the partitions of a block device */ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, const char *if_typename, int diskid, const char *pdevname); |
be8d32419 efi_loader: Add G... |
361 |
/* Called by bootefi to make GOP (graphical) interface available */ |
80ea9b099 efi_loader: retur... |
362 |
efi_status_t efi_gop_register(void); |
0efe1bcf5 efi_loader: Add n... |
363 |
/* Called by bootefi to make the network interface available */ |
075d425d6 efi_loader: retur... |
364 |
efi_status_t efi_net_register(void); |
b3d609004 efi_loader: imple... |
365 |
/* Called by bootefi to make the watchdog available */ |
d7b181d57 efi_loader: consi... |
366 |
efi_status_t efi_watchdog_register(void); |
ec80b4735 efi_loader: Imple... |
367 |
efi_status_t efi_initrd_register(void); |
e663b350f smbios: Expose in... |
368 |
/* Called by bootefi to make SMBIOS tables available */ |
0864c565a efi: Update some ... |
369 |
/** |
86df34d42 efi_loader: Insta... |
370 371 372 373 374 375 376 377 |
* efi_acpi_register() - write out ACPI tables * * Called by bootefi to make ACPI tables available * * @return 0 if OK, -ENOMEM if no memory is available for the tables */ efi_status_t efi_acpi_register(void); /** |
0864c565a efi: Update some ... |
378 379 380 381 382 383 |
* efi_smbios_register() - write out SMBIOS tables * * Called by bootefi to make SMBIOS tables available * * @return 0 if OK, -ENOMEM if no memory is available for the tables */ |
7657152bd efi_loader: efi_s... |
384 |
efi_status_t efi_smbios_register(void); |
0efe1bcf5 efi_loader: Add n... |
385 |
|
2a92080d8 efi_loader: add f... |
386 387 |
struct efi_simple_file_system_protocol * efi_fs_from_path(struct efi_device_path *fp); |
0efe1bcf5 efi_loader: Add n... |
388 389 |
/* Called by networking code to memorize the dhcp ack package */ void efi_net_set_dhcp_ack(void *pkt, int len); |
b3d609004 efi_loader: imple... |
390 391 |
/* Called by efi_set_watchdog_timer to reset the timer */ efi_status_t efi_set_watchdog(unsigned long timeout); |
0efe1bcf5 efi_loader: Add n... |
392 |
|
bee91169f efi_loader: Add b... |
393 394 395 |
/* Called from places to check whether a timer expired */ void efi_timer_check(void); /* PE loader implementation */ |
8f7e2b298 efi_loader: set e... |
396 397 |
efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle, void *efi, struct efi_loaded_image *loaded_image_info); |
bee91169f efi_loader: Add b... |
398 399 |
/* Called once to store the pristine gd pointer */ void efi_save_gd(void); |
c160d2f5e efi_loader: add c... |
400 401 |
/* Special case handler for error/abort that just tries to dtrt to get * back to u-boot world */ |
bee91169f efi_loader: Add b... |
402 |
void efi_restore_gd(void); |
50149ea37 efi_loader: Add r... |
403 404 |
/* Call this to relocate the runtime section to an address space */ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); |
0f4060ebc efi_loader: Pass ... |
405 |
/* Call this to set the current device name */ |
c07ad7c03 efi_loader: Pass ... |
406 |
void efi_set_bootdev(const char *dev, const char *devnr, const char *path); |
44549d62c efi_loader: helpe... |
407 |
/* Add a new object to the object list. */ |
fae0118e7 efi_loader: elimi... |
408 |
void efi_add_handle(efi_handle_t obj); |
2edab5e2e efi_loader: make ... |
409 |
/* Create handle */ |
2074f7006 efi_loader: consi... |
410 |
efi_status_t efi_create_handle(efi_handle_t *handle); |
678e03a00 efi_loader: new f... |
411 |
/* Delete handle */ |
fae0118e7 efi_loader: elimi... |
412 |
void efi_delete_handle(efi_handle_t obj); |
1b68153af efi_loader: rewor... |
413 |
/* Call this to validate a handle and find the EFI object for it */ |
2074f7006 efi_loader: consi... |
414 |
struct efi_object *efi_search_obj(const efi_handle_t handle); |
d7e0b0109 efi_loader: boott... |
415 416 417 418 419 420 421 |
/* Load image */ efi_status_t EFIAPI efi_load_image(bool boot_policy, efi_handle_t parent_image, struct efi_device_path *file_path, void *source_buffer, efi_uintn_t source_size, efi_handle_t *image_handle); |
f69d63fae efi_loader: use e... |
422 423 424 425 |
/* Start image */ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle, efi_uintn_t *exit_data_size, u16 **exit_data); |
d7e0b0109 efi_loader: boott... |
426 427 |
/* Unload image */ efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle); |
3f79a2b53 efi_loader: helpe... |
428 |
/* Find a protocol on a handle */ |
2074f7006 efi_loader: consi... |
429 |
efi_status_t efi_search_protocol(const efi_handle_t handle, |
3f79a2b53 efi_loader: helpe... |
430 431 432 |
const efi_guid_t *protocol_guid, struct efi_handler **handler); /* Install new protocol on a handle */ |
2074f7006 efi_loader: consi... |
433 434 |
efi_status_t efi_add_protocol(const efi_handle_t handle, const efi_guid_t *protocol, |
3f79a2b53 efi_loader: helpe... |
435 436 |
void *protocol_interface); /* Delete protocol from a handle */ |
2074f7006 efi_loader: consi... |
437 438 |
efi_status_t efi_remove_protocol(const efi_handle_t handle, const efi_guid_t *protocol, |
3f79a2b53 efi_loader: helpe... |
439 440 |
void *protocol_interface); /* Delete all protocols from a handle */ |
2074f7006 efi_loader: consi... |
441 |
efi_status_t efi_remove_all_protocols(const efi_handle_t handle); |
7657ae12f efi_loader: expor... |
442 443 444 |
/* Install multiple protocol interfaces */ efi_status_t EFIAPI efi_install_multiple_protocol_interfaces (efi_handle_t *handle, ...); |
b51ec6397 efi_loader: expor... |
445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
/* Get handles that support a given protocol */ efi_status_t EFIAPI efi_locate_handle_buffer( enum efi_locate_search_type search_type, const efi_guid_t *protocol, void *search_key, efi_uintn_t *no_handles, efi_handle_t **buffer); /* Close an previously opened protocol interface */ efi_status_t EFIAPI efi_close_protocol(efi_handle_t handle, const efi_guid_t *protocol, efi_handle_t agent_handle, efi_handle_t controller_handle); /* Open a protocol interface */ efi_status_t EFIAPI efi_handle_protocol(efi_handle_t handle, const efi_guid_t *protocol, void **protocol_interface); |
49deb455e efi_loader: refac... |
459 |
/* Call this to create an event */ |
152cade32 efi_loader: repla... |
460 |
efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, |
49deb455e efi_loader: refac... |
461 462 463 |
void (EFIAPI *notify_function) ( struct efi_event *event, void *context), |
b095f3c85 efi_loader: imple... |
464 465 |
void *notify_context, efi_guid_t *group, struct efi_event **event); |
bfc724625 efi_loader: refac... |
466 |
/* Call this to set a timer */ |
b521d29eb efi_loader: param... |
467 |
efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, |
bfc724625 efi_loader: refac... |
468 |
uint64_t trigger_time); |
91be9a77b efi_console: set ... |
469 |
/* Call this to signal an event */ |
7eaa900e5 efi_loader: event... |
470 |
void efi_signal_event(struct efi_event *event); |
50149ea37 efi_loader: Add r... |
471 |
|
2a92080d8 efi_loader: add f... |
472 473 474 475 476 477 |
/* open file system: */ struct efi_simple_file_system_protocol *efi_simple_file_system( struct blk_desc *desc, int part, struct efi_device_path *dp); /* open file from device-path: */ struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp); |
c3772ca1e efi_loader: macro... |
478 479 480 481 482 483 484 485 486 487 |
/** * efi_size_in_pages() - convert size in bytes to size in pages * * This macro returns the number of EFI memory pages required to hold 'size' * bytes. * * @size: size in bytes * Return: size in pages */ #define efi_size_in_pages(size) ((size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT) |
5d00995c3 efi_loader: Imple... |
488 489 490 |
/* Generic EFI memory allocator, call this to get memory */ void *efi_alloc(uint64_t len, int memory_type); /* More specific EFI memory allocator, called by EFI payloads */ |
f5a2a9389 efi_loader: consi... |
491 |
efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages, |
5d00995c3 efi_loader: Imple... |
492 |
uint64_t *memory); |
b61d857b2 efi_loader: Readd... |
493 |
/* EFI memory free function. */ |
f5a2a9389 efi_loader: consi... |
494 |
efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages); |
ead1274b7 efi_loader: Move ... |
495 |
/* EFI memory allocator for small allocations */ |
f5a2a9389 efi_loader: consi... |
496 |
efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, |
ead1274b7 efi_loader: Move ... |
497 |
void **buffer); |
42417bc84 efi_loader: Track... |
498 499 |
/* EFI pool memory free function. */ efi_status_t efi_free_pool(void *buffer); |
5d00995c3 efi_loader: Imple... |
500 |
/* Returns the EFI memory map */ |
f5a2a9389 efi_loader: consi... |
501 |
efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, |
5d00995c3 efi_loader: Imple... |
502 |
struct efi_mem_desc *memory_map, |
f5a2a9389 efi_loader: consi... |
503 504 |
efi_uintn_t *map_key, efi_uintn_t *descriptor_size, |
5d00995c3 efi_loader: Imple... |
505 506 |
uint32_t *descriptor_version); /* Adds a range into the EFI memory map */ |
b225c92fd efi_loader: Chang... |
507 508 |
efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, bool overlap_only_ram); |
b5b9eff26 efi_loader: Extra... |
509 510 511 |
/* Adds a conventional range into the EFI memory map */ efi_status_t efi_add_conventional_memory_map(u64 ram_start, u64 ram_end, u64 ram_top); |
05ef48a24 efi_driver: EFI b... |
512 |
/* Called by board init to initialize the EFI drivers */ |
038782a27 efi_driver: retur... |
513 |
efi_status_t efi_driver_init(void); |
5d00995c3 efi_loader: Imple... |
514 515 |
/* Called by board init to initialize the EFI memory map */ int efi_memory_init(void); |
488bf12d8 efi_loader: Expos... |
516 517 |
/* Adds new or overrides configuration table entry to the system table */ efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table); |
56d928885 efi_loader: retur... |
518 |
/* Sets up a loaded image */ |
c982874e9 efi_loader: refac... |
519 520 521 522 |
efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path, struct efi_device_path *file_path, struct efi_loaded_image_obj **handle_ptr, struct efi_loaded_image **info_ptr); |
c9a63f44b efi_loader: new f... |
523 524 |
/* Print information about all loaded images */ void efi_print_image_infos(void *pc); |
5d00995c3 efi_loader: Imple... |
525 |
|
51735ae0e efi_loader: Add b... |
526 527 528 529 |
#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER extern void *efi_bounce_buffer; #define EFI_LOADER_BOUNCE_BUFFER_SIZE (64 * 1024 * 1024) #endif |
b66c60dde efi_loader: add d... |
530 531 |
struct efi_device_path *efi_dp_next(const struct efi_device_path *dp); |
ff401d3f8 efi_loader: efi_d... |
532 533 |
int efi_dp_match(const struct efi_device_path *a, const struct efi_device_path *b); |
b66c60dde efi_loader: add d... |
534 535 |
struct efi_object *efi_dp_find_obj(struct efi_device_path *dp, struct efi_device_path **rem); |
f6dd3f359 efi_loader: corre... |
536 537 538 539 |
/* get size of the first device path instance excluding end node */ efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp); /* size of multi-instance device path excluding end node */ efi_uintn_t efi_dp_size(const struct efi_device_path *dp); |
b66c60dde efi_loader: add d... |
540 541 542 543 544 |
struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp); struct efi_device_path *efi_dp_append(const struct efi_device_path *dp1, const struct efi_device_path *dp2); struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, const struct efi_device_path *node); |
211314c10 efi_loader: imple... |
545 546 547 548 |
/* Create a device path node of given type, sub-type, length */ struct efi_device_path *efi_dp_create_device_node(const u8 type, const u8 sub_type, const u16 length); |
3acef5da4 efi_loader: compl... |
549 550 551 552 553 554 555 556 557 |
/* Append device path instance */ struct efi_device_path *efi_dp_append_instance( const struct efi_device_path *dp, const struct efi_device_path *dpi); /* Get next device path instance */ struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp, efi_uintn_t *size); /* Check if a device path contains muliple instances */ bool efi_dp_is_multi_instance(const struct efi_device_path *dp); |
b66c60dde efi_loader: add d... |
558 |
|
b66c60dde efi_loader: add d... |
559 |
struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); |
98d48bdf4 efi_loader: provi... |
560 561 |
/* Create a device node for a block device partition. */ struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part); |
b66c60dde efi_loader: add d... |
562 563 564 |
struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, const char *path); struct efi_device_path *efi_dp_from_eth(void); |
bf19273e8 efi_loader: Add m... |
565 566 567 |
struct efi_device_path *efi_dp_from_mem(uint32_t mem_type, uint64_t start_address, uint64_t end_address); |
65436f91c efi_loader: provi... |
568 569 570 |
/* Determine the last device path node that is not the end node. */ const struct efi_device_path *efi_dp_last_node( const struct efi_device_path *dp); |
04298686a efi_loader: retur... |
571 572 573 |
efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, struct efi_device_path **device_path, struct efi_device_path **file_path); |
f1589ffb3 efi_loader: add e... |
574 575 576 577 |
efi_status_t efi_dp_from_name(const char *dev, const char *devnr, const char *path, struct efi_device_path **device, struct efi_device_path **file); |
b66c60dde efi_loader: add d... |
578 579 580 581 |
#define EFI_DP_TYPE(_dp, _type, _subtype) \ (((_dp)->type == DEVICE_PATH_TYPE_##_type) && \ ((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype)) |
50149ea37 efi_loader: Add r... |
582 583 584 585 |
/* * Use these to indicate that your code / data should go into the EFI runtime * section and thus still be available when the OS is running */ |
7e21fbca2 efi_loader: Renam... |
586 587 |
#define __efi_runtime_data __attribute__ ((section (".data.efi_runtime"))) #define __efi_runtime __attribute__ ((section (".text.efi_runtime"))) |
bee91169f efi_loader: Add b... |
588 |
|
e771b4b39 efi_loader: add R... |
589 590 |
/* Indicate supported runtime services */ efi_status_t efi_init_runtime_supported(void); |
a39f39cdd efi_loader: updat... |
591 592 |
/* Update CRC32 in table header */ void __efi_runtime efi_update_table_header_crc32(struct efi_table_hdr *table); |
80a4800ee efi_loader: Allow... |
593 594 |
/* Call this with mmio_ptr as the _pointer_ to a pointer to an MMIO region * to make it available at runtime */ |
22c793e6a efi_loader: exit ... |
595 |
efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len); |
80a4800ee efi_loader: Allow... |
596 597 |
/* Boards may provide the functions below to implement RTS functionality */ |
3c63db9ca efi_loader: Renam... |
598 |
void __efi_runtime EFIAPI efi_reset_system( |
80a4800ee efi_loader: Allow... |
599 600 601 |
enum efi_reset_type reset_type, efi_status_t reset_status, unsigned long data_size, void *reset_data); |
22c793e6a efi_loader: exit ... |
602 603 604 |
/* Architecture specific initialization of the EFI subsystem */ efi_status_t efi_reset_system_init(void); |
80a4800ee efi_loader: Allow... |
605 |
|
3c63db9ca efi_loader: Renam... |
606 |
efi_status_t __efi_runtime EFIAPI efi_get_time( |
80a4800ee efi_loader: Allow... |
607 608 |
struct efi_time *time, struct efi_time_cap *capabilities); |
80a4800ee efi_loader: Allow... |
609 |
|
656f17106 efi_loader: expor... |
610 |
efi_status_t __efi_runtime EFIAPI efi_set_time(struct efi_time *time); |
623b3a579 efi_selftest: pro... |
611 612 613 614 615 616 617 618 |
#ifdef CONFIG_CMD_BOOTEFI_SELFTEST /* * Entry point for the tests of the EFI API. * It is called by 'bootefi selftest' */ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle, struct efi_system_table *systab); #endif |
0bda81bfd efi_loader: use c... |
619 620 621 |
efi_status_t EFIAPI efi_get_variable(u16 *variable_name, const efi_guid_t *vendor, u32 *attributes, efi_uintn_t *data_size, void *data); |
45c66f9cd efi_loader: adjus... |
622 623 |
efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size, u16 *variable_name, |
7a4e717b9 efi_loader: defin... |
624 |
efi_guid_t *vendor); |
0bda81bfd efi_loader: use c... |
625 626 |
efi_status_t EFIAPI efi_set_variable(u16 *variable_name, const efi_guid_t *vendor, u32 attributes, |
452257a34 efi_loader: efi_s... |
627 |
efi_uintn_t data_size, const void *data); |
ad644e7c1 efi_loader: efi v... |
628 |
|
ce43528d6 efi_loader: move ... |
629 630 631 632 |
efi_status_t EFIAPI efi_query_variable_info( u32 attributes, u64 *maximum_variable_storage_size, u64 *remaining_variable_storage_size, u64 *maximum_variable_size); |
1a82b3413 efi_loader: bootm... |
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
/* * See section 3.1.3 in the v2.7 UEFI spec for more details on * the layout of EFI_LOAD_OPTION. In short it is: * * typedef struct _EFI_LOAD_OPTION { * UINT32 Attributes; * UINT16 FilePathListLength; * // CHAR16 Description[]; <-- variable length, NULL terminated * // EFI_DEVICE_PATH_PROTOCOL FilePathList[]; * <-- FilePathListLength bytes * // UINT8 OptionalData[]; * } EFI_LOAD_OPTION; */ struct efi_load_option { u32 attributes; u16 file_path_length; u16 *label; struct efi_device_path *file_path; |
39a1ff8ce efi_loader: optio... |
651 |
const u8 *optional_data; |
1a82b3413 efi_loader: bootm... |
652 653 654 655 |
}; void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data); unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data); |
6b95b38c4 efi_loader: rewor... |
656 |
efi_status_t efi_bootmgr_load(efi_handle_t *handle); |
9975fe96b efi_loader: add b... |
657 |
|
9b5e6396b efi_loader: simpl... |
658 |
#else /* CONFIG_IS_ENABLED(EFI_LOADER) */ |
bee91169f efi_loader: Add b... |
659 |
|
50149ea37 efi_loader: Add r... |
660 |
/* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */ |
3c63db9ca efi_loader: Renam... |
661 662 |
#define __efi_runtime_data #define __efi_runtime |
22c793e6a efi_loader: exit ... |
663 664 665 666 |
static inline efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len) { return EFI_SUCCESS; } |
50149ea37 efi_loader: Add r... |
667 |
|
bee91169f efi_loader: Add b... |
668 669 |
/* No loader configured, stub out EFI_ENTRY */ static inline void efi_restore_gd(void) { } |
c07ad7c03 efi_loader: Pass ... |
670 671 |
static inline void efi_set_bootdev(const char *dev, const char *devnr, const char *path) { } |
0efe1bcf5 efi_loader: Add n... |
672 |
static inline void efi_net_set_dhcp_ack(void *pkt, int len) { } |
c9a63f44b efi_loader: new f... |
673 |
static inline void efi_print_image_infos(void *pc) { } |
bee91169f efi_loader: Add b... |
674 |
|
9b5e6396b efi_loader: simpl... |
675 |
#endif /* CONFIG_IS_ENABLED(EFI_LOADER) */ |
cd9e18dee efi_loader: guard... |
676 677 |
#endif /* _EFI_LOADER_H */ |