2 Esrt management implementation head file.
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _DXE_ESRT_IMPL_H_
16 #define _DXE_ESRT_IMPL_H_
18 #include <Guid/EventGroup.h>
19 #include <Guid/SystemResourceTable.h>
21 #include <Library/UefiLib.h>
22 #include <Library/UefiRuntimeServicesTableLib.h>
23 #include <Library/UefiLib.h>
24 #include <Library/PcdLib.h>
25 #include <Library/BaseLib.h>
26 #include <Library/BaseMemoryLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/DebugLib.h>
30 #include <Library/CapsuleLib.h>
31 #include <Library/PrintLib.h>
33 #include <Protocol/FirmwareManagement.h>
34 #include <Protocol/EsrtManagement.h>
35 #include <Protocol/VariableLock.h>
38 // Name of Variable for Non-FMP ESRT Repository
40 #define EFI_ESRT_NONFMP_VARIABLE_NAME L"EsrtNonFmp"
43 // Name of Variable for FMP
45 #define EFI_ESRT_FMP_VARIABLE_NAME L"EsrtFmp"
48 // Attribute of Cached ESRT entry
50 #define ESRT_FROM_FMP 0x00000001
51 #define ESRT_FROM_NONFMP 0x00000002
56 // Ready to boot event
61 // Updates to Fmp storage must be locked.
66 // Update to Non-Fmp storage must be locked
73 Find Esrt Entry stored in ESRT repository.
75 @param[in] FwClass Firmware class guid in Esrt entry
76 @param[in] Attribute Esrt from Non FMP or FMP instance
77 @param[out] Entry Esrt entry returned
79 @retval EFI_SUCCESS Successfully find an Esrt entry
80 @retval EF_NOT_FOUND No Esrt entry found
87 OUT EFI_SYSTEM_RESOURCE_ENTRY
*Entry
91 Insert a new ESRT entry into ESRT Cache repository.
93 @param[in] Entry Esrt entry to be set
94 @param[in] Attribute Esrt from Esrt private protocol or FMP instance
96 @retval EFI_SUCCESS Successfully set a variable.
101 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
,
106 Delete ESRT Entry from ESRT repository.
108 @param[in] FwClass FwClass of Esrt entry to delete
109 @param[in] Attribute Esrt from Esrt private protocol or FMP instance
111 @retval EFI_SUCCESS Insert all entries Successfully
112 @retval EFI_NOT_FOUND ESRT entry with FwClass doesn't exsit
117 IN EFI_GUID
*FwClass
,
122 Update one ESRT entry in ESRT repository
124 @param[in] Entry Esrt entry to be set
125 @param[in] Attribute Esrt from Non Esrt or FMP instance
127 @retval EFI_SUCCESS Successfully Update a variable.
128 @retval EFI_NOT_FOUND The Esrt enry doesn't exist
133 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
,
138 Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
140 @param[in, out] EsrtEntry Esrt entry to be Init
141 @param[in] FmpImageInfo FMP image info descriptor
142 @param[in] DescriptorVersion FMP Image info descriptor version
146 SetEsrtEntryFromFmpInfo (
147 IN OUT EFI_SYSTEM_RESOURCE_ENTRY
*EsrtEntry
,
148 IN EFI_FIRMWARE_IMAGE_DESCRIPTOR
*FmpImageInfo
,
149 IN UINT32 DescriptorVersion
153 Get ESRT entry from ESRT Cache by FwClass Guid
155 @param[in] FwClass FwClass of Esrt entry to get
156 @param[in, out] Entry Esrt entry returned
158 @retval EFI_SUCCESS The variable saving this Esrt Entry exists.
159 @retval EF_NOT_FOUND No correct variable found.
160 @retval EFI_WRITE_PROTECTED ESRT Cache repository is locked
166 IN EFI_GUID
*FwClass
,
167 IN OUT EFI_SYSTEM_RESOURCE_ENTRY
*Entry
171 Update one ESRT entry in ESRT Cache.
173 @param[in] Entry Esrt entry to be updated
175 @retval EFI_SUCCESS Successfully update an ESRT entry in cache.
176 @retval EFI_INVALID_PARAMETER Entry does't exist in ESRT Cache
177 @retval EFI_WRITE_PROTECTED ESRT Cache is locked
182 EsrtDxeUpdateEsrtEntry(
183 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
187 Non-FMP instance to unregister Esrt Entry from ESRT Cache.
189 @param[in] FwClass FwClass of Esrt entry to Unregister
191 @retval EFI_SUCCESS Insert all entries Successfully
192 @retval EFI_NOT_FOUND Entry of FwClass does not exsit
197 EsrtDxeUnRegisterEsrtEntry(
202 Non-FMP instance to register one ESRT entry into ESRT Cache.
204 @param[in] Entry Esrt entry to be set
206 @retval EFI_SUCCESS Successfully set a variable.
207 @retval EFI_INVALID_PARAMETER ESRT Entry is already exist
211 EsrtDxeRegisterEsrtEntry(
212 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
216 This function syn up Cached ESRT with data from FMP instances
217 Function should be called after Connect All in order to locate all FMP protocols
220 @retval EFI_SUCCESS Successfully sync cache repository from FMP instances
221 @retval EFI_NOT_FOUND No FMP Instance are found
222 @retval EFI_OUT_OF_RESOURCES Resource allocaton fail
232 This function locks up Esrt repository to be readonly. It should be called
233 before gEfiEndOfDxeEventGroupGuid event signaled
235 @retval EFI_SUCCESS Locks up FMP Non-FMP repository successfully
240 EsrtDxeLockEsrtRepository(
244 #endif // #ifndef _EFI_ESRT_IMPL_H_