Add INF extension Information
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7228 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -118,7 +118,7 @@ GetNextVariablePtr (
|
||||
VarHeader = (VARIABLE_HEADER *) (GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
|
||||
|
||||
if (VarHeader->StartId != VARIABLE_DATA ||
|
||||
(sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > MAX_VARIABLE_SIZE
|
||||
(sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > FixedPcdGet32(PcdMaxVariableSize)
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
@ -485,21 +485,21 @@ SetVariable (
|
||||
}
|
||||
//
|
||||
// The size of the VariableName, including the Unicode Null in bytes plus
|
||||
// the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K)
|
||||
// bytes for HwErrRec, and MAX_VARIABLE_SIZE (1024) bytes for the others.
|
||||
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
|
||||
// bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.
|
||||
//
|
||||
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
|
||||
if ((DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE)) {
|
||||
if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// The size of the VariableName, including the Unicode Null in bytes plus
|
||||
// the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
|
||||
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxVariableSize) bytes.
|
||||
//
|
||||
if ((DataSize > MAX_VARIABLE_SIZE) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {
|
||||
if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||
|
||||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@ -740,15 +740,15 @@ QueryVariableInfo (
|
||||
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
|
||||
|
||||
//
|
||||
// Let *MaximumVariableSize be MAX_VARIABLE_SIZE with the exception of the variable header size.
|
||||
// Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.
|
||||
//
|
||||
*MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);
|
||||
*MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);
|
||||
|
||||
//
|
||||
// Harware error record variable needs larger size.
|
||||
//
|
||||
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
|
||||
*MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);
|
||||
*MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -808,13 +808,13 @@ InitializeVariableStore (
|
||||
// Allocate memory for volatile variable store
|
||||
//
|
||||
VariableStore = (VARIABLE_STORE_HEADER *) AllocateRuntimePool (
|
||||
VARIABLE_STORE_SIZE
|
||||
FixedPcdGet32(PcdVariableStoreSize)
|
||||
);
|
||||
if (NULL == VariableStore) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
SetMem (VariableStore, VARIABLE_STORE_SIZE, 0xff);
|
||||
SetMem (VariableStore, FixedPcdGet32(PcdVariableStoreSize), 0xff);
|
||||
|
||||
//
|
||||
// Variable Specific Data
|
||||
@ -823,7 +823,7 @@ InitializeVariableStore (
|
||||
*LastVariableOffset = sizeof (VARIABLE_STORE_HEADER);
|
||||
|
||||
VariableStore->Signature = VARIABLE_STORE_SIGNATURE;
|
||||
VariableStore->Size = VARIABLE_STORE_SIZE;
|
||||
VariableStore->Size = FixedPcdGet32(PcdVariableStoreSize);
|
||||
VariableStore->Format = VARIABLE_STORE_FORMATTED;
|
||||
VariableStore->State = VARIABLE_STORE_HEALTHY;
|
||||
VariableStore->Reserved = 0;
|
||||
|
@ -33,18 +33,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Library/PcdLib.h>
|
||||
#include <VariableFormat.h>
|
||||
|
||||
#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
|
||||
#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)
|
||||
|
||||
//
|
||||
// Define GET_PAD_SIZE to optimize compiler
|
||||
//
|
||||
#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
|
||||
#define GET_PAD_SIZE(a) (0)
|
||||
#else
|
||||
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
|
||||
#endif
|
||||
|
||||
#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
|
||||
|
||||
typedef enum {
|
||||
|
Reference in New Issue
Block a user