xref: /freebsd-13-stable/share/man/man4/efidev.4 (revision b144e70a3325e033163aa4e6e15d0446e245702d)
1.\"-
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd August 12, 2018
28.Dt EFIDEV 4
29.Os
30.Sh NAME
31.Nm efidev ,
32.Nm efirtc
33.Nd user-mode access to UEFI runtime services
34.Sh SYNOPSIS
35To compile this driver into the kernel, place the following lines in your
36kernel configuration file:
37.Bd -ragged -offset -indent
38.Cd "options EFIRT"
39.Ed
40.Pp
41Alternatively, to load the driver as a module at boot time, place the following
42line in
43.Xr loader.conf 5 :
44.Bd -literal -offset indent
45efirt_load="YES"
46.Ed
47.Pp
48The driver may be disabled by setting the
49.Xr loader 8
50tunable
51.Va efi.rt.disabled
52to
53.Dq Li 1 .
54.Sh DESCRIPTION
55The
56.Nm
57device provides user-mode access to UEFI runtime services.
58.Nm
59also includes a driver to provide a time-of-day clock using the UEFI
60real time clock (RTC).
61However, the RTC may not always be available, based on the UEFI firmware.
62If the RTC is not available, it will not be registered as a time-of-day clock
63and the time related ioctls below will not be functional.
64.Pp
65.Nm
66provides the following ioctls defined in
67.In sys/efiio.h
68with supplemental structures and constants defined in
69.In sys/efi.h :
70.Bl -tag -width indent
71.It Dv EFIIOC_GET_TABLE Pq Vt "struct efi_get_table_ioc"
72Get a table by uuid from the UEFI system table.
73.Bd -literal -offset indent
74struct efi_get_table_ioc {
75	struct uuid uuid;
76	void *ptr;
77};
78.Ed
79.It Dv EFIIOC_GET_TIME Pq Vt "struct efi_tm"
80Get the time from the RTC, if the RTC is available.
81The
82.Vt struct efi_tm
83passed is populated with the current time, unless an error occurs.
84.Bd -literal -offset indent
85struct efi_tm {
86	uint16_t	tm_year;
87	uint8_t		tm_mon
88	uint8_t		tm_mday
89	uint8_t		tm_hour;
90	uint8_t		tm_min;
91	uint8_t		tm_sec;
92	uint8_t		 __pad1;
93	uint32_t	tm_nsec;
94	int16_t		tm_tz;
95	uint8_t		tm_dst;
96	uint8_t		__pad2;
97};
98.Ed
99.It Dv EFIIOC_SET_TIME Pq Vt "struct efi_tm"
100Sets the time stored by the RTC, if the RTC is available.
101.It Dv EFIIOC_VAR_GET Pq Vt "struct efi_var_ioc"
102Gets data from the variable described by the vendor and name fields of the
103.Vt struct efi_var_ioc
104into the
105.Fa data
106field.
107.Dv EFIIOC_VAR_GET Pq Vt "struct efi_var_ioc"
108will also populate the
109.Fa attrib
110field.
111.Bd -literal
112struct efi_var_ioc {
113	efi_char	*name;
114	size_t		 namesize;
115	struct uuid	 vendor;
116	uint32_t	 attrib;
117	void		*data;
118	size_t		 datasize;
119};
120.Ed
121.It Dv EFIIOC_VAR_NEXT Pq Vt "struct efi_var_ioc"
122Used for enumerating all UEFI variables.
123The initial call should use an empty string for the name attribute.
124Subsequent calls should supply the vendor uuid and name of the last variable
125returned.
126.It Dv EFIIOC_VAR_SET Pq Vt "struct efi_var_ioc"
127Sets data and attributes for the variable described by the name and vendor in
128the
129.Vt struct efi_var_ioc .
130.El
131.Sh FILES
132.Bl -tag -width /dev/efi
133.It Pa /dev/efi
134.El
135.Sh SEE ALSO
136.Xr efivar 3 ,
137.Xr efirt 9
138.Sh HISTORY
139A
140.Nm
141device first appeared in
142.Fx 11.1 .
143.Sh BUGS
144.Nm
145is currently only available on amd64 and arm64.
146