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