Signed-off-by: Daniel Nguyen <daniel.ngu...@arm.com> --- .../UefiShellLevel2CommandsLib/Reset.c | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c index 57ba3c90f3..361c47e430 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c @@ -79,30 +79,35 @@ ShellCommandRunReset ( &DataSize, &OsIndications ); - if (!EFI_ERROR (Status)) { - if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) { - DataSize = sizeof (OsIndications); - Status = gRT->GetVariable ( - EFI_OS_INDICATIONS_VARIABLE_NAME, - &gEfiGlobalVariableGuid, - &Attr, - &DataSize, - &OsIndications - ); - if (!EFI_ERROR (Status)) { - OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI; - } else { - OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI; - } - - Status = gRT->SetVariable ( + + if (EFI_ERROR (Status)) { + ShellStatus = SHELL_UNSUPPORTED; + goto Error; + } + + if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) { + DataSize = sizeof (OsIndications); + Status = gRT->GetVariable ( EFI_OS_INDICATIONS_VARIABLE_NAME, &gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof (OsIndications), + &Attr, + &DataSize, &OsIndications ); + + if (EFI_ERROR (Status)) { + OsIndications = EFI_OS_INDICATIONS_BOOT_TO_FW_UI; + } else { + OsIndications |= EFI_OS_INDICATIONS_BOOT_TO_FW_UI; } + + Status = gRT->SetVariable ( + EFI_OS_INDICATIONS_VARIABLE_NAME, + &gEfiGlobalVariableGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (OsIndications), + &OsIndications + ); } if (EFI_ERROR (Status)) { -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111429): https://edk2.groups.io/g/devel/message/111429 Mute This Topic: https://groups.io/mt/102698984/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-