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