2018-06-18 18:23 GMT+02:00 Leif Lindholm <leif.lindholm@linaro.org>:
> On Sun, Jun 17, 2018 at 10:11:58PM +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 <mw@semihalf.com>
>> ---
>> Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 6 ++++
>> Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 15 ++++++++++
>> Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 29 ++++++++++++++++++++
>> 3 files changed, 50 insertions(+)
>>
>> diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h
>> index f372ca0..c864f94 100644
>> --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h
>> +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h
>> @@ -38,6 +38,12 @@
>> #define MV_SOC_COMPHY_MUX_BITS 4
>>
>> //
>> +// Platform description of MDIO controllers
>> +//
>> +#define MV_SOC_MDIO_BASE(Cp) (MV_SOC_CP_BASE ((Cp)) + 0x12A200)
>
> Still pointless double parentheses around this Cp :)
> Save that for a single patch later on, as commented on earlier patch
> in set.
> (This version already fixes the bug.)
I can quickly update each patch, unless you really wish to do it
separately. Please confirm your preferences.
Thanks,
Marcin
>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>
>> +#define MV_SOC_MDIO_ID(Cp) (Cp)
>> +
>> +//
>> // Platform description of PP2 NIC
>> //
>> #define MV_SOC_PP2_BASE(Cp) MV_SOC_CP_BASE ((Cp))
>> diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
>> index a133d1c..304d068 100644
>> --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
>> +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h
>> @@ -37,6 +37,21 @@ ArmadaSoCDescComPhyGet (
>> );
>>
>> //
>> +// MDIO
>> +//
>> +typedef struct {
>> + UINTN MdioId;
>> + UINTN MdioBaseAddress;
>> +} MV_SOC_MDIO_DESC;
>> +
>> +EFI_STATUS
>> +EFIAPI
>> +ArmadaSoCDescMdioGet (
>> + IN OUT MV_SOC_MDIO_DESC **MdioDesc,
>> + IN OUT UINTN *DescCount
>> + );
>> +
>> +//
>> // NonDiscoverable devices SoC description
>> //
>> // AHCI
>> diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
>> index 580c0f4..652677f 100644
>> --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
>> +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
>> @@ -63,6 +63,35 @@ ArmadaSoCDescComPhyGet (
>>
>> EFI_STATUS
>> EFIAPI
>> +ArmadaSoCDescMdioGet (
>> + IN OUT MV_SOC_MDIO_DESC **MdioDesc,
>> + IN OUT UINTN *DescCount
>> + )
>> +{
>> + MV_SOC_MDIO_DESC *Desc;
>> + UINTN CpCount, CpIndex;
>> +
>> + CpCount = FixedPcdGet8 (PcdMaxCpCount);
>> +
>> + 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;
>> +}
>> +
>> +EFI_STATUS
>> +EFIAPI
>> ArmadaSoCDescAhciGet (
>> IN OUT MV_SOC_AHCI_DESC **AhciDesc,
>> IN OUT UINTN *DescCount
>> --
>> 2.7.4
>>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel