summaryrefslogtreecommitdiff
path: root/DuetPkg/PciBusNoEnumerationDxe
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-05 19:31:45 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-05 19:31:45 +0000
commite8ba34ff3dfb888f86d62ad229c6c5d624f56135 (patch)
tree82a6558f48a732ea948a51a777427a58053b0def /DuetPkg/PciBusNoEnumerationDxe
parent4ab0dff3381de97cbecd8ec48d68c7bacfea1fb3 (diff)
downloadedk2-platforms-e8ba34ff3dfb888f86d62ad229c6c5d624f56135.tar.xz
Update DUET PCI Bus Driver to use PeCoffLib instead of parsing the PE/COFF image itself
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7439 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'DuetPkg/PciBusNoEnumerationDxe')
-rw-r--r--DuetPkg/PciBusNoEnumerationDxe/PciBus.h2
-rw-r--r--DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf1
-rw-r--r--DuetPkg/PciBusNoEnumerationDxe/PciDriverOverride.c18
3 files changed, 13 insertions, 8 deletions
diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciBus.h b/DuetPkg/PciBusNoEnumerationDxe/PciBus.h
index edc1eaf7b9..e83f32d7bf 100644
--- a/DuetPkg/PciBusNoEnumerationDxe/PciBus.h
+++ b/DuetPkg/PciBusNoEnumerationDxe/PciBus.h
@@ -50,7 +50,7 @@ Revision History
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>
-
+#include <Library/PeCoffLib.h>
//
// Driver Produced Protocol Prototypes
diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf b/DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf
index 6128da37d4..5ad324d3e3 100644
--- a/DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf
+++ b/DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf
@@ -39,6 +39,7 @@
BaseMemoryLib
ReportStatusCodeLib
DevicePathLib
+ PeCoffLib
[Sources]
PciBus.h
diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciDriverOverride.c b/DuetPkg/PciBusNoEnumerationDxe/PciDriverOverride.c
index 67de1392f7..17bf212a19 100644
--- a/DuetPkg/PciBusNoEnumerationDxe/PciDriverOverride.c
+++ b/DuetPkg/PciBusNoEnumerationDxe/PciDriverOverride.c
@@ -135,9 +135,8 @@ Returns:
{
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;
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
@@ -167,14 +166,19 @@ Returns:
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;
}