Struct uefi::table::runtime::RuntimeServices
source · #[repr(C)]pub struct RuntimeServices(/* private fields */);
Expand description
Contains pointers to all of the runtime services.
This table, and the function pointers it contains are valid even after the UEFI OS loader and OS have taken control of the platform.
§Accessing RuntimeServices
A reference to RuntimeServices
can only be accessed by calling SystemTable::runtime_services
.
Implementations§
source§impl RuntimeServices
impl RuntimeServices
sourcepub fn get_time_and_caps(&self) -> Result<(Time, TimeCapabilities)>
pub fn get_time_and_caps(&self) -> Result<(Time, TimeCapabilities)>
Query the current time and date information and the RTC capabilities
sourcepub unsafe fn set_time(&mut self, time: &Time) -> Result
pub unsafe fn set_time(&mut self, time: &Time) -> Result
Sets the current local time and date information
During runtime, if a PC-AT CMOS device is present in the platform, the
caller must synchronize access to the device before calling set_time
.
§Safety
Undefined behavior could happen if multiple tasks try to use this function at the same time without synchronisation.
sourcepub fn get_variable_size(
&self,
name: &CStr16,
vendor: &VariableVendor
) -> Result<usize>
pub fn get_variable_size( &self, name: &CStr16, vendor: &VariableVendor ) -> Result<usize>
Get the size (in bytes) of a variable. This can be used to find out how
big of a buffer should be passed in to get_variable
.
sourcepub fn get_variable<'a>(
&self,
name: &CStr16,
vendor: &VariableVendor,
buf: &'a mut [u8]
) -> Result<(&'a [u8], VariableAttributes)>
pub fn get_variable<'a>( &self, name: &CStr16, vendor: &VariableVendor, buf: &'a mut [u8] ) -> Result<(&'a [u8], VariableAttributes)>
Get the contents and attributes of a variable. The size of buf
must
be at least as big as the variable’s size, although it can be
larger. If it is too small, BUFFER_TOO_SMALL
is returned.
On success, a tuple containing the variable’s value (a slice of buf
)
and the variable’s attributes is returned.
sourcepub fn get_variable_boxed(
&self,
name: &CStr16,
vendor: &VariableVendor
) -> Result<(Box<[u8]>, VariableAttributes)>
Available on crate feature alloc
only.
pub fn get_variable_boxed( &self, name: &CStr16, vendor: &VariableVendor ) -> Result<(Box<[u8]>, VariableAttributes)>
alloc
only.Get the contents and attributes of a variable.
sourcepub fn variable_keys(&self) -> Result<Vec<VariableKey>>
Available on crate feature alloc
only.
pub fn variable_keys(&self) -> Result<Vec<VariableKey>>
alloc
only.Get the names and vendor GUIDs of all currently-set variables.
sourcepub fn set_variable(
&self,
name: &CStr16,
vendor: &VariableVendor,
attributes: VariableAttributes,
data: &[u8]
) -> Result
pub fn set_variable( &self, name: &CStr16, vendor: &VariableVendor, attributes: VariableAttributes, data: &[u8] ) -> Result
Set the value of a variable. This can be used to create a new variable,
update an existing variable, or (when the size of data
is zero)
delete a variable.
§Warnings
The Status::WARN_RESET_REQUIRED
warning will be returned when using
this function to transition the Secure Boot mode to setup mode or audit
mode if the firmware requires a reboot for that operation.
sourcepub fn delete_variable(&self, name: &CStr16, vendor: &VariableVendor) -> Result
pub fn delete_variable(&self, name: &CStr16, vendor: &VariableVendor) -> Result
Deletes a UEFI variable.
sourcepub fn query_variable_info(
&self,
attributes: VariableAttributes
) -> Result<VariableStorageInfo>
pub fn query_variable_info( &self, attributes: VariableAttributes ) -> Result<VariableStorageInfo>
Get information about UEFI variable storage space for the type
of variable specified in attributes
.
This operation is only supported starting with UEFI 2.0; earlier
versions will fail with Status::UNSUPPORTED
.
See VariableStorageInfo
for details of the information returned.