2 Esrt management implementation head file.
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _DXE_ESRT_IMPL_H_
10 #define _DXE_ESRT_IMPL_H_
12 #include <Guid/EventGroup.h>
13 #include <Guid/SystemResourceTable.h>
15 #include <Library/UefiLib.h>
16 #include <Library/UefiRuntimeServicesTableLib.h>
17 #include <Library/UefiLib.h>
18 #include <Library/PcdLib.h>
19 #include <Library/BaseLib.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/MemoryAllocationLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/CapsuleLib.h>
26 #include <Protocol/FirmwareManagement.h>
27 #include <Protocol/EsrtManagement.h>
28 #include <Protocol/VariableLock.h>
31 // Name of Variable for Non-FMP ESRT Repository
33 #define EFI_ESRT_NONFMP_VARIABLE_NAME L"EsrtNonFmp"
36 // Name of Variable for FMP
38 #define EFI_ESRT_FMP_VARIABLE_NAME L"EsrtFmp"
41 // Attribute of Cached ESRT entry
43 #define ESRT_FROM_FMP 0x00000001
44 #define ESRT_FROM_NONFMP 0x00000002
49 // Ready to boot event
54 // Updates to Fmp storage must be locked.
59 // Update to Non-Fmp storage must be locked
66 Find Esrt Entry stored in ESRT repository.
68 @param[in] FwClass Firmware class guid in Esrt entry
69 @param[in] Attribute Esrt from Non FMP or FMP instance
70 @param[out] Entry Esrt entry returned
72 @retval EFI_SUCCESS Successfully find an Esrt entry
73 @retval EF_NOT_FOUND No Esrt entry found
80 OUT EFI_SYSTEM_RESOURCE_ENTRY
*Entry
84 Insert a new ESRT entry into ESRT Cache repository.
86 @param[in] Entry Esrt entry to be set
87 @param[in] Attribute Esrt from Esrt private protocol or FMP instance
89 @retval EFI_SUCCESS Successfully set a variable.
94 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
,
99 Delete ESRT Entry from ESRT repository.
101 @param[in] FwClass FwClass of Esrt entry to delete
102 @param[in] Attribute Esrt from Esrt private protocol or FMP instance
104 @retval EFI_SUCCESS Insert all entries Successfully
105 @retval EFI_NOT_FOUND ESRT entry with FwClass doesn't exsit
110 IN EFI_GUID
*FwClass
,
115 Update one ESRT entry in ESRT repository
117 @param[in] Entry Esrt entry to be set
118 @param[in] Attribute Esrt from Non Esrt or FMP instance
120 @retval EFI_SUCCESS Successfully Update a variable.
121 @retval EFI_NOT_FOUND The Esrt enry doesn't exist
126 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
,
131 Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
133 @param[in, out] EsrtEntry Esrt entry to be Init
134 @param[in] FmpImageInfo FMP image info descriptor
135 @param[in] DescriptorVersion FMP Image info descriptor version
139 SetEsrtEntryFromFmpInfo (
140 IN OUT EFI_SYSTEM_RESOURCE_ENTRY
*EsrtEntry
,
141 IN EFI_FIRMWARE_IMAGE_DESCRIPTOR
*FmpImageInfo
,
142 IN UINT32 DescriptorVersion
146 Get ESRT entry from ESRT Cache by FwClass Guid
148 @param[in] FwClass FwClass of Esrt entry to get
149 @param[in, out] Entry Esrt entry returned
151 @retval EFI_SUCCESS The variable saving this Esrt Entry exists.
152 @retval EF_NOT_FOUND No correct variable found.
153 @retval EFI_WRITE_PROTECTED ESRT Cache repository is locked
159 IN EFI_GUID
*FwClass
,
160 IN OUT EFI_SYSTEM_RESOURCE_ENTRY
*Entry
164 Update one ESRT entry in ESRT Cache.
166 @param[in] Entry Esrt entry to be updated
168 @retval EFI_SUCCESS Successfully update an ESRT entry in cache.
169 @retval EFI_INVALID_PARAMETER Entry does't exist in ESRT Cache
170 @retval EFI_WRITE_PROTECTED ESRT Cache is locked
175 EsrtDxeUpdateEsrtEntry(
176 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
180 Non-FMP instance to unregister Esrt Entry from ESRT Cache.
182 @param[in] FwClass FwClass of Esrt entry to Unregister
184 @retval EFI_SUCCESS Insert all entries Successfully
185 @retval EFI_NOT_FOUND Entry of FwClass does not exsit
190 EsrtDxeUnRegisterEsrtEntry(
195 Non-FMP instance to register one ESRT entry into ESRT Cache.
197 @param[in] Entry Esrt entry to be set
199 @retval EFI_SUCCESS Successfully set a variable.
200 @retval EFI_INVALID_PARAMETER ESRT Entry is already exist
204 EsrtDxeRegisterEsrtEntry(
205 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
209 This function syn up Cached ESRT with data from FMP instances
210 Function should be called after Connect All in order to locate all FMP protocols
213 @retval EFI_SUCCESS Successfully sync cache repository from FMP instances
214 @retval EFI_NOT_FOUND No FMP Instance are found
215 @retval EFI_OUT_OF_RESOURCES Resource allocaton fail
225 This function locks up Esrt repository to be readonly. It should be called
226 before gEfiEndOfDxeEventGroupGuid event signaled
228 @retval EFI_SUCCESS Locks up FMP Non-FMP repository successfully
233 EsrtDxeLockEsrtRepository(
237 #endif // #ifndef _EFI_ESRT_IMPL_H_