1.\" $OpenBSD: efi.4,v 1.3 2024/05/05 19:13:13 kn Exp $ 2.\" 3.\" Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> 4.\" Copyright (c) 2024 Klemens Nanni <kn@openbsd.org> 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: May 5 2024 $ 19.Dt EFI 4 20.Os 21.Sh NAME 22.Nm efi 23.Nd Unified Extensible Firmware Interface 24.Sh SYNOPSIS 25.Cd "# amd64" 26.Cd "efi* at bios?" 27.Pp 28.Cd "# arm64" 29.Cd "efi* at fdt?" 30.Sh DESCRIPTION 31The 32.Nm 33driver provides support for EFI runtime services offered by UEFI 34firmware implementations. 35It can read and write the Real Time Clock and provides userland applications 36.Xr ioctl 2 37access to the System Resource Table and to read and write variables. 38.Sh IOCTLS 39.Nm 40supports the following 41.Xr ioctl 2 42commands, available through 43.In dev/efi/efi.h 44.In dev/efi/efiio.h : 45.Bl -tag -width xxxx 46.It Dv EFIIOC_GET_TABLE Fa "struct efi_get_table_ioc *" 47.Bd -literal 48struct efi_get_table_ioc { 49 void *buf; /* Pointer to userspace buffer */ 50 struct uuid uuid; /* UUID to look up */ 51 size_t table_len; /* Table size */ 52 size_t buf_len; /* Size of the buffer */ 53}; 54.Ed 55.Pp 56Read a table. 57.It Dv EFIIOC_VAR_GET Fa "struct efi_var_ioc *" 58.Bd -literal 59struct efi_var_ioc { 60 uint16_t *name; /* User pointer to name, in UCS2 chars */ 61 size_t namesize; /* Number of *bytes* in the name 62 including terminator */ 63 struct uuid vendor; /* Vendor's UUID for variable */ 64 uint32_t attrib; /* Attributes */ 65 void *data; /* User pointer to value */ 66 size_t datasize; /* Number of *bytes* in the value */ 67}; 68.Ed 69.Pp 70Read a variable. 71.It Dv EFIIOC_VAR_NEXT Fa "struct efi_var_ioc *" 72Enumerate all variables. 73The first command must use the empty name. 74Further ones must denote the previous variable's name and UUID. 75.It Dv EFIIOC_VAR_SET Fa "struct efi_var_ioc *" 76Write a variable. 77Delete it if 78.Va datasize 79is zero. 80.El 81.Sh FILES 82.Bl -tag -width /dev/efi -compact 83.It Pa /dev/efi 84.El 85.Sh SEE ALSO 86.Xr ioctl 2 , 87.Xr intro 4 88.Sh HISTORY 89The 90.Nm 91device driver first appeared for arm64 in 92.Ox 6.3 . 93Support for amd64, the ESRT and EFI variables appeared in 94.Ox 7.3 . 95.Sh AUTHORS 96.An -nosplit 97The 98.Nm 99driver was written by 100.An Mark Kettenis Aq Mt kettenis@openbsd.org . 101Support for the ESRT and EFI variables is heavily based on work done by 102.An Sergii Dmytruk Aq Mt sergii.dmytruk@3meb.com . 103