uefi_raw/protocol/
misc.rs

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