From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.959.1589351518531299375 for ; Tue, 12 May 2020 23:31:58 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) IronPort-SDR: 1/7eQVOugHnR67DHGtmn/TJRChc9wnaXWEzQ19MaYsyWTKUqTmdKTA5U2sy0FyegCdMf6AI0aT dL4xxzIqeCTQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 23:31:57 -0700 IronPort-SDR: nJbTA2WUv/iiWwPP0l7I4YBLM1XytpR0sXFlszBgZMuFLQFX+3F41rjQghJCKAbhjl40KOV5Bm 49uP6hEFjUVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,386,1583222400"; d="scan'208";a="253105599" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga008.fm.intel.com with ESMTP; 12 May 2020 23:31:57 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 23:31:57 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 23:31:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.210]) by shsmsx102.ccr.corp.intel.com ([169.254.2.38]) with mapi id 14.03.0439.000; Wed, 13 May 2020 14:31:53 +0800 From: "Ni, Ray" To: "Javeed, Ashraf" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Wu, Hao A" Subject: Re: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 04/15] MdeModulePkg/PciBusDxe: Refactor the PCIe Bridge enable Thread-Topic: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 04/15] MdeModulePkg/PciBusDxe: Refactor the PCIe Bridge enable Thread-Index: AQHWJuYUJe62JSGvi0ytnelqFKTApKig+CCAgASaCWA= Date: Wed, 13 May 2020 06:31:53 +0000 Deferred-Delivery: Wed, 13 May 2020 06:31:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C53AD1D@SHSMSX104.ccr.corp.intel.com> References: <20200510161412.13832-1-ashraf.javeed@intel.com> <20200510161412.13832-5-ashraf.javeed@intel.com> In-Reply-To: <20200510161412.13832-5-ashraf.javeed@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Javeed, Ashraf > Sent: Monday, May 11, 2020 12:14 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Wang, Jian J ; Wu,= Hao A > Subject: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 04/15] MdeModulePkg/PciBu= sDxe: Refactor the PCIe Bridge enable >=20 > REF: > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1954 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2194 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2313 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2499 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2500 >=20 > Refactor the PCIe Bridge enabling code. >=20 > Signed-off-by: Ashraf Javeed > Signed-off-by: Ray Ni > Cc: Jian J Wang > Cc: Hao A Wu > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 70 +++++++++++++++++= +++-------------------------------------------------- > 1 file changed, 20 insertions(+), 50 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModul= ePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > index 5724fd6..62ef184 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > @@ -597,52 +597,36 @@ DeRegisterPciDevice ( > } >=20 > /** > - Start the PCI root Ports or PCI-PCI Bridge only. > + Enable all the PCI bridges under the specified root bridge or PCI-PCI = Bridge. >=20 > - @param Controller The root bridge handle. > - @param RootBridge A pointer to the PCI_IO_DEVICE. > - @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL. > - @param NumberOfChildren Children number. > - @param ChildHandleBuffer A pointer to the child handle buffer. > - > - @retval EFI_NOT_READY Device is not allocated. > - @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge. > - @retval EFI_NOT_FOUND Can not find the specific device. > - @retval EFI_SUCCESS Success to start Pci devices on bridge. > + @param Bridge A pointer to the PCI_IO_DEVICE. >=20 > **/ > -EFI_STATUS > +VOID > EnablePciBridges ( > - IN EFI_HANDLE Controller, > - IN PCI_IO_DEVICE *RootBridge > + IN PCI_IO_DEVICE *Bridge > ) >=20 > { > PCI_IO_DEVICE *PciIoDevice; > - EFI_STATUS Status; > - LIST_ENTRY *CurrentLink; > + LIST_ENTRY *Link; > UINT64 Supports; >=20 > - PciIoDevice =3D NULL; > - CurrentLink =3D RootBridge->ChildList.ForwardLink; > - > - while (CurrentLink !=3D NULL && CurrentLink !=3D &RootBridge->ChildLis= t) { > - > - PciIoDevice =3D PCI_IO_DEVICE_FROM_LINK (CurrentLink); > - > + for ( Link =3D GetFirstNode (&Bridge->ChildList) > + ; !IsNull (&Bridge->ChildList, Link) > + ; Link =3D GetNextNode (&Bridge->ChildList, Link) > + ) { > + PciIoDevice =3D PCI_IO_DEVICE_FROM_LINK (Link); > // > - // check if the device has been assigned with required resource > - // and registered > + // Skip the device hasn't been assigned with required resource > + // or registered. > // > - if (!PciIoDevice->Registered && !PciIoDevice->Allocated) { > - return EFI_NOT_READY; > + if (!PciIoDevice->Registered || !PciIoDevice->Allocated) { > + continue; > } >=20 > if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) { > - Status =3D EnablePciBridges ( > - Controller, > - PciIoDevice > - ); > + EnablePciBridges (PciIoDevice); >=20 > PciIoDevice->PciIo.Attributes ( > &(PciIoDevice->PciIo), > @@ -650,27 +634,17 @@ EnablePciBridges ( > 0, > &Supports > ); > - Supports &=3D (UINT64)EFI_PCI_DEVICE_ENABLE; > + Supports &=3D (UINT64) EFI_PCI_DEVICE_ENABLE; > PciIoDevice->PciIo.Attributes ( > &(PciIoDevice->PciIo), > EfiPciIoAttributeOperationEnable, > Supports, > NULL > ); > - > } > - > - CurrentLink =3D CurrentLink->ForwardLink; > - } > - > - if (PciIoDevice =3D=3D NULL) { > - return EFI_NOT_FOUND; > - } else { > - return EFI_SUCCESS; > } > } >=20 > - > /** > Register to manage the PCI device on the specified root bridge or PCI-= PCI Bridge. >=20 > @@ -851,9 +825,7 @@ StartPciDevicesOnBridge ( > ChildHandleBuffer > ); >=20 > - if (EFI_ERROR (Status)) { > - return Status; > - } else { > + if (!EFI_ERROR (Status)) { > // > // the late configuration of PCI Express features > // the platform is required to indicate its requirement for the init= ialization > @@ -861,13 +833,11 @@ StartPciDevicesOnBridge ( > // >=20 > // > - // finally start those PCI bridge port devices only > + // finally enable those PCI bridges > // > - return EnablePciBridges ( > - Controller, > - RootBridge > - ); > + EnablePciBridges (RootBridge); > } > + return Status; > } >=20 > /** > -- > 2.21.0.windows.1