]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
Refine code to follow good coding style.
[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 @param FormId The form id.
944
945 @return EFI_SUCCESS The function completed successfully.
946 @retval EFI_NOT_FOUND If VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found.
947
948 **/
949 EFI_STATUS
950 Var_UpdateBBSOption (
951 IN BMM_CALLBACK_DATA *CallbackData,
952 IN EFI_FORM_ID FormId
953 );
954
955 /**
956 Update the Text Mode of Console.
957
958 @param CallbackData The context data for BMM.
959
960 @retval EFI_SUCCSS If the Text Mode of Console is updated.
961 @return Other value if the Text Mode of Console is not updated.
962
963 **/
964 EFI_STATUS
965 Var_UpdateConMode (
966 IN BMM_CALLBACK_DATA *CallbackData
967 );
968
969 //
970 // Following are page create and refresh functions
971 //
972 /**
973 Refresh the global UpdateData structure.
974
975 **/
976 VOID
977 RefreshUpdateData (
978 VOID
979 );
980
981 /**
982 Clean up the dynamic opcode at label and form specified by
983 both LabelId.
984
985 @param LabelId It is both the Form ID and Label ID for
986 opcode deletion.
987 @param CallbackData The BMM context data.
988
989 **/
990 VOID
991 CleanUpPage (
992 IN UINT16 LabelId,
993 IN BMM_CALLBACK_DATA *CallbackData
994 );
995
996 /**
997 Create a lit of boot option from global BootOptionMenu. It
998 allow user to delete the boot option.
999
1000 @param CallbackData The BMM context data.
1001
1002 **/
1003 VOID
1004 UpdateBootDelPage (
1005 IN BMM_CALLBACK_DATA *CallbackData
1006 );
1007
1008 /**
1009 Create a lit of driver option from global DriverMenu.
1010
1011 @param CallbackData The BMM context data.
1012 **/
1013 VOID
1014 UpdateDrvAddHandlePage (
1015 IN BMM_CALLBACK_DATA *CallbackData
1016 );
1017
1018 /**
1019 Create a lit of driver option from global DriverOptionMenu. It
1020 allow user to delete the driver option.
1021
1022 @param CallbackData The BMM context data.
1023 **/
1024 VOID
1025 UpdateDrvDelPage (
1026 IN BMM_CALLBACK_DATA *CallbackData
1027 );
1028
1029 /**
1030 Prepare the page to allow user to add description for a Driver Option.
1031
1032 @param CallbackData The BMM context data.
1033 **/
1034 VOID
1035 UpdateDriverAddHandleDescPage (
1036 IN BMM_CALLBACK_DATA *CallbackData
1037 );
1038
1039 /**
1040 Dispatch the correct update page function to call based on the UpdatePageId.
1041
1042 @param UpdatePageId The form ID.
1043 @param CallbackData The BMM context data.
1044 **/
1045 VOID
1046 UpdatePageBody (
1047 IN UINT16 UpdatePageId,
1048 IN BMM_CALLBACK_DATA *CallbackData
1049 );
1050
1051 /**
1052 Create the dynamic page to allow user to set the "BootNext" vaule.
1053
1054 @param CallbackData The BMM context data.
1055 **/
1056 VOID
1057 UpdateBootNextPage (
1058 IN BMM_CALLBACK_DATA *CallbackData
1059 );
1060
1061 /**
1062 Create the dynamic page to allow user to set the "TimeOut" vaule.
1063
1064 @param CallbackData The BMM context data.
1065 **/
1066 VOID
1067 UpdateTimeOutPage (
1068 IN BMM_CALLBACK_DATA *CallbackData
1069 );
1070
1071 /**
1072 Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
1073 Parity, Stop Bits, Terminal Type.
1074
1075 @param CallbackData The BMM context data.
1076 **/
1077 VOID
1078 UpdateTerminalPage (
1079 IN BMM_CALLBACK_DATA *CallbackData
1080 );
1081
1082 /**
1083 Refresh the text mode page
1084
1085 @param CallbackData The BMM context data.
1086 **/
1087 VOID
1088 UpdateConModePage (
1089 IN BMM_CALLBACK_DATA *CallbackData
1090 );
1091
1092 /**
1093 Create a list of Goto Opcode for all terminal devices logged
1094 by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.
1095
1096 @param CallbackData The BMM context data.
1097 **/
1098 VOID
1099 UpdateConCOMPage (
1100 IN BMM_CALLBACK_DATA *CallbackData
1101 );
1102
1103 /**
1104 Create a dynamic page so that Legacy Device boot order
1105 can be set for specified device type.
1106
1107 @param UpdatePageId The form ID. It also spefies the legacy device type.
1108 @param CallbackData The BMM context data.
1109 **/
1110 VOID
1111 UpdateSetLegacyDeviceOrderPage (
1112 IN UINT16 UpdatePageId,
1113 IN BMM_CALLBACK_DATA *CallbackData
1114 );
1115
1116
1117 /**
1118 Function opens and returns a file handle to the root directory of a volume.
1119
1120 @param DeviceHandle A handle for a device
1121 @return A valid file handle or NULL is returned
1122 **/
1123 EFI_FILE_HANDLE
1124 EfiLibOpenRoot (
1125 IN EFI_HANDLE DeviceHandle
1126 );
1127
1128 /**
1129 Function gets the file system information from an open file descriptor,
1130 and stores it in a buffer allocated from pool.
1131
1132 @param FHand The file handle.
1133
1134 @return A pointer to a buffer with file information.
1135 NULL is returned if failed to get Vaolume Label Info.
1136 **/
1137 EFI_FILE_SYSTEM_VOLUME_LABEL *
1138 EfiLibFileSystemVolumeLabelInfo (
1139 IN EFI_FILE_HANDLE FHand
1140 );
1141
1142 /**
1143
1144 Function gets the file information from an open file descriptor, and stores it
1145 in a buffer allocated from pool.
1146
1147 @param FHand File Handle.
1148
1149 @return A pointer to a buffer with file information or NULL is returned
1150
1151 **/
1152 EFI_FILE_INFO *
1153 EfiLibFileInfo (
1154 IN EFI_FILE_HANDLE FHand
1155 );
1156
1157 /**
1158 Adjusts the size of a previously allocated buffer.
1159
1160 @param OldPool A pointer to the buffer whose size is being adjusted.
1161 @param OldSize The size of the current buffer.
1162 @param NewSize The size of the new buffer.
1163
1164 @return The newly allocated buffer. if NULL, allocation failed.
1165
1166 **/
1167 VOID*
1168 EfiReallocatePool (
1169 IN VOID *OldPool,
1170 IN UINTN OldSize,
1171 IN UINTN NewSize
1172 );
1173
1174 /**
1175 Function deletes the variable specified by VarName and VarGuid.
1176
1177
1178 @param VarName A Null-terminated Unicode string that is
1179 the name of the vendor's variable.
1180
1181 @param VarGuid A unique identifier for the vendor.
1182
1183 @retval EFI_SUCCESS The variable was found and removed
1184 @retval EFI_UNSUPPORTED The variable store was inaccessible
1185 @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available
1186 @retval EFI_NOT_FOUND The variable was not found
1187
1188 **/
1189 EFI_STATUS
1190 EfiLibDeleteVariable (
1191 IN CHAR16 *VarName,
1192 IN EFI_GUID *VarGuid
1193 );
1194
1195 /**
1196 Duplicate a string.
1197
1198 @param Src The source.
1199
1200 @return A new string which is duplicated copy of the source.
1201 @retval NULL If there is not enough memory.
1202
1203 **/
1204 CHAR16 *
1205 EfiStrDuplicate (
1206 IN CHAR16 *Src
1207 );
1208
1209 /**
1210 Function is used to determine the number of device path instances
1211 that exist in a device path.
1212
1213
1214 @param DevicePath A pointer to a device path data structure.
1215
1216 @return This function counts and returns the number of device path instances
1217 in DevicePath.
1218
1219 **/
1220 UINTN
1221 EfiDevicePathInstanceCount (
1222 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1223 );
1224
1225 /**
1226 Create string tokens for a menu from its help strings and display strings
1227
1228
1229 @param CallbackData The BMM context data.
1230 @param HiiHandle Hii Handle of the package to be updated.
1231 @param MenuOption The Menu whose string tokens need to be created
1232
1233 @retval EFI_SUCCESS string tokens created successfully
1234 @retval others contain some errors
1235
1236 **/
1237 EFI_STATUS
1238 CreateMenuStringToken (
1239 IN BMM_CALLBACK_DATA *CallbackData,
1240 IN EFI_HII_HANDLE HiiHandle,
1241 IN BM_MENU_OPTION *MenuOption
1242 );
1243
1244 /**
1245 Get a string from the Data Hub record based on
1246 a device path.
1247
1248 @param DevPath The device Path.
1249
1250 @return A string located from the Data Hub records based on
1251 the device path.
1252 @retval NULL If failed to get the String from Data Hub.
1253
1254 **/
1255 UINT16 *
1256 EfiLibStrFromDatahub (
1257 IN EFI_DEVICE_PATH_PROTOCOL *DevPath
1258 );
1259
1260 /**
1261 Initialize the Boot Maintenance Utitliy.
1262
1263 @retval EFI_SUCCESS utility ended successfully.
1264 @retval others contain some errors.
1265
1266 **/
1267 EFI_STATUS
1268 InitializeBM (
1269 VOID
1270 );
1271
1272 /**
1273 Start boot maintenance manager
1274
1275 @retval EFI_SUCCESS If BMM is invoked successfully.
1276 @return Other value if BMM return unsuccessfully.
1277
1278 **/
1279 EFI_STATUS
1280 BdsStartBootMaint (
1281 VOID
1282 );
1283
1284 /**
1285 Intialize all the string depositories.
1286
1287 **/
1288 VOID
1289 InitializeStringDepository (
1290 VOID
1291 );
1292
1293 /**
1294 Fetch a usable string node from the string depository and return the string token.
1295
1296
1297 @param CallbackData The BMM context data.
1298 @param StringDepository Pointer of the string depository.
1299
1300 @retval EFI_STRING_ID String token.
1301
1302 **/
1303 EFI_STRING_ID
1304 GetStringTokenFromDepository (
1305 IN BMM_CALLBACK_DATA *CallbackData,
1306 IN STRING_DEPOSITORY *StringDepository
1307 );
1308
1309 /**
1310 Reclaim string depositories by moving the current node pointer to list head..
1311 **/
1312 VOID
1313 ReclaimStringDepository (
1314 VOID
1315 );
1316
1317 /**
1318 Release resource for all the string depositories.
1319
1320 **/
1321 VOID
1322 CleanUpStringDepository (
1323 VOID
1324 );
1325
1326 /**
1327 Function handling request to apply changes for BMM pages.
1328
1329 @param Private Pointer to callback data buffer.
1330 @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
1331 @param FormId ID of the form which has sent the request to apply change.
1332
1333 @retval EFI_SUCCESS Change successfully applied.
1334 @retval Other Error occurs while trying to apply changes.
1335
1336 **/
1337 EFI_STATUS
1338 ApplyChangeHandler (
1339 IN BMM_CALLBACK_DATA *Private,
1340 IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
1341 IN EFI_FORM_ID FormId
1342 );
1343
1344 /**
1345 Discard all changes done to the BMM pages such as Boot Order change,
1346 Driver order change.
1347
1348 @param Private The BMM context data.
1349 @param CurrentFakeNVMap The current Fack NV Map.
1350
1351 **/
1352 VOID
1353 DiscardChangeHandler (
1354 IN BMM_CALLBACK_DATA *Private,
1355 IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
1356 );
1357
1358 /**
1359 Dispatch the display to the next page based on NewPageId.
1360
1361 @param Private The BMM context data.
1362 @param NewPageId The original page ID.
1363
1364 **/
1365 VOID
1366 UpdatePageId (
1367 BMM_CALLBACK_DATA *Private,
1368 UINT16 NewPageId
1369 );
1370
1371 /**
1372 Boot a file selected by user at File Expoloer of BMM.
1373
1374 @param FileContext The file context data, which contains the device path
1375 of the file to be boot from.
1376
1377 @retval EFI_SUCCESS The function completed successfull.
1378 @return Other value if the boot from the file fails.
1379
1380 **/
1381 EFI_STATUS
1382 BootThisFile (
1383 IN BM_FILE_CONTEXT *FileContext
1384 );
1385
1386 /**
1387 Update the file explower page with the refershed file system.
1388
1389
1390 @param CallbackData BMM context data
1391 @param KeyValue Key value to identify the type of data to expect.
1392
1393 @retval TRUE Inform the caller to create a callback packet to exit file explorer.
1394 @retval FALSE Indicate that there is no need to exit file explorer.
1395
1396 **/
1397 BOOLEAN
1398 UpdateFileExplorer (
1399 IN BMM_CALLBACK_DATA *CallbackData,
1400 IN UINT16 KeyValue
1401 );
1402
1403 /**
1404 This function processes the results of changes in configuration.
1405 When user select a interactive opcode, this callback will be triggered.
1406 Based on the Question(QuestionId) that triggers the callback, the corresponding
1407 actions is performed. It handles:
1408
1409 1) the addition of boot option.
1410 2) the addition of driver option.
1411 3) exit from file browser
1412 4) update of file content if a dir is selected.
1413 5) boot the file if a file is selected in "boot from file"
1414
1415
1416 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1417 @param Action Specifies the type of action taken by the browser.
1418 @param QuestionId A unique value which is sent to the original exporting driver
1419 so that it can identify the type of data to expect.
1420 @param Type The type of value for the question.
1421 @param Value A pointer to the data being sent to the original exporting driver.
1422 @param ActionRequest On return, points to the action requested by the callback function.
1423
1424 @retval EFI_SUCCESS The callback successfully handled the action.
1425 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
1426 @retval EFI_DEVICE_ERROR The variable could not be saved.
1427 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
1428
1429 **/
1430 EFI_STATUS
1431 EFIAPI
1432 FileExplorerCallback (
1433 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
1434 IN EFI_BROWSER_ACTION Action,
1435 IN EFI_QUESTION_ID QuestionId,
1436 IN UINT8 Type,
1437 IN EFI_IFR_TYPE_VALUE *Value,
1438 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1439 );
1440
1441 /**
1442 This function applies changes in a driver's configuration.
1443 Input is a Configuration, which has the routing data for this
1444 driver followed by name / value configuration pairs. The driver
1445 must apply those pairs to its configurable storage. If the
1446 driver's configuration is stored in a linear block of data
1447 and the driver's name / value pairs are in <BlockConfig>
1448 format, it may use the ConfigToBlock helper function (above) to
1449 simplify the job. Currently not implemented.
1450
1451 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
1452 @param[in] Configuration A null-terminated Unicode string in
1453 <ConfigString> format.
1454 @param[out] Progress A pointer to a string filled in with the
1455 offset of the most recent '&' before the
1456 first failing name / value pair (or the
1457 beginn ing of the string if the failure
1458 is in the first name / value pair) or
1459 the terminating NULL if all was
1460 successful.
1461
1462 @retval EFI_SUCCESS The results have been distributed or are
1463 awaiting distribution.
1464 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
1465 parts of the results that must be
1466 stored awaiting possible future
1467 protocols.
1468 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
1469 Results parameter would result
1470 in this type of error.
1471 @retval EFI_NOT_FOUND Target for the specified routing data
1472 was not found.
1473 **/
1474 EFI_STATUS
1475 EFIAPI
1476 FileExplorerRouteConfig (
1477 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
1478 IN CONST EFI_STRING Configuration,
1479 OUT EFI_STRING *Progress
1480 );
1481
1482 /**
1483 Dispatch BMM formset and FileExplorer formset.
1484
1485
1486 @param CallbackData The BMM context data.
1487
1488 @retval EFI_SUCCESS If function complete successfully.
1489 @return Other value if the Setup Browser process BMM's pages and
1490 return unsuccessfully.
1491
1492 **/
1493 EFI_STATUS
1494 FormSetDispatcher (
1495 IN BMM_CALLBACK_DATA *CallbackData
1496 );
1497
1498 /**
1499 Function returns the value of the specified variable.
1500
1501 @param Name A Null-terminated Unicode string that is
1502 the name of the vendor's variable.
1503 @param VendorGuid A unique identifier for the vendor.
1504
1505 @return The payload of the variable.
1506 @retval NULL If the variable can't be read.
1507
1508 **/
1509 VOID *
1510 EfiLibGetVariable (
1511 IN CHAR16 *Name,
1512 IN EFI_GUID *VendorGuid
1513 );
1514
1515 /**
1516 Get option number according to Boot#### and BootOrder variable.
1517 The value is saved as #### + 1.
1518
1519 @param CallbackData The BMM context data.
1520 **/
1521 VOID
1522 GetBootOrder (
1523 IN BMM_CALLBACK_DATA *CallbackData
1524 );
1525
1526 /**
1527 Get driver option order from globalc DriverOptionMenu.
1528
1529 @param CallbackData The BMM context data.
1530
1531 **/
1532 VOID
1533 GetDriverOrder (
1534 IN BMM_CALLBACK_DATA *CallbackData
1535 );
1536
1537 /**
1538 Intall BootMaint and FileExplorer HiiPackages.
1539
1540 **/
1541 EFI_STATUS
1542 InitBMPackage (
1543 VOID
1544 );
1545
1546 /**
1547 Remvoe the intalled BootMaint and FileExplorer HiiPackages.
1548
1549 **/
1550 VOID
1551 FreeBMPackage (
1552 VOID
1553 );
1554
1555 /**
1556 According to LegacyDevOrder variable to get legacy FD\HD\CD\NET\BEV
1557 devices list .
1558
1559 @param CallbackData The BMM context data.
1560 **/
1561 VOID
1562 GetLegacyDeviceOrder (
1563 IN BMM_CALLBACK_DATA *CallbackData
1564 );
1565
1566 /**
1567
1568 Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
1569 in BMM_FAKE_NV_DATA structure.
1570
1571 @param CallbackData The BMM context data.
1572
1573 **/
1574 VOID
1575 GetConsoleInCheck (
1576 IN BMM_CALLBACK_DATA *CallbackData
1577 );
1578
1579 /**
1580
1581 Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
1582 in BMM_FAKE_NV_DATA structure.
1583
1584 @param CallbackData The BMM context data.
1585
1586 **/
1587 VOID
1588 GetConsoleOutCheck (
1589 IN BMM_CALLBACK_DATA *CallbackData
1590 );
1591
1592 /**
1593
1594 Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
1595 in BMM_FAKE_NV_DATA structure.
1596
1597 @param CallbackData The BMM context data.
1598
1599 **/
1600 VOID
1601 GetConsoleErrCheck (
1602 IN BMM_CALLBACK_DATA *CallbackData
1603 );
1604
1605 /**
1606
1607 Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
1608 to BMM_FAKE_NV_DATA structure.
1609
1610 @param CallbackData The BMM context data.
1611
1612 **/
1613 VOID
1614 GetTerminalAttribute (
1615 IN BMM_CALLBACK_DATA *CallbackData
1616 );
1617
1618 /**
1619
1620 Find the first instance of this Protocol
1621 in the system and return it's interface.
1622
1623
1624 @param ProtocolGuid Provides the protocol to search for
1625 @param Interface On return, a pointer to the first interface
1626 that matches ProtocolGuid
1627
1628 @retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
1629 @retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
1630
1631 **/
1632 EFI_STATUS
1633 EfiLibLocateProtocol (
1634 IN EFI_GUID *ProtocolGuid,
1635 OUT VOID **Interface
1636 );
1637
1638 //
1639 // Global variable in this program (defined in data.c)
1640 //
1641 extern BM_MENU_OPTION BootOptionMenu;
1642 extern BM_MENU_OPTION DriverOptionMenu;
1643 extern BM_MENU_OPTION FsOptionMenu;
1644 extern BM_MENU_OPTION ConsoleInpMenu;
1645 extern BM_MENU_OPTION ConsoleOutMenu;
1646 extern BM_MENU_OPTION ConsoleErrMenu;
1647 extern BM_MENU_OPTION DirectoryMenu;
1648 extern BM_MENU_OPTION DriverMenu;
1649 extern BM_MENU_OPTION TerminalMenu;
1650 extern BM_MENU_OPTION LegacyFDMenu;
1651 extern BM_MENU_OPTION LegacyHDMenu;
1652 extern BM_MENU_OPTION LegacyCDMenu;
1653 extern BM_MENU_OPTION LegacyNETMenu;
1654 extern BM_MENU_OPTION LegacyBEVMenu;
1655 extern UINT16 TerminalType[];
1656 extern COM_ATTR BaudRateList[19];
1657 extern COM_ATTR DataBitsList[4];
1658 extern COM_ATTR ParityList[5];
1659 extern COM_ATTR StopBitsList[3];
1660 extern EFI_GUID TerminalTypeGuid[4];
1661 extern STRING_DEPOSITORY *FileOptionStrDepository;
1662 extern STRING_DEPOSITORY *ConsoleOptionStrDepository;
1663 extern STRING_DEPOSITORY *BootOptionStrDepository;
1664 extern STRING_DEPOSITORY *BootOptionHelpStrDepository;
1665 extern STRING_DEPOSITORY *DriverOptionStrDepository;
1666 extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
1667 extern STRING_DEPOSITORY *TerminalStrDepository;
1668 extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
1669 extern UINT16 mFlowControlType[2];
1670 extern UINT32 mFlowControlValue[2];
1671 //
1672 // Shared IFR form update data
1673 //
1674 extern VOID *mStartOpCodeHandle;
1675 extern VOID *mEndOpCodeHandle;
1676 extern EFI_IFR_GUID_LABEL *mStartLabel;
1677 extern EFI_IFR_GUID_LABEL *mEndLabel;
1678
1679 #endif