public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Subject: [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure
Date: Thu, 16 Feb 2017 14:17:27 +0800	[thread overview]
Message-ID: <20170216061727.341364-1-ruiyu.ni@intel.com> (raw)

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>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
---
 .../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



             reply	other threads:[~2017-02-16  6:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16  6:17 Ruiyu Ni [this message]
2017-02-16  6:20 ` [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure Wu, Jiaxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170216061727.341364-1-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox