1. Perfect libraries MSA files
2. Use MemoryAllocationLib to replace gBS memory services in EdkEt32Pkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2517 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
@@ -31,7 +31,7 @@ BdsLibGetTimeout (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Return the default value for system Timeout variable.
|
||||
|
||||
Arguments:
|
||||
@@ -39,7 +39,7 @@ Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
Timeout value.
|
||||
|
||||
--*/
|
||||
@@ -85,7 +85,7 @@ BdsLibLoadDrivers (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
The function will go through the driver optoin link list, load and start
|
||||
every driver the driver optoin device path point to.
|
||||
|
||||
@@ -94,7 +94,7 @@ Arguments:
|
||||
BdsDriverLists - The header of the current driver option link list
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
@@ -198,7 +198,7 @@ BdsLibRegisterNewOption (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
This function will register the new boot#### or driver#### option base on
|
||||
the VariableName. The new registered boot#### or driver#### will be linked
|
||||
to BdsOptionList and also update to the VariableName. After the boot#### or
|
||||
@@ -207,18 +207,18 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
BdsOptionList - The header of the boot#### or driver#### link list
|
||||
|
||||
|
||||
DevicePath - The device path which the boot####
|
||||
or driver#### option present
|
||||
|
||||
|
||||
String - The description of the boot#### or driver####
|
||||
|
||||
|
||||
VariableName - Indicate if the boot#### or driver#### option
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
EFI_SUCCESS - The boot#### or driver#### have been success registered
|
||||
|
||||
|
||||
EFI_STATUS - Return the status of gRT->SetVariable ().
|
||||
|
||||
--*/
|
||||
@@ -249,11 +249,13 @@ Returns:
|
||||
ZeroMem (OptionName, sizeof (OptionName));
|
||||
|
||||
TempOptionSize = 0;
|
||||
|
||||
TempOptionPtr = BdsLibGetVariableAndSize (
|
||||
VariableName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&TempOptionSize
|
||||
);
|
||||
|
||||
//
|
||||
// Compare with current option variable
|
||||
//
|
||||
@@ -290,8 +292,8 @@ Returns:
|
||||
//
|
||||
// Got the option, so just return
|
||||
//
|
||||
gBS->FreePool (OptionPtr);
|
||||
gBS->FreePool (TempOptionPtr);
|
||||
FreePool (OptionPtr);
|
||||
FreePool (TempOptionPtr);
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
//
|
||||
@@ -302,7 +304,7 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (OptionPtr);
|
||||
FreePool (OptionPtr);
|
||||
}
|
||||
|
||||
OptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (String) + GetDevicePathSize (DevicePath);
|
||||
@@ -342,12 +344,12 @@ Returns:
|
||||
OptionPtr
|
||||
);
|
||||
if (EFI_ERROR (Status) || UpdateBootDevicePath) {
|
||||
gBS->FreePool (OptionPtr);
|
||||
gBS->FreePool (TempOptionPtr);
|
||||
FreePool (OptionPtr);
|
||||
FreePool (TempOptionPtr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->FreePool (OptionPtr);
|
||||
FreePool (OptionPtr);
|
||||
|
||||
//
|
||||
// Update the option order variable
|
||||
@@ -363,13 +365,15 @@ Returns:
|
||||
OptionOrderPtr
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (TempOptionPtr);
|
||||
gBS->FreePool (OptionOrderPtr);
|
||||
FreePool (TempOptionPtr);
|
||||
FreePool (OptionOrderPtr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->FreePool (TempOptionPtr);
|
||||
gBS->FreePool (OptionOrderPtr);
|
||||
if (TempOptionPtr != NULL) {
|
||||
FreePool (TempOptionPtr);
|
||||
}
|
||||
FreePool (OptionOrderPtr);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -383,9 +387,9 @@ BdsLibVariableToOption (
|
||||
|
||||
Routine Description:
|
||||
|
||||
Build the boot#### or driver#### option from the VariableName, the
|
||||
Build the boot#### or driver#### option from the VariableName, the
|
||||
build boot#### or driver#### will also be linked to BdsCommonOptionList
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
BdsCommonOptionList - The header of the boot#### or driver#### option link list
|
||||
@@ -482,12 +486,12 @@ Returns:
|
||||
//
|
||||
if ((Option->Attribute & LOAD_OPTION_ACTIVE) == LOAD_OPTION_ACTIVE) {
|
||||
InsertTailList (BdsCommonOptionList, &Option->Link);
|
||||
gBS->FreePool (Variable);
|
||||
FreePool (Variable);
|
||||
return Option;
|
||||
}
|
||||
|
||||
gBS->FreePool (Variable);
|
||||
gBS->FreePool (Option);
|
||||
FreePool (Variable);
|
||||
FreePool (Option);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
@@ -553,7 +557,7 @@ Returns:
|
||||
|
||||
}
|
||||
|
||||
gBS->FreePool (OptionOrder);
|
||||
FreePool (OptionOrder);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -631,7 +635,7 @@ Routine Description:
|
||||
Free pool safely.
|
||||
|
||||
Arguments:
|
||||
|
||||
|
||||
Buffer - The allocated pool entry to free
|
||||
|
||||
Returns:
|
||||
@@ -641,7 +645,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
if (Buffer != NULL) {
|
||||
gBS->FreePool (Buffer);
|
||||
FreePool (Buffer);
|
||||
Buffer = NULL;
|
||||
}
|
||||
}
|
||||
@@ -665,7 +669,7 @@ Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
This function will remove the device path instances in Multi which partly
|
||||
This function will remove the device path instances in Multi which partly
|
||||
match with the Single, and return the result device path. If there is no
|
||||
remaining device path as a result, this function will return NULL.
|
||||
|
||||
@@ -675,24 +679,24 @@ Returns:
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
|
||||
UINTN InstanceSize;
|
||||
UINTN SingleDpSize;
|
||||
UINTN Size;
|
||||
|
||||
UINTN SingleDpSize;
|
||||
UINTN Size;
|
||||
|
||||
NewDevicePath = NULL;
|
||||
TempNewDevicePath = NULL;
|
||||
|
||||
if (Multi == NULL || Single == NULL) {
|
||||
return Multi;
|
||||
}
|
||||
|
||||
|
||||
Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);
|
||||
SingleDpSize = GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;
|
||||
InstanceSize -= END_DEVICE_PATH_LENGTH;
|
||||
|
||||
while (Instance != NULL) {
|
||||
|
||||
Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;
|
||||
|
||||
Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;
|
||||
|
||||
if ((CompareMem (Instance, Single, Size) != 0)) {
|
||||
//
|
||||
// Append the device path instance which does not match with Single
|
||||
@@ -705,7 +709,7 @@ Returns:
|
||||
Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);
|
||||
InstanceSize -= END_DEVICE_PATH_LENGTH;
|
||||
}
|
||||
|
||||
|
||||
return NewDevicePath;
|
||||
}
|
||||
|
||||
@@ -730,9 +734,9 @@ Arguments:
|
||||
Returns:
|
||||
|
||||
TRUE - If the Single is contained within Multi
|
||||
|
||||
|
||||
FALSE - The Single is not match within Multi
|
||||
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
@@ -756,11 +760,11 @@ Returns:
|
||||
// return success
|
||||
//
|
||||
if (CompareMem (Single, DevicePathInst, Size) == 0) {
|
||||
gBS->FreePool (DevicePathInst);
|
||||
FreePool (DevicePathInst);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gBS->FreePool (DevicePathInst);
|
||||
FreePool (DevicePathInst);
|
||||
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||
}
|
||||
|
||||
@@ -788,7 +792,7 @@ Arguments:
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Success print out the string using ConOut.
|
||||
|
||||
|
||||
EFI_STATUS - Return the status of the ConOut->OutputString ().
|
||||
|
||||
--*/
|
||||
@@ -821,7 +825,7 @@ Returns:
|
||||
|
||||
//
|
||||
// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
|
||||
// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
|
||||
// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
|
||||
// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
|
||||
//
|
||||
|
||||
@@ -832,7 +836,7 @@ EnableResetReminderFeature (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Enable the setup browser reset reminder feature.
|
||||
This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.
|
||||
|
||||
@@ -847,7 +851,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
mFeaturerSwitch = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
DisableResetReminderFeature (
|
||||
@@ -856,10 +860,10 @@ DisableResetReminderFeature (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Disable the setup browser reset reminder feature.
|
||||
This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
VOID
|
||||
@@ -871,7 +875,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
mFeaturerSwitch = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
EnableResetRequired (
|
||||
@@ -880,10 +884,10 @@ EnableResetRequired (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Record the info that a reset is required.
|
||||
A module boolean variable is used to record whether a reset is required.
|
||||
|
||||
A module boolean variable is used to record whether a reset is required.
|
||||
|
||||
Arguments:
|
||||
|
||||
VOID
|
||||
@@ -895,7 +899,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
mResetRequired = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
DisableResetRequired (
|
||||
@@ -906,7 +910,7 @@ DisableResetRequired (
|
||||
Routine Description:
|
||||
|
||||
Record the info that no reset is required.
|
||||
A module boolean variable is used to record whether a reset is required.
|
||||
A module boolean variable is used to record whether a reset is required.
|
||||
|
||||
Arguments:
|
||||
|
||||
@@ -919,7 +923,7 @@ Returns:
|
||||
--*/
|
||||
{
|
||||
mResetRequired = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsResetReminderFeatureEnable (
|
||||
@@ -928,7 +932,7 @@ IsResetReminderFeatureEnable (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Check whether platform policy enable the reset reminder feature. The default is enabled.
|
||||
|
||||
Arguments:
|
||||
@@ -951,9 +955,9 @@ IsResetRequired (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Check if user changed any option setting which needs a system reset to be effective.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
VOID
|
||||
@@ -974,9 +978,9 @@ SetupResetReminder (
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Check whether a reset is needed, and finish the reset reminder feature.
|
||||
If a reset is needed, Popup a menu to notice user, and finish the feature
|
||||
If a reset is needed, Popup a menu to notice user, and finish the feature
|
||||
according to the user selection.
|
||||
|
||||
Arguments:
|
||||
@@ -991,9 +995,9 @@ Returns:
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FORM_BROWSER_PROTOCOL *Browser;
|
||||
EFI_INPUT_KEY Key;
|
||||
EFI_INPUT_KEY Key;
|
||||
CHAR16 *StringBuffer1;
|
||||
CHAR16 *StringBuffer2;
|
||||
CHAR16 *StringBuffer2;
|
||||
|
||||
|
||||
//
|
||||
@@ -1001,28 +1005,28 @@ Returns:
|
||||
//
|
||||
if (IsResetReminderFeatureEnable ()) {
|
||||
if (IsResetRequired ()) {
|
||||
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiFormBrowserProtocolGuid,
|
||||
NULL,
|
||||
&Browser
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
|
||||
ASSERT (StringBuffer1 != NULL);
|
||||
StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
|
||||
ASSERT (StringBuffer2 != NULL);
|
||||
ASSERT (StringBuffer2 != NULL);
|
||||
StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");
|
||||
StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)");
|
||||
StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)");
|
||||
//
|
||||
// Popup a menu to notice user
|
||||
//
|
||||
//
|
||||
do {
|
||||
Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);
|
||||
} while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
|
||||
|
||||
gBS->FreePool (StringBuffer1);
|
||||
gBS->FreePool (StringBuffer2);
|
||||
} while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
|
||||
|
||||
FreePool (StringBuffer1);
|
||||
FreePool (StringBuffer2);
|
||||
//
|
||||
// If the user hits the YES Response key, reset
|
||||
//
|
||||
@@ -1030,9 +1034,9 @@ Returns:
|
||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||
}
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
BdsLibGetHiiHandles (
|
||||
@@ -1050,7 +1054,7 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
This - A pointer to the EFI_HII_PROTOCOL instance.
|
||||
HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
|
||||
HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
|
||||
the length of the handle buffer that is required for the handles found.
|
||||
HiiHandleBuffer - Pointer to an array of EFI_HII_PROTOCOL instances returned.
|
||||
|
||||
@@ -1059,19 +1063,19 @@ Returns:
|
||||
EFI_SUCCESS - Get an array of EFI_HII_PROTOCOL instances successfully.
|
||||
EFI_INVALID_PARAMETER - Hii is NULL.
|
||||
EFI_NOT_FOUND - Database not found.
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT16 TempBufferLength;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
TempBufferLength = 0;
|
||||
|
||||
|
||||
//
|
||||
// Try to find the actual buffer size for HiiHandle Buffer.
|
||||
//
|
||||
Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);
|
||||
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
*HiiHandleBuffer = AllocateZeroPool (TempBufferLength);
|
||||
Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);
|
||||
@@ -1080,9 +1084,9 @@ Returns:
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
||||
*HandleBufferLength = TempBufferLength;
|
||||
|
||||
|
||||
return Status;
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user