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