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