2 Esrt management implementation head file.
4 Copyright (c) 2015 - 2018, 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>
32 #include <Protocol/FirmwareManagement.h>
33 #include <Protocol/EsrtManagement.h>
34 #include <Protocol/VariableLock.h>
37 // Name of Variable for Non-FMP ESRT Repository
39 #define EFI_ESRT_NONFMP_VARIABLE_NAME L"EsrtNonFmp"
42 // Name of Variable for FMP
44 #define EFI_ESRT_FMP_VARIABLE_NAME L"EsrtFmp"
47 // Attribute of Cached ESRT entry
49 #define ESRT_FROM_FMP 0x00000001
50 #define ESRT_FROM_NONFMP 0x00000002
55 // Ready to boot event
60 // Updates to Fmp storage must be locked.
65 // Update to Non-Fmp storage must be locked
72 Find Esrt Entry stored in ESRT repository.
74 @param[in] FwClass Firmware class guid in Esrt entry
75 @param[in] Attribute Esrt from Non FMP or FMP instance
76 @param[out] Entry Esrt entry returned
78 @retval EFI_SUCCESS Successfully find an Esrt entry
79 @retval EF_NOT_FOUND No Esrt entry found
86 OUT EFI_SYSTEM_RESOURCE_ENTRY
*Entry
90 Insert a new ESRT entry into ESRT Cache repository.
92 @param[in] Entry Esrt entry to be set
93 @param[in] Attribute Esrt from Esrt private protocol or FMP instance
95 @retval EFI_SUCCESS Successfully set a variable.
100 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
,
105 Delete ESRT Entry from ESRT repository.
107 @param[in] FwClass FwClass of Esrt entry to delete
108 @param[in] Attribute Esrt from Esrt private protocol or FMP instance
110 @retval EFI_SUCCESS Insert all entries Successfully
111 @retval EFI_NOT_FOUND ESRT entry with FwClass doesn't exsit
116 IN EFI_GUID
*FwClass
,
121 Update one ESRT entry in ESRT repository
123 @param[in] Entry Esrt entry to be set
124 @param[in] Attribute Esrt from Non Esrt or FMP instance
126 @retval EFI_SUCCESS Successfully Update a variable.
127 @retval EFI_NOT_FOUND The Esrt enry doesn't exist
132 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
,
137 Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
139 @param[in, out] EsrtEntry Esrt entry to be Init
140 @param[in] FmpImageInfo FMP image info descriptor
141 @param[in] DescriptorVersion FMP Image info descriptor version
145 SetEsrtEntryFromFmpInfo (
146 IN OUT EFI_SYSTEM_RESOURCE_ENTRY
*EsrtEntry
,
147 IN EFI_FIRMWARE_IMAGE_DESCRIPTOR
*FmpImageInfo
,
148 IN UINT32 DescriptorVersion
152 Get ESRT entry from ESRT Cache by FwClass Guid
154 @param[in] FwClass FwClass of Esrt entry to get
155 @param[in, out] Entry Esrt entry returned
157 @retval EFI_SUCCESS The variable saving this Esrt Entry exists.
158 @retval EF_NOT_FOUND No correct variable found.
159 @retval EFI_WRITE_PROTECTED ESRT Cache repository is locked
165 IN EFI_GUID
*FwClass
,
166 IN OUT EFI_SYSTEM_RESOURCE_ENTRY
*Entry
170 Update one ESRT entry in ESRT Cache.
172 @param[in] Entry Esrt entry to be updated
174 @retval EFI_SUCCESS Successfully update an ESRT entry in cache.
175 @retval EFI_INVALID_PARAMETER Entry does't exist in ESRT Cache
176 @retval EFI_WRITE_PROTECTED ESRT Cache is locked
181 EsrtDxeUpdateEsrtEntry(
182 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
186 Non-FMP instance to unregister Esrt Entry from ESRT Cache.
188 @param[in] FwClass FwClass of Esrt entry to Unregister
190 @retval EFI_SUCCESS Insert all entries Successfully
191 @retval EFI_NOT_FOUND Entry of FwClass does not exsit
196 EsrtDxeUnRegisterEsrtEntry(
201 Non-FMP instance to register one ESRT entry into ESRT Cache.
203 @param[in] Entry Esrt entry to be set
205 @retval EFI_SUCCESS Successfully set a variable.
206 @retval EFI_INVALID_PARAMETER ESRT Entry is already exist
210 EsrtDxeRegisterEsrtEntry(
211 IN EFI_SYSTEM_RESOURCE_ENTRY
*Entry
215 This function syn up Cached ESRT with data from FMP instances
216 Function should be called after Connect All in order to locate all FMP protocols
219 @retval EFI_SUCCESS Successfully sync cache repository from FMP instances
220 @retval EFI_NOT_FOUND No FMP Instance are found
221 @retval EFI_OUT_OF_RESOURCES Resource allocaton fail
231 This function locks up Esrt repository to be readonly. It should be called
232 before gEfiEndOfDxeEventGroupGuid event signaled
234 @retval EFI_SUCCESS Locks up FMP Non-FMP repository successfully
239 EsrtDxeLockEsrtRepository(
243 #endif // #ifndef _EFI_ESRT_IMPL_H_