From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7933A820F7 for ; Wed, 15 Feb 2017 22:17:30 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 15 Feb 2017 22:17:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,168,1484035200"; d="scan'208";a="225933882" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 15 Feb 2017 22:17:29 -0800 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Jiaxin Wu Date: Thu, 16 Feb 2017 14:17:27 +0800 Message-Id: <20170216061727.341364-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 06:17:30 -0000 Compiler calculates the PciBar[BarIndex] using sizeof (PciBar[0]) * BarIndex, when BarIndex is type of UINT64, the above calculation generates assembly code using _allmul. Change BarIndex to UINTN to avoid the build failure. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Jiaxin Wu --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index ecda088..d9a83be 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1340,8 +1340,8 @@ UpdatePciInfo ( ) { EFI_STATUS Status; - UINT64 BarIndex; - UINT64 BarEndIndex; + UINTN BarIndex; + UINTN BarEndIndex; BOOLEAN SetFlag; VOID *Configuration; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr; @@ -1395,16 +1395,16 @@ UpdatePciInfo ( break; } - BarIndex = Ptr->AddrTranslationOffset; - BarEndIndex = BarIndex; - - // - // Update all the bars in the device - // Compare against 0xFF is to keep backward compatibility. - // - if ((BarIndex == MAX_UINT64) || (BarIndex == 0xFF)) { + if ((Ptr->AddrTranslationOffset == MAX_UINT64) || (Ptr->AddrTranslationOffset == MAX_UINT8)) { + // + // Update all the bars in the device + // Compare against MAX_UINT8 is to keep backward compatibility. + // BarIndex = 0; BarEndIndex = PCI_MAX_BAR - 1; + } else { + BarIndex = (UINTN) Ptr->AddrTranslationOffset; + BarEndIndex = BarIndex; } if (BarIndex >= PCI_MAX_BAR) { -- 2.9.0.windows.1