public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/PciBusDxe: Refine code to make it more readable
@ 2017-02-20  6:25 Ruiyu Ni
  2017-02-20  6:38 ` Wu, Hao A
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-02-20  6:25 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao A Wu

The patch doesn't impact functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
---
 .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c       | 24 ++++++++--------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index d9a83be..00b6622 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1341,7 +1341,6 @@ UpdatePciInfo (
 {
   EFI_STATUS                        Status;
   UINTN                             BarIndex;
-  UINTN                             BarEndIndex;
   BOOLEAN                           SetFlag;
   VOID                              *Configuration;
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@@ -1395,24 +1394,19 @@ UpdatePciInfo (
       break;
     }
 
-    if ((Ptr->AddrTranslationOffset == MAX_UINT64) || (Ptr->AddrTranslationOffset == MAX_UINT8)) {
+    for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
+      if ((Ptr->AddrTranslationOffset != MAX_UINT64) &&
+          (Ptr->AddrTranslationOffset != MAX_UINT8) &&
+          (Ptr->AddrTranslationOffset != BarIndex)
+          ) {
       //
-      // Update all the bars in the device
+      // Skip updating when AddrTranslationOffset is MAX_UINT64 or MAX_UINT8 (wide match).
+      // SKip updating when current BarIndex doesn't equal to AddrTranslationOffset.
       // 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) {
-      Ptr++;
-      continue;
-    }
+        continue;
+      }
 
-    for (; BarIndex <= BarEndIndex; BarIndex++) {
       SetFlag = FALSE;
       switch (Ptr->ResType) {
       case ACPI_ADDRESS_SPACE_TYPE_MEM:
-- 
2.9.0.windows.1



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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-20  6:25 [PATCH] MdeModulePkg/PciBusDxe: Refine code to make it more readable Ruiyu Ni
2017-02-20  6:38 ` Wu, Hao A

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