EFIRT(9)
β¨ EFIRT(9) β¨
okay so this is a kernel developer's manual page, bestie β it's all about efirt, efi_rt_ok, efi_get_table, efi_get_time, efi_get_time_capabilities, efi_reset_system, efi_set_time, efi_var_get, efi_var_nextname, and efi_var_set, aka kernel access to UEFI runtime services π
πΈ SYNOPSIS πΈ
first things first, you gotta build with this option in your kernel config:
options EFIRT
and then include the header, obviously:
#include <sys/efi.h>
here's the whole squad of function signatures, no cap:
int
efi_rt_ok(void);
int
efi_get_table(struct uuid *uuid, void **ptr);
int
efi_get_time(struct efi_tm *tm);
int
efi_get_time_capabilities(struct efi_tmcap *tmcap);
int
efi_reset_system(enum efi_reset type);
int
efi_set_time(struct efi_tm *tm);
int
efi_var_get(uint16_t *name, struct uuid *vendor, uint32_t *attrib,
size_t *datasize, void *data);
int
efi_var_nextname(size_t *namesize, uint16_t *name, struct uuid *vendor);
int
efi_var_set(uint16_t *name, struct uuid *vendor, uint32_t attrib,
size_t datasize, void *data);
π¦ DESCRIPTION π¦
heads up, queen: all of these calls will return ENXIO if UEFI runtime services aren't available. and efirt is currently only available on amd64 and arm64, so don't come for it on other arches π
efi_rt_ok()β returns0if UEFI runtime services are present and functional, orENXIOif they're not. that's it, that's the vibe check βefi_get_table()β gets a table byuuidfrom the UEFI system table. returns0if the table was found and populates*ptrwith the address. returnsENXIOif the configuration table or system table are unset. returnsENOENTif the requested table can't be found. slay π₯efi_get_time()β gets the current time from the RTC, if available. returns0and populates thestruct efi_tmon success. returnsEINVALif thestruct efi_tmisNULL, orEIOif the time couldn't be retrieved due to a hardware error πefi_get_time_capabilities()β gets the capabilities from the RTC. returns0and populates thestruct efi_tmcapon success. returnsEINVALif thestruct efi_tmisNULL, orEIOif the time couldn't be retrieved due to a hardware error. (yes, the manpage literally saysstruct efi_tmthere β we keep the lore faithful π)efi_reset_system()β requests a reset of the system. thetypeargument may be one of theenum efi_resetvalues, and honestly this is the main character energy of the whole page:EFI_RESET_COLDβ perform a cold reset of the system, and reboot.EFI_RESET_WARMβ perform a warm reset of the system, and reboot.EFI_RESET_SHUTDOWNβ power off the system.
efi_set_time()β sets the time on the RTC to the time described by thestruct efi_tmpassed in. returns0on success,EINVALif a time field is out of range, orEIOif the time couldn't be set due to a hardware error. deadline behavior, honestly π«Άefi_var_get()β fetches the variable identified byvendorandname. returns0and populatesattrib,datasize, anddataon success. otherwise, one of these errors gets returned:ENOENTβ the variable was not found.EOVERFLOWβdatasizeis not sufficient to hold the variable data.namesizeis updated to reflect the size needed to complete the request.EINVALβ one ofname,vendor, ordatasizeareNULL. alternatively,datasizeis large enough to hold the response butdataisNULL.EIOβ the variable couldn't be retrieved due to a hardware error.EDOOFUSβ the variable couldn't be retrieved due to an authentication failure. π (yes that's a real errno, iconic)
efi_var_nextname()β this one's for enumeration of variables. on the initial call toefi_var_nextname(),nameshould be an empty string. subsequent calls should pass in the lastnameandvendorreturned untilENOENTis returned. returns0and populatesnamesize,name, andvendorwith the next variable's data. otherwise, returns one of these:ENOENTβ the next variable was not found.EOVERFLOWβdatasizeis not sufficient to hold the variable data.namesizeis updated to reflect the size needed to complete the request.EINVALβ one ofname,vendor, ordatasizeareNULL.EIOβ the variable couldn't be retrieved due to a hardware error.
efi_var_set()β sets the variable described bynameandvendor. returns0if the variable has been successfully. (the sentence just ends there in the original, bestie β we're not fixing it, that's canon π) otherwise, returns one of these:EINVALβ eitherattribwas an invalid combination of attributes,datasizeexceeds the maximum allowed size, ornameis an empty Unicode stirng. (that typo is also canon, we stan π)EAGAINβ not enough storage is available to hold the variable and its data.EIOβ the variable couldn't be saved due to a hardware error.EROFSβ the variable in question is read-only or may not be deleted.EDOOFUSβ the variable couldn't be set due to an authentication failure. πENOENTβ the variable trying to be updated or deleted was not found.
π SEE ALSO π
efidev(4) β go read it, iykyk π§
π AUTHORS π
this manual page was written by Kyle Evans <kevans@FreeBSD.org>. king behavior, we love to see it π
and that's a wrap, bestie!! β¨ this little gem came from Debian, dated November 2, 2021 β go forth and UEFI responsibly ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- π the page's license: BSD-2-Clause
- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms