]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/VariableAuthenticated/Pei/Variable.h
Vlv2TbltDevicePkg: Use the merged Variable driver
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / Pei / Variable.h
CommitLineData
0c18794e 1/** @file\r
2 The internal header file includes the common header files, defines\r
3 internal structure and functions used by PeiVariable module.\r
4\r
039a40aa 5Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
0c18794e 6This program and the accompanying materials \r
7are licensed and made available under the terms and conditions of the BSD License \r
8which accompanies this distribution. The full text of the license may be found at \r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _PEI_VARIABLE_H_\r
17#define _PEI_VARIABLE_H_\r
18\r
19#include <PiPei.h>\r
20#include <Ppi/ReadOnlyVariable2.h>\r
21\r
22#include <Library/DebugLib.h>\r
23#include <Library/PeimEntryPoint.h>\r
24#include <Library/HobLib.h>\r
25#include <Library/PcdLib.h>\r
26#include <Library/BaseMemoryLib.h>\r
27#include <Library/PeiServicesTablePointerLib.h>\r
28#include <Library/PeiServicesLib.h>\r
29\r
30#include <Guid/AuthenticatedVariableFormat.h>\r
31#include <Guid/VariableIndexTable.h>\r
4d832aab 32#include <Guid/SystemNvDataGuid.h>\r
039a40aa 33#include <Guid/FaultTolerantWrite.h>\r
9a000b46
RN
34\r
35typedef enum {\r
36 VariableStoreTypeHob,\r
37 VariableStoreTypeNv,\r
38 VariableStoreTypeMax\r
39} VARIABLE_STORE_TYPE;\r
40\r
039a40aa
SZ
41typedef struct {\r
42 VARIABLE_STORE_HEADER *VariableStoreHeader;\r
43 VARIABLE_INDEX_TABLE *IndexTable;\r
44 //\r
45 // If it is not NULL, it means there may be an inconsecutive variable whose\r
46 // partial content is still in NV storage, but another partial content is backed up\r
47 // in spare block.\r
48 //\r
49 FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData;\r
50} VARIABLE_STORE_INFO;\r
51\r
0c18794e 52//\r
53// Functions\r
54//\r
55/**\r
56 Provide the functionality of the variable services.\r
57 \r
58 @param FileHandle Handle of the file being invoked. \r
59 Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r
60 @param PeiServices General purpose services available to every PEIM.\r
61\r
62 @retval EFI_SUCCESS If the interface could be successfully installed\r
63 @retval Others Returned from PeiServicesInstallPpi()\r
64\r
65**/\r
66EFI_STATUS\r
67EFIAPI\r
68PeimInitializeVariableServices (\r
69 IN EFI_PEI_FILE_HANDLE FileHandle,\r
70 IN CONST EFI_PEI_SERVICES **PeiServices\r
71 );\r
72\r
73/**\r
74 This service retrieves a variable's value using its name and GUID.\r
75\r
76 Read the specified variable from the UEFI variable store. If the Data \r
77 buffer is too small to hold the contents of the variable, the error\r
78 EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer\r
79 size to obtain the data.\r
80\r
81 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
82 @param VariableName A pointer to a null-terminated string that is the variable's name.\r
83 @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of\r
84 VariableGuid and VariableName must be unique.\r
85 @param Attributes If non-NULL, on return, points to the variable's attributes.\r
86 @param DataSize On entry, points to the size in bytes of the Data buffer.\r
87 On return, points to the size of the data returned in Data.\r
88 @param Data Points to the buffer which will hold the returned variable value.\r
89\r
90 @retval EFI_SUCCESS The variable was read successfully.\r
91 @retval EFI_NOT_FOUND The variable could not be found.\r
92 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. \r
93 DataSize is updated with the size required for \r
94 the specified variable.\r
95 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r
96 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r
97\r
98**/\r
99EFI_STATUS\r
100EFIAPI\r
101PeiGetVariable (\r
102 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
103 IN CONST CHAR16 *VariableName,\r
104 IN CONST EFI_GUID *VariableGuid,\r
105 OUT UINT32 *Attributes,\r
106 IN OUT UINTN *DataSize,\r
107 OUT VOID *Data\r
108 );\r
109\r
110/**\r
111 Return the next variable name and GUID.\r
112\r
113 This function is called multiple times to retrieve the VariableName \r
114 and VariableGuid of all variables currently available in the system. \r
115 On each call, the previous results are passed into the interface, \r
116 and, on return, the interface returns the data for the next \r
117 interface. When the entire variable list has been returned, \r
118 EFI_NOT_FOUND is returned.\r
119\r
120 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
121\r
122 @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.\r
123 @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.\r
124 On return, points to the next variable's null-terminated name string.\r
125\r
126 @param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID. \r
127 On return, a pointer to the next variable's GUID.\r
128\r
129 @retval EFI_SUCCESS The variable was read successfully.\r
130 @retval EFI_NOT_FOUND The variable could not be found.\r
131 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting\r
132 data. VariableNameSize is updated with the size\r
133 required for the specified variable.\r
134 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or\r
135 VariableNameSize is NULL.\r
136 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r
137\r
138**/\r
139EFI_STATUS\r
140EFIAPI\r
141PeiGetNextVariableName (\r
142 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
143 IN OUT UINTN *VariableNameSize,\r
144 IN OUT CHAR16 *VariableName,\r
145 IN OUT EFI_GUID *VariableGuid\r
146 );\r
147\r
148#endif\r