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