From 437caecbab16b1f17bda9ee10115a0c5d7317a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Date: Fri, 15 Feb 2019 16:21:58 -0800 Subject: [PATCH 33/35] fallback: Print info on GetNextVariableName errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- fallback.c | 17 +++++++++++++++-- 1 file 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 -- 2.32.0