2 The functions for Boot Maintainence Main menu.
4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
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
;
188 if (Request
== NULL
) {
189 return EFI_INVALID_PARAMETER
;
192 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
195 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
197 BufferSize
= sizeof (BMM_FAKE_NV_DATA
);
198 Status
= gHiiConfigRouting
->BlockToConfig (
201 (UINT8
*) &Private
->BmmFakeNvData
,
210 This function processes the results of changes in configuration.
213 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
214 @param Action Specifies the type of action taken by the browser.
215 @param QuestionId A unique value which is sent to the original exporting driver
216 so that it can identify the type of data to expect.
217 @param Type The type of value for the question.
218 @param Value A pointer to the data being sent to the original exporting driver.
219 @param ActionRequest On return, points to the action requested by the callback function.
221 @retval EFI_SUCCESS The callback successfully handled the action.
222 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
223 @retval EFI_DEVICE_ERROR The variable could not be saved.
224 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
225 @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid.
230 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
231 IN EFI_BROWSER_ACTION Action
,
232 IN EFI_QUESTION_ID QuestionId
,
234 IN EFI_IFR_TYPE_VALUE
*Value
,
235 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
238 BMM_CALLBACK_DATA
*Private
;
239 BM_MENU_ENTRY
*NewMenuEntry
;
240 BMM_FAKE_NV_DATA
*CurrentFakeNVMap
;
255 if ((Value
== NULL
) || (ActionRequest
== NULL
)) {
256 return EFI_INVALID_PARAMETER
;
266 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
268 Private
= BMM_CALLBACK_DATA_FROM_THIS (This
);
269 UpdatePageId (Private
, QuestionId
);
272 // Retrive uncommitted data from Form Browser
274 CurrentFakeNVMap
= (BMM_FAKE_NV_DATA
*) HiiGetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
));
275 if (CurrentFakeNVMap
== NULL
) {
276 CurrentFakeNVMap
= &Private
->BmmFakeNvData
;
280 // need to be subtituded.
282 // Update Select FD/HD/CD/NET/BEV Order Form
284 if (FORM_SET_FD_ORDER_ID
== Private
->BmmPreviousPageId
||
285 FORM_SET_HD_ORDER_ID
== Private
->BmmPreviousPageId
||
286 FORM_SET_CD_ORDER_ID
== Private
->BmmPreviousPageId
||
287 FORM_SET_NET_ORDER_ID
== Private
->BmmPreviousPageId
||
288 FORM_SET_BEV_ORDER_ID
== Private
->BmmPreviousPageId
||
289 ((FORM_BOOT_SETUP_ID
== Private
->BmmPreviousPageId
) &&
290 (QuestionId
>= LEGACY_FD_QUESTION_ID
) &&
291 (QuestionId
< (LEGACY_BEV_QUESTION_ID
+ 100)) )
294 DisMap
= Private
->BmmOldFakeNVData
.DisableMap
;
296 FormId
= Private
->BmmPreviousPageId
;
297 if (FormId
== FORM_BOOT_SETUP_ID
) {
298 FormId
= Private
->BmmCurrentPageId
;
302 case FORM_SET_FD_ORDER_ID
:
303 Number
= (UINT16
) LegacyFDMenu
.MenuNumber
;
304 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyFD
;
305 NewLegacyDev
= CurrentFakeNVMap
->LegacyFD
;
308 case FORM_SET_HD_ORDER_ID
:
309 Number
= (UINT16
) LegacyHDMenu
.MenuNumber
;
310 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyHD
;
311 NewLegacyDev
= CurrentFakeNVMap
->LegacyHD
;
314 case FORM_SET_CD_ORDER_ID
:
315 Number
= (UINT16
) LegacyCDMenu
.MenuNumber
;
316 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyCD
;
317 NewLegacyDev
= CurrentFakeNVMap
->LegacyCD
;
320 case FORM_SET_NET_ORDER_ID
:
321 Number
= (UINT16
) LegacyNETMenu
.MenuNumber
;
322 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyNET
;
323 NewLegacyDev
= CurrentFakeNVMap
->LegacyNET
;
326 case FORM_SET_BEV_ORDER_ID
:
327 Number
= (UINT16
) LegacyBEVMenu
.MenuNumber
;
328 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyBEV
;
329 NewLegacyDev
= CurrentFakeNVMap
->LegacyBEV
;
336 // First, find the different position
337 // if there is change, it should be only one
339 for (Index
= 0; Index
< Number
; Index
++) {
340 if (OldLegacyDev
[Index
] != NewLegacyDev
[Index
]) {
341 OldValue
= OldLegacyDev
[Index
];
342 NewValue
= NewLegacyDev
[Index
];
347 if (Index
!= Number
) {
349 // there is change, now process
351 if (0xFF == NewValue
) {
353 // This item will be disable
354 // Just move the items behind this forward to overlap it
357 Bit
= 7 - (OldValue
% 8);
358 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] | (UINT8
) (1 << Bit
));
359 for (Index2
= Index
; Index2
< Number
- 1; Index2
++) {
360 NewLegacyDev
[Index2
] = NewLegacyDev
[Index2
+ 1];
363 NewLegacyDev
[Index2
] = 0xFF;
365 for (Index2
= 0; Index2
< Number
; Index2
++) {
366 if (Index2
== Index
) {
370 if (OldLegacyDev
[Index2
] == NewValue
) {
372 // If NewValue is in OldLegacyDev array
373 // remember its old position
375 NewValuePos
= Index2
;
380 if (Index2
!= Number
) {
382 // We will change current item to an existing item
383 // (It's hard to describe here, please read code, it's like a cycle-moving)
385 for (Index2
= NewValuePos
; Index2
!= Index
;) {
386 if (NewValuePos
< Index
) {
387 NewLegacyDev
[Index2
] = OldLegacyDev
[Index2
+ 1];
390 NewLegacyDev
[Index2
] = OldLegacyDev
[Index2
- 1];
396 // If NewValue is not in OldlegacyDev array, we are changing to a disabled item
397 // so we should modify DisMap to reflect the change
400 Bit
= 7 - (NewValue
% 8);
401 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] & (~ (UINT8
) (1 << Bit
)));
402 if (0xFF != OldValue
) {
404 // Because NewValue is a item that was disabled before
405 // so after changing the OldValue should be disabled
406 // actually we are doing a swap of enable-disable states of two items
409 Bit
= 7 - (OldValue
% 8);
410 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] | (UINT8
) (1 << Bit
));
415 // To prevent DISABLE appears in the middle of the list
416 // we should perform a re-ordering
419 while (Index
< Number
) {
420 if (0xFF != NewLegacyDev
[Index
]) {
427 while (Index2
< Number
) {
428 if (0xFF != NewLegacyDev
[Index2
]) {
435 if (Index2
< Number
) {
436 NewLegacyDev
[Index
] = NewLegacyDev
[Index2
];
437 NewLegacyDev
[Index2
] = 0xFF;
451 if (QuestionId
< FILE_OPTION_OFFSET
) {
452 if (QuestionId
< CONFIG_OPTION_OFFSET
) {
453 switch (QuestionId
) {
454 case KEY_VALUE_BOOT_FROM_FILE
:
455 Private
->FeCurrentState
= BOOT_FROM_FILE_STATE
;
458 // Exit Bmm main formset to send File Explorer formset.
460 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
463 case FORM_BOOT_ADD_ID
:
464 Private
->FeCurrentState
= ADD_BOOT_OPTION_STATE
;
467 // Exit Bmm main formset to send File Explorer formset.
469 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
472 case FORM_DRV_ADD_FILE_ID
:
473 Private
->FeCurrentState
= ADD_DRIVER_OPTION_STATE
;
476 // Exit Bmm main formset to send File Explorer formset.
478 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
481 case FORM_DRV_ADD_HANDLE_ID
:
482 CleanUpPage (FORM_DRV_ADD_HANDLE_ID
, Private
);
483 UpdateDrvAddHandlePage (Private
);
486 case FORM_BOOT_DEL_ID
:
487 CleanUpPage (FORM_BOOT_DEL_ID
, Private
);
488 UpdateBootDelPage (Private
);
491 case FORM_BOOT_CHG_ID
:
492 case FORM_DRV_CHG_ID
:
493 UpdatePageBody (QuestionId
, Private
);
496 case FORM_DRV_DEL_ID
:
497 CleanUpPage (FORM_DRV_DEL_ID
, Private
);
498 UpdateDrvDelPage (Private
);
501 case FORM_BOOT_NEXT_ID
:
502 CleanUpPage (FORM_BOOT_NEXT_ID
, Private
);
503 UpdateBootNextPage (Private
);
506 case FORM_TIME_OUT_ID
:
507 CleanUpPage (FORM_TIME_OUT_ID
, Private
);
508 UpdateTimeOutPage (Private
);
512 gRT
->ResetSystem (EfiResetCold
, EFI_SUCCESS
, 0, NULL
);
513 return EFI_UNSUPPORTED
;
516 case FORM_CON_OUT_ID
:
517 case FORM_CON_ERR_ID
:
518 UpdatePageBody (QuestionId
, Private
);
521 case FORM_CON_MODE_ID
:
522 CleanUpPage (FORM_CON_MODE_ID
, Private
);
523 UpdateConModePage (Private
);
526 case FORM_CON_COM_ID
:
527 CleanUpPage (FORM_CON_COM_ID
, Private
);
528 UpdateConCOMPage (Private
);
531 case FORM_SET_FD_ORDER_ID
:
532 case FORM_SET_HD_ORDER_ID
:
533 case FORM_SET_CD_ORDER_ID
:
534 case FORM_SET_NET_ORDER_ID
:
535 case FORM_SET_BEV_ORDER_ID
:
536 CleanUpPage (QuestionId
, Private
);
537 UpdateSetLegacyDeviceOrderPage (QuestionId
, Private
);
540 case KEY_VALUE_SAVE_AND_EXIT
:
541 case KEY_VALUE_NO_SAVE_AND_EXIT
:
543 if (QuestionId
== KEY_VALUE_SAVE_AND_EXIT
) {
544 Status
= ApplyChangeHandler (Private
, CurrentFakeNVMap
, Private
->BmmPreviousPageId
);
545 if (EFI_ERROR (Status
)) {
548 } else if (QuestionId
== KEY_VALUE_NO_SAVE_AND_EXIT
) {
549 DiscardChangeHandler (Private
, CurrentFakeNVMap
);
553 // Tell browser not to ask for confirmation of changes,
554 // since we have already applied or discarded.
556 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_SUBMIT
;
562 } else if ((QuestionId
>= TERMINAL_OPTION_OFFSET
) && (QuestionId
< CONSOLE_OPTION_OFFSET
)) {
563 Index2
= (UINT16
) (QuestionId
- TERMINAL_OPTION_OFFSET
);
564 Private
->CurrentTerminal
= Index2
;
566 CleanUpPage (FORM_CON_COM_SETUP_ID
, Private
);
567 UpdateTerminalPage (Private
);
569 } else if (QuestionId
>= HANDLE_OPTION_OFFSET
) {
570 Index2
= (UINT16
) (QuestionId
- HANDLE_OPTION_OFFSET
);
572 NewMenuEntry
= BOpt_GetMenuEntry (&DriverMenu
, Index2
);
573 ASSERT (NewMenuEntry
!= NULL
);
574 Private
->HandleContext
= (BM_HANDLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
576 CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID
, Private
);
578 Private
->MenuEntry
= NewMenuEntry
;
579 Private
->LoadContext
->FilePathList
= Private
->HandleContext
->DevicePath
;
581 UpdateDriverAddHandleDescPage (Private
);
586 // Pass changed uncommitted data back to Form Browser
588 Status
= HiiSetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
, NULL
);
591 // Update local settting.
593 if ((UINTN
) CurrentFakeNVMap
!= (UINTN
) &Private
->BmmFakeNvData
) {
594 CopyMem (&Private
->BmmFakeNvData
, CurrentFakeNVMap
, sizeof (BMM_FAKE_NV_DATA
));
595 FreePool (CurrentFakeNVMap
);
602 Function handling request to apply changes for BMM pages.
604 @param Private Pointer to callback data buffer.
605 @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
606 @param FormId ID of the form which has sent the request to apply change.
608 @retval EFI_SUCCESS Change successfully applied.
609 @retval Other Error occurs while trying to apply changes.
614 IN BMM_CALLBACK_DATA
*Private
,
615 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
,
616 IN EFI_FORM_ID FormId
619 BM_CONSOLE_CONTEXT
*NewConsoleContext
;
620 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
621 BM_LOAD_CONTEXT
*NewLoadContext
;
622 BM_MENU_ENTRY
*NewMenuEntry
;
626 Status
= EFI_SUCCESS
;
629 case FORM_SET_FD_ORDER_ID
:
630 case FORM_SET_HD_ORDER_ID
:
631 case FORM_SET_CD_ORDER_ID
:
632 case FORM_SET_NET_ORDER_ID
:
633 case FORM_SET_BEV_ORDER_ID
:
634 Var_UpdateBBSOption (Private
);
637 case FORM_BOOT_DEL_ID
:
638 ASSERT (BootOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->BootOptionDel
) / sizeof (UINT8
)));
639 for (Index
= 0; Index
< BootOptionMenu
.MenuNumber
; Index
++) {
640 NewMenuEntry
= BOpt_GetMenuEntry (&BootOptionMenu
, Index
);
641 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
642 NewLoadContext
->Deleted
= CurrentFakeNVMap
->BootOptionDel
[Index
];
645 Var_DelBootOption ();
648 case FORM_DRV_DEL_ID
:
649 ASSERT (DriverOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->DriverOptionDel
) / sizeof (UINT8
)));
650 for (Index
= 0; Index
< DriverOptionMenu
.MenuNumber
; Index
++) {
651 NewMenuEntry
= BOpt_GetMenuEntry (&DriverOptionMenu
, Index
);
652 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
653 NewLoadContext
->Deleted
= CurrentFakeNVMap
->DriverOptionDel
[Index
];
656 Var_DelDriverOption ();
659 case FORM_BOOT_CHG_ID
:
660 Status
= Var_UpdateBootOrder (Private
);
663 case FORM_DRV_CHG_ID
:
664 Status
= Var_UpdateDriverOrder (Private
);
667 case FORM_TIME_OUT_ID
:
668 PcdSet16 (PcdPlatformBootTimeOut
, CurrentFakeNVMap
->BootTimeOut
);
670 Private
->BmmOldFakeNVData
.BootTimeOut
= CurrentFakeNVMap
->BootTimeOut
;
673 case FORM_BOOT_NEXT_ID
:
674 Status
= Var_UpdateBootNext (Private
);
677 case FORM_CON_MODE_ID
:
678 Status
= Var_UpdateConMode (Private
);
681 case FORM_CON_COM_SETUP_ID
:
682 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Private
->CurrentTerminal
);
684 ASSERT (NewMenuEntry
!= NULL
);
686 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
688 NewTerminalContext
->BaudRateIndex
= CurrentFakeNVMap
->COMBaudRate
;
689 ASSERT (CurrentFakeNVMap
->COMBaudRate
< (sizeof (BaudRateList
) / sizeof (BaudRateList
[0])));
690 NewTerminalContext
->BaudRate
= BaudRateList
[CurrentFakeNVMap
->COMBaudRate
].Value
;
691 NewTerminalContext
->DataBitsIndex
= CurrentFakeNVMap
->COMDataRate
;
692 ASSERT (CurrentFakeNVMap
->COMDataRate
< (sizeof (DataBitsList
) / sizeof (DataBitsList
[0])));
693 NewTerminalContext
->DataBits
= (UINT8
) DataBitsList
[CurrentFakeNVMap
->COMDataRate
].Value
;
694 NewTerminalContext
->StopBitsIndex
= CurrentFakeNVMap
->COMStopBits
;
695 ASSERT (CurrentFakeNVMap
->COMStopBits
< (sizeof (StopBitsList
) / sizeof (StopBitsList
[0])));
696 NewTerminalContext
->StopBits
= (UINT8
) StopBitsList
[CurrentFakeNVMap
->COMStopBits
].Value
;
697 NewTerminalContext
->ParityIndex
= CurrentFakeNVMap
->COMParity
;
698 ASSERT (CurrentFakeNVMap
->COMParity
< (sizeof (ParityList
) / sizeof (ParityList
[0])));
699 NewTerminalContext
->Parity
= (UINT8
) ParityList
[CurrentFakeNVMap
->COMParity
].Value
;
700 NewTerminalContext
->TerminalType
= CurrentFakeNVMap
->COMTerminalType
;
702 ChangeTerminalDevicePath (
703 NewTerminalContext
->DevicePath
,
707 Var_UpdateConsoleInpOption ();
708 Var_UpdateConsoleOutOption ();
709 Var_UpdateErrorOutOption ();
713 ASSERT ((ConsoleInpMenu
.MenuNumber
+ TerminalMenu
.MenuNumber
) <= (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
)));
714 for (Index
= 0; Index
< ConsoleInpMenu
.MenuNumber
; Index
++) {
715 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleInpMenu
, Index
);
716 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
717 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
720 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
721 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
722 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
723 NewTerminalContext
->IsConIn
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleInpMenu
.MenuNumber
];
726 Var_UpdateConsoleInpOption ();
729 case FORM_CON_OUT_ID
:
730 ASSERT ((ConsoleOutMenu
.MenuNumber
+ TerminalMenu
.MenuNumber
) <= (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
)));
731 for (Index
= 0; Index
< ConsoleOutMenu
.MenuNumber
; Index
++) {
732 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleOutMenu
, Index
);
733 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
734 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
737 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
738 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
739 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
740 NewTerminalContext
->IsConOut
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleOutMenu
.MenuNumber
];
743 Var_UpdateConsoleOutOption ();
746 case FORM_CON_ERR_ID
:
747 ASSERT ((ConsoleErrMenu
.MenuNumber
+ TerminalMenu
.MenuNumber
) <= (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
)));
748 for (Index
= 0; Index
< ConsoleErrMenu
.MenuNumber
; Index
++) {
749 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleErrMenu
, Index
);
750 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
751 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
754 for (Index
= 0; Index
< TerminalMenu
.MenuNumber
; Index
++) {
755 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
756 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
757 NewTerminalContext
->IsStdErr
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleErrMenu
.MenuNumber
];
760 Var_UpdateErrorOutOption ();
763 case FORM_DRV_ADD_HANDLE_DESC_ID
:
764 Status
= Var_UpdateDriverOption (
766 Private
->BmmHiiHandle
,
767 CurrentFakeNVMap
->DriverAddHandleDesc
,
768 CurrentFakeNVMap
->DriverAddHandleOptionalData
,
769 CurrentFakeNVMap
->DriverAddForceReconnect
771 if (EFI_ERROR (Status
)) {
775 BOpt_GetDriverOptions (Private
);
776 CreateMenuStringToken (Private
, Private
->BmmHiiHandle
, &DriverOptionMenu
);
788 Discard all changes done to the BMM pages such as Boot Order change,
791 @param Private The BMM context data.
792 @param CurrentFakeNVMap The current Fack NV Map.
796 DiscardChangeHandler (
797 IN BMM_CALLBACK_DATA
*Private
,
798 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
803 switch (Private
->BmmPreviousPageId
) {
804 case FORM_BOOT_CHG_ID
:
805 case FORM_DRV_CHG_ID
:
806 CopyMem (CurrentFakeNVMap
->OptionOrder
, Private
->BmmOldFakeNVData
.OptionOrder
, 100);
809 case FORM_BOOT_DEL_ID
:
810 ASSERT (BootOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->BootOptionDel
) / sizeof (CurrentFakeNVMap
->BootOptionDel
[0])));
811 for (Index
= 0; Index
< BootOptionMenu
.MenuNumber
; Index
++) {
812 CurrentFakeNVMap
->BootOptionDel
[Index
] = 0x00;
816 case FORM_DRV_DEL_ID
:
817 ASSERT (DriverOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->DriverOptionDel
) / sizeof (CurrentFakeNVMap
->DriverOptionDel
[0])));
818 for (Index
= 0; Index
< DriverOptionMenu
.MenuNumber
; Index
++) {
819 CurrentFakeNVMap
->DriverOptionDel
[Index
] = 0x00;
823 case FORM_BOOT_NEXT_ID
:
824 CurrentFakeNVMap
->BootNext
= Private
->BmmOldFakeNVData
.BootNext
;
827 case FORM_TIME_OUT_ID
:
828 CurrentFakeNVMap
->BootTimeOut
= Private
->BmmOldFakeNVData
.BootTimeOut
;
831 case FORM_DRV_ADD_HANDLE_DESC_ID
:
832 case FORM_DRV_ADD_FILE_ID
:
833 case FORM_DRV_ADD_HANDLE_ID
:
834 CurrentFakeNVMap
->DriverAddHandleDesc
[0] = 0x0000;
835 CurrentFakeNVMap
->DriverAddHandleOptionalData
[0] = 0x0000;
844 Initialize the Boot Maintenance Utitliy.
847 @retval EFI_SUCCESS utility ended successfully
848 @retval others contain some errors
856 EFI_LEGACY_BIOS_PROTOCOL
*LegacyBios
;
857 BMM_CALLBACK_DATA
*BmmCallbackInfo
;
861 Status
= EFI_SUCCESS
;
864 // Create CallbackData structures for Driver Callback
866 BmmCallbackInfo
= AllocateZeroPool (sizeof (BMM_CALLBACK_DATA
));
867 if (BmmCallbackInfo
== NULL
) {
868 return EFI_OUT_OF_RESOURCES
;
872 // Create LoadOption in BmmCallbackInfo for Driver Callback
874 Ptr
= AllocateZeroPool (sizeof (BM_LOAD_CONTEXT
) + sizeof (BM_FILE_CONTEXT
) + sizeof (BM_HANDLE_CONTEXT
) + sizeof (BM_MENU_ENTRY
));
876 FreePool (BmmCallbackInfo
);
877 return EFI_OUT_OF_RESOURCES
;
881 // Initialize Bmm callback data.
883 BmmCallbackInfo
->LoadContext
= (BM_LOAD_CONTEXT
*) Ptr
;
884 Ptr
+= sizeof (BM_LOAD_CONTEXT
);
886 BmmCallbackInfo
->FileContext
= (BM_FILE_CONTEXT
*) Ptr
;
887 Ptr
+= sizeof (BM_FILE_CONTEXT
);
889 BmmCallbackInfo
->HandleContext
= (BM_HANDLE_CONTEXT
*) Ptr
;
890 Ptr
+= sizeof (BM_HANDLE_CONTEXT
);
892 BmmCallbackInfo
->MenuEntry
= (BM_MENU_ENTRY
*) Ptr
;
894 BmmCallbackInfo
->Signature
= BMM_CALLBACK_DATA_SIGNATURE
;
895 BmmCallbackInfo
->BmmConfigAccess
.ExtractConfig
= BootMaintExtractConfig
;
896 BmmCallbackInfo
->BmmConfigAccess
.RouteConfig
= FakeRouteConfig
;
897 BmmCallbackInfo
->BmmConfigAccess
.Callback
= BootMaintCallback
;
898 BmmCallbackInfo
->BmmPreviousPageId
= FORM_MAIN_ID
;
899 BmmCallbackInfo
->BmmCurrentPageId
= FORM_MAIN_ID
;
900 BmmCallbackInfo
->FeConfigAccess
.ExtractConfig
= FakeExtractConfig
;
901 BmmCallbackInfo
->FeConfigAccess
.RouteConfig
= FakeRouteConfig
;
902 BmmCallbackInfo
->FeConfigAccess
.Callback
= FileExplorerCallback
;
903 BmmCallbackInfo
->FeCurrentState
= INACTIVE_STATE
;
904 BmmCallbackInfo
->FeDisplayContext
= UNKNOWN_CONTEXT
;
907 // Install Device Path Protocol and Config Access protocol to driver handle
909 Status
= gBS
->InstallMultipleProtocolInterfaces (
910 &BmmCallbackInfo
->BmmDriverHandle
,
911 &gEfiDevicePathProtocolGuid
,
912 &mBmmHiiVendorDevicePath
,
913 &gEfiHiiConfigAccessProtocolGuid
,
914 &BmmCallbackInfo
->BmmConfigAccess
,
917 if (EFI_ERROR (Status
)) {
922 // Install Device Path Protocol and Config Access protocol to driver handle
924 Status
= gBS
->InstallMultipleProtocolInterfaces (
925 &BmmCallbackInfo
->FeDriverHandle
,
926 &gEfiDevicePathProtocolGuid
,
927 &mFeHiiVendorDevicePath
,
928 &gEfiHiiConfigAccessProtocolGuid
,
929 &BmmCallbackInfo
->FeConfigAccess
,
932 if (EFI_ERROR (Status
)) {
937 // Post our Boot Maint VFR binnary to the HII database.
939 BmmCallbackInfo
->BmmHiiHandle
= HiiAddPackages (
941 BmmCallbackInfo
->BmmDriverHandle
,
946 ASSERT (BmmCallbackInfo
->BmmHiiHandle
!= NULL
);
949 // Post our File Explorer VFR binary to the HII database.
951 BmmCallbackInfo
->FeHiiHandle
= HiiAddPackages (
953 BmmCallbackInfo
->FeDriverHandle
,
958 ASSERT (BmmCallbackInfo
->FeHiiHandle
!= NULL
);
961 // Init OpCode Handle and Allocate space for creation of Buffer
963 mStartOpCodeHandle
= HiiAllocateOpCodeHandle ();
964 if (mStartOpCodeHandle
== NULL
) {
965 Status
= EFI_OUT_OF_RESOURCES
;
969 mEndOpCodeHandle
= HiiAllocateOpCodeHandle ();
970 if (mEndOpCodeHandle
== NULL
) {
971 Status
= EFI_OUT_OF_RESOURCES
;
976 // Create Hii Extend Label OpCode as the start opcode
978 mStartLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mStartOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
979 mStartLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
982 // Create Hii Extend Label OpCode as the end opcode
984 mEndLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mEndOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
985 mEndLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
986 mEndLabel
->Number
= LABEL_END
;
988 InitializeStringDepository ();
990 InitAllMenu (BmmCallbackInfo
);
992 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleInpMenu
);
993 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleOutMenu
);
994 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleErrMenu
);
995 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &BootOptionMenu
);
996 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverOptionMenu
);
997 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &TerminalMenu
);
998 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverMenu
);
1000 UpdateBootDelPage (BmmCallbackInfo
);
1001 UpdateDrvDelPage (BmmCallbackInfo
);
1003 if (TerminalMenu
.MenuNumber
> 0) {
1004 BmmCallbackInfo
->CurrentTerminal
= 0;
1005 UpdateTerminalPage (BmmCallbackInfo
);
1008 Status
= EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid
, (VOID
**) &LegacyBios
);
1009 if (!EFI_ERROR (Status
)) {
1010 RefreshUpdateData ();
1011 mStartLabel
->Number
= FORM_BOOT_LEGACY_DEVICE_ID
;
1014 // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
1015 // in BootOption form: legacy FD/HD/CD/NET/BEV
1017 HiiCreateGotoOpCode (
1019 FORM_SET_FD_ORDER_ID
,
1020 STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE
),
1021 STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE
),
1022 EFI_IFR_FLAG_CALLBACK
,
1023 FORM_SET_FD_ORDER_ID
1026 HiiCreateGotoOpCode (
1028 FORM_SET_HD_ORDER_ID
,
1029 STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE
),
1030 STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE
),
1031 EFI_IFR_FLAG_CALLBACK
,
1032 FORM_SET_HD_ORDER_ID
1035 HiiCreateGotoOpCode (
1037 FORM_SET_CD_ORDER_ID
,
1038 STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE
),
1039 STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE
),
1040 EFI_IFR_FLAG_CALLBACK
,
1041 FORM_SET_CD_ORDER_ID
1044 HiiCreateGotoOpCode (
1046 FORM_SET_NET_ORDER_ID
,
1047 STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE
),
1048 STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE
),
1049 EFI_IFR_FLAG_CALLBACK
,
1050 FORM_SET_NET_ORDER_ID
1053 HiiCreateGotoOpCode (
1055 FORM_SET_BEV_ORDER_ID
,
1056 STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE
),
1057 STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE
),
1058 EFI_IFR_FLAG_CALLBACK
,
1059 FORM_SET_BEV_ORDER_ID
1063 BmmCallbackInfo
->BmmHiiHandle
,
1066 mStartOpCodeHandle
, // Label FORM_BOOT_LEGACY_DEVICE_ID
1067 mEndOpCodeHandle
// LABEL_END
1072 // Dispatch BMM main formset and File Explorer formset.
1074 FormSetDispatcher (BmmCallbackInfo
);
1077 // Remove our IFR data from HII database
1079 HiiRemovePackages (BmmCallbackInfo
->BmmHiiHandle
);
1080 HiiRemovePackages (BmmCallbackInfo
->FeHiiHandle
);
1082 CleanUpStringDepository ();
1087 if (mStartOpCodeHandle
!= NULL
) {
1088 HiiFreeOpCodeHandle (mStartOpCodeHandle
);
1091 if (mEndOpCodeHandle
!= NULL
) {
1092 HiiFreeOpCodeHandle (mEndOpCodeHandle
);
1095 if (BmmCallbackInfo
->FeDriverHandle
!= NULL
) {
1096 gBS
->UninstallMultipleProtocolInterfaces (
1097 BmmCallbackInfo
->FeDriverHandle
,
1098 &gEfiDevicePathProtocolGuid
,
1099 &mFeHiiVendorDevicePath
,
1100 &gEfiHiiConfigAccessProtocolGuid
,
1101 &BmmCallbackInfo
->FeConfigAccess
,
1106 if (BmmCallbackInfo
->BmmDriverHandle
!= NULL
) {
1107 gBS
->UninstallMultipleProtocolInterfaces (
1108 BmmCallbackInfo
->BmmDriverHandle
,
1109 &gEfiDevicePathProtocolGuid
,
1110 &mBmmHiiVendorDevicePath
,
1111 &gEfiHiiConfigAccessProtocolGuid
,
1112 &BmmCallbackInfo
->BmmConfigAccess
,
1117 FreePool (BmmCallbackInfo
->LoadContext
);
1118 FreePool (BmmCallbackInfo
);
1124 Initialized all Menu Option List.
1126 @param CallbackData The BMM context data.
1131 IN BMM_CALLBACK_DATA
*CallbackData
1134 InitializeListHead (&BootOptionMenu
.Head
);
1135 InitializeListHead (&DriverOptionMenu
.Head
);
1136 BOpt_GetBootOptions (CallbackData
);
1137 BOpt_GetDriverOptions (CallbackData
);
1138 BOpt_GetLegacyOptions ();
1139 InitializeListHead (&FsOptionMenu
.Head
);
1140 BOpt_FindDrivers ();
1141 InitializeListHead (&DirectoryMenu
.Head
);
1142 InitializeListHead (&ConsoleInpMenu
.Head
);
1143 InitializeListHead (&ConsoleOutMenu
.Head
);
1144 InitializeListHead (&ConsoleErrMenu
.Head
);
1145 InitializeListHead (&TerminalMenu
.Head
);
1151 Free up all Menu Option list.
1159 BOpt_FreeMenu (&DirectoryMenu
);
1160 BOpt_FreeMenu (&FsOptionMenu
);
1161 BOpt_FreeMenu (&BootOptionMenu
);
1162 BOpt_FreeMenu (&DriverOptionMenu
);
1163 BOpt_FreeMenu (&DriverMenu
);
1164 BOpt_FreeLegacyOptions ();
1169 Intialize all the string depositories.
1173 InitializeStringDepository (
1177 STRING_DEPOSITORY
*StringDepository
;
1178 StringDepository
= AllocateZeroPool (sizeof (STRING_DEPOSITORY
) * STRING_DEPOSITORY_NUMBER
);
1179 FileOptionStrDepository
= StringDepository
++;
1180 ConsoleOptionStrDepository
= StringDepository
++;
1181 BootOptionStrDepository
= StringDepository
++;
1182 BootOptionHelpStrDepository
= StringDepository
++;
1183 DriverOptionStrDepository
= StringDepository
++;
1184 DriverOptionHelpStrDepository
= StringDepository
++;
1185 TerminalStrDepository
= StringDepository
;
1189 Fetch a usable string node from the string depository and return the string token.
1191 @param CallbackData The BMM context data.
1192 @param StringDepository The string repository.
1194 @retval EFI_STRING_ID String token.
1198 GetStringTokenFromDepository (
1199 IN BMM_CALLBACK_DATA
*CallbackData
,
1200 IN STRING_DEPOSITORY
*StringDepository
1203 STRING_LIST_NODE
*CurrentListNode
;
1204 STRING_LIST_NODE
*NextListNode
;
1206 CurrentListNode
= StringDepository
->CurrentNode
;
1208 if ((NULL
!= CurrentListNode
) && (NULL
!= CurrentListNode
->Next
)) {
1210 // Fetch one reclaimed node from the list.
1212 NextListNode
= StringDepository
->CurrentNode
->Next
;
1215 // If there is no usable node in the list, update the list.
1217 NextListNode
= AllocateZeroPool (sizeof (STRING_LIST_NODE
));
1218 ASSERT (NextListNode
!= NULL
);
1219 NextListNode
->StringToken
= HiiSetString (CallbackData
->BmmHiiHandle
, 0, L
" ", NULL
);
1220 ASSERT (NextListNode
->StringToken
!= 0);
1222 StringDepository
->TotalNodeNumber
++;
1224 if (NULL
== CurrentListNode
) {
1225 StringDepository
->ListHead
= NextListNode
;
1227 CurrentListNode
->Next
= NextListNode
;
1231 StringDepository
->CurrentNode
= NextListNode
;
1233 return StringDepository
->CurrentNode
->StringToken
;
1237 Reclaim string depositories by moving the current node pointer to list head..
1241 ReclaimStringDepository (
1245 UINTN DepositoryIndex
;
1246 STRING_DEPOSITORY
*StringDepository
;
1248 StringDepository
= FileOptionStrDepository
;
1249 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1250 StringDepository
->CurrentNode
= StringDepository
->ListHead
;
1256 Release resource for all the string depositories.
1260 CleanUpStringDepository (
1265 UINTN DepositoryIndex
;
1266 STRING_LIST_NODE
*CurrentListNode
;
1267 STRING_LIST_NODE
*NextListNode
;
1268 STRING_DEPOSITORY
*StringDepository
;
1271 // Release string list nodes.
1273 StringDepository
= FileOptionStrDepository
;
1274 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1275 CurrentListNode
= StringDepository
->ListHead
;
1276 for (NodeIndex
= 0; NodeIndex
< StringDepository
->TotalNodeNumber
; NodeIndex
++) {
1277 NextListNode
= CurrentListNode
->Next
;
1278 FreePool (CurrentListNode
);
1279 CurrentListNode
= NextListNode
;
1285 // Release string depository.
1287 FreePool (FileOptionStrDepository
);
1291 Start boot maintenance manager
1293 @retval EFI_SUCCESS If BMM is invoked successfully.
1294 @return Other value if BMM return unsuccessfully.
1303 LIST_ENTRY BdsBootOptionList
;
1305 InitializeListHead (&BdsBootOptionList
);
1308 // Connect all prior to entering the platform setup menu.
1310 if (!gConnectAllHappened
) {
1311 BdsLibConnectAllDriversToAllControllers ();
1312 gConnectAllHappened
= TRUE
;
1315 // Have chance to enumerate boot device
1317 BdsLibEnumerateAllBootOption (&BdsBootOptionList
);
1322 Status
= InitializeBM ();
1328 Dispatch BMM formset and FileExplorer formset.
1331 @param CallbackData The BMM context data.
1333 @retval EFI_SUCCESS If function complete successfully.
1334 @return Other value if the Setup Browser process BMM's pages and
1335 return unsuccessfully.
1340 IN BMM_CALLBACK_DATA
*CallbackData
1344 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
1347 UpdatePageId (CallbackData
, FORM_MAIN_ID
);
1349 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1350 Status
= gFormBrowser2
->SendForm (
1352 &CallbackData
->BmmHiiHandle
,
1359 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
1360 EnableResetRequired ();
1363 ReclaimStringDepository ();
1366 // When this Formset returns, check if we are going to explore files.
1368 if (INACTIVE_STATE
!= CallbackData
->FeCurrentState
) {
1369 UpdateFileExplorer (CallbackData
, 0);
1371 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1372 Status
= gFormBrowser2
->SendForm (
1374 &CallbackData
->FeHiiHandle
,
1381 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
1382 EnableResetRequired ();
1385 CallbackData
->FeCurrentState
= INACTIVE_STATE
;
1386 CallbackData
->FeDisplayContext
= UNKNOWN_CONTEXT
;
1387 ReclaimStringDepository ();
1398 Deletete the Boot Option from EFI Variable. The Boot Order Arrray
1401 @param OptionNumber The number of Boot option want to be deleted.
1402 @param BootOrder The Boot Order array.
1403 @param BootOrderSize The size of the Boot Order Array.
1405 @return Other value if the Boot Option specified by OptionNumber is not deleteed succesfully.
1406 @retval EFI_SUCCESS If function return successfully.
1411 BdsDeleteBootOption (
1412 IN UINTN OptionNumber
,
1413 IN OUT UINT16
*BootOrder
,
1414 IN OUT UINTN
*BootOrderSize
1417 UINT16 BootOption
[100];
1422 Status
= EFI_SUCCESS
;
1425 UnicodeSPrint (BootOption
, sizeof (BootOption
), L
"Boot%04x", OptionNumber
);
1426 Status
= EfiLibDeleteVariable (BootOption
, &gEfiGlobalVariableGuid
);
1429 // adjust boot order array
1431 for (Index
= 0; Index
< *BootOrderSize
/ sizeof (UINT16
); Index
++) {
1432 if (BootOrder
[Index
] == OptionNumber
) {
1438 if (Index
!= *BootOrderSize
/ sizeof (UINT16
)) {
1439 for (Index
= 0; Index
< *BootOrderSize
/ sizeof (UINT16
) - 1; Index
++) {
1440 if (Index
>= Index2Del
) {
1441 BootOrder
[Index
] = BootOrder
[Index
+ 1];
1445 *BootOrderSize
-= sizeof (UINT16
);