From 69a9a68c81262e8369b9399f011244599319dc1f Mon Sep 17 00:00:00 2001 From: Vu Nguyen Date: Wed, 20 Apr 2022 18:27:55 +0700 Subject: [PATCH] AmpereAltraPkg/IpmiBootDxe: Fix failed to set variables Use gEfiGlobalVariableGuid to set the Ampere specific variables cause invalid parameter issue. This change is to solve this issue by turn to use gAmpereVariableGuid for these kinds of variable. Signed-off-by: Vu Nguyen --- .../Drivers/IpmiBootDxe/IpmiBootDxe.c | 31 +++++++++++++------ .../Drivers/IpmiBootDxe/IpmiBootDxe.inf | 1 + 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.c index 5690c2393ee..b5eadd78f43 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.c @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -385,7 +386,7 @@ HandleIpmiBootOption ( DataSize = sizeof (UINT8); Status = gRT->GetVariable ( FORCE_UIAPP_VARIABLE_NAME, - &gEfiGlobalVariableGuid, + &gAmpereVariableGuid, NULL, &DataSize, &ForceUiApp @@ -435,9 +436,8 @@ HandleIpmiBootOption ( if (!BootFlags.IsPersistent) { Status = gRT->SetVariable ( EFI_LAST_BOOT_ORDER_VARIABLE_NAME, - &gEfiGlobalVariableGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS - | EFI_VARIABLE_NON_VOLATILE, + &gAmpereVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, CurrBootOrderSize, CurrBootOrder ); @@ -502,11 +502,19 @@ HandleIpmiBootOption ( if (UpdateNeed) { Status = gRT->SetVariable ( FORCE_UIAPP_VARIABLE_NAME, - &gEfiGlobalVariableGuid, + &gAmpereVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, sizeof (UINT8), &ForceUiApp ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to set the Force UiApp variable - %r\n", + __FUNCTION__, + Status + )); + } } // @@ -567,7 +575,12 @@ RestoreBootOrder ( UINTN CurrBootOrderSize; UINTN LastBootOrderSize; - GetEfiGlobalVariable2 (EFI_LAST_BOOT_ORDER_VARIABLE_NAME, (VOID **)&LastBootOrder, &LastBootOrderSize); + Status = GetVariable2 ( + EFI_LAST_BOOT_ORDER_VARIABLE_NAME, + &gAmpereVariableGuid, + (VOID **)&LastBootOrder, + &LastBootOrderSize + ); if (LastBootOrder == NULL) { return EFI_SUCCESS; } @@ -596,19 +609,19 @@ RestoreBootOrder ( LastBootOrder ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Failed to restore the BootOrder\n")); + DEBUG ((DEBUG_ERROR, "%a: Failed to restore the BootOrder\n", __FUNCTION__)); goto Exit; } Status = gRT->SetVariable ( EFI_LAST_BOOT_ORDER_VARIABLE_NAME, - &gEfiGlobalVariableGuid, + &gAmpereVariableGuid, 0, 0, NULL ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Failed to erase the LastBootOrder\n")); + DEBUG ((DEBUG_ERROR, "%a: Failed to erase the LastBootOrder\n", __FUNCTION__)); goto Exit; } diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.inf index 3c7953c9784..b8032047418 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.inf +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/IpmiBootDxe/IpmiBootDxe.inf @@ -43,6 +43,7 @@ [Guids] gAmpereAfterConsoleEventGuid + gAmpereVariableGuid gEfiGlobalVariableGuid [Depex]