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>
This commit is contained in:
Ruiyu Ni 2017-02-20 14:25:13 +08:00
parent 5422804653
commit 063bcff758
1 changed files with 12 additions and 18 deletions

View File

@ -1341,7 +1341,6 @@ UpdatePciInfo (
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN BarIndex; UINTN BarIndex;
UINTN BarEndIndex;
BOOLEAN SetFlag; BOOLEAN SetFlag;
VOID *Configuration; VOID *Configuration;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@ -1395,24 +1394,19 @@ UpdatePciInfo (
break; break;
} }
if ((Ptr->AddrTranslationOffset == MAX_UINT64) || (Ptr->AddrTranslationOffset == MAX_UINT8)) { for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
// if ((Ptr->AddrTranslationOffset != MAX_UINT64) &&
// Update all the bars in the device (Ptr->AddrTranslationOffset != MAX_UINT8) &&
// Compare against MAX_UINT8 is to keep backward compatibility. (Ptr->AddrTranslationOffset != BarIndex)
// ) {
BarIndex = 0; //
BarEndIndex = PCI_MAX_BAR - 1; // Skip updating when AddrTranslationOffset is not MAX_UINT64 or MAX_UINT8 (wide match).
} else { // Skip updating when current BarIndex doesn't equal to AddrTranslationOffset.
BarIndex = (UINTN) Ptr->AddrTranslationOffset; // Comparing against MAX_UINT8 is to keep backward compatibility.
BarEndIndex = BarIndex; //
} continue;
}
if (BarIndex >= PCI_MAX_BAR) {
Ptr++;
continue;
}
for (; BarIndex <= BarEndIndex; BarIndex++) {
SetFlag = FALSE; SetFlag = FALSE;
switch (Ptr->ResType) { switch (Ptr->ResType) {
case ACPI_ADDRESS_SPACE_TYPE_MEM: case ACPI_ADDRESS_SPACE_TYPE_MEM: