]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciBusDxe: Fix IA32 build failure
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 16 Feb 2017 06:01:53 +0000 (14:01 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 17 Feb 2017 08:59:50 +0000 (16:59 +0800)
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>
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c

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