2 The functions for Boot Maintainence Main menu.
4 Copyright (c) 2004 - 2009, 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
= &Private
->BmmFakeNvData
;
275 HiiGetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
);
278 // need to be subtituded.
280 // Update Select FD/HD/CD/NET/BEV Order Form
282 if (FORM_SET_FD_ORDER_ID
== Private
->BmmPreviousPageId
||
283 FORM_SET_HD_ORDER_ID
== Private
->BmmPreviousPageId
||
284 FORM_SET_CD_ORDER_ID
== Private
->BmmPreviousPageId
||
285 FORM_SET_NET_ORDER_ID
== Private
->BmmPreviousPageId
||
286 FORM_SET_BEV_ORDER_ID
== Private
->BmmPreviousPageId
||
287 ((FORM_BOOT_SETUP_ID
== Private
->BmmPreviousPageId
) &&
288 (QuestionId
>= LEGACY_FD_QUESTION_ID
) &&
289 (QuestionId
< (LEGACY_BEV_QUESTION_ID
+ 100)) )
292 DisMap
= Private
->BmmOldFakeNVData
.DisableMap
;
294 FormId
= Private
->BmmPreviousPageId
;
295 if (FormId
== FORM_BOOT_SETUP_ID
) {
296 FormId
= Private
->BmmCurrentPageId
;
300 case FORM_SET_FD_ORDER_ID
:
301 Number
= (UINT16
) LegacyFDMenu
.MenuNumber
;
302 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyFD
;
303 NewLegacyDev
= CurrentFakeNVMap
->LegacyFD
;
306 case FORM_SET_HD_ORDER_ID
:
307 Number
= (UINT16
) LegacyHDMenu
.MenuNumber
;
308 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyHD
;
309 NewLegacyDev
= CurrentFakeNVMap
->LegacyHD
;
312 case FORM_SET_CD_ORDER_ID
:
313 Number
= (UINT16
) LegacyCDMenu
.MenuNumber
;
314 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyCD
;
315 NewLegacyDev
= CurrentFakeNVMap
->LegacyCD
;
318 case FORM_SET_NET_ORDER_ID
:
319 Number
= (UINT16
) LegacyNETMenu
.MenuNumber
;
320 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyNET
;
321 NewLegacyDev
= CurrentFakeNVMap
->LegacyNET
;
324 case FORM_SET_BEV_ORDER_ID
:
325 Number
= (UINT16
) LegacyBEVMenu
.MenuNumber
;
326 OldLegacyDev
= Private
->BmmOldFakeNVData
.LegacyBEV
;
327 NewLegacyDev
= CurrentFakeNVMap
->LegacyBEV
;
334 // First, find the different position
335 // if there is change, it should be only one
337 for (Index
= 0; Index
< Number
; Index
++) {
338 if (OldLegacyDev
[Index
] != NewLegacyDev
[Index
]) {
339 OldValue
= OldLegacyDev
[Index
];
340 NewValue
= NewLegacyDev
[Index
];
345 if (Index
!= Number
) {
347 // there is change, now process
349 if (0xFF == NewValue
) {
351 // This item will be disable
352 // Just move the items behind this forward to overlap it
355 Bit
= 7 - (OldValue
% 8);
356 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] | (UINT8
) (1 << Bit
));
357 for (Index2
= Index
; Index2
< Number
- 1; Index2
++) {
358 NewLegacyDev
[Index2
] = NewLegacyDev
[Index2
+ 1];
361 NewLegacyDev
[Index2
] = 0xFF;
363 for (Index2
= 0; Index2
< Number
; Index2
++) {
364 if (Index2
== Index
) {
368 if (OldLegacyDev
[Index2
] == NewValue
) {
370 // If NewValue is in OldLegacyDev array
371 // remember its old position
373 NewValuePos
= Index2
;
378 if (Index2
!= Number
) {
380 // We will change current item to an existing item
381 // (It's hard to describe here, please read code, it's like a cycle-moving)
383 for (Index2
= NewValuePos
; Index2
!= Index
;) {
384 if (NewValuePos
< Index
) {
385 NewLegacyDev
[Index2
] = OldLegacyDev
[Index2
+ 1];
388 NewLegacyDev
[Index2
] = OldLegacyDev
[Index2
- 1];
394 // If NewValue is not in OldlegacyDev array, we are changing to a disabled item
395 // so we should modify DisMap to reflect the change
398 Bit
= 7 - (NewValue
% 8);
399 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] & (~ (UINT8
) (1 << Bit
)));
400 if (0xFF != OldValue
) {
402 // Because NewValue is a item that was disabled before
403 // so after changing the OldValue should be disabled
404 // actually we are doing a swap of enable-disable states of two items
407 Bit
= 7 - (OldValue
% 8);
408 DisMap
[Pos
] = (UINT8
) (DisMap
[Pos
] | (UINT8
) (1 << Bit
));
413 // To prevent DISABLE appears in the middle of the list
414 // we should perform a re-ordering
417 while (Index
< Number
) {
418 if (0xFF != NewLegacyDev
[Index
]) {
425 while (Index2
< Number
) {
426 if (0xFF != NewLegacyDev
[Index2
]) {
433 if (Index2
< Number
) {
434 NewLegacyDev
[Index
] = NewLegacyDev
[Index2
];
435 NewLegacyDev
[Index2
] = 0xFF;
449 if (QuestionId
< FILE_OPTION_OFFSET
) {
450 if (QuestionId
< CONFIG_OPTION_OFFSET
) {
451 switch (QuestionId
) {
452 case KEY_VALUE_BOOT_FROM_FILE
:
453 Private
->FeCurrentState
= FileExplorerStateBootFromFile
;
456 // Exit Bmm main formset to send File Explorer formset.
458 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
461 case FORM_BOOT_ADD_ID
:
462 Private
->FeCurrentState
= FileExplorerStateAddBootOption
;
465 // Exit Bmm main formset to send File Explorer formset.
467 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
470 case FORM_DRV_ADD_FILE_ID
:
471 Private
->FeCurrentState
= FileExplorerStateAddDriverOptionState
;
474 // Exit Bmm main formset to send File Explorer formset.
476 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_EXIT
;
479 case FORM_DRV_ADD_HANDLE_ID
:
480 CleanUpPage (FORM_DRV_ADD_HANDLE_ID
, Private
);
481 UpdateDrvAddHandlePage (Private
);
484 case FORM_BOOT_DEL_ID
:
485 CleanUpPage (FORM_BOOT_DEL_ID
, Private
);
486 UpdateBootDelPage (Private
);
489 case FORM_BOOT_CHG_ID
:
490 case FORM_DRV_CHG_ID
:
491 UpdatePageBody (QuestionId
, Private
);
494 case FORM_DRV_DEL_ID
:
495 CleanUpPage (FORM_DRV_DEL_ID
, Private
);
496 UpdateDrvDelPage (Private
);
499 case FORM_BOOT_NEXT_ID
:
500 CleanUpPage (FORM_BOOT_NEXT_ID
, Private
);
501 UpdateBootNextPage (Private
);
504 case FORM_TIME_OUT_ID
:
505 CleanUpPage (FORM_TIME_OUT_ID
, Private
);
506 UpdateTimeOutPage (Private
);
510 gRT
->ResetSystem (EfiResetCold
, EFI_SUCCESS
, 0, NULL
);
511 return EFI_UNSUPPORTED
;
514 case FORM_CON_OUT_ID
:
515 case FORM_CON_ERR_ID
:
516 UpdatePageBody (QuestionId
, Private
);
519 case FORM_CON_MODE_ID
:
520 CleanUpPage (FORM_CON_MODE_ID
, Private
);
521 UpdateConModePage (Private
);
524 case FORM_CON_COM_ID
:
525 CleanUpPage (FORM_CON_COM_ID
, Private
);
526 UpdateConCOMPage (Private
);
529 case FORM_SET_FD_ORDER_ID
:
530 case FORM_SET_HD_ORDER_ID
:
531 case FORM_SET_CD_ORDER_ID
:
532 case FORM_SET_NET_ORDER_ID
:
533 case FORM_SET_BEV_ORDER_ID
:
534 CleanUpPage (QuestionId
, Private
);
535 UpdateSetLegacyDeviceOrderPage (QuestionId
, Private
);
538 case KEY_VALUE_SAVE_AND_EXIT
:
539 case KEY_VALUE_NO_SAVE_AND_EXIT
:
541 if (QuestionId
== KEY_VALUE_SAVE_AND_EXIT
) {
542 Status
= ApplyChangeHandler (Private
, CurrentFakeNVMap
, Private
->BmmPreviousPageId
);
543 if (EFI_ERROR (Status
)) {
546 } else if (QuestionId
== KEY_VALUE_NO_SAVE_AND_EXIT
) {
547 DiscardChangeHandler (Private
, CurrentFakeNVMap
);
551 // Tell browser not to ask for confirmation of changes,
552 // since we have already applied or discarded.
554 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_SUBMIT
;
560 } else if ((QuestionId
>= TERMINAL_OPTION_OFFSET
) && (QuestionId
< CONSOLE_OPTION_OFFSET
)) {
561 Index2
= (UINT16
) (QuestionId
- TERMINAL_OPTION_OFFSET
);
562 Private
->CurrentTerminal
= Index2
;
564 CleanUpPage (FORM_CON_COM_SETUP_ID
, Private
);
565 UpdateTerminalPage (Private
);
567 } else if (QuestionId
>= HANDLE_OPTION_OFFSET
) {
568 Index2
= (UINT16
) (QuestionId
- HANDLE_OPTION_OFFSET
);
570 NewMenuEntry
= BOpt_GetMenuEntry (&DriverMenu
, Index2
);
571 ASSERT (NewMenuEntry
!= NULL
);
572 Private
->HandleContext
= (BM_HANDLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
574 CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID
, Private
);
576 Private
->MenuEntry
= NewMenuEntry
;
577 Private
->LoadContext
->FilePathList
= Private
->HandleContext
->DevicePath
;
579 UpdateDriverAddHandleDescPage (Private
);
584 // Pass changed uncommitted data back to Form Browser
586 Status
= HiiSetBrowserData (&mBootMaintGuid
, mBootMaintStorageName
, sizeof (BMM_FAKE_NV_DATA
), (UINT8
*) CurrentFakeNVMap
, NULL
);
592 Function handling request to apply changes for BMM pages.
594 @param Private Pointer to callback data buffer.
595 @param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
596 @param FormId ID of the form which has sent the request to apply change.
598 @retval EFI_SUCCESS Change successfully applied.
599 @retval Other Error occurs while trying to apply changes.
604 IN BMM_CALLBACK_DATA
*Private
,
605 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
,
606 IN EFI_FORM_ID FormId
609 BM_CONSOLE_CONTEXT
*NewConsoleContext
;
610 BM_TERMINAL_CONTEXT
*NewTerminalContext
;
611 BM_LOAD_CONTEXT
*NewLoadContext
;
612 BM_MENU_ENTRY
*NewMenuEntry
;
616 Status
= EFI_SUCCESS
;
619 case FORM_SET_FD_ORDER_ID
:
620 case FORM_SET_HD_ORDER_ID
:
621 case FORM_SET_CD_ORDER_ID
:
622 case FORM_SET_NET_ORDER_ID
:
623 case FORM_SET_BEV_ORDER_ID
:
624 Var_UpdateBBSOption (Private
);
627 case FORM_BOOT_DEL_ID
:
629 ((Index
< BootOptionMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->BootOptionDel
) / sizeof (UINT8
))));
631 NewMenuEntry
= BOpt_GetMenuEntry (&BootOptionMenu
, Index
);
632 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
633 NewLoadContext
->Deleted
= CurrentFakeNVMap
->BootOptionDel
[Index
];
636 Var_DelBootOption ();
639 case FORM_DRV_DEL_ID
:
641 ((Index
< DriverOptionMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->DriverOptionDel
) / sizeof (UINT8
))));
643 NewMenuEntry
= BOpt_GetMenuEntry (&DriverOptionMenu
, Index
);
644 NewLoadContext
= (BM_LOAD_CONTEXT
*) NewMenuEntry
->VariableContext
;
645 NewLoadContext
->Deleted
= CurrentFakeNVMap
->DriverOptionDel
[Index
];
648 Var_DelDriverOption ();
651 case FORM_BOOT_CHG_ID
:
652 Status
= Var_UpdateBootOrder (Private
);
655 case FORM_DRV_CHG_ID
:
656 Status
= Var_UpdateDriverOrder (Private
);
659 case FORM_TIME_OUT_ID
:
660 PcdSet16 (PcdPlatformBootTimeOut
, CurrentFakeNVMap
->BootTimeOut
);
662 Private
->BmmOldFakeNVData
.BootTimeOut
= CurrentFakeNVMap
->BootTimeOut
;
665 case FORM_BOOT_NEXT_ID
:
666 Status
= Var_UpdateBootNext (Private
);
669 case FORM_CON_MODE_ID
:
670 Status
= Var_UpdateConMode (Private
);
673 case FORM_CON_COM_SETUP_ID
:
674 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Private
->CurrentTerminal
);
676 ASSERT (NewMenuEntry
!= NULL
);
678 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
680 NewTerminalContext
->BaudRateIndex
= CurrentFakeNVMap
->COMBaudRate
;
681 ASSERT (CurrentFakeNVMap
->COMBaudRate
< (sizeof (BaudRateList
) / sizeof (BaudRateList
[0])));
682 NewTerminalContext
->BaudRate
= BaudRateList
[CurrentFakeNVMap
->COMBaudRate
].Value
;
683 NewTerminalContext
->DataBitsIndex
= CurrentFakeNVMap
->COMDataRate
;
684 ASSERT (CurrentFakeNVMap
->COMDataRate
< (sizeof (DataBitsList
) / sizeof (DataBitsList
[0])));
685 NewTerminalContext
->DataBits
= (UINT8
) DataBitsList
[CurrentFakeNVMap
->COMDataRate
].Value
;
686 NewTerminalContext
->StopBitsIndex
= CurrentFakeNVMap
->COMStopBits
;
687 ASSERT (CurrentFakeNVMap
->COMStopBits
< (sizeof (StopBitsList
) / sizeof (StopBitsList
[0])));
688 NewTerminalContext
->StopBits
= (UINT8
) StopBitsList
[CurrentFakeNVMap
->COMStopBits
].Value
;
689 NewTerminalContext
->ParityIndex
= CurrentFakeNVMap
->COMParity
;
690 ASSERT (CurrentFakeNVMap
->COMParity
< (sizeof (ParityList
) / sizeof (ParityList
[0])));
691 NewTerminalContext
->Parity
= (UINT8
) ParityList
[CurrentFakeNVMap
->COMParity
].Value
;
692 NewTerminalContext
->TerminalType
= CurrentFakeNVMap
->COMTerminalType
;
694 ChangeTerminalDevicePath (
695 NewTerminalContext
->DevicePath
,
699 Var_UpdateConsoleInpOption ();
700 Var_UpdateConsoleOutOption ();
701 Var_UpdateErrorOutOption ();
706 ((Index
< ConsoleInpMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
))));
708 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleInpMenu
, Index
);
709 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
710 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
714 ((Index
< TerminalMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
) - ConsoleInpMenu
.MenuNumber
)));
716 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
717 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
718 NewTerminalContext
->IsConIn
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleInpMenu
.MenuNumber
];
721 Var_UpdateConsoleInpOption ();
724 case FORM_CON_OUT_ID
:
726 ((Index
< ConsoleOutMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
))));
728 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleOutMenu
, Index
);
729 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
730 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
734 ((Index
< TerminalMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
) - ConsoleOutMenu
.MenuNumber
)));
736 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
737 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
738 NewTerminalContext
->IsConOut
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleOutMenu
.MenuNumber
];
741 Var_UpdateConsoleOutOption ();
744 case FORM_CON_ERR_ID
:
745 ASSERT ((ConsoleErrMenu
.MenuNumber
+ TerminalMenu
.MenuNumber
) <= (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
)));
747 ((Index
< ConsoleErrMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
))));
749 NewMenuEntry
= BOpt_GetMenuEntry (&ConsoleErrMenu
, Index
);
750 NewConsoleContext
= (BM_CONSOLE_CONTEXT
*) NewMenuEntry
->VariableContext
;
751 NewConsoleContext
->IsActive
= CurrentFakeNVMap
->ConsoleCheck
[Index
];
755 ((Index
< TerminalMenu
.MenuNumber
) && (Index
< (sizeof (CurrentFakeNVMap
->ConsoleCheck
) / sizeof (UINT8
) - ConsoleErrMenu
.MenuNumber
)));
757 NewMenuEntry
= BOpt_GetMenuEntry (&TerminalMenu
, Index
);
758 NewTerminalContext
= (BM_TERMINAL_CONTEXT
*) NewMenuEntry
->VariableContext
;
759 NewTerminalContext
->IsStdErr
= CurrentFakeNVMap
->ConsoleCheck
[Index
+ ConsoleErrMenu
.MenuNumber
];
762 Var_UpdateErrorOutOption ();
765 case FORM_DRV_ADD_HANDLE_DESC_ID
:
766 Status
= Var_UpdateDriverOption (
768 Private
->BmmHiiHandle
,
769 CurrentFakeNVMap
->DriverAddHandleDesc
,
770 CurrentFakeNVMap
->DriverAddHandleOptionalData
,
771 CurrentFakeNVMap
->DriverAddForceReconnect
773 if (EFI_ERROR (Status
)) {
777 BOpt_GetDriverOptions (Private
);
778 CreateMenuStringToken (Private
, Private
->BmmHiiHandle
, &DriverOptionMenu
);
790 Discard all changes done to the BMM pages such as Boot Order change,
793 @param Private The BMM context data.
794 @param CurrentFakeNVMap The current Fack NV Map.
798 DiscardChangeHandler (
799 IN BMM_CALLBACK_DATA
*Private
,
800 IN BMM_FAKE_NV_DATA
*CurrentFakeNVMap
805 switch (Private
->BmmPreviousPageId
) {
806 case FORM_BOOT_CHG_ID
:
807 case FORM_DRV_CHG_ID
:
808 CopyMem (CurrentFakeNVMap
->OptionOrder
, Private
->BmmOldFakeNVData
.OptionOrder
, 100);
811 case FORM_BOOT_DEL_ID
:
812 ASSERT (BootOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->BootOptionDel
) / sizeof (CurrentFakeNVMap
->BootOptionDel
[0])));
813 for (Index
= 0; Index
< BootOptionMenu
.MenuNumber
; Index
++) {
814 CurrentFakeNVMap
->BootOptionDel
[Index
] = 0x00;
818 case FORM_DRV_DEL_ID
:
819 ASSERT (DriverOptionMenu
.MenuNumber
<= (sizeof (CurrentFakeNVMap
->DriverOptionDel
) / sizeof (CurrentFakeNVMap
->DriverOptionDel
[0])));
820 for (Index
= 0; Index
< DriverOptionMenu
.MenuNumber
; Index
++) {
821 CurrentFakeNVMap
->DriverOptionDel
[Index
] = 0x00;
825 case FORM_BOOT_NEXT_ID
:
826 CurrentFakeNVMap
->BootNext
= Private
->BmmOldFakeNVData
.BootNext
;
829 case FORM_TIME_OUT_ID
:
830 CurrentFakeNVMap
->BootTimeOut
= Private
->BmmOldFakeNVData
.BootTimeOut
;
833 case FORM_DRV_ADD_HANDLE_DESC_ID
:
834 case FORM_DRV_ADD_FILE_ID
:
835 case FORM_DRV_ADD_HANDLE_ID
:
836 CurrentFakeNVMap
->DriverAddHandleDesc
[0] = 0x0000;
837 CurrentFakeNVMap
->DriverAddHandleOptionalData
[0] = 0x0000;
846 Initialize the Boot Maintenance Utitliy.
849 @retval EFI_SUCCESS utility ended successfully
850 @retval others contain some errors
858 EFI_LEGACY_BIOS_PROTOCOL
*LegacyBios
;
859 BMM_CALLBACK_DATA
*BmmCallbackInfo
;
863 Status
= EFI_SUCCESS
;
866 // Create CallbackData structures for Driver Callback
868 BmmCallbackInfo
= AllocateZeroPool (sizeof (BMM_CALLBACK_DATA
));
869 if (BmmCallbackInfo
== NULL
) {
870 return EFI_OUT_OF_RESOURCES
;
874 // Create LoadOption in BmmCallbackInfo for Driver Callback
876 Ptr
= AllocateZeroPool (sizeof (BM_LOAD_CONTEXT
) + sizeof (BM_FILE_CONTEXT
) + sizeof (BM_HANDLE_CONTEXT
) + sizeof (BM_MENU_ENTRY
));
878 FreePool (BmmCallbackInfo
);
879 return EFI_OUT_OF_RESOURCES
;
883 // Initialize Bmm callback data.
885 BmmCallbackInfo
->LoadContext
= (BM_LOAD_CONTEXT
*) Ptr
;
886 Ptr
+= sizeof (BM_LOAD_CONTEXT
);
888 BmmCallbackInfo
->FileContext
= (BM_FILE_CONTEXT
*) Ptr
;
889 Ptr
+= sizeof (BM_FILE_CONTEXT
);
891 BmmCallbackInfo
->HandleContext
= (BM_HANDLE_CONTEXT
*) Ptr
;
892 Ptr
+= sizeof (BM_HANDLE_CONTEXT
);
894 BmmCallbackInfo
->MenuEntry
= (BM_MENU_ENTRY
*) Ptr
;
896 BmmCallbackInfo
->Signature
= BMM_CALLBACK_DATA_SIGNATURE
;
897 BmmCallbackInfo
->BmmConfigAccess
.ExtractConfig
= BootMaintExtractConfig
;
898 BmmCallbackInfo
->BmmConfigAccess
.RouteConfig
= FakeRouteConfig
;
899 BmmCallbackInfo
->BmmConfigAccess
.Callback
= BootMaintCallback
;
900 BmmCallbackInfo
->BmmPreviousPageId
= FORM_MAIN_ID
;
901 BmmCallbackInfo
->BmmCurrentPageId
= FORM_MAIN_ID
;
902 BmmCallbackInfo
->FeConfigAccess
.ExtractConfig
= FakeExtractConfig
;
903 BmmCallbackInfo
->FeConfigAccess
.RouteConfig
= FakeRouteConfig
;
904 BmmCallbackInfo
->FeConfigAccess
.Callback
= FileExplorerCallback
;
905 BmmCallbackInfo
->FeCurrentState
= FileExplorerStateInActive
;
906 BmmCallbackInfo
->FeDisplayContext
= FileExplorerDisplayUnknown
;
909 // Install Device Path Protocol and Config Access protocol to driver handle
911 Status
= gBS
->InstallMultipleProtocolInterfaces (
912 &BmmCallbackInfo
->BmmDriverHandle
,
913 &gEfiDevicePathProtocolGuid
,
914 &mBmmHiiVendorDevicePath
,
915 &gEfiHiiConfigAccessProtocolGuid
,
916 &BmmCallbackInfo
->BmmConfigAccess
,
919 if (EFI_ERROR (Status
)) {
924 // Install Device Path Protocol and Config Access protocol to driver handle
926 Status
= gBS
->InstallMultipleProtocolInterfaces (
927 &BmmCallbackInfo
->FeDriverHandle
,
928 &gEfiDevicePathProtocolGuid
,
929 &mFeHiiVendorDevicePath
,
930 &gEfiHiiConfigAccessProtocolGuid
,
931 &BmmCallbackInfo
->FeConfigAccess
,
934 if (EFI_ERROR (Status
)) {
939 // Post our Boot Maint VFR binnary to the HII database.
941 BmmCallbackInfo
->BmmHiiHandle
= HiiAddPackages (
943 BmmCallbackInfo
->BmmDriverHandle
,
948 ASSERT (BmmCallbackInfo
->BmmHiiHandle
!= NULL
);
951 // Post our File Explorer VFR binary to the HII database.
953 BmmCallbackInfo
->FeHiiHandle
= HiiAddPackages (
955 BmmCallbackInfo
->FeDriverHandle
,
960 ASSERT (BmmCallbackInfo
->FeHiiHandle
!= NULL
);
963 // Init OpCode Handle and Allocate space for creation of Buffer
965 mStartOpCodeHandle
= HiiAllocateOpCodeHandle ();
966 if (mStartOpCodeHandle
== NULL
) {
967 Status
= EFI_OUT_OF_RESOURCES
;
971 mEndOpCodeHandle
= HiiAllocateOpCodeHandle ();
972 if (mEndOpCodeHandle
== NULL
) {
973 Status
= EFI_OUT_OF_RESOURCES
;
978 // Create Hii Extend Label OpCode as the start opcode
980 mStartLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mStartOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
981 mStartLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
984 // Create Hii Extend Label OpCode as the end opcode
986 mEndLabel
= (EFI_IFR_GUID_LABEL
*) HiiCreateGuidOpCode (mEndOpCodeHandle
, &gEfiIfrTianoGuid
, NULL
, sizeof (EFI_IFR_GUID_LABEL
));
987 mEndLabel
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
988 mEndLabel
->Number
= LABEL_END
;
990 InitializeStringDepository ();
992 InitAllMenu (BmmCallbackInfo
);
994 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleInpMenu
);
995 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleOutMenu
);
996 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &ConsoleErrMenu
);
997 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &BootOptionMenu
);
998 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverOptionMenu
);
999 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &TerminalMenu
);
1000 CreateMenuStringToken (BmmCallbackInfo
, BmmCallbackInfo
->BmmHiiHandle
, &DriverMenu
);
1002 UpdateBootDelPage (BmmCallbackInfo
);
1003 UpdateDrvDelPage (BmmCallbackInfo
);
1005 if (TerminalMenu
.MenuNumber
> 0) {
1006 BmmCallbackInfo
->CurrentTerminal
= 0;
1007 UpdateTerminalPage (BmmCallbackInfo
);
1010 Status
= EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid
, (VOID
**) &LegacyBios
);
1011 if (!EFI_ERROR (Status
)) {
1012 RefreshUpdateData ();
1013 mStartLabel
->Number
= FORM_BOOT_LEGACY_DEVICE_ID
;
1016 // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
1017 // in BootOption form: legacy FD/HD/CD/NET/BEV
1019 HiiCreateGotoOpCode (
1021 FORM_SET_FD_ORDER_ID
,
1022 STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE
),
1023 STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE
),
1024 EFI_IFR_FLAG_CALLBACK
,
1025 FORM_SET_FD_ORDER_ID
1028 HiiCreateGotoOpCode (
1030 FORM_SET_HD_ORDER_ID
,
1031 STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE
),
1032 STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE
),
1033 EFI_IFR_FLAG_CALLBACK
,
1034 FORM_SET_HD_ORDER_ID
1037 HiiCreateGotoOpCode (
1039 FORM_SET_CD_ORDER_ID
,
1040 STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE
),
1041 STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE
),
1042 EFI_IFR_FLAG_CALLBACK
,
1043 FORM_SET_CD_ORDER_ID
1046 HiiCreateGotoOpCode (
1048 FORM_SET_NET_ORDER_ID
,
1049 STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE
),
1050 STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE
),
1051 EFI_IFR_FLAG_CALLBACK
,
1052 FORM_SET_NET_ORDER_ID
1055 HiiCreateGotoOpCode (
1057 FORM_SET_BEV_ORDER_ID
,
1058 STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE
),
1059 STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE
),
1060 EFI_IFR_FLAG_CALLBACK
,
1061 FORM_SET_BEV_ORDER_ID
1065 BmmCallbackInfo
->BmmHiiHandle
,
1068 mStartOpCodeHandle
, // Label FORM_BOOT_LEGACY_DEVICE_ID
1069 mEndOpCodeHandle
// LABEL_END
1074 // Dispatch BMM main formset and File Explorer formset.
1076 FormSetDispatcher (BmmCallbackInfo
);
1079 // Remove our IFR data from HII database
1081 HiiRemovePackages (BmmCallbackInfo
->BmmHiiHandle
);
1082 HiiRemovePackages (BmmCallbackInfo
->FeHiiHandle
);
1084 CleanUpStringDepository ();
1089 if (mStartOpCodeHandle
!= NULL
) {
1090 HiiFreeOpCodeHandle (mStartOpCodeHandle
);
1093 if (mEndOpCodeHandle
!= NULL
) {
1094 HiiFreeOpCodeHandle (mEndOpCodeHandle
);
1097 if (BmmCallbackInfo
->FeDriverHandle
!= NULL
) {
1098 gBS
->UninstallMultipleProtocolInterfaces (
1099 BmmCallbackInfo
->FeDriverHandle
,
1100 &gEfiDevicePathProtocolGuid
,
1101 &mFeHiiVendorDevicePath
,
1102 &gEfiHiiConfigAccessProtocolGuid
,
1103 &BmmCallbackInfo
->FeConfigAccess
,
1108 if (BmmCallbackInfo
->BmmDriverHandle
!= NULL
) {
1109 gBS
->UninstallMultipleProtocolInterfaces (
1110 BmmCallbackInfo
->BmmDriverHandle
,
1111 &gEfiDevicePathProtocolGuid
,
1112 &mBmmHiiVendorDevicePath
,
1113 &gEfiHiiConfigAccessProtocolGuid
,
1114 &BmmCallbackInfo
->BmmConfigAccess
,
1119 FreePool (BmmCallbackInfo
->LoadContext
);
1120 FreePool (BmmCallbackInfo
);
1126 Initialized all Menu Option List.
1128 @param CallbackData The BMM context data.
1133 IN BMM_CALLBACK_DATA
*CallbackData
1136 InitializeListHead (&BootOptionMenu
.Head
);
1137 InitializeListHead (&DriverOptionMenu
.Head
);
1138 BOpt_GetBootOptions (CallbackData
);
1139 BOpt_GetDriverOptions (CallbackData
);
1140 BOpt_GetLegacyOptions ();
1141 InitializeListHead (&FsOptionMenu
.Head
);
1142 BOpt_FindDrivers ();
1143 InitializeListHead (&DirectoryMenu
.Head
);
1144 InitializeListHead (&ConsoleInpMenu
.Head
);
1145 InitializeListHead (&ConsoleOutMenu
.Head
);
1146 InitializeListHead (&ConsoleErrMenu
.Head
);
1147 InitializeListHead (&TerminalMenu
.Head
);
1153 Free up all Menu Option list.
1161 BOpt_FreeMenu (&DirectoryMenu
);
1162 BOpt_FreeMenu (&FsOptionMenu
);
1163 BOpt_FreeMenu (&BootOptionMenu
);
1164 BOpt_FreeMenu (&DriverOptionMenu
);
1165 BOpt_FreeMenu (&DriverMenu
);
1166 BOpt_FreeLegacyOptions ();
1171 Intialize all the string depositories.
1175 InitializeStringDepository (
1179 STRING_DEPOSITORY
*StringDepository
;
1180 StringDepository
= AllocateZeroPool (sizeof (STRING_DEPOSITORY
) * STRING_DEPOSITORY_NUMBER
);
1181 FileOptionStrDepository
= StringDepository
++;
1182 ConsoleOptionStrDepository
= StringDepository
++;
1183 BootOptionStrDepository
= StringDepository
++;
1184 BootOptionHelpStrDepository
= StringDepository
++;
1185 DriverOptionStrDepository
= StringDepository
++;
1186 DriverOptionHelpStrDepository
= StringDepository
++;
1187 TerminalStrDepository
= StringDepository
;
1191 Fetch a usable string node from the string depository and return the string token.
1193 @param CallbackData The BMM context data.
1194 @param StringDepository The string repository.
1196 @retval EFI_STRING_ID String token.
1200 GetStringTokenFromDepository (
1201 IN BMM_CALLBACK_DATA
*CallbackData
,
1202 IN STRING_DEPOSITORY
*StringDepository
1205 STRING_LIST_NODE
*CurrentListNode
;
1206 STRING_LIST_NODE
*NextListNode
;
1208 CurrentListNode
= StringDepository
->CurrentNode
;
1210 if ((NULL
!= CurrentListNode
) && (NULL
!= CurrentListNode
->Next
)) {
1212 // Fetch one reclaimed node from the list.
1214 NextListNode
= StringDepository
->CurrentNode
->Next
;
1217 // If there is no usable node in the list, update the list.
1219 NextListNode
= AllocateZeroPool (sizeof (STRING_LIST_NODE
));
1220 ASSERT (NextListNode
!= NULL
);
1221 NextListNode
->StringToken
= HiiSetString (CallbackData
->BmmHiiHandle
, 0, L
" ", NULL
);
1222 ASSERT (NextListNode
->StringToken
!= 0);
1224 StringDepository
->TotalNodeNumber
++;
1226 if (NULL
== CurrentListNode
) {
1227 StringDepository
->ListHead
= NextListNode
;
1229 CurrentListNode
->Next
= NextListNode
;
1233 StringDepository
->CurrentNode
= NextListNode
;
1235 return StringDepository
->CurrentNode
->StringToken
;
1239 Reclaim string depositories by moving the current node pointer to list head..
1243 ReclaimStringDepository (
1247 UINTN DepositoryIndex
;
1248 STRING_DEPOSITORY
*StringDepository
;
1250 StringDepository
= FileOptionStrDepository
;
1251 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1252 StringDepository
->CurrentNode
= StringDepository
->ListHead
;
1258 Release resource for all the string depositories.
1262 CleanUpStringDepository (
1267 UINTN DepositoryIndex
;
1268 STRING_LIST_NODE
*CurrentListNode
;
1269 STRING_LIST_NODE
*NextListNode
;
1270 STRING_DEPOSITORY
*StringDepository
;
1273 // Release string list nodes.
1275 StringDepository
= FileOptionStrDepository
;
1276 for (DepositoryIndex
= 0; DepositoryIndex
< STRING_DEPOSITORY_NUMBER
; DepositoryIndex
++) {
1277 CurrentListNode
= StringDepository
->ListHead
;
1278 for (NodeIndex
= 0; NodeIndex
< StringDepository
->TotalNodeNumber
; NodeIndex
++) {
1279 NextListNode
= CurrentListNode
->Next
;
1280 FreePool (CurrentListNode
);
1281 CurrentListNode
= NextListNode
;
1287 // Release string depository.
1289 FreePool (FileOptionStrDepository
);
1293 Start boot maintenance manager
1295 @retval EFI_SUCCESS If BMM is invoked successfully.
1296 @return Other value if BMM return unsuccessfully.
1305 LIST_ENTRY BdsBootOptionList
;
1307 InitializeListHead (&BdsBootOptionList
);
1310 // Connect all prior to entering the platform setup menu.
1312 if (!gConnectAllHappened
) {
1313 BdsLibConnectAllDriversToAllControllers ();
1314 gConnectAllHappened
= TRUE
;
1317 // Have chance to enumerate boot device
1319 BdsLibEnumerateAllBootOption (&BdsBootOptionList
);
1324 Status
= InitializeBM ();
1330 Dispatch BMM formset and FileExplorer formset.
1333 @param CallbackData The BMM context data.
1335 @retval EFI_SUCCESS If function complete successfully.
1336 @return Other value if the Setup Browser process BMM's pages and
1337 return unsuccessfully.
1342 IN BMM_CALLBACK_DATA
*CallbackData
1346 EFI_BROWSER_ACTION_REQUEST ActionRequest
;
1349 UpdatePageId (CallbackData
, FORM_MAIN_ID
);
1351 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1352 Status
= gFormBrowser2
->SendForm (
1354 &CallbackData
->BmmHiiHandle
,
1361 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
1362 EnableResetRequired ();
1365 ReclaimStringDepository ();
1368 // When this Formset returns, check if we are going to explore files.
1370 if (FileExplorerStateInActive
!= CallbackData
->FeCurrentState
) {
1371 UpdateFileExplorer (CallbackData
, 0);
1373 ActionRequest
= EFI_BROWSER_ACTION_REQUEST_NONE
;
1374 Status
= gFormBrowser2
->SendForm (
1376 &CallbackData
->FeHiiHandle
,
1383 if (ActionRequest
== EFI_BROWSER_ACTION_REQUEST_RESET
) {
1384 EnableResetRequired ();
1387 CallbackData
->FeCurrentState
= FileExplorerStateInActive
;
1388 CallbackData
->FeDisplayContext
= FileExplorerDisplayUnknown
;
1389 ReclaimStringDepository ();
1400 Deletete the Boot Option from EFI Variable. The Boot Order Arrray
1403 @param OptionNumber The number of Boot option want to be deleted.
1404 @param BootOrder The Boot Order array.
1405 @param BootOrderSize The size of the Boot Order Array.
1407 @return Other value if the Boot Option specified by OptionNumber is not deleteed succesfully.
1408 @retval EFI_SUCCESS If function return successfully.
1413 BdsDeleteBootOption (
1414 IN UINTN OptionNumber
,
1415 IN OUT UINT16
*BootOrder
,
1416 IN OUT UINTN
*BootOrderSize
1419 UINT16 BootOption
[100];
1424 Status
= EFI_SUCCESS
;
1427 UnicodeSPrint (BootOption
, sizeof (BootOption
), L
"Boot%04x", OptionNumber
);
1428 Status
= EfiLibDeleteVariable (BootOption
, &gEfiGlobalVariableGuid
);
1431 // adjust boot order array
1433 for (Index
= 0; Index
< *BootOrderSize
/ sizeof (UINT16
); Index
++) {
1434 if (BootOrder
[Index
] == OptionNumber
) {
1440 if (Index
!= *BootOrderSize
/ sizeof (UINT16
)) {
1441 for (Index
= 0; Index
< *BootOrderSize
/ sizeof (UINT16
) - 1; Index
++) {
1442 if (Index
>= Index2Del
) {
1443 BootOrder
[Index
] = BootOrder
[Index
+ 1];
1447 *BootOrderSize
-= sizeof (UINT16
);