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