]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/ReadOnlyVariable2.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Ppi / ReadOnlyVariable2.h
CommitLineData
5879b875 1/** @file\r
d7132512
LG
2 This file declares Read-only Variable Service2 PPI.\r
3 This ppi permits read-only access to the UEFI variable store during the PEI phase.\r
5879b875 4\r
9095d37b 5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
5879b875 7\r
5879b875 8 @par Revision Reference:\r
0047820e 9 This PPI is introduced in PI Version 1.0.\r
5879b875 10\r
11**/\r
12\r
13#ifndef __PEI_READ_ONLY_VARIABLE2_PPI_H__\r
14#define __PEI_READ_ONLY_VARIABLE2_PPI_H__\r
15\r
16#define EFI_PEI_READ_ONLY_VARIABLE2_PPI_GUID \\r
00edb218 17 { 0x2ab86ef5, 0xecb5, 0x4134, { 0xb5, 0x56, 0x38, 0x54, 0xca, 0x1f, 0xe1, 0xb4 } }\r
5879b875 18\r
19\r
20typedef struct _EFI_PEI_READ_ONLY_VARIABLE2_PPI EFI_PEI_READ_ONLY_VARIABLE2_PPI;\r
21\r
22/**\r
d7132512
LG
23 This service retrieves a variable's value using its name and GUID.\r
24\r
9095d37b
LG
25 Read the specified variable from the UEFI variable store. If the Data\r
26 buffer is too small to hold the contents of the variable,\r
00edb218
A
27 the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the\r
28 required buffer size to obtain the data.\r
5879b875 29\r
13c38031 30 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
31 @param VariableName A pointer to a null-terminated string that is the variable's name.\r
255f993d 32 @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of\r
13c38031 33 VariableGuid and VariableName must be unique.\r
34 @param Attributes If non-NULL, on return, points to the variable's attributes.\r
35 @param DataSize On entry, points to the size in bytes of the Data buffer.\r
36 On return, points to the size of the data returned in Data.\r
37 @param Data Points to the buffer which will hold the returned variable value.\r
bca08c48 38 May be NULL with a zero DataSize in order to determine the size of the buffer needed.\r
5879b875 39\r
13c38031 40 @retval EFI_SUCCESS The variable was read successfully.\r
bca08c48 41 @retval EFI_NOT_FOUND The variable was not found.\r
9095d37b
LG
42 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data.\r
43 DataSize is updated with the size required for\r
00edb218 44 the specified variable.\r
5879b875 45 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r
5879b875 46 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r
47\r
48**/\r
49typedef\r
50EFI_STATUS\r
51(EFIAPI *EFI_PEI_GET_VARIABLE2)(\r
00edb218
A
52 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
53 IN CONST CHAR16 *VariableName,\r
54 IN CONST EFI_GUID *VariableGuid,\r
55 OUT UINT32 *Attributes,\r
56 IN OUT UINTN *DataSize,\r
bca08c48 57 OUT VOID *Data OPTIONAL\r
ba237732 58 );\r
5879b875 59\r
60\r
61/**\r
d7132512
LG
62 Return the next variable name and GUID.\r
63\r
9095d37b
LG
64 This function is called multiple times to retrieve the VariableName\r
65 and VariableGuid of all variables currently available in the system.\r
66 On each call, the previous results are passed into the interface,\r
67 and, on return, the interface returns the data for the next\r
68 interface. When the entire variable list has been returned,\r
00edb218 69 EFI_NOT_FOUND is returned.\r
5879b875 70\r
00edb218 71 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
5879b875 72\r
00edb218 73 @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.\r
9eec5948 74 On return, the size of the variable name buffer.\r
ac644614 75 @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.\r
76 On return, points to the next variable's null-terminated name string.\r
5879b875 77\r
9095d37b 78 @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID.\r
ac644614 79 On return, a pointer to the next variable's GUID.\r
5879b875 80\r
5879b875 81 @retval EFI_SUCCESS The variable was read successfully.\r
5879b875 82 @retval EFI_NOT_FOUND The variable could not be found.\r
5879b875 83 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting\r
00edb218
A
84 data. VariableNameSize is updated with the size\r
85 required for the specified variable.\r
5879b875 86 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or\r
00edb218 87 VariableNameSize is NULL.\r
5879b875 88 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.\r
89\r
90**/\r
91typedef\r
92EFI_STATUS\r
5a9403b8 93(EFIAPI *EFI_PEI_GET_NEXT_VARIABLE_NAME2)(\r
00edb218
A
94 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
95 IN OUT UINTN *VariableNameSize,\r
96 IN OUT CHAR16 *VariableName,\r
97 IN OUT EFI_GUID *VariableGuid\r
ba237732 98 );\r
5879b875 99\r
13c38031 100///\r
9095d37b
LG
101/// This PPI provides a lightweight, read-only variant of the full EFI\r
102/// variable services.\r
13c38031 103///\r
5879b875 104struct _EFI_PEI_READ_ONLY_VARIABLE2_PPI {\r
5a9403b8 105 EFI_PEI_GET_VARIABLE2 GetVariable;\r
106 EFI_PEI_GET_NEXT_VARIABLE_NAME2 NextVariableName;\r
5879b875 107};\r
108\r
109extern EFI_GUID gEfiPeiReadOnlyVariable2PpiGuid;\r
110\r
111#endif\r