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::241; helo=mail-wr0-x241.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (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 C816F210DF51D for ; Mon, 18 Jun 2018 09:23:44 -0700 (PDT) Received: by mail-wr0-x241.google.com with SMTP id h10-v6so17481884wrq.8 for ; Mon, 18 Jun 2018 09:23:44 -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=/lJAq4bMkHCeFjBF9JmlrcGkch7y5EC3kyw53JAZkjI=; b=TznPGnXT5T2AzdGaVMDVswpi0YA0MQdgUDYsgjz2NsrH8P46bxobBugay8S/j6Yf6U 6idg1dgaFCcjGpEIh6kMSNnJjug2pdBDl1VdRB4t8ZkFlaG5Fj13lITY2nXgEfRlx8/a OtYOktDZcfjXU7G6NoIYFmJrc610dmiRHu4R4= 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=/lJAq4bMkHCeFjBF9JmlrcGkch7y5EC3kyw53JAZkjI=; b=S344AOu+dYoBumwWz4yHZZn1gNeXIHSH6iRs1I8Fqv7AJ41CdJUNy8OtrxfTqqc3S5 QDzSB7U2FSt3wf3d0eC6Jd7fdbTkzB+ZPOMRHTTb/po8o3+OYguwZfyDP0FtwvXxu1SH ZZ+vx5fkCxHQqOaihUoVu7OyE9XlkbcxIYOpEUd4cuxdqtYhmJ4HMM8x/V4j4mVkZD0Z L/7jRKBm1qxcoDKQB+JQu7cBz+wcEVtV8Ia4WZ2d5DEG4u8LPWaEbBYkLl0yUaqs0+hJ 9HAseB+TImctmVQctIvKx3bMK39mOCwi3YVGKzDp+cQdZxn9UNKsNK/XJtckT7ueaEaw tATQ== X-Gm-Message-State: APt69E3tOdAz0Ge6uCUQrd0r1/GiKArH0mX9jBsZ2LudkeDWVAI1IZnW y49rdsrLdYLLTWtKSu5uNeUjEQ== X-Google-Smtp-Source: ADUXVKKUVA/p9Qc/AyPuaLm0to6OGo/U3Ick3y+uMyeIALW147KJrVn9rExcZdvHDXxlirqrrrVYAg== X-Received: by 2002:adf:b02b:: with SMTP id f40-v6mr11437078wra.75.1529339023263; Mon, 18 Jun 2018 09:23:43 -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 u15-v6sm11775441wma.37.2018.06.18.09.23.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 09:23:42 -0700 (PDT) Date: Mon, 18 Jun 2018 17:23:40 +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: <20180618162340.pihbaer7zylpushy@bivouac.eciton.net> References: <1529266325-18371-1-git-send-email-mw@semihalf.com> <1529266325-18371-19-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1529266325-18371-19-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH v2 18/25] Marvell/Armada7k8k: Extend ArmadaSoCDescLib with MDIO 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 16:23:45 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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.) Reviewed-by: Leif Lindholm > +#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 >