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