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