25#define LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('l', 'f', 'f', 'v')
36#define LOAD_FILE_ON_FV2_PRIVATE_DATA_FROM_THIS(a) CR (a, LOAD_FILE_ON_FV2_PRIVATE_DATA, LoadFile, LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE)
37#define LOAD_FILE_ON_FV2_PRIVATE_DATA_FROM_LINK(a) CR (a, LOAD_FILE_ON_FV2_PRIVATE_DATA, Link, LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE)
74 IN BOOLEAN BootPolicy,
76 IN VOID *Buffer OPTIONAL
83 UINT32 AuthenticationStatus;
85 if ((This ==
NULL) || (BufferSize ==
NULL)) {
86 return EFI_INVALID_PARAMETER;
93 return EFI_UNSUPPORTED;
99 Private = LOAD_FILE_ON_FV2_PRIVATE_DATA_FROM_THIS (This);
106 Status = Private->Fv->ReadSection (
113 &AuthenticationStatus
115 if (EFI_ERROR (Status)) {
123 if ((*BufferSize < Pe32BufferSize) || (Buffer ==
NULL)) {
124 *BufferSize = Pe32BufferSize;
125 return EFI_BUFFER_TOO_SMALL;
133 return Private->Fv->ReadSection (
140 &AuthenticationStatus
145 LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE,
173 for (Entry = (&mPrivateDataList)->ForwardLink; Entry != (&mPrivateDataList); Entry = Entry->ForwardLink) {
174 PrivateData = LOAD_FILE_ON_FV2_PRIVATE_DATA_FROM_LINK (Entry);
175 if (
CompareGuid (NameGuid, &PrivateData->NameGuid)) {
176 DEBUG ((DEBUG_INFO,
"LoadFileOnFv2:FileLoadProtocol has been installed in:%g\n", NameGuid));
217 FilePath->Header.
Type = MEDIA_DEVICE_PATH;
247 EFI_FV_FILETYPE FileType;
253 UINT32 AuthenticationStatus;
257 DEBUG ((DEBUG_INFO,
"LoadFileOnFv2:Find a FV!\n"));
258 Status =
gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
260 Status =
gBS->HandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
261 Fvb->GetPhysicalAddress (Fvb, &Address);
262 DEBUG ((DEBUG_INFO,
"LoadFileOnFv2:Fvb->Address=%x \n", Address));
269 FileType = EFI_FV_FILETYPE_APPLICATION;
272 Status = Fv->GetNextFile (Fv, &Key, &FileType, &NameGuid, &Attributes, &Size);
273 if (EFI_ERROR (Status)) {
278 Status = Fv->ReadSection (
281 EFI_SECTION_USER_INTERFACE,
285 &AuthenticationStatus
287 if (EFI_ERROR (Status)) {
293 ASSERT (Private !=
NULL);
296 CopyGuid (&Private->NameGuid, &NameGuid);
297 LoadFileHandle =
NULL;
298 DEBUG ((DEBUG_INFO,
"Find a APPLICATION in this FV!\n"));
299 Status =
gBS->InstallMultipleProtocolInterfaces (
301 &gEfiDevicePathProtocolGuid,
303 &gEfiLoadFileProtocolGuid,
307 if (!EFI_ERROR (Status)) {
310 DEBUG ((DEBUG_ERROR,
"Application with the same name %s has been installed.!\n", UiName));
345 if (Handle ==
NULL) {
349 Status =
gBS->LocateHandle (
351 &gEfiFirmwareVolume2ProtocolGuid,
356 if (EFI_BUFFER_TOO_SMALL == Status) {
359 if (Handle ==
NULL) {
363 Status =
gBS->LocateHandle (
365 &gEfiFirmwareVolume2ProtocolGuid,
370 if (EFI_ERROR (Status)) {
373 }
else if (EFI_ERROR (Status)) {
378 for (Index = 0; Index < BufferSize/
sizeof (
EFI_HANDLE); Index++) {
379 CurHandle = Handle + Index;
386 if (Handle !=
NULL) {
410 &gEfiFirmwareVolume2ProtocolGuid,
418 &gLzmaCustomDecompressGuid,
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
#define MEDIA_FILEPATH_DP
UINT16 EFIAPI SetDevicePathNodeLength(IN OUT VOID *Node, IN UINTN Length)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathNode(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI FileDevicePath(IN EFI_HANDLE Device OPTIONAL, IN CONST CHAR16 *FileName)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
VOID EFIAPI InstallFileLoadProtocol(EFI_HANDLE Handle)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI CreateFileDevicePath(IN EFI_HANDLE Device, IN EFI_GUID *NameGuid, IN CONST CHAR16 *FileName)
VOID EFIAPI FvNotificationEvent(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI LoadFileOnFv2Intialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI LoadFileOnFv2LoadFile(IN EFI_LOAD_FILE_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
BOOLEAN EFIAPI IsInPrivateList(IN EFI_GUID *NameGuid)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
UINT32 EFI_FV_FILE_ATTRIBUTES
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT64 EFI_PHYSICAL_ADDRESS
VOID EFIAPI EfiInitializeFwVolDevicepathNode(IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, IN CONST EFI_GUID *NameGuid)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)