]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
Support RouteConfig function for BdsDxe driver.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / BootMaint.h
1 /** @file
2 Header file for boot maintenance module.
3
4 Copyright (c) 2004 - 2014, 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 _BOOT_MAINT_H_
16 #define _BOOT_MAINT_H_
17
18 #include "Bds.h"
19 #include "BBSsupport.h"
20 #include "FormGuid.h"
21 #include "FrontPage.h"
22
23 //
24 // Constants which are variable names used to access variables
25 //
26 #define VAR_CON_OUT_MODE L"ConOutMode"
27
28 //
29 // String Contant
30 //
31 #define STR_FLOPPY L"Floppy Drive #%02x"
32 #define STR_HARDDISK L"HardDisk Drive #%02x"
33 #define STR_CDROM L"ATAPI CDROM Drive #%02x"
34 #define STR_NET L"NET Drive #%02x"
35 #define STR_BEV L"BEV Drive #%02x"
36 #define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
37 #define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
38 #define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
39 #define STR_NET_HELP L"NET Drive #%02x"
40 #define STR_BEV_HELP L"BEV Drive #%02x"
41
42 extern CHAR16 mFileExplorerStorageName[];
43 extern CHAR16 mBootMaintStorageName[];
44 //
45 // These are the VFR compiler generated data representing our VFR data.
46 //
47 extern UINT8 BmBin[];
48 extern UINT8 FEBin[];
49
50 //
51 // Below are the number of options in Baudrate, Databits,
52 // Parity and Stopbits selection for serial ports.
53 //
54 #define BM_COM_ATTR_BUADRATE 19
55 #define BM_COM_ATTR_DATABITS 4
56 #define BM_COM_ATTR_PARITY 5
57 #define BM_COM_ATTR_STOPBITS 3
58
59 //
60 // Callback function helper
61 //
62 #define BMM_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('C', 'b', 'c', 'k')
63 #define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)
64
65 #define FE_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, FeConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)
66
67 //
68 // Enumeration type definition
69 //
70 typedef enum _TYPE_OF_TERMINAL {
71 TerminalTypePcAnsi = 0,
72 TerminalTypeVt100,
73 TerminalTypeVt100Plus,
74 TerminalTypeVtUtf8
75 } TYPE_OF_TERMINAL;
76
77 typedef enum _FILE_EXPLORER_STATE {
78 FileExplorerStateInActive = 0,
79 FileExplorerStateBootFromFile,
80 FileExplorerStateAddBootOption,
81 FileExplorerStateAddDriverOptionState,
82 FileExplorerStateUnknown
83 } FILE_EXPLORER_STATE;
84
85 typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
86 FileExplorerDisplayFileSystem,
87 FileExplorerDisplayDirectory,
88 FileExplorerDisplayUnknown
89 } FILE_EXPLORER_DISPLAY_CONTEXT;
90
91 //
92 // All of the signatures that will be used in list structure
93 //
94 #define BM_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
95 #define BM_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('l', 'o', 'a', 'd')
96 #define BM_CONSOLE_OPTION_SIGNATURE SIGNATURE_32 ('c', 'n', 's', 'l')
97 #define BM_FILE_OPTION_SIGNATURE SIGNATURE_32 ('f', 'i', 'l', 'e')
98 #define BM_HANDLE_OPTION_SIGNATURE SIGNATURE_32 ('h', 'n', 'd', 'l')
99 #define BM_TERMINAL_OPTION_SIGNATURE SIGNATURE_32 ('t', 'r', 'm', 'l')
100 #define BM_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
101
102 #define BM_LOAD_CONTEXT_SELECT 0x0
103 #define BM_CONSOLE_CONTEXT_SELECT 0x1
104 #define BM_FILE_CONTEXT_SELECT 0x2
105 #define BM_HANDLE_CONTEXT_SELECT 0x3
106 #define BM_TERMINAL_CONTEXT_SELECT 0x5
107
108 #define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
109 #define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
110 #define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
111 #define BM_LEGACY_DEV_CONTEXT_SELECT 0x9
112
113 //
114 // Buffer size for update data
115 //
116 #define UPDATE_DATA_SIZE 0x100000
117
118 //
119 // Namespace of callback keys used in display and file system navigation
120 //
121 #define MAX_BBS_OFFSET 0xE000
122 #define NET_OPTION_OFFSET 0xD800
123 #define BEV_OPTION_OFFSET 0xD000
124 #define FD_OPTION_OFFSET 0xC000
125 #define HD_OPTION_OFFSET 0xB000
126 #define CD_OPTION_OFFSET 0xA000
127 #define FILE_OPTION_GOTO_OFFSET 0xC000
128 #define FILE_OPTION_OFFSET 0x8000
129 #define FILE_OPTION_MASK 0x3FFF
130 #define HANDLE_OPTION_OFFSET 0x7000
131 #define CONSOLE_OPTION_OFFSET 0x6000
132 #define TERMINAL_OPTION_OFFSET 0x5000
133 #define CONFIG_OPTION_OFFSET 0x1200
134 #define KEY_VALUE_OFFSET 0x1100
135 #define FORM_ID_OFFSET 0x1000
136
137 //
138 // VarOffset that will be used to create question
139 // all these values are computed from the structure
140 // defined below
141 //
142 #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field)))
143
144 //
145 // Question Id of Zero is invalid, so add an offset to it
146 //
147 #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
148
149 #define BOOT_TIME_OUT_VAR_OFFSET VAR_OFFSET (BootTimeOut)
150 #define BOOT_NEXT_VAR_OFFSET VAR_OFFSET (BootNext)
151 #define COM1_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM1BaudRate)
152 #define COM1_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM1DataRate)
153 #define COM1_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM1StopBits)
154 #define COM1_PARITY_VAR_OFFSET VAR_OFFSET (COM1Parity)
155 #define COM1_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
156 #define COM2_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM2BaudRate)
157 #define COM2_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM2DataRate)
158 #define COM2_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM2StopBits)
159 #define COM2_PARITY_VAR_OFFSET VAR_OFFSET (COM2Parity)
160 #define COM2_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)
161 #define DRV_ADD_HANDLE_DESC_VAR_OFFSET VAR_OFFSET (DriverAddHandleDesc)
162 #define DRV_ADD_ACTIVE_VAR_OFFSET VAR_OFFSET (DriverAddActive)
163 #define DRV_ADD_RECON_VAR_OFFSET VAR_OFFSET (DriverAddForceReconnect)
164 #define CON_IN_COM1_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM1)
165 #define CON_IN_COM2_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM2)
166 #define CON_OUT_COM1_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM1)
167 #define CON_OUT_COM2_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM2)
168 #define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
169 #define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
170 #define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
171 #define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
172 #define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
173 #define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)
174 #define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
175 #define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
176 #define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
177 #define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)
178 #define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
179 #define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
180 #define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)
181 #define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
182 #define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
183 #define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
184 #define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
185 #define LEGACY_FD_VAR_OFFSET VAR_OFFSET (LegacyFD)
186 #define LEGACY_HD_VAR_OFFSET VAR_OFFSET (LegacyHD)
187 #define LEGACY_CD_VAR_OFFSET VAR_OFFSET (LegacyCD)
188 #define LEGACY_NET_VAR_OFFSET VAR_OFFSET (LegacyNET)
189 #define LEGACY_BEV_VAR_OFFSET VAR_OFFSET (LegacyBEV)
190
191 #define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
192 #define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
193 #define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
194 #define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
195 #define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
196 #define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
197 #define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
198 #define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
199 #define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
200 #define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
201 #define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
202 #define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
203 #define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
204 #define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
205 #define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
206 #define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
207 #define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
208 #define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
209 #define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
210 #define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
211 #define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
212 #define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
213 #define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
214 #define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
215 #define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)
216 #define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
217 #define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
218 #define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
219 #define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
220 #define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
221 #define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
222 #define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
223 #define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
224 #define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
225 #define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
226 #define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
227 #define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
228 #define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
229 #define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
230 #define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
231 #define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
232
233 #define STRING_DEPOSITORY_NUMBER 8
234
235 ///
236 /// Serial Ports attributes, first one is the value for
237 /// return from callback function, stringtoken is used to
238 /// display the value properly
239 ///
240 typedef struct {
241 UINTN Value;
242 UINT16 StringToken;
243 } COM_ATTR;
244
245 typedef struct {
246 UINT64 BaudRate;
247 UINT8 DataBits;
248 UINT8 Parity;
249 UINT8 StopBits;
250
251 UINT8 BaudRateIndex;
252 UINT8 DataBitsIndex;
253 UINT8 ParityIndex;
254 UINT8 StopBitsIndex;
255
256 UINT8 FlowControl;
257
258 UINT8 IsConIn;
259 UINT8 IsConOut;
260 UINT8 IsStdErr;
261 UINT8 TerminalType;
262
263 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
264 } BM_TERMINAL_CONTEXT;
265
266 typedef struct {
267 BOOLEAN IsBootNext;
268 BOOLEAN LoadOptionModified;
269 BOOLEAN Deleted;
270
271 BOOLEAN IsLegacy;
272 BOOLEAN IsActive;
273 BOOLEAN ForceReconnect;
274 UINTN OptionalDataSize;
275
276 UINTN LoadOptionSize;
277 UINT8 *LoadOption;
278
279 UINT32 Attributes;
280 UINT16 FilePathListLength;
281 UINT16 *Description;
282 EFI_DEVICE_PATH_PROTOCOL *FilePathList;
283 UINT8 *OptionalData;
284
285 UINT16 BbsIndex;
286 } BM_LOAD_CONTEXT;
287
288 typedef struct {
289 BBS_TABLE *BbsEntry;
290 UINT16 BbsIndex;
291 UINT16 BbsCount;
292 CHAR16 *Description;
293 } BM_LEGACY_DEVICE_CONTEXT;
294
295 typedef struct {
296
297 BOOLEAN IsActive;
298
299 BOOLEAN IsTerminal;
300
301 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
302 } BM_CONSOLE_CONTEXT;
303
304 typedef struct {
305 UINTN Column;
306 UINTN Row;
307 } CONSOLE_OUT_MODE;
308
309 typedef struct {
310 EFI_HANDLE Handle;
311 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
312 EFI_FILE_HANDLE FHandle;
313 UINT16 *FileName;
314 EFI_FILE_SYSTEM_VOLUME_LABEL *Info;
315
316 BOOLEAN IsRoot;
317 BOOLEAN IsDir;
318 BOOLEAN IsRemovableMedia;
319 BOOLEAN IsLoadFile;
320 BOOLEAN IsBootLegacy;
321 } BM_FILE_CONTEXT;
322
323 typedef struct {
324 EFI_HANDLE Handle;
325 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
326 } BM_HANDLE_CONTEXT;
327
328 typedef struct {
329 UINTN Signature;
330 LIST_ENTRY Head;
331 UINTN MenuNumber;
332 } BM_MENU_OPTION;
333
334 typedef struct {
335 UINTN Signature;
336 LIST_ENTRY Link;
337 UINTN OptionNumber;
338 UINT16 *DisplayString;
339 UINT16 *HelpString;
340 EFI_STRING_ID DisplayStringToken;
341 EFI_STRING_ID HelpStringToken;
342 UINTN ContextSelection;
343 VOID *VariableContext;
344 } BM_MENU_ENTRY;
345
346 typedef struct {
347 //
348 // Shared callback data.
349 //
350 UINTN Signature;
351
352 BM_MENU_ENTRY *MenuEntry;
353 BM_HANDLE_CONTEXT *HandleContext;
354 BM_FILE_CONTEXT *FileContext;
355 BM_LOAD_CONTEXT *LoadContext;
356 BM_TERMINAL_CONTEXT *TerminalContext;
357 UINTN CurrentTerminal;
358 BBS_TYPE BbsType;
359
360 //
361 // BMM main formset callback data.
362 //
363 EFI_HII_HANDLE BmmHiiHandle;
364 EFI_HANDLE BmmDriverHandle;
365 EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess;
366 EFI_FORM_ID BmmCurrentPageId;
367 EFI_FORM_ID BmmPreviousPageId;
368 BOOLEAN BmmAskSaveOrNot;
369 BMM_FAKE_NV_DATA BmmFakeNvData;
370 BMM_FAKE_NV_DATA BmmOldFakeNVData;
371
372 //
373 // File explorer formset callback data.
374 //
375 EFI_HII_HANDLE FeHiiHandle;
376 EFI_HANDLE FeDriverHandle;
377 EFI_HII_CONFIG_ACCESS_PROTOCOL FeConfigAccess;
378 FILE_EXPLORER_STATE FeCurrentState;
379 FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext;
380 FILE_EXPLORER_NV_DATA FeFakeNvData;
381 } BMM_CALLBACK_DATA;
382
383 typedef struct _STRING_LIST_NODE STRING_LIST_NODE;
384
385 struct _STRING_LIST_NODE {
386 EFI_STRING_ID StringToken;
387 STRING_LIST_NODE *Next;
388 };
389
390 typedef struct _STRING_DEPOSITORY {
391 UINTN TotalNodeNumber;
392 STRING_LIST_NODE *CurrentNode;
393 STRING_LIST_NODE *ListHead;
394 } STRING_DEPOSITORY;
395
396 //
397 // #pragma pack()
398 //
399 // For initializing File System menu
400 //
401
402 /**
403 This function build the FsOptionMenu list which records all
404 available file system in the system. They includes all instances
405 of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM
406 and all type of legacy boot device.
407
408 @param CallbackData BMM context data
409
410 @retval EFI_SUCCESS Success find the file system
411 @retval EFI_OUT_OF_RESOURCES Can not create menu entry
412
413 **/
414 EFI_STATUS
415 BOpt_FindFileSystem (
416 IN BMM_CALLBACK_DATA *CallbackData
417 );
418
419 /**
420 Find files under current directory
421 All files and sub-directories in current directory
422 will be stored in DirectoryMenu for future use.
423
424 @param CallbackData The BMM context data.
425 @param MenuEntry The Menu Entry.
426
427 @retval EFI_SUCCESS Get files from current dir successfully.
428 @return Other value if can't get files from current dir.
429
430 **/
431 EFI_STATUS
432 BOpt_FindFiles (
433 IN BMM_CALLBACK_DATA *CallbackData,
434 IN BM_MENU_ENTRY *MenuEntry
435 );
436
437 /**
438
439 Find drivers that will be added as Driver#### variables from handles
440 in current system environment
441 All valid handles in the system except those consume SimpleFs, LoadFile
442 are stored in DriverMenu for future use.
443
444 @retval EFI_SUCCESS The function complets successfully.
445 @return Other value if failed to build the DriverMenu.
446
447 **/
448 EFI_STATUS
449 BOpt_FindDrivers (
450 VOID
451 );
452
453 /**
454
455 Build the BootOptionMenu according to BootOrder Variable.
456 This Routine will access the Boot#### to get EFI_LOAD_OPTION.
457
458 @param CallbackData The BMM context data.
459
460 @return The number of the Var Boot####.
461
462 **/
463 EFI_STATUS
464 BOpt_GetBootOptions (
465 IN BMM_CALLBACK_DATA *CallbackData
466 );
467
468 /**
469
470 Build up all DriverOptionMenu
471
472 @param CallbackData The BMM context data.
473
474 @return EFI_SUCESS The functin completes successfully.
475 @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.
476
477
478 **/
479 EFI_STATUS
480 BOpt_GetDriverOptions (
481 IN BMM_CALLBACK_DATA *CallbackData
482 );
483
484
485 /**
486 Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().
487
488 @retval EFI_SUCCESS The function complete successfully.
489 @retval EFI_OUT_OF_RESOURCES No enough memory to complete this function.
490
491 **/
492 EFI_STATUS
493 BOpt_GetLegacyOptions (
494 VOID
495 );
496
497 /**
498 Free out resouce allocated from Legacy Boot Options.
499
500 **/
501 VOID
502 BOpt_FreeLegacyOptions (
503 VOID
504 );
505
506 /**
507 Free resources allocated in Allocate Rountine.
508
509 @param FreeMenu Menu to be freed
510
511 **/
512 VOID
513 BOpt_FreeMenu (
514 BM_MENU_OPTION *FreeMenu
515 );
516
517
518 /**
519
520 Append file name to existing file name.
521
522 @param Str1 The existing file name
523 @param Str2 The file name to be appended
524
525 @return Allocate a new string to hold the appended result.
526 Caller is responsible to free the returned string.
527
528 **/
529 CHAR16*
530 BOpt_AppendFileName (
531 IN CHAR16 *Str1,
532 IN CHAR16 *Str2
533 );
534
535 /**
536
537 Check whether current FileName point to a valid
538 Efi Image File.
539
540 @param FileName File need to be checked.
541
542 @retval TRUE Is Efi Image
543 @retval FALSE Not a valid Efi Image
544
545 **/
546 BOOLEAN
547 BOpt_IsEfiImageName (
548 IN UINT16 *FileName
549 );
550
551 /**
552
553 Check whether current FileName point to a valid Efi Application
554
555 @param Dir Pointer to current Directory
556 @param FileName Pointer to current File name.
557
558 @retval TRUE Is a valid Efi Application
559 @retval FALSE not a valid Efi Application
560
561 **/
562 BOOLEAN
563 BOpt_IsEfiApp (
564 IN EFI_FILE_HANDLE Dir,
565 IN UINT16 *FileName
566 );
567
568 /**
569
570 Get the Option Number that has not been allocated for use.
571
572 @param Type The type of Option.
573
574 @return The available Option Number.
575
576 **/
577 UINT16
578 BOpt_GetOptionNumber (
579 CHAR16 *Type
580 );
581
582 /**
583
584 Get the Option Number for Boot#### that does not used.
585
586 @return The available Option Number.
587
588 **/
589 UINT16
590 BOpt_GetBootOptionNumber (
591 VOID
592 );
593
594 /**
595
596 Get the Option Number for Driver#### that does not used.
597
598 @return The unused Option Number.
599
600 **/
601 UINT16
602 BOpt_GetDriverOptionNumber (
603 VOID
604 );
605
606 /**
607 Create a menu entry give a Menu type.
608
609 @param MenuType The Menu type to be created.
610
611
612 @retval NULL If failed to create the menu.
613 @return The menu.
614
615 **/
616 BM_MENU_ENTRY *
617 BOpt_CreateMenuEntry (
618 UINTN MenuType
619 );
620
621 /**
622 Free up all resource allocated for a BM_MENU_ENTRY.
623
624 @param MenuEntry A pointer to BM_MENU_ENTRY.
625
626 **/
627 VOID
628 BOpt_DestroyMenuEntry (
629 BM_MENU_ENTRY *MenuEntry
630 );
631
632 /**
633 Get the Menu Entry from the list in Menu Entry List.
634
635 If MenuNumber is great or equal to the number of Menu
636 Entry in the list, then ASSERT.
637
638 @param MenuOption The Menu Entry List to read the menu entry.
639 @param MenuNumber The index of Menu Entry.
640
641 @return The Menu Entry.
642
643 **/
644 BM_MENU_ENTRY *
645 BOpt_GetMenuEntry (
646 BM_MENU_OPTION *MenuOption,
647 UINTN MenuNumber
648 );
649
650 //
651 // Locate all serial io devices for console
652 //
653 /**
654 Build a list containing all serial devices.
655
656 @retval EFI_SUCCESS The function complete successfully.
657 @retval EFI_UNSUPPORTED No serial ports present.
658
659 **/
660 EFI_STATUS
661 LocateSerialIo (
662 VOID
663 );
664
665 //
666 // Initializing Console menu
667 //
668 /**
669 Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
670
671 @retval EFI_SUCCESS The function always complete successfully.
672
673 **/
674 EFI_STATUS
675 GetAllConsoles(
676 VOID
677 );
678
679 //
680 // Get current mode information
681 //
682 /**
683 Get mode number according to column and row
684
685 @param CallbackData The BMM context data.
686 **/
687 VOID
688 GetConsoleOutMode (
689 IN BMM_CALLBACK_DATA *CallbackData
690 );
691
692 //
693 // Cleaning up console menu
694 //
695 /**
696 Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
697
698 @retval EFI_SUCCESS The function always complete successfully.
699 **/
700 EFI_STATUS
701 FreeAllConsoles (
702 VOID
703 );
704
705 /**
706 Update the device path that describing a terminal device
707 based on the new BaudRate, Data Bits, parity and Stop Bits
708 set.
709
710 @param DevicePath The devicepath protocol instance wanted to be updated.
711
712 **/
713 VOID
714 ChangeVariableDevicePath (
715 IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath
716 );
717
718 /**
719 Update the multi-instance device path of Terminal Device based on
720 the global TerminalMenu. If ChangeTernimal is TRUE, the terminal
721 device path in the Terminal Device in TerminalMenu is also updated.
722
723 @param DevicePath The multi-instance device path.
724 @param ChangeTerminal TRUE, then device path in the Terminal Device
725 in TerminalMenu is also updated; FALSE, no update.
726
727 @return EFI_SUCCESS The function completes successfully.
728
729 **/
730 EFI_STATUS
731 ChangeTerminalDevicePath (
732 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
733 IN BOOLEAN ChangeTerminal
734 );
735
736 //
737 // Variable operation by menu selection
738 //
739 /**
740 This function create a currently loaded Boot Option from
741 the BMM. It then appends this Boot Option to the end of
742 the "BootOrder" list. It also append this Boot Opotion to the end
743 of BootOptionMenu.
744
745 @param CallbackData The BMM context data.
746 @param NvRamMap The file explorer formset internal state.
747
748 @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
749 @retval EFI_SUCCESS If function completes successfully.
750
751 **/
752 EFI_STATUS
753 Var_UpdateBootOption (
754 IN BMM_CALLBACK_DATA *CallbackData,
755 IN FILE_EXPLORER_NV_DATA *NvRamMap
756 );
757
758 /**
759 Delete Boot Option that represent a Deleted state in BootOptionMenu.
760 After deleting this boot option, call Var_ChangeBootOrder to
761 make sure BootOrder is in valid state.
762
763 @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to
764 BM_LOAD_CONTEXT marked for deletion is deleted
765 @return Others If failed to update the "BootOrder" variable after deletion.
766
767 **/
768 EFI_STATUS
769 Var_DelBootOption (
770 VOID
771 );
772
773 /**
774 After any operation on Boot####, there will be a discrepancy in BootOrder.
775 Since some are missing but in BootOrder, while some are present but are
776 not reflected by BootOrder. Then a function rebuild BootOrder from
777 scratch by content from BootOptionMenu is needed.
778
779 @retval EFI_SUCCESS The boot order is updated successfully.
780 @return other than EFI_SUCCESS if failed to change the "BootOrder" EFI Variable.
781
782 **/
783 EFI_STATUS
784 Var_ChangeBootOrder (
785 VOID
786 );
787
788 /**
789 This function create a currently loaded Drive Option from
790 the BMM. It then appends this Driver Option to the end of
791 the "DriverOrder" list. It append this Driver Opotion to the end
792 of DriverOptionMenu.
793
794 @param CallbackData The BMM context data.
795 @param HiiHandle The HII handle associated with the BMM formset.
796 @param DescriptionData The description of this driver option.
797 @param OptionalData The optional load option.
798 @param ForceReconnect If to force reconnect.
799
800 @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.
801 @retval EFI_SUCCESS If function completes successfully.
802
803 **/
804 EFI_STATUS
805 Var_UpdateDriverOption (
806 IN BMM_CALLBACK_DATA *CallbackData,
807 IN EFI_HII_HANDLE HiiHandle,
808 IN UINT16 *DescriptionData,
809 IN UINT16 *OptionalData,
810 IN UINT8 ForceReconnect
811 );
812
813 /**
814 Delete Load Option that represent a Deleted state in BootOptionMenu.
815 After deleting this Driver option, call Var_ChangeDriverOrder to
816 make sure DriverOrder is in valid state.
817
818 @retval EFI_SUCCESS Load Option is successfully updated.
819 @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI
820 Variable.
821
822 **/
823 EFI_STATUS
824 Var_DelDriverOption (
825 VOID
826 );
827
828 /**
829 After any operation on Driver####, there will be a discrepancy in
830 DriverOrder. Since some are missing but in DriverOrder, while some
831 are present but are not reflected by DriverOrder. Then a function
832 rebuild DriverOrder from scratch by content from DriverOptionMenu is
833 needed.
834
835 @retval EFI_SUCCESS The driver order is updated successfully.
836 @return other than EFI_SUCCESS if failed to set the "DriverOrder" EFI Variable.
837
838 **/
839 EFI_STATUS
840 Var_ChangeDriverOrder (
841 VOID
842 );
843
844 /**
845 This function delete and build multi-instance device path ConIn
846 console device.
847
848 @retval EFI_SUCCESS The function complete successfully.
849 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
850 **/
851 EFI_STATUS
852 Var_UpdateConsoleInpOption (
853 VOID
854 );
855
856 /**
857 This function delete and build multi-instance device path ConOut console device.
858
859 @retval EFI_SUCCESS The function complete successfully.
860 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
861 **/
862 EFI_STATUS
863 Var_UpdateConsoleOutOption (
864 VOID
865 );
866
867 /**
868 This function delete and build multi-instance device path ErrOut console device.
869
870 @retval EFI_SUCCESS The function complete successfully.
871 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
872 **/
873 EFI_STATUS
874 Var_UpdateErrorOutOption (
875 VOID
876 );
877
878 /**
879 Update the device path of "ConOut", "ConIn" and "ErrOut" based on the new BaudRate, Data Bits,
880 parity and stop Bits set.
881
882 **/
883 VOID
884 Var_UpdateAllConsoleOption (
885 VOID
886 );
887
888 /**
889 This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM,
890 this EFI Variable is deleted.
891 It also update the BMM context data specified the "BootNext" value.
892
893 @param CallbackData The BMM context data.
894
895 @retval EFI_SUCCESS The function complete successfully.
896 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
897
898 **/
899 EFI_STATUS
900 Var_UpdateBootNext (
901 IN BMM_CALLBACK_DATA *CallbackData
902 );
903
904 /**
905 This function update the "BootOrder" EFI Variable based on BMM Formset's NV map. It then refresh
906 BootOptionMenu with the new "BootOrder" list.
907
908 @param CallbackData The BMM context data.
909
910 @retval EFI_SUCCESS The function complete successfully.
911 @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
912 @return not The EFI variable can not be saved. See gRT->SetVariable for detail return information.
913
914 **/
915 EFI_STATUS
916 Var_UpdateBootOrder (
917 IN BMM_CALLBACK_DATA *CallbackData
918 );
919
920 /**
921 This function update the "DriverOrder" EFI Variable based on
922 BMM Formset's NV map. It then refresh DriverOptionMenu
923 with the new "DriverOrder" list.
924
925 @param CallbackData The BMM context data.
926
927 @retval EFI_SUCCESS The function complete successfully.
928 @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.
929 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.
930
931 **/
932 EFI_STATUS
933 Var_UpdateDriverOrder (
934 IN BMM_CALLBACK_DATA *CallbackData
935 );
936
937 /**
938 Update the legacy BBS boot option. VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable
939 is udpated with the new Legacy Boot order. The EFI Variable of "Boot####" and gEfiGlobalVariableGuid
940 is also updated.
941
942 @param CallbackData The context data for BMM.
943
944 @return EFI_SUCCESS The function completed successfully.
945 @retval EFI_NOT_FOUND If VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found.
946
947 **/
948 EFI_STATUS
949 Var_UpdateBBSOption (
950 IN BMM_CALLBACK_DATA *CallbackData,
951 IN EFI_FORM_ID FormId
952 );
953
954 /**
955 Update the Text Mode of Console.
956
957 @param CallbackData The context data for BMM.
958
959 @retval EFI_SUCCSS If the Text Mode of Console is updated.
960 @return Other value if the Text Mode of Console is not updated.
961
962 **/
963 EFI_STATUS
964 Var_UpdateConMode (
965 IN BMM_CALLBACK_DATA *CallbackData
966 );
967
968 //
969 // Following are page create and refresh functions
970 //
971 /**
972 Refresh the global UpdateData structure.
973
974 **/
975 VOID
976 RefreshUpdateData (
977 VOID
978 );
979
980 /**
981 Clean up the dynamic opcode at label and form specified by
982 both LabelId.
983
984 @param LabelId It is both the Form ID and Label ID for
985 opcode deletion.
986 @param CallbackData The BMM context data.
987
988 **/
989 VOID
990 CleanUpPage (
991 IN UINT16 LabelId,
992 IN BMM_CALLBACK_DATA *CallbackData
993 );
994
995 /**
996 Create a lit of boot option from global BootOptionMenu. It
997 allow user to delete the boot option.
998
999 @param CallbackData The BMM context data.
1000
1001 **/
1002 VOID
1003 UpdateBootDelPage (
1004 IN BMM_CALLBACK_DATA *CallbackData
1005 );
1006
1007 /**
1008 Create a lit of driver option from global DriverMenu.
1009
1010 @param CallbackData The BMM context data.
1011 **/
1012 VOID
1013 UpdateDrvAddHandlePage (
1014 IN BMM_CALLBACK_DATA *CallbackData
1015 );
1016
1017 /**
1018 Create a lit of driver option from global DriverOptionMenu. It
1019 allow user to delete the driver option.
1020
1021 @param CallbackData The BMM context data.
1022 **/
1023 VOID
1024 UpdateDrvDelPage (
1025 IN BMM_CALLBACK_DATA *CallbackData
1026 );
1027
1028 /**
1029 Prepare the page to allow user to add description for a Driver Option.
1030
1031 @param CallbackData The BMM context data.
1032 **/
1033 VOID
1034 UpdateDriverAddHandleDescPage (
1035 IN BMM_CALLBACK_DATA *CallbackData
1036 );
1037
1038 /**
1039 Dispatch the correct update page function to call based on the UpdatePageId.
1040
1041 @param UpdatePageId The form ID.
1042 @param CallbackData The BMM context data.
1043 **/
1044 VOID
1045 UpdatePageBody (
1046 IN UINT16 UpdatePageId,
1047 IN BMM_CALLBACK_DATA *CallbackData
1048 );
1049
1050 /**
1051 Create the dynamic page to allow user to set the "BootNext" vaule.
1052
1053 @param CallbackData The BMM context data.
1054 **/
1055 VOID
1056 UpdateBootNextPage (
1057 IN BMM_CALLBACK_DATA *CallbackData
1058 );
1059
1060 /**
1061 Create the dynamic page to allow user to set the "TimeOut" vaule.
1062
1063 @param CallbackData The BMM context data.
1064 **/
1065 VOID
1066 UpdateTimeOutPage (
1067 IN BMM_CALLBACK_DATA *CallbackData
1068 );
1069
1070 /**
1071 Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
1072 Parity, Stop Bits, Terminal Type.
1073
1074 @param CallbackData The BMM context data.
1075 **/
1076 VOID
1077 UpdateTerminalPage (
1078 IN BMM_CALLBACK_DATA *CallbackData
1079 );
1080
1081 /**
1082 Refresh the text mode page
1083
1084 @param CallbackData The BMM context data.
1085 **/
1086 VOID
1087 UpdateConModePage (
1088 IN BMM_CALLBACK_DATA *CallbackData
1089 );
1090
1091 /**
1092 Create a list of Goto Opcode for all terminal devices logged
1093 by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
1094
1095 @param CallbackData The BMM context data.
1096 **/
1097 VOID
1098 UpdateConCOMPage (
1099 IN BMM_CALLBACK_DATA *CallbackData
1100 );
1101
1102 /**
1103 Create a dynamic page so that Legacy Device boot order
1104 can be set for specified device type.
1105
1106 @param UpdatePageId The form ID. It also spefies the legacy device type.
1107 @param CallbackData The BMM context data.
1108 **/
1109 VOID
1110 UpdateSetLegacyDeviceOrderPage (
1111 IN UINT16 UpdatePageId,
1112 IN BMM_CALLBACK_DATA *CallbackData
1113 );
1114
1115
1116 /**
1117 Function opens and returns a file handle to the root directory of a volume.
1118
1119 @param DeviceHandle A handle for a device
1120 @return A valid file handle or NULL is returned
1121 **/
1122 EFI_FILE_HANDLE
1123 EfiLibOpenRoot (
1124 IN EFI_HANDLE DeviceHandle
1125 );
1126
1127 /**
1128 Function gets the file system information from an open file descriptor,
1129 and stores it in a buffer allocated from pool.
1130
1131 @param FHand The file handle.
1132
1133 @return A pointer to a buffer with file information.
1134 NULL is returned if failed to get Vaolume Label Info.
1135 **/
1136 EFI_FILE_SYSTEM_VOLUME_LABEL *
1137 EfiLibFileSystemVolumeLabelInfo (
1138 IN EFI_FILE_HANDLE FHand
1139 );
1140
1141 /**
1142
1143 Function gets the file information from an open file descriptor, and stores it
1144 in a buffer allocated from pool.
1145
1146 @param FHand File Handle.
1147
1148 @return A pointer to a buffer with file information or NULL is returned
1149
1150 **/
1151 EFI_FILE_INFO *
1152 EfiLibFileInfo (
1153 IN EFI_FILE_HANDLE FHand
1154 );
1155
1156 /**
1157 Adjusts the size of a previously allocated buffer.
1158
1159 @param OldPool A pointer to the buffer whose size is being adjusted.
1160 @param OldSize The size of the current buffer.
1161 @param NewSize The size of the new buffer.
1162
1163 @return The newly allocated buffer. if NULL, allocation failed.
1164
1165 **/
1166 VOID*
1167 EfiReallocatePool (
1168 IN VOID *OldPool,
1169 IN UINTN OldSize,
1170 IN UINTN NewSize
1171 );
1172
1173 /**
1174 Function deletes the variable specified by VarName and VarGuid.
1175
1176
1177 @param VarName A Null-terminated Unicode string that is
1178 the name of the vendor's variable.
1179
1180 @param VarGuid A unique identifier for the vendor.
1181
1182 @retval EFI_SUCCESS The variable was found and removed
1183 @retval EFI_UNSUPPORTED The variable store was inaccessible
1184 @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
1185 @retval EFI_NOT_FOUND The variable was not found
1186
1187 **/
1188 EFI_STATUS
1189 EfiLibDeleteVariable (
1190 IN CHAR16 *VarName,
1191 IN EFI_GUID *VarGuid
1192 );
1193
1194 /**
1195 Duplicate a string.
1196
1197 @param Src The source.
1198
1199 @return A new string which is duplicated copy of the source.
1200 @retval NULL If there is not enough memory.
1201
1202 **/
1203 CHAR16 *
1204 EfiStrDuplicate (
1205 IN CHAR16 *Src
1206 );
1207
1208 /**
1209 Function is used to determine the number of device path instances
1210 that exist in a device path.
1211
1212
1213 @param DevicePath A pointer to a device path data structure.
1214
1215 @return This function counts and returns the number of device path instances
1216 in DevicePath.
1217
1218 **/
1219 UINTN
1220 EfiDevicePathInstanceCount (
1221 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1222 );
1223
1224 /**
1225 Create string tokens for a menu from its help strings and display strings
1226
1227
1228 @param CallbackData The BMM context data.
1229 @param HiiHandle Hii Handle of the package to be updated.
1230 @param MenuOption The Menu whose string tokens need to be created
1231
1232 @retval EFI_SUCCESS string tokens created successfully
1233 @retval others contain some errors
1234
1235 **/
1236 EFI_STATUS
1237 CreateMenuStringToken (
1238 IN BMM_CALLBACK_DATA *CallbackData,
1239 IN EFI_HII_HANDLE HiiHandle,
1240 IN BM_MENU_OPTION *MenuOption
1241 );
1242
1243 /**
1244 Get a string from the Data Hub record based on
1245 a device path.
1246
1247 @param DevPath The device Path.
1248
1249 @return A string located from the Data Hub records based on
1250 the device path.
1251 @retval NULL If failed to get the String from Data Hub.
1252
1253 **/
1254 UINT16 *
1255 EfiLibStrFromDatahub (
1256 IN EFI_DEVICE_PATH_PROTOCOL *DevPath
1257 );
1258
1259 /**
1260 Initialize the Boot Maintenance Utitliy.
1261
1262 @retval EFI_SUCCESS utility ended successfully.
1263 @retval others contain some errors.
1264
1265 **/
1266 EFI_STATUS
1267 InitializeBM (
1268 VOID
1269 );
1270
1271 /**
1272 Start boot maintenance manager
1273
1274 @retval EFI_SUCCESS If BMM is invoked successfully.
1275 @return Other value if BMM return unsuccessfully.
1276
1277 **/
1278 EFI_STATUS
1279 BdsStartBootMaint (
1280 VOID
1281 );
1282
1283 /**
1284 Intialize all the string depositories.
1285
1286 **/
1287 VOID
1288 InitializeStringDepository (
1289 VOID
1290 );
1291
1292 /**
1293 Fetch a usable string node from the string depository and return the string token.
1294
1295
1296 @param CallbackData The BMM context data.
1297 @param StringDepository Pointer of the string depository.
1298
1299 @retval EFI_STRING_ID String token.
1300
1301 **/
1302 EFI_STRING_ID
1303 GetStringTokenFromDepository (
1304 IN BMM_CALLBACK_DATA *CallbackData,
1305 IN STRING_DEPOSITORY *StringDepository
1306 );
1307
1308 /**
1309 Reclaim string depositories by moving the current node pointer to list head..
1310 **/
1311 VOID
1312 ReclaimStringDepository (
1313 VOID
1314 );
1315
1316 /**
1317 Release resource for all the string depositories.
1318
1319 **/
1320 VOID
1321 CleanUpStringDepository (
1322 VOID
1323 );
1324
1325 /**
1326 Function handling request to apply changes for BMM pages.
1327
1328 @param Private Pointer to callback data buffer.
1329 @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
1330 @param FormId ID of the form which has sent the request to apply change.
1331
1332 @retval EFI_SUCCESS Change successfully applied.
1333 @retval Other Error occurs while trying to apply changes.
1334
1335 **/
1336 EFI_STATUS
1337 ApplyChangeHandler (
1338 IN BMM_CALLBACK_DATA *Private,
1339 IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
1340 IN EFI_FORM_ID FormId
1341 );
1342
1343 /**
1344 Discard all changes done to the BMM pages such as Boot Order change,
1345 Driver order change.
1346
1347 @param Private The BMM context data.
1348 @param CurrentFakeNVMap The current Fack NV Map.
1349
1350 **/
1351 VOID
1352 DiscardChangeHandler (
1353 IN BMM_CALLBACK_DATA *Private,
1354 IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
1355 );
1356
1357 /**
1358 Dispatch the display to the next page based on NewPageId.
1359
1360 @param Private The BMM context data.
1361 @param NewPageId The original page ID.
1362
1363 **/
1364 VOID
1365 UpdatePageId (
1366 BMM_CALLBACK_DATA *Private,
1367 UINT16 NewPageId
1368 );
1369
1370 /**
1371 Boot a file selected by user at File Expoloer of BMM.
1372
1373 @param FileContext The file context data, which contains the device path
1374 of the file to be boot from.
1375
1376 @retval EFI_SUCCESS The function completed successfull.
1377 @return Other value if the boot from the file fails.
1378
1379 **/
1380 EFI_STATUS
1381 BootThisFile (
1382 IN BM_FILE_CONTEXT *FileContext
1383 );
1384
1385 /**
1386 Update the file explower page with the refershed file system.
1387
1388
1389 @param CallbackData BMM context data
1390 @param KeyValue Key value to identify the type of data to expect.
1391
1392 @retval TRUE Inform the caller to create a callback packet to exit file explorer.
1393 @retval FALSE Indicate that there is no need to exit file explorer.
1394
1395 **/
1396 BOOLEAN
1397 UpdateFileExplorer (
1398 IN BMM_CALLBACK_DATA *CallbackData,
1399 IN UINT16 KeyValue
1400 );
1401
1402 /**
1403 This function processes the results of changes in configuration.
1404 When user select a interactive opcode, this callback will be triggered.
1405 Based on the Question(QuestionId) that triggers the callback, the corresponding
1406 actions is performed. It handles:
1407
1408 1) the addition of boot option.
1409 2) the addition of driver option.
1410 3) exit from file browser
1411 4) update of file content if a dir is selected.
1412 5) boot the file if a file is selected in "boot from file"
1413
1414
1415 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1416 @param Action Specifies the type of action taken by the browser.
1417 @param QuestionId A unique value which is sent to the original exporting driver
1418 so that it can identify the type of data to expect.
1419 @param Type The type of value for the question.
1420 @param Value A pointer to the data being sent to the original exporting driver.
1421 @param ActionRequest On return, points to the action requested by the callback function.
1422
1423 @retval EFI_SUCCESS The callback successfully handled the action.
1424 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
1425 @retval EFI_DEVICE_ERROR The variable could not be saved.
1426 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
1427
1428 **/
1429 EFI_STATUS
1430 EFIAPI
1431 FileExplorerCallback (
1432 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
1433 IN EFI_BROWSER_ACTION Action,
1434 IN EFI_QUESTION_ID QuestionId,
1435 IN UINT8 Type,
1436 IN EFI_IFR_TYPE_VALUE *Value,
1437 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1438 );
1439
1440 /**
1441 This function applies changes in a driver's configuration.
1442 Input is a Configuration, which has the routing data for this
1443 driver followed by name / value configuration pairs. The driver
1444 must apply those pairs to its configurable storage. If the
1445 driver's configuration is stored in a linear block of data
1446 and the driver's name / value pairs are in <BlockConfig>
1447 format, it may use the ConfigToBlock helper function (above) to
1448 simplify the job. Currently not implemented.
1449
1450 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1451 @param[in] Configuration A null-terminated Unicode string in
1452 <ConfigString> format.
1453 @param[out] Progress A pointer to a string filled in with the
1454 offset of the most recent '&' before the
1455 first failing name / value pair (or the
1456 beginn ing of the string if the failure
1457 is in the first name / value pair) or
1458 the terminating NULL if all was
1459 successful.
1460
1461 @retval EFI_SUCCESS The results have been distributed or are
1462 awaiting distribution.
1463 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
1464 parts of the results that must be
1465 stored awaiting possible future
1466 protocols.
1467 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
1468 Results parameter would result
1469 in this type of error.
1470 @retval EFI_NOT_FOUND Target for the specified routing data
1471 was not found.
1472 **/
1473 EFI_STATUS
1474 EFIAPI
1475 FileExplorerRouteConfig (
1476 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
1477 IN CONST EFI_STRING Configuration,
1478 OUT EFI_STRING *Progress
1479 );
1480
1481 /**
1482 Dispatch BMM formset and FileExplorer formset.
1483
1484
1485 @param CallbackData The BMM context data.
1486
1487 @retval EFI_SUCCESS If function complete successfully.
1488 @return Other value if the Setup Browser process BMM's pages and
1489 return unsuccessfully.
1490
1491 **/
1492 EFI_STATUS
1493 FormSetDispatcher (
1494 IN BMM_CALLBACK_DATA *CallbackData
1495 );
1496
1497 /**
1498 Function returns the value of the specified variable.
1499
1500 @param Name A Null-terminated Unicode string that is
1501 the name of the vendor's variable.
1502 @param VendorGuid A unique identifier for the vendor.
1503
1504 @return The payload of the variable.
1505 @retval NULL If the variable can't be read.
1506
1507 **/
1508 VOID *
1509 EfiLibGetVariable (
1510 IN CHAR16 *Name,
1511 IN EFI_GUID *VendorGuid
1512 );
1513
1514 /**
1515 Get option number according to Boot#### and BootOrder variable.
1516 The value is saved as #### + 1.
1517
1518 @param CallbackData The BMM context data.
1519 **/
1520 VOID
1521 GetBootOrder (
1522 IN BMM_CALLBACK_DATA *CallbackData
1523 );
1524
1525 /**
1526 Get driver option order from globalc DriverOptionMenu.
1527
1528 @param CallbackData The BMM context data.
1529
1530 **/
1531 VOID
1532 GetDriverOrder (
1533 IN BMM_CALLBACK_DATA *CallbackData
1534 );
1535
1536 /**
1537 Intall BootMaint and FileExplorer HiiPackages.
1538
1539 **/
1540 EFI_STATUS
1541 InitBMPackage (
1542 VOID
1543 );
1544
1545 /**
1546 Remvoe the intalled BootMaint and FileExplorer HiiPackages.
1547
1548 **/
1549 VOID
1550 FreeBMPackage (
1551 VOID
1552 );
1553
1554 /**
1555 According to LegacyDevOrder variable to get legacy FD\HD\CD\NET\BEV
1556 devices list .
1557
1558 @param CallbackData The BMM context data.
1559 **/
1560 VOID
1561 GetLegacyDeviceOrder (
1562 IN BMM_CALLBACK_DATA *CallbackData
1563 );
1564
1565 /**
1566
1567 Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
1568 in BMM_FAKE_NV_DATA structure.
1569
1570 @param CallbackData The BMM context data.
1571
1572 **/
1573 VOID
1574 GetConsoleInCheck (
1575 IN BMM_CALLBACK_DATA *CallbackData
1576 );
1577
1578 /**
1579
1580 Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
1581 in BMM_FAKE_NV_DATA structure.
1582
1583 @param CallbackData The BMM context data.
1584
1585 **/
1586 VOID
1587 GetConsoleOutCheck (
1588 IN BMM_CALLBACK_DATA *CallbackData
1589 );
1590
1591 /**
1592
1593 Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
1594 in BMM_FAKE_NV_DATA structure.
1595
1596 @param CallbackData The BMM context data.
1597
1598 **/
1599 VOID
1600 GetConsoleErrCheck (
1601 IN BMM_CALLBACK_DATA *CallbackData
1602 );
1603
1604 /**
1605
1606 Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
1607 to BMM_FAKE_NV_DATA structure.
1608
1609 @param CallbackData The BMM context data.
1610
1611 **/
1612 VOID
1613 GetTerminalAttribute (
1614 IN BMM_CALLBACK_DATA *CallbackData
1615 );
1616
1617 /**
1618
1619 Find the first instance of this Protocol
1620 in the system and return it's interface.
1621
1622
1623 @param ProtocolGuid Provides the protocol to search for
1624 @param Interface On return, a pointer to the first interface
1625 that matches ProtocolGuid
1626
1627 @retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
1628 @retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
1629
1630 **/
1631 EFI_STATUS
1632 EfiLibLocateProtocol (
1633 IN EFI_GUID *ProtocolGuid,
1634 OUT VOID **Interface
1635 );
1636
1637 //
1638 // Global variable in this program (defined in data.c)
1639 //
1640 extern BM_MENU_OPTION BootOptionMenu;
1641 extern BM_MENU_OPTION DriverOptionMenu;
1642 extern BM_MENU_OPTION FsOptionMenu;
1643 extern BM_MENU_OPTION ConsoleInpMenu;
1644 extern BM_MENU_OPTION ConsoleOutMenu;
1645 extern BM_MENU_OPTION ConsoleErrMenu;
1646 extern BM_MENU_OPTION DirectoryMenu;
1647 extern BM_MENU_OPTION DriverMenu;
1648 extern BM_MENU_OPTION TerminalMenu;
1649 extern BM_MENU_OPTION LegacyFDMenu;
1650 extern BM_MENU_OPTION LegacyHDMenu;
1651 extern BM_MENU_OPTION LegacyCDMenu;
1652 extern BM_MENU_OPTION LegacyNETMenu;
1653 extern BM_MENU_OPTION LegacyBEVMenu;
1654 extern UINT16 TerminalType[];
1655 extern COM_ATTR BaudRateList[19];
1656 extern COM_ATTR DataBitsList[4];
1657 extern COM_ATTR ParityList[5];
1658 extern COM_ATTR StopBitsList[3];
1659 extern EFI_GUID TerminalTypeGuid[4];
1660 extern STRING_DEPOSITORY *FileOptionStrDepository;
1661 extern STRING_DEPOSITORY *ConsoleOptionStrDepository;
1662 extern STRING_DEPOSITORY *BootOptionStrDepository;
1663 extern STRING_DEPOSITORY *BootOptionHelpStrDepository;
1664 extern STRING_DEPOSITORY *DriverOptionStrDepository;
1665 extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
1666 extern STRING_DEPOSITORY *TerminalStrDepository;
1667 extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
1668 extern UINT16 mFlowControlType[2];
1669 extern UINT32 mFlowControlValue[2];
1670 //
1671 // Shared IFR form update data
1672 //
1673 extern VOID *mStartOpCodeHandle;
1674 extern VOID *mEndOpCodeHandle;
1675 extern EFI_IFR_GUID_LABEL *mStartLabel;
1676 extern EFI_IFR_GUID_LABEL *mEndLabel;
1677
1678 #endif