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 B7FE7212CFEA2 for ; Tue, 12 Jun 2018 11:24:59 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id e18-v6so16897969wrs.5 for ; Tue, 12 Jun 2018 11:24:59 -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=xn1IJeVUlFOjo3qAfgtZnf7XqYtHAg+k5TXX8sipThE=; b=HkOGIZnSC62dy4ISniunFwq5TY+xNosPjGAan8c7+KTOlZKXJvlVg8dS8j3JxXMIC6 ilQfKBoBLvlwFucK4ML6hwL6Y+zZtZiWccWUaBiH7qT4EI6W5ofVD+snistJ24gmNiBw QdhTk0LwElAwv1VgDHHaVVx5COHzf7lkqo6JI= 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=xn1IJeVUlFOjo3qAfgtZnf7XqYtHAg+k5TXX8sipThE=; b=GPqlkwGi++RqOQ8aSMnEmglEDaN5YdAUa08wL9DHDVbDFrYwUt5CFN34uItrXXoOZS z/8yWtMIZtKSkXOrZ2Tr0fi3H+tsP81B+9PbAQv9ywLiQq+COdKkgAfqXnG3odwo2qUo EHmYzmz3im1EeKijHQEbz/RV2NM3Y/WFLIDsnB2Z+rEE5b+gOXFGFBRcKngysOy0NpUk 6M+05vS8K7g9bsyLA3wWfLL5KCZuR2V1i5UT3Ky41CJwRmkJnQjAuZo2h3fiKtxix2cp AIZ1BvMbmV7LUkHr6/XbMgXU9wqUYHszzeuVVI0BPv0gGMAolURV1zZs73ooiBYatoeG KQYA== X-Gm-Message-State: APt69E1SKTpvJAgyM5c5sfZJO/B7PsLdrf1b1ERpMNZQwnRdW4wDd60U Kxt+sTTniOdQ1Nyvm7oWlKaxkQ== X-Google-Smtp-Source: ADUXVKKpGxFC+kwm4hMDky9ek9TNdthWPBOvLfgLJ1P/Ibfi7j7fyr4AFvwEssbKmyH46uNeI6kMJg== X-Received: by 2002:adf:cd85:: with SMTP id q5-v6mr1244082wrj.275.1528827898337; Tue, 12 Jun 2018 11:24:58 -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 p3-v6sm779958wrn.31.2018.06.12.11.24.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 11:24:57 -0700 (PDT) Date: Tue, 12 Jun 2018 19:24:55 +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: <20180612182455.zpfmsqc6ubahxhun@bivouac.eciton.net> References: <1528472063-1660-1-git-send-email-mw@semihalf.com> <1528472063-1660-10-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1528472063-1660-10-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms PATCH 09/25] Marvell/Drivers: MvBoardDesc: Extend protocol with PP2 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 18:25:00 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jun 08, 2018 at 05:34:07PM +0200, Marcin Wojtas wrote: > Introduce new callback that can provide information > about PP2 NICs to the Pp2Dxe driver. > > Extend ArmadaBoardDescLib with new structure MV_BOARD_PP2_DESC, > for holding board specific data. In further steps it should > be extended and replace PCD port's representation with the > appropriate structures. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas > Reviewed-by: Hua Jing > --- > Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 60 ++++++++++++++++++++ > Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + > Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 11 ++++ > Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 +++ > 4 files changed, 80 insertions(+) > > diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > index c220e58..86bddad 100644 > --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > @@ -37,6 +37,65 @@ MV_BOARD_DESC *mBoardDescInstance; > > STATIC > EFI_STATUS > +MvBoardDescPp2Get ( > + IN MARVELL_BOARD_DESC_PROTOCOL *This, > + IN OUT MV_BOARD_PP2_DESC **Pp2Desc > + ) > +{ > + UINT8 *Pp2DeviceTable, Pp2Count; Please use UINTN for counter. > + UINTN Pp2DeviceTableSize, Pp2Index, Index; > + MV_BOARD_PP2_DESC *BoardDesc; > + MV_SOC_PP2_DESC *SoCDesc; > + EFI_STATUS Status; > + > + /* Get SoC data about all available PP2 controllers */ > + Status = ArmadaSoCDescPp2Get (&SoCDesc, &Pp2Count); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + /* Obtain table with enabled PP2 NICs */ > + Pp2DeviceTable = (UINT8 *)PcdGetPtr (PcdPp2Controllers); > + if (Pp2DeviceTable == NULL) { > + /* No PP2 NIC on platform */ > + return EFI_SUCCESS; > + } > + > + Pp2DeviceTableSize = PcdGetSize (PcdPp2Controllers); > + > + /* Check if PCD with PP2 NICs is correctly defined */ > + if (Pp2DeviceTableSize > Pp2Count) { > + DEBUG ((DEBUG_ERROR, "%a: Wrong PcdPp2Controllers format\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + /* Allocate and fill board description */ > + BoardDesc = AllocateZeroPool (Pp2DeviceTableSize * sizeof (MV_BOARD_PP2_DESC)); > + if (BoardDesc == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + Pp2Index = 0; > + for (Index = 0; Index < Pp2DeviceTableSize; Index++) { > + if (!MVHW_DEV_ENABLED (Pp2, Index)) { if (Pp2DeviceTable[Index] != MVHW_DEV_ENABLED) { > + DEBUG ((DEBUG_ERROR, "%a: Skip Pp2 controller %d\n", __FUNCTION__, Index)); > + continue; > + } > + > + BoardDesc[Pp2Index].SoC = &SoCDesc[Index]; > + Pp2Index++; > + } > + > + BoardDesc->Pp2DevCount = Pp2Index; > + > + *Pp2Desc = BoardDesc; > + > + return EFI_SUCCESS; > +} > + > +STATIC > +EFI_STATUS > MvBoardDescUtmiGet ( > IN MARVELL_BOARD_DESC_PROTOCOL *This, > IN OUT MV_BOARD_UTMI_DESC **UtmiDesc > @@ -138,6 +197,7 @@ MvBoardDescInitProtocol ( > IN MARVELL_BOARD_DESC_PROTOCOL *BoardDescProtocol > ) > { > + BoardDescProtocol->BoardDescPp2Get = MvBoardDescPp2Get; > BoardDescProtocol->BoardDescUtmiGet = MvBoardDescUtmiGet; > BoardDescProtocol->BoardDescFree = MvBoardDescFree; > > diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf > index 9367833..c7d5fe2 100644 > --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf > +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf > @@ -57,6 +57,7 @@ > gMarvellBoardDescProtocolGuid > > [Pcd] > + gMarvellTokenSpaceGuid.PcdPp2Controllers > gMarvellTokenSpaceGuid.PcdUtmiControllersEnabled > gMarvellTokenSpaceGuid.PcdUtmiPortType > gMarvellTokenSpaceGuid.PcdPciEXhci > diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > index 2d50067..78cf698 100644 > --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > @@ -17,6 +17,17 @@ > #include > > // > +// PP2 NIC devices per-board description > +// > +// TODO - Extend structure with entire > +// ports description instead of PCDs. Drop the TODO. / Leif > +// > +typedef struct { > + MV_SOC_PP2_DESC *SoC; > + UINT8 Pp2DevCount; > +} MV_BOARD_PP2_DESC; > + > +// > // UTMI PHY devices per-board description > // > typedef struct { > diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h b/Silicon/Marvell/Include/Protocol/BoardDesc.h > index f8a2902..114a0ec 100644 > --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h > +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h > @@ -43,6 +43,13 @@ typedef struct _MARVELL_BOARD_DESC_PROTOCOL MARVELL_BOARD_DESC_PROTOCOL; > > typedef > EFI_STATUS > +(EFIAPI *MV_BOARD_DESC_PP2_GET) ( > + IN MARVELL_BOARD_DESC_PROTOCOL *This, > + IN OUT MV_BOARD_PP2_DESC **Pp2Desc > + ); > + > +typedef > +EFI_STATUS > (EFIAPI *MV_BOARD_DESC_UTMI_GET) ( > IN MARVELL_BOARD_DESC_PROTOCOL *This, > IN OUT MV_BOARD_UTMI_DESC **UtmiDesc > @@ -55,6 +62,7 @@ VOID > ); > > struct _MARVELL_BOARD_DESC_PROTOCOL { > + MV_BOARD_DESC_PP2_GET BoardDescPp2Get; > MV_BOARD_DESC_UTMI_GET BoardDescUtmiGet; > MV_BOARD_DESC_FREE BoardDescFree; > }; > -- > 2.7.4 >