]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/Pei/VariableWorker.c
Code Scrub:
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Pei / VariableWorker.c
1 /** @file
2
3 Variable worker functions specific for IA32, X64 and EBC.
4
5 Copyright (c) 2007 - 2008, Intel Corporation
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 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) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));
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 **/
45 VOID
46 VariableIndexTableUpdate (
47 IN OUT VARIABLE_INDEX_TABLE *IndexTable,
48 IN VARIABLE_HEADER *Variable
49 )
50 {
51 IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
52
53 return;
54 }
55