From nobody Sat Nov 2 14:28:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487571947465193.47876304996487; Sun, 19 Feb 2017 22:25:47 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 39763821CB; Sun, 19 Feb 2017 22:25:46 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AD0B882154 for ; Sun, 19 Feb 2017 22:25:45 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2017 22:25:45 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 19 Feb 2017 22:25:44 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="227372070" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 20 Feb 2017 14:25:42 +0800 Message-Id: <20170220062542.456028-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg/PciBusDxe: Refine code to make it more readable X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao A Wu MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch doesn't impact functionality. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Hao A Wu Reviewed-by: Hao Wu --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 24 ++++++++----------= ---- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/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; } =20 - if ((Ptr->AddrTranslationOffset =3D=3D MAX_UINT64) || (Ptr->AddrTransl= ationOffset =3D=3D MAX_UINT8)) { + for (BarIndex =3D 0; BarIndex < PCI_MAX_BAR; BarIndex++) { + if ((Ptr->AddrTranslationOffset !=3D MAX_UINT64) && + (Ptr->AddrTranslationOffset !=3D MAX_UINT8) && + (Ptr->AddrTranslationOffset !=3D BarIndex) + ) { // - // Update all the bars in the device + // Skip updating when AddrTranslationOffset is MAX_UINT64 or MAX_UIN= T8 (wide match). + // SKip updating when current BarIndex doesn't equal to AddrTranslat= ionOffset. // Compare against MAX_UINT8 is to keep backward compatibility. // - BarIndex =3D 0; - BarEndIndex =3D PCI_MAX_BAR - 1; - } else { - BarIndex =3D (UINTN) Ptr->AddrTranslationOffset; - BarEndIndex =3D BarIndex; - } - - if (BarIndex >=3D PCI_MAX_BAR) { - Ptr++; - continue; - } + continue; + } =20 - for (; BarIndex <=3D BarEndIndex; BarIndex++) { SetFlag =3D FALSE; switch (Ptr->ResType) { case ACPI_ADDRESS_SPACE_TYPE_MEM: --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel