uefi_raw/table/
runtime.rs1use crate::capsule::CapsuleHeader;
6use crate::table::boot::MemoryDescriptor;
7use crate::table::Header;
8use crate::time::Time;
9use crate::{guid, Char16, Guid, PhysicalAddress, Status};
10use bitflags::bitflags;
11use core::ffi::c_void;
12
13#[derive(Debug)]
18#[repr(C)]
19pub struct RuntimeServices {
20 pub header: Header,
21 pub get_time:
22 unsafe extern "efiapi" fn(time: *mut Time, capabilities: *mut TimeCapabilities) -> Status,
23 pub set_time: unsafe extern "efiapi" fn(time: *const Time) -> Status,
24 pub get_wakeup_time:
25 unsafe extern "efiapi" fn(enabled: *mut u8, pending: *mut u8, time: *mut Time) -> Status,
26 pub set_wakeup_time: unsafe extern "efiapi" fn(enable: u8, time: *const Time) -> Status,
27 pub set_virtual_address_map: unsafe extern "efiapi" fn(
28 map_size: usize,
29 desc_size: usize,
30 desc_version: u32,
31 virtual_map: *mut MemoryDescriptor,
32 ) -> Status,
33 pub convert_pointer:
34 unsafe extern "efiapi" fn(debug_disposition: usize, address: *mut *const c_void) -> Status,
35 pub get_variable: unsafe extern "efiapi" fn(
36 variable_name: *const Char16,
37 vendor_guid: *const Guid,
38 attributes: *mut VariableAttributes,
39 data_size: *mut usize,
40 data: *mut u8,
41 ) -> Status,
42 pub get_next_variable_name: unsafe extern "efiapi" fn(
43 variable_name_size: *mut usize,
44 variable_name: *mut u16,
45 vendor_guid: *mut Guid,
46 ) -> Status,
47 pub set_variable: unsafe extern "efiapi" fn(
48 variable_name: *const Char16,
49 vendor_guid: *const Guid,
50 attributes: VariableAttributes,
51 data_size: usize,
52 data: *const u8,
53 ) -> Status,
54 pub get_next_high_monotonic_count: unsafe extern "efiapi" fn(high_count: *mut u32) -> Status,
55 pub reset_system: unsafe extern "efiapi" fn(
56 rt: ResetType,
57 status: Status,
58 data_size: usize,
59 data: *const u8,
60 ) -> !,
61
62 pub update_capsule: unsafe extern "efiapi" fn(
64 capsule_header_array: *const *const CapsuleHeader,
65 capsule_count: usize,
66 scatter_gather_list: PhysicalAddress,
67 ) -> Status,
68 pub query_capsule_capabilities: unsafe extern "efiapi" fn(
69 capsule_header_array: *const *const CapsuleHeader,
70 capsule_count: usize,
71 maximum_capsule_size: *mut u64,
72 reset_type: *mut ResetType,
73 ) -> Status,
74
75 pub query_variable_info: unsafe extern "efiapi" fn(
77 attributes: VariableAttributes,
78 maximum_variable_storage_size: *mut u64,
79 remaining_variable_storage_size: *mut u64,
80 maximum_variable_size: *mut u64,
81 ) -> Status,
82}
83
84newtype_enum! {
85 #[derive(Default)]
86 pub enum ResetType: u32 => {
88 COLD = 0,
92
93 WARM = 1,
98
99 SHUTDOWN = 2,
101
102 PLATFORM_SPECIFIC = 3,
104 }
105}
106
107#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
109#[repr(C)]
110pub struct TimeCapabilities {
111 pub resolution: u32,
114
115 pub accuracy: u32,
117
118 pub sets_to_zero: bool,
121}
122
123bitflags! {
124 #[repr(transparent)]
126 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
127 pub struct VariableAttributes: u32 {
128 const NON_VOLATILE = 0x01;
130
131 const BOOTSERVICE_ACCESS = 0x02;
134
135 const RUNTIME_ACCESS = 0x04;
138
139 const HARDWARE_ERROR_RECORD = 0x08;
142
143 const AUTHENTICATED_WRITE_ACCESS = 0x10;
145
146 const TIME_BASED_AUTHENTICATED_WRITE_ACCESS = 0x20;
149
150 const APPEND_WRITE = 0x40;
155
156 const ENHANCED_AUTHENTICATED_ACCESS = 0x80;
159 }
160}
161
162newtype_enum! {
163 pub enum VariableVendor: Guid => {
167 GLOBAL_VARIABLE = guid!("8be4df61-93ca-11d2-aa0d-00e098032b8c"),
169
170 IMAGE_SECURITY_DATABASE = guid!("d719b2cb-3d3a-4596-a3bc-dad00e67656f"),
172 }
173}