2 The functions for Boot Maintainence Main menu.
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
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.
15 #include "BootMaint.h"
17 EFI_DEVICE_PATH_PROTOCOL EndDevicePath
[] = {
20 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
22 END_DEVICE_PATH_LENGTH
,
28 HII_VENDOR_DEVICE_PATH mBmmHiiVendorDevicePath
= {
34 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
35 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
39 // {165A028F-0BB2-4b5f-8747-77592E3F6499}
41 { 0x165a028f, 0xbb2, 0x4b5f, { 0x87, 0x47, 0x77, 0x59, 0x2e, 0x3f, 0x64, 0x99 } }
45 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
47 (UINT8
) (END_DEVICE_PATH_LENGTH
),
48 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
53 HII_VENDOR_DEVICE_PATH mFeHiiVendorDevicePath
= {
59 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
60 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
64 // {91DB4238-B0C8-472e-BBCF-F3A6541010F4}
66 { 0x91db4238, 0xb0c8, 0x472e, { 0xbb, 0xcf, 0xf3, 0xa6, 0x54, 0x10, 0x10, 0xf4 } }
70 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
72 (UINT8
) (END_DEVICE_PATH_LENGTH
),
73 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
78 EFI_GUID mBootMaintGuid
= BOOT_MAINT_FORMSET_GUID
;
79 EFI_GUID mFileExplorerGuid
= FILE_EXPLORE_FORMSET_GUID
;
81 CHAR16 mBootMaintStorageName
[] = L
"BmmData";
82 CHAR16 mFileExplorerStorageName
[] = L
"FeData";
83 BMM_CALLBACK_DATA
*mBmmCallbackInfo
= NULL
;
84 BOOLEAN mAllMenuInit
= FALSE
;
85 BOOLEAN mEnterFileExplorer
= FALSE
;
90 @param CallbackData The BMM context data.
95 IN BMM_CALLBACK_DATA
*CallbackData
99 Free up all Menu Option list.
108 Create string tokens for a menu from its help strings and display strings
110 @param CallbackData The BMM context data.
111 @param HiiHandle Hii Handle of the package to be updated.
112 @param MenuOption The Menu whose string tokens need to be created
114 @retval EFI_SUCCESS String tokens created successfully
115 @retval others contain some errors
118 CreateMenuStringToken (
119 IN BMM_CALLBACK_DATA
*CallbackData
,
120 IN EFI_HII_HANDLE HiiHandle
,
121 IN BM_MENU_OPTION
*MenuOption
124 BM_MENU_ENTRY
*NewMenuEntry
;
127 for (Index
= 0; Index
< MenuOption
->MenuNumber
; Index
++) {
128 NewMenuEntry
= BOpt_GetMenuEntry (MenuOption
, Index
);
130 NewMenuEntry
->DisplayStringToken
= HiiSetString (
133 NewMenuEntry
->DisplayString
,
137 if (NULL
== NewMenuEntry
->HelpString
) {
138 NewMenuEntry
->HelpStringToken
= NewMenuEntry
->DisplayStringToken
;
140 NewMenuEntry
->HelpStringToken
= HiiSetString (
143 NewMenuEntry
->HelpString
,
153 This function allows a caller to extract the current configuration for one
154 or more named elements from the target driver.
157 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
158 @param Request A null-terminated Unicode string in <ConfigRequest> format.
159 @param Progress On return, points to a character in the Request string.
160 Points to the string's null terminator if request was successful.
161 Points to the most recent '&' before the first failing name/value
162 pair (or the beginning of the string if the failure is in the
163 first name/value pair) if the request was not successful.
164 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
165 has all values filled in for the names in the Request string.
166 String to be allocated by the called function.
168 @retval EFI_SUCCESS The Results is filled with the requested values.
169 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
170 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
171 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
176 BootMaintExtractConfig (
177 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
178 IN CONST EFI_STRING Request
,
179 OUT EFI_STRING
*Progress
,
180 OUT EFI_STRING
*Results
185 BMM_CALLBACK_DATA
*Private
;
186 EFI_STRING ConfigRequestHdr
;
187 EFI_STRING ConfigRequest
;
188 BOOLEAN AllocatedRequest
;
191 if (Progress
== NULL
|| Results
== NULL
) {
192 return EFI_INVALID_PARAMETER
;
196 if ((Request
!= NULL
) && !HiiIsConfigHdrMatch (Request
, &mBootMaintGuid
, mBootMaintStorageName
)) {
197 return EFI_NOT_FOUND
;
200 ConfigRequestHdr
= NULL
;
201 ConfigRequest
= NULL
;
202 AllocatedRequest
= FALSE
;
205 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
207 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
209 BufferSize
= sizeof (BMM_FAKE_NV_DATA
);
210 ConfigRequest
= Request
;
211 if ((Request
== NULL
) || (StrStr (Request
, L
"OFFSET") == NULL
)) {
213 // Request has no request element, construct full request string.
214 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
215 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
217 ConfigRequestHdr
= HiiConstructConfigHdr (&mBootMaintGuid
, mBootMaintStorageName
, Private
->BmmDriverHandle
);
218 Size
= (StrLen (ConfigRequestHdr
) + 32 + 1) * sizeof (CHAR16
);
219 ConfigRequest
= AllocateZeroPool (Size
);
220 ASSERT (ConfigRequest
!= NULL
);
221 AllocatedRequest
= TRUE
;
222 UnicodeSPrint (ConfigRequest
, Size
, L
"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr
, (UINT64
)BufferSize
);
223 FreePool (ConfigRequestHdr
);
226 Status
= gHiiConfigRouting
->BlockToConfig (
229 (UINT8
*) &Private
->BmmFakeNvData
,
235 // Free the allocated config request string.
237 if (AllocatedRequest
) {
238 FreePool (ConfigRequest
);
239 ConfigRequest
= NULL
;
242 // Set Progress string to the original request string.
244 if (Request
== NULL
) {
246 } else if (StrStr (Request
, L
"OFFSET") == NULL
) {
247 *Progress
= Request
+ StrLen (Request
);
254 This function applies changes in a driver's configuration.
255 Input is a Configuration, which has the routing data for this
256 driver followed by name / value configuration pairs. The driver
257 must apply those pairs to its configurable storage. If the
258 driver's configuration is stored in a linear block of data
259 and the driver's name / value pairs are in <BlockConfig>
260 format, it may use the ConfigToBlock helper function (above) to
261 simplify the job. Currently not implemented.
263 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
264 @param[in] Configuration A null-terminated Unicode string in
265 <ConfigString> format.
266 @param[out] Progress A pointer to a string filled in with the
267 offset of the most recent '&' before the
268 first failing name / value pair (or the
269 beginn ing of the string if the failure
270 is in the first name / value pair) or
271 the terminating NULL if all was
274 @retval EFI_SUCCESS The results have been distributed or are
275 awaiting distribution.
276 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
277 parts of the results that must be
278 stored awaiting possible future
280 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
281 Results parameter would result
282 in this type of error.
283 @retval EFI_NOT_FOUND Target for the specified routing data
288 BootMaintRouteConfig (
289 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
290 IN CONST EFI_STRING Configuration
,
291 OUT EFI_STRING
*Progress
296 EFI_HII_CONFIG_ROUTING_PROTOCOL
*ConfigRouting
;
297 BMM_FAKE_NV_DATA
*NewBmmData
;
298 BMM_FAKE_NV_DATA
*OldBmmData
;
299 BM_MENU_ENTRY
*NewMenuEntry
;
300 BM_LOAD_CONTEXT
*NewLoadContext
;
302 BMM_CALLBACK_DATA
*Private
;
304 if (Progress
== NULL
) {
305 return EFI_INVALID_PARAMETER
;
307 *Progress
= Configuration
;
309 if (Configuration
== NULL
) {
310 return EFI_INVALID_PARAMETER
;
314 // Check routing data in <ConfigHdr>.
315 // Note: there is no name for Name/Value storage, only GUID will be checked
317 if (!HiiIsConfigHdrMatch (Configuration
, &mBootMaintGuid
, mBootMaintStorageName
)) {
318 return EFI_NOT_FOUND
;
321 Status
= gBS
->LocateProtocol (
322 &gEfiHiiConfigRoutingProtocolGuid
,
324 (VOID
**)&ConfigRouting
326 if (EFI_ERROR (Status
)) {
330 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
332 // Get Buffer Storage data from EFI variable
334 BufferSize
= sizeof (BMM_FAKE_NV_DATA
);
335 OldBmmData
= &Private
->BmmOldFakeNVData
;
336 NewBmmData
= &Private
->BmmFakeNvData
;
338 // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
340 Status
= ConfigRouting
->ConfigToBlock (
343 (UINT8
*) NewBmmData
,
347 ASSERT_EFI_ERROR (Status
);
349 // Compare new and old BMM configuration data and only do action for modified item to
350 // avoid setting unnecessary non-volatile variable
354 // Check data which located in BMM main page and save the settings if need
356 if (CompareMem (&NewBmmData
->BootNext
, &OldBmmData
->BootNext
, sizeof (NewBmmData
->BootNext
)) != 0) {
357 Status
= Var_UpdateBootNext (Private
);
361 // Check data which located in Boot Options Menu and save the settings if need
363 if (CompareMem (NewBmmData
->BootOptionDel
, OldBmmData
->BootOptionDel
, sizeof (NewBmmData
->BootOptionDel
)) != 0) {
365 ((Index
< BootOptionMenu
.MenuNumber
) && (Index
< (sizeof (NewBmmData
->BootOptionDel
) / sizeof (NewBmmData
->BootOptionDel
[0]))));
367 NewMenuEntry
= BOpt_GetMenuEntry (&BootOptionMenu
, Index
);
368 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
369 NewLoadContext
->Deleted
= NewBmmData
->BootOptionDel
[Index
];
370 NewBmmData
->BootOptionDel
[Index
] = FALSE
;
373 Var_DelBootOption ();
376 if (CompareMem (NewBmmData
->BootOptionOrder
, OldBmmData
->BootOptionOrder
, sizeof (NewBmmData
->BootOptionOrder
)) != 0) {
377 Status
= Var_UpdateBootOrder (Private
);
381 // Check data which located in Driver Options Menu and save the settings if need
383 if (CompareMem (NewBmmData
->DriverOptionDel
, OldBmmData
->DriverOptionDel
, sizeof (NewBmmData
->DriverOptionDel
)) != 0) {
385 ((Index
< DriverOptionMenu
.MenuNumber
) && (Index
< (sizeof (NewBmmData
->DriverOptionDel
) / sizeof (NewBmmData
->DriverOptionDel
[0]))));
387 NewMenuEntry
= BOpt_GetMenuEntry (&DriverOptionMenu
, Index
);
388 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
389 NewLoadContext
->Deleted
= NewBmmData
->DriverOptionDel
[Index
];
390 NewBmmData
->DriverOptionDel
[Index
] = FALSE
;
392 Var_DelDriverOption ();
395 if (CompareMem (NewBmmData
->DriverOptionOrder
, OldBmmData
->DriverOptionOrder
, sizeof (NewBmmData
->DriverOptionOrder
)) != 0) {
396 Status
= Var_UpdateDriverOrder (Private
);
400 // After user do the save action, need to update OldBmmData.
402 CopyMem (OldBmmData
, NewBmmData
, sizeof (BMM_FAKE_NV_DATA
));
408 This function processes the results of changes in configuration.
411 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
412 @param Action Specifies the type of action taken by the browser.
413 @param QuestionId A unique value which is sent to the original exporting driver
414 so that it can identify the type of data to expect.
415 @param Type The type of value for the question.
416 @param Value A pointer to the data being sent to the original exporting driver.
417 @param ActionRequest On return, points to the action requested by the callback function.
419 @retval EFI_SUCCESS The callback successfully handled the action.
420 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
421 @retval EFI_DEVICE_ERROR The variable could not be saved.
422 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
423 @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
428 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
429 IN EFI_BROWSER_ACTION Action
,
430 IN EFI_QUESTION_ID QuestionId
,
432 IN EFI_IFR_TYPE_VALUE
*Value
,
433 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
436 BMM_CALLBACK_DATA
*Private
;
437 BM_MENU_ENTRY
*NewMenuEntry
;
438 BMM_FAKE_NV_DATA
*CurrentFakeNVMap
;
446 //Chech whether exit from FileExplorer and reenter BM,if yes,reclaim string depositories
448 if (Action
== EFI_BROWSER_ACTION_FORM_OPEN
){
449 if(mEnterFileExplorer
){
450 ReclaimStringDepository();
451 mEnterFileExplorer
= FALSE
;
455 if (Action
!= EFI_BROWSER_ACTION_CHANGING
&& Action
!= EFI_BROWSER_ACTION_CHANGED
) {
457 // Do nothing for other UEFI Action. Only do call back when data is changed.
459 return EFI_UNSUPPORTED
;
466 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
469 // Retrive uncommitted data from Form Browser
471 CurrentFakeNVMap
= &Private
->BmmFakeNvData
;
472 HiiGetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
);
474 if (Action
== EFI_BROWSER_ACTION_CHANGING
) {
476 return EFI_INVALID_PARAMETER
;
479 UpdatePageId (Private
, QuestionId
);
481 if (QuestionId
< FILE_OPTION_OFFSET
) {
482 if (QuestionId
< CONFIG_OPTION_OFFSET
) {
483 switch (QuestionId
) {
484 case FORM_BOOT_ADD_ID
:
485 // Leave Bm and enter FileExplorer.
486 Private
->FeCurrentState
= FileExplorerStateAddBootOption
;
487 Private
->FeDisplayContext
= FileExplorerDisplayUnknown
;
488 ReclaimStringDepository ();
489 UpdateFileExplorer(Private
, 0);
490 mEnterFileExplorer
= TRUE
;
493 case FORM_DRV_ADD_FILE_ID
:
494 // Leave Bm and enter FileExplorer.
495 Private
->FeCurrentState
= FileExplorerStateAddDriverOptionState
;
496 Private
->FeDisplayContext
= FileExplorerDisplayUnknown
;
497 ReclaimStringDepository ();
498 UpdateFileExplorer(Private
, 0);
499 mEnterFileExplorer
= TRUE
;
502 case FORM_DRV_ADD_HANDLE_ID
:
503 CleanUpPage (FORM_DRV_ADD_HANDLE_ID
, Private
);
504 UpdateDrvAddHandlePage (Private
);
507 case FORM_BOOT_DEL_ID
:
508 CleanUpPage (FORM_BOOT_DEL_ID
, Private
);
509 UpdateBootDelPage (Private
);
512 case FORM_BOOT_CHG_ID
:
513 case FORM_DRV_CHG_ID
:
514 UpdatePageBody (QuestionId
, Private
);
517 case FORM_DRV_DEL_ID
:
518 CleanUpPage (FORM_DRV_DEL_ID
, Private
);
519 UpdateDrvDelPage (Private
);
522 case FORM_BOOT_NEXT_ID
:
523 CleanUpPage (FORM_BOOT_NEXT_ID
, Private
);
524 UpdateBootNextPage (Private
);
527 case FORM_TIME_OUT_ID
:
528 CleanUpPage (FORM_TIME_OUT_ID
, Private
);
529 UpdateTimeOutPage (Private
);
533 case FORM_CON_OUT_ID
:
534 case FORM_CON_ERR_ID
:
535 UpdatePageBody (QuestionId
, Private
);
538 case FORM_CON_MODE_ID
:
539 CleanUpPage (FORM_CON_MODE_ID
, Private
);
540 UpdateConModePage (Private
);
543 case FORM_CON_COM_ID
:
544 CleanUpPage (FORM_CON_COM_ID
, Private
);
545 UpdateConCOMPage (Private
);
551 } else if ((QuestionId
>= TERMINAL_OPTION_OFFSET
) && (QuestionId
< CONSOLE_OPTION_OFFSET
)) {
552 Index
= (UINT16
) (QuestionId
- TERMINAL_OPTION_OFFSET
);
553 Private
->CurrentTerminal
= Index
;
555 CleanUpPage (FORM_CON_COM_SETUP_ID
, Private
);
556 UpdateTerminalPage (Private
);
558 } else if (QuestionId
>= HANDLE_OPTION_OFFSET
) {
559 Index
= (UINT16
) (QuestionId
- HANDLE_OPTION_OFFSET
);
561 NewMenuEntry
= BOpt_GetMenuEntry (&DriverMenu
, Index
);
562 ASSERT (NewMenuEntry
!= NULL
);
563 Private
->HandleContext
= (BM_HANDLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
565 CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID
, Private
);
567 Private
->MenuEntry
= NewMenuEntry
;
568 Private
->LoadContext
->FilePathList
= Private
->HandleContext
->DevicePath
;
570 UpdateDriverAddHandleDescPage (Private
);
573 if (QuestionId
== KEY_VALUE_BOOT_FROM_FILE
){
574 // Leave Bm and enter FileExplorer.
575 Private
->FeCurrentState
= FileExplorerStateBootFromFile
;
576 Private
->FeDisplayContext
= FileExplorerDisplayUnknown
;
577 ReclaimStringDepository ();
578 UpdateFileExplorer(Private
, 0);
579 mEnterFileExplorer
= TRUE
;
581 } else if (Action
== EFI_BROWSER_ACTION_CHANGED
) {
582 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
583 return EFI_INVALID_PARAMETER
;
586 switch (QuestionId
) {
587 case KEY_VALUE_SAVE_AND_EXIT
:
588 case KEY_VALUE_NO_SAVE_AND_EXIT
:
589 if (QuestionId
== KEY_VALUE_SAVE_AND_EXIT
) {
590 Status
= ApplyChangeHandler (Private
, CurrentFakeNVMap
, Private
->BmmPreviousPageId
);
591 if (EFI_ERROR (Status
)) {
594 } else if (QuestionId
== KEY_VALUE_NO_SAVE_AND_EXIT
) {
595 DiscardChangeHandler (Private
, CurrentFakeNVMap
);
599 // Tell browser not to ask for confirmation of changes,
600 // since we have already applied or discarded.
602 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT
;
612 // Pass changed uncommitted data back to Form Browser
614 HiiSetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
, NULL
);
620 Function handling request to apply changes for BMM pages.
622 @param Private Pointer to callback data buffer.
623 @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
624 @param FormId ID of the form which has sent the request to apply change.
626 @retval EFI_SUCCESS Change successfully applied.
627 @retval Other Error occurs while trying to apply changes.
632 IN BMM_CALLBACK_DATA
*Private
,
633 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
,
634 IN EFI_FORM_ID FormId
637 BM_CONSOLE_CONTEXT
*NewConsoleContext
;
638 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
639 BM_LOAD_CONTEXT
*NewLoadContext
;
640 BM_MENU_ENTRY
*NewMenuEntry
;
644 Status
= EFI_SUCCESS
;
647 case FORM_BOOT_DEL_ID
:
649 ((Index
< BootOptionMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->BootOptionDel
) / sizeof (CurrentFakeNVMap
->BootOptionDel
[0]))));
651 NewMenuEntry
= BOpt_GetMenuEntry (&BootOptionMenu
, Index
);
652 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
653 NewLoadContext
->Deleted
= CurrentFakeNVMap
->BootOptionDel
[Index
];
654 CurrentFakeNVMap
->BootOptionDel
[Index
] = FALSE
;
657 Var_DelBootOption ();
660 case FORM_DRV_DEL_ID
:
662 ((Index
< DriverOptionMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->DriverOptionDel
) / sizeof (CurrentFakeNVMap
->DriverOptionDel
[0]))));
664 NewMenuEntry
= BOpt_GetMenuEntry (&DriverOptionMenu
, Index
);
665 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
666 NewLoadContext
->Deleted
= CurrentFakeNVMap
->DriverOptionDel
[Index
];
667 CurrentFakeNVMap
->DriverOptionDel
[Index
] = FALSE
;
670 Var_DelDriverOption ();
673 case FORM_BOOT_CHG_ID
:
674 Status
= Var_UpdateBootOrder (Private
);
677 case FORM_DRV_CHG_ID
:
678 Status
= Var_UpdateDriverOrder (Private
);
681 case FORM_TIME_OUT_ID
:
682 Status
= gRT
->SetVariable (
684 &gEfiGlobalVariableGuid
,
685 EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
,
687 &(CurrentFakeNVMap
->BootTimeOut
)
689 ASSERT_EFI_ERROR(Status
);
691 Private
->BmmOldFakeNVData
.BootTimeOut
= CurrentFakeNVMap
->BootTimeOut
;
694 case FORM_BOOT_NEXT_ID
:
695 Status
= Var_UpdateBootNext (Private
);
698 case FORM_CON_MODE_ID
:
699 Status
= Var_UpdateConMode (Private
);
702 case FORM_CON_COM_SETUP_ID
:
703 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Private
->CurrentTerminal
);
705 ASSERT (NewMenuEntry
!= NULL
);
707 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
709 NewTerminalContext
->BaudRateIndex
= CurrentFakeNVMap
->COMBaudRate
;
710 ASSERT (CurrentFakeNVMap
->COMBaudRate
< (sizeof (BaudRateList
) / sizeof (BaudRateList
[0])));
711 NewTerminalContext
->BaudRate
= BaudRateList
[CurrentFakeNVMap
->COMBaudRate
].Value
;
712 NewTerminalContext
->DataBitsIndex
= CurrentFakeNVMap
->COMDataRate
;
713 ASSERT (CurrentFakeNVMap
->COMDataRate
< (sizeof (DataBitsList
) / sizeof (DataBitsList
[0])));
714 NewTerminalContext
->DataBits
= (UINT8
) DataBitsList
[CurrentFakeNVMap
->COMDataRate
].Value
;
715 NewTerminalContext
->StopBitsIndex
= CurrentFakeNVMap
->COMStopBits
;
716 ASSERT (CurrentFakeNVMap
->COMStopBits
< (sizeof (StopBitsList
) / sizeof (StopBitsList
[0])));
717 NewTerminalContext
->StopBits
= (UINT8
) StopBitsList
[CurrentFakeNVMap
->COMStopBits
].Value
;
718 NewTerminalContext
->ParityIndex
= CurrentFakeNVMap
->COMParity
;
719 ASSERT (CurrentFakeNVMap
->COMParity
< (sizeof (ParityList
) / sizeof (ParityList
[0])));
720 NewTerminalContext
->Parity
= (UINT8
) ParityList
[CurrentFakeNVMap
->COMParity
].Value
;
721 NewTerminalContext
->TerminalType
= CurrentFakeNVMap
->COMTerminalType
;
723 ChangeTerminalDevicePath (
724 NewTerminalContext
->DevicePath
,
728 Var_UpdateConsoleInpOption ();
729 Var_UpdateConsoleOutOption ();
730 Var_UpdateErrorOutOption ();
734 for (Index
= 0; Index
< ConsoleInpMenu
.MenuNumber
; Index
++) {
735 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleInpMenu
, Index
);
736 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
737 ASSERT (Index
< MAX_MENU_NUMBER
);
738 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
741 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
742 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
743 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
744 ASSERT (Index
+ ConsoleInpMenu
.MenuNumber
< MAX_MENU_NUMBER
);
745 NewTerminalContext
->IsConIn
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleInpMenu
.MenuNumber
];
748 Var_UpdateConsoleInpOption ();
751 case FORM_CON_OUT_ID
:
752 for (Index
= 0; Index
< ConsoleOutMenu
.MenuNumber
; Index
++) {
753 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleOutMenu
, Index
);
754 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
755 ASSERT (Index
< MAX_MENU_NUMBER
);
756 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
759 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
760 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
761 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
762 ASSERT (Index
+ ConsoleOutMenu
.MenuNumber
< MAX_MENU_NUMBER
);
763 NewTerminalContext
->IsConOut
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleOutMenu
.MenuNumber
];
766 Var_UpdateConsoleOutOption ();
769 case FORM_CON_ERR_ID
:
770 for (Index
= 0; Index
< ConsoleErrMenu
.MenuNumber
; Index
++) {
771 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleErrMenu
, Index
);
772 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
773 ASSERT (Index
< MAX_MENU_NUMBER
);
774 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
777 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
778 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
779 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
780 ASSERT (Index
+ ConsoleErrMenu
.MenuNumber
< MAX_MENU_NUMBER
);
781 NewTerminalContext
->IsStdErr
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleErrMenu
.MenuNumber
];
784 Var_UpdateErrorOutOption ();
787 case FORM_DRV_ADD_HANDLE_DESC_ID
:
788 Status
= Var_UpdateDriverOption (
790 Private
->BmmHiiHandle
,
791 CurrentFakeNVMap
->DriverAddHandleDesc
,
792 CurrentFakeNVMap
->DriverAddHandleOptionalData
,
793 CurrentFakeNVMap
->DriverAddForceReconnect
795 if (EFI_ERROR (Status
)) {
799 BOpt_GetDriverOptions (Private
);
800 CreateMenuStringToken (Private
, Private
->BmmHiiHandle
, &DriverOptionMenu
);
812 Discard all changes done to the BMM pages such as Boot Order change,
815 @param Private The BMM context data.
816 @param CurrentFakeNVMap The current Fack NV Map.
820 DiscardChangeHandler (
821 IN BMM_CALLBACK_DATA
*Private
,
822 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
827 switch (Private
->BmmPreviousPageId
) {
828 case FORM_BOOT_CHG_ID
:
829 CopyMem (CurrentFakeNVMap
->BootOptionOrder
, Private
->BmmOldFakeNVData
.BootOptionOrder
, sizeof (CurrentFakeNVMap
->BootOptionOrder
));
832 case FORM_DRV_CHG_ID
:
833 CopyMem (CurrentFakeNVMap
->DriverOptionOrder
, Private
->BmmOldFakeNVData
.DriverOptionOrder
, sizeof (CurrentFakeNVMap
->DriverOptionOrder
));
836 case FORM_BOOT_DEL_ID
:
837 ASSERT (BootOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->BootOptionDel
) / sizeof (CurrentFakeNVMap
->BootOptionDel
[0])));
838 for (Index
= 0; Index
< BootOptionMenu
.MenuNumber
; Index
++) {
839 CurrentFakeNVMap
->BootOptionDel
[Index
] = FALSE
;
843 case FORM_DRV_DEL_ID
:
844 ASSERT (DriverOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->DriverOptionDel
) / sizeof (CurrentFakeNVMap
->DriverOptionDel
[0])));
845 for (Index
= 0; Index
< DriverOptionMenu
.MenuNumber
; Index
++) {
846 CurrentFakeNVMap
->DriverOptionDel
[Index
] = FALSE
;
850 case FORM_BOOT_NEXT_ID
:
851 CurrentFakeNVMap
->BootNext
= Private
->BmmOldFakeNVData
.BootNext
;
854 case FORM_TIME_OUT_ID
:
855 CurrentFakeNVMap
->BootTimeOut
= Private
->BmmOldFakeNVData
.BootTimeOut
;
858 case FORM_DRV_ADD_HANDLE_DESC_ID
:
859 case FORM_DRV_ADD_FILE_ID
:
860 case FORM_DRV_ADD_HANDLE_ID
:
861 CurrentFakeNVMap
->DriverAddHandleDesc
[0] = 0x0000;
862 CurrentFakeNVMap
->DriverAddHandleOptionalData
[0] = 0x0000;
872 Create dynamic code for BMM.
874 @param BmmCallbackInfo The BMM context data.
879 IN BMM_CALLBACK_DATA
*BmmCallbackInfo
882 EFI_HII_HANDLE HiiHandle
;
883 VOID
*StartOpCodeHandle
;
884 VOID
*EndOpCodeHandle
;
885 EFI_IFR_GUID_LABEL
*StartLabel
;
886 EFI_IFR_GUID_LABEL
*EndLabel
;
888 EFI_STRING_ID FormSetTitle
;
889 EFI_STRING_ID FormSetHelp
;
892 EFI_STRING_ID TokenHelp
;
893 EFI_HII_HANDLE
*HiiHandles
;
895 EFI_GUID FormSetGuid
;
896 CHAR16
*DevicePathStr
;
897 EFI_STRING_ID DevicePathId
;
899 HiiHandle
= BmmCallbackInfo
->BmmHiiHandle
;
901 // Allocate space for creation of UpdateData Buffer
903 StartOpCodeHandle
= HiiAllocateOpCodeHandle ();
904 ASSERT (StartOpCodeHandle
!= NULL
);
906 EndOpCodeHandle
= HiiAllocateOpCodeHandle ();
907 ASSERT (EndOpCodeHandle
!= NULL
);
910 // Create Hii Extend Label OpCode as the start opcode
912 StartLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (StartOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
913 StartLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
914 StartLabel
->Number
= LABEL_BMM_PLATFORM_INFORMATION
;
917 // Create Hii Extend Label OpCode as the end opcode
919 EndLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (EndOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
920 EndLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
921 EndLabel
->Number
= LABEL_END
;
924 // Get all the Hii handles
926 HiiHandles
= HiiGetHiiHandles (NULL
);
927 ASSERT (HiiHandles
!= NULL
);
930 // Search for formset of each class type
933 for (Index
= 0; HiiHandles
[Index
] != NULL
; Index
++) {
934 if (!ExtractDisplayedHiiFormFromHiiHandle (HiiHandles
[Index
], &gEfiIfrBootMaintenanceGuid
, SkipCount
, &FormSetTitle
, &FormSetHelp
, &FormSetGuid
)) {
938 String
= HiiGetString (HiiHandles
[Index
], FormSetTitle
, NULL
);
939 if (String
== NULL
) {
940 String
= HiiGetString (HiiHandle
, STR_MISSING_STRING
, NULL
);
941 ASSERT (String
!= NULL
);
943 Token
= HiiSetString (HiiHandle
, 0, String
, NULL
);
946 String
= HiiGetString (HiiHandles
[Index
], FormSetHelp
, NULL
);
947 if (String
== NULL
) {
948 String
= HiiGetString (HiiHandle
, STR_MISSING_STRING
, NULL
);
949 ASSERT (String
!= NULL
);
951 TokenHelp
= HiiSetString (HiiHandle
, 0, String
, NULL
);
954 DevicePathStr
= ExtractDevicePathFromHiiHandle(HiiHandles
[Index
]);
956 if (DevicePathStr
!= NULL
){
957 DevicePathId
= HiiSetString (HiiHandle
, 0, DevicePathStr
, NULL
);
958 FreePool (DevicePathStr
);
961 HiiCreateGotoExOpCode (
967 (EFI_QUESTION_ID
) (Index
+ FRONT_PAGE_KEY_OFFSET
),
973 //One packagelist may has more than one form package,
974 //Index-- means keep current HiiHandle and still extract from the packagelist,
975 //SkipCount++ means skip the formset which was found before in the same form package.
989 HiiFreeOpCodeHandle (StartOpCodeHandle
);
990 HiiFreeOpCodeHandle (EndOpCodeHandle
);
991 FreePool (HiiHandles
);
996 Create dynamic code for BMM.
998 @param BmmCallbackInfo The BMM context data.
1002 InitializeBmmConfig(
1003 IN BMM_CALLBACK_DATA
*BmmCallbackInfo
1006 UpdateBootDelPage (BmmCallbackInfo
);
1007 UpdateDrvDelPage (BmmCallbackInfo
);
1009 if (TerminalMenu
.MenuNumber
> 0) {
1010 BmmCallbackInfo
->CurrentTerminal
= 0;
1011 UpdateTerminalPage (BmmCallbackInfo
);
1014 InitializeDrivers (BmmCallbackInfo
);
1018 Initialize the Boot Maintenance Utitliy.
1026 BMM_CALLBACK_DATA
*BmmCallbackInfo
;
1028 BmmCallbackInfo
= mBmmCallbackInfo
;
1029 BmmCallbackInfo
->BmmPreviousPageId
= FORM_MAIN_ID
;
1030 BmmCallbackInfo
->BmmCurrentPageId
= FORM_MAIN_ID
;
1031 BmmCallbackInfo
->FeCurrentState
= FileExplorerStateInActive
;
1032 BmmCallbackInfo
->FeDisplayContext
= FileExplorerDisplayUnknown
;
1034 InitAllMenu (BmmCallbackInfo
);
1036 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleInpMenu
);
1037 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleOutMenu
);
1038 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleErrMenu
);
1039 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &BootOptionMenu
);
1040 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverOptionMenu
);
1041 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &TerminalMenu
);
1042 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverMenu
);
1044 InitializeBmmConfig(BmmCallbackInfo
);
1048 Initialized all Menu Option List.
1050 @param CallbackData The BMM context data.
1055 IN BMM_CALLBACK_DATA
*CallbackData
1058 InitializeListHead (&BootOptionMenu
.Head
);
1059 InitializeListHead (&DriverOptionMenu
.Head
);
1060 BOpt_GetBootOptions (CallbackData
);
1061 BOpt_GetDriverOptions (CallbackData
);
1062 InitializeListHead (&FsOptionMenu
.Head
);
1063 BOpt_FindDrivers ();
1064 InitializeListHead (&DirectoryMenu
.Head
);
1065 InitializeListHead (&ConsoleInpMenu
.Head
);
1066 InitializeListHead (&ConsoleOutMenu
.Head
);
1067 InitializeListHead (&ConsoleErrMenu
.Head
);
1068 InitializeListHead (&TerminalMenu
.Head
);
1071 mAllMenuInit
= TRUE
;
1075 Free up all Menu Option list.
1086 BOpt_FreeMenu (&DirectoryMenu
);
1087 BOpt_FreeMenu (&FsOptionMenu
);
1088 BOpt_FreeMenu (&BootOptionMenu
);
1089 BOpt_FreeMenu (&DriverOptionMenu
);
1090 BOpt_FreeMenu (&DriverMenu
);
1092 mAllMenuInit
= FALSE
;
1096 Initialize all the string depositories.
1100 InitializeStringDepository (
1104 STRING_DEPOSITORY
*StringDepository
;
1105 StringDepository
= AllocateZeroPool (sizeof (STRING_DEPOSITORY
) * STRING_DEPOSITORY_NUMBER
);
1106 FileOptionStrDepository
= StringDepository
++;
1107 ConsoleOptionStrDepository
= StringDepository
++;
1108 BootOptionStrDepository
= StringDepository
++;
1109 BootOptionHelpStrDepository
= StringDepository
++;
1110 DriverOptionStrDepository
= StringDepository
++;
1111 DriverOptionHelpStrDepository
= StringDepository
++;
1112 TerminalStrDepository
= StringDepository
;
1116 Fetch a usable string node from the string depository and return the string token.
1118 @param CallbackData The BMM context data.
1119 @param StringDepository The string repository.
1121 @retval EFI_STRING_ID String token.
1125 GetStringTokenFromDepository (
1126 IN BMM_CALLBACK_DATA
*CallbackData
,
1127 IN STRING_DEPOSITORY
*StringDepository
1130 STRING_LIST_NODE
*CurrentListNode
;
1131 STRING_LIST_NODE
*NextListNode
;
1133 CurrentListNode
= StringDepository
->CurrentNode
;
1135 if ((NULL
!= CurrentListNode
) && (NULL
!= CurrentListNode
->Next
)) {
1137 // Fetch one reclaimed node from the list.
1139 NextListNode
= StringDepository
->CurrentNode
->Next
;
1142 // If there is no usable node in the list, update the list.
1144 NextListNode
= AllocateZeroPool (sizeof (STRING_LIST_NODE
));
1145 ASSERT (NextListNode
!= NULL
);
1146 NextListNode
->StringToken
= HiiSetString (CallbackData
->BmmHiiHandle
, 0, L
" ", NULL
);
1147 ASSERT (NextListNode
->StringToken
!= 0);
1149 StringDepository
->TotalNodeNumber
++;
1151 if (NULL
== CurrentListNode
) {
1152 StringDepository
->ListHead
= NextListNode
;
1154 CurrentListNode
->Next
= NextListNode
;
1158 StringDepository
->CurrentNode
= NextListNode
;
1160 return StringDepository
->CurrentNode
->StringToken
;
1164 Reclaim string depositories by moving the current node pointer to list head..
1168 ReclaimStringDepository (
1172 UINTN DepositoryIndex
;
1173 STRING_DEPOSITORY
*StringDepository
;
1175 StringDepository
= FileOptionStrDepository
;
1176 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1177 StringDepository
->CurrentNode
= StringDepository
->ListHead
;
1183 Release resource for all the string depositories.
1187 CleanUpStringDepository (
1192 UINTN DepositoryIndex
;
1193 STRING_LIST_NODE
*CurrentListNode
;
1194 STRING_LIST_NODE
*NextListNode
;
1195 STRING_DEPOSITORY
*StringDepository
;
1198 // Release string list nodes.
1200 StringDepository
= FileOptionStrDepository
;
1201 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1202 CurrentListNode
= StringDepository
->ListHead
;
1203 for (NodeIndex
= 0; NodeIndex
< StringDepository
->TotalNodeNumber
; NodeIndex
++) {
1204 NextListNode
= CurrentListNode
->Next
;
1205 FreePool (CurrentListNode
);
1206 CurrentListNode
= NextListNode
;
1212 // Release string depository.
1214 FreePool (FileOptionStrDepository
);
1218 Install BootMaint and FileExplorer HiiPackages.
1222 InitBootMaintenance(
1226 BMM_CALLBACK_DATA
*BmmCallbackInfo
;
1230 Status
= EFI_SUCCESS
;
1232 if (!gConnectAllHappened
){
1233 EfiBootManagerConnectAll();
1234 gConnectAllHappened
= TRUE
;
1237 EfiBootManagerRefreshAllBootOption ();
1240 // Create CallbackData structures for Driver Callback
1242 BmmCallbackInfo
= AllocateZeroPool (sizeof (BMM_CALLBACK_DATA
));
1243 ASSERT (BmmCallbackInfo
!= NULL
);
1246 // Create LoadOption in BmmCallbackInfo for Driver Callback
1248 Ptr
= AllocateZeroPool (sizeof (BM_LOAD_CONTEXT
) + sizeof (BM_FILE_CONTEXT
) + sizeof (BM_HANDLE_CONTEXT
) + sizeof (BM_MENU_ENTRY
));
1249 ASSERT (Ptr
!= NULL
);
1252 // Initialize Bmm callback data.
1254 BmmCallbackInfo
->LoadContext
= (BM_LOAD_CONTEXT
*) Ptr
;
1255 Ptr
+= sizeof (BM_LOAD_CONTEXT
);
1257 BmmCallbackInfo
->FileContext
= (BM_FILE_CONTEXT
*) Ptr
;
1258 Ptr
+= sizeof (BM_FILE_CONTEXT
);
1260 BmmCallbackInfo
->HandleContext
= (BM_HANDLE_CONTEXT
*) Ptr
;
1261 Ptr
+= sizeof (BM_HANDLE_CONTEXT
);
1263 BmmCallbackInfo
->MenuEntry
= (BM_MENU_ENTRY
*) Ptr
;
1265 BmmCallbackInfo
->Signature
= BMM_CALLBACK_DATA_SIGNATURE
;
1266 BmmCallbackInfo
->BmmConfigAccess
.ExtractConfig
= BootMaintExtractConfig
;
1267 BmmCallbackInfo
->BmmConfigAccess
.RouteConfig
= BootMaintRouteConfig
;
1268 BmmCallbackInfo
->BmmConfigAccess
.Callback
= BootMaintCallback
;
1269 BmmCallbackInfo
->BmmPreviousPageId
= FORM_MAIN_ID
;
1270 BmmCallbackInfo
->BmmCurrentPageId
= FORM_MAIN_ID
;
1271 BmmCallbackInfo
->FeConfigAccess
.ExtractConfig
= FakeExtractConfig
;
1272 BmmCallbackInfo
->FeConfigAccess
.RouteConfig
= FakeRouteConfig
;
1273 BmmCallbackInfo
->FeConfigAccess
.Callback
= FileExplorerCallback
;
1274 BmmCallbackInfo
->FeCurrentState
= FileExplorerStateInActive
;
1275 BmmCallbackInfo
->FeDisplayContext
= FileExplorerDisplayUnknown
;
1278 // Install Device Path Protocol and Config Access protocol to driver handle
1280 Status
= gBS
->InstallMultipleProtocolInterfaces (
1281 &BmmCallbackInfo
->BmmDriverHandle
,
1282 &gEfiDevicePathProtocolGuid
,
1283 &mBmmHiiVendorDevicePath
,
1284 &gEfiHiiConfigAccessProtocolGuid
,
1285 &BmmCallbackInfo
->BmmConfigAccess
,
1288 ASSERT_EFI_ERROR (Status
);
1291 // Install Device Path Protocol and Config Access protocol to driver handle
1293 Status
= gBS
->InstallMultipleProtocolInterfaces (
1294 &BmmCallbackInfo
->FeDriverHandle
,
1295 &gEfiDevicePathProtocolGuid
,
1296 &mFeHiiVendorDevicePath
,
1297 &gEfiHiiConfigAccessProtocolGuid
,
1298 &BmmCallbackInfo
->FeConfigAccess
,
1301 ASSERT_EFI_ERROR (Status
);
1304 // Post our Boot Maint VFR binary to the HII database.
1306 BmmCallbackInfo
->BmmHiiHandle
= HiiAddPackages (
1308 BmmCallbackInfo
->BmmDriverHandle
,
1313 ASSERT (BmmCallbackInfo
->BmmHiiHandle
!= NULL
);
1316 // Post our File Explorer VFR binary to the HII database.
1318 BmmCallbackInfo
->FeHiiHandle
= HiiAddPackages (
1320 BmmCallbackInfo
->FeDriverHandle
,
1325 ASSERT (BmmCallbackInfo
->FeHiiHandle
!= NULL
);
1328 // Init OpCode Handle and Allocate space for creation of Buffer
1330 mStartOpCodeHandle
= HiiAllocateOpCodeHandle ();
1331 ASSERT (mStartOpCodeHandle
!= NULL
);
1333 mEndOpCodeHandle
= HiiAllocateOpCodeHandle ();
1334 ASSERT (mEndOpCodeHandle
!= NULL
);
1337 // Create Hii Extend Label OpCode as the start opcode
1339 mStartLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mStartOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
1340 mStartLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
1343 // Create Hii Extend Label OpCode as the end opcode
1345 mEndLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mEndOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
1346 mEndLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
1347 mEndLabel
->Number
= LABEL_END
;
1349 mBmmCallbackInfo
= BmmCallbackInfo
;
1351 InitializeStringDepository ();
1356 Remove the installed BootMaint and FileExplorer HiiPackages.
1365 BMM_CALLBACK_DATA
*BmmCallbackInfo
;
1367 if (mStartOpCodeHandle
!= NULL
) {
1368 HiiFreeOpCodeHandle (mStartOpCodeHandle
);
1371 if (mEndOpCodeHandle
!= NULL
) {
1372 HiiFreeOpCodeHandle (mEndOpCodeHandle
);
1376 CleanUpStringDepository ();
1378 BmmCallbackInfo
= mBmmCallbackInfo
;
1381 // Remove our IFR data from HII database
1383 HiiRemovePackages (BmmCallbackInfo
->BmmHiiHandle
);
1384 HiiRemovePackages (BmmCallbackInfo
->FeHiiHandle
);
1386 gBS
->UninstallMultipleProtocolInterfaces (
1387 BmmCallbackInfo
->FeDriverHandle
,
1388 &gEfiDevicePathProtocolGuid
,
1389 &mFeHiiVendorDevicePath
,
1390 &gEfiHiiConfigAccessProtocolGuid
,
1391 &BmmCallbackInfo
->FeConfigAccess
,
1395 gBS
->UninstallMultipleProtocolInterfaces (
1396 BmmCallbackInfo
->BmmDriverHandle
,
1397 &gEfiDevicePathProtocolGuid
,
1398 &mBmmHiiVendorDevicePath
,
1399 &gEfiHiiConfigAccessProtocolGuid
,
1400 &BmmCallbackInfo
->BmmConfigAccess
,
1404 FreePool (BmmCallbackInfo
->LoadContext
);
1405 FreePool (BmmCallbackInfo
);