summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-23 12:28:22 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-23 12:28:22 +0000
commitc0394e042457900c634fd7d69dcc59033b38d38a (patch)
tree80e8b6400117bc9a59249521ce58d330e8a58d6b
parentf6f9031f8e95727c4947a41c202f133d98aed642 (diff)
Fix the bug in PciBus driver to correct parse the 64bit BAR.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Rui Sun<rui.sun@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13673 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 16f14ca2c..a1627807e 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1473,8 +1473,6 @@ PciIovParseVfBar (
UINT32 Value;
UINT32 OriginalValue;
UINT32 Mask;
- UINT32 Data;
- UINT8 Index;
EFI_STATUS Status;
//
@@ -1592,12 +1590,7 @@ PciIovParseVfBar (
//
// Fix the length to support some spefic 64 bit BAR
//
- Data = Value;
- Index = 0;
- for (Data = Value; Data != 0; Data >>= 1) {
- Index ++;
- }
- Value |= ((UINT32)(-1) << Index);
+ Value |= ((UINT32) -1 << HighBitSet32 (Value));
//
// Calculate the size of 64bit bar
@@ -1672,8 +1665,6 @@ PciParseBar (
UINT32 Value;
UINT32 OriginalValue;
UINT32 Mask;
- UINT32 Data;
- UINT8 Index;
EFI_STATUS Status;
OriginalValue = 0;
@@ -1810,12 +1801,7 @@ PciParseBar (
//
// Fix the length to support some spefic 64 bit BAR
//
- Data = Value;
- Index = 0;
- for (Data = Value; Data != 0; Data >>= 1) {
- Index ++;
- }
- Value |= ((UINT32)(-1) << Index);
+ Value |= ((UINT32)(-1) << HighBitSet32 (Value));
//
// Calculate the size of 64bit bar