]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Ppi/ReadOnlyVariable.h
077293749df113463e5c93d6efa28e465e69bcfa
[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 #define EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID \
25 { \
26 0x3cdc90c6, 0x13fb, 0x4a75, {0x9e, 0x79, 0x59, 0xe9, 0xdd, 0x78, 0xb9, 0xfa } \
27 }
28
29 typedef struct _EFI_PEI_READ_ONLY_VARIABLE_PPI EFI_PEI_READ_ONLY_VARIABLE_PPI;
30
31 //
32 // Variable attributes
33 //
34 #define EFI_VARIABLE_NON_VOLATILE 0x00000001
35 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
36 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
37 ///
38 /// Inconsistent with specification here:
39 /// In Framework Spec, PeiCis0.91, there is no this field defined.
40 /// Keeping this inconsistance is for backward compatibility.
41 ///
42 #define EFI_VARIABLE_READ_ONLY 0x00000008
43
44 /**
45 Get Variable value by Name and GUID pair
46
47 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
48 @param VariableName A NULL-terminated Unicode string that is the name of the vendor's variable.
49 @param VendorGuid A unique identifier for the vendor.
50 @param Attributes If not NULL, a pointer to the memory location to return
51 the attributes bitmask for the variable.
52 @param DataSize On input, the size in bytes of the return Data buffer.
53 On output, the size of data returned in Data.
54 @param Data The buffer to return the contents of the variable.
55
56 @retval EFI_SUCCESS The function completed successfully.
57 @retval EFI_NOT_FOUND The variable was not found.
58 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.
59 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
60 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
61
62 **/
63 typedef
64 EFI_STATUS
65 (EFIAPI *EFI_PEI_GET_VARIABLE)(
66 IN EFI_PEI_SERVICES **PeiServices,
67 IN CHAR16 *VariableName,
68 IN EFI_GUID *VendorGuid,
69 OUT UINT32 *Attributes OPTIONAL,
70 IN OUT UINTN *DataSize,
71 OUT VOID *Data
72 );
73
74 /**
75 This function can be called multiple times to retrieve the VariableName
76 and VendorGuid of all variables currently available in the system. On each call
77 to GetNextVariableName() the previous results are passed into the interface,
78 and on output the interface returns the next variable name data. When the
79 entire variable list has been returned, the error EFI_NOT_FOUND is returned.
80
81 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
82 @param VariableNameSize The size of the VariableName buffer.
83 @param VariableName On input, supplies the last VariableName that was
84 returned by GetNextVariableName(). On output, returns the Null-terminated
85 Unicode string of the current variable.
86 @param VendorGuid On input, supplies the last VendorGuid that was
87 returned by GetNextVariableName(). On output, returns the VendorGuid
88 of the current variable.
89
90 @retval EFI_SUCCESS The function completed successfully.
91 @retval EFI_NOT_FOUND The next variable was not found.
92 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.
93 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
94 @retval EFI_DEVICE_ERROR The variable name could not be retrieved due to a hardware error.
95
96 **/
97 typedef
98 EFI_STATUS
99 (EFIAPI *EFI_PEI_GET_NEXT_VARIABLE_NAME)(
100 IN EFI_PEI_SERVICES **PeiServices,
101 IN OUT UINTN *VariableNameSize,
102 IN OUT CHAR16 *VariableName,
103 IN OUT EFI_GUID *VendorGuid
104 );
105
106 ///
107 /// This PPI provides a lightweight, read-only variant of the full EFI
108 /// variable services.
109 ///
110 struct _EFI_PEI_READ_ONLY_VARIABLE_PPI {
111 ///
112 /// Inconsistent with specification here:
113 /// In Framework Spec, PeiCis0.91, the field is named as GetVariable and GetNextVariableName.
114 /// Keeping this inconsistance is for backward compatibility.
115 ///
116 EFI_PEI_GET_VARIABLE PeiGetVariable; ///< A service to ascertain a given variable name.
117 EFI_PEI_GET_NEXT_VARIABLE_NAME PeiGetNextVariableName; ///< A service to ascertain a variable based upon a given, known variable
118 };
119
120 extern EFI_GUID gEfiPeiReadOnlyVariablePpiGuid;
121
122 #endif