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