1bb7548fdSMatthew Dillon.\" Copyright 2016 Netflix, Inc. 2bb7548fdSMatthew Dillon.\" All rights reserved. 3bb7548fdSMatthew Dillon.\" 4bb7548fdSMatthew Dillon.\" Redistribution and use in source and binary forms, with or without 5bb7548fdSMatthew Dillon.\" modification, are permitted provided that the following conditions 6bb7548fdSMatthew Dillon.\" are met: 7bb7548fdSMatthew Dillon.\" 1. Redistributions of source code must retain the above copyright 8bb7548fdSMatthew Dillon.\" notice, this list of conditions and the following disclaimer. 9bb7548fdSMatthew Dillon.\" 2. Redistributions in binary form must reproduce the above copyright 10bb7548fdSMatthew Dillon.\" notice, this list of conditions and the following disclaimer in the 11bb7548fdSMatthew Dillon.\" documentation and/or other materials provided with the distribution. 12bb7548fdSMatthew Dillon.\" 13bb7548fdSMatthew Dillon.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14bb7548fdSMatthew Dillon.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15bb7548fdSMatthew Dillon.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16bb7548fdSMatthew Dillon.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17bb7548fdSMatthew Dillon.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18bb7548fdSMatthew Dillon.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19bb7548fdSMatthew Dillon.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20bb7548fdSMatthew Dillon.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21bb7548fdSMatthew Dillon.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22bb7548fdSMatthew Dillon.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23bb7548fdSMatthew Dillon.\" SUCH DAMAGE. 24bb7548fdSMatthew Dillon.\" 254661c169SSascha Wildner.\" $FreeBSD: head/lib/libefivar/efivar.3 343755 2019-02-04 21:28:25Z imp $ 26bb7548fdSMatthew Dillon.\" 27*8f5a7c01SSascha Wildner.Dd July 3, 2020 28bb7548fdSMatthew Dillon.Dt LIBEFIVAR 3 29bb7548fdSMatthew Dillon.Os 30bb7548fdSMatthew Dillon.Sh NAME 31bb7548fdSMatthew Dillon.Nm libefivar 32bb7548fdSMatthew Dillon.Nd EFI Non Volatile Variable Support 33bb7548fdSMatthew Dillon.Sh LIBRARY 34bb7548fdSMatthew Dillon.Lb libefivar 35bb7548fdSMatthew Dillon.Sh SYNOPSIS 36bb7548fdSMatthew Dillon.In efivar.h 37bb7548fdSMatthew Dillon.Ft int 38b33f9840SSascha Wildner.Fn efi_append_variable "efi_guid_t guid" "const char *name" "uint8_t *data" "size_t data_size" "uint32_t attributes" 39bb7548fdSMatthew Dillon.Ft int 40bb7548fdSMatthew Dillon.Fn efi_del_variable "efi_guid_t guid" "const char *name" 41bb7548fdSMatthew Dillon.Ft int 42b33f9840SSascha Wildner.Fn efi_get_variable "efi_guid_t guid" "const char *name" "uint8_t **data" "size_t *data_size" "uint32_t *attributes" 43bb7548fdSMatthew Dillon.Ft int 44bb7548fdSMatthew Dillon.Fn efi_get_variable_attributes "efi_guid_t guid" "const char *name" "uint32_t *attributes" 45bb7548fdSMatthew Dillon.Ft int 46bb7548fdSMatthew Dillon.Fn efi_get_variable_size "efi_guid_t guid" "const char *name" "size_t *size" 47bb7548fdSMatthew Dillon.Ft int 48bb7548fdSMatthew Dillon.Fn efi_get_next_variable_name "efi_guid_t **guid" "char **name" 49bb7548fdSMatthew Dillon.Ft int 50bb7548fdSMatthew Dillon.Fn efi_guid_to_name "efi_guid_t *guid" "char **name" 51bb7548fdSMatthew Dillon.Ft int 52bb7548fdSMatthew Dillon.Fn efi_guid_to_symbol "efi_guid_t *guid" "char **symbol" 53bb7548fdSMatthew Dillon.Ft int 54bb7548fdSMatthew Dillon.Fn efi_guid_to_str "const efi_guid_t *guid" "char **sp" 55bb7548fdSMatthew Dillon.Ft int 56bb7548fdSMatthew Dillon.Fn efi_name_to_guid "const char *name" "efi_guid_t *guid" 57bb7548fdSMatthew Dillon.Ft int 58*8f5a7c01SSascha Wildner.Fn efi_set_variable "efi_guid_t guid" "const char *name" "uint8_t *data" "size_t data_size" "uint32_t attributes" 59bb7548fdSMatthew Dillon.Ft int 60d1918246SSascha Wildner.Fn efi_str_to_guid "const char *s" "efi_guid_t *guid" 61bb7548fdSMatthew Dillon.Ft int 62d1918246SSascha Wildner.Fn efi_variables_supported "void" 63bb7548fdSMatthew Dillon.Sh DESCRIPTION 64bb7548fdSMatthew DillonThe 65bb7548fdSMatthew Dillon.Nm 66bb7548fdSMatthew Dillonlibrary implements access to EFI Variables via the EFI Runtime 67fa2a47c7SSascha WildnerServices. 684661c169SSascha WildnerAll 694661c169SSascha Wildner.Vt "char *" 704661c169SSascha Wildnerstrings are converted to 16-bit UTF strings before passing 71bb7548fdSMatthew Dillonthem to EFI. 72bb7548fdSMatthew Dillon.Pp 73bb7548fdSMatthew Dillon.Fn efi_variables_supported 74bb7548fdSMatthew Dillonreturns non-zero if the current machine supports setting of EFI firmware 75bb7548fdSMatthew Dillonvariables and the kernel support for doing so is present. 76bb7548fdSMatthew DillonOtherwise zero is returned. 77bb7548fdSMatthew Dillon.Pp 78bb7548fdSMatthew Dillon.Fn efi_del_variable 79bb7548fdSMatthew Dillondeletes the EFI variable selected by 804661c169SSascha Wildner.Fa guid 81bb7548fdSMatthew Dillonand 824661c169SSascha Wildner.Fa name . 83bb7548fdSMatthew Dillon.Pp 844661c169SSascha WildnerThe following functions have not been implemented yet: 854661c169SSascha Wildner.Bl -dash -offset indent -compact 864661c169SSascha Wildner.It 87bb7548fdSMatthew Dillon.Fn efi_append_variable 884661c169SSascha Wildner.It 89bb7548fdSMatthew Dillon.Fn efi_get_next_variable_name 904661c169SSascha Wildner.It 914661c169SSascha Wildner.Fn efi_get_variable 924661c169SSascha Wildner.It 934661c169SSascha Wildner.Fn efi_get_variable_attributes 944661c169SSascha Wildner.It 954661c169SSascha Wildner.Fn efi_get_variable_size 964661c169SSascha Wildner.It 97bb7548fdSMatthew Dillon.Fn efi_guid_to_name 984661c169SSascha Wildner.It 994661c169SSascha Wildner.Fn efi_guid_to_str 1004661c169SSascha Wildner.It 101bb7548fdSMatthew Dillon.Fn efi_guid_to_symbol 1024661c169SSascha Wildner.It 1034661c169SSascha Wildner.Fn efi_name_to_guid 1044661c169SSascha Wildner.It 1054661c169SSascha Wildner.Fn efi_set_variable 1064661c169SSascha Wildner.It 1074661c169SSascha Wildner.Fn efi_str_to_guid 1084661c169SSascha Wildner.El 109d1918246SSascha Wildner.Sh SEE ALSO 110da367edfSSascha Wildner.Xr efidev 4 , 1114661c169SSascha Wildner.Xr efidp 8 , 112d1918246SSascha Wildner.Xr efivar 8 1134661c169SSascha Wildner.Sh HISTORY 1144661c169SSascha WildnerThe 1154661c169SSascha Wildner.Nm 1164661c169SSascha Wildnerlibrary first appeared in 1174661c169SSascha Wildner.Fx 12.0 . 118bb7548fdSMatthew Dillon.Sh AUTHORS 119bb7548fdSMatthew Dillon.An -nosplit 120bb7548fdSMatthew DillonThis software was originally written by 121bb7548fdSMatthew Dillon.An Warner Losh . 122d1918246SSascha Wildner.Sh BUGS 123d1918246SSascha WildnerNo facilities exist to process the strings as native UTF. 1244661c169SSascha WildnerThis is a limitation in the Linux 1254661c169SSascha Wildner.Nm 1264661c169SSascha Wildnerlibrary interface. 127