Commit 7cbc12415dad707b94d755311126059e5cdc65e3
Committed by
Alexander Graf
1 parent
ff925938c8
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
efi_loader: initalize EFI object list only once
If several EFI applications are executed in sequence we want to keep the content of the EFI object list. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Showing 1 changed file with 36 additions and 26 deletions Side-by-side Diff
cmd/bootefi.c
... | ... | @@ -20,6 +20,8 @@ |
20 | 20 | |
21 | 21 | DECLARE_GLOBAL_DATA_PTR; |
22 | 22 | |
23 | +static uint8_t efi_obj_list_initalized; | |
24 | + | |
23 | 25 | /* |
24 | 26 | * When booting using the "bootefi" command, we don't know which |
25 | 27 | * physical device the file came from. So we create a pseudo-device |
... | ... | @@ -104,6 +106,38 @@ |
104 | 106 | }, |
105 | 107 | }; |
106 | 108 | |
109 | +/* Initialize and populate EFI object list */ | |
110 | +static void efi_init_obj_list(void) | |
111 | +{ | |
112 | + efi_obj_list_initalized = 1; | |
113 | + | |
114 | + list_add_tail(&loaded_image_info_obj.link, &efi_obj_list); | |
115 | + list_add_tail(&bootefi_device_obj.link, &efi_obj_list); | |
116 | + efi_console_register(); | |
117 | +#ifdef CONFIG_PARTITIONS | |
118 | + efi_disk_register(); | |
119 | +#endif | |
120 | +#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO) | |
121 | + efi_gop_register(); | |
122 | +#endif | |
123 | +#ifdef CONFIG_NET | |
124 | + void *nethandle = loaded_image_info.device_handle; | |
125 | + efi_net_register(&nethandle); | |
126 | + | |
127 | + if (!memcmp(bootefi_device_path[0].str, "N\0e\0t", 6)) | |
128 | + loaded_image_info.device_handle = nethandle; | |
129 | + else | |
130 | + loaded_image_info.device_handle = bootefi_device_path; | |
131 | +#endif | |
132 | +#ifdef CONFIG_GENERATE_SMBIOS_TABLE | |
133 | + efi_smbios_register(); | |
134 | +#endif | |
135 | + | |
136 | + /* Initialize EFI runtime services */ | |
137 | + efi_reset_system_init(); | |
138 | + efi_get_time_init(); | |
139 | +} | |
140 | + | |
107 | 141 | static void *copy_fdt(void *fdt) |
108 | 142 | { |
109 | 143 | u64 fdt_size = fdt_totalsize(fdt); |
... | ... | @@ -223,32 +257,8 @@ |
223 | 257 | return -ENOENT; |
224 | 258 | |
225 | 259 | /* Initialize and populate EFI object list */ |
226 | - INIT_LIST_HEAD(&efi_obj_list); | |
227 | - list_add_tail(&loaded_image_info_obj.link, &efi_obj_list); | |
228 | - list_add_tail(&bootefi_device_obj.link, &efi_obj_list); | |
229 | - efi_console_register(); | |
230 | -#ifdef CONFIG_PARTITIONS | |
231 | - efi_disk_register(); | |
232 | -#endif | |
233 | -#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO) | |
234 | - efi_gop_register(); | |
235 | -#endif | |
236 | -#ifdef CONFIG_NET | |
237 | - void *nethandle = loaded_image_info.device_handle; | |
238 | - efi_net_register(&nethandle); | |
239 | - | |
240 | - if (!memcmp(bootefi_device_path[0].str, "N\0e\0t", 6)) | |
241 | - loaded_image_info.device_handle = nethandle; | |
242 | - else | |
243 | - loaded_image_info.device_handle = bootefi_device_path; | |
244 | -#endif | |
245 | -#ifdef CONFIG_GENERATE_SMBIOS_TABLE | |
246 | - efi_smbios_register(); | |
247 | -#endif | |
248 | - | |
249 | - /* Initialize EFI runtime services */ | |
250 | - efi_reset_system_init(); | |
251 | - efi_get_time_init(); | |
260 | + if (!efi_obj_list_initalized) | |
261 | + efi_init_obj_list(); | |
252 | 262 | |
253 | 263 | /* Call our payload! */ |
254 | 264 | debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry); |
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999
-
mentioned in commit f4f999