summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-05 19:32:40 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-05 19:32:40 +0000
commit2fb718b0641735e130baf677d19cb0c046c4f908 (patch)
treea3bd1555193e32ab09f2492a89b0228c94dc3e99 /IntelFrameworkModulePkg
parente8ba34ff3dfb888f86d62ad229c6c5d624f56135 (diff)
downloadedk2-platforms-2fb718b0641735e130baf677d19cb0c046c4f908.tar.xz
Update PCI Bus Driver to use the PeCoffLib instead of paring the PE/COFF image itself
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7440 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h1
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf2
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c18
3 files changed, 13 insertions, 8 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
index 74a4abf4df..2c09061695 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
@@ -45,6 +45,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>
#include <Library/PciIncompatibleDeviceSupportLib.h>
+#include <Library/PeCoffLib.h>
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/PeImage.h>
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
index 3c8b63cd78..8fa69ec729 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
@@ -86,7 +86,7 @@
BaseLib
UefiDriverEntryPoint
DebugLib
-
+ PeCoffLib
[Guids]
gEfiPciOptionRomTableGuid # SOMETIMES_CONSUMED System Table
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c
index 6c9d6f8079..6ec208453e 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c
@@ -101,9 +101,8 @@ AddDriver (
)
{
EFI_STATUS Status;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_NT_HEADERS *PeHdr;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
PCI_DRIVER_OVERRIDE_LIST *Node;
Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
@@ -123,16 +122,21 @@ AddDriver (
PciIoDevice->BusOverride = TRUE;
- DosHdr = (EFI_IMAGE_DOS_HEADER *) LoadedImage->ImageBase;
- if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ ImageContext.Handle = LoadedImage->ImageBase;
+ ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
+
+ //
+ // Get information about the image
+ //
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
- PeHdr = (EFI_IMAGE_NT_HEADERS *) ((UINTN) LoadedImage->ImageBase + DosHdr->e_lfanew);
-
- if (PeHdr->FileHeader.Machine != EFI_IMAGE_MACHINE_EBC) {
+ if (ImageContext.Machine != EFI_IMAGE_MACHINE_EBC) {
return EFI_SUCCESS;
}
+
return EFI_SUCCESS;
}