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