EFIDEV(4)
π EFIDEV π
okay so bestie, we're reading EFIDEV(4) today β that's the Kernel Interfaces Manual, section 4, the one about talking to your firmware's runtime services from userspace. pull up a chair, grab a strawberry π, this one's actually so good.
β¨ NAME β¨
efidev, efirtc β user-mode access to UEFI runtime services π«Ά
β¨ SYNOPSIS β¨
so like, if you wanna bake this driver straight into your kernel, you drop these lines into your kernel configuration file:
options EFIRT
orrr if you'd rather just load it as a module at boot time (way more chill tbh), you put this line in loader.conf(5):
efirt_load="YES"
and heads up: you can also turn the whole thing off by setting the loader(8) tunable efi.rt.disabled to β1β. no cap.
β¨ DESCRIPTION β¨
the efidev device is literally the plug that gives user-mode programs access to UEFI runtime services. it's giving bridge energy.
efidev also includes a driver that provides a time-of-day clock using the UEFI real time clock (RTC). BUT β and this is the part everyone forgets π β the RTC may not always be available, and whether it is depends entirely on your UEFI firmware. if the RTC isn't available, it will not be registered as a time-of-day clock, and all the time-related ioctls down below will just... not be functional. vibe check failed, sorry.
efidev provides the following ioctls, defined in <sys/efiio.h>, with the supplemental structures and constants living in <sys/efi.h>:
EFIIOC_GET_TABLE(struct efi_get_table_ioc) β gets you a table byuuidfrom the UEFI system table. iconic.
struct efi_get_table_ioc {
struct uuid uuid;
void *ptr;
};
EFIIOC_GET_TIME(struct efi_tm) β reads the time from the RTC, if the RTC is available. thestruct efi_tmyou pass in gets populated with the current time β unless an error happens, in which case, well. π
struct efi_tm {
uint16_t tm_year;
uint8_t tm_mon
uint8_t tm_mday
uint8_t tm_hour;
uint8_t tm_min;
uint8_t tm_sec;
uint8_t __pad1;
uint32_t tm_nsec;
int16_t tm_tz;
uint8_t tm_dst;
uint8_t __pad2;
};
EFIIOC_SET_TIME(struct efi_tm) β sets the time stored by the RTC, if the RTC is available. (see the pattern? RTC availability is the whole plot π)EFIIOC_VAR_GET(struct efi_var_ioc) β gets data from the variable described by thevendorandnamefields of thestruct efi_var_iocinto thedatafield. it will also populate theattribfield, slay.
struct efi_var_ioc {
efi_char *name;
size_t namesize;
struct uuid vendor;
uint32_t attrib;
void *data;
size_t datasize;
};
EFIIOC_VAR_NEXT(struct efi_var_ioc) β this one's for enumerating all the UEFI variables. the first call should use an empty string for thenameattribute. every call after that should supply thevendoruuid and thenameof the last variable that was returned. it's a little chain, iykyk πEFIIOC_VAR_SET(struct efi_var_ioc) β setsdataand attributes for the variable described by thenameandvendorin thestruct efi_var_ioc. main character energy, honestly.
β¨ FILES β¨
/dev/efi
β¨ SEE ALSO β¨
β¨ HISTORY β¨
a efidev device first appeared in FreeBSD 11.1. throwback. π
β¨ BUGS β¨
efidevis currently only available onamd64andarm64. so if you're on something else... not me finding out the hard way π
and that's the whole page, bestie! this one's from the Debian crew, dated August 12, 2018 β yes, a vintage, and it still ate. π β¨πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π the page's license: BSD-2-Clause-FreeBSD
- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms