EFIRT(9)

✨ NAME ✨

okay bestie, welcome to efirt(9) β€” that's the kernel access to UEFI runtime services page, and yes it's giving very "deep magic, do not touch unless you know what you're doing" energy πŸ’…

the whole fam is here: 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, efi_var_set.


🌸 SYNOPSIS 🌸

options EFIRT

#include <sys/efi.h>

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(void);

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 πŸ¦‹

okay so first thing, the group-chat announcement: every single one of these calls returns ENXIO if UEFI runtime services aren't available. no services, no vibes. and also, efirt is currently only available on amd64 and arm64 β€” so if you're on something else, this whole page is just ✨aesthetic✨ for you.

efi_rt_ok() πŸ’–

returns 0 if UEFI runtime services are present and functional, or ENXIO if not. that's it. that's the vibe check.

efi_get_table() πŸ”

gets a table by uuid from the UEFI system table. returns 0 if the table was found, and populates *ptr with the address. returns ENXIO if the configuration table or system table are unset. returns ENOENT if the requested table cannot be found. (rip, the table ghosted you.)

efi_get_time() ⏰

gets the current time from the RTC, if it's available. returns 0 and populates the struct efi_tm on success. returns EINVAL if the struct efi_tm is NULL, or EIO if the time could not be retrieved due to a hardware error.

efi_get_time_capabilities() πŸŽ€

gets the capabilities from the RTC. returns 0 and populates the struct efi_tmcap on success. returns EINVAL if the struct efi_tm is NULL, or EIO if the time could not be retrieved due to a hardware error.

efi_reset_system() πŸ’€

requests a warm reset and reboot of the system. yeah. that's a whole thing. it just asks for it, no arguments, no return value to check. main character move tbh.

efi_set_time() πŸ•°οΈ

sets the time on the RTC to the time described by the struct efi_tm passed in. returns 0 on success, EINVAL if a time field is out of range, or EIO if the time could not be set due to a hardware error.

efi_var_get() πŸ“

fetches the variable identified by vendor and name. returns 0 and populates attrib, datasize, and data on success. otherwise, one of these little guys comes back at you:

  • ENOENT β€” the variable was not found.
  • EOVERFLOW β€” datasize is not sufficient to hold the variable data. namesize is updated to reflect the size needed to complete the request.
  • EINVAL β€” one of name, vendor, or datasize are NULL. alternatively, datasize is large enough to hold the response but data is NULL.
  • EIO β€” the variable could not be retrieved due to a hardware error.
  • EDOOFUS β€” the variable could not be retired due to an authentication failure.
not the EDOOFUS. iconic error name, honestly. no notes. πŸ‘‘

efi_var_nextname() 🌈

this one's for enumeration of variables, aka scrolling the list. on the initial call to efi_var_nextname(), name should be an empty string. subsequent calls should pass in the last name and vendor returned, until ENOENT is returned. returns 0 and populates namesize, name, and vendor with the next variable's data. otherwise, returns one of the following:

  • ENOENT β€” the next variable was not found.
  • EOVERFLOW β€” datasize is not sufficient to hold the variable data. namesize is updated to reflect the size needed to complete the request.
  • EINVAL β€” one of name, vendor, or datasize are NULL.
  • EIO β€” the variable could not be retrieved due to a hardware error.

efi_var_set() ✨

sets the variable described by name and vendor. returns 0 if the variable has been successfully. otherwise, returns one of the following:

  • EINVAL β€” either attrib was an invalid combination of attributes, datasize exceeds the maximum allowed size, or name is an empty Unicode string.
  • EAGAIN β€” not enough storage is available to hold the variable and its data.
  • EIO β€” the variable could not be saved due to a hardware error.
  • EROFS β€” the variable in question is read-only or may not be deleted.
  • EDOOFUS β€” the variable could not be set due to an authentication failure.
  • ENOENT β€” the variable trying to be updated or deleted was not found.

πŸ‘€ SEE ALSO πŸ‘€


🫢 AUTHORS 🫢

this manual page was written by Kyle Evans <kevans@FreeBSD.org>. thank you Kyle, you ate πŸ’–


and that's the whole page bestie, no cap β€” this beauty came from Debian, dated August 12, 2018, and it lives in section EFIRT(9) of the Kernel Developer's Manual. go forth and talk to your firmware responsibly 🧚✨

πŸ“¦ where this page comes from