From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 646272123780A for ; Tue, 12 Jun 2018 11:21:33 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id o12-v6so25115034wrm.12 for ; Tue, 12 Jun 2018 11:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XJO4hOxIPinq3gj3+sHQkyyfYkYBMjcbaNEsSrgsv9o=; b=OFPob7dDr5gmc3u01SIrAwLyrg/wuvnu07sDx30AIomlJmC+8oakhUZ2CBtzjeRXvG uFr1jq0fYU/FeJqh51++7DXDm0sAWDsYXZ5E7NYrjO7Xzp2r3Ww8vf3sC0qo4/pHj/39 9uaYp4mAckYSpNP+ntVuwbx8ZUru/GHRZGi9E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XJO4hOxIPinq3gj3+sHQkyyfYkYBMjcbaNEsSrgsv9o=; b=rkSioBBm5k4mtHwj/LHuHoT00anT9rRfMvcgd6dxmqy7bcc1XH6j5kNIGWGPEUhA3F Q9VwpMa7NY7GG38rwQu3QKAU/FHmLWskHQZGfL+lUVtXB/M8JJnSzsZzY1pZDfwiQaX9 N0CXyv12PPjCU2UoTYOECYCccyjYT1sphYWHBFR/BF2alGl6aLCbOHwFXbTiXPWwUBcv vYd7APeQdrlWc/7WkCjzfoy2vW3vDejEVWurBhN9K1xyVXzvcEUarpLN4MxVrT3dug23 9UtB0RvHnJWuoL6BdCPmwlAXgXxHwnMAO9o/v+z5eCYhfi3A8feCJaMVo5FpQO8H4B4i qgdw== X-Gm-Message-State: APt69E14wLaaxh6PjxSupxGm01g8w/KchOsyAT+0gCuUhd9DFE62NSOl pFLd/yQICSkp6eJHm87qDLUvrg== X-Google-Smtp-Source: ADUXVKKzqLeaAS4StZhGfC0R9jwVWzbtUS2oV7yjAnLYGyAu4KulbMZ1PcQZbzgV/VWYTdktqjEkTQ== X-Received: by 2002:adf:ed52:: with SMTP id u18-v6mr1253979wro.262.1528827691818; Tue, 12 Jun 2018 11:21:31 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id e63-v6sm1545582wma.46.2018.06.12.11.21.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 11:21:30 -0700 (PDT) Date: Tue, 12 Jun 2018 19:21:28 +0100 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, jinghua@marvell.com, jsd@semihalf.com, jaz@semihalf.com Message-ID: <20180612182128.kgozd2zhwuwh6pzc@bivouac.eciton.net> References: <1528472063-1660-1-git-send-email-mw@semihalf.com> <1528472063-1660-9-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1528472063-1660-9-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms PATCH 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: Tue, 12 Jun 2018 18:21:33 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > Reviewed-by: Hua Jing > --- > 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 >