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::244; helo=mail-wr0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (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 39C4F213281DF for ; Tue, 12 Jun 2018 14:24:46 -0700 (PDT) Received: by mail-wr0-x244.google.com with SMTP id l41-v6so502738wre.7 for ; Tue, 12 Jun 2018 14:24:46 -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=EZPYpqVCeLR/5h0hAGR1EkfIv9qRQAMqaJtgWEW58kg=; b=A6aqognxKS/kMOgtKEo/P2zBlgTBRmUXfTwKsDVC7KbAvuZxWhC+cWm4rH3dgnoMuR OdEZzbPZIdnFyDJUI+EPXYCcg1MoAJeDKKsMvHHELEcNlaIguyQRuyve7NPjFq7uu3rx nwVl3rItuUHr0ESZgAIv1Xx0YXTqvlBf99FXs= 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=EZPYpqVCeLR/5h0hAGR1EkfIv9qRQAMqaJtgWEW58kg=; b=FevDB/oW4NokraanyzoCoKlRvl+JkrQIwrFuoO9HBGEaSPC0DH2MimUIEauDQ16XbZ 5y/5VqrS0uloBHinPn9oV0eu205ApuR6vsmUcls6dHUZ/xrRGjnQJGRy54gg2mJruu74 pM0l5+YAeLC9lreRcj9t3hwDUknQl71pPMdw5DWzpxOZ5s/cgrNa3wr0jyL7YfGXXYYw mVcJScLnKSik7s1A2a0UKdkV4YTGczv1qcUcXzzZxu2fqCgicns5AkOaxFik2UAYoLrf W6BQbBJ6+3lIpPnoKnFPRt+qufedgK5QoJdbmSzQykW/wMVByCoBzrgPEfPkPD2c7OEU 5rOg== X-Gm-Message-State: APt69E39g1mlLXOVpVNQVSU6aArm79Pe9bUMzfiztGeTCVRma86W/hjk 85vkxXnYgagJyXV1UvNsY7/1GW3X5ho= X-Google-Smtp-Source: ADUXVKL7K1SX7PZHQjRn5R6r6IFRxvoHyzW2ok5pnzgfuqI9EFN8geHFmuE00E1xrNAYEXrvaRbyAg== X-Received: by 2002:adf:b710:: with SMTP id l16-v6mr1987947wre.115.1528838685461; Tue, 12 Jun 2018 14:24:45 -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 h8-v6sm725463wmb.32.2018.06.12.14.24.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 14:24:44 -0700 (PDT) Date: Tue, 12 Jun 2018 22:24:42 +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: <20180612212442.ljflbeoec5q7vkvn@bivouac.eciton.net> References: <1528472063-1660-1-git-send-email-mw@semihalf.com> <1528472063-1660-20-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1528472063-1660-20-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms PATCH 19/25] Marvell/Drivers: MvBoardDesc: Extend protocol with MDIO support 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 21:24:47 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jun 08, 2018 at 05:34:17PM +0200, Marcin Wojtas wrote: > Introduce new callback that can provide information > about MDIO controllers to the Mdio driver. > > Extend ArmadaBoardDescLib with new structure MV_BOARD_MDIO_DESC, > for holding board specific data. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas > Reviewed-by: Hua Jing > --- > Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 37 ++++++++++++++++++++ > Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 8 +++++ > Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 +++++ > 3 files changed, 53 insertions(+) > > diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > index d580319..8f3bdfa 100644 > --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > @@ -96,6 +96,42 @@ MvBoardDescComPhyGet ( > > STATIC > EFI_STATUS > +MvBoardDescMdioGet ( > + IN MARVELL_BOARD_DESC_PROTOCOL *This, > + IN OUT MV_BOARD_MDIO_DESC **MdioDesc > + ) > +{ > + MV_BOARD_MDIO_DESC *BoardDesc; > + MV_SOC_MDIO_DESC *SoCDesc; > + EFI_STATUS Status; > + UINT8 MdioCount; UINTN. > + UINTN Index; > + > + /* Get SoC data about all available MDIO controllers */ > + Status = ArmadaSoCDescMdioGet (&SoCDesc, &MdioCount); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + /* Allocate and fill board description */ > + BoardDesc = AllocateZeroPool (MdioCount * sizeof (MV_BOARD_MDIO_DESC)); > + if (BoardDesc == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + for (Index = 0; Index < MdioCount; Index++) { > + BoardDesc[Index].SoC = &SoCDesc[Index]; > + } > + > + BoardDesc->MdioDevCount = MdioCount; > + *MdioDesc = BoardDesc; > + > + return EFI_SUCCESS; > +} > + > +STATIC > +EFI_STATUS > MvBoardDescAhciGet ( > IN MARVELL_BOARD_DESC_PROTOCOL *This, > IN OUT MV_BOARD_AHCI_DESC **AhciDesc > @@ -434,6 +470,7 @@ MvBoardDescInitProtocol ( > ) > { > BoardDescProtocol->BoardDescComPhyGet = MvBoardDescComPhyGet; > + BoardDescProtocol->BoardDescMdioGet = MvBoardDescMdioGet; Insert alhabetically. > BoardDescProtocol->BoardDescAhciGet = MvBoardDescAhciGet; > BoardDescProtocol->BoardDescSdMmcGet = MvBoardDescSdMmcGet; > BoardDescProtocol->BoardDescXhciGet = MvBoardDescXhciGet; > diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > index 1b56316..5379679 100644 > --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > @@ -28,6 +28,14 @@ typedef struct { > } MV_BOARD_COMPHY_DESC; > > // > +// MDIO devices per-board description > +// > +typedef struct { > + MV_SOC_MDIO_DESC *SoC; > + UINT8 MdioDevCount; UINTN. > +} MV_BOARD_MDIO_DESC; > + > +// > // NonDiscoverableDevices per-board description > // > > diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h b/Silicon/Marvell/Include/Protocol/BoardDesc.h > index 27250db..cff802a 100644 > --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h > +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h > @@ -50,6 +50,13 @@ EFI_STATUS > > typedef > EFI_STATUS > +(EFIAPI *MV_BOARD_DESC_MDIO_GET) ( > + IN MARVELL_BOARD_DESC_PROTOCOL *This, > + IN OUT MV_BOARD_MDIO_DESC **MdioDesc > + ); > + > +typedef > +EFI_STATUS > (EFIAPI *MV_BOARD_DESC_AHCI_GET) ( > IN MARVELL_BOARD_DESC_PROTOCOL *This, > IN OUT MV_BOARD_AHCI_DESC **AhciDesc > @@ -91,6 +98,7 @@ VOID > > struct _MARVELL_BOARD_DESC_PROTOCOL { > MV_BOARD_DESC_COMPHY_GET BoardDescComPhyGet; > + MV_BOARD_DESC_MDIO_GET BoardDescMdioGet; Insert alphabetically. / Leif > MV_BOARD_DESC_AHCI_GET BoardDescAhciGet; > MV_BOARD_DESC_SDMMC_GET BoardDescSdMmcGet; > MV_BOARD_DESC_XHCI_GET BoardDescXhciGet; > -- > 2.7.4 >