]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/VariablePei/Ipf/VariableWorker.c
Add VariablePei into IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / VariablePei / Ipf / VariableWorker.c
CommitLineData
7ba905c9 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#include <Variable.h>\r
16\r
17\r
18/**\r
19 Get one variable by the index count.\r
20\r
21 @param IndexTable The pointer to variable index table.\r
22 @param Count The index count of variable in index table.\r
23\r
24 @return The pointer to variable header indexed by count.\r
25\r
26**/\r
27VARIABLE_HEADER *\r
28GetVariableByIndex (\r
29 IN VARIABLE_INDEX_TABLE *IndexTable,\r
30 IN UINT32 Count\r
31 )\r
32{\r
33 return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );\r
34}\r
35\r
36/**\r
37 Record Variable in VariableIndex HOB.\r
38\r
39 Record Variable in VariableIndex HOB and update the length of variable index table.\r
40\r
41 @param IndexTable The pointer to variable index table.\r
42 @param Variable The pointer to the variable that will be recorded.\r
43\r
44 @retval VOID\r
45\r
46**/\r
47VOID\r
48VariableIndexTableUpdate (\r
49 IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
50 IN VARIABLE_HEADER *Variable\r
51 )\r
52{\r
53 IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);\r
54\r
55 return;\r
56}\r
57\r