]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Application/UiApp/FrontPage.h
UiApp code split from IntelFrameworkModulePkg/Universal/BdsDxe driver.
[mirror_edk2.git] / MdeModulePkg / Application / UiApp / FrontPage.h
1 /** @file
2 FrontPage routines to handle the callbacks and browser calls
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _FRONT_PAGE_H_
16 #define _FRONT_PAGE_H_
17
18 #include "DeviceMngr/DeviceManager.h"
19 #include "BootMaint/BootMaint.h"
20 #include "BootMngr/BootManager.h"
21 #include "String.h"
22
23 #include <Protocol/BootLogo.h>
24 //
25 // These are the VFR compiler generated data representing our VFR data.
26 //
27 extern UINT8 FrontPageVfrBin[];
28
29 extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
30
31 extern BOOLEAN gConnectAllHappened;
32
33 #define SMBIOS_TYPE4_CPU_SOCKET_POPULATED BIT6
34
35 ///
36 /// The size of a 3 character ISO639 language code.
37 ///
38 #define ISO_639_2_ENTRY_SIZE 3
39
40 //
41 // This is the VFR compiler generated header file which defines the
42 // string identifiers.
43 //
44 #define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
45
46 //
47 // These are defined as the same with vfr file
48 //
49 #define FRONT_PAGE_FORM_ID 0x1000
50 #define INVALID_FORM_ID 0x0FFF
51
52 #define FRONT_PAGE_KEY_SECTION 0x1000
53 #define FRONT_PAGE_KEY_OFFSET 0x4000
54 #define FRONT_PAGE_KEY_CONTINUE 0x1000
55 #define FRONT_PAGE_KEY_LANGUAGE 0x1234
56 #define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064
57 #define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567
58 #define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876
59 #define FRONT_PAGE_KEY_RESET 0X7654
60
61 #define LABEL_SELECT_LANGUAGE 0x1000
62 #define LABEL_PLATFORM_INFORMATION 0x1001
63 #define LABEL_END 0xffff
64
65 #define FRONT_PAGE_FORMSET_GUID \
66 { \
67 0x9e0c30bc, 0x3f06, 0x4ba6, {0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe} \
68 }
69
70 #define FRONT_PAGE_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('F', 'P', 'C', 'B')
71
72 typedef struct {
73 UINTN Signature;
74
75 //
76 // HII relative handles
77 //
78 EFI_HII_HANDLE HiiHandle;
79 EFI_HANDLE DriverHandle;
80 EFI_STRING_ID *LanguageToken;
81
82 //
83 // Produced protocols
84 //
85 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
86 } FRONT_PAGE_CALLBACK_DATA;
87
88
89 #define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
90 CR (a, \
91 FRONT_PAGE_CALLBACK_DATA, \
92 ConfigAccess, \
93 FRONT_PAGE_CALLBACK_DATA_SIGNATURE \
94 )
95
96 /**
97 This function allows a caller to extract the current configuration for one
98 or more named elements from the target driver.
99
100
101 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
102 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
103 @param Progress - On return, points to a character in the Request string.
104 Points to the string's null terminator if request was successful.
105 Points to the most recent '&' before the first failing name/value
106 pair (or the beginning of the string if the failure is in the
107 first name/value pair) if the request was not successful.
108 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
109 has all values filled in for the names in the Request string.
110 String to be allocated by the called function.
111
112 @retval EFI_SUCCESS The Results is filled with the requested values.
113 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
114 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
115 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
116
117 **/
118 EFI_STATUS
119 EFIAPI
120 FakeExtractConfig (
121 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
122 IN CONST EFI_STRING Request,
123 OUT EFI_STRING *Progress,
124 OUT EFI_STRING *Results
125 );
126
127 /**
128 This function processes the results of changes in configuration.
129
130
131 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
132 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
133 @param Progress - A pointer to a string filled in with the offset of the most
134 recent '&' before the first failing name/value pair (or the
135 beginning of the string if the failure is in the first
136 name/value pair) or the terminating NULL if all was successful.
137
138 @retval EFI_SUCCESS The Results is processed successfully.
139 @retval EFI_INVALID_PARAMETER Configuration is NULL.
140 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
141
142 **/
143 EFI_STATUS
144 EFIAPI
145 FakeRouteConfig (
146 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
147 IN CONST EFI_STRING Configuration,
148 OUT EFI_STRING *Progress
149 );
150
151 /**
152 This function processes the results of changes in configuration.
153
154
155 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
156 @param Action - Specifies the type of action taken by the browser.
157 @param QuestionId - A unique value which is sent to the original exporting driver
158 so that it can identify the type of data to expect.
159 @param Type - The type of value for the question.
160 @param Value - A pointer to the data being sent to the original exporting driver.
161 @param ActionRequest - On return, points to the action requested by the callback function.
162
163 @retval EFI_SUCCESS The callback successfully handled the action.
164 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
165 @retval EFI_DEVICE_ERROR The variable could not be saved.
166 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
167
168 **/
169 EFI_STATUS
170 EFIAPI
171 FrontPageCallback (
172 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
173 IN EFI_BROWSER_ACTION Action,
174 IN EFI_QUESTION_ID QuestionId,
175 IN UINT8 Type,
176 IN EFI_IFR_TYPE_VALUE *Value,
177 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
178 );
179
180 /**
181 Initialize HII information for the FrontPage
182
183 @retval EFI_SUCCESS The operation is successful.
184 @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed.
185
186 **/
187 EFI_STATUS
188 InitializeFrontPage (
189 VOID
190 );
191
192 /**
193 Acquire the string associated with the ProducerGuid and return it.
194
195
196 @param ProducerGuid - The Guid to search the HII database for
197 @param Token - The token value of the string to extract
198 @param String - The string that is extracted
199
200 @retval EFI_SUCCESS The function returns EFI_SUCCESS always.
201
202 **/
203 EFI_STATUS
204 GetProducerString (
205 IN EFI_GUID *ProducerGuid,
206 IN EFI_STRING_ID Token,
207 OUT CHAR16 **String
208 );
209
210 /**
211 This function is the main entry of the UI entry.
212 The function will present the main menu of the system UI.
213
214 @param ConnectAllHappened Caller passes the value to UI to avoid unnecessary connect-all.
215
216 **/
217 VOID
218 EFIAPI
219 UiEntry (
220 IN BOOLEAN ConnectAllHappened
221 );
222
223 /**
224 Extract the displayed formset for given HII handle and class guid.
225
226 @param Handle The HII handle.
227 @param SetupClassGuid The class guid specifies which form set will be displayed.
228 @param SkipCount Skip some formsets which has processed before.
229 @param FormSetTitle Formset title string.
230 @param FormSetHelp Formset help string.
231 @param FormSetGuid Formset Guid.
232
233 @retval TRUE The formset for given HII handle will be displayed.
234 @return FALSE The formset for given HII handle will not be displayed.
235
236 **/
237 BOOLEAN
238 ExtractDisplayedHiiFormFromHiiHandle (
239 IN EFI_HII_HANDLE Handle,
240 IN EFI_GUID *SetupClassGuid,
241 IN UINTN SkipCount,
242 OUT EFI_STRING_ID *FormSetTitle,
243 OUT EFI_STRING_ID *FormSetHelp,
244 OUT EFI_GUID *FormSetGuid
245 );
246
247 /**
248 Extract device path for given HII handle and class guid.
249
250 @param Handle The HII handle.
251
252 @retval NULL Fail to get the device path string.
253 @return PathString Get the device path string.
254
255 **/
256 CHAR16 *
257 ExtractDevicePathFromHiiHandle (
258 IN EFI_HII_HANDLE Handle
259 );
260
261 /**
262 This function will change video resolution and text mode
263 according to defined setup mode or defined boot mode
264
265 @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
266
267 @retval EFI_SUCCESS Mode is changed successfully.
268 @retval Others Mode failed to be changed.
269
270 **/
271 EFI_STATUS
272 EFIAPI
273 BdsSetConsoleMode (
274 BOOLEAN IsSetupMode
275 );
276
277 #endif // _FRONT_PAGE_H_
278