42 OUT UINT32 *LastAttemptVersion,
43 OUT UINT32 *LastAttemptStatus
47 VOID *AuthenticatedImage;
48 UINTN AuthenticatedImageSize;
49 VOID *DispatchFvImage;
50 UINTN DispatchFvImageSize;
55 AuthenticatedImage =
NULL;
56 AuthenticatedImageSize = 0;
58 DEBUG ((DEBUG_INFO,
"DispatchSystemFmpImages\n"));
64 if (EFI_ERROR (Status)) {
65 DEBUG ((DEBUG_INFO,
"SystemFirmwareAuthenticateImage - %r\n", Status));
72 Result =
ExtractDriverFvImage (AuthenticatedImage, AuthenticatedImageSize, &DispatchFvImage, &DispatchFvImageSize);
74 DEBUG ((DEBUG_INFO,
"ExtractDriverFvImage\n"));
80 if (FvImage !=
NULL) {
81 CopyMem (FvImage, DispatchFvImage, DispatchFvImageSize);
82 Status =
gDS->ProcessFirmwareVolume (
87 DEBUG ((DEBUG_INFO,
"ProcessFirmwareVolume - %r\n", Status));
88 if (!EFI_ERROR (Status)) {
90 DEBUG ((DEBUG_INFO,
"Dispatch Done\n"));
154 OUT CHAR16 **AbortReason
162 if ((Image ==
NULL) || (ImageSize == 0) || (AbortReason ==
NULL)) {
163 return EFI_INVALID_PARAMETER;
169 if ((ImageIndex == 0) || (ImageIndex > SystemFmpPrivate->DescriptorCount)) {
170 return EFI_INVALID_PARAMETER;
176 Status =
DispatchSystemFmpImages ((VOID *)Image, ImageSize, &SystemFmpPrivate->LastAttempt.LastAttemptVersion, &SystemFmpPrivate->LastAttempt.LastAttemptStatus);
177 DEBUG ((DEBUG_INFO,
"(Agent)SetImage - LastAttempt Version - 0x%x, State - 0x%x\n", SystemFmpPrivate->LastAttempt.LastAttemptVersion, SystemFmpPrivate->LastAttempt.LastAttemptStatus));
178 if (EFI_ERROR (Status)) {
179 VarStatus =
gRT->SetVariable (
180 SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,
181 &gSystemFmpLastAttemptVariableGuid,
183 sizeof (SystemFmpPrivate->LastAttempt),
184 &SystemFmpPrivate->LastAttempt
186 DEBUG ((DEBUG_INFO,
"(Agent)SetLastAttempt - %r\n", VarStatus));
193 Status =
gBS->HandleProtocol (
194 SystemFmpPrivate->Handle,
195 &gSystemFmpProtocolGuid,
198 if (EFI_ERROR (Status)) {
199 Status =
gBS->LocateProtocol (
200 &gSystemFmpProtocolGuid,
204 if (EFI_ERROR (Status)) {
205 DEBUG ((DEBUG_INFO,
"(Agent)SetImage - SystemFmpProtocol - %r\n", Status));
206 SystemFmpPrivate->LastAttempt.LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT;
207 VarStatus =
gRT->SetVariable (
208 SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,
209 &gSystemFmpLastAttemptVariableGuid,
211 sizeof (SystemFmpPrivate->LastAttempt),
212 &SystemFmpPrivate->LastAttempt
214 DEBUG ((DEBUG_INFO,
"(Agent)SetLastAttempt - %r\n", VarStatus));
219 return SystemFmp->SetImage (SystemFmp, ImageIndex, Image, ImageSize, VendorCode, Progress, AbortReason);
243 if (mSystemFmpPrivate ==
NULL) {
244 return EFI_OUT_OF_RESOURCES;
248 if (EFI_ERROR (Status)) {
250 mSystemFmpPrivate =
NULL;
257 Status =
gBS->InstallProtocolInterface (
258 &mSystemFmpPrivate->Handle,
259 &gEfiFirmwareManagementProtocolGuid,
261 &mSystemFmpPrivate->Fmp
263 if (EFI_ERROR (Status)) {
265 mSystemFmpPrivate =
NULL;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI ExtractDriverFvImage(IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **DriverFvImage, OUT UINTN *DriverFvImageSize)
EFI_STATUS EFIAPI CapsuleAuthenticateSystemFirmware(IN VOID *Image, IN UINTN ImageSize, IN BOOLEAN ForceVersionMatch, OUT UINT32 *LastAttemptVersion, OUT UINT32 *LastAttemptStatus, OUT VOID **AuthenticatedImage, OUT UINTN *AuthenticatedImageSize)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS)(IN UINTN Completion)
EFI_RUNTIME_SERVICES * gRT
#define DEBUG(Expression)
VOID *EFIAPI AllocatePages(IN UINTN Pages)
EFI_STATUS InitializePrivateData(IN SYSTEM_FMP_PRIVATE_DATA *SystemFmpPrivate)
#define SYSTEM_FMP_PRIVATE_DATA_FROM_FMP(a)
EFI_STATUS EFIAPI SystemFirmwareReportMainDxe(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS DispatchSystemFmpImages(IN VOID *Image, IN UINTN ImageSize, OUT UINT32 *LastAttemptVersion, OUT UINT32 *LastAttemptStatus)
EFI_STATUS EFIAPI FmpSetImage(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress, OUT CHAR16 **AbortReason)
#define EFI_SIZE_TO_PAGES(Size)
#define EFI_VARIABLE_NON_VOLATILE