mirror of https://github.com/acidanthera/audk.git
IntelFrameworkModulePkg/LegacyBootMaintUiLib: Refine the code
Remove the ASSERT code that may be triggered in LegacyBootMaintUiLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
c7d310dd16
commit
1b53320e9e
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Legacy Boot Maintainence UI implementation.
|
Legacy Boot Maintainence UI implementation.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -109,8 +109,11 @@ HII_VENDOR_DEVICE_PATH mLegacyBootOptionHiiVendorDevicePath = {
|
||||||
@param EnBootOptionCount Count of the enabled Boot Option Numbers
|
@param EnBootOptionCount Count of the enabled Boot Option Numbers
|
||||||
@param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers
|
@param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers
|
||||||
@param DisBootOptionCount Count of the disabled Boot Option Numbers
|
@param DisBootOptionCount Count of the disabled Boot Option Numbers
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The function completed successfully.
|
||||||
|
@retval other Contain some error, details see the status return by gRT->SetVariable.
|
||||||
**/
|
**/
|
||||||
VOID
|
EFI_STATUS
|
||||||
OrderLegacyBootOption4SameType (
|
OrderLegacyBootOption4SameType (
|
||||||
UINT16 *DevOrder,
|
UINT16 *DevOrder,
|
||||||
UINTN DevOrderCount,
|
UINTN DevOrderCount,
|
||||||
|
@ -143,6 +146,7 @@ OrderLegacyBootOption4SameType (
|
||||||
*DisBootOptionCount = 0;
|
*DisBootOptionCount = 0;
|
||||||
*EnBootOptionCount = 0;
|
*EnBootOptionCount = 0;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
ASSERT (BbsIndexArray != NULL);
|
ASSERT (BbsIndexArray != NULL);
|
||||||
ASSERT (DeviceTypeArray != NULL);
|
ASSERT (DeviceTypeArray != NULL);
|
||||||
|
@ -207,11 +211,12 @@ OrderLegacyBootOption4SameType (
|
||||||
BootOrderSize,
|
BootOrderSize,
|
||||||
BootOrder
|
BootOrder
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
FreePool (NewBootOption);
|
FreePool (NewBootOption);
|
||||||
FreePool (DeviceTypeArray);
|
FreePool (DeviceTypeArray);
|
||||||
FreePool (BbsIndexArray);
|
FreePool (BbsIndexArray);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -222,8 +227,9 @@ OrderLegacyBootOption4SameType (
|
||||||
@param NVMapData The data for egacy BBS boot.
|
@param NVMapData The data for egacy BBS boot.
|
||||||
|
|
||||||
@return EFI_SUCCESS The function completed successfully.
|
@return EFI_SUCCESS The function completed successfully.
|
||||||
@retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can be found.
|
@retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found.
|
||||||
@retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource
|
@retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource
|
||||||
|
@retval other Contain some error, details see the status return by gRT->SetVariable.
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UpdateBBSOption (
|
UpdateBBSOption (
|
||||||
|
@ -260,6 +266,8 @@ UpdateBBSOption (
|
||||||
DisMap = NULL;
|
DisMap = NULL;
|
||||||
NewOrder = NULL;
|
NewOrder = NULL;
|
||||||
CurrentType = 0;
|
CurrentType = 0;
|
||||||
|
EnBootOption = NULL;
|
||||||
|
DisBootOption = NULL;
|
||||||
|
|
||||||
|
|
||||||
DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
|
DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;
|
||||||
|
@ -381,7 +389,7 @@ UpdateBBSOption (
|
||||||
//
|
//
|
||||||
ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1);
|
ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1);
|
||||||
|
|
||||||
OrderLegacyBootOption4SameType (
|
Status = OrderLegacyBootOption4SameType (
|
||||||
DevOrder->Data,
|
DevOrder->Data,
|
||||||
DevOrder->Length / sizeof (UINT16) - 1,
|
DevOrder->Length / sizeof (UINT16) - 1,
|
||||||
&EnBootOption,
|
&EnBootOption,
|
||||||
|
@ -389,6 +397,9 @@ UpdateBBSOption (
|
||||||
&DisBootOption,
|
&DisBootOption,
|
||||||
&DisBootOptionCount
|
&DisBootOptionCount
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
goto Fail;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2. Deactivate the DisBootOption and activate the EnBootOption
|
// 2. Deactivate the DisBootOption and activate the EnBootOption
|
||||||
|
@ -446,6 +457,15 @@ UpdateBBSOption (
|
||||||
OriginalPtr
|
OriginalPtr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Fail:
|
||||||
|
if (EnBootOption != NULL) {
|
||||||
|
FreePool (EnBootOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DisBootOption != NULL) {
|
||||||
|
FreePool (DisBootOption);
|
||||||
|
}
|
||||||
|
|
||||||
FreePool (OriginalPtr);
|
FreePool (OriginalPtr);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue