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