]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/VariableAuthenticated/Pei/Variable.h
Change IPF version AuthVariable driver to support multiple-platform feature.
[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
5Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
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
9a000b46
RN
32\r
33typedef enum {\r
34 VariableStoreTypeHob,\r
35 VariableStoreTypeNv,\r
36 VariableStoreTypeMax\r
37} VARIABLE_STORE_TYPE;\r
38\r
0c18794e 39//\r
40// Functions\r
41//\r
42/**\r
43 Provide the functionality of the variable services.\r
44 \r
45 @param FileHandle Handle of the file being invoked. \r
46 Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r
47 @param PeiServices General purpose services available to every PEIM.\r
48\r
49 @retval EFI_SUCCESS If the interface could be successfully installed\r
50 @retval Others Returned from PeiServicesInstallPpi()\r
51\r
52**/\r
53EFI_STATUS\r
54EFIAPI\r
55PeimInitializeVariableServices (\r
56 IN EFI_PEI_FILE_HANDLE FileHandle,\r
57 IN CONST EFI_PEI_SERVICES **PeiServices\r
58 );\r
59\r
60/**\r
61 This service retrieves a variable's value using its name and GUID.\r
62\r
63 Read the specified variable from the UEFI variable store. If the Data \r
64 buffer is too small to hold the contents of the variable, the error\r
65 EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer\r
66 size to obtain the data.\r
67\r
68 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
69 @param VariableName A pointer to a null-terminated string that is the variable's name.\r
70 @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of\r
71 VariableGuid and VariableName must be unique.\r
72 @param Attributes If non-NULL, on return, points to the variable's attributes.\r
73 @param DataSize On entry, points to the size in bytes of the Data buffer.\r
74 On return, points to the size of the data returned in Data.\r
75 @param Data Points to the buffer which will hold the returned variable value.\r
76\r
77 @retval EFI_SUCCESS The variable was read successfully.\r
78 @retval EFI_NOT_FOUND The variable could not be found.\r
79 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data. \r
80 DataSize is updated with the size required for \r
81 the specified variable.\r
82 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r
83 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r
84\r
85**/\r
86EFI_STATUS\r
87EFIAPI\r
88PeiGetVariable (\r
89 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
90 IN CONST CHAR16 *VariableName,\r
91 IN CONST EFI_GUID *VariableGuid,\r
92 OUT UINT32 *Attributes,\r
93 IN OUT UINTN *DataSize,\r
94 OUT VOID *Data\r
95 );\r
96\r
97/**\r
98 Return the next variable name and GUID.\r
99\r
100 This function is called multiple times to retrieve the VariableName \r
101 and VariableGuid of all variables currently available in the system. \r
102 On each call, the previous results are passed into the interface, \r
103 and, on return, the interface returns the data for the next \r
104 interface. When the entire variable list has been returned, \r
105 EFI_NOT_FOUND is returned.\r
106\r
107 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
108\r
109 @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.\r
110 @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.\r
111 On return, points to the next variable's null-terminated name string.\r
112\r
113 @param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID. \r
114 On return, a pointer to the next variable's GUID.\r
115\r
116 @retval EFI_SUCCESS The variable was read successfully.\r
117 @retval EFI_NOT_FOUND The variable could not be found.\r
118 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting\r
119 data. VariableNameSize is updated with the size\r
120 required for the specified variable.\r
121 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or\r
122 VariableNameSize is NULL.\r
123 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r
124\r
125**/\r
126EFI_STATUS\r
127EFIAPI\r
128PeiGetNextVariableName (\r
129 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
130 IN OUT UINTN *VariableNameSize,\r
131 IN OUT CHAR16 *VariableName,\r
132 IN OUT EFI_GUID *VariableGuid\r
133 );\r
134\r
135#endif\r