]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c
Move VariablePei/VariableDxe/EmuVarible to /Variable folder of MdeModulePkg.
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Pei / Ipf / VariableWorker.c
1 /** @file
2 Variable worker functions.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <Variable.h>
16
17
18 /**
19 Get one variable by the index count.
20
21 @param IndexTable The pointer to variable index table.
22 @param Count The index count of variable in index table.
23
24 @return The pointer to variable header indexed by count.
25
26 **/
27 VARIABLE_HEADER *
28 GetVariableByIndex (
29 IN VARIABLE_INDEX_TABLE *IndexTable,
30 IN UINT32 Count
31 )
32 {
33 return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );
34 }
35
36 /**
37 Record Variable in VariableIndex HOB.
38
39 Record Variable in VariableIndex HOB and update the length of variable index table.
40
41 @param IndexTable The pointer to variable index table.
42 @param Variable The pointer to the variable that will be recorded.
43
44 @retval VOID
45
46 **/
47 VOID
48 VariableIndexTableUpdate (
49 IN OUT VARIABLE_INDEX_TABLE *IndexTable,
50 IN VARIABLE_HEADER *Variable
51 )
52 {
53 IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
54
55 return;
56 }
57