summaryrefslogtreecommitdiffstats
path: root/arch/efi/efi/efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/efi/efi/efi.c')
-rw-r--r--arch/efi/efi/efi.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index c05d183c02..b0e98f95b0 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -83,6 +83,33 @@ out:
return buf;
}
+int efi_set_variable(char *name, efi_guid_t *vendor, uint32_t attributes,
+ void *buf, unsigned long size)
+{
+ efi_status_t efiret = EFI_SUCCESS;
+ s16 *name16 = strdup_char_to_wchar(name);
+
+ efiret = RT->set_variable(name16, vendor, attributes, size, buf);
+
+ free(name16);
+
+ return -efi_errno(efiret);
+}
+
+int efi_set_variable_usec(char *name, efi_guid_t *vendor, uint64_t usec)
+{
+ char buf[20];
+ wchar_t buf16[40];
+
+ snprintf(buf, sizeof(buf), "%lld", usec);
+ strcpy_char_to_wchar(buf16, buf);
+
+ return efi_set_variable(name, vendor,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS, buf16,
+ (strlen(buf)+1) * sizeof(wchar_t));
+}
+
struct efi_boot {
u32 attributes;
u16 file_path_len;