Remove unnecessary use of FixedPcdxxx() functions and [FixedPcd] INF sections. These should only be used for PCDs that are used to pre-init global variables, pre-init global structures, or size arrays.
Do some minor clean ups to INF files git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9868 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Implement all four UEFI Runtime Variable services for the nonvolatile
|
||||
and volatile storage space and install variable architecture protocol.
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
Copyright (c) 2006 - 2010, 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
|
||||
@@ -1475,7 +1475,7 @@ UpdateVariable (
|
||||
// as a temporary storage.
|
||||
//
|
||||
NextVariable = GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.VolatileVariableBase));
|
||||
ScratchSize = MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize));
|
||||
ScratchSize = MAX (PcdGet32 (PcdMaxVariableSize), PcdGet32 (PcdMaxHardwareErrorVariableSize));
|
||||
|
||||
SetMem (NextVariable, ScratchSize, 0xff);
|
||||
|
||||
@@ -1519,9 +1519,9 @@ UpdateVariable (
|
||||
Volatile = FALSE;
|
||||
NonVolatileVarableStoreSize = ((VARIABLE_STORE_HEADER *)(UINTN)(mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase))->Size;
|
||||
if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
|
||||
&& ((VarSize + mVariableModuleGlobal->HwErrVariableTotalSize) > FixedPcdGet32(PcdHwErrStorageSize)))
|
||||
&& ((VarSize + mVariableModuleGlobal->HwErrVariableTotalSize) > PcdGet32 (PcdHwErrStorageSize)))
|
||||
|| (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
|
||||
&& ((VarSize + mVariableModuleGlobal->CommonVariableTotalSize) > NonVolatileVarableStoreSize - sizeof (VARIABLE_STORE_HEADER) - FixedPcdGet32(PcdHwErrStorageSize)))) {
|
||||
&& ((VarSize + mVariableModuleGlobal->CommonVariableTotalSize) > NonVolatileVarableStoreSize - sizeof (VARIABLE_STORE_HEADER) - PcdGet32 (PcdHwErrStorageSize)))) {
|
||||
if (EfiAtRuntime ()) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
@@ -1538,9 +1538,9 @@ UpdateVariable (
|
||||
// If still no enough space, return out of resources
|
||||
//
|
||||
if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
|
||||
&& ((VarSize + mVariableModuleGlobal->HwErrVariableTotalSize) > FixedPcdGet32(PcdHwErrStorageSize)))
|
||||
&& ((VarSize + mVariableModuleGlobal->HwErrVariableTotalSize) > PcdGet32 (PcdHwErrStorageSize)))
|
||||
|| (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
|
||||
&& ((VarSize + mVariableModuleGlobal->CommonVariableTotalSize) > NonVolatileVarableStoreSize - sizeof (VARIABLE_STORE_HEADER) - FixedPcdGet32(PcdHwErrStorageSize)))) {
|
||||
&& ((VarSize + mVariableModuleGlobal->CommonVariableTotalSize) > NonVolatileVarableStoreSize - sizeof (VARIABLE_STORE_HEADER) - PcdGet32 (PcdHwErrStorageSize)))) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
@@ -1943,12 +1943,12 @@ RuntimeServiceSetVariable (
|
||||
|
||||
//
|
||||
// The size of the VariableName, including the Unicode Null in bytes plus
|
||||
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
|
||||
// bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.
|
||||
// the DataSize is limited to maximum size of PcdGet32 (PcdMaxHardwareErrorVariableSize)
|
||||
// bytes for HwErrRec, and PcdGet32 (PcdMaxVariableSize) bytes for the others.
|
||||
//
|
||||
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
|
||||
if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {
|
||||
if ((DataSize > PcdGet32 (PcdMaxHardwareErrorVariableSize)) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > PcdGet32 (PcdMaxHardwareErrorVariableSize))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
@@ -1960,10 +1960,10 @@ RuntimeServiceSetVariable (
|
||||
} else {
|
||||
//
|
||||
// The size of the VariableName, including the Unicode Null in bytes plus
|
||||
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxVariableSize) bytes.
|
||||
// the DataSize is limited to maximum size of PcdGet32 (PcdMaxVariableSize) bytes.
|
||||
//
|
||||
if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {
|
||||
if ((DataSize > PcdGet32 (PcdMaxVariableSize)) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > PcdGet32 (PcdMaxVariableSize))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@@ -2091,18 +2091,18 @@ RuntimeServiceQueryVariableInfo (
|
||||
// Harware error record variable needs larger size.
|
||||
//
|
||||
if ((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) {
|
||||
*MaximumVariableStorageSize = FixedPcdGet32(PcdHwErrStorageSize);
|
||||
*MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);
|
||||
*MaximumVariableStorageSize = PcdGet32 (PcdHwErrStorageSize);
|
||||
*MaximumVariableSize = PcdGet32 (PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);
|
||||
} else {
|
||||
if ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0) {
|
||||
ASSERT (FixedPcdGet32(PcdHwErrStorageSize) < VariableStoreHeader->Size);
|
||||
*MaximumVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER) - FixedPcdGet32(PcdHwErrStorageSize);
|
||||
ASSERT (PcdGet32 (PcdHwErrStorageSize) < VariableStoreHeader->Size);
|
||||
*MaximumVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32 (PcdHwErrStorageSize);
|
||||
}
|
||||
|
||||
//
|
||||
// Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.
|
||||
// Let *MaximumVariableSize be PcdGet32 (PcdMaxVariableSize) with the exception of the variable header size.
|
||||
//
|
||||
*MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);
|
||||
*MaximumVariableSize = PcdGet32 (PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2259,19 +2259,19 @@ VariableCommonInitialize (
|
||||
// ensure that the value of PcdHwErrStorageSize is less than or equal to the value of
|
||||
// PcdFlashNvStorageVariableSize.
|
||||
//
|
||||
ASSERT (FixedPcdGet32(PcdHwErrStorageSize) <= FixedPcdGet32(PcdFlashNvStorageVariableSize));
|
||||
ASSERT (PcdGet32 (PcdHwErrStorageSize) <= PcdGet32 (PcdFlashNvStorageVariableSize));
|
||||
|
||||
//
|
||||
// Allocate memory for volatile variable store, note that there is a scratch space to store scratch data.
|
||||
//
|
||||
ScratchSize = MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize));
|
||||
VolatileVariableStore = AllocateRuntimePool (FixedPcdGet32(PcdVariableStoreSize) + ScratchSize);
|
||||
ScratchSize = MAX (PcdGet32 (PcdMaxVariableSize), PcdGet32 (PcdMaxHardwareErrorVariableSize));
|
||||
VolatileVariableStore = AllocateRuntimePool (PcdGet32 (PcdVariableStoreSize) + ScratchSize);
|
||||
if (VolatileVariableStore == NULL) {
|
||||
FreePool (mVariableModuleGlobal);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
SetMem (VolatileVariableStore, FixedPcdGet32(PcdVariableStoreSize) + ScratchSize, 0xff);
|
||||
SetMem (VolatileVariableStore, PcdGet32 (PcdVariableStoreSize) + ScratchSize, 0xff);
|
||||
|
||||
//
|
||||
// Variable Specific Data
|
||||
@@ -2281,7 +2281,7 @@ VariableCommonInitialize (
|
||||
mVariableModuleGlobal->FvbInstance = FvbProtocol;
|
||||
|
||||
CopyGuid (&VolatileVariableStore->Signature, &gEfiVariableGuid);
|
||||
VolatileVariableStore->Size = FixedPcdGet32(PcdVariableStoreSize);
|
||||
VolatileVariableStore->Size = PcdGet32 (PcdVariableStoreSize);
|
||||
VolatileVariableStore->Format = VARIABLE_STORE_FORMATTED;
|
||||
VolatileVariableStore->State = VARIABLE_STORE_HEALTHY;
|
||||
VolatileVariableStore->Reserved = 0;
|
||||
|
Reference in New Issue
Block a user