Remove package dependency of IntelFrameworkPkg
[mirror_edk2.git] / MdeModulePkg / Universal / VariablePei / Ipf / VariableWorker.c
CommitLineData
7ff7768d 1/** @file\r
2 Variable worker functions.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14//\r
15// The package level header files this module uses\r
16//\r
17#include <PiPei.h>\r
18\r
19//\r
20// The protocols, PPI and GUID defintions for this module\r
21//\r
22#include <Ppi/ReadOnlyVariable.h>\r
23//\r
24// The Library classes this module consumes\r
25//\r
26#include <Library/DebugLib.h>\r
27#include <Library/PeimEntryPoint.h>\r
28#include <Library/HobLib.h>\r
29#include <Library/PcdLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31\r
32#include <Variable.h>\r
33\r
34\r
35/**\r
36 Get one variable by the index count.\r
37\r
38 @param IndexTable The pointer to variable index table.\r
39 @param Count The index count of variable in index table.\r
40\r
41 @return The pointer to variable header indexed by count.\r
42\r
43**/\r
44VARIABLE_HEADER *\r
45GetVariableByIndex (\r
46 IN VARIABLE_INDEX_TABLE *IndexTable,\r
47 IN UINT32 Count\r
48 )\r
49{\r
50 return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );\r
51}\r
52\r
53/**\r
54 Record Variable in VariableIndex HOB.\r
55\r
56 Record Variable in VariableIndex HOB and update the length of variable index table.\r
57\r
58 @param IndexTable The pointer to variable index table.\r
59 @param Variable The pointer to the variable that will be recorded.\r
60\r
61 @retval VOID\r
62\r
63**/\r
64VOID\r
65VariableIndexTableUpdate (\r
66 IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
67 IN VARIABLE_HEADER *Variable\r
68 )\r
69{\r
70 IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);\r
71\r
72 return;\r
73}\r
74\r