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