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