6e6c0873a52764e49f656ecbe71d78d50347abb9
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / ReadOnlyVariable.h
1 /** @file
2 This file declares Read-only Variable Service PPI
3 These services provide a lightweight, read-only variant of the full EFI variable services. The
4 reason that these services are read-only is to reduce the complexity of flash management. Also,
5 some implementation of the PEI may use the same physical flash part for variable and PEIM
6 storage; as such, a write command to certain technologies would alter the contents of the entire part,
7 thus making the in situ PEIM execution not follow the required flow.
8
9 Copyright (c) 2006, Intel Corporation
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
14
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18 Module Name: ReadOnlyVariable.h
19
20 @par Revision Reference:
21 This PPI is defined in PEI CIS
22 Version 0.91.
23
24 **/
25
26 #ifndef __PEI_READ_ONLY_VARIABLE_PPI_H__
27 #define __PEI_READ_ONLY_VARIABLE_PPI_H__
28
29 #include <PiPei.h>
30
31 #define EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID \
32 { \
33 0x3cdc90c6, 0x13fb, 0x4a75, {0x9e, 0x79, 0x59, 0xe9, 0xdd, 0x78, 0xb9, 0xfa } \
34 }
35
36 typedef struct _EFI_PEI_READ_ONLY_VARIABLE_PPI EFI_PEI_READ_ONLY_VARIABLE_PPI;
37
38 //
39 // Variable attributes
40 //
41 #define EFI_VARIABLE_NON_VOLATILE 0x00000001
42 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
43 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
44 #define EFI_VARIABLE_READ_ONLY 0x00000008
45
46 /**
47 Get Variable value by Name and GUID pair
48
49 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
50 @param VariableName A NULL-terminated Unicode string that is the name of the vendor's variable.
51 @param VendorGuid A unique identifier for the vendor.
52 @param Attributes If not NULL, a pointer to the memory location to return
53 the attributes bitmask for the variable.
54 @param DataSize On input, the size in bytes of the return Data buffer.
55 On output, the size of data returned in Data.
56 @param Data The buffer to return the contents of the variable.
57
58 @retval EFI_SUCCESS The function completed successfully.
59 @retval EFI_NOT_FOUND The variable was not found.
60 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.
61 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
62 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
63
64 **/
65 typedef
66 EFI_STATUS
67 (EFIAPI *EFI_PEI_GET_VARIABLE) (
68 IN EFI_PEI_SERVICES **PeiServices,
69 IN CHAR16 *VariableName,
70 IN EFI_GUID *VendorGuid,
71 OUT UINT32 *Attributes OPTIONAL,
72 IN OUT UINTN *DataSize,
73 OUT VOID *Data
74 );
75
76 /**
77 This function can be called multiple times to retrieve the VariableName
78 and VendorGuid of all variables currently available in the system. On each call
79 to GetNextVariableName() the previous results are passed into the interface,
80 and on output the interface returns the next variable name data. When the
81 entire variable list has been returned, the error EFI_NOT_FOUND is returned.
82
83 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
84 @param VariableNameSize The size of the VariableName buffer.
85 @param VariableName On input, supplies the last VariableName that was
86 returned by GetNextVariableName(). On output, returns the Null-terminated
87 Unicode string of the current variable.
88 @param VendorGuid On input, supplies the last VendorGuid that was
89 returned by GetNextVariableName(). On output, returns the VendorGuid
90 of the current variable.
91
92 @retval EFI_SUCCESS The function completed successfully.
93 @retval EFI_NOT_FOUND The next variable was not found.
94 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.
95 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
96 @retval EFI_DEVICE_ERROR The variable name could not be retrieved due to a hardware error.
97
98 **/
99 typedef
100 EFI_STATUS
101 (EFIAPI *EFI_PEI_GET_NEXT_VARIABLE_NAME) (
102 IN EFI_PEI_SERVICES **PeiServices,
103 IN OUT UINTN *VariableNameSize,
104 IN OUT CHAR16 *VariableName,
105 IN OUT EFI_GUID *VendorGuid
106 );
107
108 /**
109 @par Ppi Description:
110 This PPI provides a lightweight, read-only variant of the full EFI
111 variable services.
112
113 @param GetVariable
114 A service to ascertain a given variable name.
115
116 @param GetNextVariableName
117 A service to ascertain a variable based upon a given, known variable
118
119 **/
120 struct _EFI_PEI_READ_ONLY_VARIABLE_PPI {
121 EFI_PEI_GET_VARIABLE PeiGetVariable;
122 EFI_PEI_GET_NEXT_VARIABLE_NAME PeiGetNextVariableName;
123 };
124
125 extern EFI_GUID gEfiPeiReadOnlyVariablePpiGuid;
126
127 #endif