xref: /freebsd/share/man/man4/efidev.4 (revision 2f4146c5d4705f7cc35c739d54390bcb2338abbb)
1503478afSKyle Evans.\"-
2503478afSKyle Evans.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3503478afSKyle Evans.\"
4503478afSKyle Evans.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
5503478afSKyle Evans.\"
6503478afSKyle Evans.\" Redistribution and use in source and binary forms, with or without
7503478afSKyle Evans.\" modification, are permitted provided that the following conditions
8503478afSKyle Evans.\" are met:
9503478afSKyle Evans.\" 1. Redistributions of source code must retain the above copyright
10503478afSKyle Evans.\"    notice, this list of conditions and the following disclaimer.
11503478afSKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright
12503478afSKyle Evans.\"    notice, this list of conditions and the following disclaimer in the
13503478afSKyle Evans.\"    documentation and/or other materials provided with the distribution.
14503478afSKyle Evans.\"
15503478afSKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16503478afSKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17503478afSKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18503478afSKyle Evans.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19503478afSKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20503478afSKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21503478afSKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22503478afSKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23503478afSKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24503478afSKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25503478afSKyle Evans.\" SUCH DAMAGE.
26503478afSKyle Evans.\"
27503478afSKyle Evans.\" $FreeBSD$
28503478afSKyle Evans.\"
29503478afSKyle Evans.Dd August 12, 2018
30503478afSKyle Evans.Dt EFIDEV 4
31503478afSKyle Evans.Os
32503478afSKyle Evans.Sh NAME
33503478afSKyle Evans.Nm efidev ,
34503478afSKyle Evans.Nm efirtc
35503478afSKyle Evans.Nd user-mode access to UEFI runtime services
36503478afSKyle Evans.Sh SYNOPSIS
37503478afSKyle EvansTo compile this driver into the kernel, place the following lines in your
38503478afSKyle Evanskernel configuration file:
39503478afSKyle Evans.Bd -ragged -offset -indent
40503478afSKyle Evans.Cd "options EFIRT"
41503478afSKyle Evans.Ed
42503478afSKyle Evans.Pp
43503478afSKyle EvansAlternatively, to load the driver as a module at boot time, place the following
44503478afSKyle Evansline in
45503478afSKyle Evans.Xr loader.conf 5 :
46503478afSKyle Evans.Bd -literal -offset indent
47503478afSKyle Evansefirt_load="YES"
48503478afSKyle Evans.Ed
49503478afSKyle Evans.Pp
50*2f4146c5SMateusz PiotrowskiThe driver may be disabled by setting the
51503478afSKyle Evans.Xr loader 8
52503478afSKyle Evanstunable
53503478afSKyle Evans.Va efi.rt.disabled
54*2f4146c5SMateusz Piotrowskito
55*2f4146c5SMateusz Piotrowski.Dq Li 1 .
56503478afSKyle Evans.Sh DESCRIPTION
57503478afSKyle EvansThe
58503478afSKyle Evans.Nm
59503478afSKyle Evansdevice provides user-mode access to UEFI runtime services.
60503478afSKyle Evans.Nm
61503478afSKyle Evansalso includes a driver to provide a time-of-day clock using the UEFI
62503478afSKyle Evansreal time clock (RTC).
63503478afSKyle EvansHowever, the RTC may not always be available, based on the UEFI firmware.
64503478afSKyle EvansIf the RTC is not available, it will not be registered as a time-of-day clock
65503478afSKyle Evansand the time related ioctls below will not be functional.
66503478afSKyle Evans.Pp
67503478afSKyle Evans.Nm
68503478afSKyle Evansprovides the following ioctls defined in
69503478afSKyle Evans.In sys/efiio.h
70503478afSKyle Evanswith supplemental structures and constants defined in
71503478afSKyle Evans.In sys/efi.h :
72*2f4146c5SMateusz Piotrowski.Bl -tag -width indent
73503478afSKyle Evans.It Dv EFIIOC_GET_TABLE Pq Vt "struct efi_get_table_ioc"
74503478afSKyle EvansGet a table by uuid from the UEFI system table.
75*2f4146c5SMateusz Piotrowski.Bd -literal -offset indent
76503478afSKyle Evansstruct efi_get_table_ioc {
77503478afSKyle Evans	struct uuid uuid;
78503478afSKyle Evans	void *ptr;
79503478afSKyle Evans};
80503478afSKyle Evans.Ed
81503478afSKyle Evans.It Dv EFIIOC_GET_TIME Pq Vt "struct efi_tm"
82503478afSKyle EvansGet the time from the RTC, if the RTC is available.
83503478afSKyle EvansThe
84503478afSKyle Evans.Vt struct efi_tm
85503478afSKyle Evanspassed is populated with the current time, unless an error occurs.
86*2f4146c5SMateusz Piotrowski.Bd -literal -offset indent
87503478afSKyle Evansstruct efi_tm {
88503478afSKyle Evans	uint16_t	tm_year;
89503478afSKyle Evans	uint8_t		tm_mon
90503478afSKyle Evans	uint8_t		tm_mday
91503478afSKyle Evans	uint8_t		tm_hour;
92503478afSKyle Evans	uint8_t		tm_min;
93503478afSKyle Evans	uint8_t		tm_sec;
94503478afSKyle Evans	uint8_t		 __pad1;
95503478afSKyle Evans	uint32_t	tm_nsec;
96503478afSKyle Evans	int16_t		tm_tz;
97503478afSKyle Evans	uint8_t		tm_dst;
98503478afSKyle Evans	uint8_t		__pad2;
99503478afSKyle Evans};
100503478afSKyle Evans.Ed
101503478afSKyle Evans.It Dv EFIIOC_SET_TIME Pq Vt "struct efi_tm"
102503478afSKyle EvansSets the time stored by the RTC, if the RTC is available.
103503478afSKyle Evans.It Dv EFIIOC_VAR_GET Pq Vt "struct efi_var_ioc"
104503478afSKyle EvansGets data from the variable described by the vendor and name fields of the
105503478afSKyle Evans.Vt struct efi_var_ioc
106*2f4146c5SMateusz Piotrowskiinto the
107*2f4146c5SMateusz Piotrowski.Fa data
108*2f4146c5SMateusz Piotrowskifield.
109503478afSKyle Evans.Dv EFIIOC_VAR_GET Pq Vt "struct efi_var_ioc"
110*2f4146c5SMateusz Piotrowskiwill also populate the
111*2f4146c5SMateusz Piotrowski.Fa attrib
112*2f4146c5SMateusz Piotrowskifield.
113503478afSKyle Evans.Bd -literal
114503478afSKyle Evansstruct efi_var_ioc {
115503478afSKyle Evans	efi_char	*name;
116503478afSKyle Evans	size_t		 namesize;
117503478afSKyle Evans	struct uuid	 vendor;
118503478afSKyle Evans	uint32_t	 attrib;
119503478afSKyle Evans	void		*data;
120503478afSKyle Evans	size_t		 datasize;
121503478afSKyle Evans};
122503478afSKyle Evans.Ed
123503478afSKyle Evans.It Dv EFIIOC_VAR_NEXT Pq Vt "struct efi_var_ioc"
124503478afSKyle EvansUsed for enumerating all UEFI variables.
125503478afSKyle EvansThe initial call should use an empty string for the name attribute.
126503478afSKyle EvansSubsequent calls should supply the vendor uuid and name of the last variable
127503478afSKyle Evansreturned.
128503478afSKyle Evans.It Dv EFIIOC_VAR_SET Pq Vt "struct efi_var_ioc"
129503478afSKyle EvansSets data and attributes for the variable described by the name and vendor in
130503478afSKyle Evansthe
131503478afSKyle Evans.Vt struct efi_var_ioc .
132503478afSKyle Evans.El
133503478afSKyle Evans.Sh FILES
134503478afSKyle Evans.Bl -tag -width /dev/efi
135503478afSKyle Evans.It Pa /dev/efi
136503478afSKyle Evans.El
137503478afSKyle Evans.Sh SEE ALSO
138*2f4146c5SMateusz Piotrowski.Xr efivar 3 ,
139503478afSKyle Evans.Xr efirt 9
140503478afSKyle Evans.Sh HISTORY
141503478afSKyle EvansA
142503478afSKyle Evans.Nm
143503478afSKyle Evansdevice first appeared in
144503478afSKyle Evans.Fx 11.1 .
145*2f4146c5SMateusz Piotrowski.Sh BUGS
146*2f4146c5SMateusz Piotrowski.Nm
147*2f4146c5SMateusz Piotrowskiis currently only available on amd64 and arm64.
148