Add loaded Image device paths for EFI Drivers loaded from PCI Option ROM.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8022 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
gikidy 2009-04-03 08:13:16 +00:00
parent 00683bf432
commit 0a9fe76339
3 changed files with 49 additions and 0 deletions

View File

@ -25,6 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/DevicePath.h>
#include <Protocol/Runtime.h>
#include <Protocol/LoadFile.h>
#include <Protocol/LoadFile2.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/VariableWrite.h>
#include <Protocol/PlatformDriverOverride.h>

View File

@ -110,6 +110,7 @@
gEfiLoadPeImageProtocolGuid ## PRODUCES
gEfiSimpleFileSystemProtocolGuid ## CONSUMES
gEfiLoadFileProtocolGuid ## CONSUMES
gEfiLoadFile2ProtocolGuid ## CONSUMES
gEfiResetArchProtocolGuid ## CONSUMES
gEfiRealTimeClockArchProtocolGuid ## CONSUMES
gEfiRuntimeArchProtocolGuid ## CONSUMES

View File

@ -90,6 +90,7 @@ CoreOpenImageFile (
EFI_FILE_HANDLE FileHandle;
EFI_FILE_HANDLE LastHandle;
EFI_LOAD_FILE_PROTOCOL *LoadFile;
EFI_LOAD_FILE2_PROTOCOL *LoadFile2;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
EFI_SECTION_TYPE SectionType;
UINT8 *Pe32Buffer;
@ -315,6 +316,52 @@ CoreOpenImageFile (
}
}
//
// Try LoadFile2 style
//
if (!BootPolicy) {
TempFilePath = *FilePath;
Status = CoreDevicePathToInterface (
&gEfiLoadFile2ProtocolGuid,
&TempFilePath,
(VOID*)&LoadFile2,
DeviceHandle
);
if (!EFI_ERROR (Status)) {
//
// Call LoadFile2 with the correct buffer size
//
ASSERT (ImageFileHandle->SourceSize == 0);
ASSERT (ImageFileHandle->Source == NULL);
Status = LoadFile2->LoadFile (
LoadFile2,
TempFilePath,
BootPolicy,
&ImageFileHandle->SourceSize,
ImageFileHandle->Source
);
if (Status == EFI_BUFFER_TOO_SMALL) {
ImageFileHandle->Source = AllocatePool (ImageFileHandle->SourceSize);
if (ImageFileHandle->Source == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = LoadFile2->LoadFile (
LoadFile2,
TempFilePath,
BootPolicy,
&ImageFileHandle->SourceSize,
ImageFileHandle->Source
);
}
}
if (!EFI_ERROR (Status)) {
ImageFileHandle->FreeBuffer = TRUE;
goto Done;
}
}
}
//
// Try LoadFile style