2 The functions for Boot Maintainence Main menu.
4 Copyright (c) 2004 - 2011, 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"
18 #include "FrontPage.h"
20 EFI_DEVICE_PATH_PROTOCOL EndDevicePath
[] = {
23 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
25 END_DEVICE_PATH_LENGTH
,
31 HII_VENDOR_DEVICE_PATH mBmmHiiVendorDevicePath
= {
37 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
38 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
42 // {165A028F-0BB2-4b5f-8747-77592E3F6499}
44 { 0x165a028f, 0xbb2, 0x4b5f, { 0x87, 0x47, 0x77, 0x59, 0x2e, 0x3f, 0x64, 0x99 } }
48 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
50 (UINT8
) (END_DEVICE_PATH_LENGTH
),
51 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
56 HII_VENDOR_DEVICE_PATH mFeHiiVendorDevicePath
= {
62 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
63 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
67 // {91DB4238-B0C8-472e-BBCF-F3A6541010F4}
69 { 0x91db4238, 0xb0c8, 0x472e, { 0xbb, 0xcf, 0xf3, 0xa6, 0x54, 0x10, 0x10, 0xf4 } }
73 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
75 (UINT8
) (END_DEVICE_PATH_LENGTH
),
76 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
81 EFI_GUID EfiLegacyDevOrderGuid
= EFI_LEGACY_DEV_ORDER_VARIABLE_GUID
;
82 EFI_GUID mBootMaintGuid
= BOOT_MAINT_FORMSET_GUID
;
83 EFI_GUID mFileExplorerGuid
= FILE_EXPLORE_FORMSET_GUID
;
85 CHAR16 mBootMaintStorageName
[] = L
"BmmData";
86 CHAR16 mFileExplorerStorageName
[] = L
"FeData";
91 @param CallbackData The BMM context data.
96 IN BMM_CALLBACK_DATA
*CallbackData
100 Free up all Menu Option list.
109 Create string tokens for a menu from its help strings and display strings
111 @param CallbackData The BMM context data.
112 @param HiiHandle Hii Handle of the package to be updated.
113 @param MenuOption The Menu whose string tokens need to be created
115 @retval EFI_SUCCESS String tokens created successfully
116 @retval others contain some errors
119 CreateMenuStringToken (
120 IN BMM_CALLBACK_DATA
*CallbackData
,
121 IN EFI_HII_HANDLE HiiHandle
,
122 IN BM_MENU_OPTION
*MenuOption
125 BM_MENU_ENTRY
*NewMenuEntry
;
128 for (Index
= 0; Index
< MenuOption
->MenuNumber
; Index
++) {
129 NewMenuEntry
= BOpt_GetMenuEntry (MenuOption
, Index
);
131 NewMenuEntry
->DisplayStringToken
= HiiSetString (
134 NewMenuEntry
->DisplayString
,
138 if (NULL
== NewMenuEntry
->HelpString
) {
139 NewMenuEntry
->HelpStringToken
= NewMenuEntry
->DisplayStringToken
;
141 NewMenuEntry
->HelpStringToken
= HiiSetString (
144 NewMenuEntry
->HelpString
,
154 This function allows a caller to extract the current configuration for one
155 or more named elements from the target driver.
158 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
159 @param Request A null-terminated Unicode string in <ConfigRequest> format.
160 @param Progress On return, points to a character in the Request string.
161 Points to the string's null terminator if request was successful.
162 Points to the most recent '&' before the first failing name/value
163 pair (or the beginning of the string if the failure is in the
164 first name/value pair) if the request was not successful.
165 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
166 has all values filled in for the names in the Request string.
167 String to be allocated by the called function.
169 @retval EFI_SUCCESS The Results is filled with the requested values.
170 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
171 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
172 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
177 BootMaintExtractConfig (
178 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
179 IN CONST EFI_STRING Request
,
180 OUT EFI_STRING
*Progress
,
181 OUT EFI_STRING
*Results
186 BMM_CALLBACK_DATA
*Private
;
187 EFI_STRING ConfigRequestHdr
;
188 EFI_STRING ConfigRequest
;
189 BOOLEAN AllocatedRequest
;
192 if (Progress
== NULL
|| Results
== NULL
) {
193 return EFI_INVALID_PARAMETER
;
197 if ((Request
!= NULL
) && !HiiIsConfigHdrMatch (Request
, &mBootMaintGuid
, mBootMaintStorageName
)) {
198 return EFI_NOT_FOUND
;
201 ConfigRequestHdr
= NULL
;
202 ConfigRequest
= NULL
;
203 AllocatedRequest
= FALSE
;
206 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
208 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
210 BufferSize
= sizeof (BMM_FAKE_NV_DATA
);
211 ConfigRequest
= Request
;
212 if ((Request
== NULL
) || (StrStr (Request
, L
"OFFSET") == NULL
)) {
214 // Request has no request element, construct full request string.
215 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
216 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
218 ConfigRequestHdr
= HiiConstructConfigHdr (&mBootMaintGuid
, mBootMaintStorageName
, Private
->BmmDriverHandle
);
219 Size
= (StrLen (ConfigRequestHdr
) + 32 + 1) * sizeof (CHAR16
);
220 ConfigRequest
= AllocateZeroPool (Size
);
221 ASSERT (ConfigRequest
!= NULL
);
222 AllocatedRequest
= TRUE
;
223 UnicodeSPrint (ConfigRequest
, Size
, L
"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr
, (UINT64
)BufferSize
);
224 FreePool (ConfigRequestHdr
);
227 Status
= gHiiConfigRouting
->BlockToConfig (
230 (UINT8
*) &Private
->BmmFakeNvData
,
236 // Free the allocated config request string.
238 if (AllocatedRequest
) {
239 FreePool (ConfigRequest
);
240 ConfigRequest
= NULL
;
243 // Set Progress string to the original request string.
245 if (Request
== NULL
) {
247 } else if (StrStr (Request
, L
"OFFSET") == NULL
) {
248 *Progress
= Request
+ StrLen (Request
);
255 This function processes the results of changes in configuration.
258 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
259 @param Action Specifies the type of action taken by the browser.
260 @param QuestionId A unique value which is sent to the original exporting driver
261 so that it can identify the type of data to expect.
262 @param Type The type of value for the question.
263 @param Value A pointer to the data being sent to the original exporting driver.
264 @param ActionRequest On return, points to the action requested by the callback function.
266 @retval EFI_SUCCESS The callback successfully handled the action.
267 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
268 @retval EFI_DEVICE_ERROR The variable could not be saved.
269 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
270 @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
275 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
276 IN EFI_BROWSER_ACTION Action
,
277 IN EFI_QUESTION_ID QuestionId
,
279 IN EFI_IFR_TYPE_VALUE
*Value
,
280 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
283 BMM_CALLBACK_DATA
*Private
;
284 BM_MENU_ENTRY
*NewMenuEntry
;
285 BMM_FAKE_NV_DATA
*CurrentFakeNVMap
;
300 if ((Action
== EFI_BROWSER_ACTION_FORM_OPEN
) || (Action
== EFI_BROWSER_ACTION_FORM_CLOSE
)) {
302 // Do nothing for UEFI OPEN/CLOSE Action
307 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
308 return EFI_INVALID_PARAMETER
;
318 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
320 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
321 UpdatePageId (Private
, QuestionId
);
324 // Retrive uncommitted data from Form Browser
326 CurrentFakeNVMap
= &Private
->BmmFakeNvData
;
327 HiiGetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
);
330 // need to be subtituded.
332 // Update Select FD/HD/CD/NET/BEV Order Form
334 if (FORM_SET_FD_ORDER_ID
== Private
->BmmPreviousPageId
||
335 FORM_SET_HD_ORDER_ID
== Private
->BmmPreviousPageId
||
336 FORM_SET_CD_ORDER_ID
== Private
->BmmPreviousPageId
||
337 FORM_SET_NET_ORDER_ID
== Private
->BmmPreviousPageId
||
338 FORM_SET_BEV_ORDER_ID
== Private
->BmmPreviousPageId
||
339 ((FORM_BOOT_SETUP_ID
== Private
->BmmPreviousPageId
) &&
340 (QuestionId
>= LEGACY_FD_QUESTION_ID
) &&
341 (QuestionId
< (LEGACY_BEV_QUESTION_ID
+ 100)) )
344 DisMap
= Private
->BmmOldFakeNVData
.DisableMap
;
346 FormId
= Private
->BmmPreviousPageId
;
347 if (FormId
== FORM_BOOT_SETUP_ID
) {
348 FormId
= Private
->BmmCurrentPageId
;
352 case FORM_SET_FD_ORDER_ID
:
353 Number
= (UINT16
) LegacyFDMenu
.MenuNumber
;
354 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyFD
;
355 NewLegacyDev
= CurrentFakeNVMap
->LegacyFD
;
358 case FORM_SET_HD_ORDER_ID
:
359 Number
= (UINT16
) LegacyHDMenu
.MenuNumber
;
360 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyHD
;
361 NewLegacyDev
= CurrentFakeNVMap
->LegacyHD
;
364 case FORM_SET_CD_ORDER_ID
:
365 Number
= (UINT16
) LegacyCDMenu
.MenuNumber
;
366 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyCD
;
367 NewLegacyDev
= CurrentFakeNVMap
->LegacyCD
;
370 case FORM_SET_NET_ORDER_ID
:
371 Number
= (UINT16
) LegacyNETMenu
.MenuNumber
;
372 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyNET
;
373 NewLegacyDev
= CurrentFakeNVMap
->LegacyNET
;
376 case FORM_SET_BEV_ORDER_ID
:
377 Number
= (UINT16
) LegacyBEVMenu
.MenuNumber
;
378 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyBEV
;
379 NewLegacyDev
= CurrentFakeNVMap
->LegacyBEV
;
386 // First, find the different position
387 // if there is change, it should be only one
389 for (Index
= 0; Index
< Number
; Index
++) {
390 if (OldLegacyDev
[Index
] != NewLegacyDev
[Index
]) {
391 OldValue
= OldLegacyDev
[Index
];
392 NewValue
= NewLegacyDev
[Index
];
397 if (Index
!= Number
) {
399 // there is change, now process
401 if (0xFF == NewValue
) {
403 // This item will be disable
404 // Just move the items behind this forward to overlap it
407 Bit
= 7 - (OldValue
% 8);
408 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] | (UINT8
) (1 << Bit
));
409 for (Index2
= Index
; Index2
< Number
- 1; Index2
++) {
410 NewLegacyDev
[Index2
] = NewLegacyDev
[Index2
+ 1];
413 NewLegacyDev
[Index2
] = 0xFF;
415 for (Index2
= 0; Index2
< Number
; Index2
++) {
416 if (Index2
== Index
) {
420 if (OldLegacyDev
[Index2
] == NewValue
) {
422 // If NewValue is in OldLegacyDev array
423 // remember its old position
425 NewValuePos
= Index2
;
430 if (Index2
!= Number
) {
432 // We will change current item to an existing item
433 // (It's hard to describe here, please read code, it's like a cycle-moving)
435 for (Index2
= NewValuePos
; Index2
!= Index
;) {
436 if (NewValuePos
< Index
) {
437 NewLegacyDev
[Index2
] = OldLegacyDev
[Index2
+ 1];
440 NewLegacyDev
[Index2
] = OldLegacyDev
[Index2
- 1];
446 // If NewValue is not in OldlegacyDev array, we are changing to a disabled item
447 // so we should modify DisMap to reflect the change
450 Bit
= 7 - (NewValue
% 8);
451 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] & (~ (UINT8
) (1 << Bit
)));
452 if (0xFF != OldValue
) {
454 // Because NewValue is a item that was disabled before
455 // so after changing the OldValue should be disabled
456 // actually we are doing a swap of enable-disable states of two items
459 Bit
= 7 - (OldValue
% 8);
460 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] | (UINT8
) (1 << Bit
));
465 // To prevent DISABLE appears in the middle of the list
466 // we should perform a re-ordering
469 while (Index
< Number
) {
470 if (0xFF != NewLegacyDev
[Index
]) {
477 while (Index2
< Number
) {
478 if (0xFF != NewLegacyDev
[Index2
]) {
485 if (Index2
< Number
) {
486 NewLegacyDev
[Index
] = NewLegacyDev
[Index2
];
487 NewLegacyDev
[Index2
] = 0xFF;
501 if (QuestionId
< FILE_OPTION_OFFSET
) {
502 if (QuestionId
< CONFIG_OPTION_OFFSET
) {
503 switch (QuestionId
) {
504 case KEY_VALUE_BOOT_FROM_FILE
:
505 Private
->FeCurrentState
= FileExplorerStateBootFromFile
;
508 // Exit Bmm main formset to send File Explorer formset.
510 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
513 case FORM_BOOT_ADD_ID
:
514 Private
->FeCurrentState
= FileExplorerStateAddBootOption
;
517 // Exit Bmm main formset to send File Explorer formset.
519 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
522 case FORM_DRV_ADD_FILE_ID
:
523 Private
->FeCurrentState
= FileExplorerStateAddDriverOptionState
;
526 // Exit Bmm main formset to send File Explorer formset.
528 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
531 case FORM_DRV_ADD_HANDLE_ID
:
532 CleanUpPage (FORM_DRV_ADD_HANDLE_ID
, Private
);
533 UpdateDrvAddHandlePage (Private
);
536 case FORM_BOOT_DEL_ID
:
537 CleanUpPage (FORM_BOOT_DEL_ID
, Private
);
538 UpdateBootDelPage (Private
);
541 case FORM_BOOT_CHG_ID
:
542 case FORM_DRV_CHG_ID
:
543 UpdatePageBody (QuestionId
, Private
);
546 case FORM_DRV_DEL_ID
:
547 CleanUpPage (FORM_DRV_DEL_ID
, Private
);
548 UpdateDrvDelPage (Private
);
551 case FORM_BOOT_NEXT_ID
:
552 CleanUpPage (FORM_BOOT_NEXT_ID
, Private
);
553 UpdateBootNextPage (Private
);
556 case FORM_TIME_OUT_ID
:
557 CleanUpPage (FORM_TIME_OUT_ID
, Private
);
558 UpdateTimeOutPage (Private
);
562 gRT
->ResetSystem (EfiResetCold
, EFI_SUCCESS
, 0, NULL
);
563 return EFI_UNSUPPORTED
;
566 case FORM_CON_OUT_ID
:
567 case FORM_CON_ERR_ID
:
568 UpdatePageBody (QuestionId
, Private
);
571 case FORM_CON_MODE_ID
:
572 CleanUpPage (FORM_CON_MODE_ID
, Private
);
573 UpdateConModePage (Private
);
576 case FORM_CON_COM_ID
:
577 CleanUpPage (FORM_CON_COM_ID
, Private
);
578 UpdateConCOMPage (Private
);
581 case FORM_SET_FD_ORDER_ID
:
582 case FORM_SET_HD_ORDER_ID
:
583 case FORM_SET_CD_ORDER_ID
:
584 case FORM_SET_NET_ORDER_ID
:
585 case FORM_SET_BEV_ORDER_ID
:
586 CleanUpPage (QuestionId
, Private
);
587 UpdateSetLegacyDeviceOrderPage (QuestionId
, Private
);
590 case KEY_VALUE_SAVE_AND_EXIT
:
591 case KEY_VALUE_NO_SAVE_AND_EXIT
:
593 if (QuestionId
== KEY_VALUE_SAVE_AND_EXIT
) {
594 Status
= ApplyChangeHandler (Private
, CurrentFakeNVMap
, Private
->BmmPreviousPageId
);
595 if (EFI_ERROR (Status
)) {
598 } else if (QuestionId
== KEY_VALUE_NO_SAVE_AND_EXIT
) {
599 DiscardChangeHandler (Private
, CurrentFakeNVMap
);
603 // Tell browser not to ask for confirmation of changes,
604 // since we have already applied or discarded.
606 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_SUBMIT
;
612 } else if ((QuestionId
>= TERMINAL_OPTION_OFFSET
) && (QuestionId
< CONSOLE_OPTION_OFFSET
)) {
613 Index2
= (UINT16
) (QuestionId
- TERMINAL_OPTION_OFFSET
);
614 Private
->CurrentTerminal
= Index2
;
616 CleanUpPage (FORM_CON_COM_SETUP_ID
, Private
);
617 UpdateTerminalPage (Private
);
619 } else if (QuestionId
>= HANDLE_OPTION_OFFSET
) {
620 Index2
= (UINT16
) (QuestionId
- HANDLE_OPTION_OFFSET
);
622 NewMenuEntry
= BOpt_GetMenuEntry (&DriverMenu
, Index2
);
623 ASSERT (NewMenuEntry
!= NULL
);
624 Private
->HandleContext
= (BM_HANDLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
626 CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID
, Private
);
628 Private
->MenuEntry
= NewMenuEntry
;
629 Private
->LoadContext
->FilePathList
= Private
->HandleContext
->DevicePath
;
631 UpdateDriverAddHandleDescPage (Private
);
636 // Pass changed uncommitted data back to Form Browser
638 Status
= HiiSetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
, NULL
);
644 Function handling request to apply changes for BMM pages.
646 @param Private Pointer to callback data buffer.
647 @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
648 @param FormId ID of the form which has sent the request to apply change.
650 @retval EFI_SUCCESS Change successfully applied.
651 @retval Other Error occurs while trying to apply changes.
656 IN BMM_CALLBACK_DATA
*Private
,
657 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
,
658 IN EFI_FORM_ID FormId
661 BM_CONSOLE_CONTEXT
*NewConsoleContext
;
662 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
663 BM_LOAD_CONTEXT
*NewLoadContext
;
664 BM_MENU_ENTRY
*NewMenuEntry
;
668 Status
= EFI_SUCCESS
;
671 case FORM_SET_FD_ORDER_ID
:
672 case FORM_SET_HD_ORDER_ID
:
673 case FORM_SET_CD_ORDER_ID
:
674 case FORM_SET_NET_ORDER_ID
:
675 case FORM_SET_BEV_ORDER_ID
:
676 Var_UpdateBBSOption (Private
);
679 case FORM_BOOT_DEL_ID
:
681 ((Index
< BootOptionMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->OptionDel
) / sizeof (CurrentFakeNVMap
->OptionDel
[0]))));
683 NewMenuEntry
= BOpt_GetMenuEntry (&BootOptionMenu
, Index
);
684 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
685 NewLoadContext
->Deleted
= CurrentFakeNVMap
->OptionDel
[Index
];
688 Var_DelBootOption ();
691 case FORM_DRV_DEL_ID
:
693 ((Index
< DriverOptionMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->OptionDel
) / sizeof (CurrentFakeNVMap
->OptionDel
[0]))));
695 NewMenuEntry
= BOpt_GetMenuEntry (&DriverOptionMenu
, Index
);
696 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
697 NewLoadContext
->Deleted
= CurrentFakeNVMap
->OptionDel
[Index
];
700 Var_DelDriverOption ();
703 case FORM_BOOT_CHG_ID
:
704 Status
= Var_UpdateBootOrder (Private
);
707 case FORM_DRV_CHG_ID
:
708 Status
= Var_UpdateDriverOrder (Private
);
711 case FORM_TIME_OUT_ID
:
712 PcdSet16 (PcdPlatformBootTimeOut
, CurrentFakeNVMap
->BootTimeOut
);
714 Private
->BmmOldFakeNVData
.BootTimeOut
= CurrentFakeNVMap
->BootTimeOut
;
717 case FORM_BOOT_NEXT_ID
:
718 Status
= Var_UpdateBootNext (Private
);
721 case FORM_CON_MODE_ID
:
722 Status
= Var_UpdateConMode (Private
);
725 case FORM_CON_COM_SETUP_ID
:
726 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Private
->CurrentTerminal
);
728 ASSERT (NewMenuEntry
!= NULL
);
730 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
732 NewTerminalContext
->BaudRateIndex
= CurrentFakeNVMap
->COMBaudRate
;
733 ASSERT (CurrentFakeNVMap
->COMBaudRate
< (sizeof (BaudRateList
) / sizeof (BaudRateList
[0])));
734 NewTerminalContext
->BaudRate
= BaudRateList
[CurrentFakeNVMap
->COMBaudRate
].Value
;
735 NewTerminalContext
->DataBitsIndex
= CurrentFakeNVMap
->COMDataRate
;
736 ASSERT (CurrentFakeNVMap
->COMDataRate
< (sizeof (DataBitsList
) / sizeof (DataBitsList
[0])));
737 NewTerminalContext
->DataBits
= (UINT8
) DataBitsList
[CurrentFakeNVMap
->COMDataRate
].Value
;
738 NewTerminalContext
->StopBitsIndex
= CurrentFakeNVMap
->COMStopBits
;
739 ASSERT (CurrentFakeNVMap
->COMStopBits
< (sizeof (StopBitsList
) / sizeof (StopBitsList
[0])));
740 NewTerminalContext
->StopBits
= (UINT8
) StopBitsList
[CurrentFakeNVMap
->COMStopBits
].Value
;
741 NewTerminalContext
->ParityIndex
= CurrentFakeNVMap
->COMParity
;
742 ASSERT (CurrentFakeNVMap
->COMParity
< (sizeof (ParityList
) / sizeof (ParityList
[0])));
743 NewTerminalContext
->Parity
= (UINT8
) ParityList
[CurrentFakeNVMap
->COMParity
].Value
;
744 NewTerminalContext
->TerminalType
= CurrentFakeNVMap
->COMTerminalType
;
746 ChangeTerminalDevicePath (
747 NewTerminalContext
->DevicePath
,
751 Var_UpdateConsoleInpOption ();
752 Var_UpdateConsoleOutOption ();
753 Var_UpdateErrorOutOption ();
757 for (Index
= 0; Index
< ConsoleInpMenu
.MenuNumber
; Index
++) {
758 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleInpMenu
, Index
);
759 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
760 ASSERT (Index
< MAX_MENU_NUMBER
);
761 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
764 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
765 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
766 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
767 ASSERT (Index
+ ConsoleInpMenu
.MenuNumber
< MAX_MENU_NUMBER
);
768 NewTerminalContext
->IsConIn
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleInpMenu
.MenuNumber
];
771 Var_UpdateConsoleInpOption ();
774 case FORM_CON_OUT_ID
:
775 for (Index
= 0; Index
< ConsoleOutMenu
.MenuNumber
; Index
++) {
776 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleOutMenu
, Index
);
777 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
778 ASSERT (Index
< MAX_MENU_NUMBER
);
779 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
782 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
783 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
784 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
785 ASSERT (Index
+ ConsoleOutMenu
.MenuNumber
< MAX_MENU_NUMBER
);
786 NewTerminalContext
->IsConOut
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleOutMenu
.MenuNumber
];
789 Var_UpdateConsoleOutOption ();
792 case FORM_CON_ERR_ID
:
793 for (Index
= 0; Index
< ConsoleErrMenu
.MenuNumber
; Index
++) {
794 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleErrMenu
, Index
);
795 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
796 ASSERT (Index
< MAX_MENU_NUMBER
);
797 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
800 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
801 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
802 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
803 ASSERT (Index
+ ConsoleErrMenu
.MenuNumber
< MAX_MENU_NUMBER
);
804 NewTerminalContext
->IsStdErr
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleErrMenu
.MenuNumber
];
807 Var_UpdateErrorOutOption ();
810 case FORM_DRV_ADD_HANDLE_DESC_ID
:
811 Status
= Var_UpdateDriverOption (
813 Private
->BmmHiiHandle
,
814 CurrentFakeNVMap
->DriverAddHandleDesc
,
815 CurrentFakeNVMap
->DriverAddHandleOptionalData
,
816 CurrentFakeNVMap
->DriverAddForceReconnect
818 if (EFI_ERROR (Status
)) {
822 BOpt_GetDriverOptions (Private
);
823 CreateMenuStringToken (Private
, Private
->BmmHiiHandle
, &DriverOptionMenu
);
835 Discard all changes done to the BMM pages such as Boot Order change,
838 @param Private The BMM context data.
839 @param CurrentFakeNVMap The current Fack NV Map.
843 DiscardChangeHandler (
844 IN BMM_CALLBACK_DATA
*Private
,
845 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
850 switch (Private
->BmmPreviousPageId
) {
851 case FORM_BOOT_CHG_ID
:
852 case FORM_DRV_CHG_ID
:
853 CopyMem (CurrentFakeNVMap
->OptionOrder
, Private
->BmmOldFakeNVData
.OptionOrder
, sizeof (CurrentFakeNVMap
->OptionOrder
));
856 case FORM_BOOT_DEL_ID
:
857 ASSERT (BootOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->OptionDel
) / sizeof (CurrentFakeNVMap
->OptionDel
[0])));
858 for (Index
= 0; Index
< BootOptionMenu
.MenuNumber
; Index
++) {
859 CurrentFakeNVMap
->OptionDel
[Index
] = FALSE
;
863 case FORM_DRV_DEL_ID
:
864 ASSERT (DriverOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->OptionDel
) / sizeof (CurrentFakeNVMap
->OptionDel
[0])));
865 for (Index
= 0; Index
< DriverOptionMenu
.MenuNumber
; Index
++) {
866 CurrentFakeNVMap
->OptionDel
[Index
] = FALSE
;
870 case FORM_BOOT_NEXT_ID
:
871 CurrentFakeNVMap
->BootNext
= Private
->BmmOldFakeNVData
.BootNext
;
874 case FORM_TIME_OUT_ID
:
875 CurrentFakeNVMap
->BootTimeOut
= Private
->BmmOldFakeNVData
.BootTimeOut
;
878 case FORM_DRV_ADD_HANDLE_DESC_ID
:
879 case FORM_DRV_ADD_FILE_ID
:
880 case FORM_DRV_ADD_HANDLE_ID
:
881 CurrentFakeNVMap
->DriverAddHandleDesc
[0] = 0x0000;
882 CurrentFakeNVMap
->DriverAddHandleOptionalData
[0] = 0x0000;
891 Initialize the Boot Maintenance Utitliy.
894 @retval EFI_SUCCESS utility ended successfully
895 @retval others contain some errors
903 EFI_LEGACY_BIOS_PROTOCOL
*LegacyBios
;
904 BMM_CALLBACK_DATA
*BmmCallbackInfo
;
908 Status
= EFI_SUCCESS
;
911 // Create CallbackData structures for Driver Callback
913 BmmCallbackInfo
= AllocateZeroPool (sizeof (BMM_CALLBACK_DATA
));
914 if (BmmCallbackInfo
== NULL
) {
915 return EFI_OUT_OF_RESOURCES
;
919 // Create LoadOption in BmmCallbackInfo for Driver Callback
921 Ptr
= AllocateZeroPool (sizeof (BM_LOAD_CONTEXT
) + sizeof (BM_FILE_CONTEXT
) + sizeof (BM_HANDLE_CONTEXT
) + sizeof (BM_MENU_ENTRY
));
923 FreePool (BmmCallbackInfo
);
924 return EFI_OUT_OF_RESOURCES
;
928 // Initialize Bmm callback data.
930 BmmCallbackInfo
->LoadContext
= (BM_LOAD_CONTEXT
*) Ptr
;
931 Ptr
+= sizeof (BM_LOAD_CONTEXT
);
933 BmmCallbackInfo
->FileContext
= (BM_FILE_CONTEXT
*) Ptr
;
934 Ptr
+= sizeof (BM_FILE_CONTEXT
);
936 BmmCallbackInfo
->HandleContext
= (BM_HANDLE_CONTEXT
*) Ptr
;
937 Ptr
+= sizeof (BM_HANDLE_CONTEXT
);
939 BmmCallbackInfo
->MenuEntry
= (BM_MENU_ENTRY
*) Ptr
;
941 BmmCallbackInfo
->Signature
= BMM_CALLBACK_DATA_SIGNATURE
;
942 BmmCallbackInfo
->BmmConfigAccess
.ExtractConfig
= BootMaintExtractConfig
;
943 BmmCallbackInfo
->BmmConfigAccess
.RouteConfig
= FakeRouteConfig
;
944 BmmCallbackInfo
->BmmConfigAccess
.Callback
= BootMaintCallback
;
945 BmmCallbackInfo
->BmmPreviousPageId
= FORM_MAIN_ID
;
946 BmmCallbackInfo
->BmmCurrentPageId
= FORM_MAIN_ID
;
947 BmmCallbackInfo
->FeConfigAccess
.ExtractConfig
= FakeExtractConfig
;
948 BmmCallbackInfo
->FeConfigAccess
.RouteConfig
= FakeRouteConfig
;
949 BmmCallbackInfo
->FeConfigAccess
.Callback
= FileExplorerCallback
;
950 BmmCallbackInfo
->FeCurrentState
= FileExplorerStateInActive
;
951 BmmCallbackInfo
->FeDisplayContext
= FileExplorerDisplayUnknown
;
954 // Install Device Path Protocol and Config Access protocol to driver handle
956 Status
= gBS
->InstallMultipleProtocolInterfaces (
957 &BmmCallbackInfo
->BmmDriverHandle
,
958 &gEfiDevicePathProtocolGuid
,
959 &mBmmHiiVendorDevicePath
,
960 &gEfiHiiConfigAccessProtocolGuid
,
961 &BmmCallbackInfo
->BmmConfigAccess
,
964 if (EFI_ERROR (Status
)) {
969 // Install Device Path Protocol and Config Access protocol to driver handle
971 Status
= gBS
->InstallMultipleProtocolInterfaces (
972 &BmmCallbackInfo
->FeDriverHandle
,
973 &gEfiDevicePathProtocolGuid
,
974 &mFeHiiVendorDevicePath
,
975 &gEfiHiiConfigAccessProtocolGuid
,
976 &BmmCallbackInfo
->FeConfigAccess
,
979 if (EFI_ERROR (Status
)) {
984 // Post our Boot Maint VFR binary to the HII database.
986 BmmCallbackInfo
->BmmHiiHandle
= HiiAddPackages (
988 BmmCallbackInfo
->BmmDriverHandle
,
993 ASSERT (BmmCallbackInfo
->BmmHiiHandle
!= NULL
);
996 // Post our File Explorer VFR binary to the HII database.
998 BmmCallbackInfo
->FeHiiHandle
= HiiAddPackages (
1000 BmmCallbackInfo
->FeDriverHandle
,
1005 ASSERT (BmmCallbackInfo
->FeHiiHandle
!= NULL
);
1008 // Init OpCode Handle and Allocate space for creation of Buffer
1010 mStartOpCodeHandle
= HiiAllocateOpCodeHandle ();
1011 if (mStartOpCodeHandle
== NULL
) {
1012 Status
= EFI_OUT_OF_RESOURCES
;
1016 mEndOpCodeHandle
= HiiAllocateOpCodeHandle ();
1017 if (mEndOpCodeHandle
== NULL
) {
1018 Status
= EFI_OUT_OF_RESOURCES
;
1023 // Create Hii Extend Label OpCode as the start opcode
1025 mStartLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mStartOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
1026 mStartLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
1029 // Create Hii Extend Label OpCode as the end opcode
1031 mEndLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mEndOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
1032 mEndLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
1033 mEndLabel
->Number
= LABEL_END
;
1035 InitializeStringDepository ();
1037 InitAllMenu (BmmCallbackInfo
);
1039 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleInpMenu
);
1040 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleOutMenu
);
1041 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleErrMenu
);
1042 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &BootOptionMenu
);
1043 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverOptionMenu
);
1044 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &TerminalMenu
);
1045 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverMenu
);
1047 UpdateBootDelPage (BmmCallbackInfo
);
1048 UpdateDrvDelPage (BmmCallbackInfo
);
1050 if (TerminalMenu
.MenuNumber
> 0) {
1051 BmmCallbackInfo
->CurrentTerminal
= 0;
1052 UpdateTerminalPage (BmmCallbackInfo
);
1055 Status
= EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid
, (VOID
**) &LegacyBios
);
1056 if (!EFI_ERROR (Status
)) {
1057 RefreshUpdateData ();
1058 mStartLabel
->Number
= FORM_BOOT_LEGACY_DEVICE_ID
;
1061 // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
1062 // in BootOption form: legacy FD/HD/CD/NET/BEV
1064 HiiCreateGotoOpCode (
1066 FORM_SET_FD_ORDER_ID
,
1067 STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE
),
1068 STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE
),
1069 EFI_IFR_FLAG_CALLBACK
,
1070 FORM_SET_FD_ORDER_ID
1073 HiiCreateGotoOpCode (
1075 FORM_SET_HD_ORDER_ID
,
1076 STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE
),
1077 STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE
),
1078 EFI_IFR_FLAG_CALLBACK
,
1079 FORM_SET_HD_ORDER_ID
1082 HiiCreateGotoOpCode (
1084 FORM_SET_CD_ORDER_ID
,
1085 STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE
),
1086 STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE
),
1087 EFI_IFR_FLAG_CALLBACK
,
1088 FORM_SET_CD_ORDER_ID
1091 HiiCreateGotoOpCode (
1093 FORM_SET_NET_ORDER_ID
,
1094 STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE
),
1095 STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE
),
1096 EFI_IFR_FLAG_CALLBACK
,
1097 FORM_SET_NET_ORDER_ID
1100 HiiCreateGotoOpCode (
1102 FORM_SET_BEV_ORDER_ID
,
1103 STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE
),
1104 STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE
),
1105 EFI_IFR_FLAG_CALLBACK
,
1106 FORM_SET_BEV_ORDER_ID
1110 BmmCallbackInfo
->BmmHiiHandle
,
1113 mStartOpCodeHandle
, // Label FORM_BOOT_LEGACY_DEVICE_ID
1114 mEndOpCodeHandle
// LABEL_END
1119 // Dispatch BMM main formset and File Explorer formset.
1121 FormSetDispatcher (BmmCallbackInfo
);
1124 // Remove our IFR data from HII database
1126 HiiRemovePackages (BmmCallbackInfo
->BmmHiiHandle
);
1127 HiiRemovePackages (BmmCallbackInfo
->FeHiiHandle
);
1129 CleanUpStringDepository ();
1134 if (mStartOpCodeHandle
!= NULL
) {
1135 HiiFreeOpCodeHandle (mStartOpCodeHandle
);
1138 if (mEndOpCodeHandle
!= NULL
) {
1139 HiiFreeOpCodeHandle (mEndOpCodeHandle
);
1142 if (BmmCallbackInfo
->FeDriverHandle
!= NULL
) {
1143 gBS
->UninstallMultipleProtocolInterfaces (
1144 BmmCallbackInfo
->FeDriverHandle
,
1145 &gEfiDevicePathProtocolGuid
,
1146 &mFeHiiVendorDevicePath
,
1147 &gEfiHiiConfigAccessProtocolGuid
,
1148 &BmmCallbackInfo
->FeConfigAccess
,
1153 if (BmmCallbackInfo
->BmmDriverHandle
!= NULL
) {
1154 gBS
->UninstallMultipleProtocolInterfaces (
1155 BmmCallbackInfo
->BmmDriverHandle
,
1156 &gEfiDevicePathProtocolGuid
,
1157 &mBmmHiiVendorDevicePath
,
1158 &gEfiHiiConfigAccessProtocolGuid
,
1159 &BmmCallbackInfo
->BmmConfigAccess
,
1164 FreePool (BmmCallbackInfo
->LoadContext
);
1165 FreePool (BmmCallbackInfo
);
1171 Initialized all Menu Option List.
1173 @param CallbackData The BMM context data.
1178 IN BMM_CALLBACK_DATA
*CallbackData
1181 InitializeListHead (&BootOptionMenu
.Head
);
1182 InitializeListHead (&DriverOptionMenu
.Head
);
1183 BOpt_GetBootOptions (CallbackData
);
1184 BOpt_GetDriverOptions (CallbackData
);
1185 BOpt_GetLegacyOptions ();
1186 InitializeListHead (&FsOptionMenu
.Head
);
1187 BOpt_FindDrivers ();
1188 InitializeListHead (&DirectoryMenu
.Head
);
1189 InitializeListHead (&ConsoleInpMenu
.Head
);
1190 InitializeListHead (&ConsoleOutMenu
.Head
);
1191 InitializeListHead (&ConsoleErrMenu
.Head
);
1192 InitializeListHead (&TerminalMenu
.Head
);
1198 Free up all Menu Option list.
1206 BOpt_FreeMenu (&DirectoryMenu
);
1207 BOpt_FreeMenu (&FsOptionMenu
);
1208 BOpt_FreeMenu (&BootOptionMenu
);
1209 BOpt_FreeMenu (&DriverOptionMenu
);
1210 BOpt_FreeMenu (&DriverMenu
);
1211 BOpt_FreeLegacyOptions ();
1216 Initialize all the string depositories.
1220 InitializeStringDepository (
1224 STRING_DEPOSITORY
*StringDepository
;
1225 StringDepository
= AllocateZeroPool (sizeof (STRING_DEPOSITORY
) * STRING_DEPOSITORY_NUMBER
);
1226 FileOptionStrDepository
= StringDepository
++;
1227 ConsoleOptionStrDepository
= StringDepository
++;
1228 BootOptionStrDepository
= StringDepository
++;
1229 BootOptionHelpStrDepository
= StringDepository
++;
1230 DriverOptionStrDepository
= StringDepository
++;
1231 DriverOptionHelpStrDepository
= StringDepository
++;
1232 TerminalStrDepository
= StringDepository
;
1236 Fetch a usable string node from the string depository and return the string token.
1238 @param CallbackData The BMM context data.
1239 @param StringDepository The string repository.
1241 @retval EFI_STRING_ID String token.
1245 GetStringTokenFromDepository (
1246 IN BMM_CALLBACK_DATA
*CallbackData
,
1247 IN STRING_DEPOSITORY
*StringDepository
1250 STRING_LIST_NODE
*CurrentListNode
;
1251 STRING_LIST_NODE
*NextListNode
;
1253 CurrentListNode
= StringDepository
->CurrentNode
;
1255 if ((NULL
!= CurrentListNode
) && (NULL
!= CurrentListNode
->Next
)) {
1257 // Fetch one reclaimed node from the list.
1259 NextListNode
= StringDepository
->CurrentNode
->Next
;
1262 // If there is no usable node in the list, update the list.
1264 NextListNode
= AllocateZeroPool (sizeof (STRING_LIST_NODE
));
1265 ASSERT (NextListNode
!= NULL
);
1266 NextListNode
->StringToken
= HiiSetString (CallbackData
->BmmHiiHandle
, 0, L
" ", NULL
);
1267 ASSERT (NextListNode
->StringToken
!= 0);
1269 StringDepository
->TotalNodeNumber
++;
1271 if (NULL
== CurrentListNode
) {
1272 StringDepository
->ListHead
= NextListNode
;
1274 CurrentListNode
->Next
= NextListNode
;
1278 StringDepository
->CurrentNode
= NextListNode
;
1280 return StringDepository
->CurrentNode
->StringToken
;
1284 Reclaim string depositories by moving the current node pointer to list head..
1288 ReclaimStringDepository (
1292 UINTN DepositoryIndex
;
1293 STRING_DEPOSITORY
*StringDepository
;
1295 StringDepository
= FileOptionStrDepository
;
1296 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1297 StringDepository
->CurrentNode
= StringDepository
->ListHead
;
1303 Release resource for all the string depositories.
1307 CleanUpStringDepository (
1312 UINTN DepositoryIndex
;
1313 STRING_LIST_NODE
*CurrentListNode
;
1314 STRING_LIST_NODE
*NextListNode
;
1315 STRING_DEPOSITORY
*StringDepository
;
1318 // Release string list nodes.
1320 StringDepository
= FileOptionStrDepository
;
1321 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1322 CurrentListNode
= StringDepository
->ListHead
;
1323 for (NodeIndex
= 0; NodeIndex
< StringDepository
->TotalNodeNumber
; NodeIndex
++) {
1324 NextListNode
= CurrentListNode
->Next
;
1325 FreePool (CurrentListNode
);
1326 CurrentListNode
= NextListNode
;
1332 // Release string depository.
1334 FreePool (FileOptionStrDepository
);
1338 Start boot maintenance manager
1340 @retval EFI_SUCCESS If BMM is invoked successfully.
1341 @return Other value if BMM return unsuccessfully.
1350 LIST_ENTRY BdsBootOptionList
;
1352 InitializeListHead (&BdsBootOptionList
);
1355 // Connect all prior to entering the platform setup menu.
1357 if (!gConnectAllHappened
) {
1358 BdsLibConnectAllDriversToAllControllers ();
1359 gConnectAllHappened
= TRUE
;
1362 // Have chance to enumerate boot device
1364 BdsLibEnumerateAllBootOption (&BdsBootOptionList
);
1369 Status
= InitializeBM ();
1375 Dispatch BMM formset and FileExplorer formset.
1378 @param CallbackData The BMM context data.
1380 @retval EFI_SUCCESS If function complete successfully.
1381 @return Other value if the Setup Browser process BMM's pages and
1382 return unsuccessfully.
1387 IN BMM_CALLBACK_DATA
*CallbackData
1391 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
1394 UpdatePageId (CallbackData
, FORM_MAIN_ID
);
1396 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1397 Status
= gFormBrowser2
->SendForm (
1399 &CallbackData
->BmmHiiHandle
,
1406 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
1407 EnableResetRequired ();
1410 ReclaimStringDepository ();
1413 // When this Formset returns, check if we are going to explore files.
1415 if (FileExplorerStateInActive
!= CallbackData
->FeCurrentState
) {
1416 UpdateFileExplorer (CallbackData
, 0);
1418 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1419 Status
= gFormBrowser2
->SendForm (
1421 &CallbackData
->FeHiiHandle
,
1428 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
1429 EnableResetRequired ();
1432 CallbackData
->FeCurrentState
= FileExplorerStateInActive
;
1433 CallbackData
->FeDisplayContext
= FileExplorerDisplayUnknown
;
1434 ReclaimStringDepository ();