xref: /freebsd/lib/libefivar/efivar.3 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1.\"
2.\" Copyright 2016 Netflix, Inc.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd October 25, 2018
27.Dt LIBEFIVAR 3
28.Os
29.Sh NAME
30.Nm libefivar
31.Nd EFI Non Volatile Variable Support
32.Sh SYNOPSIS
33.In efivar.h
34.Ft int
35.Fn efi_append_variable "efi_guid_t guid" "const char *name" "void *data" "size_t data_size" "uint32_t attributes"
36.Ft int
37.Fn efi_del_variable "efi_guid_t guid" "const char *name"
38.Ft int
39.Fn efi_get_variable "efi_guid_t guid" "const char *name" "void **data" "ssize_t *data_size" "uint32_t *attributes"
40.Ft int
41.Fn efi_get_variable_attributes "efi_guid_t guid" "const char *name" "uint32_t *attributes"
42.Ft int
43.Fn efi_get_variable_size "efi_guid_t guid" "const char *name" "size_t *size"
44.Ft int
45.Fn efi_get_next_variable_name "efi_guid_t **guid" "char **name"
46.Ft int
47.Fn efi_guid_to_name "efi_guid_t *guid" "char **name"
48.Ft int
49.Fn efi_guid_to_symbol "efi_guid_t *guid" "char **symbol"
50.Ft int
51.Fn efi_guid_to_str "const efi_guid_t *guid" "char **sp"
52.Ft int
53.Fn efi_name_to_guid "const char *name" "efi_guid_t *guid"
54.Ft int
55.Fn efi_set_variable "efi_guid_t guid" "const char *name" "void *data" "size_t data_size" "uint32_t attributes"
56.Ft int
57.Fn efi_str_to_guid "const char *s" "efi_guid_t *guid"
58.Ft int
59.Fn efi_variables_supported "void"
60.Sh DESCRIPTION
61The
62.Nm
63library implements access to EFI Variables via the EFI Runtime
64Services.
65All
66.Vt "char *"
67strings are converted to 16-bit UTF strings before passing
68them to EFI.
69.Pp
70.Fn efi_variables_supported
71returns non-zero if the current machine supports setting of EFI firmware
72variables and the kernel support for doing so is present.
73Otherwise zero is returned.
74.Pp
75.Fn efi_del_variable
76deletes the EFI variable selected by
77.Va guid
78and
79.Va name .
80.Pp
81The following functions have not been implemented yet:
82.Bl -dash -offset indent -compact
83.It
84.Fn efi_append_variable
85.It
86.Fn efi_get_next_variable_name
87.It
88.Fn efi_get_variable
89.It
90.Fn efi_get_variable_attributes
91.It
92.Fn efi_get_variable_size
93.It
94.Fn efi_guid_to_name
95.It
96.Fn efi_guid_to_str
97.It
98.Fn efi_guid_to_symbol
99.It
100.Fn efi_name_to_guid
101.It
102.Fn efi_set_variable
103.It
104.Fn efi_str_to_guid
105.El
106.Sh SEE ALSO
107.Xr efidev 4
108.Sh HISTORY
109The
110.Nm
111library first appeared in
112.Fx 12.0 .
113.Sh AUTHORS
114.An -nosplit
115This software was originally written by
116.An Warner Losh .
117.Sh BUGS
118No facilities exist to process the strings as native UTF.
119This is a limitation in the Linux
120.Nm
121library interface.
122