}
static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
- UINT64 key, indvar;
+ UINT64 key;
UINTN timeout;
BOOLEAN modevar;
_cleanup_freepool_ CHAR16 *partstr = NULL, *defaultstr = NULL;
if (shim_loaded())
Print(L"Shim: present\n");
- if (efivar_get_uint64_le(EFI_GLOBAL_GUID, L"OsIndicationsSupported", &indvar) == EFI_SUCCESS)
- Print(L"OsIndicationsSupported: %d\n", indvar);
+ Print(L"OsIndicationsSupported: %d\n", get_os_indications_supported());
Print(L"\n--- press key ---\n\n");
console_key_read(&key, 0);
const CHAR16 *loaded_image_path,
EFI_FILE *root_dir) {
- UINT64 osind = 0;
-
assert(config);
assert(loaded_image);
assert(loaded_image_path);
config_entry_add_loader_auto(config, loaded_image->DeviceHandle, root_dir, loaded_image_path,
L"auto-efi-default", '\0', L"EFI Default Loader", NULL);
- if (config->auto_firmware && efivar_get_uint64_le(EFI_GLOBAL_GUID, L"OsIndicationsSupported", &osind) == EFI_SUCCESS) {
- if (osind & EFI_OS_INDICATIONS_BOOT_TO_FW_UI)
- config_entry_add_call(config,
- L"auto-reboot-to-firmware-setup",
- L"Reboot Into Firmware Interface",
- reboot_into_firmware);
- }
+ if (config->auto_firmware && (get_os_indications_supported() & EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
+ config_entry_add_call(config,
+ L"auto-reboot-to-firmware-setup",
+ L"Reboot Into Firmware Interface",
+ reboot_into_firmware);
}
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
*ret = TAKE_PTR(dir);
return EFI_SUCCESS;
}
+
+UINT64 get_os_indications_supported(VOID) {
+ UINT64 osind;
+ EFI_STATUS err;
+
+ /* Returns the supported OS indications. If we can't acquire it, returns a zeroed out mask, i.e. no
+ * supported features. */
+
+ err = efivar_get_uint64_le(EFI_GLOBAL_GUID, L"OsIndicationsSupported", &osind);
+ if (EFI_ERROR(err))
+ return 0;
+
+ return osind;
+}