1use core::fmt::Debug;
6
7use crate::protocol::device_path::DevicePathProtocol;
8use crate::{Char16, Guid, Status, guid, newtype_enum};
9
10#[derive(Debug)]
12#[repr(C)]
13pub struct ConfigKeywordHandlerProtocol {
14 pub set_data: unsafe extern "efiapi" fn(
15 this: *mut Self,
16 keyword_string: *const Char16,
17 progress: *mut *const Char16,
18 progress_err: *mut u32,
19 ) -> Status,
20 pub get_data: unsafe extern "efiapi" fn(
21 this: *const Self,
22 namespace_id: *const Char16,
23 keyword_string: *const Char16,
24 progress: *mut *const Char16,
25 progress_err: *mut u32,
26 results: *mut *const Char16,
27 ) -> Status,
28}
29
30impl ConfigKeywordHandlerProtocol {
31 pub const GUID: Guid = guid!("0a8badd5-03b8-4d19-b128-7b8f0edaa596");
32}
33
34newtype_enum! {
35 #[derive(Default)]
37 pub enum BrowserAction: usize => {
38 CHANGING = 0,
42 CHANGED = 1,
45 RETRIEVE = 2,
48 FORM_OPEN = 3,
51 FORM_CLOSE = 4,
54 SUBMITTED = 5,
57 DEFAULT_STANDARD = 0x1000,
59 DEFAULT_MANUFACTURING = 0x1001,
61 DEFAULT_SAFE = 0x1002,
63 DEFAULT_PLATFORM = 0x2000,
65 DEFAULT_HARDWARE = 0x3000,
67 DEFAULT_FIRMWARE = 0x4000,
69 }
70}
71
72newtype_enum! {
73 #[derive(Default)]
75 pub enum BrowserActionRequest: usize => {
76 NONE = 0,
78 RESET = 1,
80 SUBMIT = 2,
82 EXIT = 3,
84 FORM_SUBMIT_EXIT = 4,
86 FORM_DISCARD_EXIT = 5,
88 FORM_APPLY = 6,
90 FORM_DISCARD = 7,
92 RECONNECT = 8,
95 QUESTION_APPLY = 9,
97 }
98}
99
100#[repr(C)]
101#[derive(Debug, Copy, Clone)]
102pub struct HiiTime {
103 pub hour: u8,
104 pub minute: u8,
105 pub second: u8,
106}
107
108#[repr(C)]
109#[derive(Debug, Copy, Clone)]
110pub struct HiiDate {
111 pub year: u16,
112 pub month: u8,
113 pub day: u8,
114}
115
116#[repr(C)]
117#[derive(Debug, Copy, Clone)]
118pub struct HiiRef {
119 pub question_id: QuestionId,
120 pub form_id: FormId,
121 pub guid: Guid,
122 pub string_id: StringId,
123}
124
125#[repr(C)]
126#[derive(Copy, Clone)]
127pub union IfrTypeValue {
128 pub u8: u8, pub u16: u16, pub u32: u32, pub u64: u64, pub b: bool, pub time: HiiTime, pub date: HiiDate, pub string: StringId, pub hii_ref: HiiRef, }
138impl core::fmt::Debug for IfrTypeValue {
139 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
140 f.debug_struct("EfiIfrTypeValue").finish()
141 }
142}
143
144pub type QuestionId = u16;
145pub type FormId = u16;
146pub type StringId = u16;
147
148#[derive(Debug)]
150#[repr(C)]
151pub struct HiiConfigAccessProtocol {
152 pub extract_config: unsafe extern "efiapi" fn(
153 this: *const Self,
154 request: *const Char16,
155 progress: *mut *const Char16,
156 results: *mut *const Char16,
157 ) -> Status,
158 pub route_config: unsafe extern "efiapi" fn(
159 this: *const Self,
160 configuration: *const Char16,
161 progress: *mut *const Char16,
162 ) -> Status,
163 pub callback: unsafe extern "efiapi" fn(
164 this: *const Self,
165 action: BrowserAction,
166 question_id: QuestionId,
167 value_type: u8,
168 value: *mut IfrTypeValue,
169 action_request: *mut BrowserActionRequest,
170 ) -> Status,
171}
172
173impl HiiConfigAccessProtocol {
174 pub const GUID: Guid = guid!("330d4706-f2a0-4e4f-a369-b66fa8d54385");
175}
176
177#[derive(Debug)]
179#[repr(C)]
180pub struct HiiConfigRoutingProtocol {
181 pub extract_config: unsafe extern "efiapi" fn(
182 this: *const Self,
183 config_request: *const Char16,
184 progress: *mut *const Char16,
185 results: *mut *const Char16,
186 ) -> Status,
187 pub export_config:
188 unsafe extern "efiapi" fn(this: *const Self, results: *mut *const Char16) -> Status,
189 pub route_config: unsafe extern "efiapi" fn(
190 this: *const Self,
191 configuration: *const Char16,
192 progress: *mut *const Char16,
193 ) -> Status,
194 pub block_to_config: unsafe extern "efiapi" fn(
195 this: *const Self,
196 config_request: *const Char16,
197 block: *const u8,
198 block_size: usize,
199 config: *mut *const Char16,
200 progress: *mut *const Char16,
201 ) -> Status,
202 pub config_to_block: unsafe extern "efiapi" fn(
203 this: *const Self,
204 config_resp: *const Char16,
205 block: *mut *const u8,
206 block_size: *mut usize,
207 progress: *mut *const Char16,
208 ) -> Status,
209 pub get_alt_cfg: unsafe extern "efiapi" fn(
210 this: *const Self,
211 config_resp: *const Char16,
212 guid: *const Guid,
213 name: *const Char16,
214 device_path: *const DevicePathProtocol,
215 alt_cfg_id: *const Char16,
216 alt_cfg_resp: *mut *const Char16,
217 ) -> Status,
218}
219
220impl HiiConfigRoutingProtocol {
221 pub const GUID: Guid = guid!("587e72d7-cc50-4f79-8209-ca291fc1a10f");
222}