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