2 Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
\r
3 UEFI PI Spec supersedes Intel's Framework Specs.
\r
4 # EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI
\r
6 # This module produces EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.
\r
7 # This module is used on platform when both of these two conditions are true:
\r
8 # 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present.
\r
9 # 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI.
\r
11 This module can't be used together with ReadOnlyVariable2ToReadOnlyVariableThunk module.
\r
13 Copyright (c) 2006 - 2008 Intel Corporation. <BR>
\r
14 All rights reserved. This program and the accompanying materials
\r
15 are licensed and made available under the terms and conditions of the BSD License
\r
16 which accompanies this distribution. The full text of the license may be found at
\r
17 http://opensource.org/licenses/bsd-license.php
\r
19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
\r
20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
\r
26 #include <Ppi/ReadOnlyVariable.h>
\r
27 #include <Ppi/ReadOnlyVariable2.h>
\r
28 #include <Ppi/ReadOnlyVariableThunkPresent.h>
\r
29 #include <Library/DebugLib.h>
\r
30 #include <Library/PeiServicesLib.h>
\r
33 // Function Prototypes
\r
38 IN EFI_PEI_SERVICES **PeiServices,
\r
39 IN CHAR16 *VariableName,
\r
40 IN EFI_GUID *VendorGuid,
\r
41 OUT UINT32 *Attributes OPTIONAL,
\r
42 IN OUT UINTN *DataSize,
\r
48 PeiGetNextVariableName (
\r
49 IN EFI_PEI_SERVICES **PeiServices,
\r
50 IN OUT UINTN *VariableNameSize,
\r
51 IN OUT CHAR16 *VariableName,
\r
52 IN OUT EFI_GUID *VendorGuid
\r
58 EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi = {
\r
60 PeiGetNextVariableName
\r
63 EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
\r
64 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
\r
65 &gEfiPeiReadOnlyVariablePpiGuid,
\r
70 Standard entry point of a PEIM.
\r
72 @param FfsHeadher The FFS file header
\r
73 @param PeiServices General purpose services available to every PEIM.
\r
75 @retval EFI_SUCCESS If the gEfiPeiReadOnlyVariablePpiGuid interface could be successfully installed.
\r
80 PeimInitializeReadOnlyVariable (
\r
81 IN EFI_PEI_FILE_HANDLE FfsHeader,
\r
82 IN CONST EFI_PEI_SERVICES **PeiServices
\r
89 // Make sure ReadOnlyVariableToReadOnlyVariable2 module is not present. If so, the call chain will form a
\r
90 // infinite loop: ReadOnlyVariable -> ReadOnlyVariable2 -> ReadOnlyVariable -> ....
\r
92 Status = PeiServicesLocatePpi (&gPeiReadonlyVariableThunkPresentPpiGuid, 0, NULL, &Interface);
\r
93 ASSERT (Status == EFI_NOT_FOUND);
\r
96 // Publish the variable capability to other modules
\r
98 return (*PeiServices)->InstallPpi (PeiServices, &mPpiListVariable);
\r
102 Provide the read variable functionality of the variable services.
\r
104 @param PeiServices General purpose services available to every PEIM.
\r
105 @param VariableName The variable name
\r
106 @param VendorGuid The vendor's GUID
\r
107 @param Attributes Pointer to the attribute
\r
108 @param DataSize Size of data
\r
109 @param Data Pointer to data
\r
111 @retval EFI_SUCCESS The interface could be successfully installed
\r
112 @retval EFI_NOT_FOUND The variable could not be discovered
\r
113 @retval EFI_BUFFER_TOO_SMALL The caller buffer is not large enough
\r
119 IN EFI_PEI_SERVICES **PeiServices,
\r
120 IN CHAR16 *VariableName,
\r
121 IN EFI_GUID *VendorGuid,
\r
122 OUT UINT32 *Attributes OPTIONAL,
\r
123 IN OUT UINTN *DataSize,
\r
128 EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2;
\r
130 Status = (*PeiServices)->LocatePpi (
\r
131 (CONST EFI_PEI_SERVICES **)PeiServices,
\r
132 &gEfiPeiReadOnlyVariable2PpiGuid,
\r
135 (VOID **)&ReadOnlyVariable2
\r
137 ASSERT_EFI_ERROR (Status);
\r
139 return ReadOnlyVariable2->GetVariable (
\r
150 Provide the get next variable functionality of the variable services.
\r
152 @param PeiServices General purpose services available to every PEIM.
\r
153 @param VariabvleNameSize The variable name's size.
\r
154 @param VariableName A pointer to the variable's name.
\r
155 @param VariableGuid A pointer to the EFI_GUID structure.
\r
156 @param VariableNameSize Size of the variable name
\r
157 @param VariableName The variable name
\r
158 @param VendorGuid The vendor's GUID
\r
160 @retval EFI_SUCCESS The interface could be successfully installed
\r
161 @retval EFI_NOT_FOUND The variable could not be discovered
\r
166 PeiGetNextVariableName (
\r
167 IN EFI_PEI_SERVICES **PeiServices,
\r
168 IN OUT UINTN *VariableNameSize,
\r
169 IN OUT CHAR16 *VariableName,
\r
170 IN OUT EFI_GUID *VendorGuid
\r
174 EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2;
\r
176 Status = (*PeiServices)->LocatePpi (
\r
177 (CONST EFI_PEI_SERVICES **)PeiServices,
\r
178 &gEfiPeiReadOnlyVariable2PpiGuid,
\r
181 (VOID **)&ReadOnlyVariable2
\r
183 ASSERT_EFI_ERROR (Status);
\r
185 return ReadOnlyVariable2->NextVariableName (
\r