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