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