summaryrefslogtreecommitdiff
path: root/fallback.c
diff options
context:
space:
mode:
authorJoão Paulo Rechi Vita <jprvita@endlessos.org>2019-02-15 16:21:58 -0800
committerPeter Jones <pjones@redhat.com>2021-09-03 16:51:19 -0400
commit437caecbab16b1f17bda9ee10115a0c5d7317a1d (patch)
treea9bdd71a0a078b8ce4e835388648a09cff22eeb3 /fallback.c
parent44f186354b6c9262e9a2b9f99cb5233d8fc19abf (diff)
downloadefi-boot-shim-437caecbab16b1f17bda9ee10115a0c5d7317a1d.tar.gz
efi-boot-shim-437caecbab16b1f17bda9ee10115a0c5d7317a1d.zip
fallback: Print info on GetNextVariableName errors
When listing all variables checking for duplicates, print which error was returned if not EFI_NOT_FOUND (which simply means reached the end of the list). Signed-off-by: João Paulo Rechi Vita <jprvita@endlessos.org>
Diffstat (limited to 'fallback.c')
-rw-r--r--fallback.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fallback.c b/fallback.c
index 2eea8a74..feb15df5 100644
--- a/fallback.c
+++ b/fallback.c
@@ -431,8 +431,21 @@ find_boot_option(EFI_DEVICE_PATH *dp, EFI_DEVICE_PATH *fulldp,
UINTN varname_size = sizeof(varname);
efi_status = gRT->GetNextVariableName(&varname_size, varname,
&vendor_guid);
- if (EFI_ERROR(efi_status))
+ if (EFI_ERROR(efi_status)) {
+ if (efi_status == EFI_BUFFER_TOO_SMALL)
+ VerbosePrint(L"Buffer too small for next variable name\n");
+
+ if (efi_status == EFI_DEVICE_ERROR)
+ VerbosePrint(L"The next variable name could not be retrieved due to a hardware error\n");
+
+ if (efi_status == EFI_INVALID_PARAMETER)
+ VerbosePrint(L"Invalid parameter to GetNextVariableName: varname_size=%d, varname=%s\n",
+ varname_size, varname);
+
+ /* EFI_NOT_FOUND means we listed all variables */
+ VerbosePrint(L"Checked all boot entries\n");
break;
+ }
if (StrLen(varname) != 8 || StrnCmp(varname, L"Boot", 4) ||
!isxdigit(varname[4]) || !isxdigit(varname[5]) ||
@@ -474,7 +487,7 @@ find_boot_option(EFI_DEVICE_PATH *dp, EFI_DEVICE_PATH *fulldp,
}
FreePool(candidate);
FreePool(data);
- return EFI_NOT_FOUND;
+ return efi_status;
}
EFI_STATUS