AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * EFI setup code |
| 4 | * |
| 5 | * Copyright (c) 2016-2018 Alexander Graf et al. |
| 6 | */ |
| 7 | |
Heinrich Schuchardt | 149108a | 2021-06-29 13:33:09 +0200 | [diff] [blame] | 8 | #define LOG_CATEGORY LOGC_EFI |
| 9 | |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 10 | #include <efi_loader.h> |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 11 | #include <efi_variable.h> |
Heinrich Schuchardt | 149108a | 2021-06-29 13:33:09 +0200 | [diff] [blame] | 12 | #include <log.h> |
Heinrich Schuchardt | b927663 | 2023-02-10 09:02:56 +0100 | [diff] [blame] | 13 | #include <asm-generic/unaligned.h> |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 14 | |
| 15 | #define OBJ_LIST_NOT_INITIALIZED 1 |
| 16 | |
Heinrich Schuchardt | 15b1bf1 | 2020-03-19 18:21:58 +0000 | [diff] [blame] | 17 | efi_status_t efi_obj_list_initialized = OBJ_LIST_NOT_INITIALIZED; |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 18 | |
Heinrich Schuchardt | 52cbac9 | 2019-05-04 11:47:48 +0200 | [diff] [blame] | 19 | /* |
| 20 | * Allow unaligned memory access. |
| 21 | * |
| 22 | * This routine is overridden by architectures providing this feature. |
| 23 | */ |
| 24 | void __weak allow_unaligned(void) |
| 25 | { |
| 26 | } |
| 27 | |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 28 | /** |
| 29 | * efi_init_platform_lang() - define supported languages |
| 30 | * |
| 31 | * Set the PlatformLangCodes and PlatformLang variables. |
| 32 | * |
| 33 | * Return: status code |
| 34 | */ |
| 35 | static efi_status_t efi_init_platform_lang(void) |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 36 | { |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 37 | efi_status_t ret; |
| 38 | efi_uintn_t data_size = 0; |
| 39 | char *lang = CONFIG_EFI_PLATFORM_LANG_CODES; |
| 40 | char *pos; |
Heinrich Schuchardt | 734d325 | 2019-04-05 02:45:21 +0200 | [diff] [blame] | 41 | |
| 42 | /* |
| 43 | * Variable PlatformLangCodes defines the language codes that the |
| 44 | * machine can support. |
| 45 | */ |
Simon Glass | 156ccbc | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 46 | ret = efi_set_variable_int(u"PlatformLangCodes", |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 47 | &efi_global_variable_guid, |
| 48 | EFI_VARIABLE_BOOTSERVICE_ACCESS | |
| 49 | EFI_VARIABLE_RUNTIME_ACCESS | |
| 50 | EFI_VARIABLE_READ_ONLY, |
| 51 | sizeof(CONFIG_EFI_PLATFORM_LANG_CODES), |
| 52 | CONFIG_EFI_PLATFORM_LANG_CODES, false); |
Heinrich Schuchardt | 734d325 | 2019-04-05 02:45:21 +0200 | [diff] [blame] | 53 | if (ret != EFI_SUCCESS) |
| 54 | goto out; |
| 55 | |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 56 | /* |
| 57 | * Variable PlatformLang defines the language that the machine has been |
| 58 | * configured for. |
| 59 | */ |
Simon Glass | 156ccbc | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 60 | ret = efi_get_variable_int(u"PlatformLang", |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 61 | &efi_global_variable_guid, |
| 62 | NULL, &data_size, &pos, NULL); |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 63 | if (ret == EFI_BUFFER_TOO_SMALL) { |
| 64 | /* The variable is already set. Do not change it. */ |
| 65 | ret = EFI_SUCCESS; |
| 66 | goto out; |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * The list of supported languages is semicolon separated. Use the first |
| 71 | * language to initialize PlatformLang. |
| 72 | */ |
| 73 | pos = strchr(lang, ';'); |
| 74 | if (pos) |
| 75 | *pos = 0; |
| 76 | |
Simon Glass | 156ccbc | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 77 | ret = efi_set_variable_int(u"PlatformLang", |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 78 | &efi_global_variable_guid, |
| 79 | EFI_VARIABLE_NON_VOLATILE | |
| 80 | EFI_VARIABLE_BOOTSERVICE_ACCESS | |
| 81 | EFI_VARIABLE_RUNTIME_ACCESS, |
| 82 | 1 + strlen(lang), lang, false); |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 83 | out: |
| 84 | if (ret != EFI_SUCCESS) |
| 85 | printf("EFI: cannot initialize platform language settings\n"); |
| 86 | return ret; |
| 87 | } |
| 88 | |
AKASHI Takahiro | d0f0794 | 2020-04-14 11:51:45 +0900 | [diff] [blame] | 89 | #ifdef CONFIG_EFI_SECURE_BOOT |
| 90 | /** |
| 91 | * efi_init_secure_boot - initialize secure boot state |
| 92 | * |
Heinrich Schuchardt | 30f92ce | 2020-05-03 16:29:00 +0200 | [diff] [blame] | 93 | * Return: status code |
AKASHI Takahiro | d0f0794 | 2020-04-14 11:51:45 +0900 | [diff] [blame] | 94 | */ |
| 95 | static efi_status_t efi_init_secure_boot(void) |
| 96 | { |
| 97 | efi_guid_t signature_types[] = { |
| 98 | EFI_CERT_SHA256_GUID, |
| 99 | EFI_CERT_X509_GUID, |
| 100 | }; |
| 101 | efi_status_t ret; |
| 102 | |
Simon Glass | 156ccbc | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 103 | ret = efi_set_variable_int(u"SignatureSupport", |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 104 | &efi_global_variable_guid, |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 105 | EFI_VARIABLE_READ_ONLY | |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 106 | EFI_VARIABLE_BOOTSERVICE_ACCESS | |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 107 | EFI_VARIABLE_RUNTIME_ACCESS, |
Heinrich Schuchardt | dc90e5c | 2020-06-24 19:38:29 +0200 | [diff] [blame] | 108 | sizeof(signature_types), |
| 109 | &signature_types, false); |
AKASHI Takahiro | d0f0794 | 2020-04-14 11:51:45 +0900 | [diff] [blame] | 110 | if (ret != EFI_SUCCESS) |
| 111 | printf("EFI: cannot initialize SignatureSupport variable\n"); |
| 112 | |
| 113 | return ret; |
| 114 | } |
| 115 | #else |
| 116 | static efi_status_t efi_init_secure_boot(void) |
| 117 | { |
| 118 | return EFI_SUCCESS; |
| 119 | } |
| 120 | #endif /* CONFIG_EFI_SECURE_BOOT */ |
| 121 | |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 122 | /** |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 123 | * efi_init_capsule - initialize capsule update state |
| 124 | * |
| 125 | * Return: status code |
| 126 | */ |
| 127 | static efi_status_t efi_init_capsule(void) |
| 128 | { |
| 129 | efi_status_t ret = EFI_SUCCESS; |
| 130 | |
Ilias Apalodimas | e10fffe | 2023-01-20 13:58:48 +0200 | [diff] [blame] | 131 | if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) { |
Etienne Carriere | 4429393 | 2023-02-16 18:21:41 +0100 | [diff] [blame] | 132 | u16 var_name16[12]; |
| 133 | |
| 134 | efi_create_indexed_name(var_name16, sizeof(var_name16), |
| 135 | "Capsule", CONFIG_EFI_CAPSULE_MAX); |
| 136 | |
Simon Glass | 156ccbc | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 137 | ret = efi_set_variable_int(u"CapsuleMax", |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 138 | &efi_guid_capsule_report, |
| 139 | EFI_VARIABLE_READ_ONLY | |
| 140 | EFI_VARIABLE_BOOTSERVICE_ACCESS | |
| 141 | EFI_VARIABLE_RUNTIME_ACCESS, |
Etienne Carriere | 4429393 | 2023-02-16 18:21:41 +0100 | [diff] [blame] | 142 | 22, var_name16, false); |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 143 | if (ret != EFI_SUCCESS) |
| 144 | printf("EFI: cannot initialize CapsuleMax variable\n"); |
| 145 | } |
| 146 | |
| 147 | return ret; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * efi_init_os_indications() - indicate supported features for OS requests |
| 152 | * |
| 153 | * Set the OsIndicationsSupported variable. |
| 154 | * |
| 155 | * Return: status code |
| 156 | */ |
| 157 | static efi_status_t efi_init_os_indications(void) |
| 158 | { |
| 159 | u64 os_indications_supported = 0; |
| 160 | |
| 161 | if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) |
| 162 | os_indications_supported |= |
| 163 | EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED; |
| 164 | |
AKASHI Takahiro | c74cd8b | 2020-11-17 09:27:56 +0900 | [diff] [blame] | 165 | if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK)) |
| 166 | os_indications_supported |= |
| 167 | EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED; |
| 168 | |
AKASHI Takahiro | 8d99026 | 2020-11-30 18:12:11 +0900 | [diff] [blame] | 169 | if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT)) |
| 170 | os_indications_supported |= |
| 171 | EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED; |
| 172 | |
Simon Glass | 156ccbc | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 173 | return efi_set_variable_int(u"OsIndicationsSupported", |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 174 | &efi_global_variable_guid, |
| 175 | EFI_VARIABLE_BOOTSERVICE_ACCESS | |
| 176 | EFI_VARIABLE_RUNTIME_ACCESS | |
| 177 | EFI_VARIABLE_READ_ONLY, |
| 178 | sizeof(os_indications_supported), |
| 179 | &os_indications_supported, false); |
| 180 | } |
| 181 | |
Heinrich Schuchardt | 149108a | 2021-06-29 13:33:09 +0200 | [diff] [blame] | 182 | /** |
AKASHI Takahiro | 023d9c9 | 2022-10-21 12:01:57 +0900 | [diff] [blame] | 183 | * efi_init_early() - handle initialization at early stage |
AKASHI Takahiro | a57ad20 | 2022-04-19 10:05:11 +0900 | [diff] [blame] | 184 | * |
AKASHI Takahiro | 023d9c9 | 2022-10-21 12:01:57 +0900 | [diff] [blame] | 185 | * expected to be called in board_init_r(). |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 186 | * |
| 187 | * Return: status code |
| 188 | */ |
AKASHI Takahiro | 023d9c9 | 2022-10-21 12:01:57 +0900 | [diff] [blame] | 189 | int efi_init_early(void) |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 190 | { |
AKASHI Takahiro | 023d9c9 | 2022-10-21 12:01:57 +0900 | [diff] [blame] | 191 | efi_status_t ret; |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 192 | |
Heinrich Schuchardt | 52cbac9 | 2019-05-04 11:47:48 +0200 | [diff] [blame] | 193 | /* Allow unaligned memory access */ |
| 194 | allow_unaligned(); |
| 195 | |
Heinrich Schuchardt | c067cef | 2020-05-20 21:27:29 +0200 | [diff] [blame] | 196 | /* Initialize root node */ |
| 197 | ret = efi_root_node_register(); |
| 198 | if (ret != EFI_SUCCESS) |
| 199 | goto out; |
| 200 | |
AKASHI Takahiro | f7a963c | 2020-06-09 14:09:31 +0900 | [diff] [blame] | 201 | ret = efi_console_register(); |
| 202 | if (ret != EFI_SUCCESS) |
| 203 | goto out; |
| 204 | |
Heinrich Schuchardt | 8f8fe1d | 2022-10-05 11:28:47 +0200 | [diff] [blame] | 205 | /* Initialize EFI driver uclass */ |
| 206 | ret = efi_driver_init(); |
AKASHI Takahiro | 023d9c9 | 2022-10-21 12:01:57 +0900 | [diff] [blame] | 207 | if (ret != EFI_SUCCESS) |
| 208 | goto out; |
AKASHI Takahiro | a57ad20 | 2022-04-19 10:05:11 +0900 | [diff] [blame] | 209 | |
AKASHI Takahiro | a57ad20 | 2022-04-19 10:05:11 +0900 | [diff] [blame] | 210 | return 0; |
AKASHI Takahiro | 023d9c9 | 2022-10-21 12:01:57 +0900 | [diff] [blame] | 211 | out: |
| 212 | /* never re-init UEFI subsystem */ |
| 213 | efi_obj_list_initialized = ret; |
| 214 | |
| 215 | return -1; |
AKASHI Takahiro | a57ad20 | 2022-04-19 10:05:11 +0900 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | /** |
| 219 | * efi_init_obj_list() - Initialize and populate EFI object list |
| 220 | * |
| 221 | * Return: status code |
| 222 | */ |
| 223 | efi_status_t efi_init_obj_list(void) |
| 224 | { |
| 225 | efi_status_t ret = EFI_SUCCESS; |
| 226 | |
| 227 | /* Initialize once only */ |
| 228 | if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED) |
| 229 | return efi_obj_list_initialized; |
| 230 | |
Heinrich Schuchardt | 68edbed | 2022-06-14 08:02:03 +0200 | [diff] [blame] | 231 | /* Set up console modes */ |
| 232 | efi_setup_console_size(); |
| 233 | |
Heinrich Schuchardt | d5391bf | 2022-08-31 16:37:35 +0200 | [diff] [blame] | 234 | /* |
| 235 | * Probe block devices to find the ESP. |
| 236 | * efi_disks_register() must be called before efi_init_variables(). |
| 237 | */ |
| 238 | ret = efi_disks_register(); |
| 239 | if (ret != EFI_SUCCESS) |
| 240 | goto out; |
| 241 | |
Heinrich Schuchardt | 8819209 | 2019-06-20 13:52:16 +0200 | [diff] [blame] | 242 | /* Initialize variable services */ |
| 243 | ret = efi_init_variables(); |
| 244 | if (ret != EFI_SUCCESS) |
| 245 | goto out; |
| 246 | |
Raymond Mao | 550862b | 2023-11-10 13:25:37 +0900 | [diff] [blame] | 247 | if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { |
| 248 | /* update boot option after variable service initialized */ |
| 249 | ret = efi_bootmgr_update_media_device_boot_option(); |
| 250 | if (ret != EFI_SUCCESS) |
| 251 | goto out; |
| 252 | } |
| 253 | |
Heinrich Schuchardt | 07805f2 | 2019-04-11 07:34:24 +0200 | [diff] [blame] | 254 | /* Define supported languages */ |
| 255 | ret = efi_init_platform_lang(); |
| 256 | if (ret != EFI_SUCCESS) |
| 257 | goto out; |
| 258 | |
AKASHI Takahiro | d40e05a | 2019-04-24 15:30:38 +0900 | [diff] [blame] | 259 | /* Indicate supported features */ |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 260 | ret = efi_init_os_indications(); |
AKASHI Takahiro | d40e05a | 2019-04-24 15:30:38 +0900 | [diff] [blame] | 261 | if (ret != EFI_SUCCESS) |
| 262 | goto out; |
| 263 | |
Heinrich Schuchardt | 76be687 | 2020-02-19 20:48:49 +0100 | [diff] [blame] | 264 | /* Initialize system table */ |
| 265 | ret = efi_initialize_system_table(); |
AKASHI Takahiro | e771b4b | 2019-06-05 13:21:38 +0900 | [diff] [blame] | 266 | if (ret != EFI_SUCCESS) |
| 267 | goto out; |
| 268 | |
Jose Marinho | 6b92c17 | 2021-12-23 14:51:07 +0000 | [diff] [blame] | 269 | if (IS_ENABLED(CONFIG_EFI_ECPT)) { |
| 270 | ret = efi_ecpt_register(); |
| 271 | if (ret != EFI_SUCCESS) |
| 272 | goto out; |
| 273 | } |
| 274 | |
Jose Marinho | 64a8aae | 2021-03-02 17:26:38 +0000 | [diff] [blame] | 275 | if (IS_ENABLED(CONFIG_EFI_ESRT)) { |
| 276 | ret = efi_esrt_register(); |
| 277 | if (ret != EFI_SUCCESS) |
| 278 | goto out; |
| 279 | } |
| 280 | |
Ilias Apalodimas | c8d0fd5 | 2020-11-30 11:47:40 +0200 | [diff] [blame] | 281 | if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) { |
| 282 | ret = efi_tcg2_register(); |
| 283 | if (ret != EFI_SUCCESS) |
| 284 | goto out; |
Masahisa Kojima | 54bec17 | 2021-12-07 14:15:31 +0900 | [diff] [blame] | 285 | |
| 286 | ret = efi_tcg2_do_initial_measurement(); |
| 287 | if (ret == EFI_SECURITY_VIOLATION) |
| 288 | goto out; |
Ilias Apalodimas | c8d0fd5 | 2020-11-30 11:47:40 +0200 | [diff] [blame] | 289 | } |
| 290 | |
Ilias Apalodimas | 5d98329 | 2022-07-22 21:32:03 +0530 | [diff] [blame] | 291 | /* Install EFI_RNG_PROTOCOL */ |
| 292 | if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) { |
| 293 | ret = efi_rng_register(); |
| 294 | if (ret != EFI_SUCCESS) |
| 295 | goto out; |
| 296 | } |
| 297 | |
Sunil V L | 1ccf871 | 2022-01-28 20:48:44 +0530 | [diff] [blame] | 298 | if (IS_ENABLED(CONFIG_EFI_RISCV_BOOT_PROTOCOL)) { |
| 299 | ret = efi_riscv_register(); |
| 300 | if (ret != EFI_SUCCESS) |
| 301 | goto out; |
| 302 | } |
| 303 | |
AKASHI Takahiro | d0f0794 | 2020-04-14 11:51:45 +0900 | [diff] [blame] | 304 | /* Secure boot */ |
| 305 | ret = efi_init_secure_boot(); |
| 306 | if (ret != EFI_SUCCESS) |
| 307 | goto out; |
| 308 | |
Heinrich Schuchardt | 76be687 | 2020-02-19 20:48:49 +0100 | [diff] [blame] | 309 | /* Indicate supported runtime services */ |
| 310 | ret = efi_init_runtime_supported(); |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 311 | if (ret != EFI_SUCCESS) |
| 312 | goto out; |
| 313 | |
Ilias Apalodimas | 6e0184b | 2021-06-22 17:38:53 +0300 | [diff] [blame] | 314 | if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) { |
| 315 | ret = efi_load_capsule_drivers(); |
| 316 | if (ret != EFI_SUCCESS) |
| 317 | goto out; |
| 318 | } |
| 319 | |
Simon Glass | b86986c | 2022-10-18 07:46:31 -0600 | [diff] [blame] | 320 | if (IS_ENABLED(CONFIG_VIDEO)) { |
Simon Glass | 777f3e3 | 2022-10-16 15:58:34 -0600 | [diff] [blame] | 321 | ret = efi_gop_register(); |
| 322 | if (ret != EFI_SUCCESS) |
| 323 | goto out; |
| 324 | } |
Jan Kiszka | 77b5c4a | 2022-10-14 18:10:06 +0200 | [diff] [blame] | 325 | #ifdef CONFIG_NETDEVICES |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 326 | ret = efi_net_register(); |
| 327 | if (ret != EFI_SUCCESS) |
| 328 | goto out; |
| 329 | #endif |
Simon Glass | 53e8e6f | 2023-09-19 21:00:12 -0600 | [diff] [blame] | 330 | if (IS_ENABLED(CONFIG_ACPI)) { |
| 331 | ret = efi_acpi_register(); |
| 332 | if (ret != EFI_SUCCESS) |
| 333 | goto out; |
| 334 | } |
Simon Glass | 53fab13 | 2023-09-20 07:29:51 -0600 | [diff] [blame] | 335 | if (IS_ENABLED(CONFIG_SMBIOS)) { |
| 336 | ret = efi_smbios_register(); |
| 337 | if (ret != EFI_SUCCESS) |
| 338 | goto out; |
| 339 | } |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 340 | ret = efi_watchdog_register(); |
| 341 | if (ret != EFI_SUCCESS) |
| 342 | goto out; |
| 343 | |
AKASHI Takahiro | 2bc27ca | 2020-11-17 09:27:55 +0900 | [diff] [blame] | 344 | ret = efi_init_capsule(); |
| 345 | if (ret != EFI_SUCCESS) |
| 346 | goto out; |
| 347 | |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 348 | /* Initialize EFI runtime services */ |
| 349 | ret = efi_reset_system_init(); |
| 350 | if (ret != EFI_SUCCESS) |
| 351 | goto out; |
| 352 | |
AKASHI Takahiro | c74cd8b | 2020-11-17 09:27:56 +0900 | [diff] [blame] | 353 | /* Execute capsules after reboot */ |
| 354 | if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) && |
| 355 | !IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY)) |
| 356 | ret = efi_launch_capsules(); |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 357 | out: |
AKASHI Takahiro | 056b45b | 2018-12-30 15:16:55 +0100 | [diff] [blame] | 358 | efi_obj_list_initialized = ret; |
| 359 | return ret; |
| 360 | } |