From 27cdb748654bc90d5695e35a1f38cfdd6b5499fc Mon Sep 17 00:00:00 2001 From: Nigel Croxon Date: Fri, 11 Oct 2013 11:12:28 -0400 Subject: [PATCH] Added support for SetVariable to store volatile variable, and SetNVVariable to store non volatile variable. Signed-off-by: Sylvain Chouleur Signed-off-by: Nigel Croxon --- gnu-efi-3.0/inc/efilib.h | 15 ++++++++++++++ gnu-efi-3.0/lib/misc.c | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/gnu-efi-3.0/inc/efilib.h b/gnu-efi-3.0/inc/efilib.h index 574042d..e0c6375 100644 --- a/gnu-efi-3.0/inc/efilib.h +++ b/gnu-efi-3.0/inc/efilib.h @@ -522,6 +522,21 @@ LibDeleteVariable ( ); EFI_STATUS +LibSetNVVariable ( + IN CHAR16 *VarName, + IN EFI_GUID *VarGuid, + IN UINTN DataSize, + IN VOID *Data + ); + +EFI_STATUS +LibSetVariable ( + IN CHAR16 *VarName, + IN EFI_GUID *VarGuid, + IN UINTN DataSize, + IN VOID *Data + ); +EFI_STATUS LibInsertToTailOfBootOrder ( IN UINT16 BootOption, IN BOOLEAN OnlyInsertIfEmpty diff --git a/gnu-efi-3.0/lib/misc.c b/gnu-efi-3.0/lib/misc.c index 32f48cc..48823bb 100644 --- a/gnu-efi-3.0/lib/misc.c +++ b/gnu-efi-3.0/lib/misc.c @@ -321,6 +321,48 @@ LibDeleteVariable ( return (Status); } +EFI_STATUS +LibSetNVVariable ( + IN CHAR16 *VarName, + IN EFI_GUID *VarGuid, + IN UINTN DataSize, + IN VOID *Data + ) +{ + EFI_STATUS Status; + + Status = uefi_call_wrapper( + RT->SetVariable, + 5, + VarName, VarGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + DataSize, Data + ); + ASSERT (!EFI_ERROR(Status)); + return (Status); +} + +EFI_STATUS +LibSetVariable ( + IN CHAR16 *VarName, + IN EFI_GUID *VarGuid, + IN UINTN DataSize, + IN VOID *Data + ) +{ + EFI_STATUS Status; + + Status = uefi_call_wrapper( + RT->SetVariable, + 5, + VarName, VarGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + DataSize, Data + ); + ASSERT (!EFI_ERROR(Status)); + return (Status); +} + EFI_STATUS LibInsertToTailOfBootOrder ( IN UINT16 BootOption,