uefi_raw/protocol/
misc.rs

1use crate::table::runtime;
2use crate::{guid, Guid, Status};
3
4#[derive(Debug)]
5#[repr(C)]
6pub struct TimestampProtocol {
7    pub get_timestamp: unsafe extern "efiapi" fn() -> u64,
8    pub get_properties: unsafe extern "efiapi" fn(*mut TimestampProperties) -> Status,
9}
10
11impl TimestampProtocol {
12    pub const GUID: Guid = guid!("afbfde41-2e6e-4262-ba65-62b9236e5495");
13}
14
15/// Properties of the timestamp counter.
16#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
17#[repr(C)]
18pub struct TimestampProperties {
19    /// Timestamp counter frequency, in Hz.
20    pub frequency: u64,
21
22    /// The maximum value of the timestamp counter before it rolls over. For
23    /// example, a 24-bit counter would have an end value of `0xff_ffff`.
24    pub end_value: u64,
25}
26
27/// Properties of Reset Notification.
28#[derive(Debug)]
29#[repr(C)]
30pub struct ResetNotificationProtocol {
31    pub register_reset_notify:
32        unsafe extern "efiapi" fn(this: *mut Self, reset_function: ResetSystemFn) -> Status,
33    pub unregister_reset_notify:
34        unsafe extern "efiapi" fn(this: *mut Self, reset_function: ResetSystemFn) -> Status,
35}
36
37impl ResetNotificationProtocol {
38    pub const GUID: Guid = guid!("9da34ae0-eaf9-4bbf-8ec3-fd60226c44be");
39}
40
41/// Raw reset notification function, to be called if you register it when a ResetSystem() is executed.
42pub type ResetSystemFn = unsafe extern "efiapi" fn(
43    rt: runtime::ResetType,
44    status: Status,
45    data_size: usize,
46    data: *const u8,
47);