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