---
name: "efirt"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/efirt"
---

# efirt(9)

kernel access to UEFI runtime services

## NAME

**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** – kernel access to UEFI runtime services

## 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**(*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

All of the following calls will return ENXIO if UEFI runtime services are not available. **efirt** is currently only available on amd64 and arm64.

The **efi\_rt\_ok**() Returns 0 if UEFI runtime services are present and functional, or ENXIO if not.

The **efi\_get\_table**() function 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.

The **efi\_get\_time**() function gets the current time from the RTC, if 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.

The **efi\_get\_time\_capabilities**() function 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.

The **efi\_reset\_system**() function requests a reset of the system. The *type* argument may be one of the *enum* *efi\_reset* values:

- 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.

The **efi\_set\_time**() function 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.

The **efi\_var\_get**() function fetches the variable identified by *vendor* and *name*. Returns 0 and populates *attrib*, *datasize*, and *data* on success. Otherwise, one of the following errors are returned:

- 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 retrieved due to an authentication failure.

The **efi\_var\_nextname**() function is used for enumeration of variables. 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 errors:

- 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.

The **efi\_var\_set**() function sets the variable described by *name* and *vendor*. Returns 0 if the variable has been successfully. Otherwise, returns one of the following errors:

- EINVAL

  Either *attrib* was an invalid combination of attributes, *datasize* exceeds the maximum allowed size, or *name* is an empty Unicode stirng.

- 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

[efidev(4)](/efidev/4.md)

## AUTHORS

This manual page was written by Kyle Evans ⟨*kevans@FreeBSD.org*⟩.
