summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-03 08:13:16 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-03 08:13:16 +0000
commit0a9fe763390d9ba730e8bd0b017b0d51742543fb (patch)
treeb1de2938da02ed6b24fea4cfd7b53ef744a14e5c /MdeModulePkg/Core
parent00683bf4327d05929c9ff21684dc30268af4603c (diff)
downloadedk2-0a9fe763390d9ba730e8bd0b017b0d51742543fb.tar.gz
edk2-0a9fe763390d9ba730e8bd0b017b0d51742543fb.tar.bz2
edk2-0a9fe763390d9ba730e8bd0b017b0d51742543fb.zip
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
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.h1
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.inf1
-rw-r--r--MdeModulePkg/Core/Dxe/Image/ImageFile.c47
3 files changed, 49 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 1680e7d830..d499ab4850 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -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>
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf
index ead72162f8..9baef70b7e 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -110,6 +110,7 @@
gEfiLoadPeImageProtocolGuid ## PRODUCES
gEfiSimpleFileSystemProtocolGuid ## CONSUMES
gEfiLoadFileProtocolGuid ## CONSUMES
+ gEfiLoadFile2ProtocolGuid ## CONSUMES
gEfiResetArchProtocolGuid ## CONSUMES
gEfiRealTimeClockArchProtocolGuid ## CONSUMES
gEfiRuntimeArchProtocolGuid ## CONSUMES
diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c
index b132cf49d5..9c6729a8fd 100644
--- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c
+++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c
@@ -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