fs: add fs_get_type() for current filesystem type
[oweals/u-boot.git] / cmd / nvedit_efi.c
index ff8eaa1aad2df4c2b23678daee3f52017e44b38d..ede4cd5235ea822de6d6bb2aea13185b9b506eac 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <command.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <exports.h>
 #include <hexdump.h>
 #include <malloc.h>
@@ -329,7 +330,7 @@ out:
 }
 
 /**
- * do_env_print_efi() - set UEFI variable
+ * do_env_set_efi() - set UEFI variable
  *
  * @cmdtp:     Command table
  * @flag:      Command flag
@@ -349,6 +350,7 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        u16 *var_name16 = NULL, *p;
        size_t len;
        efi_guid_t guid;
+       u32 attributes;
        efi_status_t ret;
 
        if (argc == 1)
@@ -362,6 +364,16 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return CMD_RET_FAILURE;
        }
 
+       attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                    EFI_VARIABLE_RUNTIME_ACCESS;
+       if (!strcmp(argv[1], "-nv")) {
+               attributes |= EFI_VARIABLE_NON_VOLATILE;
+               argc--;
+               argv++;
+               if (argc == 1)
+                       return CMD_RET_SUCCESS;
+       }
+
        var_name = argv[1];
        if (argc == 2) {
                /* delete */
@@ -391,9 +403,7 @@ int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        utf8_utf16_strncpy(&p, var_name, len + 1);
 
        guid = efi_global_variable_guid;
-       ret = EFI_CALL(efi_set_variable(var_name16, &guid,
-                                       EFI_VARIABLE_BOOTSERVICE_ACCESS |
-                                       EFI_VARIABLE_RUNTIME_ACCESS,
+       ret = EFI_CALL(efi_set_variable(var_name16, &guid, attributes,
                                        size, value));
        if (ret == EFI_SUCCESS) {
                ret = CMD_RET_SUCCESS;