diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-09 06:31:30 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-09 06:31:30 +0000 |
commit | 8e3fdb95fa09752ba95b336d2a0ecd2a6d927843 (patch) | |
tree | ab1203c71fa27fc8ad2a51bf2b847363c04837cf | |
parent | 72d50eec450f6101fdd2593b875b55712776df7c (diff) | |
download | edk2-8e3fdb95fa09752ba95b336d2a0ecd2a6d927843.zip edk2-8e3fdb95fa09752ba95b336d2a0ecd2a6d927843.tar.gz edk2-8e3fdb95fa09752ba95b336d2a0ecd2a6d927843.tar.bz2 |
Move Varialbe common definitions (GET_PAD_SIZE and HEADER_ALIGN macro) into MdeModulePackage Include VariableFormat.h
And Use PCD to replace macros in source code to reduce confusion.(FixedPcdGet32(PcdMaxVariableSize) replaces MAX_VARIABLE_SIZE, and FixedPcdGet32(PcdMaxHardwareErrorVariableSize) replaces MAX_HARDWARE_ERROR_VARIABLE_SIZE.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7230 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | DuetPkg/FSVariable/FSVariable.c | 20 | ||||
-rw-r--r-- | DuetPkg/FSVariable/FSVariable.h | 9 |
2 files changed, 10 insertions, 19 deletions
diff --git a/DuetPkg/FSVariable/FSVariable.c b/DuetPkg/FSVariable/FSVariable.c index 3a5fcc4..18b93c0 100644 --- a/DuetPkg/FSVariable/FSVariable.c +++ b/DuetPkg/FSVariable/FSVariable.c @@ -70,7 +70,7 @@ Returns: {
if (Variable == NULL ||
Variable->StartId != VARIABLE_DATA ||
- (sizeof (VARIABLE_HEADER) + Variable->NameSize + Variable->DataSize) > MAX_VARIABLE_SIZE
+ (sizeof (VARIABLE_HEADER) + Variable->NameSize + Variable->DataSize) > FixedPcdGet32(PcdMaxVariableSize)
) {
return FALSE;
}
@@ -734,17 +734,17 @@ Returns: //
// 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 {
- 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;
}
}
@@ -1035,15 +1035,15 @@ Returns: *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);
}
//
diff --git a/DuetPkg/FSVariable/FSVariable.h b/DuetPkg/FSVariable/FSVariable.h index c046fe9..9fdd0a7 100644 --- a/DuetPkg/FSVariable/FSVariable.h +++ b/DuetPkg/FSVariable/FSVariable.h @@ -53,15 +53,6 @@ Abstract: #define VARIABLE_SCRATCH_SIZE (4 * 1024)
#define VARIABLE_RECLAIM_THRESHOLD (1024)
-//
-// 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 {
|