2010-01-30 04:24:03 +00:00
|
|
|
.\"-
|
|
|
|
.\" Copyright (c) 2010 Marcel Moolenaar
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2010-02-09 18:43:20 +00:00
|
|
|
.Dd January 29, 2010
|
2010-01-30 04:24:03 +00:00
|
|
|
.Dt LIBEFI 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm efi_getvar , efi_nextvarname , efi_setvar
|
2010-02-09 18:43:20 +00:00
|
|
|
.Nd "interface for accessing the EFI variable services"
|
2010-01-30 04:24:03 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libefi
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In libefi.h
|
|
|
|
.Ft int
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fo efi_getvar
|
|
|
|
.Fa "char *name" "uuid_t *vendor" "uint32_t *attrib"
|
|
|
|
.Fa "size_t *datasize" "void *data"
|
|
|
|
.Fc
|
2010-01-30 04:24:03 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn efi_nextvarname "size_t *namesize" "char *name" "uuid_t *vendor"
|
|
|
|
.Ft int
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fo efi_setvar
|
|
|
|
.Fa "char *name" "uuid_t *vendor" "uint32_t attrib"
|
|
|
|
.Fa "size_t datasize" "void *data"
|
|
|
|
.Fc
|
2010-01-30 04:24:03 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm libefi
|
|
|
|
library provides access to a select set of the runtime services of the
|
|
|
|
Extensible Firmware Interface (EFI).
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn efi_nextvarname
|
|
|
|
function is used to enumerate the variables.
|
|
|
|
The
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa namesize
|
2010-01-30 04:24:03 +00:00
|
|
|
parameter needs to be set to the size of the buffer pointed to by
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa name .
|
2010-01-30 04:24:03 +00:00
|
|
|
On return,
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa namesize
|
|
|
|
is set to the length of the variable name (including the terminating
|
|
|
|
.Ql \e0 )
|
2010-01-30 04:24:03 +00:00
|
|
|
irrespective of whether the buffer was big enough.
|
|
|
|
The buffer pointed to by
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa name
|
2010-01-30 04:24:03 +00:00
|
|
|
contains the full or partial variable name on return.
|
|
|
|
Only on successful completion of the request is the
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa vendor
|
2010-01-30 04:24:03 +00:00
|
|
|
updated.
|
|
|
|
The values returned should be passed to successive calls to
|
|
|
|
.Fn efi_nextvarname
|
|
|
|
until all variables have been enumerated.
|
|
|
|
.Pp
|
|
|
|
The variable name and vendor as returned by
|
|
|
|
.Fn efi_nextvarname
|
|
|
|
can be passed to
|
|
|
|
.Fn efi_getvar
|
|
|
|
to obtain the value and attribute of the variable.
|
|
|
|
The buffer that is to contain the value is specified by
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa data
|
2010-01-30 04:24:03 +00:00
|
|
|
and the size of the buffer is given by
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa datasize .
|
2010-01-30 04:24:03 +00:00
|
|
|
The attribute pointed to by
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa attrib
|
2010-01-30 04:24:03 +00:00
|
|
|
consists of the bit values defined by the EFI specification.
|
|
|
|
.Pp
|
|
|
|
Variables can be created, modified and deleted using the
|
|
|
|
.Fn efi_setvar
|
|
|
|
function.
|
2010-08-03 17:40:09 +00:00
|
|
|
All new variables must be non-volatile and runtime accessible in
|
2010-01-30 04:24:03 +00:00
|
|
|
order for the request to succeed.
|
|
|
|
Note that for runtime accessable variables the boottime accessable bit must
|
|
|
|
be set as well.
|
|
|
|
To delete a variable, set
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fa datasize
|
2010-01-30 04:24:03 +00:00
|
|
|
to 0.
|
|
|
|
.Pp
|
|
|
|
The vendor UUID is used to avoid collisions between variable names of
|
|
|
|
different vendors.
|
2010-02-09 18:43:20 +00:00
|
|
|
Variables created for use by
|
|
|
|
.Fx
|
|
|
|
should use the
|
|
|
|
.Dv EFI_FREEBSD_VARIABLE
|
2010-01-30 04:24:03 +00:00
|
|
|
UUID as defined in the
|
2010-02-09 18:43:20 +00:00
|
|
|
.In libefi.h
|
2010-01-30 04:24:03 +00:00
|
|
|
header file.
|
|
|
|
.Sh RETURN VALUES
|
|
|
|
Upon successful completion, these functions return 0.
|
|
|
|
Otherwise, the error number is returned.
|
|
|
|
These functions will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EACCES
|
|
|
|
Insufficient permissions to access the EFI services.
|
|
|
|
.It Bq Er EILSEQ
|
|
|
|
The variable name is not in UTF-8.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The request has invalid parameters.
|
|
|
|
.It Bq Er ENOENT
|
|
|
|
The variable does not exist or no more variables exist.
|
|
|
|
.It Bq Er ENOMEM
|
|
|
|
Temporary storage could not be allocated.
|
|
|
|
.It Bq Er EOVERFLOW
|
|
|
|
The variable name is too long or the data is too big to fit in
|
|
|
|
the buffer provided.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr errno 2 ,
|
|
|
|
.Xr uuid 3
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm libefi
|
|
|
|
library first appeared in
|
2010-02-09 18:43:20 +00:00
|
|
|
.Fx 9.0
|
2010-01-30 04:24:03 +00:00
|
|
|
for the ia64 architecture.
|
|
|
|
.Sh AUTHORS
|
|
|
|
The
|
|
|
|
.Nm libefi
|
2010-02-09 18:43:20 +00:00
|
|
|
library and this manual page were written by
|
2010-01-30 04:24:03 +00:00
|
|
|
.An Marcel Moolenaar Aq marcel@FreeBSD.org .
|