Skip to main content

uefi_raw/protocol/hii/
form_browser.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3//! Form Browser protocol
4
5use super::{FormId, HiiHandle};
6use crate::{Boolean, Char16, Guid, Status, guid, newtype_enum};
7
8/// EFI_SCREEN_DESCRIPTOR
9#[derive(Debug)]
10#[repr(C)]
11pub struct ScreenDescriptor {
12    pub left_column: usize,
13    pub right_column: usize,
14    pub top_row: usize,
15    pub bottom_row: usize,
16}
17
18newtype_enum! {
19    /// Represents actions requested by the Forms Browser in response to user interactions.
20    #[derive(Default)]
21    pub enum BrowserActionRequest: usize => {
22        /// No special behavior is taken by the Forms Browser.
23        NONE = 0,
24        /// The Forms Browser will exit and request the platform to reset.
25        RESET = 1,
26        /// The Forms Browser will save all modified question values to storage and exit.
27        SUBMIT = 2,
28        /// The Forms Browser will discard all modified question values and exit.
29        EXIT = 3,
30        /// The Forms Browser will write all modified question values on the selected form to storage and exit the form.
31        FORM_SUBMIT_EXIT = 4,
32        /// The Forms Browser will discard the modified question values on the selected form and exit the form.
33        FORM_DISCARD_EXIT = 5,
34        /// The Forms Browser will write all modified current question values on the selected form to storage.
35        FORM_APPLY = 6,
36        /// The Forms Browser will discard the current question values on the selected form and replace them with the original values.
37        FORM_DISCARD = 7,
38        /// The user performed a hardware or software configuration change, requiring controller reconnection.
39        /// The Forms Browser calls `DisconnectController()` followed by `ConnectController()`.
40        RECONNECT = 8,
41        /// The Forms Browser will write the current modified question value on the selected form to storage.
42        QUESTION_APPLY = 9,
43    }
44}
45
46/// EFI_FORM_BROWSER2_PROTOCOL
47#[derive(Debug)]
48#[repr(C)]
49pub struct FormBrowser2Protocol {
50    pub send_form: unsafe extern "efiapi" fn(
51        this: *const Self,
52        handles: *const HiiHandle,
53        handle_count: usize,
54        formset_guid: *const Guid,
55        form_id: FormId,
56        screen_dimensions: *const ScreenDescriptor,
57        action_request: *mut BrowserActionRequest,
58    ) -> Status,
59    pub browser_callback: unsafe extern "efiapi" fn(
60        this: *const Self,
61        results_data_size: *mut usize,
62        results_data: *mut Char16,
63        retrieve_data: Boolean,
64        variable_guid: *const Guid,
65        variable_name: *const Char16,
66    ) -> Status,
67}
68
69impl FormBrowser2Protocol {
70    pub const GUID: Guid = guid!("b9d4c360-bcfb-4f9b-9298-53c136982258");
71}