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