]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/VariablePei/Variable.h
Update prototype of DxeLoadCore().
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / VariablePei / Variable.h
1 /** @file
2
3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 **/
13
14 #ifndef _PEI_VARIABLE_H
15 #define _PEI_VARIABLE_H
16
17 #include <PiPei.h>
18 #include <Ppi/ReadOnlyVariable.h>
19 #include <Ppi/ReadOnlyVariable2.h>
20 #include <Library/DebugLib.h>
21 #include <Library/PeimEntryPoint.h>
22 #include <Library/HobLib.h>
23 #include <Library/PcdLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/PeiServicesTablePointerLib.h>
26 #include <VariableFormat.h>
27
28 //
29 // Define GET_PAD_SIZE to optimize compiler
30 //
31 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
32 #define GET_PAD_SIZE(a) (0)
33 #else
34 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
35 #endif
36
37 #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
38
39 typedef struct {
40 VARIABLE_HEADER *CurrPtr;
41 VARIABLE_HEADER *EndPtr;
42 VARIABLE_HEADER *StartPtr;
43 } VARIABLE_POINTER_TRACK;
44
45 #define VARIABLE_INDEX_TABLE_VOLUME 122
46
47 #define EFI_VARIABLE_INDEX_TABLE_GUID \
48 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
49
50 typedef struct {
51 UINT16 Length;
52 UINT16 GoneThrough;
53 VARIABLE_HEADER *EndPtr;
54 VARIABLE_HEADER *StartPtr;
55 UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];
56 } VARIABLE_INDEX_TABLE;
57
58
59 //
60 // Functions
61 //
62 EFI_STATUS
63 EFIAPI
64 PeimInitializeVariableServices (
65 IN EFI_FFS_FILE_HEADER *FfsHeader,
66 IN EFI_PEI_SERVICES **PeiServices
67 )
68 ;
69
70 EFI_STATUS
71 EFIAPI
72 PeiGetVariable (
73 IN EFI_PEI_SERVICES **PeiServices,
74 IN CHAR16 *VariableName,
75 IN EFI_GUID * VendorGuid,
76 OUT UINT32 *Attributes OPTIONAL,
77 IN OUT UINTN *DataSize,
78 OUT VOID *Data
79 )
80 ;
81
82 EFI_STATUS
83 EFIAPI
84 PeiGetVariable2 (
85 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
86 IN CONST CHAR16 *VariableName,
87 IN CONST EFI_GUID *VariableGuid,
88 OUT UINT32 *Attributes,
89 IN OUT UINTN *DataSize,
90 OUT VOID *Data
91 )
92 ;
93
94 EFI_STATUS
95 EFIAPI
96 PeiGetNextVariableName2 (
97 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
98 IN OUT UINTN *VariableNameSize,
99 IN OUT CHAR16 *VariableName,
100 IN OUT EFI_GUID *VariableGuid
101 )
102 ;
103
104 EFI_STATUS
105 EFIAPI
106 PeiGetNextVariableName (
107 IN EFI_PEI_SERVICES **PeiServices,
108 IN OUT UINTN *VariableNameSize,
109 IN OUT CHAR16 *VariableName,
110 IN OUT EFI_GUID *VendorGuid
111 )
112 ;
113
114 /**
115 Get one variable by the index count.
116
117 @param IndexTable The pointer to variable index table.
118 @param Count The index count of variable in index table.
119
120 @return The pointer to variable header indexed by count.
121
122 **/
123 VARIABLE_HEADER *
124 GetVariableByIndex (
125 IN VARIABLE_INDEX_TABLE *IndexTable,
126 IN UINT32 Count
127 );
128
129 /**
130 Record Variable in VariableIndex HOB.
131
132 Record Variable in VariableIndex HOB and update the length of variable index table.
133
134 @param IndexTable The pointer to variable index table.
135 @param Variable The pointer to the variable that will be recorded.
136
137 @retval VOID
138
139 **/
140 VOID
141 VariableIndexTableUpdate (
142 IN OUT VARIABLE_INDEX_TABLE *IndexTable,
143 IN VARIABLE_HEADER *Variable
144 );
145
146 #endif // _PEI_VARIABLE_H