summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-02-20 14:25:13 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-02-21 11:16:01 +0800
commit063bcff758e9d078dcaa6acfd2476a97176393ea (patch)
tree3857cb647943f874a874db6bf611bcf95f99f200 /MdeModulePkg/Bus
parent54228046533720f0e8282be15eea7aafaf0cd0d6 (diff)
downloadedk2-063bcff758e9d078dcaa6acfd2476a97176393ea.zip
edk2-063bcff758e9d078dcaa6acfd2476a97176393ea.tar.gz
edk2-063bcff758e9d078dcaa6acfd2476a97176393ea.tar.bz2
MdeModulePkg/PciBusDxe: Refine code to make it more readable
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>
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index d9a83be..81171c8 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)) {
- //
- // 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) {
- Ptr++;
- continue;
- }
+ for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
+ if ((Ptr->AddrTranslationOffset != MAX_UINT64) &&
+ (Ptr->AddrTranslationOffset != MAX_UINT8) &&
+ (Ptr->AddrTranslationOffset != BarIndex)
+ ) {
+ //
+ // Skip updating when AddrTranslationOffset is not MAX_UINT64 or MAX_UINT8 (wide match).
+ // Skip updating when current BarIndex doesn't equal to AddrTranslationOffset.
+ // Comparing against MAX_UINT8 is to keep backward compatibility.
+ //
+ continue;
+ }
- for (; BarIndex <= BarEndIndex; BarIndex++) {
SetFlag = FALSE;
switch (Ptr->ResType) {
case ACPI_ADDRESS_SPACE_TYPE_MEM: