MdeModulePkg:Change the type of BootNext
[mirror_edk2.git] / MdeModulePkg / Library / BootMaintenanceManagerLib / BootMaintenanceManager.h
CommitLineData
4af04335
DB
1/** @file\r
2Header file for boot maintenance module.\r
3\r
4Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _BOOT_MAINT_H_\r
16#define _BOOT_MAINT_H_\r
17\r
18#include "FormGuid.h"\r
19\r
20#include <Guid/TtyTerm.h>\r
21#include <Guid/MdeModuleHii.h>\r
22#include <Guid/FileSystemVolumeLabelInfo.h>\r
23#include <Guid/GlobalVariable.h>\r
24#include <Guid/HiiBootMaintenanceFormset.h>\r
25\r
26#include <Protocol/LoadFile.h>\r
27#include <Protocol/HiiConfigAccess.h>\r
28#include <Protocol/SimpleFileSystem.h>\r
29#include <Protocol/SerialIo.h>\r
30#include <Protocol/DevicePathToText.h>\r
31\r
32#include <Library/PrintLib.h>\r
33#include <Library/DebugLib.h>\r
34#include <Library/BaseMemoryLib.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/UefiLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/UefiRuntimeServicesTableLib.h>\r
39#include <Library/DevicePathLib.h>\r
40#include <Library/HiiLib.h>\r
41#include <Library/UefiHiiServicesLib.h>\r
42#include <Library/UefiBootManagerLib.h>\r
43#include <Library/FileExplorerLib.h>\r
44\r
45#pragma pack(1)\r
46\r
47///\r
48/// HII specific Vendor Device Path definition.\r
49///\r
50typedef struct {\r
51 VENDOR_DEVICE_PATH VendorDevicePath;\r
52 EFI_DEVICE_PATH_PROTOCOL End;\r
53} HII_VENDOR_DEVICE_PATH;\r
54#pragma pack()\r
55\r
56//\r
57// Constants which are variable names used to access variables\r
58//\r
59\r
60#define VAR_CON_OUT_MODE L"ConOutMode"\r
61\r
62//\r
63// Variable created with this flag will be "Efi:...."\r
64//\r
65#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE\r
66\r
67extern EFI_GUID mBootMaintGuid;\r
68extern CHAR16 mBootMaintStorageName[];\r
69//\r
70// These are the VFR compiler generated data representing our VFR data.\r
71//\r
72extern UINT8 BootMaintenanceManagerBin[];\r
73\r
74//\r
75// Below are the number of options in Baudrate, Databits,\r
76// Parity and Stopbits selection for serial ports.\r
77//\r
78#define BM_COM_ATTR_BUADRATE 19\r
79#define BM_COM_ATTR_DATABITS 4\r
80#define BM_COM_ATTR_PARITY 5\r
81#define BM_COM_ATTR_STOPBITS 3\r
82\r
83//\r
84// Callback function helper\r
85//\r
86#define BMM_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('C', 'b', 'c', 'k')\r
87#define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmConfigAccess, BMM_CALLBACK_DATA_SIGNATURE)\r
88\r
89//\r
90// Enumeration type definition\r
91//\r
92typedef UINT8 BBS_TYPE;\r
93\r
94typedef enum _TYPE_OF_TERMINAL {\r
95 TerminalTypePcAnsi = 0,\r
96 TerminalTypeVt100,\r
97 TerminalTypeVt100Plus,\r
98 TerminalTypeVtUtf8,\r
99 TerminalTypeTtyTerm\r
100} TYPE_OF_TERMINAL;\r
101\r
102//\r
103// All of the signatures that will be used in list structure\r
104//\r
105#define BM_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')\r
106#define BM_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('l', 'o', 'a', 'd')\r
107#define BM_CONSOLE_OPTION_SIGNATURE SIGNATURE_32 ('c', 'n', 's', 'l')\r
108#define BM_FILE_OPTION_SIGNATURE SIGNATURE_32 ('f', 'i', 'l', 'e')\r
109#define BM_HANDLE_OPTION_SIGNATURE SIGNATURE_32 ('h', 'n', 'd', 'l')\r
110#define BM_TERMINAL_OPTION_SIGNATURE SIGNATURE_32 ('t', 'r', 'm', 'l')\r
111#define BM_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')\r
112\r
113#define BM_LOAD_CONTEXT_SELECT 0x0\r
114#define BM_CONSOLE_CONTEXT_SELECT 0x1\r
115#define BM_FILE_CONTEXT_SELECT 0x2\r
116#define BM_HANDLE_CONTEXT_SELECT 0x3\r
117#define BM_TERMINAL_CONTEXT_SELECT 0x5\r
118\r
119#define BM_CONSOLE_IN_CONTEXT_SELECT 0x6\r
120#define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7\r
121#define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8\r
122\r
123//\r
124// Buffer size for update data\r
125//\r
126#define UPDATE_DATA_SIZE 0x100000\r
127\r
128//\r
129// Namespace of callback keys used in display and file system navigation\r
130//\r
131#define MAX_BBS_OFFSET 0xE000\r
132#define NET_OPTION_OFFSET 0xD800\r
133#define BEV_OPTION_OFFSET 0xD000\r
134#define FD_OPTION_OFFSET 0xC000\r
135#define HD_OPTION_OFFSET 0xB000\r
136#define CD_OPTION_OFFSET 0xA000\r
137#define FILE_OPTION_OFFSET 0x8000\r
138#define FILE_OPTION_MASK 0x7FFF\r
139#define HANDLE_OPTION_OFFSET 0x7000\r
140#define CONSOLE_OPTION_OFFSET 0x6000\r
141#define TERMINAL_OPTION_OFFSET 0x5000\r
142#define CONFIG_OPTION_OFFSET 0x1200\r
143#define KEY_VALUE_OFFSET 0x1100\r
144#define FORM_ID_OFFSET 0x1000\r
145\r
146//\r
147// VarOffset that will be used to create question\r
148// all these values are computed from the structure\r
149// defined below\r
150//\r
151#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field)))\r
152\r
153//\r
154// Question Id of Zero is invalid, so add an offset to it\r
155//\r
156#define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)\r
157\r
158#define BOOT_TIME_OUT_VAR_OFFSET VAR_OFFSET (BootTimeOut)\r
159#define BOOT_NEXT_VAR_OFFSET VAR_OFFSET (BootNext)\r
160#define COM1_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM1BaudRate)\r
161#define COM1_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM1DataRate)\r
162#define COM1_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM1StopBits)\r
163#define COM1_PARITY_VAR_OFFSET VAR_OFFSET (COM1Parity)\r
164#define COM1_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)\r
165#define COM2_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COM2BaudRate)\r
166#define COM2_DATA_RATE_VAR_OFFSET VAR_OFFSET (COM2DataRate)\r
167#define COM2_STOP_BITS_VAR_OFFSET VAR_OFFSET (COM2StopBits)\r
168#define COM2_PARITY_VAR_OFFSET VAR_OFFSET (COM2Parity)\r
169#define COM2_TERMINAL_VAR_OFFSET VAR_OFFSET (COM2TerminalType)\r
170#define DRV_ADD_HANDLE_DESC_VAR_OFFSET VAR_OFFSET (DriverAddHandleDesc)\r
171#define DRV_ADD_ACTIVE_VAR_OFFSET VAR_OFFSET (DriverAddActive)\r
172#define DRV_ADD_RECON_VAR_OFFSET VAR_OFFSET (DriverAddForceReconnect)\r
173#define CON_IN_COM1_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM1)\r
174#define CON_IN_COM2_VAR_OFFSET VAR_OFFSET (ConsoleInputCOM2)\r
175#define CON_OUT_COM1_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM1)\r
176#define CON_OUT_COM2_VAR_OFFSET VAR_OFFSET (ConsoleOutputCOM2)\r
177#define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)\r
178#define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)\r
179#define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)\r
180#define CON_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck)\r
181#define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)\r
182#define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)\r
183#define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)\r
184#define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)\r
185#define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)\r
186#define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)\r
187#define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)\r
188#define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)\r
189#define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)\r
190#define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)\r
191#define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)\r
192#define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)\r
193#define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)\r
194#define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)\r
195\r
196#define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)\r
197#define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)\r
198#define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)\r
199#define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)\r
200#define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)\r
201#define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)\r
202#define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)\r
203#define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)\r
204#define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)\r
205#define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)\r
206#define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)\r
207#define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)\r
208#define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)\r
209#define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)\r
210#define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)\r
211#define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)\r
212#define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)\r
213#define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)\r
214#define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)\r
215#define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)\r
216#define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)\r
217#define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)\r
218#define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)\r
219#define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)\r
220#define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)\r
221#define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)\r
222#define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)\r
223#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)\r
224#define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)\r
225#define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)\r
226#define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)\r
227#define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)\r
228#define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)\r
229#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)\r
230#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)\r
231#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)\r
232#define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)\r
233\r
234#define STRING_DEPOSITORY_NUMBER 8\r
235\r
f7986526
DB
236#define NONE_BOOTNEXT_VALUE (0xFFFF + 1)\r
237\r
4af04335
DB
238///\r
239/// Serial Ports attributes, first one is the value for\r
240/// return from callback function, stringtoken is used to\r
241/// display the value properly\r
242///\r
243typedef struct {\r
244 UINTN Value;\r
245 UINT16 StringToken;\r
246} COM_ATTR;\r
247\r
248typedef struct {\r
249 UINT64 BaudRate;\r
250 UINT8 DataBits;\r
251 UINT8 Parity;\r
252 UINT8 StopBits;\r
253\r
254 UINT8 BaudRateIndex;\r
255 UINT8 DataBitsIndex;\r
256 UINT8 ParityIndex;\r
257 UINT8 StopBitsIndex;\r
258\r
259 UINT8 FlowControl;\r
260\r
261 UINT8 IsConIn;\r
262 UINT8 IsConOut;\r
263 UINT8 IsStdErr;\r
264 UINT8 TerminalType;\r
265\r
266 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
267} BM_TERMINAL_CONTEXT;\r
268\r
269typedef struct {\r
270 BOOLEAN IsBootNext;\r
271 BOOLEAN LoadOptionModified;\r
272 BOOLEAN Deleted;\r
273\r
274 BOOLEAN IsLegacy;\r
275 BOOLEAN IsActive;\r
276 BOOLEAN ForceReconnect;\r
277 UINTN OptionalDataSize;\r
278\r
279 UINTN LoadOptionSize;\r
280 UINT8 *LoadOption;\r
281\r
282 UINT32 Attributes;\r
283 UINT16 FilePathListLength;\r
284 UINT16 *Description;\r
285 EFI_DEVICE_PATH_PROTOCOL *FilePathList;\r
286 UINT8 *OptionalData;\r
287\r
288 UINT16 BbsIndex;\r
289} BM_LOAD_CONTEXT;\r
290\r
291typedef struct {\r
292\r
293 BOOLEAN IsActive;\r
294\r
295 BOOLEAN IsTerminal;\r
296\r
297 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
298} BM_CONSOLE_CONTEXT;\r
299\r
300typedef struct {\r
301 UINTN Column;\r
302 UINTN Row;\r
303} CONSOLE_OUT_MODE;\r
304\r
305typedef struct {\r
306 EFI_HANDLE Handle;\r
307 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
308 EFI_FILE_HANDLE FHandle;\r
309 UINT16 *FileName;\r
310 EFI_FILE_SYSTEM_VOLUME_LABEL *Info;\r
311\r
312 BOOLEAN IsRoot;\r
313 BOOLEAN IsDir;\r
314 BOOLEAN IsRemovableMedia;\r
315 BOOLEAN IsLoadFile;\r
316 BOOLEAN IsBootLegacy;\r
317} BM_FILE_CONTEXT;\r
318\r
319typedef struct {\r
320 EFI_HANDLE Handle;\r
321 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
322} BM_HANDLE_CONTEXT;\r
323\r
324typedef struct {\r
325 UINTN Signature;\r
326 LIST_ENTRY Head;\r
327 UINTN MenuNumber;\r
328} BM_MENU_OPTION;\r
329\r
330typedef struct {\r
331 UINTN Signature;\r
332 LIST_ENTRY Link;\r
333 UINTN OptionNumber;\r
334 UINT16 *DisplayString;\r
335 UINT16 *HelpString;\r
336 EFI_STRING_ID DisplayStringToken;\r
337 EFI_STRING_ID HelpStringToken;\r
338 UINTN ContextSelection;\r
339 VOID *VariableContext;\r
340} BM_MENU_ENTRY;\r
341\r
342typedef struct {\r
343 \r
344 UINTN Signature;\r
345\r
346 EFI_HII_HANDLE BmmHiiHandle;\r
347 EFI_HANDLE BmmDriverHandle;\r
348 ///\r
349 /// Boot Maintenance Manager Produced protocols\r
350 ///\r
351 EFI_HII_CONFIG_ACCESS_PROTOCOL BmmConfigAccess;\r
352 EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
353\r
354 BM_MENU_ENTRY *MenuEntry;\r
355 BM_HANDLE_CONTEXT *HandleContext;\r
356 BM_FILE_CONTEXT *FileContext;\r
357 BM_LOAD_CONTEXT *LoadContext;\r
358 BM_TERMINAL_CONTEXT *TerminalContext;\r
359 UINTN CurrentTerminal;\r
360 BBS_TYPE BbsType;\r
361\r
362 //\r
363 // BMM main formset callback data.\r
364 //\r
365 \r
366 EFI_FORM_ID BmmCurrentPageId;\r
367 EFI_FORM_ID BmmPreviousPageId;\r
368 BOOLEAN BmmAskSaveOrNot;\r
369 BMM_FAKE_NV_DATA BmmFakeNvData;\r
370 BMM_FAKE_NV_DATA BmmOldFakeNVData;\r
371\r
372} BMM_CALLBACK_DATA;\r
373\r
374/**\r
375\r
376 Find drivers that will be added as Driver#### variables from handles\r
377 in current system environment\r
378 All valid handles in the system except those consume SimpleFs, LoadFile\r
379 are stored in DriverMenu for future use.\r
380\r
381 @retval EFI_SUCCESS The function complets successfully.\r
382 @return Other value if failed to build the DriverMenu.\r
383\r
384**/\r
385EFI_STATUS\r
386BOpt_FindDrivers (\r
387 VOID\r
388 );\r
389\r
390/**\r
391\r
392 Build the BootOptionMenu according to BootOrder Variable.\r
393 This Routine will access the Boot#### to get EFI_LOAD_OPTION.\r
394\r
395 @param CallbackData The BMM context data.\r
396\r
397 @return The number of the Var Boot####.\r
398\r
399**/\r
400EFI_STATUS\r
401BOpt_GetBootOptions (\r
402 IN BMM_CALLBACK_DATA *CallbackData\r
403 );\r
404\r
405/**\r
406\r
407 Build up all DriverOptionMenu\r
408\r
409 @param CallbackData The BMM context data.\r
410\r
411 @return EFI_SUCESS The functin completes successfully.\r
412 @retval EFI_OUT_OF_RESOURCES Not enough memory to compete the operation.\r
413 \r
414\r
415**/\r
416EFI_STATUS\r
417BOpt_GetDriverOptions (\r
418 IN BMM_CALLBACK_DATA *CallbackData\r
419 );\r
420\r
421/**\r
422 Free resources allocated in Allocate Rountine.\r
423\r
424 @param FreeMenu Menu to be freed\r
425\r
426**/\r
427VOID\r
428BOpt_FreeMenu (\r
429 BM_MENU_OPTION *FreeMenu\r
430 );\r
431\r
432/**\r
433\r
434 Get the Option Number that has not been allocated for use.\r
435\r
436 @param Type The type of Option.\r
437\r
438 @return The available Option Number.\r
439\r
440**/\r
441UINT16\r
442BOpt_GetOptionNumber (\r
443 CHAR16 *Type\r
444 );\r
445\r
446/**\r
447\r
448 Get the Option Number for Boot#### that does not used.\r
449\r
450 @return The available Option Number.\r
451\r
452**/\r
453UINT16\r
454BOpt_GetBootOptionNumber (\r
455 VOID\r
456 );\r
457\r
458/**\r
459\r
460Get the Option Number for Driver#### that does not used.\r
461\r
462@return The unused Option Number.\r
463\r
464**/\r
465UINT16\r
466BOpt_GetDriverOptionNumber (\r
467 VOID\r
468 );\r
469\r
470/**\r
471 Create a menu entry give a Menu type.\r
472\r
473 @param MenuType The Menu type to be created.\r
474\r
475\r
476 @retval NULL If failed to create the menu.\r
477 @return The menu.\r
478\r
479**/\r
480BM_MENU_ENTRY *\r
481BOpt_CreateMenuEntry (\r
482 UINTN MenuType\r
483 );\r
484\r
485/**\r
486 Free up all resource allocated for a BM_MENU_ENTRY.\r
487\r
488 @param MenuEntry A pointer to BM_MENU_ENTRY.\r
489\r
490**/\r
491VOID\r
492BOpt_DestroyMenuEntry (\r
493 BM_MENU_ENTRY *MenuEntry\r
494 );\r
495\r
496/**\r
497 Get the Menu Entry from the list in Menu Entry List.\r
498\r
499 If MenuNumber is great or equal to the number of Menu\r
500 Entry in the list, then ASSERT.\r
501\r
502 @param MenuOption The Menu Entry List to read the menu entry.\r
503 @param MenuNumber The index of Menu Entry.\r
504\r
505 @return The Menu Entry.\r
506\r
507**/\r
508BM_MENU_ENTRY *\r
509BOpt_GetMenuEntry (\r
510 BM_MENU_OPTION *MenuOption,\r
511 UINTN MenuNumber\r
512 );\r
513\r
514/**\r
515 Get option number according to Boot#### and BootOrder variable. \r
516 The value is saved as #### + 1.\r
517\r
518 @param CallbackData The BMM context data.\r
519**/\r
520VOID \r
521GetBootOrder (\r
522 IN BMM_CALLBACK_DATA *CallbackData\r
523 );\r
524\r
525/**\r
526 Get driver option order from globalc DriverOptionMenu.\r
527\r
528 @param CallbackData The BMM context data.\r
529 \r
530**/\r
531VOID \r
532GetDriverOrder (\r
533 IN BMM_CALLBACK_DATA *CallbackData\r
534 );\r
535\r
536//\r
537// Locate all serial io devices for console\r
538//\r
539/**\r
540 Build a list containing all serial devices.\r
541\r
542 @retval EFI_SUCCESS The function complete successfully.\r
543 @retval EFI_UNSUPPORTED No serial ports present.\r
544\r
545**/\r
546EFI_STATUS\r
547LocateSerialIo (\r
548 VOID\r
549 );\r
550\r
551//\r
552// Initializing Console menu\r
553//\r
554/**\r
555 Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
556\r
557 @retval EFI_SUCCESS The function always complete successfully.\r
558\r
559**/\r
560EFI_STATUS\r
561GetAllConsoles(\r
562 VOID\r
563 );\r
564\r
565//\r
566// Get current mode information\r
567//\r
568/**\r
569 Get mode number according to column and row\r
570\r
571 @param CallbackData The BMM context data.\r
572**/\r
573VOID\r
574GetConsoleOutMode (\r
575 IN BMM_CALLBACK_DATA *CallbackData\r
576 );\r
577\r
578//\r
579// Cleaning up console menu\r
580//\r
581/**\r
582 Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu\r
583\r
584 @retval EFI_SUCCESS The function always complete successfully.\r
585**/\r
586EFI_STATUS\r
587FreeAllConsoles (\r
588 VOID\r
589 );\r
590\r
591/**\r
592 Update the device path that describing a terminal device\r
593 based on the new BaudRate, Data Bits, parity and Stop Bits\r
594 set.\r
595\r
596 @param DevicePath The devicepath protocol instance wanted to be updated.\r
597\r
598**/\r
599VOID\r
600ChangeVariableDevicePath (\r
601 IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
602 );\r
603\r
604/**\r
605 Update the multi-instance device path of Terminal Device based on\r
606 the global TerminalMenu. If ChangeTernimal is TRUE, the terminal \r
607 device path in the Terminal Device in TerminalMenu is also updated.\r
608\r
609 @param DevicePath The multi-instance device path.\r
610 @param ChangeTerminal TRUE, then device path in the Terminal Device \r
611 in TerminalMenu is also updated; FALSE, no update.\r
612\r
613 @return EFI_SUCCESS The function completes successfully.\r
614\r
615**/\r
616EFI_STATUS\r
617ChangeTerminalDevicePath (\r
618 IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
619 IN BOOLEAN ChangeTerminal\r
620 );\r
621\r
622//\r
623// Variable operation by menu selection\r
624//\r
625/**\r
626 This function create a currently loaded Boot Option from \r
627 the BMM. It then appends this Boot Option to the end of \r
628 the "BootOrder" list. It also append this Boot Opotion to the end\r
629 of BootOptionMenu.\r
630\r
631 @param CallbackData The BMM context data.\r
632\r
633 @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.\r
634 @retval EFI_SUCCESS If function completes successfully.\r
635\r
636**/\r
637EFI_STATUS\r
638Var_UpdateBootOption (\r
639 IN BMM_CALLBACK_DATA *CallbackData\r
640 );\r
641\r
642/**\r
643 Delete Boot Option that represent a Deleted state in BootOptionMenu.\r
644 After deleting this boot option, call Var_ChangeBootOrder to\r
645 make sure BootOrder is in valid state.\r
646\r
647 @retval EFI_SUCCESS If all boot load option EFI Variables corresponding to \r
648 BM_LOAD_CONTEXT marked for deletion is deleted\r
649 @return Others If failed to update the "BootOrder" variable after deletion. \r
650\r
651**/\r
652EFI_STATUS\r
653Var_DelBootOption (\r
654 VOID\r
655 );\r
656\r
657/**\r
658 After any operation on Boot####, there will be a discrepancy in BootOrder.\r
659 Since some are missing but in BootOrder, while some are present but are\r
660 not reflected by BootOrder. Then a function rebuild BootOrder from\r
661 scratch by content from BootOptionMenu is needed.\r
662\r
663 @retval EFI_SUCCESS The boot order is updated successfully.\r
664 @return other than EFI_SUCCESS if failed to change the "BootOrder" EFI Variable.\r
665\r
666**/\r
667EFI_STATUS\r
668Var_ChangeBootOrder (\r
669 VOID\r
670 );\r
671\r
672/**\r
673 This function create a currently loaded Drive Option from \r
674 the BMM. It then appends this Driver Option to the end of \r
675 the "DriverOrder" list. It append this Driver Opotion to the end\r
676 of DriverOptionMenu.\r
677\r
678 @param CallbackData The BMM context data.\r
679 @param HiiHandle The HII handle associated with the BMM formset.\r
680 @param DescriptionData The description of this driver option.\r
681 @param OptionalData The optional load option.\r
682 @param ForceReconnect If to force reconnect.\r
683\r
684 @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.\r
685 @retval EFI_SUCCESS If function completes successfully.\r
686\r
687**/\r
688EFI_STATUS\r
689Var_UpdateDriverOption (\r
690 IN BMM_CALLBACK_DATA *CallbackData,\r
691 IN EFI_HII_HANDLE HiiHandle,\r
692 IN UINT16 *DescriptionData,\r
693 IN UINT16 *OptionalData,\r
694 IN UINT8 ForceReconnect\r
695 );\r
696\r
697/**\r
698 Delete Load Option that represent a Deleted state in BootOptionMenu.\r
699 After deleting this Driver option, call Var_ChangeDriverOrder to\r
700 make sure DriverOrder is in valid state.\r
701\r
702 @retval EFI_SUCCESS Load Option is successfully updated.\r
703 @return Other value than EFI_SUCCESS if failed to update "Driver Order" EFI\r
704 Variable.\r
705\r
706**/\r
707EFI_STATUS\r
708Var_DelDriverOption (\r
709 VOID\r
710 );\r
711\r
712/**\r
713 After any operation on Driver####, there will be a discrepancy in\r
714 DriverOrder. Since some are missing but in DriverOrder, while some\r
715 are present but are not reflected by DriverOrder. Then a function\r
716 rebuild DriverOrder from scratch by content from DriverOptionMenu is\r
717 needed.\r
718\r
719 @retval EFI_SUCCESS The driver order is updated successfully.\r
720 @return other than EFI_SUCCESS if failed to set the "DriverOrder" EFI Variable.\r
721\r
722**/\r
723EFI_STATUS\r
724Var_ChangeDriverOrder (\r
725 VOID\r
726 );\r
727\r
728/**\r
729 This function delete and build multi-instance device path ConIn\r
730 console device.\r
731\r
732 @retval EFI_SUCCESS The function complete successfully.\r
733 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.\r
734**/\r
735EFI_STATUS\r
736Var_UpdateConsoleInpOption (\r
737 VOID\r
738 );\r
739\r
740/**\r
741 This function delete and build multi-instance device path ConOut console device.\r
742\r
743 @retval EFI_SUCCESS The function complete successfully.\r
744 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.\r
745**/\r
746EFI_STATUS\r
747Var_UpdateConsoleOutOption (\r
748 VOID\r
749 );\r
750\r
751/**\r
752 This function delete and build multi-instance device path ErrOut console device.\r
753\r
754 @retval EFI_SUCCESS The function complete successfully.\r
755 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.\r
756**/\r
757EFI_STATUS\r
758Var_UpdateErrorOutOption (\r
759 VOID\r
760 );\r
761\r
762/**\r
763 This function delete and build Out of Band console device.\r
764 \r
765 @param MenuIndex Menu index which user select in the terminal menu list.\r
766 \r
767 @retval EFI_SUCCESS The function complete successfully.\r
768 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information. \r
769**/\r
770EFI_STATUS\r
771Var_UpdateOutOfBandOption (\r
772 IN UINT16 MenuIndex\r
773 );\r
774\r
775/**\r
776 Update the device path of "ConOut", "ConIn" and "ErrOut" based on the new BaudRate, Data Bits, \r
777 parity and stop Bits set.\r
778\r
779**/\r
780VOID\r
781Var_UpdateAllConsoleOption (\r
782 VOID\r
783 );\r
784\r
785/**\r
786 This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM, \r
787 this EFI Variable is deleted.\r
788 It also update the BMM context data specified the "BootNext" value.\r
789\r
790 @param CallbackData The BMM context data.\r
791\r
792 @retval EFI_SUCCESS The function complete successfully.\r
793 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.\r
794\r
795**/\r
796EFI_STATUS\r
797Var_UpdateBootNext (\r
798 IN BMM_CALLBACK_DATA *CallbackData\r
799 );\r
800\r
801/**\r
802 This function update the "BootOrder" EFI Variable based on BMM Formset's NV map. It then refresh \r
803 BootOptionMenu with the new "BootOrder" list.\r
804\r
805 @param CallbackData The BMM context data.\r
806\r
807 @retval EFI_SUCCESS The function complete successfully.\r
808 @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.\r
809 @return not The EFI variable can not be saved. See gRT->SetVariable for detail return information.\r
810\r
811**/\r
812EFI_STATUS\r
813Var_UpdateBootOrder (\r
814 IN BMM_CALLBACK_DATA *CallbackData\r
815 );\r
816\r
817/**\r
818 This function update the "DriverOrder" EFI Variable based on\r
819 BMM Formset's NV map. It then refresh DriverOptionMenu\r
820 with the new "DriverOrder" list.\r
821\r
822 @param CallbackData The BMM context data.\r
823\r
824 @retval EFI_SUCCESS The function complete successfully.\r
825 @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the function.\r
826 @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.\r
827\r
828**/\r
829EFI_STATUS\r
830Var_UpdateDriverOrder (\r
831 IN BMM_CALLBACK_DATA *CallbackData\r
832 );\r
833\r
834/**\r
835 Update the Text Mode of Console.\r
836\r
837 @param CallbackData The context data for BMM.\r
838\r
839 @retval EFI_SUCCSS If the Text Mode of Console is updated.\r
840 @return Other value if the Text Mode of Console is not updated.\r
841\r
842**/\r
843EFI_STATUS\r
844Var_UpdateConMode (\r
845 IN BMM_CALLBACK_DATA *CallbackData\r
846 );\r
847\r
848//\r
849// Following are page create and refresh functions\r
850//\r
851/**\r
852 Create the global UpdateData structure.\r
853\r
854**/\r
855VOID\r
856CreateUpdateData (\r
857 VOID\r
858 );\r
859\r
860/**\r
861 Refresh the global UpdateData structure.\r
862\r
863**/\r
864VOID\r
865RefreshUpdateData (\r
866 VOID\r
867 );\r
868\r
869/**\r
870 Clean up the dynamic opcode at label and form specified by\r
871 both LabelId. \r
872\r
873 @param LabelId It is both the Form ID and Label ID for\r
874 opcode deletion.\r
875 @param CallbackData The BMM context data.\r
876\r
877**/\r
878VOID\r
879CleanUpPage (\r
880 IN UINT16 LabelId,\r
881 IN BMM_CALLBACK_DATA *CallbackData\r
882 );\r
883\r
884/**\r
885 Create a lit of boot option from global BootOptionMenu. It\r
886 allow user to delete the boot option.\r
887\r
888 @param CallbackData The BMM context data.\r
889\r
890**/\r
891VOID\r
892UpdateBootDelPage (\r
893 IN BMM_CALLBACK_DATA *CallbackData\r
894 );\r
895\r
896/**\r
897 Create a lit of driver option from global DriverMenu.\r
898\r
899 @param CallbackData The BMM context data.\r
900**/\r
901VOID\r
902UpdateDrvAddHandlePage (\r
903 IN BMM_CALLBACK_DATA *CallbackData\r
904 );\r
905\r
906/**\r
907 Create a lit of driver option from global DriverOptionMenu. It\r
908 allow user to delete the driver option.\r
909\r
910 @param CallbackData The BMM context data.\r
911**/\r
912VOID\r
913UpdateDrvDelPage (\r
914 IN BMM_CALLBACK_DATA *CallbackData\r
915 );\r
916\r
917/**\r
918 Prepare the page to allow user to add description for a Driver Option.\r
919\r
920 @param CallbackData The BMM context data.\r
921**/\r
922VOID\r
923UpdateDriverAddHandleDescPage (\r
924 IN BMM_CALLBACK_DATA *CallbackData\r
925 );\r
926\r
927/**\r
928 Dispatch the correct update page function to call based on the UpdatePageId.\r
929\r
930 @param UpdatePageId The form ID.\r
931 @param CallbackData The BMM context data.\r
932**/\r
933VOID\r
934UpdatePageBody (\r
935 IN UINT16 UpdatePageId,\r
936 IN BMM_CALLBACK_DATA *CallbackData\r
937 );\r
938\r
939/**\r
940 Create the dynamic page to allow user to set the "BootNext" vaule.\r
941\r
942 @param CallbackData The BMM context data.\r
943**/\r
944VOID\r
945UpdateBootNextPage (\r
946 IN BMM_CALLBACK_DATA *CallbackData\r
947 );\r
948\r
949/**\r
950 Create the dynamic page to allow user to set the "TimeOut" vaule.\r
951\r
952 @param CallbackData The BMM context data.\r
953**/\r
954VOID\r
955UpdateTimeOutPage (\r
956 IN BMM_CALLBACK_DATA *CallbackData\r
957 );\r
958\r
959/**\r
960 Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,\r
961 Parity, Stop Bits, Terminal Type.\r
962\r
963 @param CallbackData The BMM context data.\r
964**/\r
965VOID\r
966UpdateTerminalPage (\r
967 IN BMM_CALLBACK_DATA *CallbackData\r
968 );\r
969\r
970/**\r
971 Refresh the text mode page\r
972\r
973 @param CallbackData The BMM context data.\r
974**/\r
975VOID\r
976UpdateConModePage (\r
977 IN BMM_CALLBACK_DATA *CallbackData\r
978 );\r
979\r
980/**\r
981 Create a list of Goto Opcode for all terminal devices logged\r
982 by TerminaMenu. This list will be inserted to form FORM_CON_COM_SETUP_ID.\r
983\r
984 @param CallbackData The BMM context data.\r
985**/\r
986VOID\r
987UpdateConCOMPage (\r
988 IN BMM_CALLBACK_DATA *CallbackData\r
989 );\r
990\r
991/**\r
992 Update add boot/driver option page.\r
993\r
994 @param CallbackData The BMM context data.\r
995 @param FormId The form ID to be updated.\r
996 @param DevicePath Device path.\r
997\r
998**/\r
999VOID\r
1000UpdateOptionPage(\r
1001 IN BMM_CALLBACK_DATA *CallbackData,\r
1002 IN EFI_FORM_ID FormId,\r
1003 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
1004 );\r
1005\r
1006/**\r
1007 Function deletes the variable specified by VarName and VarGuid.\r
1008\r
1009\r
1010 @param VarName A Null-terminated Unicode string that is\r
1011 the name of the vendor's variable.\r
1012 \r
1013 @param VarGuid A unique identifier for the vendor.\r
1014\r
1015 @retval EFI_SUCCESS The variable was found and removed\r
1016 @retval EFI_UNSUPPORTED The variable store was inaccessible\r
1017 @retval EFI_OUT_OF_RESOURCES The temporary buffer was not available\r
1018 @retval EFI_NOT_FOUND The variable was not found\r
1019\r
1020**/\r
1021EFI_STATUS\r
1022EfiLibDeleteVariable (\r
1023 IN CHAR16 *VarName,\r
1024 IN EFI_GUID *VarGuid\r
1025 );\r
1026\r
1027/**\r
1028 Function is used to determine the number of device path instances\r
1029 that exist in a device path.\r
1030\r
1031\r
1032 @param DevicePath A pointer to a device path data structure.\r
1033\r
1034 @return This function counts and returns the number of device path instances\r
1035 in DevicePath.\r
1036\r
1037**/\r
1038UINTN\r
1039EfiDevicePathInstanceCount (\r
1040 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
1041 );\r
1042\r
1043/**\r
1044 Get a string from the Data Hub record based on \r
1045 a device path.\r
1046\r
1047 @param DevPath The device Path.\r
1048\r
1049 @return A string located from the Data Hub records based on\r
1050 the device path.\r
1051 @retval NULL If failed to get the String from Data Hub.\r
1052\r
1053**/\r
1054UINT16 *\r
1055EfiLibStrFromDatahub (\r
1056 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
1057 );\r
1058\r
1059/**\r
1060 Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type\r
1061 specified by DeviceType.\r
1062\r
1063 @param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,\r
1064 etc.\r
1065 @param OptionIndex Returns the index number (#### in Boot####).\r
1066 @param OptionSize Return the size of the Boot### variable.\r
1067\r
1068**/\r
1069VOID *\r
1070GetLegacyBootOptionVar (\r
1071 IN UINTN DeviceType,\r
1072 OUT UINTN *OptionIndex,\r
1073 OUT UINTN *OptionSize\r
1074 );\r
1075\r
1076/**\r
1077 Discard all changes done to the BMM pages such as Boot Order change,\r
1078 Driver order change.\r
1079\r
1080 @param Private The BMM context data.\r
1081 @param CurrentFakeNVMap The current Fack NV Map.\r
1082\r
1083**/\r
1084VOID\r
1085DiscardChangeHandler (\r
1086 IN BMM_CALLBACK_DATA *Private,\r
1087 IN BMM_FAKE_NV_DATA *CurrentFakeNVMap\r
1088 );\r
1089\r
1090/**\r
1091 Dispatch the display to the next page based on NewPageId.\r
1092\r
1093 @param Private The BMM context data.\r
1094 @param NewPageId The original page ID.\r
1095\r
1096**/\r
1097VOID\r
1098UpdatePageId (\r
1099 BMM_CALLBACK_DATA *Private,\r
1100 UINT16 NewPageId\r
1101 );\r
1102\r
1103/**\r
1104 Remove the installed BootMaint and FileExplorer HiiPackages.\r
1105\r
1106**/\r
1107VOID\r
1108FreeBMPackage(\r
1109 VOID\r
1110 );\r
1111\r
1112/**\r
1113 Install BootMaint and FileExplorer HiiPackages.\r
1114\r
1115**/\r
1116VOID\r
1117InitBootMaintenance(\r
1118 VOID\r
1119 );\r
1120\r
1121/**\r
1122\r
1123 Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]\r
1124 in BMM_FAKE_NV_DATA structure.\r
1125\r
1126 @param CallbackData The BMM context data.\r
1127\r
1128**/ \r
1129VOID \r
1130GetConsoleInCheck (\r
1131 IN BMM_CALLBACK_DATA *CallbackData\r
1132 );\r
1133\r
1134/**\r
1135\r
1136 Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]\r
1137 in BMM_FAKE_NV_DATA structure.\r
1138\r
1139 @param CallbackData The BMM context data.\r
1140\r
1141**/\r
1142VOID\r
1143GetConsoleOutCheck (\r
1144 IN BMM_CALLBACK_DATA *CallbackData\r
1145 );\r
1146\r
1147/**\r
1148\r
1149 Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]\r
1150 in BMM_FAKE_NV_DATA structure.\r
1151\r
1152 @param CallbackData The BMM context data.\r
1153\r
1154**/ \r
1155VOID\r
1156GetConsoleErrCheck (\r
1157 IN BMM_CALLBACK_DATA *CallbackData\r
1158 );\r
1159\r
1160/**\r
1161\r
1162 Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)\r
1163 to BMM_FAKE_NV_DATA structure.\r
1164\r
1165 @param CallbackData The BMM context data.\r
1166\r
1167**/\r
1168VOID\r
1169GetTerminalAttribute (\r
1170 IN BMM_CALLBACK_DATA *CallbackData\r
1171 );\r
1172\r
1173/**\r
1174 This function will change video resolution and text mode\r
1175 according to defined setup mode or defined boot mode \r
1176\r
1177 @param IsSetupMode Indicate mode is changed to setup mode or boot mode. \r
1178\r
1179 @retval EFI_SUCCESS Mode is changed successfully.\r
1180 @retval Others Mode failed to be changed.\r
1181\r
1182**/\r
1183EFI_STATUS\r
1184EFIAPI\r
1185BmmBdsSetConsoleMode (\r
1186 BOOLEAN IsSetupMode\r
1187 );\r
1188\r
1189\r
1190/**\r
1191 This function converts an input device structure to a Unicode string.\r
1192\r
1193 @param DevPath A pointer to the device path structure.\r
1194\r
1195 @return A new allocated Unicode string that represents the device path.\r
1196\r
1197**/\r
1198CHAR16 *\r
1199UiDevicePathToStr (\r
1200 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
1201 );\r
1202\r
1203/**\r
1204 Extract filename from device path. The returned buffer is allocated using AllocateCopyPool.\r
1205 The caller is responsible for freeing the allocated buffer using FreePool().\r
1206\r
1207 @param DevicePath Device path.\r
1208\r
1209 @return A new allocated string that represents the file name.\r
1210\r
1211**/\r
1212CHAR16 *\r
1213ExtractFileNameFromDevicePath (\r
1214 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
1215 );\r
1216\r
1217/**\r
1218 This function allows a caller to extract the current configuration for one\r
1219 or more named elements from the target driver.\r
1220\r
1221 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
1222 @param Request A null-terminated Unicode string in <ConfigRequest> format.\r
1223 @param Progress On return, points to a character in the Request string.\r
1224 Points to the string's null terminator if request was successful.\r
1225 Points to the most recent '&' before the first failing name/value\r
1226 pair (or the beginning of the string if the failure is in the\r
1227 first name/value pair) if the request was not successful.\r
1228 @param Results A null-terminated Unicode string in <ConfigAltResp> format which\r
1229 has all values filled in for the names in the Request string.\r
1230 String to be allocated by the called function.\r
1231\r
1232 @retval EFI_SUCCESS The Results is filled with the requested values.\r
1233 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
1234 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
1235 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
1236\r
1237**/\r
1238EFI_STATUS\r
1239EFIAPI\r
1240BootMaintExtractConfig (\r
1241 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
1242 IN CONST EFI_STRING Request,\r
1243 OUT EFI_STRING *Progress,\r
1244 OUT EFI_STRING *Results\r
1245 );\r
1246\r
1247/**\r
1248 This function applies changes in a driver's configuration.\r
1249 Input is a Configuration, which has the routing data for this\r
1250 driver followed by name / value configuration pairs. The driver\r
1251 must apply those pairs to its configurable storage. If the\r
1252 driver's configuration is stored in a linear block of data\r
1253 and the driver's name / value pairs are in <BlockConfig>\r
1254 format, it may use the ConfigToBlock helper function (above) to\r
1255 simplify the job. Currently not implemented.\r
1256\r
1257 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
1258 @param[in] Configuration A null-terminated Unicode string in\r
1259 <ConfigString> format. \r
1260 @param[out] Progress A pointer to a string filled in with the\r
1261 offset of the most recent '&' before the\r
1262 first failing name / value pair (or the\r
1263 beginn ing of the string if the failure\r
1264 is in the first name / value pair) or\r
1265 the terminating NULL if all was\r
1266 successful.\r
1267\r
1268 @retval EFI_SUCCESS The results have been distributed or are\r
1269 awaiting distribution. \r
1270 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the\r
1271 parts of the results that must be\r
1272 stored awaiting possible future\r
1273 protocols.\r
1274 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the\r
1275 Results parameter would result\r
1276 in this type of error.\r
1277 @retval EFI_NOT_FOUND Target for the specified routing data\r
1278 was not found.\r
1279**/\r
1280EFI_STATUS\r
1281EFIAPI\r
1282BootMaintRouteConfig (\r
1283 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
1284 IN CONST EFI_STRING Configuration,\r
1285 OUT EFI_STRING *Progress\r
1286 );\r
1287\r
1288/**\r
1289 This function processes the results of changes in configuration.\r
1290\r
1291\r
1292 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
1293 @param Action Specifies the type of action taken by the browser.\r
1294 @param QuestionId A unique value which is sent to the original exporting driver\r
1295 so that it can identify the type of data to expect.\r
1296 @param Type The type of value for the question.\r
1297 @param Value A pointer to the data being sent to the original exporting driver.\r
1298 @param ActionRequest On return, points to the action requested by the callback function.\r
1299\r
1300 @retval EFI_SUCCESS The callback successfully handled the action.\r
1301 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
1302 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
1303 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.\r
1304 @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.\r
1305**/\r
1306EFI_STATUS\r
1307EFIAPI\r
1308BootMaintCallback (\r
1309 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
1310 IN EFI_BROWSER_ACTION Action,\r
1311 IN EFI_QUESTION_ID QuestionId,\r
1312 IN UINT8 Type,\r
1313 IN EFI_IFR_TYPE_VALUE *Value,\r
1314 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
1315 );\r
1316\r
1317/**\r
1318 Create boot option base on the input file path info.\r
1319\r
1320 @param FilePath Point to the file path.\r
1321\r
1322 @retval TRUE Exit caller function.\r
1323 @retval FALSE Not exit caller function.\r
1324\r
1325**/\r
1326BOOLEAN \r
1327CreateBootOptionFromFile (\r
1328 IN EFI_DEVICE_PATH_PROTOCOL *FilePath\r
1329 );\r
1330\r
1331/**\r
1332 Create driver option base on the input file path info.\r
1333\r
1334 @param FilePath Point to the file path.\r
1335\r
1336 @retval TRUE Exit caller function.\r
1337 @retval FALSE Not exit caller function.\r
1338**/\r
1339BOOLEAN \r
1340CreateDriverOptionFromFile (\r
1341 IN EFI_DEVICE_PATH_PROTOCOL *FilePath\r
1342 );\r
1343\r
1344/**\r
1345 Boot the file specified by the input file path info.\r
1346\r
1347 @param FilePath Point to the file path.\r
1348\r
1349 @retval TRUE Exit caller function.\r
1350 @retval FALSE Not exit caller function.\r
1351 \r
1352**/\r
1353BOOLEAN \r
1354BootFromFile (\r
1355 IN EFI_DEVICE_PATH_PROTOCOL *FilePath\r
1356 );\r
1357\r
1358//\r
1359// Global variable in this program (defined in data.c)\r
1360//\r
1361extern BM_MENU_OPTION BootOptionMenu;\r
1362extern BM_MENU_OPTION DriverOptionMenu;\r
1363extern BM_MENU_OPTION ConsoleInpMenu;\r
1364extern BM_MENU_OPTION ConsoleOutMenu;\r
1365extern BM_MENU_OPTION ConsoleErrMenu;\r
1366extern BM_MENU_OPTION DriverMenu;\r
1367extern BM_MENU_OPTION TerminalMenu;\r
1368extern UINT16 TerminalType[5];\r
1369extern COM_ATTR BaudRateList[19];\r
1370extern COM_ATTR DataBitsList[4];\r
1371extern COM_ATTR ParityList[5];\r
1372extern COM_ATTR StopBitsList[3];\r
1373extern EFI_GUID TerminalTypeGuid[5];\r
1374extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];\r
1375extern UINT16 mFlowControlType[2];\r
1376extern UINT32 mFlowControlValue[2];\r
1377\r
1378//\r
1379// Shared IFR form update data\r
1380//\r
1381extern VOID *mStartOpCodeHandle;\r
1382extern VOID *mEndOpCodeHandle;\r
1383extern EFI_IFR_GUID_LABEL *mStartLabel;\r
1384extern EFI_IFR_GUID_LABEL *mEndLabel;\r
1385extern BMM_CALLBACK_DATA gBootMaintenancePrivate;\r
1386extern BMM_CALLBACK_DATA *mBmmCallbackInfo;\r
1387\r
1388#endif\r