summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Bus
diff options
context:
space:
mode:
authorajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-26 15:23:35 +0000
committerajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-26 15:23:35 +0000
commit2ce311322c72857f73138c45358e722607a1e80c (patch)
treefc382467b7924a9fa6c2d80132beae70207f4b0e /EdkModulePkg/Bus
parentdca84bbd419fdeaa8cf26ad4ab95e6f37588ea0b (diff)
downloadedk2-platforms-2ce311322c72857f73138c45358e722607a1e80c.tar.xz
Removed cross references from PciCf8Lib and PciExpressLib class to PciLib class.
Added PeCoffLoaderGetMachineType to the PeCoffGetEntryPointLibrary Class. Document to be updated. Added the PeCoffLoaderImageReadFromMemory() and PeCoffLoaderRelocateImageForRuntime () to the PcCoffLib. Updated EfiImage.h and removed EFI_IMAGE_OPTIONAL_HEADER and EFI_IMAGE_NT_HEADERS as they were replaced with checking the MachineType. PeCoffLib – Added checks for MachineType so the PeCoff lib can load any PE32 or PE32+ image. The relocations are still limited to IA32, X64, IPF, and EBC. I also added a re-relocator function to remove PeLoader Code from Runtime Lib. Even though there is only one instance of the re-relocator I wanted to get all the PeCoff loader code together. Replaced DEBUG_CODE() macro with DEBUG_CODE_START() and DEBUG_CODE_END() so you can debug through the DEBUG_CODE() macros. Also removed PE/COFF code and replaced with library usage. I also updated the IO Instrinsic lib to use _ReadWriteBarrior() to help with sync problems git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1103 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Bus')
-rw-r--r--EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c132
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c120
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa21
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c11
4 files changed, 132 insertions, 152 deletions
diff --git a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c b/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
index 1bdce40f67..e48cf73235 100644
--- a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
+++ b/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
@@ -2085,94 +2085,90 @@ AtapiPassThruCheckErrorStatus (
)
{
UINT8 StatusRegister;
-
-//#ifdef EFI_DEBUG
-
UINT8 ErrorRegister;
-//#endif
-
StatusRegister = ReadPortB (
AtapiScsiPrivate->PciIo,
AtapiScsiPrivate->IoPort->Reg.Status
);
- DEBUG_CODE (
+
+ DEBUG_CODE_BEGIN ();
if (StatusRegister & DWF) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Write Fault\n",
- StatusRegister)
- );
- }
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Write Fault\n",
+ StatusRegister)
+ );
+ }
- if (StatusRegister & CORR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Corrected Data\n",
- StatusRegister)
- );
- }
+ if (StatusRegister & CORR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Corrected Data\n",
+ StatusRegister)
+ );
+ }
- if (StatusRegister & ERR) {
- ErrorRegister = ReadPortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Reg1.Error);
+ if (StatusRegister & ERR) {
+ ErrorRegister = ReadPortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Reg1.Error);
+
- if (ErrorRegister & BBK_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Bad Block Detected\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & BBK_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Bad Block Detected\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & UNC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Uncorrectable Data\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & UNC_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Uncorrectable Data\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & MC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Media Change\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & MC_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Media Change\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & ABRT_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Abort\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & ABRT_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Abort\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & TK0NF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Track 0 Not Found\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & TK0NF_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Track 0 Not Found\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & AMNF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Address Mark Not Found\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & AMNF_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "AtapiPassThruCheckErrorStatus()-- %02x : Error : Address Mark Not Found\n",
+ ErrorRegister)
+ );
+ }
+ }
- }
- );
+ DEBUG_CODE_END ();
if ((StatusRegister & (ERR | DWF | CORR)) == 0) {
-
return EFI_SUCCESS;
}
+
return EFI_DEVICE_ERROR;
-
-}
+} \ No newline at end of file
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
index 9a1542d0ea..cb184a497d 100644
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
+++ b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
@@ -640,77 +640,77 @@ CheckErrorStatus (
StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
- DEBUG_CODE (
+ DEBUG_CODE_BEGIN ();
if (StatusRegister & DWF) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Write Fault\n",
- StatusRegister)
- );
- }
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Write Fault\n",
+ StatusRegister)
+ );
+ }
- if (StatusRegister & CORR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Corrected Data\n",
- StatusRegister)
- );
- }
+ if (StatusRegister & CORR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Corrected Data\n",
+ StatusRegister)
+ );
+ }
- if (StatusRegister & ERR) {
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
+ if (StatusRegister & ERR) {
+ ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if (ErrorRegister & BBK_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Bad Block Detected\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & BBK_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Bad Block Detected\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & UNC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Uncorrectable Data\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & UNC_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Uncorrectable Data\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & MC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Media Change\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & MC_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Media Change\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & ABRT_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Abort\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & ABRT_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Abort\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & TK0NF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Track 0 Not Found\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & TK0NF_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Track 0 Not Found\n",
+ ErrorRegister)
+ );
+ }
- if (ErrorRegister & AMNF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Address Mark Not Found\n",
- ErrorRegister)
- );
- }
+ if (ErrorRegister & AMNF_ERR) {
+ DEBUG (
+ (EFI_D_BLKIO,
+ "CheckErrorStatus()-- %02x : Error : Address Mark Not Found\n",
+ ErrorRegister)
+ );
+ }
+ }
- }
- );
+ DEBUG_CODE_END ();
if ((StatusRegister & (ERR | DWF | CORR)) == 0) {
return EFI_SUCCESS;
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
index 182baa7c6b..c6194d6aa8 100644
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
+++ b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
@@ -1,23 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
+<?xml version="1.0" encoding="UTF-8"?>
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>PciBus</ModuleName>
<ModuleType>DXE_DRIVER</ModuleType>
<GuidValue>93B80004-9FB3-11d4-9A3A-0090273FC14D</GuidValue>
<Version>1.0</Version>
<Abstract>Component description file for PciBus module.</Abstract>
- <Description>
- PCI bus driver. This module will probe all PCI devices and allocate MMIO and IO
- space for these devices.
- </Description>
+ <Description>PCI bus driver. This module will probe all PCI devices and allocate MMIO and IO
+ space for these devices.</Description>
<Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
<License>All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -63,6 +53,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DevicePathLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>PeCoffGetEntryPointLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>PciBus.h</Filename>
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
index 76c5a20784..cd2d585303 100644
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
+++ b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
@@ -139,8 +139,6 @@ Returns:
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_NT_HEADERS *PeHdr;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
PCI_DRIVER_OVERRIDE_LIST *Node;
EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
@@ -169,14 +167,7 @@ Returns:
PciIoDevice->BusOverride = TRUE;
- DosHdr = (EFI_IMAGE_DOS_HEADER *) LoadedImage->ImageBase;
- if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- return EFI_SUCCESS;
- }
-
- PeHdr = (EFI_IMAGE_NT_HEADERS *) ((UINTN) LoadedImage->ImageBase + DosHdr->e_lfanew);
-
- if (PeHdr->FileHeader.Machine != EFI_IMAGE_MACHINE_EBC) {
+ if (PeCoffLoaderGetMachineType ((VOID *)(UINTN)LoadedImage->ImageBase) != EFI_IMAGE_MACHINE_EBC) {
return EFI_SUCCESS;
}