]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/EsrtDxe/EsrtImpl.h
MdeModulePkg: Remove redundant library classes and GUIDs
[mirror_edk2.git] / MdeModulePkg / Universal / EsrtDxe / EsrtImpl.h
CommitLineData
acd32208
CZ
1/** @file\r
2 Esrt management implementation head file.\r
3\r
d1102dba 4Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
acd32208
CZ
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _DXE_ESRT_IMPL_H_\r
16#define _DXE_ESRT_IMPL_H_\r
17\r
18#include <Guid/EventGroup.h>\r
19#include <Guid/SystemResourceTable.h>\r
20\r
21#include <Library/UefiLib.h>\r
22#include <Library/UefiRuntimeServicesTableLib.h>\r
23#include <Library/UefiLib.h>\r
24#include <Library/PcdLib.h>\r
25#include <Library/BaseLib.h>\r
26#include <Library/BaseMemoryLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/DebugLib.h>\r
30#include <Library/CapsuleLib.h>\r
acd32208
CZ
31\r
32#include <Protocol/FirmwareManagement.h>\r
33#include <Protocol/EsrtManagement.h>\r
34#include <Protocol/VariableLock.h>\r
35\r
36//\r
37// Name of Variable for Non-FMP ESRT Repository\r
d1102dba 38//\r
acd32208
CZ
39#define EFI_ESRT_NONFMP_VARIABLE_NAME L"EsrtNonFmp"\r
40\r
41//\r
42// Name of Variable for FMP\r
d1102dba 43//\r
acd32208
CZ
44#define EFI_ESRT_FMP_VARIABLE_NAME L"EsrtFmp"\r
45\r
46//\r
47// Attribute of Cached ESRT entry\r
48//\r
49#define ESRT_FROM_FMP 0x00000001\r
50#define ESRT_FROM_NONFMP 0x00000002\r
51\r
52typedef struct {\r
53 EFI_HANDLE Handle;\r
54 //\r
55 // Ready to boot event\r
56 //\r
57 EFI_EVENT Event;\r
d1102dba 58\r
acd32208
CZ
59 //\r
60 // Updates to Fmp storage must be locked.\r
61 //\r
62 EFI_LOCK FmpLock;\r
63\r
64 //\r
65 // Update to Non-Fmp storage must be locked\r
66 //\r
67 EFI_LOCK NonFmpLock;\r
68} ESRT_PRIVATE_DATA;\r
69\r
70\r
71/**\r
d1102dba 72 Find Esrt Entry stored in ESRT repository.\r
acd32208
CZ
73\r
74 @param[in] FwClass Firmware class guid in Esrt entry\r
75 @param[in] Attribute Esrt from Non FMP or FMP instance\r
76 @param[out] Entry Esrt entry returned\r
d1102dba 77\r
acd32208
CZ
78 @retval EFI_SUCCESS Successfully find an Esrt entry\r
79 @retval EF_NOT_FOUND No Esrt entry found\r
80\r
81**/\r
82EFI_STATUS\r
83GetEsrtEntry (\r
84 IN EFI_GUID *FwClass,\r
85 IN UINTN Attribute,\r
86 OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry\r
87 );\r
88\r
89/**\r
90 Insert a new ESRT entry into ESRT Cache repository.\r
91\r
92 @param[in] Entry Esrt entry to be set\r
93 @param[in] Attribute Esrt from Esrt private protocol or FMP instance\r
d1102dba 94\r
acd32208
CZ
95 @retval EFI_SUCCESS Successfully set a variable.\r
96\r
97**/\r
98EFI_STATUS\r
99InsertEsrtEntry(\r
100 IN EFI_SYSTEM_RESOURCE_ENTRY *Entry,\r
101 UINTN Attribute\r
102 );\r
103\r
104/**\r
d1102dba 105 Delete ESRT Entry from ESRT repository.\r
acd32208 106\r
d1102dba 107 @param[in] FwClass FwClass of Esrt entry to delete\r
acd32208 108 @param[in] Attribute Esrt from Esrt private protocol or FMP instance\r
d1102dba
LG
109\r
110 @retval EFI_SUCCESS Insert all entries Successfully\r
acd32208 111 @retval EFI_NOT_FOUND ESRT entry with FwClass doesn't exsit\r
d1102dba 112\r
acd32208
CZ
113**/\r
114EFI_STATUS\r
115DeleteEsrtEntry(\r
116 IN EFI_GUID *FwClass,\r
117 IN UINTN Attribute\r
118 );\r
119\r
120/**\r
121 Update one ESRT entry in ESRT repository\r
122\r
123 @param[in] Entry Esrt entry to be set\r
124 @param[in] Attribute Esrt from Non Esrt or FMP instance\r
d1102dba 125\r
acd32208
CZ
126 @retval EFI_SUCCESS Successfully Update a variable.\r
127 @retval EFI_NOT_FOUND The Esrt enry doesn't exist\r
128\r
129**/\r
130EFI_STATUS\r
131UpdateEsrtEntry(\r
132 IN EFI_SYSTEM_RESOURCE_ENTRY *Entry,\r
133 UINTN Attribute\r
134 );\r
135\r
136/**\r
137 Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .\r
138\r
a3ac2587
CZ
139 @param[in, out] EsrtEntry Esrt entry to be Init\r
140 @param[in] FmpImageInfo FMP image info descriptor\r
141 @param[in] DescriptorVersion FMP Image info descriptor version\r
d1102dba 142\r
acd32208 143**/\r
d1102dba 144VOID\r
acd32208
CZ
145SetEsrtEntryFromFmpInfo (\r
146 IN OUT EFI_SYSTEM_RESOURCE_ENTRY *EsrtEntry,\r
147 IN EFI_FIRMWARE_IMAGE_DESCRIPTOR *FmpImageInfo,\r
148 IN UINT32 DescriptorVersion\r
149 );\r
150\r
151/**\r
d1102dba
LG
152 Get ESRT entry from ESRT Cache by FwClass Guid\r
153\r
154 @param[in] FwClass FwClass of Esrt entry to get\r
155 @param[in, out] Entry Esrt entry returned\r
acd32208 156\r
acd32208
CZ
157 @retval EFI_SUCCESS The variable saving this Esrt Entry exists.\r
158 @retval EF_NOT_FOUND No correct variable found.\r
159 @retval EFI_WRITE_PROTECTED ESRT Cache repository is locked\r
160\r
161**/\r
162EFI_STATUS\r
163EFIAPI\r
164EsrtDxeGetEsrtEntry(\r
165 IN EFI_GUID *FwClass,\r
166 IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry\r
167 );\r
168\r
169/**\r
170 Update one ESRT entry in ESRT Cache.\r
171\r
172 @param[in] Entry Esrt entry to be updated\r
d1102dba 173\r
acd32208
CZ
174 @retval EFI_SUCCESS Successfully update an ESRT entry in cache.\r
175 @retval EFI_INVALID_PARAMETER Entry does't exist in ESRT Cache\r
176 @retval EFI_WRITE_PROTECTED ESRT Cache is locked\r
177\r
178**/\r
179EFI_STATUS\r
180EFIAPI\r
181EsrtDxeUpdateEsrtEntry(\r
182 IN EFI_SYSTEM_RESOURCE_ENTRY *Entry\r
183 );\r
184\r
185/**\r
d1102dba
LG
186 Non-FMP instance to unregister Esrt Entry from ESRT Cache.\r
187\r
188 @param[in] FwClass FwClass of Esrt entry to Unregister\r
acd32208 189\r
d1102dba 190 @retval EFI_SUCCESS Insert all entries Successfully\r
acd32208
CZ
191 @retval EFI_NOT_FOUND Entry of FwClass does not exsit\r
192\r
193**/\r
194EFI_STATUS\r
195EFIAPI\r
196EsrtDxeUnRegisterEsrtEntry(\r
197 IN EFI_GUID *FwClass\r
198 );\r
199\r
200/**\r
201 Non-FMP instance to register one ESRT entry into ESRT Cache.\r
202\r
203 @param[in] Entry Esrt entry to be set\r
204\r
205 @retval EFI_SUCCESS Successfully set a variable.\r
206 @retval EFI_INVALID_PARAMETER ESRT Entry is already exist\r
207**/\r
208EFI_STATUS\r
209EFIAPI\r
210EsrtDxeRegisterEsrtEntry(\r
211 IN EFI_SYSTEM_RESOURCE_ENTRY *Entry\r
212 );\r
213\r
214/**\r
215 This function syn up Cached ESRT with data from FMP instances\r
216 Function should be called after Connect All in order to locate all FMP protocols\r
a3ac2587 217 installed.\r
acd32208
CZ
218\r
219 @retval EFI_SUCCESS Successfully sync cache repository from FMP instances\r
220 @retval EFI_NOT_FOUND No FMP Instance are found\r
221 @retval EFI_OUT_OF_RESOURCES Resource allocaton fail\r
222\r
223**/\r
224EFI_STATUS\r
225EFIAPI\r
226EsrtDxeSyncFmp(\r
227 VOID\r
228 );\r
229\r
230/**\r
d1102dba 231 This function locks up Esrt repository to be readonly. It should be called\r
acd32208
CZ
232 before gEfiEndOfDxeEventGroupGuid event signaled\r
233\r
d1102dba 234 @retval EFI_SUCCESS Locks up FMP Non-FMP repository successfully\r
acd32208
CZ
235\r
236**/\r
237EFI_STATUS\r
238EFIAPI\r
239EsrtDxeLockEsrtRepository(\r
240 VOID\r
241 );\r
242\r
243#endif // #ifndef _EFI_ESRT_IMPL_H_\r
244\r