|
| 1 | +// SPDX-License-Identifier: MIT OR Apache-2.0 |
| 2 | + |
| 3 | +//! Bindings for HII protocols relating to system configuration. |
| 4 | +
|
| 5 | +use core::fmt::Debug; |
| 6 | + |
| 7 | +usecrate::{Char16,Guid,Status, guid}; |
| 8 | + |
| 9 | +/// EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL |
| 10 | +#[derive(Debug)] |
| 11 | +#[repr(C)] |
| 12 | +pubstructConfigKeywordHandlerProtocol{ |
| 13 | +pubset_data:unsafeextern"efiapi"fn( |
| 14 | +this:*mutSelf, |
| 15 | +keyword_string:*constChar16, |
| 16 | +progress:*mut*constChar16, |
| 17 | +progress_err:*mutu32, |
| 18 | +) ->Status, |
| 19 | +pubget_data:unsafeextern"efiapi"fn( |
| 20 | +this:*constSelf, |
| 21 | +namespace_id:*constChar16, |
| 22 | +keyword_string:*constChar16, |
| 23 | +progress:*mut*constChar16, |
| 24 | +progress_err:*mutu32, |
| 25 | +results:*mut*constChar16, |
| 26 | +) ->Status, |
| 27 | +} |
| 28 | + |
| 29 | +implConfigKeywordHandlerProtocol{ |
| 30 | +pubconstGUID:Guid =guid!("0a8badd5-03b8-4d19-b128-7b8f0edaa596"); |
| 31 | +} |
| 32 | + |
| 33 | +newtype_enum!{ |
| 34 | +/// Type of action taken by the form browser |
| 35 | + #[derive(Default)] |
| 36 | +pubenumBrowserAction:usize =>{ |
| 37 | +/// Called before the browser changes the value in the display (for questions which have a value) |
| 38 | +/// or takes an action (in the case of an action button or cross-reference). |
| 39 | +/// If EFI_SUCCESS is returned, the browser uses the value returned by Callback(). |
| 40 | +CHANGING =0, |
| 41 | +/// Called after the browser has changed its internal copy of the question value and displayed it (if appropriate). |
| 42 | +/// For action buttons, this is called after processing. Errors are ignored. |
| 43 | +CHANGED =1, |
| 44 | +/// Called after the browser has read the current question value but before displaying it. |
| 45 | +/// If EFI_SUCCESS is returned, the updated value is used. |
| 46 | +RETRIEVE =2, |
| 47 | +/// Called for each question on a form prior to its value being retrieved or displayed. |
| 48 | +/// If a question appears on more than one form, this may be called more than once. |
| 49 | +FORM_OPEN =3, |
| 50 | +/// Called for each question on a form after processing any submit actions for that form. |
| 51 | +/// If a question appears on multiple forms, this will be called more than once. |
| 52 | +FORM_CLOSE =4, |
| 53 | +/// Called after the browser submits the modified question value. |
| 54 | +/// ActionRequest is ignored. |
| 55 | +SUBMITTED =5, |
| 56 | +/// Represents the standard default action, selecting a default value based on lower-priority methods. |
| 57 | +DEFAULT_STANDARD =0x1000, |
| 58 | +/// Represents the manufacturing default action, selecting a default value relevant to manufacturing. |
| 59 | +DEFAULT_MANUFACTURING =0x1001, |
| 60 | +/// Represents the safe default action, selecting the safest possible default value. |
| 61 | +DEFAULT_SAFE =0x1002, |
| 62 | +/// Represents platform-defined default values within a range of possible store identifiers. |
| 63 | +DEFAULT_PLATFORM =0x2000, |
| 64 | +/// Represents hardware-defined default values within a range of possible store identifiers. |
| 65 | +DEFAULT_HARDWARE =0x3000, |
| 66 | +/// Represents firmware-defined default values within a range of possible store identifiers. |
| 67 | +DEFAULT_FIRMWARE =0x4000, |
| 68 | +} |
| 69 | +} |
| 70 | + |
| 71 | +newtype_enum!{ |
| 72 | +/// Represents actions requested by the Forms Browser in response to user interactions. |
| 73 | + #[derive(Default)] |
| 74 | +pubenumBrowserActionRequest:usize =>{ |
| 75 | +/// No special behavior is taken by the Forms Browser. |
| 76 | +NONE =0, |
| 77 | +/// The Forms Browser will exit and request the platform to reset. |
| 78 | +RESET =1, |
| 79 | +/// The Forms Browser will save all modified question values to storage and exit. |
| 80 | +SUBMIT =2, |
| 81 | +/// The Forms Browser will discard all modified question values and exit. |
| 82 | +EXIT =3, |
| 83 | +/// The Forms Browser will write all modified question values on the selected form to storage and exit the form. |
| 84 | +FORM_SUBMIT_EXIT =4, |
| 85 | +/// The Forms Browser will discard the modified question values on the selected form and exit the form. |
| 86 | +FORM_DISCARD_EXIT =5, |
| 87 | +/// The Forms Browser will write all modified current question values on the selected form to storage. |
| 88 | +FORM_APPLY =6, |
| 89 | +/// The Forms Browser will discard the current question values on the selected form and replace them with the original values. |
| 90 | +FORM_DISCARD =7, |
| 91 | +/// The user performed a hardware or software configuration change, requiring controller reconnection. |
| 92 | +/// The Forms Browser calls `DisconnectController()` followed by `ConnectController()`. |
| 93 | +RECONNECT =8, |
| 94 | +/// The Forms Browser will write the current modified question value on the selected form to storage. |
| 95 | +QUESTION_APPLY =9, |
| 96 | +} |
| 97 | +} |
| 98 | + |
| 99 | +#[repr(C)] |
| 100 | +#[derive(Debug,Copy,Clone)] |
| 101 | +pubstructHiiTime{ |
| 102 | +pubhour:u8, |
| 103 | +pubminute:u8, |
| 104 | +pubsecond:u8, |
| 105 | +} |
| 106 | + |
| 107 | +#[repr(C)] |
| 108 | +#[derive(Debug,Copy,Clone)] |
| 109 | +pubstructHiiDate{ |
| 110 | +pubyear:u16, |
| 111 | +pubmonth:u8, |
| 112 | +pubday:u8, |
| 113 | +} |
| 114 | + |
| 115 | +#[repr(C)] |
| 116 | +#[derive(Debug,Copy,Clone)] |
| 117 | +pubstructHiiRef{ |
| 118 | +pubquestion_id:QuestionId, |
| 119 | +pubform_id:FormId, |
| 120 | +pubguid:Guid, |
| 121 | +pubstring_id:StringId, |
| 122 | +} |
| 123 | + |
| 124 | +#[repr(C)] |
| 125 | +#[derive(Copy,Clone)] |
| 126 | +pubunionIfrTypeValue{ |
| 127 | +pubu8:u8,// EFI_IFR_TYPE_NUM_SIZE_8 |
| 128 | +pubu16:u16,// EFI_IFR_TYPE_NUM_SIZE_16 |
| 129 | +pubu32:u32,// EFI_IFR_TYPE_NUM_SIZE_32 |
| 130 | +pubu64:u64,// EFI_IFR_TYPE_NUM_SIZE_64 |
| 131 | +pubb:bool,// EFI_IFR_TYPE_BOOLEAN |
| 132 | +pubtime:HiiTime,// EFI_IFR_TYPE_TIME |
| 133 | +pubdate:HiiDate,// EFI_IFR_TYPE_DATE |
| 134 | +pubstring:StringId,// EFI_IFR_TYPE_STRING, EFI_IFR_TYPE_ACTION |
| 135 | +pubhii_ref:HiiRef,// EFI_IFR_TYPE_REF |
| 136 | +} |
| 137 | +impl core::fmt::DebugforIfrTypeValue{ |
| 138 | +fnfmt(&self,f:&mut core::fmt::Formatter<'_>) -> core::fmt::Result{ |
| 139 | + f.debug_struct("EfiIfrTypeValue").finish() |
| 140 | +} |
| 141 | +} |
| 142 | + |
| 143 | +pubtypeQuestionId =u16; |
| 144 | +pubtypeFormId =u16; |
| 145 | +pubtypeStringId =u16; |
| 146 | + |
| 147 | +/// EFI_HII_CONFIG_ACCESS_PROTOCOL |
| 148 | +#[derive(Debug)] |
| 149 | +#[repr(C)] |
| 150 | +pubstructHiiConfigAccessProtocol{ |
| 151 | +pubextract_config:unsafeextern"efiapi"fn( |
| 152 | +this:*constSelf, |
| 153 | +request:*constChar16, |
| 154 | +progress:*mut*constChar16, |
| 155 | +results:*mut*constChar16, |
| 156 | +) ->Status, |
| 157 | +pubroute_config:unsafeextern"efiapi"fn( |
| 158 | +this:*constSelf, |
| 159 | +configuration:*constChar16, |
| 160 | +progress:*mut*constChar16, |
| 161 | +) ->Status, |
| 162 | +pubcallback:unsafeextern"efiapi"fn( |
| 163 | +this:*constSelf, |
| 164 | +action:BrowserAction, |
| 165 | +question_id:QuestionId, |
| 166 | +value_type:u8, |
| 167 | +value:*mutIfrTypeValue, |
| 168 | +action_request:*mutBrowserActionRequest, |
| 169 | +) ->Status, |
| 170 | +} |
| 171 | + |
| 172 | +implHiiConfigAccessProtocol{ |
| 173 | +pubconstGUID:Guid =guid!("330d4706-f2a0-4e4f-a369-b66fa8d54385"); |
| 174 | +} |