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