3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Misc BDS library function
23 // Include common header file for this module.
25 #include "CommonHeader.h"
27 #define MAX_STRING_LEN 200
28 static BOOLEAN mFeaturerSwitch
= TRUE
;
29 static BOOLEAN mResetRequired
= FALSE
;
30 extern UINT16 gPlatformBootTimeOutDefault
;
40 Return the default value for system Timeout variable.
57 // Return Timeout variable or 0xffff if no valid
58 // Timeout variable exists.
60 Size
= sizeof (UINT16
);
61 Status
= gRT
->GetVariable (L
"Timeout", &gEfiGlobalVariableGuid
, NULL
, &Size
, &Timeout
);
62 if (!EFI_ERROR (Status
)) {
66 // To make the current EFI Automatic-Test activity possible, just add
67 // following code to make AutoBoot enabled when this variable is not
69 // This code should be removed later.
71 Timeout
= gPlatformBootTimeOutDefault
;
74 // Notes: Platform should set default variable if non exists on all error cases!!!
76 Status
= gRT
->SetVariable (
78 &gEfiGlobalVariableGuid
,
79 EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
,
88 IN LIST_ENTRY
*BdsDriverLists
94 The function will go through the driver optoin link list, load and start
95 every driver the driver optoin device path point to.
99 BdsDriverLists - The header of the current driver option link list
109 BDS_COMMON_OPTION
*Option
;
110 EFI_HANDLE ImageHandle
;
111 EFI_LOADED_IMAGE_PROTOCOL
*ImageInfo
;
114 BOOLEAN ReconnectAll
;
116 ReconnectAll
= FALSE
;
119 // Process the driver option
121 for (Link
= BdsDriverLists
->ForwardLink
; Link
!= BdsDriverLists
; Link
= Link
->ForwardLink
) {
122 Option
= CR (Link
, BDS_COMMON_OPTION
, Link
, BDS_LOAD_OPTION_SIGNATURE
);
124 // If a load option is not marked as LOAD_OPTION_ACTIVE,
125 // the boot manager will not automatically load the option.
127 if (!IS_LOAD_OPTION_TYPE (Option
->Attribute
, LOAD_OPTION_ACTIVE
)) {
131 // If a driver load option is marked as LOAD_OPTION_FORCE_RECONNECT,
132 // then all of the EFI drivers in the system will be disconnected and
133 // reconnected after the last driver load option is processed.
135 if (IS_LOAD_OPTION_TYPE (Option
->Attribute
, LOAD_OPTION_FORCE_RECONNECT
)) {
139 // Make sure the driver path is connected.
141 BdsLibConnectDevicePath (Option
->DevicePath
);
144 // Load and start the image that Driver#### describes
146 Status
= gBS
->LoadImage (
155 if (!EFI_ERROR (Status
)) {
156 gBS
->HandleProtocol (ImageHandle
, &gEfiLoadedImageProtocolGuid
, &ImageInfo
);
159 // Verify whether this image is a driver, if not,
160 // exit it and continue to parse next load option
162 if (ImageInfo
->ImageCodeType
!= EfiBootServicesCode
&& ImageInfo
->ImageCodeType
!= EfiRuntimeServicesCode
) {
163 gBS
->Exit (ImageHandle
, EFI_INVALID_PARAMETER
, 0, NULL
);
167 if (Option
->LoadOptionsSize
!= 0) {
168 ImageInfo
->LoadOptionsSize
= Option
->LoadOptionsSize
;
169 ImageInfo
->LoadOptions
= Option
->LoadOptions
;
172 // Before calling the image, enable the Watchdog Timer for
173 // the 5 Minute period
175 gBS
->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL
);
177 Status
= gBS
->StartImage (ImageHandle
, &ExitDataSize
, &ExitData
);
178 DEBUG ((EFI_D_INFO
| EFI_D_LOAD
, "Driver Return Status = %r\n", Status
));
181 // Clear the Watchdog Timer after the image returns
183 gBS
->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL
);
187 // Process the LOAD_OPTION_FORCE_RECONNECT driver option
190 BdsLibDisconnectAllEfi ();
197 BdsLibRegisterNewOption (
198 IN LIST_ENTRY
*BdsOptionList
,
199 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
201 IN CHAR16
*VariableName
207 This function will register the new boot#### or driver#### option base on
208 the VariableName. The new registered boot#### or driver#### will be linked
209 to BdsOptionList and also update to the VariableName. After the boot#### or
210 driver#### updated, the BootOrder or DriverOrder will also be updated.
214 BdsOptionList - The header of the boot#### or driver#### link list
216 DevicePath - The device path which the boot####
217 or driver#### option present
219 String - The description of the boot#### or driver####
221 VariableName - Indicate if the boot#### or driver#### option
225 EFI_SUCCESS - The boot#### or driver#### have been success registered
227 EFI_STATUS - Return the status of gRT->SetVariable ().
233 UINT16 MaxOptionNumber
;
234 UINT16 RegisterOptionNumber
;
235 UINT16
*TempOptionPtr
;
236 UINTN TempOptionSize
;
237 UINT16
*OptionOrderPtr
;
241 EFI_DEVICE_PATH_PROTOCOL
*OptionDevicePath
;
243 CHAR16 OptionName
[10];
244 BOOLEAN UpdateBootDevicePath
;
249 OptionDevicePath
= NULL
;
252 OptionOrderPtr
= NULL
;
253 UpdateBootDevicePath
= FALSE
;
254 ZeroMem (OptionName
, sizeof (OptionName
));
258 TempOptionPtr
= BdsLibGetVariableAndSize (
260 &gEfiGlobalVariableGuid
,
265 // Compare with current option variable
267 for (Index
= 0; Index
< TempOptionSize
/ sizeof (UINT16
); Index
++) {
269 // Got the max option#### number
271 if (MaxOptionNumber
< TempOptionPtr
[Index
]) {
272 MaxOptionNumber
= TempOptionPtr
[Index
];
275 if (*VariableName
== 'B') {
276 UnicodeSPrint (OptionName
, sizeof (OptionName
), L
"Boot%04x", TempOptionPtr
[Index
]);
278 UnicodeSPrint (OptionName
, sizeof (OptionName
), L
"Driver%04x", TempOptionPtr
[Index
]);
281 OptionPtr
= BdsLibGetVariableAndSize (
283 &gEfiGlobalVariableGuid
,
287 TempPtr
+= sizeof (UINT32
) + sizeof (UINT16
);
288 Description
= (CHAR16
*) TempPtr
;
289 TempPtr
+= StrSize ((CHAR16
*) TempPtr
);
290 OptionDevicePath
= (EFI_DEVICE_PATH_PROTOCOL
*) TempPtr
;
293 // Notes: the description may will change base on the GetStringToken
295 if (CompareMem (Description
, String
, StrSize (Description
)) == 0) {
296 if (CompareMem (OptionDevicePath
, DevicePath
, GetDevicePathSize (OptionDevicePath
)) == 0) {
298 // Got the option, so just return
300 FreePool (OptionPtr
);
301 FreePool (TempOptionPtr
);
305 // Boot device path changed, need update.
307 UpdateBootDevicePath
= TRUE
;
312 FreePool (OptionPtr
);
315 OptionSize
= sizeof (UINT32
) + sizeof (UINT16
) + StrSize (String
) + GetDevicePathSize (DevicePath
);
316 OptionPtr
= AllocateZeroPool (OptionSize
);
318 *(UINT32
*) TempPtr
= LOAD_OPTION_ACTIVE
;
319 TempPtr
+= sizeof (UINT32
);
320 *(UINT16
*) TempPtr
= (UINT16
) GetDevicePathSize (DevicePath
);
321 TempPtr
+= sizeof (UINT16
);
322 CopyMem (TempPtr
, String
, StrSize (String
));
323 TempPtr
+= StrSize (String
);
324 CopyMem (TempPtr
, DevicePath
, GetDevicePathSize (DevicePath
));
326 if (UpdateBootDevicePath
) {
328 // The number in option#### to be updated
330 RegisterOptionNumber
= TempOptionPtr
[Index
];
333 // The new option#### number
335 RegisterOptionNumber
= MaxOptionNumber
+ 1;
338 if (*VariableName
== 'B') {
339 UnicodeSPrint (OptionName
, sizeof (OptionName
), L
"Boot%04x", RegisterOptionNumber
);
341 UnicodeSPrint (OptionName
, sizeof (OptionName
), L
"Driver%04x", RegisterOptionNumber
);
344 Status
= gRT
->SetVariable (
346 &gEfiGlobalVariableGuid
,
347 EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
,
351 if (EFI_ERROR (Status
) || UpdateBootDevicePath
) {
352 FreePool (OptionPtr
);
353 FreePool (TempOptionPtr
);
357 FreePool (OptionPtr
);
360 // Update the option order variable
362 OptionOrderPtr
= AllocateZeroPool ((Index
+ 1) * sizeof (UINT16
));
363 CopyMem (OptionOrderPtr
, TempOptionPtr
, Index
* sizeof (UINT16
));
364 OptionOrderPtr
[Index
] = RegisterOptionNumber
;
365 Status
= gRT
->SetVariable (
367 &gEfiGlobalVariableGuid
,
368 EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
,
369 (Index
+ 1) * sizeof (UINT16
),
372 if (EFI_ERROR (Status
)) {
373 FreePool (TempOptionPtr
);
374 FreePool (OptionOrderPtr
);
378 if (TempOptionPtr
!= NULL
) {
379 FreePool (TempOptionPtr
);
381 FreePool (OptionOrderPtr
);
387 BdsLibVariableToOption (
388 IN OUT LIST_ENTRY
*BdsCommonOptionList
,
389 IN CHAR16
*VariableName
395 Build the boot#### or driver#### option from the VariableName, the
396 build boot#### or driver#### will also be linked to BdsCommonOptionList
400 BdsCommonOptionList - The header of the boot#### or driver#### option link list
402 VariableName - EFI Variable name indicate if it is boot#### or driver####
406 BDS_COMMON_OPTION - Get the option just been created
408 NULL - Failed to get the new option
417 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
418 BDS_COMMON_OPTION
*Option
;
420 UINT32 LoadOptionsSize
;
424 // Read the variable. We will never free this data.
426 Variable
= BdsLibGetVariableAndSize (
428 &gEfiGlobalVariableGuid
,
431 if (Variable
== NULL
) {
435 // Notes: careful defined the variable of Boot#### or
436 // Driver####, consider use some macro to abstract the code
439 // Get the option attribute
442 Attribute
= *(UINT32
*) Variable
;
443 TempPtr
+= sizeof (UINT32
);
446 // Get the option's device path size
448 FilePathSize
= *(UINT16
*) TempPtr
;
449 TempPtr
+= sizeof (UINT16
);
452 // Get the option's description string
454 Description
= (CHAR16
*) TempPtr
;
457 // Get the option's description string size
459 TempPtr
+= StrSize ((CHAR16
*) TempPtr
);
462 // Get the option's device path
464 DevicePath
= (EFI_DEVICE_PATH_PROTOCOL
*) TempPtr
;
465 TempPtr
+= FilePathSize
;
467 LoadOptions
= TempPtr
;
468 LoadOptionsSize
= (UINT32
) (VariableSize
- (UINTN
) (TempPtr
- Variable
));
471 // The Console variables may have multiple device paths, so make
472 // an Entry for each one.
474 Option
= AllocateZeroPool (sizeof (BDS_COMMON_OPTION
));
475 if (Option
== NULL
) {
479 Option
->Signature
= BDS_LOAD_OPTION_SIGNATURE
;
480 Option
->DevicePath
= AllocateZeroPool (GetDevicePathSize (DevicePath
));
481 CopyMem (Option
->DevicePath
, DevicePath
, GetDevicePathSize (DevicePath
));
482 Option
->Attribute
= Attribute
;
483 Option
->Description
= AllocateZeroPool (StrSize (Description
));
484 CopyMem (Option
->Description
, Description
, StrSize (Description
));
485 Option
->LoadOptions
= AllocateZeroPool (LoadOptionsSize
);
486 CopyMem (Option
->LoadOptions
, LoadOptions
, LoadOptionsSize
);
487 Option
->LoadOptionsSize
= LoadOptionsSize
;
490 // Insert active entry to BdsDeviceList
492 if ((Option
->Attribute
& LOAD_OPTION_ACTIVE
) == LOAD_OPTION_ACTIVE
) {
493 InsertTailList (BdsCommonOptionList
, &Option
->Link
);
505 BdsLibBuildOptionFromVar (
506 IN LIST_ENTRY
*BdsCommonOptionList
,
507 IN CHAR16
*VariableName
513 Process BootOrder, or DriverOrder variables, by calling
514 BdsLibVariableToOption () for each UINT16 in the variables.
518 BdsCommonOptionList - The header of the option list base on variable
521 VariableName - EFI Variable name indicate the BootOrder or DriverOrder
525 EFI_SUCCESS - Success create the boot option or driver option list
527 EFI_OUT_OF_RESOURCES - Failed to get the boot option or driver option list
532 UINTN OptionOrderSize
;
534 BDS_COMMON_OPTION
*Option
;
535 CHAR16 OptionName
[20];
538 // Zero Buffer in order to get all BOOT#### variables
540 ZeroMem (OptionName
, sizeof (OptionName
));
543 // Read the BootOrder, or DriverOrder variable.
545 OptionOrder
= BdsLibGetVariableAndSize (
547 &gEfiGlobalVariableGuid
,
550 if (OptionOrder
== NULL
) {
551 return EFI_OUT_OF_RESOURCES
;
554 for (Index
= 0; Index
< OptionOrderSize
/ sizeof (UINT16
); Index
++) {
555 if (*VariableName
== 'B') {
556 UnicodeSPrint (OptionName
, sizeof (OptionName
), L
"Boot%04x", OptionOrder
[Index
]);
558 UnicodeSPrint (OptionName
, sizeof (OptionName
), L
"Driver%04x", OptionOrder
[Index
]);
560 Option
= BdsLibVariableToOption (BdsCommonOptionList
, OptionName
);
561 Option
->BootCurrent
= OptionOrder
[Index
];
565 FreePool (OptionOrder
);
571 BdsLibGetVariableAndSize (
573 IN EFI_GUID
*VendorGuid
,
574 OUT UINTN
*VariableSize
580 Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
581 buffer, and the size of the buffer. If failure return NULL.
585 Name - String part of EFI variable name
587 VendorGuid - GUID part of EFI variable name
589 VariableSize - Returns the size of the EFI variable that was read
593 Dynamically allocated memory that contains a copy of the EFI variable.
594 Caller is responsible freeing the buffer.
596 NULL - Variable was not read
607 // Pass in a zero size buffer to find the required buffer size.
610 Status
= gRT
->GetVariable (Name
, VendorGuid
, NULL
, &BufferSize
, Buffer
);
611 if (Status
== EFI_BUFFER_TOO_SMALL
) {
613 // Allocate the buffer to return
615 Buffer
= AllocateZeroPool (BufferSize
);
616 if (Buffer
== NULL
) {
620 // Read variable into the allocated buffer.
622 Status
= gRT
->GetVariable (Name
, VendorGuid
, NULL
, &BufferSize
, Buffer
);
623 if (EFI_ERROR (Status
)) {
628 *VariableSize
= BufferSize
;
644 Buffer - The allocated pool entry to free
648 Pointer of the buffer allocated.
652 if (Buffer
!= NULL
) {
658 EFI_DEVICE_PATH_PROTOCOL
*
659 BdsLibDelPartMatchInstance (
660 IN EFI_DEVICE_PATH_PROTOCOL
*Multi
,
661 IN EFI_DEVICE_PATH_PROTOCOL
*Single
667 Delete the instance in Multi which matches partly with Single instance
671 Multi - A pointer to a multi-instance device path data structure.
673 Single - A pointer to a single-instance device path data structure.
677 This function will remove the device path instances in Multi which partly
678 match with the Single, and return the result device path. If there is no
679 remaining device path as a result, this function will return NULL.
683 EFI_DEVICE_PATH_PROTOCOL
*Instance
;
684 EFI_DEVICE_PATH_PROTOCOL
*NewDevicePath
;
685 EFI_DEVICE_PATH_PROTOCOL
*TempNewDevicePath
;
690 NewDevicePath
= NULL
;
691 TempNewDevicePath
= NULL
;
693 if (Multi
== NULL
|| Single
== NULL
) {
697 Instance
= GetNextDevicePathInstance (&Multi
, &InstanceSize
);
698 SingleDpSize
= GetDevicePathSize (Single
) - END_DEVICE_PATH_LENGTH
;
699 InstanceSize
-= END_DEVICE_PATH_LENGTH
;
701 while (Instance
!= NULL
) {
703 Size
= (SingleDpSize
< InstanceSize
) ? SingleDpSize
: InstanceSize
;
705 if ((CompareMem (Instance
, Single
, Size
) != 0)) {
707 // Append the device path instance which does not match with Single
709 TempNewDevicePath
= NewDevicePath
;
710 NewDevicePath
= AppendDevicePathInstance (NewDevicePath
, Instance
);
711 BdsLibSafeFreePool(TempNewDevicePath
);
713 BdsLibSafeFreePool(Instance
);
714 Instance
= GetNextDevicePathInstance (&Multi
, &InstanceSize
);
715 InstanceSize
-= END_DEVICE_PATH_LENGTH
;
718 return NewDevicePath
;
722 BdsLibMatchDevicePaths (
723 IN EFI_DEVICE_PATH_PROTOCOL
*Multi
,
724 IN EFI_DEVICE_PATH_PROTOCOL
*Single
730 Function compares a device path data structure to that of all the nodes of a
731 second device path instance.
735 Multi - A pointer to a multi-instance device path data structure.
737 Single - A pointer to a single-instance device path data structure.
741 TRUE - If the Single is contained within Multi
743 FALSE - The Single is not match within Multi
748 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
749 EFI_DEVICE_PATH_PROTOCOL
*DevicePathInst
;
752 if (!Multi
|| !Single
) {
757 DevicePathInst
= GetNextDevicePathInstance (&DevicePath
, &Size
);
760 // Search for the match of 'Single' in 'Multi'
762 while (DevicePathInst
!= NULL
) {
764 // If the single device path is found in multiple device paths,
767 if (CompareMem (Single
, DevicePathInst
, Size
) == 0) {
768 FreePool (DevicePathInst
);
772 FreePool (DevicePathInst
);
773 DevicePathInst
= GetNextDevicePathInstance (&DevicePath
, &Size
);
780 BdsLibOutputStrings (
781 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ConOut
,
788 This function prints a series of strings.
792 ConOut - Pointer to EFI_SIMPLE_TEXT_OUT_PROTOCOL
794 ... - A variable argument list containing series of strings,
795 the last string must be NULL.
799 EFI_SUCCESS - Success print out the string using ConOut.
801 EFI_STATUS - Return the status of the ConOut->OutputString ().
809 Status
= EFI_SUCCESS
;
810 VA_START (args
, ConOut
);
812 while (!EFI_ERROR (Status
)) {
814 // If String is NULL, then it's the end of the list
816 String
= VA_ARG (args
, CHAR16
*);
821 Status
= ConOut
->OutputString (ConOut
, String
);
823 if (EFI_ERROR (Status
)) {
832 // Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
833 // Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
834 // user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
838 EnableResetReminderFeature (
845 Enable the setup browser reset reminder feature.
846 This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.
858 mFeaturerSwitch
= TRUE
;
862 DisableResetReminderFeature (
869 Disable the setup browser reset reminder feature.
870 This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.
882 mFeaturerSwitch
= FALSE
;
886 EnableResetRequired (
893 Record the info that a reset is required.
894 A module boolean variable is used to record whether a reset is required.
906 mResetRequired
= TRUE
;
910 DisableResetRequired (
917 Record the info that no reset is required.
918 A module boolean variable is used to record whether a reset is required.
930 mResetRequired
= FALSE
;
934 IsResetReminderFeatureEnable (
941 Check whether platform policy enable the reset reminder feature. The default is enabled.
953 return mFeaturerSwitch
;
964 Check if user changed any option setting which needs a system reset to be effective.
976 return mResetRequired
;
987 Check whether a reset is needed, and finish the reset reminder feature.
988 If a reset is needed, Popup a menu to notice user, and finish the feature
989 according to the user selection.
1002 EFI_FORM_BROWSER_PROTOCOL
*Browser
;
1004 CHAR16
*StringBuffer1
;
1005 CHAR16
*StringBuffer2
;
1009 //check any reset required change is applied? if yes, reset system
1011 if (IsResetReminderFeatureEnable ()) {
1012 if (IsResetRequired ()) {
1014 Status
= gBS
->LocateProtocol (
1015 &gEfiFormBrowserProtocolGuid
,
1020 ASSERT (Status
!= EFI_SUCCESS
);
1022 StringBuffer1
= AllocateZeroPool (MAX_STRING_LEN
* sizeof (CHAR16
));
1023 ASSERT (StringBuffer1
!= NULL
);
1024 StringBuffer2
= AllocateZeroPool (MAX_STRING_LEN
* sizeof (CHAR16
));
1025 ASSERT (StringBuffer2
!= NULL
);
1026 StrCpy (StringBuffer1
, L
"Configuration changed. Reset to apply it Now ? ");
1027 StrCpy (StringBuffer2
, L
"Enter (YES) / Esc (NO)");
1029 // Popup a menu to notice user
1032 Browser
->CreatePopUp (2, TRUE
, 0, NULL
, &Key
, StringBuffer1
, StringBuffer2
);
1033 } while ((Key
.ScanCode
!= SCAN_ESC
) && (Key
.UnicodeChar
!= CHAR_CARRIAGE_RETURN
));
1035 FreePool (StringBuffer1
);
1036 FreePool (StringBuffer2
);
1038 // If the user hits the YES Response key, reset
1040 if ((Key
.UnicodeChar
== CHAR_CARRIAGE_RETURN
)) {
1041 gRT
->ResetSystem (EfiResetCold
, EFI_SUCCESS
, 0, NULL
);
1043 gST
->ConOut
->ClearScreen (gST
->ConOut
);
1049 BdsLibGetHiiHandles (
1050 IN EFI_HII_PROTOCOL
*Hii
,
1051 IN OUT UINT16
*HandleBufferLength
,
1052 OUT EFI_HII_HANDLE
**HiiHandleBuffer
1056 Routine Description:
1058 Determines the handles that are currently active in the database.
1059 It's the caller's responsibility to free handle buffer.
1063 This - A pointer to the EFI_HII_PROTOCOL instance.
1064 HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
1065 the length of the handle buffer that is required for the handles found.
1066 HiiHandleBuffer - Pointer to an array of EFI_HII_PROTOCOL instances returned.
1070 EFI_SUCCESS - Get an array of EFI_HII_PROTOCOL instances successfully.
1071 EFI_INVALID_PARAMETER - Hii is NULL.
1072 EFI_NOT_FOUND - Database not found.
1076 UINT16 TempBufferLength
;
1079 TempBufferLength
= 0;
1082 // Try to find the actual buffer size for HiiHandle Buffer.
1084 Status
= Hii
->FindHandles (Hii
, &TempBufferLength
, *HiiHandleBuffer
);
1086 if (Status
== EFI_BUFFER_TOO_SMALL
) {
1087 *HiiHandleBuffer
= AllocateZeroPool (TempBufferLength
);
1088 Status
= Hii
->FindHandles (Hii
, &TempBufferLength
, *HiiHandleBuffer
);
1090 // we should not fail here.
1092 ASSERT_EFI_ERROR (Status
);
1095 *HandleBufferLength
= TempBufferLength
;