From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::235; helo=mail-lf0-x235.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com [IPv6:2a00:1450:4010:c07::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 03F3B21109FF9 for ; Mon, 18 Jun 2018 15:59:10 -0700 (PDT) Received: by mail-lf0-x235.google.com with SMTP id g21-v6so27183339lfb.4 for ; Mon, 18 Jun 2018 15:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kJ+wJNwuiJZkFfwIP3Pv4TpjuL+onc5GIUHeO/EbzNg=; b=N98PnSMZscawAvTzTv0I7hqFnHVlOHje8vKDhWkpMaVdOvWyMQWimtUTuWgYNFJvPw lDnvEbZHnPcy5myjnMvkbT6dXpaC6C1mhKriXFFLjTRTm1+wgNCb9oLV3EXUv8TBY9IJ 4krIxrHaP/UZg7u4V2sb6nPICVtfO3wSJmoNyrSSRSupwztHwga4BvYLU1KdyCP1XByc ZOpzU3VsXsoavu1k0T7rkU57Lqle/kgk9ddwtL5j21TbpFow/QxvUUM3xIBFzAAYzkJM aR+4dncttGjADHQ55zwD7874xPSbCHumWWMqYrwwmNNneEgBLEkos1v09geknoRy7uLR 4QgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kJ+wJNwuiJZkFfwIP3Pv4TpjuL+onc5GIUHeO/EbzNg=; b=mCXUPEq0/KT/bGAlJCZntdJmf1L+3uqacDOS4N7CC/hWQVSEL1gpwj3b7TE1nhPCUF 5NpulzxPUe+EAZIF5oK2ye1amsX6k6JX921xKP/CHTIuobfwlXOnosqsujJQ+RHohLeB XmdGa/7zTeUj5j9iyaFbcuMHL4SBVVQjFE03RadVqbjSIYjZ18gHrYaxW8XSOQgImpL2 9vtKRzPSy00h8uF8VxuBBlKdBy3Yk2ip+L6KpwtlapI8rPRn6dT1zpGwPSeceXCcEnZS 9pHsdlLuS6igzhgPF3f37R2/tYpBJLCYyFzHQ0vSkamhjDnzYNa15wytayJekuGO241V Rc1g== X-Gm-Message-State: APt69E04zrxHDnU+LMrLJ5dpM1QKbiziuNM+b0ZZXEnnGZingxtzz2+S l+GmY5H3ktmcWt+5QmjtngYOwVHRy6U= X-Google-Smtp-Source: ADUXVKLcBGldufMRl8tlAAGeAIPxI1gxHSrX42f0Il28BddcWBBplmr4zNT0WP8FZSMra2/sPmEOsg== X-Received: by 2002:a19:e544:: with SMTP id c65-v6mr8905359lfh.134.1529362748912; Mon, 18 Jun 2018 15:59:08 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h136-v6sm3020754lfe.23.2018.06.18.15.59.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jun 2018 15:59:08 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com Date: Tue, 19 Jun 2018 00:58:27 +0200 Message-Id: <1529362724-9244-9-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529362724-9244-1-git-send-email-mw@semihalf.com> References: <1529362724-9244-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v3 08/25] Marvell/Armada7k8k: Extend ArmadaSoCDescLib with PP2 information X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2018 22:59:11 -0000 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 Reviewed-by: Leif Lindholm --- 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 c5711b0..b899d29 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -24,6 +24,12 @@ #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 + +// // 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 0d45684..cafcc0f 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 UINTN *DescCount + ); + +// // UTMI PHY devices SoC description // typedef struct { diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 63fb224..61b4e30 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -30,6 +30,35 @@ EFI_STATUS EFIAPI +ArmadaSoCDescPp2Get ( + IN OUT MV_SOC_PP2_DESC **Pp2Desc, + IN OUT UINTN *DescCount + ) +{ + MV_SOC_PP2_DESC *Desc; + UINTN CpCount, CpIndex; + + CpCount = FixedPcdGet8 (PcdMaxCpCount); + + 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; +} + +EFI_STATUS +EFIAPI ArmadaSoCDescUtmiGet ( IN OUT MV_SOC_UTMI_DESC **UtmiDesc, IN OUT UINTN *DescCount -- 2.7.4