refine VariablePei driver to unify the algorithm of access VariableIndexTable among various archs.

1. record the distance of two neighboring VAR_ADDED type variables rather than the offset of each variable. As the field recording this info is UINT16 width, the latter causes in IA32/X64 platform, it can only cache those variables from offset 0 to offset 2^16; in IPF platform, from offset 0 to offset 2^18(extend the scope by left-shift the offset two bits).
when taking the former algorithm, the max range of caching variable is from offset 0 to offset 122*(2^16)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8625 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian
2009-06-23 08:30:04 +00:00
parent 48a9ea7b1b
commit 841014ba97
5 changed files with 45 additions and 163 deletions

View File

@@ -41,11 +41,18 @@ typedef struct {
#define EFI_VARIABLE_INDEX_TABLE_GUID \
{ 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
///
/// Use this data structure to store variable-related info, which can decrease
/// the cost of access to NV.
///
typedef struct {
UINT16 Length;
UINT16 GoneThrough;
VARIABLE_HEADER *EndPtr;
VARIABLE_HEADER *StartPtr;
///
/// This field is used to store the distance of two neighbouring VAR_ADDED type variables.
/// The meaning of the field is implement-dependent.
UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];
} VARIABLE_INDEX_TABLE;
@@ -146,34 +153,4 @@ PeiGetNextVariableName (
IN OUT EFI_GUID *VariableGuid
);
/**
Get one variable by the index count.
@param IndexTable The pointer to variable index table.
@param Count The index count of variable in index table.
@return The pointer to variable header indexed by count.
**/
VARIABLE_HEADER *
GetVariableByIndex (
IN VARIABLE_INDEX_TABLE *IndexTable,
IN UINT32 Count
);
/**
Record Variable in VariableIndex HOB.
Record Variable in VariableIndex HOB and update the length of variable index table.
@param IndexTable The pointer to variable index table.
@param Variable The pointer to the variable that will be recorded.
**/
VOID
VariableIndexTableUpdate (
IN OUT VARIABLE_INDEX_TABLE *IndexTable,
IN VARIABLE_HEADER *Variable
);
#endif