summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-06 03:52:01 +0000
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-06 03:52:01 +0000
commitd8b61daacca489c69b3f21d2f8d6bd6e33e16e13 (patch)
tree74d1e5fc68cd78f74e38951d4b753ed54525f73d /MdeModulePkg
parent38d64b32506f653abe2decc05b5bd90d524d028f (diff)
downloadedk2-d8b61daacca489c69b3f21d2f8d6bd6e33e16e13.zip
edk2-d8b61daacca489c69b3f21d2f8d6bd6e33e16e13.tar.gz
edk2-d8b61daacca489c69b3f21d2f8d6bd6e33e16e13.tar.bz2
Fix bug in PciCfg to support PCI express address.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3549 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf1
-rw-r--r--MdeModulePkg/MdeModulePkg.dsc2
-rw-r--r--MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c32
3 files changed, 24 insertions, 11 deletions
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 05ece78..77991e9 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -67,7 +67,6 @@
BaseMemoryLib
PeiServicesTablePointerLib
CustomDecompressLib
- TianoDecompressLib
UefiDecompressLib
PeCoffLoaderLib
CacheMaintenanceLib
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 4f2d8bf..e19e463 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -79,7 +79,7 @@
ReportStatusCodeLib|IntelFrameworkPkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
- SmBusLib|MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.inf
+ SmBusLib|MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf
[LibraryClasses.common.DXE_CORE]
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
diff --git a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c
index cab5512..3542bdd 100644
--- a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c
+++ b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c
@@ -22,13 +22,27 @@
#include <IndustryStandard\Pci.h>
-#define COMMON_TO_PCILIB_ADDRESS(A) (UINTN)PCI_LIB_ADDRESS( \
- ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &A)->Bus, \
- ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &A)->Device, \
- ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &A)->Function, \
- ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &A)->Register \
- )
+/**
+ Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.
+ @param Address PCI address with
+ EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.
+
+ @return The PCI address with PCI_LIB_ADDRESS format.
+
+**/
+STATIC
+UINTN
+PciCfgAddressConvert (
+ EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address
+ )
+{
+ if (Address->ExtendedRegister == 0) {
+ return PCI_LIB_ADDRESS (Address->Bus, Address->Device, Address->Function, Address->Register);
+ }
+
+ return PCI_LIB_ADDRESS (Address->Bus, Address->Device, Address->Function, Address->ExtendedRegister);
+}
/**
Reads from a given location in the PCI configuration space.
@@ -206,7 +220,7 @@ PciCfg2Read (
{
UINTN PciLibAddress;
- PciLibAddress = COMMON_TO_PCILIB_ADDRESS (Address);
+ PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);
if (Width == EfiPeiPciCfgWidthUint8) {
*((UINT8 *) Buffer) = PciRead8 (PciLibAddress);
@@ -257,7 +271,7 @@ PciCfg2Write (
{
UINTN PciLibAddress;
- PciLibAddress = COMMON_TO_PCILIB_ADDRESS (Address);
+ PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);
if (Width == EfiPeiPciCfgWidthUint8) {
PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));
@@ -315,7 +329,7 @@ PciCfg2Modify (
{
UINTN PciLibAddress;
- PciLibAddress = COMMON_TO_PCILIB_ADDRESS (Address);
+ PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);
if (Width == EfiPeiPciCfgWidthUint8) {
PciAndThenOr8 (PciLibAddress, ~(*(UINT8 *)ClearBits), *((UINT8 *) SetBits));