All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 06/11] efi_loader: variable: support non-volatile attribute
Date: Wed, 24 Apr 2019 15:30:40 +0900	[thread overview]
Message-ID: <20190424063045.14443-7-takahiro.akashi@linaro.org> (raw)
In-Reply-To: <20190424063045.14443-1-takahiro.akashi@linaro.org>

The attribute, EFI_VARIABLE_NON_VOLATILE, should be encoded as "nv" flag
in U-Boot variable if specified.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 lib/efi_loader/efi_variable.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 37728c3c165d..2f489ab9db97 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -125,6 +125,8 @@ static const char *parse_attr(const char *str, u32 *attrp)
 
 		if ((s = prefix(str, "ro"))) {
 			attr |= READ_ONLY;
+		} else if ((s = prefix(str, "nv"))) {
+			attr |= EFI_VARIABLE_NON_VOLATILE;
 		} else if ((s = prefix(str, "boot"))) {
 			attr |= EFI_VARIABLE_BOOTSERVICE_ACCESS;
 		} else if ((s = prefix(str, "run"))) {
@@ -452,7 +454,7 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 		}
 	}
 
-	val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
+	val = malloc(2 * data_size + strlen("{ro,run,boot,nv}(blob)") + 1);
 	if (!val) {
 		ret = EFI_OUT_OF_RESOURCES;
 		goto out;
@@ -464,12 +466,16 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 	 * store attributes
 	 * TODO: several attributes are not supported
 	 */
-	attributes &= (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS);
+	attributes &= (EFI_VARIABLE_NON_VOLATILE |
+		       EFI_VARIABLE_BOOTSERVICE_ACCESS |
+		       EFI_VARIABLE_RUNTIME_ACCESS);
 	s += sprintf(s, "{");
 	while (attributes) {
 		u32 attr = 1 << (ffs(attributes) - 1);
 
-		if (attr == EFI_VARIABLE_BOOTSERVICE_ACCESS)
+		if (attr == EFI_VARIABLE_NON_VOLATILE)
+			s += sprintf(s, "nv");
+		else if (attr == EFI_VARIABLE_BOOTSERVICE_ACCESS)
 			s += sprintf(s, "boot");
 		else if (attr == EFI_VARIABLE_RUNTIME_ACCESS)
 			s += sprintf(s, "run");
-- 
2.20.1

  parent reply	other threads:[~2019-04-24  6:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24  6:30 [U-Boot] [PATCH v2 00/11] efi_loader: non-volatile variables support AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 01/11] lib: charset: add u16_strcmp() AKASHI Takahiro
2019-04-24 16:24   ` Heinrich Schuchardt
2019-04-25  0:38     ` AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 02/11] lib: charset: add u16_strncmp() AKASHI Takahiro
2019-04-24 17:40   ` Heinrich Schuchardt
2019-04-24 18:36   ` Heinrich Schuchardt
2019-04-25  0:16     ` AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 03/11] cmd: efidebug: rework "boot dump" sub-command using GetNextVariableName() AKASHI Takahiro
2019-04-24 20:13   ` Heinrich Schuchardt
2019-04-25  0:30     ` AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 04/11] efi_loader: set OsIndicationsSupported at init AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 05/11] env: save UEFI non-volatile variables in dedicated storage AKASHI Takahiro
2019-04-25 18:44   ` Heinrich Schuchardt
2019-04-24  6:30 ` AKASHI Takahiro [this message]
2019-04-24  6:30 ` [U-Boot] [PATCH v2 07/11] efi_loader: variable: split UEFI variables from U-Boot environment AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 08/11] efi_loader: load saved non-volatile variables at init AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 09/11] efi_loader: bootmgr: handle BootNext as non-volatile AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 10/11] cmd: env: add -nv option for UEFI non-volatile variable AKASHI Takahiro
2019-04-24  6:30 ` [U-Boot] [PATCH v2 11/11] cmd: efidebug: make some boot variables non-volatile AKASHI Takahiro
2019-04-24 22:12 ` [U-Boot] [PATCH v2 00/11] efi_loader: non-volatile variables support Heinrich Schuchardt
2019-04-25  1:12   ` AKASHI Takahiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190424063045.14443-7-takahiro.akashi@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.