|
1 | 1 | //! UEFI services available at runtime, even after the OS boots.
|
2 | 2 |
|
3 |
| -use crate::{guid, Guid}; |
| 3 | +use crate::capsule::CapsuleHeader; |
| 4 | +use crate::table::boot::MemoryDescriptor; |
| 5 | +use crate::table::Header; |
| 6 | +use crate::time::Time; |
| 7 | +use crate::{guid, Char16, Guid, PhysicalAddress, Status}; |
4 | 8 | use bitflags::bitflags;
|
| 9 | +use core::ffi::c_void; |
| 10 | + |
| 11 | +/// Table of pointers to all the runtime services. |
| 12 | +/// |
| 13 | +/// This table, and the function pointers it contains are valid even after the |
| 14 | +/// UEFI OS loader and OS have taken control of the platform. |
| 15 | +#[repr(C)] |
| 16 | +pub struct RuntimeServices { |
| 17 | + pub header: Header, |
| 18 | + pub get_time: |
| 19 | + unsafe extern "efiapi" fn(time: *mut Time, capabilities: *mut TimeCapabilities) -> Status, |
| 20 | + pub set_time: unsafe extern "efiapi" fn(time: *const Time) -> Status, |
| 21 | + pub get_wakeup_time: |
| 22 | + unsafe extern "efiapi" fn(enabled: *mut u8, pending: *mut u8, time: *mut Time) -> Status, |
| 23 | + pub set_wakeup_time: unsafe extern "efiapi" fn(enable: u8, time: *const Time) -> Status, |
| 24 | + pub set_virtual_address_map: unsafe extern "efiapi" fn( |
| 25 | + map_size: usize, |
| 26 | + desc_size: usize, |
| 27 | + desc_version: u32, |
| 28 | + virtual_map: *mut MemoryDescriptor, |
| 29 | + ) -> Status, |
| 30 | + pub convert_pointer: |
| 31 | + unsafe extern "efiapi" fn(debug_disposition: usize, address: *mut *const c_void) -> Status, |
| 32 | + pub get_variable: unsafe extern "efiapi" fn( |
| 33 | + variable_name: *const Char16, |
| 34 | + vendor_guid: *const Guid, |
| 35 | + attributes: *mut VariableAttributes, |
| 36 | + data_size: *mut usize, |
| 37 | + data: *mut u8, |
| 38 | + ) -> Status, |
| 39 | + pub get_next_variable_name: unsafe extern "efiapi" fn( |
| 40 | + variable_name_size: *mut usize, |
| 41 | + variable_name: *mut u16, |
| 42 | + vendor_guid: *mut Guid, |
| 43 | + ) -> Status, |
| 44 | + pub set_variable: unsafe extern "efiapi" fn( |
| 45 | + variable_name: *const Char16, |
| 46 | + vendor_guid: *const Guid, |
| 47 | + attributes: VariableAttributes, |
| 48 | + data_size: usize, |
| 49 | + data: *const u8, |
| 50 | + ) -> Status, |
| 51 | + pub get_next_high_monotonic_count: unsafe extern "efiapi" fn(high_count: *mut u32) -> Status, |
| 52 | + pub reset_system: unsafe extern "efiapi" fn( |
| 53 | + rt: ResetType, |
| 54 | + status: Status, |
| 55 | + data_size: usize, |
| 56 | + data: *const u8, |
| 57 | + ) -> !, |
| 58 | + |
| 59 | + // UEFI 2.0 Capsule Services. |
| 60 | + pub update_capsule: unsafe extern "efiapi" fn( |
| 61 | + capsule_header_array: *const *const CapsuleHeader, |
| 62 | + capsule_count: usize, |
| 63 | + scatter_gather_list: PhysicalAddress, |
| 64 | + ) -> Status, |
| 65 | + pub query_capsule_capabilities: unsafe extern "efiapi" fn( |
| 66 | + capsule_header_array: *const *const CapsuleHeader, |
| 67 | + capsule_count: usize, |
| 68 | + maximum_capsule_size: *mut usize, |
| 69 | + reset_type: *mut ResetType, |
| 70 | + ) -> Status, |
| 71 | + |
| 72 | + // Miscellaneous UEFI 2.0 Service. |
| 73 | + pub query_variable_info: unsafe extern "efiapi" fn( |
| 74 | + attributes: VariableAttributes, |
| 75 | + maximum_variable_storage_size: *mut u64, |
| 76 | + remaining_variable_storage_size: *mut u64, |
| 77 | + maximum_variable_size: *mut u64, |
| 78 | + ) -> Status, |
| 79 | +} |
5 | 80 |
|
6 | 81 | newtype_enum! {
|
7 | 82 | /// The type of system reset.
|
|
0 commit comments