From nobody Mon Feb 9 13:38:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41069+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41069+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1558366074; cv=none; d=zoho.com; s=zohoarc; b=CNqRg39avRGilVaM9oMrWgA6PJxI18cu0yZg5vb3DKp0e3w5DgEfK13px2V1ymYYKJyAC7NqEXumbmnBxmPH2RpNzU7ufTzDFsqfhFoOQ+Cb3IR9wo0Q1Gx9ss6rjSATAds+fS7QBGHqCUl44rqRU+X+z8paWT6ZpLfs1zurwUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558366074; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=5ZexqJFHsD5lXZJ/T0jDcGyvJ+R0jt0VAcZ6DrcMC08=; b=gv3c19ok8pEjcjFi4bYpo3MXlPHqt7k9vSEe6zWC7z8Zlr32QPUZtrtqpR5q7Qs+ApcM8Wo0sYvahZMRV94W8A/QgxNaH4WMgqOn5XzHXwpilWae+A5zMraAs9PmI27uiVLBdLYo07iw9NjEgKnUN2WDuUZ1a8xar8KR7N4IVaI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41069+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558366074962478.18047006710094; Mon, 20 May 2019 08:27:54 -0700 (PDT) Return-Path: X-Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by groups.io with SMTP; Mon, 20 May 2019 08:27:54 -0700 X-Received: by mail-lf1-f67.google.com with SMTP id q17so10669904lfo.4 for ; Mon, 20 May 2019 08:27:53 -0700 (PDT) X-Gm-Message-State: APjAAAXhq+xutKSg0Z7vAZttQHzrCubvi3YtOPGj96m2WnMXBbk8l9I7 DBbp/A9XOTjzXXHaxMVI3AWNjyvbIdg= X-Google-Smtp-Source: APXvYqwq7hPwuYNUh2CPl+7++94dIs41dK5/yqkw06A+kMX/sDKrfy1/wWhVHZBcP0omjO2xRfi1eQ== X-Received: by 2002:a19:3f4f:: with SMTP id m76mr36051586lfa.17.1558366071603; Mon, 20 May 2019 08:27:51 -0700 (PDT) X-Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id d5sm3906205lji.85.2019.05.20.08.27.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 May 2019 08:27:50 -0700 (PDT) From: "Marcin Wojtas" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com, Jici.Gao@arm.com, rebecca@bluestop.org, kettenis@jive.eu Subject: [edk2-devel] [edk2-platforms: PATCH v2 02/14] Marvell/Library: ArmadaSoCDescLib: Add PCIE information Date: Mon, 20 May 2019 17:27:15 +0200 Message-Id: <1558366047-15994-3-git-send-email-mw@semihalf.com> In-Reply-To: <1558366047-15994-1-git-send-email-mw@semihalf.com> References: <1558366047-15994-1-git-send-email-mw@semihalf.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mw@semihalf.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558366074; bh=hjmgpuOHEhfFwQMmfZODKR+GMb1jFWnLLZRJXanhElw=; h=Cc:Date:From:Reply-To:Subject:To; b=O3CpTlbWlMiIqt4ljvwIrd6Hw2WpCFCWVQhHxoXEqIb8q5M7a+Qbwzi+6jqT7h5znzy tltu/XN2OXltXti5FzDnhPTH+BqvqWUHjVrL6vlerrEhD5b4LmOCEWL91mcAMThfMibbj Jo67OjcLlnmHfP1/j3JYTHVnE1DV22YRcIM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch introduces new library callback (ArmadaSoCPcieGet ()), which dynamically allocates and fills array with all available PCIE controllers' base addresses. It is needed for the configuration of PCIE, whose support will be added in the upcoming patches. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescL= ib.h | 6 +++ Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h = | 20 +++++++++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescL= ib.c | 44 ++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada= 7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/= Armada7k8kSoCDescLib.h index 74883fd..0296d43 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoC= DescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoC= DescLib.h @@ -76,6 +76,12 @@ #define MV_SOC_MDIO_ID(Cp) (Cp) =20 // +// Platform description of PCIE +// +#define MV_SOC_PCIE_PER_CP_COUNT 3 +#define MV_SOC_PCIE_BASE(Index) (0x600000 + ((Index) * 0x20000)) + +// // 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/M= arvell/Include/Library/ArmadaSoCDescLib.h index cd9c9f2..6432916 100644 --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h @@ -185,6 +185,26 @@ ArmadaSoCDescXhciGet ( IN OUT UINTN *DescCount ); =20 +/** + This function returns the total number of PCIE controllers and an array + with their base addresses. + + @param[in out] **PcieDbiAddresses Array containing PCIE controllers' ba= se + adresses. + @param[in out] *Count Total amount of available PCIE contro= llers. + + @retval EFI_SUCCESS The data were obtained successfully. + @retval EFI_OUT_OF_RESOURCES The request could not be completed du= e to a + lack of resources. + +**/ +EFI_STATUS +EFIAPI +ArmadaSoCPcieGet ( + IN OUT EFI_PHYSICAL_ADDRESS **PcieDbiAddresses, + IN OUT UINTN *Count + ); + // // PP2 NIC devices SoC description // diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada= 7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/= Armada7k8kSoCDescLib.c index b637966..5947601 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoC= DescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoC= DescLib.c @@ -272,6 +272,50 @@ ArmadaSoCDescAhciGet ( return EFI_SUCCESS; } =20 +/** + This function returns the total number of PCIE controllers and an array + with their base addresses. + + @param[in out] **PcieBaseAddresses Array containing PCIE controllers' ba= se + adresses. + @param[in out] *Count Total amount of available PCIE contro= llers. + + @retval EFI_SUCCESS The data were obtained successfully. + @retval EFI_OUT_OF_RESOURCES The request could not be completed du= e to a + lack of resources. + +**/ +EFI_STATUS +EFIAPI +ArmadaSoCPcieGet ( + IN OUT EFI_PHYSICAL_ADDRESS **PcieBaseAddresses, + IN OUT UINTN *Count + ) +{ + UINTN CpCount, CpIndex, Index; + EFI_PHYSICAL_ADDRESS *BaseAddress; + + CpCount =3D FixedPcdGet8 (PcdMaxCpCount); + + *Count =3D CpCount * MV_SOC_PCIE_PER_CP_COUNT; + BaseAddress =3D AllocateZeroPool (*Count * sizeof (EFI_PHYSICAL_ADDRESS)= ); + if (BaseAddress =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); + return EFI_OUT_OF_RESOURCES; + } + + *PcieBaseAddresses =3D BaseAddress; + + for (CpIndex =3D 0; CpIndex < CpCount; CpIndex++) { + for (Index =3D 0; Index < MV_SOC_PCIE_PER_CP_COUNT; Index++) { + *BaseAddress =3D MV_SOC_CP_BASE (CpIndex) + MV_SOC_PCIE_BASE (Index); + BaseAddress++; + } + } + + return EFI_SUCCESS; +} + EFI_STATUS EFIAPI ArmadaSoCDescPp2Get ( --=20 2.7.4 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41069): https://edk2.groups.io/g/devel/message/41069 Mute This Topic: https://groups.io/mt/31686568/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-