[edk2-devel] [PATCH v4 8/9] ArmVirtPkg/FdtPciHostBridgeLib: Refactor GetRootBridges() / FreeRootBridges()

Jiahui Cen via groups.io posted 9 patches 5 years ago
There is a newer version of this series
[edk2-devel] [PATCH v4 8/9] ArmVirtPkg/FdtPciHostBridgeLib: Refactor GetRootBridges() / FreeRootBridges()
Posted by Jiahui Cen via groups.io 5 years ago
Rebase ArmVirtPkg/FdtPciHostBridgeLib with the new
PciHostBridgeUtilityGetRootBridges() / PciHostBridgeUtilityFreeRootBridges()
functions.

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;
+
+  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);
 }
 
 /**
-- 
2.29.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70153): https://edk2.groups.io/g/devel/message/70153
Mute This Topic: https://groups.io/mt/79619796/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v4 8/9] ArmVirtPkg/FdtPciHostBridgeLib: Refactor GetRootBridges() / FreeRootBridges()
Posted by Laszlo Ersek 5 years ago
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);
>  }
>  
>  /**
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70280): https://edk2.groups.io/g/devel/message/70280
Mute This Topic: https://groups.io/mt/79619796/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v4 8/9] ArmVirtPkg/FdtPciHostBridgeLib: Refactor GetRootBridges() / FreeRootBridges()
Posted by Jiahui Cen via groups.io 5 years ago
Hi Laszlo,

On 2021/1/14 19:01, Laszlo Ersek wrote:
> 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?
> 

Right, I will add some more detailed commit message.

Thanks,
Jiahui

>>
>> 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);
>>  }
>>  
>>  /**
>>
> 
> 
> 
> 
> 
> 
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70286): https://edk2.groups.io/g/devel/message/70286
Mute This Topic: https://groups.io/mt/79619796/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-