MdeModulePkg/PciBusDxe: Fix IA32 build failure

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 <ruiyu.ni@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
Ruiyu Ni 2017-02-16 14:01:53 +08:00
parent 958163561e
commit eb470e05a3
1 changed files with 10 additions and 10 deletions

View File

@ -1340,8 +1340,8 @@ UpdatePciInfo (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT64 BarIndex; UINTN BarIndex;
UINT64 BarEndIndex; UINTN BarEndIndex;
BOOLEAN SetFlag; BOOLEAN SetFlag;
VOID *Configuration; VOID *Configuration;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@ -1395,16 +1395,16 @@ UpdatePciInfo (
break; break;
} }
BarIndex = Ptr->AddrTranslationOffset; if ((Ptr->AddrTranslationOffset == MAX_UINT64) || (Ptr->AddrTranslationOffset == MAX_UINT8)) {
BarEndIndex = BarIndex; //
// Update all the bars in the device
// // Compare against MAX_UINT8 is to keep backward compatibility.
// Update all the bars in the device //
// Compare against 0xFF is to keep backward compatibility.
//
if ((BarIndex == MAX_UINT64) || (BarIndex == 0xFF)) {
BarIndex = 0; BarIndex = 0;
BarEndIndex = PCI_MAX_BAR - 1; BarEndIndex = PCI_MAX_BAR - 1;
} else {
BarIndex = (UINTN) Ptr->AddrTranslationOffset;
BarEndIndex = BarIndex;
} }
if (BarIndex >= PCI_MAX_BAR) { if (BarIndex >= PCI_MAX_BAR) {