1. Removed #ifdef SNP_DEBUG and used debug lib to output information
[mirror_edk2.git] / EdkModulePkg / Universal / Variable / Pei / Variable.h
CommitLineData
878ddf1f 1/*++\r
2\r
3aaddf92 3Copyright (c) 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
878ddf1f 11\r
12Module Name:\r
13\r
14 Variable.h\r
3aaddf92 15\r
878ddf1f 16Abstract:\r
17\r
18 Tiano PEIM to provide the variable functionality\r
19\r
20--*/\r
21\r
22#ifndef _PEI_VARIABLE_H\r
23#define _PEI_VARIABLE_H\r
24\r
25//\r
26// BugBug: We need relcate the head file.\r
3aaddf92 27//\r
878ddf1f 28#include <Common/Variable.h>\r
5094fb09 29#include <VarMachine.h>\r
878ddf1f 30\r
31//\r
32// Define GET_PAD_SIZE to optimize compiler\r
33//\r
34#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
35#define GET_PAD_SIZE(a) (0)\r
36#else\r
37#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
38#endif\r
39\r
40#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
41\r
42#define GET_VARIABLE_DATA_PTR(a) \\r
43 (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (a) + (a)->NameSize + GET_PAD_SIZE ((a)->NameSize))\r
44\r
45typedef struct {\r
46 VARIABLE_HEADER *CurrPtr;\r
47 VARIABLE_HEADER *EndPtr;\r
48 VARIABLE_HEADER *StartPtr;\r
49} VARIABLE_POINTER_TRACK;\r
50\r
51#define VARIABLE_INDEX_TABLE_VOLUME 122\r
52\r
53#define EFI_VARIABLE_INDEX_TABLE_GUID \\r
54 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }\r
55\r
56typedef struct {\r
57 UINT16 Length;\r
58 UINT16 GoneThrough;\r
59 VARIABLE_HEADER *EndPtr;\r
60 VARIABLE_HEADER *StartPtr;\r
61 UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];\r
62} VARIABLE_INDEX_TABLE;\r
63\r
64extern EFI_GUID gEfiVariableIndexTableGuid;\r
65\r
66//\r
67// Functions\r
68//\r
69EFI_STATUS\r
70EFIAPI\r
71PeimInitializeVariableServices (\r
72 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
73 IN EFI_PEI_SERVICES **PeiServices\r
74 )\r
75/*++\r
76\r
77Routine Description:\r
78\r
79 TODO: Add function description\r
80\r
81Arguments:\r
82\r
83 FfsHeader - TODO: add argument description\r
84 PeiServices - TODO: add argument description\r
85\r
86Returns:\r
87\r
88 TODO: add return values\r
89\r
90--*/\r
91;\r
92\r
93EFI_STATUS\r
94EFIAPI\r
95PeiGetVariable (\r
96 IN EFI_PEI_SERVICES **PeiServices,\r
97 IN CHAR16 *VariableName,\r
98 IN EFI_GUID * VendorGuid,\r
99 OUT UINT32 *Attributes OPTIONAL,\r
100 IN OUT UINTN *DataSize,\r
101 OUT VOID *Data\r
102 )\r
103/*++\r
104\r
105Routine Description:\r
106\r
107 TODO: Add function description\r
108\r
109Arguments:\r
110\r
111 PeiServices - TODO: add argument description\r
112 VariableName - TODO: add argument description\r
113 VendorGuid - TODO: add argument description\r
114 Attributes - TODO: add argument description\r
115 DataSize - TODO: add argument description\r
116 Data - TODO: add argument description\r
117\r
118Returns:\r
119\r
120 TODO: add return values\r
121\r
122--*/\r
123;\r
124\r
125EFI_STATUS\r
126EFIAPI\r
127PeiGetNextVariableName (\r
128 IN EFI_PEI_SERVICES **PeiServices,\r
129 IN OUT UINTN *VariableNameSize,\r
130 IN OUT CHAR16 *VariableName,\r
131 IN OUT EFI_GUID *VendorGuid\r
132 )\r
133/*++\r
134\r
135Routine Description:\r
136\r
137 TODO: Add function description\r
138\r
139Arguments:\r
140\r
141 PeiServices - TODO: add argument description\r
142 VariableNameSize - TODO: add argument description\r
143 VariableName - TODO: add argument description\r
144 VendorGuid - TODO: add argument description\r
145\r
146Returns:\r
147\r
148 TODO: add return values\r
149\r
150--*/\r
151;\r
152\r
3aaddf92 153VARIABLE_HEADER *\r
154GetVariableByIndex (\r
155 IN VARIABLE_INDEX_TABLE *IndexTable,\r
156 IN UINT32 Count\r
157 );\r
158\r
159VOID\r
160VariableIndexTableUpdate (\r
161 IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
162 IN VARIABLE_HEADER *Variable\r
163 );\r
164\r
878ddf1f 165#endif // _PEI_VARIABLE_H\r