Re: [PATCH v4 8/9] ArmVirtPkg/FdtPciHostBridgeLib: Refactor GetRootBridges() / FreeRootBridges()


Laszlo Ersek
 

On 01/12/21 10:45, Jiahui Cen via groups.io wrote:
Rebase ArmVirtPkg/FdtPciHostBridgeLib with the new
PciHostBridgeUtilityGetRootBridges() / PciHostBridgeUtilityFreeRootBridges()
functions.
(1) This commit message is utterly useless.

This is the patch where the entire series culminates -- where you
actually bring pxb support to ArmVirtPkg. Do you think you should
perhaps elaborate on the *WHOLE GOAL* of this series, in this commit
message?


BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Yubo Miao <miaoyubo@huawei.com>
---
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 95166d18c82d..89582ef76eb3 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -272,8 +272,6 @@ ProcessPciHost (
return Status;
}

-STATIC PCI_ROOT_BRIDGE mRootBridge;
-
/**
Return all the root bridge instances in an array.

@@ -361,8 +359,10 @@ PciHostBridgeGetRootBridges (
PMemAbove4G.Base = MAX_UINT64;
PMemAbove4G.Limit = 0;

- Status = PciHostBridgeUtilityInitRootBridge (
- Attributes,
+ *Count = 0;
(2) As noted earlier, this assignment should be pushed down into
PciHostBridgeUtilityGetRootBridges().

Thanks
Laszlo

+
+ return PciHostBridgeUtilityGetRootBridges (
+ Count,
Attributes,
AllocationAttributes,
TRUE,
@@ -373,19 +373,8 @@ PciHostBridgeGetRootBridges (
&Mem,
&MemAbove4G,
&PMem,
- &PMemAbove4G,
- &mRootBridge
+ &PMemAbove4G
);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "%a: failed to initialize PCI host bridge: %r\n",
- __FUNCTION__, Status));
- *Count = 0;
- return NULL;
- }
-
- *Count = 1;
-
- return &mRootBridge;
}

/**
@@ -402,8 +391,7 @@ PciHostBridgeFreeRootBridges (
UINTN Count
)
{
- ASSERT (Count == 1);
- PciHostBridgeUtilityUninitRootBridge (Bridges);
+ PciHostBridgeUtilityFreeRootBridges (Bridges, Count);
}

/**

Join devel@edk2.groups.io to automatically receive all group messages.