public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure
@ 2017-02-16  6:17 Ruiyu Ni
  2017-02-16  6:20 ` Wu, Jiaxin
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-02-16  6:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jiaxin Wu

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure
  2017-02-16  6:17 [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure Ruiyu Ni
@ 2017-02-16  6:20 ` Wu, Jiaxin
  0 siblings, 0 replies; 2+ messages in thread
From: Wu, Jiaxin @ 2017-02-16  6:20 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org

Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>



> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Thursday, February 16, 2017 2:17 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [PATCH] 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>
> 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-16  6:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-16  6:17 [PATCH] MdeModulePkg/PciBusDxe: Fix IA32 build failure Ruiyu Ni
2017-02-16  6:20 ` Wu, Jiaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox