On Fri, Jun 08, 2018 at 05:34:16PM +0200, Marcin Wojtas wrote:
> This patch introduces new library callback (ArmadaSoCDescMdioGet ()),
> which dynamically allocates and fills MV_SOC_MDIO_DESC structure with
> the SoC description of Mdio controllers.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas <m...@semihalf.com>
> Reviewed-by: Hua Jing <jing...@marvell.com>
> ---
>  
> Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
>  | 34 ++++++++++++++++++++
>  Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h                           
>   | 15 +++++++++
>  2 files changed, 49 insertions(+)
> 
> diff --git 
> a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
>  
> b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> index ba44a0c..515ff03 100644
> --- 
> a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> +++ 
> b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> @@ -72,6 +72,40 @@ ArmadaSoCDescComPhyGet (
>  }
>  
>  //
> +// Platform description of MDIO controllers
> +//
> +#define MV_SOC_MDIO_BASE(Cp)            MV_SOC_CP_BASE ((Cp)) + 0x12A200
> +#define MV_SOC_MDIO_ID(Cp)              ((Cp))

There appears to be a somewhat unfair distribution of parentheses
between the two lines above. Parentheses don't need to be inside
parentheses in order to retain evaluation order, but arithmetic
operations definitely do.

> +
> +EFI_STATUS
> +EFIAPI
> +ArmadaSoCDescMdioGet (
> +  IN OUT MV_SOC_MDIO_DESC  **MdioDesc,
> +  IN OUT UINT8             *DescCount

UINTN.

> +  )
> +{
> +  MV_SOC_MDIO_DESC *Desc;
> +  UINT8 CpCount = FixedPcdGet8 (PcdMaxCpCount);
> +  UINT8 CpIndex;

UINTN x2.
(Also, doesn't the coding style ban assignment as part of definition?)

> +
> +  Desc = AllocateZeroPool (CpCount * sizeof (MV_SOC_MDIO_DESC));
> +  if (Desc == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__));
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  for (CpIndex = 0; CpIndex < CpCount; CpIndex++) {
> +    Desc[CpIndex].MdioId = MV_SOC_MDIO_ID (CpIndex);
> +    Desc[CpIndex].MdioBaseAddress = MV_SOC_MDIO_BASE (CpIndex);
> +  }
> +
> +  *MdioDesc = Desc;
> +  *DescCount = CpCount;
> +
> +  return EFI_SUCCESS;
> +}
> +
> +//
>  // Platform description of NonDiscoverableDevices
>  //
>  
> diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h 
> b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
> index 791d58b..41d9642 100644
> --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
> +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
> @@ -37,6 +37,21 @@ ArmadaSoCDescComPhyGet (
>    );
>  
>  //
> +// MDIO
> +//
> +typedef struct {
> +  UINT8 MdioId;

Use UINTN.

/
    Leif

> +  UINTN MdioBaseAddress;
> +} MV_SOC_MDIO_DESC;
> +
> +EFI_STATUS
> +EFIAPI
> +ArmadaSoCDescMdioGet (
> +  IN OUT MV_SOC_MDIO_DESC  **MdioDesc,
> +  IN OUT UINT8              *DescCount
> +  );
> +
> +//
>  // NonDiscoverable devices SoC description
>  //
>  // AHCI
> -- 
> 2.7.4
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to