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