]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
998ad1ff33bdec88b20d36227a14712602d26491
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / FrontPage.h
1 /** @file
2 FrontPage routines to handle the callbacks and browser calls
3
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. 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 #define ONE_SECOND 10000000
24
25 ///
26 /// The size of a 3 character ISO639 language code.
27 ///
28 #define ISO_639_2_ENTRY_SIZE 3
29
30 //
31 // This is the VFR compiler generated header file which defines the
32 // string identifiers.
33 //
34 #define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
35
36 //
37 // These are defined as the same with vfr file
38 //
39 #define FRONT_PAGE_FORM_ID 0x1000
40
41 #define FRONT_PAGE_KEY_CONTINUE 0x1000
42 #define FRONT_PAGE_KEY_LANGUAGE 0x1234
43 #define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064
44 #define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567
45 #define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876
46
47 #define LABEL_SELECT_LANGUAGE 0x1000
48 #define LABEL_END 0xffff
49
50 #define FRONT_PAGE_FORMSET_GUID \
51 { \
52 0x9e0c30bc, 0x3f06, 0x4ba6, {0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe} \
53 }
54
55 #define FRONT_PAGE_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('F', 'P', 'C', 'B')
56
57 typedef struct {
58 UINTN Signature;
59
60 //
61 // HII relative handles
62 //
63 EFI_HII_HANDLE HiiHandle;
64 EFI_HANDLE DriverHandle;
65 EFI_STRING_ID *LanguageToken;
66
67 //
68 // Produced protocols
69 //
70 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
71 } FRONT_PAGE_CALLBACK_DATA;
72
73 #define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
74 CR (a, \
75 FRONT_PAGE_CALLBACK_DATA, \
76 ConfigAccess, \
77 FRONT_PAGE_CALLBACK_DATA_SIGNATURE \
78 )
79
80 //
81 // These are the VFR compiler generated data representing our VFR data.
82 //
83 extern UINT8 FrontPageVfrBin[];
84
85 extern EFI_HII_DATABASE_PROTOCOL *gHiiDatabase;
86 extern EFI_HII_STRING_PROTOCOL *gHiiString;
87 extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
88 extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting;
89
90 extern UINTN gCallbackKey;
91 extern BOOLEAN gConnectAllHappened;
92
93 /**
94 This function allows a caller to extract the current configuration for one
95 or more named elements from the target driver.
96
97
98 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
99 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
100 @param Progress - On return, points to a character in the Request string.
101 Points to the string's null terminator if request was successful.
102 Points to the most recent '&' before the first failing name/value
103 pair (or the beginning of the string if the failure is in the
104 first name/value pair) if the request was not successful.
105 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
106 has all values filled in for the names in the Request string.
107 String to be allocated by the called function.
108
109 @retval EFI_SUCCESS The Results is filled with the requested values.
110 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
111 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
112 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
113
114 **/
115 EFI_STATUS
116 EFIAPI
117 FakeExtractConfig (
118 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
119 IN CONST EFI_STRING Request,
120 OUT EFI_STRING *Progress,
121 OUT EFI_STRING *Results
122 );
123
124 /**
125 This function processes the results of changes in configuration.
126
127
128 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
129 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
130 @param Progress - A pointer to a string filled in with the offset of the most
131 recent '&' before the first failing name/value pair (or the
132 beginning of the string if the failure is in the first
133 name/value pair) or the terminating NULL if all was successful.
134
135 @retval EFI_SUCCESS The Results is processed successfully.
136 @retval EFI_INVALID_PARAMETER Configuration is NULL.
137 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
138
139 **/
140 EFI_STATUS
141 EFIAPI
142 FakeRouteConfig (
143 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
144 IN CONST EFI_STRING Configuration,
145 OUT EFI_STRING *Progress
146 );
147
148 /**
149 This function processes the results of changes in configuration.
150
151
152 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
153 @param Action - Specifies the type of action taken by the browser.
154 @param QuestionId - A unique value which is sent to the original exporting driver
155 so that it can identify the type of data to expect.
156 @param Type - The type of value for the question.
157 @param Value - A pointer to the data being sent to the original exporting driver.
158 @param ActionRequest - On return, points to the action requested by the callback function.
159
160 @retval EFI_SUCCESS The callback successfully handled the action.
161 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
162 @retval EFI_DEVICE_ERROR The variable could not be saved.
163 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
164
165 **/
166 EFI_STATUS
167 EFIAPI
168 FrontPageCallback (
169 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
170 IN EFI_BROWSER_ACTION Action,
171 IN EFI_QUESTION_ID QuestionId,
172 IN UINT8 Type,
173 IN EFI_IFR_TYPE_VALUE *Value,
174 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
175 );
176
177 /**
178 Initialize HII information for the FrontPage
179
180
181 @param InitializeHiiData TRUE if HII elements need to be initialized.
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 IN BOOLEAN InitializeHiiData
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 Compare two EFI_TIME data.
212
213
214 @param FirstTime - A pointer to the first EFI_TIME data.
215 @param SecondTime - A pointer to the second EFI_TIME data.
216
217 @retval TRUE The FirstTime is not later than the SecondTime.
218 @retval FALSE The FirstTime is later than the SecondTime.
219
220 **/
221 BOOLEAN
222 TimeCompare (
223 IN EFI_TIME *FirstTime,
224 IN EFI_TIME *SecondTime
225 );
226
227 /**
228 This function is the main entry of the platform setup entry.
229 The function will present the main menu of the system setup,
230 this is the platform reference part and can be customize.
231
232
233 @param TimeoutDefault - The fault time out value before the system
234 continue to boot.
235 @param ConnectAllHappened - The indicater to check if the connect all have
236 already happended.
237
238 **/
239 VOID
240 PlatformBdsEnterFrontPage (
241 IN UINT16 TimeoutDefault,
242 IN BOOLEAN ConnectAllHappened
243 );
244
245 #endif // _FRONT_PAGE_H_
246