Add a more generic efi_setenv function.
efi_setenv allows any UEFI variable to be set.
This commit is contained in:
parent
6389bef8f1
commit
883d342d38
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346345
@ -125,6 +125,7 @@ void cpy16to8(const CHAR16 *, char *, size_t);
|
||||
EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len);
|
||||
EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len);
|
||||
EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len);
|
||||
EFI_STATUS efi_setenv(EFI_GUID *guid, const char *varname, UINT32 attr, void *data, __size_t len);
|
||||
EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr);
|
||||
|
||||
/* guids and names */
|
||||
|
@ -68,6 +68,25 @@ efi_freebsd_getenv(const char *v, void *data, size_t *len)
|
||||
return (efi_getenv(&FreeBSDBootVarGUID, v, data, len));
|
||||
}
|
||||
|
||||
/*
|
||||
* efi_setenv -- Sets an env variable.
|
||||
*/
|
||||
EFI_STATUS
|
||||
efi_setenv(EFI_GUID *guid, const char *varname, UINT32 attr, void *data, __size_t len)
|
||||
{
|
||||
EFI_STATUS rv;
|
||||
CHAR16 *uv;
|
||||
size_t ul;
|
||||
|
||||
uv = NULL;
|
||||
if (utf8_to_ucs2(varname, &uv, &ul) != 0)
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
|
||||
rv = RS->SetVariable(uv, guid, attr, len, data);
|
||||
free(uv);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user