1use core::fmt::Debug;
6
7use super::form_browser::BrowserActionRequest;
8use super::{FormId, QuestionId, StringId};
9use crate::protocol::device_path::DevicePathProtocol;
10use crate::{Boolean, Char16, Guid, Status, guid, newtype_enum};
11
12#[derive(Debug)]
14#[repr(C)]
15pub struct ConfigKeywordHandlerProtocol {
16 pub set_data: unsafe extern "efiapi" fn(
17 this: *mut Self,
18 keyword_string: *const Char16,
19 progress: *mut *const Char16,
20 progress_err: *mut u32,
21 ) -> Status,
22 pub get_data: unsafe extern "efiapi" fn(
23 this: *const Self,
24 namespace_id: *const Char16,
25 keyword_string: *const Char16,
26 progress: *mut *const Char16,
27 progress_err: *mut u32,
28 results: *mut *const Char16,
29 ) -> Status,
30}
31
32impl ConfigKeywordHandlerProtocol {
33 pub const GUID: Guid = guid!("0a8badd5-03b8-4d19-b128-7b8f0edaa596");
34}
35
36newtype_enum! {
37 #[derive(Default)]
39 pub enum BrowserAction: usize => {
40 CHANGING = 0,
44 CHANGED = 1,
47 RETRIEVE = 2,
50 FORM_OPEN = 3,
53 FORM_CLOSE = 4,
56 SUBMITTED = 5,
59 DEFAULT_STANDARD = 0x1000,
61 DEFAULT_MANUFACTURING = 0x1001,
63 DEFAULT_SAFE = 0x1002,
65 DEFAULT_PLATFORM = 0x2000,
67 DEFAULT_HARDWARE = 0x3000,
69 DEFAULT_FIRMWARE = 0x4000,
71 }
72}
73
74#[repr(C)]
75#[derive(Debug, Copy, Clone)]
76pub struct HiiTime {
77 pub hour: u8,
78 pub minute: u8,
79 pub second: u8,
80}
81
82#[repr(C)]
83#[derive(Debug, Copy, Clone)]
84pub struct HiiDate {
85 pub year: u16,
86 pub month: u8,
87 pub day: u8,
88}
89
90#[repr(C)]
91#[derive(Debug, Copy, Clone)]
92pub struct HiiRef {
93 pub question_id: QuestionId,
94 pub form_id: FormId,
95 pub guid: Guid,
96 pub string_id: StringId,
97}
98
99#[repr(C)]
100#[derive(Copy, Clone)]
101pub union IfrTypeValue {
102 pub u8: u8, pub u16: u16, pub u32: u32, pub u64: u64, pub b: Boolean, pub time: HiiTime, pub date: HiiDate, pub string: StringId, pub hii_ref: HiiRef, }
112impl core::fmt::Debug for IfrTypeValue {
113 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
114 f.debug_struct("EfiIfrTypeValue").finish()
115 }
116}
117
118#[derive(Debug)]
120#[repr(C)]
121pub struct HiiConfigAccessProtocol {
122 pub extract_config: unsafe extern "efiapi" fn(
123 this: *const Self,
124 request: *const Char16,
125 progress: *mut *const Char16,
126 results: *mut *const Char16,
127 ) -> Status,
128 pub route_config: unsafe extern "efiapi" fn(
129 this: *const Self,
130 configuration: *const Char16,
131 progress: *mut *const Char16,
132 ) -> Status,
133 pub callback: unsafe extern "efiapi" fn(
134 this: *const Self,
135 action: BrowserAction,
136 question_id: QuestionId,
137 value_type: u8,
138 value: *mut IfrTypeValue,
139 action_request: *mut BrowserActionRequest,
140 ) -> Status,
141}
142
143impl HiiConfigAccessProtocol {
144 pub const GUID: Guid = guid!("330d4706-f2a0-4e4f-a369-b66fa8d54385");
145}
146
147#[derive(Debug)]
149#[repr(C)]
150pub struct HiiConfigRoutingProtocol {
151 pub extract_config: unsafe extern "efiapi" fn(
152 this: *const Self,
153 config_request: *const Char16,
154 progress: *mut *const Char16,
155 results: *mut *const Char16,
156 ) -> Status,
157 pub export_config:
158 unsafe extern "efiapi" fn(this: *const Self, results: *mut *const Char16) -> Status,
159 pub route_config: unsafe extern "efiapi" fn(
160 this: *const Self,
161 configuration: *const Char16,
162 progress: *mut *const Char16,
163 ) -> Status,
164 pub block_to_config: unsafe extern "efiapi" fn(
165 this: *const Self,
166 config_request: *const Char16,
167 block: *const u8,
168 block_size: usize,
169 config: *mut *const Char16,
170 progress: *mut *const Char16,
171 ) -> Status,
172 pub config_to_block: unsafe extern "efiapi" fn(
173 this: *const Self,
174 config_resp: *const Char16,
175 block: *mut *const u8,
176 block_size: *mut usize,
177 progress: *mut *const Char16,
178 ) -> Status,
179 pub get_alt_cfg: unsafe extern "efiapi" fn(
180 this: *const Self,
181 config_resp: *const Char16,
182 guid: *const Guid,
183 name: *const Char16,
184 device_path: *const DevicePathProtocol,
185 alt_cfg_id: *const Char16,
186 alt_cfg_resp: *mut *const Char16,
187 ) -> Status,
188}
189
190impl HiiConfigRoutingProtocol {
191 pub const GUID: Guid = guid!("587e72d7-cc50-4f79-8209-ca291fc1a10f");
192}