mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
efi_loader: centralize messaging for efi_init_obj_list
If efi_init_obj_list() fails we cannot use the UEFI sub-system. * Instead of having messages for this everywhere write an error message in efi_init_obj_list(). * Always use (ret != EFI_SUCCESS) when checking the return value of efi_init_obj_list(). * Remove the return code from the error message as it does not help users to understand which initialization went wrong. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
@@ -58,8 +58,8 @@ static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow)
|
||||
}
|
||||
|
||||
ret = efi_init_obj_list();
|
||||
if (ret)
|
||||
return log_msg_ret("init", ret);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* Enable this method if the "BootOrder" UEFI exists. */
|
||||
bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid,
|
||||
|
||||
@@ -144,11 +144,8 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
if (argc > 2) {
|
||||
ulong rd_addr = 0;
|
||||
|
||||
@@ -505,12 +505,8 @@ static void handle_uefi_bootnext(void)
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
|
||||
if (ret != EFI_SUCCESS)
|
||||
return;
|
||||
}
|
||||
|
||||
/* If UEFI BootNext variable is set, boot the BootNext load option */
|
||||
size = sizeof(u16);
|
||||
|
||||
@@ -2466,12 +2466,8 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
ret = eficonfig_init();
|
||||
if (ret != EFI_SUCCESS)
|
||||
|
||||
@@ -1669,11 +1669,8 @@ static int do_efidebug(struct cmd_tbl *cmdtp, int flag,
|
||||
|
||||
/* Initialize UEFI drivers */
|
||||
r = efi_init_obj_list();
|
||||
if (r != EFI_SUCCESS) {
|
||||
printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
r & ~EFI_ERROR_MASK);
|
||||
if (r != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
cp = find_cmd_tbl(argv[0], cmd_efidebug_sub,
|
||||
ARRAY_SIZE(cmd_efidebug_sub));
|
||||
|
||||
@@ -213,11 +213,8 @@ int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) {
|
||||
if (!strcmp(argv[0], "-guid")) {
|
||||
@@ -389,11 +386,8 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
|
||||
@@ -224,11 +224,8 @@ static efi_status_t efi_binary_run_dp(void *image, size_t size, void *fdt,
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = efi_install_fdt(fdt);
|
||||
if (ret != EFI_SUCCESS)
|
||||
|
||||
@@ -1310,11 +1310,8 @@ efi_status_t efi_bootmgr_run(void *fdt)
|
||||
|
||||
/* Initialize EFI drivers */
|
||||
ret = efi_init_obj_list();
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = efi_bootmgr_load(&handle, &load_options);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
|
||||
@@ -392,5 +392,7 @@ efi_status_t efi_init_obj_list(void)
|
||||
ret = efi_start_obj_list();
|
||||
out:
|
||||
efi_obj_list_initialized = ret;
|
||||
if (ret != EFI_SUCCESS)
|
||||
log_err("Cannot initialize UEFI sub-system\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user