aboutsummaryrefslogtreecommitdiff
path: root/cmd/nvedit_efi.c
AgeCommit message (Collapse)AuthorFilesLines
2021-09-11efi_loader: eliminate EFI_CALL() in nvedit_efi.cHeinrich Schuchardt1-5/+4
Reduce the code size by avoiding using the external UEFI API and using our internal functions instead. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-08-02global: Convert simple_strtoul() with hex to hextoul()Simon Glass1-2/+2
It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-05env: efi: fix a wrong address dereferenceAKASHI Takahiro1-2/+1
Probably, a pointer to a variable in an inner block should not be exposed to an outer block. Fixes: c70f44817d46 ("efi_loader: simplify 'printenv -e'") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> [trini: Don't make guid const now] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-08-24efi_loader: use ':' as separator for setenv -iHeinrich Schuchardt1-1/+1
setenv -e -i <address>,<filesize> can be used to set a UEFI variable from memory. For separating an address and a size we use ':' in most commands. Let's do the same for setenv -e -i. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-16efi_loader: simplify 'printenv -e'Heinrich Schuchardt1-87/+19
Currently default output of 'printenv -e' is restricted to variables with GUID EFI_GLOBAL_VARIABLE. This excludes db and dbx. As the number of variables is small there is no need for this restriction. If no GUID is provided, print all matching variables irrespective of GUID. Always show the numeric value of the GUID. If the GUID provided to 'setenv -e' is invalid, return CMD_RET_USAGE. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-07-11efi_loader: display RO attribute in printenv -eHeinrich Schuchardt1-8/+16
Let the 'printenv -e' command display the read only flag. If the variable is time authenticated write the time stamp. Avoid EFI_CALL() when calling SetVariable() and GetVariable(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-05-18command: Remove the cmd_tbl_t typedefSimon Glass1-5/+7
We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop uuid.h from common headerSimon Glass1-0/+1
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-07efi_loader: use logical and in do_env_print_efi()Heinrich Schuchardt1-1/+1
If we want to check if two booleans are true, we should use a logical conjunction (&&) and not a bitwise and-operator (&). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-04-16cmd: env: add "-at" option to "env set -e" commandAKASHI Takahiro1-1/+4
With "-at" option, EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS will be passed to SetVariable() to authenticate the variable. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-04-16cmd: env: use appropriate guid for authenticated UEFI variableAKASHI Takahiro1-4/+14
A signature database variable is associated with a specific guid. For convenience, if user doesn't supply any guid info, "env set|print -e" should complement it. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2019-10-30cmd: env: extend "env [set|print] -e" to manage UEFI variablesAKASHI Takahiro1-39/+238
With this patch, when setting UEFI variable with "env set -e" command, we will be able to - specify vendor guid with "-guid guid", - specify variable attributes, BOOTSERVICE_ACCESS, RUNTIME_ACCESS, respectively with "-bs" and "-rt", - append a value instead of overwriting with "-a", - use memory as variable's value instead of explicit values given at the command line with "-i address,size" If guid is not explicitly given, default value will be used. Meanwhile, "env print -e," will be modified so that it will NOT dump a variable's value if '-n' is specified. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-10-06cmd: env: fix a typo in a comment of do_env_set_efi()AKASHI Takahiro1-1/+1
A wrong function name is referred to in a comment of do_env_set_efi(). Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-08-11env: Move env_set() to env.hSimon Glass1-0/+1
Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-06-04cmd: env: add -nv option for UEFI non-volatile variableAKASHI Takahiro1-3/+12
With this option, -nv, at "setenv -e" command, a variable will be defined as non-volatile. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-06-04cmd: env: print a message when setting UEFI variable failedAKASHI Takahiro1-1/+9
Error message will alert a user that setting/deleting a variable failed. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-02efi_loader: memory leak in append valueHeinrich Schuchardt1-1/+4
When printing an UEFI variable an error may arise while converting an illegal hexadecimal value. In this case a buffer is leaked. Close the memory leak. Provide an error message. Reported-by: Coverity (CID 185830) Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-03-20efi_loader: memory leak in efi_dump_single_var()Heinrich Schuchardt1-1/+0
A misplaced return statement lead to a memory leak in efi_dump_single_var(). Reported-by: Coverity (CID 185829) Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-25cmd: env: add "-e" option for handling UEFI variablesAKASHI Takahiro1-0/+399
"env [print|set] -e" allows for handling uefi variables without knowing details about mapping to corresponding u-boot variables. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>