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