mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
efi_loader: variable: support non-volatile attribute
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> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
e80474ad39
commit
cee2cbc731
1 changed files with 9 additions and 3 deletions
|
@ -125,6 +125,8 @@ static const char *parse_attr(const char *str, u32 *attrp)
|
||||||
|
|
||||||
if ((s = prefix(str, "ro"))) {
|
if ((s = prefix(str, "ro"))) {
|
||||||
attr |= READ_ONLY;
|
attr |= READ_ONLY;
|
||||||
|
} else if ((s = prefix(str, "nv"))) {
|
||||||
|
attr |= EFI_VARIABLE_NON_VOLATILE;
|
||||||
} else if ((s = prefix(str, "boot"))) {
|
} else if ((s = prefix(str, "boot"))) {
|
||||||
attr |= EFI_VARIABLE_BOOTSERVICE_ACCESS;
|
attr |= EFI_VARIABLE_BOOTSERVICE_ACCESS;
|
||||||
} else if ((s = prefix(str, "run"))) {
|
} else if ((s = prefix(str, "run"))) {
|
||||||
|
@ -468,7 +470,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) {
|
if (!val) {
|
||||||
ret = EFI_OUT_OF_RESOURCES;
|
ret = EFI_OUT_OF_RESOURCES;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -480,12 +482,16 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
|
||||||
* store attributes
|
* store attributes
|
||||||
* TODO: several attributes are not supported
|
* 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, "{");
|
s += sprintf(s, "{");
|
||||||
while (attributes) {
|
while (attributes) {
|
||||||
u32 attr = 1 << (ffs(attributes) - 1);
|
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");
|
s += sprintf(s, "boot");
|
||||||
else if (attr == EFI_VARIABLE_RUNTIME_ACCESS)
|
else if (attr == EFI_VARIABLE_RUNTIME_ACCESS)
|
||||||
s += sprintf(s, "run");
|
s += sprintf(s, "run");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue