]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciBusDxe: Refine code to make it more readable
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 20 Feb 2017 06:25:13 +0000 (14:25 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 21 Feb 2017 03:16:01 +0000 (11:16 +0800)
The patch doesn't impact functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c

index d9a83bee7c103ac2462a15a13fdefb51a4118f42..81171c82d9e21500ceaf25464d78d196904b02b2 100644 (file)
@@ -1341,7 +1341,6 @@ UpdatePciInfo (
 {\r
   EFI_STATUS                        Status;\r
   UINTN                             BarIndex;\r
-  UINTN                             BarEndIndex;\r
   BOOLEAN                           SetFlag;\r
   VOID                              *Configuration;\r
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;\r
@@ -1395,24 +1394,19 @@ UpdatePciInfo (
       break;\r
     }\r
 \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
-      Ptr++;\r
-      continue;\r
-    }\r
+    for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {\r
+      if ((Ptr->AddrTranslationOffset != MAX_UINT64) &&\r
+          (Ptr->AddrTranslationOffset != MAX_UINT8) &&\r
+          (Ptr->AddrTranslationOffset != BarIndex)\r
+          ) {\r
+        //\r
+        // Skip updating when AddrTranslationOffset is not MAX_UINT64 or MAX_UINT8 (wide match).\r
+        // Skip updating when current BarIndex doesn't equal to AddrTranslationOffset.\r
+        // Comparing against MAX_UINT8 is to keep backward compatibility.\r
+        //\r
+        continue;\r
+      }\r
 \r
-    for (; BarIndex <= BarEndIndex; BarIndex++) {\r
       SetFlag = FALSE;\r
       switch (Ptr->ResType) {\r
       case ACPI_ADDRESS_SPACE_TYPE_MEM:\r