From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mx.groups.io with SMTP id smtpd.web08.6256.1610534047211932749 for ; Wed, 13 Jan 2021 02:34:07 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.191, mailfrom: cenjiahui@huawei.com) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DG3fq1tYfzMHTD; Wed, 13 Jan 2021 18:32:35 +0800 (CST) Received: from localhost (10.174.184.155) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Wed, 13 Jan 2021 18:33:45 +0800 From: "Jiahui Cen" To: CC: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Rebecca Cran , Peter Grehan , Anthony Perard , Julien Grall , Leif Lindholm , Sami Mujawar , , , Jiahui Cen , Yubo Miao Subject: [PATCH v5 09/10] ArmVirtPkg/FdtPciHostBridgeLib: Refactor Get/FreeRootBridges() Date: Wed, 13 Jan 2021 18:33:30 +0800 Message-ID: <20210113103331.10375-10-cenjiahui@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210113103331.10375-1-cenjiahui@huawei.com> References: <20210113103331.10375-1-cenjiahui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.184.155] X-CFilter-Loop: Reflected Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Rebase ArmVirtPkg/FdtPciHostBridgeLib to the new PciHostBridgeUtilityGetRootBridges()/PciHostBridgeUtilityFreeRootBridges(= ) functions. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3059 Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Jiahui Cen Signed-off-by: Yubo Miao --- ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 24 +++++-= -------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c= b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c index 3ec7992b6331..89582ef76eb3 100644 --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c +++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c @@ -272,8 +272,6 @@ ProcessPciHost ( return Status; } =20 -STATIC PCI_ROOT_BRIDGE mRootBridge; - /** Return all the root bridge instances in an array. =20 @@ -361,8 +359,10 @@ PciHostBridgeGetRootBridges ( PMemAbove4G.Base =3D MAX_UINT64; PMemAbove4G.Limit =3D 0; =20 - Status =3D PciHostBridgeUtilityInitRootBridge ( - Attributes, + *Count =3D 0; + + return PciHostBridgeUtilityGetRootBridges ( + Count, Attributes, AllocationAttributes, TRUE, @@ -373,19 +373,8 @@ PciHostBridgeGetRootBridges ( &Mem, &MemAbove4G, &PMem, - &PMemAbove4G, - &mRootBridge + &PMemAbove4G ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: failed to initialize PCI host bridge: %r\n= ", - __FUNCTION__, Status)); - *Count =3D 0; - return NULL; - } - - *Count =3D 1; - - return &mRootBridge; } =20 /** @@ -402,8 +391,7 @@ PciHostBridgeFreeRootBridges ( UINTN Count ) { - ASSERT (Count =3D=3D 1); - PciHostBridgeUtilityUninitRootBridge (Bridges); + PciHostBridgeUtilityFreeRootBridges (Bridges, Count); } =20 /** --=20 2.29.2