On Fri, Jun 08, 2018 at 05:34:06PM +0200, Marcin Wojtas wrote:
> This patch introduces new library callback (ArmadaSoCDescPp2Get ()),
> which dynamically allocates and fills MV_SOC_PP2_DESC structure with
> the SoC description of PP2 NICs.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> Reviewed-by: Hua Jing <jinghua@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 0ee943b..36b445e 100644
> --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> @@ -32,6 +32,40 @@
> #define MV_SOC_CP_BASE(Cp) (0xF2000000 + (Cp) * 0x2000000)
>
> //
> +// Platform description of PP2 NIC
> +//
> +#define MV_SOC_PP2_BASE(Cp) MV_SOC_CP_BASE ((Cp))
> +#define MV_SOC_PP2_CLK_FREQ 333333333
> +
> +EFI_STATUS
> +EFIAPI
> +ArmadaSoCDescPp2Get (
> + IN OUT MV_SOC_PP2_DESC **Pp2Desc,
> + IN OUT UINT8 *DescCount
> + )
> +{
> + MV_SOC_PP2_DESC *Desc;
> + UINT8 CpCount = FixedPcdGet8 (PcdMaxCpCount);
Please use UINTN for counters.
/
Leif
> + UINT8 CpIndex;
> +
> + Desc = AllocateZeroPool (CpCount * sizeof (MV_SOC_PP2_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].Pp2BaseAddress = MV_SOC_PP2_BASE (CpIndex);
> + Desc[CpIndex].Pp2ClockFrequency = MV_SOC_PP2_CLK_FREQ;
> + }
> +
> + *Pp2Desc = Desc;
> + *DescCount = CpCount;
> +
> + return EFI_SUCCESS;
> +}
> +
> +//
> // Platform description of UTMI PHY's
> //
> #define MV_SOC_UTMI_PER_CP_COUNT 2
> diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
> index 22f5c17..559642b 100644
> --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
> +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
> @@ -15,6 +15,21 @@
> #define __ARMADA_SOC_DESC_LIB_H__
>
> //
> +// PP2 NIC devices SoC description
> +//
> +typedef struct {
> + UINTN Pp2BaseAddress;
> + UINTN Pp2ClockFrequency;
> +} MV_SOC_PP2_DESC;
> +
> +EFI_STATUS
> +EFIAPI
> +ArmadaSoCDescPp2Get (
> + IN OUT MV_SOC_PP2_DESC **Pp2Desc,
> + IN OUT UINT8 *DescCount
> + );
> +
> +//
> // UTMI PHY devices SoC description
> //
> typedef struct {
> --
> 2.7.4
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel