aboutsummaryrefslogtreecommitdiff
path: root/stand/efi/boot1/boot1.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-03-12 21:40:14 +0000
committerWarner Losh <imp@FreeBSD.org>2018-03-12 21:40:14 +0000
commit5722dd8394fd16a53f65fa0149aeb2d1068d5115 (patch)
tree4177aff4a1b90f094275008262b3ca58670cbe44 /stand/efi/boot1/boot1.c
parentf7b26b765b5fcbccf33e41637961ba6330010115 (diff)
downloadsrc-5722dd8394fd16a53f65fa0149aeb2d1068d5115.tar.gz
src-5722dd8394fd16a53f65fa0149aeb2d1068d5115.zip
Move the env convenience routines out of boot1.c.
These routines are more generally useful. Even though boot1 is on its way out, it's better to make these common during the transition than copy them.
Notes
Notes: svn path=/head/; revision=330813
Diffstat (limited to 'stand/efi/boot1/boot1.c')
-rw-r--r--stand/efi/boot1/boot1.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c
index 62c94db51ef5..5c03a100f373 100644
--- a/stand/efi/boot1/boot1.c
+++ b/stand/efi/boot1/boot1.c
@@ -54,8 +54,6 @@ static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL;
static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL;
static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
-static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID;
-static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID;
/*
* Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures
@@ -80,42 +78,6 @@ Free(void *buf, const char *file __unused, int line __unused)
(void)BS->FreePool(buf);
}
-static EFI_STATUS
-efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len)
-{
- size_t ul;
- CHAR16 *uv;
- UINT32 attr;
- UINTN dl;
- EFI_STATUS rv;
-
- uv = NULL;
- if (utf8_to_ucs2(v, &uv, &ul) != 0)
- return (EFI_OUT_OF_RESOURCES);
- dl = *len;
- rv = RS->GetVariable(uv, g, &attr, &dl, data);
- if (rv == EFI_SUCCESS)
- *len = dl;
- free(uv);
- return (rv);
-}
-
-static EFI_STATUS
-efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr)
-{
- CHAR16 *var = NULL;
- size_t len;
- EFI_STATUS rv;
-
- if (utf8_to_ucs2(varname, &var, &len) != 0)
- return (EFI_OUT_OF_RESOURCES);
- rv = RS->SetVariable(var, &FreeBSDBootVarGUID,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- (ucs2len(valstr) + 1) * sizeof(efi_char), valstr);
- free(var);
- return (rv);
-}
-
/*
* nodes_match returns TRUE if the imgpath isn't NULL and the nodes match,
* FALSE otherwise.
@@ -505,11 +467,11 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
boot_current = 0;
sz = sizeof(boot_current);
- efi_getenv(&GlobalBootVarGUID, "BootCurrent", &boot_current, &sz);
+ efi_global_getenv("BootCurrent", &boot_current, &sz);
printf(" BootCurrent: %04x\n", boot_current);
sz = sizeof(boot_order);
- efi_getenv(&GlobalBootVarGUID, "BootOrder", &boot_order, &sz);
+ efi_global_getenv("BootOrder", &boot_order, &sz);
printf(" BootOrder:");
for (i = 0; i < sz / sizeof(boot_order[0]); i++)
printf(" %04x", boot_order[i]);