11EFI_GUID gSystemFmpLastAttemptVariableGuid = SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_GUID;
12EFI_GUID gSystemFmpProtocolGuid = SYSTEM_FMP_PROTOCOL_GUID;
67 OUT UINT32 *DescriptorVersion,
68 OUT UINT8 *DescriptorCount,
70 OUT UINT32 *PackageVersion,
71 OUT CHAR16 **PackageVersionName
79 if (ImageInfoSize ==
NULL) {
80 return EFI_INVALID_PARAMETER;
85 return EFI_BUFFER_TOO_SMALL;
88 if ((ImageInfo ==
NULL) ||
89 (DescriptorVersion ==
NULL) ||
90 (DescriptorCount ==
NULL) ||
91 (DescriptorSize ==
NULL) ||
92 (PackageVersion ==
NULL) ||
93 (PackageVersionName ==
NULL))
95 return EFI_INVALID_PARAMETER;
100 *DescriptorCount = SystemFmpPrivate->DescriptorCount;
106 ImageDescriptor = SystemFmpPrivate->ImageDescriptor;
107 ImageInfo->ImageIndex = ImageDescriptor->ImageIndex;
108 CopyGuid (&ImageInfo->ImageTypeId, &ImageDescriptor->ImageTypeId);
109 ImageInfo->ImageId = ImageDescriptor->ImageId;
110 if (ImageDescriptor->ImageIdNameStringOffset != 0) {
111 ImageInfo->ImageIdName = (CHAR16 *)((
UINTN)ImageDescriptor + ImageDescriptor->ImageIdNameStringOffset);
113 ImageInfo->ImageIdName =
NULL;
116 ImageInfo->Version = ImageDescriptor->Version;
117 if (ImageDescriptor->VersionNameStringOffset != 0) {
118 ImageInfo->VersionName = (CHAR16 *)((
UINTN)ImageDescriptor + ImageDescriptor->VersionNameStringOffset);
120 ImageInfo->VersionName =
NULL;
123 ImageInfo->Size = (
UINTN)ImageDescriptor->Size;
124 ImageInfo->AttributesSupported = ImageDescriptor->AttributesSupported;
125 ImageInfo->AttributesSetting = ImageDescriptor->AttributesSetting;
126 ImageInfo->Compatibilities = ImageDescriptor->Compatibilities;
127 ImageInfo->LowestSupportedImageVersion = ImageDescriptor->LowestSupportedImageVersion;
128 ImageInfo->LastAttemptVersion = SystemFmpPrivate->LastAttempt.LastAttemptVersion;
129 ImageInfo->LastAttemptStatus = SystemFmpPrivate->LastAttempt.LastAttemptStatus;
130 ImageInfo->HardwareInstance = ImageDescriptor->HardwareInstance;
135 *PackageVersion = ImageDescriptor->PackageVersion;
136 if (ImageDescriptor->PackageVersionNameStringOffset != 0) {
137 *PackageVersionName = (VOID *)((
UINTN)ImageDescriptor + ImageDescriptor->PackageVersionNameStringOffset);
140 *PackageVersionName =
NULL;
178 return EFI_UNSUPPORTED;
208 OUT UINT32 *ImageUpdatable
211 return EFI_UNSUPPORTED;
250 OUT UINT32 *PackageVersion,
251 OUT CHAR16 **PackageVersionName,
252 OUT UINT32 *PackageVersionNameMaxLen,
253 OUT UINT64 *AttributesSupported,
254 OUT UINT64 *AttributesSetting
257 return EFI_UNSUPPORTED;
298 IN UINT32 PackageVersion,
299 IN CONST CHAR16 *PackageVersionName
302 return EFI_UNSUPPORTED;
320 SystemFmpPrivate->Signature = SYSTEM_FMP_PRIVATE_DATA_SIGNATURE;
321 SystemFmpPrivate->Handle =
NULL;
322 SystemFmpPrivate->DescriptorCount = 1;
325 SystemFmpPrivate->ImageDescriptor =
PcdGetPtr (PcdEdkiiSystemFirmwareImageDescriptor);
327 SystemFmpPrivate->LastAttempt.LastAttemptVersion = 0x0;
328 SystemFmpPrivate->LastAttempt.LastAttemptStatus = 0x0;
329 VarSize =
sizeof (SystemFmpPrivate->LastAttempt);
330 VarStatus =
gRT->GetVariable (
331 SYSTEM_FMP_LAST_ATTEMPT_VARIABLE_NAME,
332 &gSystemFmpLastAttemptVariableGuid,
335 &SystemFmpPrivate->LastAttempt
337 DEBUG ((DEBUG_INFO,
"GetLastAttempt - %r\n", VarStatus));
338 DEBUG ((DEBUG_INFO,
"GetLastAttempt Version - 0x%x, State - 0x%x\n", SystemFmpPrivate->LastAttempt.LastAttemptVersion, SystemFmpPrivate->LastAttempt.LastAttemptStatus));
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION
EFI_RUNTIME_SERVICES * gRT
#define DEBUG(Expression)
#define PcdGetPtr(TokenName)
EFI_STATUS EFIAPI FmpGetImageInfo(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN OUT UINTN *ImageInfoSize, IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo, OUT UINT32 *DescriptorVersion, OUT UINT8 *DescriptorCount, OUT UINTN *DescriptorSize, OUT UINT32 *PackageVersion, OUT CHAR16 **PackageVersionName)
EFI_STATUS EFIAPI FmpCheckImage(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN CONST VOID *Image, IN UINTN ImageSize, OUT UINT32 *ImageUpdatable)
EFI_STATUS EFIAPI FmpGetImage(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN UINT8 ImageIndex, IN OUT VOID *Image, IN OUT UINTN *ImageSize)
EFI_STATUS InitializePrivateData(IN SYSTEM_FMP_PRIVATE_DATA *SystemFmpPrivate)
EFI_STATUS EFIAPI FmpGetPackageInfo(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, OUT UINT32 *PackageVersion, OUT CHAR16 **PackageVersionName, OUT UINT32 *PackageVersionNameMaxLen, OUT UINT64 *AttributesSupported, OUT UINT64 *AttributesSetting)
EFI_STATUS EFIAPI FmpSetPackageInfo(IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This, IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode, IN UINT32 PackageVersion, IN CONST CHAR16 *PackageVersionName)
#define SYSTEM_FMP_PRIVATE_DATA_FROM_FMP(a)
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)