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