* Copyright (c) 2017 Rob Clark
*/
+#define LOG_CATEGORY LOGC_EFI
+
#include <common.h>
#include <charset.h>
#include <log.h>
if (lo.attributes & LOAD_OPTION_ACTIVE) {
u32 attributes;
- debug("%s: trying to load \"%ls\" from %pD\n",
- __func__, lo.label, lo.file_path);
+ log_debug("%s: trying to load \"%ls\" from %pD\n",
+ __func__, lo.label, lo.file_path);
ret = EFI_CALL(efi_load_image(true, efi_root, lo.file_path,
NULL, 0, handle));
if (ret != EFI_SUCCESS) {
- printf("Loading from Boot%04X '%ls' failed\n", n,
- lo.label);
+ log_warning("Loading %ls '%ls' failed\n",
+ varname, lo.label);
goto error;
}
if (ret != EFI_SUCCESS) {
if (EFI_CALL(efi_unload_image(*handle))
!= EFI_SUCCESS)
- printf("Unloading image failed\n");
+ log_err("Unloading image failed\n");
goto error;
}
- printf("Booting: %ls\n", lo.label);
+ log_info("Booting: %ls\n", lo.label);
} else {
ret = EFI_LOAD_ERROR;
}
if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) {
/* BootNext does exist here */
if (ret == EFI_BUFFER_TOO_SMALL || size != sizeof(u16))
- printf("BootNext must be 16-bit integer\n");
+ log_err("BootNext must be 16-bit integer\n");
/* delete BootNext */
ret = EFI_CALL(efi_set_variable(
ret = try_load_entry(bootnext, handle);
if (ret == EFI_SUCCESS)
return ret;
- printf("Loading from BootNext failed, falling back to BootOrder\n");
+ log_warning(
+ "Loading from BootNext failed, falling back to BootOrder\n");
}
} else {
- printf("Deleting BootNext failed\n");
+ log_err("Deleting BootNext failed\n");
}
}
/* BootOrder */
bootorder = get_var(L"BootOrder", &efi_global_variable_guid, &size);
if (!bootorder) {
- printf("BootOrder not defined\n");
+ log_info("BootOrder not defined\n");
ret = EFI_NOT_FOUND;
goto error;
}
num = size / sizeof(uint16_t);
for (i = 0; i < num; i++) {
- debug("%s: trying to load Boot%04X\n", __func__, bootorder[i]);
+ log_debug("%s trying to load Boot%04X\n", __func__,
+ bootorder[i]);
ret = try_load_entry(bootorder[i], handle);
if (ret == EFI_SUCCESS)
break;