2 Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
3 UEFI PI Spec supersedes Intel's Framework Specs.
4 # EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI
6 # This module produces EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
7 # This module is used on platform when both of these two conditions are true:
8 # 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present.
9 # 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI.
11 Copyright (c) 2006 - 2008 Intel Corporation. <BR>
12 All rights reserved. This program and the accompanying materials
13 are licensed and made available under the terms and conditions of the BSD License
14 which accompanies this distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24 #include <Ppi/ReadOnlyVariable.h>
25 #include <Ppi/ReadOnlyVariable2.h>
26 #include <Library/DebugLib.h>
29 // Function Prototypes
34 IN EFI_PEI_SERVICES
**PeiServices
,
35 IN CHAR16
*VariableName
,
36 IN EFI_GUID
*VendorGuid
,
37 OUT UINT32
*Attributes OPTIONAL
,
38 IN OUT UINTN
*DataSize
,
44 PeiGetNextVariableName (
45 IN EFI_PEI_SERVICES
**PeiServices
,
46 IN OUT UINTN
*VariableNameSize
,
47 IN OUT CHAR16
*VariableName
,
48 IN OUT EFI_GUID
*VendorGuid
54 EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi
= {
56 PeiGetNextVariableName
59 EFI_PEI_PPI_DESCRIPTOR mPpiListVariable
= {
60 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
61 &gEfiPeiReadOnlyVariablePpiGuid
,
67 PeimInitializeReadOnlyVariable (
68 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
69 IN CONST EFI_PEI_SERVICES
**PeiServices
75 Provide the functionality of the variable services.
79 FfsHeadher - The FFS file header
80 PeiServices - General purpose services available to every PEIM.
84 Status - EFI_SUCCESS if the interface could be successfully
90 // Publish the variable capability to other modules
92 return (*PeiServices
)->InstallPpi (PeiServices
, &mPpiListVariable
);
98 IN EFI_PEI_SERVICES
**PeiServices
,
99 IN CHAR16
*VariableName
,
100 IN EFI_GUID
*VendorGuid
,
101 OUT UINT32
*Attributes OPTIONAL
,
102 IN OUT UINTN
*DataSize
,
109 Provide the read variable functionality of the variable services.
113 PeiServices - General purpose services available to every PEIM.
115 VariableName - The variable name
117 VendorGuid - The vendor's GUID
119 Attributes - Pointer to the attribute
121 DataSize - Size of data
123 Data - Pointer to data
127 EFI_SUCCESS - The interface could be successfully installed
129 EFI_NOT_FOUND - The variable could not be discovered
131 EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough
136 EFI_PEI_READ_ONLY_VARIABLE2_PPI
*ReadOnlyVariable2
;
138 Status
= (*PeiServices
)->LocatePpi (
139 (CONST EFI_PEI_SERVICES
**)PeiServices
,
140 &gEfiPeiReadOnlyVariable2PpiGuid
,
143 (VOID
**)&ReadOnlyVariable2
145 ASSERT_EFI_ERROR (Status
);
147 return ReadOnlyVariable2
->GetVariable (
159 PeiGetNextVariableName (
160 IN EFI_PEI_SERVICES
**PeiServices
,
161 IN OUT UINTN
*VariableNameSize
,
162 IN OUT CHAR16
*VariableName
,
163 IN OUT EFI_GUID
*VendorGuid
169 Provide the get next variable functionality of the variable services.
173 PeiServices - General purpose services available to every PEIM.
174 VariabvleNameSize - The variable name's size.
175 VariableName - A pointer to the variable's name.
176 VariableGuid - A pointer to the EFI_GUID structure.
178 VariableNameSize - Size of the variable name
180 VariableName - The variable name
182 VendorGuid - The vendor's GUID
186 EFI_SUCCESS - The interface could be successfully installed
188 EFI_NOT_FOUND - The variable could not be discovered
193 EFI_PEI_READ_ONLY_VARIABLE2_PPI
*ReadOnlyVariable2
;
195 Status
= (*PeiServices
)->LocatePpi (
196 (CONST EFI_PEI_SERVICES
**)PeiServices
,
197 &gEfiPeiReadOnlyVariable2PpiGuid
,
200 (VOID
**)&ReadOnlyVariable2
202 ASSERT_EFI_ERROR (Status
);
204 return ReadOnlyVariable2
->NextVariableName (