1 | /** @file
|
---|
2 | Header file for boot maintenance module.
|
---|
3 |
|
---|
4 | Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _BOOT_MAINT_H_
|
---|
10 | #define _BOOT_MAINT_H_
|
---|
11 |
|
---|
12 | #include "FormGuid.h"
|
---|
13 |
|
---|
14 | #include <Guid/TtyTerm.h>
|
---|
15 | #include <Guid/MdeModuleHii.h>
|
---|
16 | #include <Guid/FileSystemVolumeLabelInfo.h>
|
---|
17 | #include <Guid/GlobalVariable.h>
|
---|
18 | #include <Guid/HiiBootMaintenanceFormset.h>
|
---|
19 |
|
---|
20 | #include <Protocol/LoadFile.h>
|
---|
21 | #include <Protocol/HiiConfigAccess.h>
|
---|
22 | #include <Protocol/SimpleFileSystem.h>
|
---|
23 | #include <Protocol/SerialIo.h>
|
---|
24 | #include <Protocol/DevicePathToText.h>
|
---|
25 | #include <Protocol/FormBrowserEx2.h>
|
---|
26 |
|
---|
27 | #include <Library/PrintLib.h>
|
---|
28 | #include <Library/DebugLib.h>
|
---|
29 | #include <Library/BaseMemoryLib.h>
|
---|
30 | #include <Library/UefiBootServicesTableLib.h>
|
---|
31 | #include <Library/UefiLib.h>
|
---|
32 | #include <Library/MemoryAllocationLib.h>
|
---|
33 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
34 | #include <Library/DevicePathLib.h>
|
---|
35 | #include <Library/HiiLib.h>
|
---|
36 | #include <Library/UefiHiiServicesLib.h>
|
---|
37 | #include <Library/UefiBootManagerLib.h>
|
---|
38 | #include <Library/FileExplorerLib.h>
|
---|
39 | #include "BootMaintenanceManagerCustomizedUi.h"
|
---|
40 |
|
---|
41 | #pragma pack(1)
|
---|
42 |
|
---|
43 | ///
|
---|
44 | /// HII specific Vendor Device Path definition.
|
---|
45 | ///
|
---|
46 | typedef struct {
|
---|
47 | VENDOR_DEVICE_PATH VendorDevicePath;
|
---|
48 | EFI_DEVICE_PATH_PROTOCOL End;
|
---|
49 | } HII_VENDOR_DEVICE_PATH;
|
---|
50 | #pragma pack()
|
---|
51 |
|
---|
52 | //
|
---|
53 | // Constants which are variable names used to access variables
|
---|
54 | //
|
---|
55 |
|
---|
56 | #define VAR_CON_OUT_MODE L"ConOutMode"
|
---|
57 |
|
---|
58 | //
|
---|
59 | // Variable created with this flag will be "Efi:...."
|
---|
60 | //
|
---|
61 | #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
|
---|
62 |
|
---|
63 | extern EFI_GUID mBootMaintGuid;
|
---|
64 | extern CHAR16 mBootMaintStorageName[];
|
---|
65 | //
|
---|
66 | // These are the VFR compiler generated data representing our VFR data.
|
---|
67 | //
|
---|
68 | extern UINT8 BootMaintenanceManagerBin[];
|
---|
69 |
|
---|
70 | //
|
---|
71 | // Below are the number of options in Baudrate, Databits,
|
---|
72 | // Parity and Stopbits selection for serial ports.
|
---|
73 | //
|
---|
74 | #define BM_COM_ATTR_BUADRATE 19
|
---|
75 | #define BM_COM_ATTR_DATABITS 4
|
---|
76 | #define BM_COM_ATTR_PARITY 5
|
---|
77 | #define BM_COM_ATTR_STOPBITS 3
|
---|
78 |
|
---|
79 | //
|
---|
80 | // Callback function helper
|
---|
81 | //
|
---|
82 | #define BMM_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('C', 'b', 'c', 'k')
|
---|
83 | #define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)
|
---|
84 |
|
---|
85 | //
|
---|
86 | // Enumeration type definition
|
---|
87 | //
|
---|
88 | typedef UINT8 BBS_TYPE;
|
---|
89 |
|
---|
90 | typedef enum _TYPE_OF_TERMINAL {
|
---|
91 | TerminalTypePcAnsi = 0,
|
---|
92 | TerminalTypeVt100,
|
---|
93 | TerminalTypeVt100Plus,
|
---|
94 | TerminalTypeVtUtf8,
|
---|
95 | TerminalTypeTtyTerm
|
---|
96 | } TYPE_OF_TERMINAL;
|
---|
97 |
|
---|
98 | //
|
---|
99 | // All of the signatures that will be used in list structure
|
---|
100 | //
|
---|
101 | #define BM_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
|
---|
102 | #define BM_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('l', 'o', 'a', 'd')
|
---|
103 | #define BM_CONSOLE_OPTION_SIGNATURE SIGNATURE_32 ('c', 'n', 's', 'l')
|
---|
104 | #define BM_FILE_OPTION_SIGNATURE SIGNATURE_32 ('f', 'i', 'l', 'e')
|
---|
105 | #define BM_HANDLE_OPTION_SIGNATURE SIGNATURE_32 ('h', 'n', 'd', 'l')
|
---|
106 | #define BM_TERMINAL_OPTION_SIGNATURE SIGNATURE_32 ('t', 'r', 'm', 'l')
|
---|
107 | #define BM_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
|
---|
108 |
|
---|
109 | #define BM_LOAD_CONTEXT_SELECT 0x0
|
---|
110 | #define BM_CONSOLE_CONTEXT_SELECT 0x1
|
---|
111 | #define BM_FILE_CONTEXT_SELECT 0x2
|
---|
112 | #define BM_HANDLE_CONTEXT_SELECT 0x3
|
---|
113 | #define BM_TERMINAL_CONTEXT_SELECT 0x5
|
---|
114 |
|
---|
115 | #define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
|
---|
116 | #define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
|
---|
117 | #define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
|
---|
118 |
|
---|
119 | //
|
---|
120 | // Buffer size for update data
|
---|
121 | //
|
---|
122 | #define UPDATE_DATA_SIZE 0x100000
|
---|
123 |
|
---|
124 | //
|
---|
125 | // Namespace of callback keys used in display and file system navigation
|
---|
126 | //
|
---|
127 | #define MAX_BBS_OFFSET 0xE000
|
---|
128 | #define NET_OPTION_OFFSET 0xD800
|
---|
129 | #define BEV_OPTION_OFFSET 0xD000
|
---|
130 | #define FD_OPTION_OFFSET 0xC000
|
---|
131 | #define HD_OPTION_OFFSET 0xB000
|
---|
132 | #define CD_OPTION_OFFSET 0xA000
|
---|
133 | #define FILE_OPTION_OFFSET 0x8000
|
---|
134 | #define FILE_OPTION_MASK 0x7FFF
|
---|
135 | #define HANDLE_OPTION_OFFSET 0x7000
|
---|
136 | #define CONSOLE_OPTION_OFFSET 0x6000
|
---|
137 | #define TERMINAL_OPTION_OFFSET 0x5000
|
---|
138 | #define CONFIG_OPTION_OFFSET 0x1200
|
---|
139 | #define KEY_VALUE_OFFSET 0x1100
|
---|
140 | #define FORM_ID_OFFSET 0x1000
|
---|
141 |
|
---|
142 | //
|
---|
143 | // VarOffset that will be used to create question
|
---|
144 | // all these values are computed from the structure
|
---|
145 | // defined below
|
---|
146 | //
|
---|
147 | #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field)))
|
---|
148 |
|
---|
149 | //
|
---|
150 | // Question Id of Zero is invalid, so add an offset to it
|
---|
151 | //
|
---|
152 | #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
|
---|
153 |
|
---|
154 | #define BOOT_TIME_OUT_VAR_OFFSET VAR_OFFSET (BootTimeOut)
|
---|
155 | #define BOOT_NEXT_VAR_OFFSET VAR_OFFSET (BootNext)
|
---|
156 | #define COM1_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM1BaudRate)
|
---|
157 | #define COM1_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM1DataRate)
|
---|
158 | #define COM1_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM1StopBits)
|
---|
159 | #define COM1_PARITY_VAR_OFFSET VAR_OFFSET (COM1Parity)
|
---|
160 | #define COM1_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
|
---|
161 | #define COM2_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM2BaudRate)
|
---|
162 | #define COM2_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM2DataRate)
|
---|
163 | #define COM2_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM2StopBits)
|
---|
164 | #define COM2_PARITY_VAR_OFFSET VAR_OFFSET (COM2Parity)
|
---|
165 | #define COM2_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
|
---|
166 | #define DRV_ADD_HANDLE_DESC_VAR_OFFSET VAR_OFFSET (DriverAddHandleDesc)
|
---|
167 | #define DRV_ADD_ACTIVE_VAR_OFFSET VAR_OFFSET (DriverAddActive)
|
---|
168 | #define DRV_ADD_RECON_VAR_OFFSET VAR_OFFSET (DriverAddForceReconnect)
|
---|
169 | #define CON_IN_COM1_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM1)
|
---|
170 | #define CON_IN_COM2_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM2)
|
---|
171 | #define CON_OUT_COM1_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM1)
|
---|
172 | #define CON_OUT_COM2_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM2)
|
---|
173 | #define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
|
---|
174 | #define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
|
---|
175 | #define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
|
---|
176 | #define CON_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck)
|
---|
177 | #define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
|
---|
178 | #define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
|
---|
179 | #define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)
|
---|
180 | #define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
|
---|
181 | #define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
|
---|
182 | #define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
|
---|
183 | #define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)
|
---|
184 | #define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
|
---|
185 | #define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
|
---|
186 | #define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)
|
---|
187 | #define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
|
---|
188 | #define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
|
---|
189 | #define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
|
---|
190 | #define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
|
---|
191 |
|
---|
192 | #define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
|
---|
193 | #define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
|
---|
194 | #define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
|
---|
195 | #define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
|
---|
196 | #define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
|
---|
197 | #define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
|
---|
198 | #define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
|
---|
199 | #define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
|
---|
200 | #define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
|
---|
201 | #define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
|
---|
202 | #define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
|
---|
203 | #define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
|
---|
204 | #define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
|
---|
205 | #define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
|
---|
206 | #define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
|
---|
207 | #define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
|
---|
208 | #define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
|
---|
209 | #define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
|
---|
210 | #define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
|
---|
211 | #define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
|
---|
212 | #define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
|
---|
213 | #define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
|
---|
214 | #define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
|
---|
215 | #define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
|
---|
216 | #define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
|
---|
217 | #define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)
|
---|
218 | #define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
|
---|
219 | #define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
|
---|
220 | #define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
|
---|
221 | #define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
|
---|
222 | #define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
|
---|
223 | #define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
|
---|
224 | #define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
|
---|
225 | #define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
|
---|
226 | #define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
|
---|
227 | #define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
|
---|
228 | #define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
|
---|
229 |
|
---|
230 | #define STRING_DEPOSITORY_NUMBER 8
|
---|
231 |
|
---|
232 | #define NONE_BOOTNEXT_VALUE (0xFFFF + 1)
|
---|
233 |
|
---|
234 | ///
|
---|
235 | /// Serial Ports attributes, first one is the value for
|
---|
236 | /// return from callback function, stringtoken is used to
|
---|
237 | /// display the value properly
|
---|
238 | ///
|
---|
239 | typedef struct {
|
---|
240 | UINTN Value;
|
---|
241 | UINT16 StringToken;
|
---|
242 | } COM_ATTR;
|
---|
243 |
|
---|
244 | typedef struct {
|
---|
245 | UINT64 BaudRate;
|
---|
246 | UINT8 DataBits;
|
---|
247 | UINT8 Parity;
|
---|
248 | UINT8 StopBits;
|
---|
249 |
|
---|
250 | UINT8 BaudRateIndex;
|
---|
251 | UINT8 DataBitsIndex;
|
---|
252 | UINT8 ParityIndex;
|
---|
253 | UINT8 StopBitsIndex;
|
---|
254 |
|
---|
255 | UINT8 FlowControl;
|
---|
256 |
|
---|
257 | UINT8 IsConIn;
|
---|
258 | UINT8 IsConOut;
|
---|
259 | UINT8 IsStdErr;
|
---|
260 | UINT8 TerminalType;
|
---|
261 |
|
---|
262 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
263 | } BM_TERMINAL_CONTEXT;
|
---|
264 |
|
---|
265 | typedef struct {
|
---|
266 | BOOLEAN IsBootNext;
|
---|
267 | BOOLEAN Deleted;
|
---|
268 |
|
---|
269 | BOOLEAN IsLegacy;
|
---|
270 |
|
---|
271 | UINT32 Attributes;
|
---|
272 | UINT16 FilePathListLength;
|
---|
273 | UINT16 *Description;
|
---|
274 | EFI_DEVICE_PATH_PROTOCOL *FilePathList;
|
---|
275 | UINT8 *OptionalData;
|
---|
276 | } BM_LOAD_CONTEXT;
|
---|
277 |
|
---|
278 | typedef struct {
|
---|
279 |
|
---|
280 | BOOLEAN IsActive;
|
---|
281 |
|
---|
282 | BOOLEAN IsTerminal;
|
---|
283 |
|
---|
284 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
285 | } BM_CONSOLE_CONTEXT;
|
---|
286 |
|
---|
287 | typedef struct {
|
---|
288 | UINTN Column;
|
---|
289 | UINTN Row;
|
---|
290 | } CONSOLE_OUT_MODE;
|
---|
291 |
|
---|
292 | typedef struct {
|
---|
293 | EFI_HANDLE Handle;
|
---|
294 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
295 | EFI_FILE_HANDLE FHandle;
|
---|
296 | UINT16 *FileName;
|
---|
297 | EFI_FILE_SYSTEM_VOLUME_LABEL *Info;
|
---|
298 |
|
---|
299 | BOOLEAN IsRoot;
|
---|
300 | BOOLEAN IsDir;
|
---|
301 | BOOLEAN IsRemovableMedia;
|
---|
302 | BOOLEAN IsLoadFile;
|
---|
303 | BOOLEAN IsBootLegacy;
|
---|
304 | } BM_FILE_CONTEXT;
|
---|
305 |
|
---|
306 | typedef struct {
|
---|
307 | EFI_HANDLE Handle;
|
---|
308 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
309 | } BM_HANDLE_CONTEXT;
|
---|
310 |
|
---|
311 | typedef struct {
|
---|
312 | UINTN Signature;
|
---|
313 | LIST_ENTRY Head;
|
---|
314 | UINTN MenuNumber;
|
---|
315 | } BM_MENU_OPTION;
|
---|
316 |
|
---|
317 | typedef struct {
|
---|
318 | UINTN Signature;
|
---|
319 | LIST_ENTRY Link;
|
---|
320 | UINTN OptionNumber;
|
---|
321 | UINT16 *DisplayString;
|
---|
322 | UINT16 *HelpString;
|
---|
323 | EFI_STRING_ID DisplayStringToken;
|
---|
324 | EFI_STRING_ID HelpStringToken;
|
---|
325 | UINTN ContextSelection;
|
---|
326 | VOID *VariableContext;
|
---|
327 | } BM_MENU_ENTRY;
|
---|
328 |
|
---|
329 | typedef struct {
|
---|
330 |
|
---|
331 | UINTN Signature;
|
---|
332 |
|
---|
333 | EFI_HII_HANDLE BmmHiiHandle;
|
---|
334 | EFI_HANDLE BmmDriverHandle;
|
---|
335 | ///
|
---|
336 | /// Boot Maintenance Manager Produced protocols
|
---|
337 | ///
|
---|
338 | EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess;
|
---|
339 | EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
---|
340 |
|
---|
341 | BM_MENU_ENTRY *MenuEntry;
|
---|
342 | BM_HANDLE_CONTEXT *HandleContext;
|
---|
343 | BM_FILE_CONTEXT *FileContext;
|
---|
344 | BM_LOAD_CONTEXT *LoadContext;
|
---|
345 | BM_TERMINAL_CONTEXT *TerminalContext;
|
---|
346 | UINTN CurrentTerminal;
|
---|
347 | BBS_TYPE BbsType;
|
---|
348 |
|
---|
349 | //
|
---|
350 | // BMM main formset callback data.
|
---|
351 | //
|
---|
352 |
|
---|
353 | EFI_FORM_ID BmmCurrentPageId;
|
---|
354 | EFI_FORM_ID BmmPreviousPageId;
|
---|
355 | BOOLEAN BmmAskSaveOrNot;
|
---|
356 | BMM_FAKE_NV_DATA BmmFakeNvData;
|
---|
357 | BMM_FAKE_NV_DATA BmmOldFakeNVData;
|
---|
358 |
|
---|
359 | } BMM_CALLBACK_DATA;
|
---|
360 |
|
---|
361 | /**
|
---|
362 |
|
---|
363 | Find drivers that will be added as Driver#### variables from handles
|
---|
364 | in current system environment
|
---|
365 | All valid handles in the system except those consume SimpleFs, LoadFile
|
---|
366 | are stored in DriverMenu for future use.
|
---|
367 |
|
---|
368 | @retval EFI_SUCCESS The function complets successfully.
|
---|
369 | @return Other value if failed to build the DriverMenu.
|
---|
370 |
|
---|
371 | **/
|
---|
372 | EFI_STATUS
|
---|
373 | BOpt_FindDrivers (
|
---|
374 | VOID
|
---|
375 | );
|
---|
376 |
|
---|
377 | /**
|
---|
378 |
|
---|
379 | Build the BootOptionMenu according to BootOrder Variable.
|
---|
380 | This Routine will access the Boot#### to get EFI_LOAD_OPTION.
|
---|
381 |
|
---|
382 | @param CallbackData The BMM context data.
|
---|
383 |
|
---|
384 | @return The number of the Var Boot####.
|
---|
385 |
|
---|
386 | **/
|
---|
387 | EFI_STATUS
|
---|
388 | BOpt_GetBootOptions (
|
---|
389 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
390 | );
|
---|
391 |
|
---|
392 | /**
|
---|
393 |
|
---|
394 | Build up all DriverOptionMenu
|
---|
395 |
|
---|
396 | @param CallbackData The BMM context data.
|
---|
397 |
|
---|
398 | @return EFI_SUCESS The functin completes successfully.
|
---|
399 | @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
|
---|
400 |
|
---|
401 |
|
---|
402 | **/
|
---|
403 | EFI_STATUS
|
---|
404 | BOpt_GetDriverOptions (
|
---|
405 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
406 | );
|
---|
407 |
|
---|
408 | /**
|
---|
409 | Free resources allocated in Allocate Rountine.
|
---|
410 |
|
---|
411 | @param FreeMenu Menu to be freed
|
---|
412 |
|
---|
413 | **/
|
---|
414 | VOID
|
---|
415 | BOpt_FreeMenu (
|
---|
416 | BM_MENU_OPTION *FreeMenu
|
---|
417 | );
|
---|
418 |
|
---|
419 | /**
|
---|
420 |
|
---|
421 | Get the Option Number that has not been allocated for use.
|
---|
422 |
|
---|
423 | @param Type The type of Option.
|
---|
424 |
|
---|
425 | @return The available Option Number.
|
---|
426 |
|
---|
427 | **/
|
---|
428 | UINT16
|
---|
429 | BOpt_GetOptionNumber (
|
---|
430 | CHAR16 *Type
|
---|
431 | );
|
---|
432 |
|
---|
433 | /**
|
---|
434 |
|
---|
435 | Get the Option Number for Boot#### that does not used.
|
---|
436 |
|
---|
437 | @return The available Option Number.
|
---|
438 |
|
---|
439 | **/
|
---|
440 | UINT16
|
---|
441 | BOpt_GetBootOptionNumber (
|
---|
442 | VOID
|
---|
443 | );
|
---|
444 |
|
---|
445 | /**
|
---|
446 |
|
---|
447 | Get the Option Number for Driver#### that does not used.
|
---|
448 |
|
---|
449 | @return The unused Option Number.
|
---|
450 |
|
---|
451 | **/
|
---|
452 | UINT16
|
---|
453 | BOpt_GetDriverOptionNumber (
|
---|
454 | VOID
|
---|
455 | );
|
---|
456 |
|
---|
457 | /**
|
---|
458 | Create a menu entry give a Menu type.
|
---|
459 |
|
---|
460 | @param MenuType The Menu type to be created.
|
---|
461 |
|
---|
462 |
|
---|
463 | @retval NULL If failed to create the menu.
|
---|
464 | @return The menu.
|
---|
465 |
|
---|
466 | **/
|
---|
467 | BM_MENU_ENTRY *
|
---|
468 | BOpt_CreateMenuEntry (
|
---|
469 | UINTN MenuType
|
---|
470 | );
|
---|
471 |
|
---|
472 | /**
|
---|
473 | Free up all resource allocated for a BM_MENU_ENTRY.
|
---|
474 |
|
---|
475 | @param MenuEntry A pointer to BM_MENU_ENTRY.
|
---|
476 |
|
---|
477 | **/
|
---|
478 | VOID
|
---|
479 | BOpt_DestroyMenuEntry (
|
---|
480 | BM_MENU_ENTRY *MenuEntry
|
---|
481 | );
|
---|
482 |
|
---|
483 | /**
|
---|
484 | Get the Menu Entry from the list in Menu Entry List.
|
---|
485 |
|
---|
486 | If MenuNumber is great or equal to the number of Menu
|
---|
487 | Entry in the list, then ASSERT.
|
---|
488 |
|
---|
489 | @param MenuOption The Menu Entry List to read the menu entry.
|
---|
490 | @param MenuNumber The index of Menu Entry.
|
---|
491 |
|
---|
492 | @return The Menu Entry.
|
---|
493 |
|
---|
494 | **/
|
---|
495 | BM_MENU_ENTRY *
|
---|
496 | BOpt_GetMenuEntry (
|
---|
497 | BM_MENU_OPTION *MenuOption,
|
---|
498 | UINTN MenuNumber
|
---|
499 | );
|
---|
500 |
|
---|
501 | /**
|
---|
502 | Get option number according to Boot#### and BootOrder variable.
|
---|
503 | The value is saved as #### + 1.
|
---|
504 |
|
---|
505 | @param CallbackData The BMM context data.
|
---|
506 | **/
|
---|
507 | VOID
|
---|
508 | GetBootOrder (
|
---|
509 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
510 | );
|
---|
511 |
|
---|
512 | /**
|
---|
513 | Get driver option order from globalc DriverOptionMenu.
|
---|
514 |
|
---|
515 | @param CallbackData The BMM context data.
|
---|
516 |
|
---|
517 | **/
|
---|
518 | VOID
|
---|
519 | GetDriverOrder (
|
---|
520 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
521 | );
|
---|
522 |
|
---|
523 | //
|
---|
524 | // Locate all serial io devices for console
|
---|
525 | //
|
---|
526 | /**
|
---|
527 | Build a list containing all serial devices.
|
---|
528 |
|
---|
529 | @retval EFI_SUCCESS The function complete successfully.
|
---|
530 | @retval EFI_UNSUPPORTED No serial ports present.
|
---|
531 |
|
---|
532 | **/
|
---|
533 | EFI_STATUS
|
---|
534 | LocateSerialIo (
|
---|
535 | VOID
|
---|
536 | );
|
---|
537 |
|
---|
538 | //
|
---|
539 | // Initializing Console menu
|
---|
540 | //
|
---|
541 | /**
|
---|
542 | Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
---|
543 |
|
---|
544 | @retval EFI_SUCCESS The function always complete successfully.
|
---|
545 |
|
---|
546 | **/
|
---|
547 | EFI_STATUS
|
---|
548 | GetAllConsoles(
|
---|
549 | VOID
|
---|
550 | );
|
---|
551 |
|
---|
552 | //
|
---|
553 | // Get current mode information
|
---|
554 | //
|
---|
555 | /**
|
---|
556 | Get mode number according to column and row
|
---|
557 |
|
---|
558 | @param CallbackData The BMM context data.
|
---|
559 | **/
|
---|
560 | VOID
|
---|
561 | GetConsoleOutMode (
|
---|
562 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
563 | );
|
---|
564 |
|
---|
565 | //
|
---|
566 | // Cleaning up console menu
|
---|
567 | //
|
---|
568 | /**
|
---|
569 | Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
---|
570 |
|
---|
571 | @retval EFI_SUCCESS The function always complete successfully.
|
---|
572 | **/
|
---|
573 | EFI_STATUS
|
---|
574 | FreeAllConsoles (
|
---|
575 | VOID
|
---|
576 | );
|
---|
577 |
|
---|
578 | /**
|
---|
579 | Update the device path that describing a terminal device
|
---|
580 | based on the new BaudRate, Data Bits, parity and Stop Bits
|
---|
581 | set.
|
---|
582 |
|
---|
583 | @param DevicePath The devicepath protocol instance wanted to be updated.
|
---|
584 |
|
---|
585 | **/
|
---|
586 | VOID
|
---|
587 | ChangeVariableDevicePath (
|
---|
588 | IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
589 | );
|
---|
590 |
|
---|
591 | /**
|
---|
592 | Update the multi-instance device path of Terminal Device based on
|
---|
593 | the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
|
---|
594 | device path in the Terminal Device in TerminalMenu is also updated.
|
---|
595 |
|
---|
596 | @param DevicePath The multi-instance device path.
|
---|
597 | @param ChangeTerminal TRUE, then device path in the Terminal Device
|
---|
598 | in TerminalMenu is also updated; FALSE, no update.
|
---|
599 |
|
---|
600 | @return EFI_SUCCESS The function completes successfully.
|
---|
601 |
|
---|
602 | **/
|
---|
603 | EFI_STATUS
|
---|
604 | ChangeTerminalDevicePath (
|
---|
605 | IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
606 | IN BOOLEAN ChangeTerminal
|
---|
607 | );
|
---|
608 |
|
---|
609 | //
|
---|
610 | // Variable operation by menu selection
|
---|
611 | //
|
---|
612 | /**
|
---|
613 | This function create a currently loaded Boot Option from
|
---|
614 | the BMM. It then appends this Boot Option to the end of
|
---|
615 | the "BootOrder" list. It also append this Boot Opotion to the end
|
---|
616 | of BootOptionMenu.
|
---|
617 |
|
---|
618 | @param CallbackData The BMM context data.
|
---|
619 |
|
---|
620 | @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
|
---|
621 | @retval EFI_SUCCESS If function completes successfully.
|
---|
622 |
|
---|
623 | **/
|
---|
624 | EFI_STATUS
|
---|
625 | Var_UpdateBootOption (
|
---|
626 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
627 | );
|
---|
628 |
|
---|
629 | /**
|
---|
630 | Delete Boot Option that represent a Deleted state in BootOptionMenu.
|
---|
631 |
|
---|
632 | @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to
|
---|
633 | BM_LOAD_CONTEXT marked for deletion is deleted
|
---|
634 | @return Others If failed to update the "BootOrder" variable after deletion.
|
---|
635 |
|
---|
636 | **/
|
---|
637 | EFI_STATUS
|
---|
638 | Var_DelBootOption (
|
---|
639 | VOID
|
---|
640 | );
|
---|
641 |
|
---|
642 | /**
|
---|
643 | This function create a currently loaded Drive Option from
|
---|
644 | the BMM. It then appends this Driver Option to the end of
|
---|
645 | the "DriverOrder" list. It append this Driver Opotion to the end
|
---|
646 | of DriverOptionMenu.
|
---|
647 |
|
---|
648 | @param CallbackData The BMM context data.
|
---|
649 | @param HiiHandle The HII handle associated with the BMM formset.
|
---|
650 | @param DescriptionData The description of this driver option.
|
---|
651 | @param OptionalData The optional load option.
|
---|
652 | @param ForceReconnect If to force reconnect.
|
---|
653 |
|
---|
654 | @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
|
---|
655 | @retval EFI_SUCCESS If function completes successfully.
|
---|
656 |
|
---|
657 | **/
|
---|
658 | EFI_STATUS
|
---|
659 | Var_UpdateDriverOption (
|
---|
660 | IN BMM_CALLBACK_DATA *CallbackData,
|
---|
661 | IN EFI_HII_HANDLE HiiHandle,
|
---|
662 | IN UINT16 *DescriptionData,
|
---|
663 | IN UINT16 *OptionalData,
|
---|
664 | IN UINT8 ForceReconnect
|
---|
665 | );
|
---|
666 |
|
---|
667 | /**
|
---|
668 | Delete Load Option that represent a Deleted state in DriverOptionMenu.
|
---|
669 |
|
---|
670 | @retval EFI_SUCCESS Load Option is successfully updated.
|
---|
671 | @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
|
---|
672 | Variable.
|
---|
673 |
|
---|
674 | **/
|
---|
675 | EFI_STATUS
|
---|
676 | Var_DelDriverOption (
|
---|
677 | VOID
|
---|
678 | );
|
---|
679 |
|
---|
680 | /**
|
---|
681 | This function delete and build multi-instance device path ConIn
|
---|
682 | console device.
|
---|
683 |
|
---|
684 | @retval EFI_SUCCESS The function complete successfully.
|
---|
685 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
686 | **/
|
---|
687 | EFI_STATUS
|
---|
688 | Var_UpdateConsoleInpOption (
|
---|
689 | VOID
|
---|
690 | );
|
---|
691 |
|
---|
692 | /**
|
---|
693 | This function delete and build multi-instance device path ConOut console device.
|
---|
694 |
|
---|
695 | @retval EFI_SUCCESS The function complete successfully.
|
---|
696 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
697 | **/
|
---|
698 | EFI_STATUS
|
---|
699 | Var_UpdateConsoleOutOption (
|
---|
700 | VOID
|
---|
701 | );
|
---|
702 |
|
---|
703 | /**
|
---|
704 | This function delete and build multi-instance device path ErrOut console device.
|
---|
705 |
|
---|
706 | @retval EFI_SUCCESS The function complete successfully.
|
---|
707 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
708 | **/
|
---|
709 | EFI_STATUS
|
---|
710 | Var_UpdateErrorOutOption (
|
---|
711 | VOID
|
---|
712 | );
|
---|
713 |
|
---|
714 | /**
|
---|
715 | This function delete and build Out of Band console device.
|
---|
716 |
|
---|
717 | @param MenuIndex Menu index which user select in the terminal menu list.
|
---|
718 |
|
---|
719 | @retval EFI_SUCCESS The function complete successfully.
|
---|
720 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
721 | **/
|
---|
722 | EFI_STATUS
|
---|
723 | Var_UpdateOutOfBandOption (
|
---|
724 | IN UINT16 MenuIndex
|
---|
725 | );
|
---|
726 |
|
---|
727 | /**
|
---|
728 | This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM,
|
---|
729 | this EFI Variable is deleted.
|
---|
730 | It also update the BMM context data specified the "BootNext" value.
|
---|
731 |
|
---|
732 | @param CallbackData The BMM context data.
|
---|
733 |
|
---|
734 | @retval EFI_SUCCESS The function complete successfully.
|
---|
735 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
736 |
|
---|
737 | **/
|
---|
738 | EFI_STATUS
|
---|
739 | Var_UpdateBootNext (
|
---|
740 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
741 | );
|
---|
742 |
|
---|
743 | /**
|
---|
744 | This function update the "BootOrder" EFI Variable based on BMM Formset's NV map. It then refresh
|
---|
745 | BootOptionMenu with the new "BootOrder" list.
|
---|
746 |
|
---|
747 | @param CallbackData The BMM context data.
|
---|
748 |
|
---|
749 | @retval EFI_SUCCESS The function complete successfully.
|
---|
750 | @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
|
---|
751 | @return not The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
752 |
|
---|
753 | **/
|
---|
754 | EFI_STATUS
|
---|
755 | Var_UpdateBootOrder (
|
---|
756 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
757 | );
|
---|
758 |
|
---|
759 | /**
|
---|
760 | This function update the "DriverOrder" EFI Variable based on
|
---|
761 | BMM Formset's NV map. It then refresh DriverOptionMenu
|
---|
762 | with the new "DriverOrder" list.
|
---|
763 |
|
---|
764 | @param CallbackData The BMM context data.
|
---|
765 |
|
---|
766 | @retval EFI_SUCCESS The function complete successfully.
|
---|
767 | @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
|
---|
768 | @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
|
---|
769 |
|
---|
770 | **/
|
---|
771 | EFI_STATUS
|
---|
772 | Var_UpdateDriverOrder (
|
---|
773 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
774 | );
|
---|
775 |
|
---|
776 | /**
|
---|
777 | Update the Text Mode of Console.
|
---|
778 |
|
---|
779 | @param CallbackData The context data for BMM.
|
---|
780 |
|
---|
781 | @retval EFI_SUCCSS If the Text Mode of Console is updated.
|
---|
782 | @return Other value if the Text Mode of Console is not updated.
|
---|
783 |
|
---|
784 | **/
|
---|
785 | EFI_STATUS
|
---|
786 | Var_UpdateConMode (
|
---|
787 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
788 | );
|
---|
789 |
|
---|
790 | //
|
---|
791 | // Following are page create and refresh functions
|
---|
792 | //
|
---|
793 | /**
|
---|
794 | Create the global UpdateData structure.
|
---|
795 |
|
---|
796 | **/
|
---|
797 | VOID
|
---|
798 | CreateUpdateData (
|
---|
799 | VOID
|
---|
800 | );
|
---|
801 |
|
---|
802 | /**
|
---|
803 | Refresh the global UpdateData structure.
|
---|
804 |
|
---|
805 | **/
|
---|
806 | VOID
|
---|
807 | RefreshUpdateData (
|
---|
808 | VOID
|
---|
809 | );
|
---|
810 |
|
---|
811 | /**
|
---|
812 | Clean up the dynamic opcode at label and form specified by
|
---|
813 | both LabelId.
|
---|
814 |
|
---|
815 | @param LabelId It is both the Form ID and Label ID for
|
---|
816 | opcode deletion.
|
---|
817 | @param CallbackData The BMM context data.
|
---|
818 |
|
---|
819 | **/
|
---|
820 | VOID
|
---|
821 | CleanUpPage (
|
---|
822 | IN UINT16 LabelId,
|
---|
823 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
824 | );
|
---|
825 |
|
---|
826 | /**
|
---|
827 | Create a lit of boot option from global BootOptionMenu. It
|
---|
828 | allow user to delete the boot option.
|
---|
829 |
|
---|
830 | @param CallbackData The BMM context data.
|
---|
831 |
|
---|
832 | **/
|
---|
833 | VOID
|
---|
834 | UpdateBootDelPage (
|
---|
835 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
836 | );
|
---|
837 |
|
---|
838 | /**
|
---|
839 | Create a lit of driver option from global DriverMenu.
|
---|
840 |
|
---|
841 | @param CallbackData The BMM context data.
|
---|
842 | **/
|
---|
843 | VOID
|
---|
844 | UpdateDrvAddHandlePage (
|
---|
845 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
846 | );
|
---|
847 |
|
---|
848 | /**
|
---|
849 | Create a lit of driver option from global DriverOptionMenu. It
|
---|
850 | allow user to delete the driver option.
|
---|
851 |
|
---|
852 | @param CallbackData The BMM context data.
|
---|
853 | **/
|
---|
854 | VOID
|
---|
855 | UpdateDrvDelPage (
|
---|
856 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
857 | );
|
---|
858 |
|
---|
859 | /**
|
---|
860 | Prepare the page to allow user to add description for a Driver Option.
|
---|
861 |
|
---|
862 | @param CallbackData The BMM context data.
|
---|
863 | **/
|
---|
864 | VOID
|
---|
865 | UpdateDriverAddHandleDescPage (
|
---|
866 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
867 | );
|
---|
868 |
|
---|
869 | /**
|
---|
870 | Dispatch the correct update page function to call based on the UpdatePageId.
|
---|
871 |
|
---|
872 | @param UpdatePageId The form ID.
|
---|
873 | @param CallbackData The BMM context data.
|
---|
874 | **/
|
---|
875 | VOID
|
---|
876 | UpdatePageBody (
|
---|
877 | IN UINT16 UpdatePageId,
|
---|
878 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
879 | );
|
---|
880 |
|
---|
881 | /**
|
---|
882 | Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
|
---|
883 | Parity, Stop Bits, Terminal Type.
|
---|
884 |
|
---|
885 | @param CallbackData The BMM context data.
|
---|
886 | **/
|
---|
887 | VOID
|
---|
888 | UpdateTerminalPage (
|
---|
889 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
890 | );
|
---|
891 |
|
---|
892 | /**
|
---|
893 | Refresh the text mode page
|
---|
894 |
|
---|
895 | @param CallbackData The BMM context data.
|
---|
896 | **/
|
---|
897 | VOID
|
---|
898 | UpdateConModePage (
|
---|
899 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
900 | );
|
---|
901 |
|
---|
902 | /**
|
---|
903 | Create a list of Goto Opcode for all terminal devices logged
|
---|
904 | by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
|
---|
905 |
|
---|
906 | @param CallbackData The BMM context data.
|
---|
907 | **/
|
---|
908 | VOID
|
---|
909 | UpdateConCOMPage (
|
---|
910 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
911 | );
|
---|
912 |
|
---|
913 | /**
|
---|
914 | Update add boot/driver option page.
|
---|
915 |
|
---|
916 | @param CallbackData The BMM context data.
|
---|
917 | @param FormId The form ID to be updated.
|
---|
918 | @param DevicePath Device path.
|
---|
919 |
|
---|
920 | **/
|
---|
921 | VOID
|
---|
922 | UpdateOptionPage(
|
---|
923 | IN BMM_CALLBACK_DATA *CallbackData,
|
---|
924 | IN EFI_FORM_ID FormId,
|
---|
925 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
926 | );
|
---|
927 |
|
---|
928 | /**
|
---|
929 | Function deletes the variable specified by VarName and VarGuid.
|
---|
930 |
|
---|
931 |
|
---|
932 | @param VarName A Null-terminated Unicode string that is
|
---|
933 | the name of the vendor's variable.
|
---|
934 |
|
---|
935 | @param VarGuid A unique identifier for the vendor.
|
---|
936 |
|
---|
937 | @retval EFI_SUCCESS The variable was found and removed
|
---|
938 | @retval EFI_UNSUPPORTED The variable store was inaccessible
|
---|
939 | @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
|
---|
940 | @retval EFI_NOT_FOUND The variable was not found
|
---|
941 |
|
---|
942 | **/
|
---|
943 | EFI_STATUS
|
---|
944 | EfiLibDeleteVariable (
|
---|
945 | IN CHAR16 *VarName,
|
---|
946 | IN EFI_GUID *VarGuid
|
---|
947 | );
|
---|
948 |
|
---|
949 | /**
|
---|
950 | Function is used to determine the number of device path instances
|
---|
951 | that exist in a device path.
|
---|
952 |
|
---|
953 |
|
---|
954 | @param DevicePath A pointer to a device path data structure.
|
---|
955 |
|
---|
956 | @return This function counts and returns the number of device path instances
|
---|
957 | in DevicePath.
|
---|
958 |
|
---|
959 | **/
|
---|
960 | UINTN
|
---|
961 | EfiDevicePathInstanceCount (
|
---|
962 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
963 | );
|
---|
964 |
|
---|
965 | /**
|
---|
966 | Get a string from the Data Hub record based on
|
---|
967 | a device path.
|
---|
968 |
|
---|
969 | @param DevPath The device Path.
|
---|
970 |
|
---|
971 | @return A string located from the Data Hub records based on
|
---|
972 | the device path.
|
---|
973 | @retval NULL If failed to get the String from Data Hub.
|
---|
974 |
|
---|
975 | **/
|
---|
976 | UINT16 *
|
---|
977 | EfiLibStrFromDatahub (
|
---|
978 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
---|
979 | );
|
---|
980 |
|
---|
981 | /**
|
---|
982 | Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type
|
---|
983 | specified by DeviceType.
|
---|
984 |
|
---|
985 | @param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,
|
---|
986 | etc.
|
---|
987 | @param OptionIndex Returns the index number (#### in Boot####).
|
---|
988 | @param OptionSize Return the size of the Boot### variable.
|
---|
989 |
|
---|
990 | **/
|
---|
991 | VOID *
|
---|
992 | GetLegacyBootOptionVar (
|
---|
993 | IN UINTN DeviceType,
|
---|
994 | OUT UINTN *OptionIndex,
|
---|
995 | OUT UINTN *OptionSize
|
---|
996 | );
|
---|
997 |
|
---|
998 | /**
|
---|
999 | Discard all changes done to the BMM pages such as Boot Order change,
|
---|
1000 | Driver order change.
|
---|
1001 |
|
---|
1002 | @param Private The BMM context data.
|
---|
1003 | @param CurrentFakeNVMap The current Fack NV Map.
|
---|
1004 |
|
---|
1005 | **/
|
---|
1006 | VOID
|
---|
1007 | DiscardChangeHandler (
|
---|
1008 | IN BMM_CALLBACK_DATA *Private,
|
---|
1009 | IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
|
---|
1010 | );
|
---|
1011 |
|
---|
1012 |
|
---|
1013 | /**
|
---|
1014 | This function is to clean some useless data before submit changes.
|
---|
1015 |
|
---|
1016 | @param Private The BMM context data.
|
---|
1017 |
|
---|
1018 | **/
|
---|
1019 | VOID
|
---|
1020 | CleanUselessBeforeSubmit (
|
---|
1021 | IN BMM_CALLBACK_DATA *Private
|
---|
1022 | );
|
---|
1023 |
|
---|
1024 | /**
|
---|
1025 | Dispatch the display to the next page based on NewPageId.
|
---|
1026 |
|
---|
1027 | @param Private The BMM context data.
|
---|
1028 | @param NewPageId The original page ID.
|
---|
1029 |
|
---|
1030 | **/
|
---|
1031 | VOID
|
---|
1032 | UpdatePageId (
|
---|
1033 | BMM_CALLBACK_DATA *Private,
|
---|
1034 | UINT16 NewPageId
|
---|
1035 | );
|
---|
1036 |
|
---|
1037 | /**
|
---|
1038 | Remove the installed BootMaint and FileExplorer HiiPackages.
|
---|
1039 |
|
---|
1040 | **/
|
---|
1041 | VOID
|
---|
1042 | FreeBMPackage(
|
---|
1043 | VOID
|
---|
1044 | );
|
---|
1045 |
|
---|
1046 | /**
|
---|
1047 | Install BootMaint and FileExplorer HiiPackages.
|
---|
1048 |
|
---|
1049 | **/
|
---|
1050 | VOID
|
---|
1051 | InitBootMaintenance(
|
---|
1052 | VOID
|
---|
1053 | );
|
---|
1054 |
|
---|
1055 | /**
|
---|
1056 |
|
---|
1057 | Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
|
---|
1058 | in BMM_FAKE_NV_DATA structure.
|
---|
1059 |
|
---|
1060 | @param CallbackData The BMM context data.
|
---|
1061 |
|
---|
1062 | **/
|
---|
1063 | VOID
|
---|
1064 | GetConsoleInCheck (
|
---|
1065 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1066 | );
|
---|
1067 |
|
---|
1068 | /**
|
---|
1069 |
|
---|
1070 | Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
|
---|
1071 | in BMM_FAKE_NV_DATA structure.
|
---|
1072 |
|
---|
1073 | @param CallbackData The BMM context data.
|
---|
1074 |
|
---|
1075 | **/
|
---|
1076 | VOID
|
---|
1077 | GetConsoleOutCheck (
|
---|
1078 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1079 | );
|
---|
1080 |
|
---|
1081 | /**
|
---|
1082 |
|
---|
1083 | Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
|
---|
1084 | in BMM_FAKE_NV_DATA structure.
|
---|
1085 |
|
---|
1086 | @param CallbackData The BMM context data.
|
---|
1087 |
|
---|
1088 | **/
|
---|
1089 | VOID
|
---|
1090 | GetConsoleErrCheck (
|
---|
1091 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1092 | );
|
---|
1093 |
|
---|
1094 | /**
|
---|
1095 |
|
---|
1096 | Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
|
---|
1097 | to BMM_FAKE_NV_DATA structure.
|
---|
1098 |
|
---|
1099 | @param CallbackData The BMM context data.
|
---|
1100 |
|
---|
1101 | **/
|
---|
1102 | VOID
|
---|
1103 | GetTerminalAttribute (
|
---|
1104 | IN BMM_CALLBACK_DATA *CallbackData
|
---|
1105 | );
|
---|
1106 |
|
---|
1107 | /**
|
---|
1108 | This function will change video resolution and text mode
|
---|
1109 | according to defined setup mode or defined boot mode
|
---|
1110 |
|
---|
1111 | @param IsSetupMode Indicate mode is changed to setup mode or boot mode.
|
---|
1112 |
|
---|
1113 | @retval EFI_SUCCESS Mode is changed successfully.
|
---|
1114 | @retval Others Mode failed to be changed.
|
---|
1115 |
|
---|
1116 | **/
|
---|
1117 | EFI_STATUS
|
---|
1118 | BmmSetConsoleMode (
|
---|
1119 | BOOLEAN IsSetupMode
|
---|
1120 | );
|
---|
1121 |
|
---|
1122 |
|
---|
1123 | /**
|
---|
1124 | This function converts an input device structure to a Unicode string.
|
---|
1125 |
|
---|
1126 | @param DevPath A pointer to the device path structure.
|
---|
1127 |
|
---|
1128 | @return A new allocated Unicode string that represents the device path.
|
---|
1129 |
|
---|
1130 | **/
|
---|
1131 | CHAR16 *
|
---|
1132 | UiDevicePathToStr (
|
---|
1133 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
---|
1134 | );
|
---|
1135 |
|
---|
1136 | /**
|
---|
1137 | Extract filename from device path. The returned buffer is allocated using AllocateCopyPool.
|
---|
1138 | The caller is responsible for freeing the allocated buffer using FreePool().
|
---|
1139 |
|
---|
1140 | @param DevicePath Device path.
|
---|
1141 |
|
---|
1142 | @return A new allocated string that represents the file name.
|
---|
1143 |
|
---|
1144 | **/
|
---|
1145 | CHAR16 *
|
---|
1146 | ExtractFileNameFromDevicePath (
|
---|
1147 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
1148 | );
|
---|
1149 |
|
---|
1150 | /**
|
---|
1151 | This function allows a caller to extract the current configuration for one
|
---|
1152 | or more named elements from the target driver.
|
---|
1153 |
|
---|
1154 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
---|
1155 | @param Request A null-terminated Unicode string in <ConfigRequest> format.
|
---|
1156 | @param Progress On return, points to a character in the Request string.
|
---|
1157 | Points to the string's null terminator if request was successful.
|
---|
1158 | Points to the most recent '&' before the first failing name/value
|
---|
1159 | pair (or the beginning of the string if the failure is in the
|
---|
1160 | first name/value pair) if the request was not successful.
|
---|
1161 | @param Results A null-terminated Unicode string in <ConfigAltResp> format which
|
---|
1162 | has all values filled in for the names in the Request string.
|
---|
1163 | String to be allocated by the called function.
|
---|
1164 |
|
---|
1165 | @retval EFI_SUCCESS The Results is filled with the requested values.
|
---|
1166 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
|
---|
1167 | @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
|
---|
1168 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
---|
1169 |
|
---|
1170 | **/
|
---|
1171 | EFI_STATUS
|
---|
1172 | EFIAPI
|
---|
1173 | BootMaintExtractConfig (
|
---|
1174 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
1175 | IN CONST EFI_STRING Request,
|
---|
1176 | OUT EFI_STRING *Progress,
|
---|
1177 | OUT EFI_STRING *Results
|
---|
1178 | );
|
---|
1179 |
|
---|
1180 | /**
|
---|
1181 | This function applies changes in a driver's configuration.
|
---|
1182 | Input is a Configuration, which has the routing data for this
|
---|
1183 | driver followed by name / value configuration pairs. The driver
|
---|
1184 | must apply those pairs to its configurable storage. If the
|
---|
1185 | driver's configuration is stored in a linear block of data
|
---|
1186 | and the driver's name / value pairs are in <BlockConfig>
|
---|
1187 | format, it may use the ConfigToBlock helper function (above) to
|
---|
1188 | simplify the job. Currently not implemented.
|
---|
1189 |
|
---|
1190 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
---|
1191 | @param[in] Configuration A null-terminated Unicode string in
|
---|
1192 | <ConfigString> format.
|
---|
1193 | @param[out] Progress A pointer to a string filled in with the
|
---|
1194 | offset of the most recent '&' before the
|
---|
1195 | first failing name / value pair (or the
|
---|
1196 | beginn ing of the string if the failure
|
---|
1197 | is in the first name / value pair) or
|
---|
1198 | the terminating NULL if all was
|
---|
1199 | successful.
|
---|
1200 |
|
---|
1201 | @retval EFI_SUCCESS The results have been distributed or are
|
---|
1202 | awaiting distribution.
|
---|
1203 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
|
---|
1204 | parts of the results that must be
|
---|
1205 | stored awaiting possible future
|
---|
1206 | protocols.
|
---|
1207 | @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
|
---|
1208 | Results parameter would result
|
---|
1209 | in this type of error.
|
---|
1210 | @retval EFI_NOT_FOUND Target for the specified routing data
|
---|
1211 | was not found.
|
---|
1212 | **/
|
---|
1213 | EFI_STATUS
|
---|
1214 | EFIAPI
|
---|
1215 | BootMaintRouteConfig (
|
---|
1216 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
1217 | IN CONST EFI_STRING Configuration,
|
---|
1218 | OUT EFI_STRING *Progress
|
---|
1219 | );
|
---|
1220 |
|
---|
1221 | /**
|
---|
1222 | This function processes the results of changes in configuration.
|
---|
1223 |
|
---|
1224 |
|
---|
1225 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
---|
1226 | @param Action Specifies the type of action taken by the browser.
|
---|
1227 | @param QuestionId A unique value which is sent to the original exporting driver
|
---|
1228 | so that it can identify the type of data to expect.
|
---|
1229 | @param Type The type of value for the question.
|
---|
1230 | @param Value A pointer to the data being sent to the original exporting driver.
|
---|
1231 | @param ActionRequest On return, points to the action requested by the callback function.
|
---|
1232 |
|
---|
1233 | @retval EFI_SUCCESS The callback successfully handled the action.
|
---|
1234 | @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
---|
1235 | @retval EFI_DEVICE_ERROR The variable could not be saved.
|
---|
1236 | @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
|
---|
1237 | @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
|
---|
1238 | **/
|
---|
1239 | EFI_STATUS
|
---|
1240 | EFIAPI
|
---|
1241 | BootMaintCallback (
|
---|
1242 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
1243 | IN EFI_BROWSER_ACTION Action,
|
---|
1244 | IN EFI_QUESTION_ID QuestionId,
|
---|
1245 | IN UINT8 Type,
|
---|
1246 | IN EFI_IFR_TYPE_VALUE *Value,
|
---|
1247 | OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
---|
1248 | );
|
---|
1249 |
|
---|
1250 | /**
|
---|
1251 | Create boot option base on the input file path info.
|
---|
1252 |
|
---|
1253 | @param FilePath Point to the file path.
|
---|
1254 |
|
---|
1255 | @retval TRUE Exit caller function.
|
---|
1256 | @retval FALSE Not exit caller function.
|
---|
1257 |
|
---|
1258 | **/
|
---|
1259 | BOOLEAN
|
---|
1260 | EFIAPI
|
---|
1261 | CreateBootOptionFromFile (
|
---|
1262 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
---|
1263 | );
|
---|
1264 |
|
---|
1265 | /**
|
---|
1266 | Create driver option base on the input file path info.
|
---|
1267 |
|
---|
1268 | @param FilePath Point to the file path.
|
---|
1269 |
|
---|
1270 | @retval TRUE Exit caller function.
|
---|
1271 | @retval FALSE Not exit caller function.
|
---|
1272 | **/
|
---|
1273 | BOOLEAN
|
---|
1274 | EFIAPI
|
---|
1275 | CreateDriverOptionFromFile (
|
---|
1276 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
---|
1277 | );
|
---|
1278 |
|
---|
1279 | /**
|
---|
1280 | Boot the file specified by the input file path info.
|
---|
1281 |
|
---|
1282 | @param FilePath Point to the file path.
|
---|
1283 |
|
---|
1284 | @retval TRUE Exit caller function.
|
---|
1285 | @retval FALSE Not exit caller function.
|
---|
1286 |
|
---|
1287 | **/
|
---|
1288 | BOOLEAN
|
---|
1289 | EFIAPI
|
---|
1290 | BootFromFile (
|
---|
1291 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
---|
1292 | );
|
---|
1293 |
|
---|
1294 | //
|
---|
1295 | // Global variable in this program (defined in data.c)
|
---|
1296 | //
|
---|
1297 | extern BM_MENU_OPTION BootOptionMenu;
|
---|
1298 | extern BM_MENU_OPTION DriverOptionMenu;
|
---|
1299 | extern BM_MENU_OPTION ConsoleInpMenu;
|
---|
1300 | extern BM_MENU_OPTION ConsoleOutMenu;
|
---|
1301 | extern BM_MENU_OPTION ConsoleErrMenu;
|
---|
1302 | extern BM_MENU_OPTION DriverMenu;
|
---|
1303 | extern BM_MENU_OPTION TerminalMenu;
|
---|
1304 | extern UINT16 TerminalType[5];
|
---|
1305 | extern COM_ATTR BaudRateList[19];
|
---|
1306 | extern COM_ATTR DataBitsList[4];
|
---|
1307 | extern COM_ATTR ParityList[5];
|
---|
1308 | extern COM_ATTR StopBitsList[3];
|
---|
1309 | extern EFI_GUID TerminalTypeGuid[5];
|
---|
1310 | extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
|
---|
1311 | extern UINT16 mFlowControlType[2];
|
---|
1312 | extern UINT32 mFlowControlValue[2];
|
---|
1313 |
|
---|
1314 | //
|
---|
1315 | // Shared IFR form update data
|
---|
1316 | //
|
---|
1317 | extern VOID *mStartOpCodeHandle;
|
---|
1318 | extern VOID *mEndOpCodeHandle;
|
---|
1319 | extern EFI_IFR_GUID_LABEL *mStartLabel;
|
---|
1320 | extern EFI_IFR_GUID_LABEL *mEndLabel;
|
---|
1321 | extern BMM_CALLBACK_DATA gBootMaintenancePrivate;
|
---|
1322 | extern BMM_CALLBACK_DATA *mBmmCallbackInfo;
|
---|
1323 |
|
---|
1324 | #endif
|
---|