From c0394e042457900c634fd7d69dcc59033b38d38a Mon Sep 17 00:00:00 2001 From: niruiyu Date: Thu, 23 Aug 2012 12:28:22 +0000 Subject: [PATCH] Fix the bug in PciBus driver to correct parse the 64bit BAR. Signed-off-by: Ruiyu Ni Reviewed-by: Rui Sun git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13673 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index 16f14ca2c8..a1627807e5 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 -- 2.39.2