From nobody Fri Dec 27 01:47:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504233230338308.2964311092842; Thu, 31 Aug 2017 19:33:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2CB7321E74907; Thu, 31 Aug 2017 19:30:58 -0700 (PDT) Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) (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 8F96921EB5283 for ; Thu, 31 Aug 2017 19:30:56 -0700 (PDT) Received: by mail-lf0-x230.google.com with SMTP id z12so4778354lfd.3 for ; Thu, 31 Aug 2017 19:33:40 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p5sm263439lfe.72.2017.08.31.19.33.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Aug 2017 19:33:37 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2bGQ7hRCD7fDHK9Uuwh4EqMEc+0bI9WjB1itHEqvIsI=; b=YGq17MCnbskFII0ePPczgn8NAyYTOe7NVWBy7+L53xIfLCORS8c51+N1rHlLm3czck Km5tBoE8lgm5W3xzQmzAbMLZ0GelHRzCJCWjKbp+AWlPF4TnAje0Ys7a3Xc1sRiFzfmd Lj5ylyXeG6M1oSxxW7dvd1/F+X7oVccfnDDct3XarmqmEJyNYV/qAaSIR00MdnRC/qv8 vHWEBOpzDJdCVH7cXFhm+Cx3YUVGMVE9RGWuHBKZP9iPnhL8dWeHm08wjui42ZRQye4c 0BlzjrnKA5UWElf0jKxWzZESWTwV0gr8SF3/n1+djxHCKuRx/k14VsNIE+BOFbYpXhNg frSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2bGQ7hRCD7fDHK9Uuwh4EqMEc+0bI9WjB1itHEqvIsI=; b=PwzEP0ydKAXJL4nysrak5hvypGMiMgTRIW9gA2uWyPsvbcvf+CmakSLQLKRXNhviN0 DdbBUQa3REetObbe9oXesPao6ZBfnPAMwXh/Qqbysn5DMgw1CebCMdW2vEtGK65gkr4s xVMbeuhxTiU3U0Hle7xkKKynwP6MUVgNsSPOYDdIPAsBb2ImpQvpfK1HLqMEgSJFnCUp uruY7yNWL3J31w5gtimJT1ycHkJSVXFDCAe0vfjaPSHIWFEMxuJcr0CHev0ihFJXnWKG I+0EMSpzlkxtINaOBx0Xc9S60lBff2gPJ5b/zkfeTjfNaggHzV47nvYvHQcyjRcJKI1Y fsmQ== X-Gm-Message-State: AHPjjUjv3N9MP4SxFqy1sNytpYQuP6BLV+4Z6x2sS3IBX9Q1Sgs+B+Hx azX2sJx61bZLibA5bwYxAw== X-Google-Smtp-Source: ADKCNb7aj4p5Tu8TQqiTPWczYJ6b65jXxE7eUhLFMeqYAqhPAzamA2ao5Y9HVXQJLsOpHnCPlS0riQ== X-Received: by 10.46.13.18 with SMTP id 18mr188690ljn.156.1504233218261; Thu, 31 Aug 2017 19:33:38 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Fri, 1 Sep 2017 04:37:30 +0200 Message-Id: <1504233451-6455-7-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1504233451-6455-1-git-send-email-mw@semihalf.com> References: <1504233451-6455-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH 6/7] Drivers/Net/Pp2Dxe: Move devices description to MvHwDescLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jinghua@marvell.com, ard.biesheuvel@linaro.org, agraf@suse.de, leif.lindholm@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch introduces Pp2Dxe description, using the new structures and template in MvHwDescLib. This change enables more flexible addition of multiple Pp2Dxe controllers. For that purpose, static global variables (BufferLocation and Mvpp2Shared) had to be replaced by dynamically allocated resources. PortingGuide is updated accordingly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Platform/Marvell/Armada/Armada70x0.dsc | 3 +- .../Marvell/Documentation/PortingGuide/Pp2.txt | 9 +- Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 109 ++++++++++++++++-= ---- Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h | 19 ++-- Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf | 3 +- Platform/Marvell/Include/Library/MvHwDescLib.h | 26 +++++ Platform/Marvell/Marvell.dec | 3 +- 7 files changed, 125 insertions(+), 47 deletions(-) diff --git a/Platform/Marvell/Armada/Armada70x0.dsc b/Platform/Marvell/Arma= da/Armada70x0.dsc index bbe6ba5..334bfaa 100644 --- a/Platform/Marvell/Armada/Armada70x0.dsc +++ b/Platform/Marvell/Armada/Armada70x0.dsc @@ -121,13 +121,12 @@ =20 #NET gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0xff, 0x0, 0x1 } - gMarvellTokenSpaceGuid.PcdPp2ClockFrequency|333333333 gMarvellTokenSpaceGuid.PcdPp2GopIndexes|{ 0x0, 0x2, 0x3 } gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp|{ 0x0, 0x0, 0x0 } gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed|{ 0x5, 0x3, 0x3 } gMarvellTokenSpaceGuid.PcdPp2NumPorts|3 gMarvellTokenSpaceGuid.PcdPp2PortIds|{ 0x0, 0x1, 0x2 } - gMarvellTokenSpaceGuid.PcdPp2SharedAddress|0xf2000000 + gMarvellTokenSpaceGuid.PcdPp2Controllers|{ 0x1 } =20 #PciEmulation gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x1, 0x1, 0x0, 0x0 } diff --git a/Platform/Marvell/Documentation/PortingGuide/Pp2.txt b/Platform= /Marvell/Documentation/PortingGuide/Pp2.txt index 3c2f418..9b829c9 100644 --- a/Platform/Marvell/Documentation/PortingGuide/Pp2.txt +++ b/Platform/Marvell/Documentation/PortingGuide/Pp2.txt @@ -3,6 +3,9 @@ Pp2Dxe porting guide Pp2Dxe is driver supporting PP2 NIC on Marvell platforms. Following PCDs are required to operate: =20 +Array with used controllers - Set to 0x1 for enabled, 0x0 for disabled: + gMarvellTokenSpaceGuid.PcdPp2Controllers + Number of ports/network interfaces: gMarvellTokenSpaceGuid.PcdPp2NumPorts =20 @@ -30,9 +33,3 @@ PHY_SPEED (in Mbps) is defined as follows: 4 SPEED_2500, 5 SPEED_10000 } PHY_SPEED; - -Base address of shared register space of PP2: - gMarvellTokenSpaceGuid.PcdPp2SharedAddress - -TCLK frequency in Hz: - gMarvellTokenSpaceGuid.PcdPp2ClockFrequency diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Platform/Marvel= l/Drivers/Net/Pp2Dxe/Pp2Dxe.c index 42cf0f9..8e6bfbc 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -42,6 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA= GE. #include #include #include +#include #include #include #include @@ -53,8 +54,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA= GE. =20 #define ReturnUnlock(tpl, status) do { gBS->RestoreTPL (tpl); return (stat= us); } while(0) =20 -STATIC MVPP2_SHARED *Mvpp2Shared; -STATIC BUFFER_LOCATION BufferLocation; +DECLARE_A7K8K_PP2_TEMPLATE; + STATIC PP2_DEVICE_PATH Pp2DevicePathTemplate =3D { { { @@ -172,7 +173,7 @@ QueueRemove ( STATIC EFI_STATUS Pp2DxeBmPoolInit ( - VOID + MVPP2_SHARED *Mvpp2Shared ) { INTN Index; @@ -233,7 +234,7 @@ FreePools: STATIC EFI_STATUS Pp2DxeBmStart ( - VOID + MVPP2_SHARED *Mvpp2Shared ) { UINT8 *Buff, *BuffPhys; @@ -247,7 +248,7 @@ Pp2DxeBmStart ( =20 /* Fill BM pool with Buffers */ for (Index =3D 0; Index < MVPP2_BM_SIZE; Index++) { - Buff =3D (UINT8 *)(BufferLocation.RxBuffers[Pool] + (Index * RX_BUFF= ER_SIZE)); + Buff =3D (UINT8 *)(Mvpp2Shared->BufferLocation.RxBuffers[Pool] + (In= dex * RX_BUFFER_SIZE)); if (Buff =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } @@ -342,6 +343,7 @@ Pp2DxeSetupAggrTxqs ( ) { MVPP2_TX_QUEUE *AggrTxq; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; =20 AggrTxq =3D Mvpp2Shared->AggrTxqs; AggrTxq->DescsPhys =3D (DmaAddrT)AggrTxq->Descs; @@ -361,6 +363,7 @@ Pp2DxeOpen ( ) { PP2DXE_PORT *Port =3D &Pp2Context->Port; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; UINT8 MacBcast[NET_ETHER_ADDR_LEN] =3D { 0xff, 0xff, 0xff, 0xff, 0xff, 0= xff }; UINT8 DevAddr[NET_ETHER_ADDR_LEN]; INTN Ret; @@ -412,6 +415,7 @@ Pp2DxeLatePortInitialize ( ) { PP2DXE_PORT *Port =3D &Pp2Context->Port; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; INTN Queue; =20 Port->TxRingSize =3D MVPP2_MAX_TXD; @@ -428,7 +432,7 @@ Pp2DxeLatePortInitialize ( } =20 /* Use preallocated area */ - Port->Txqs[0].Descs =3D BufferLocation.TxDescs[Port->Id]; + Port->Txqs[0].Descs =3D Mvpp2Shared->BufferLocation.TxDescs[Port->Id]; =20 for (Queue =3D 0; Queue < TxqNumber; Queue++) { MVPP2_TX_QUEUE *Txq =3D &Port->Txqs[Queue]; @@ -444,7 +448,7 @@ Pp2DxeLatePortInitialize ( return EFI_OUT_OF_RESOURCES; } =20 - Port->Rxqs[0].Descs =3D BufferLocation.RxDescs[Port->Id]; + Port->Rxqs[0].Descs =3D Mvpp2Shared->BufferLocation.RxDescs[Port->Id]; =20 for (Queue =3D 0; Queue < TxqNumber; Queue++) { MVPP2_RX_QUEUE *Rxq =3D &Port->Rxqs[Queue]; @@ -666,6 +670,7 @@ Pp2DxeHalt ( { PP2DXE_CONTEXT *Pp2Context =3D Context; PP2DXE_PORT *Port =3D &Pp2Context->Port; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; STATIC BOOLEAN CommonPartHalted =3D FALSE; INTN Index; =20 @@ -737,6 +742,7 @@ Pp2SnpStationAddress ( PP2DXE_CONTEXT *Pp2Context =3D INSTANCE_FROM_SNP(Snp); PP2_DEVICE_PATH *Pp2DevicePath =3D Pp2Context->DevicePath; PP2DXE_PORT *Port =3D &Pp2Context->Port; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; UINT32 State =3D Snp->Mode->State; EFI_TPL SavedTpl; INTN Ret; @@ -877,6 +883,7 @@ Pp2SnpTransmit ( { PP2DXE_CONTEXT *Pp2Context =3D INSTANCE_FROM_SNP(This); PP2DXE_PORT *Port =3D &Pp2Context->Port; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; MVPP2_TX_QUEUE *AggrTxq =3D Mvpp2Shared->AggrTxqs; MVPP2_TX_DESC *TxDesc; EFI_STATUS Status; @@ -1002,6 +1009,7 @@ Pp2SnpReceive ( INTN ReceivedPackets; PP2DXE_CONTEXT *Pp2Context =3D INSTANCE_FROM_SNP(This); PP2DXE_PORT *Port =3D &Pp2Context->Port; + MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv; UINTN PhysAddr, VirtAddr; EFI_STATUS Status =3D EFI_SUCCESS; EFI_TPL SavedTpl; @@ -1160,11 +1168,12 @@ Pp2DxeParsePortPcd ( Pp2Context->Port.Speed =3D Speed[Pp2Context->Instance]; } =20 +STATIC EFI_STATUS -EFIAPI -Pp2DxeInitialise ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable +Pp2DxeInitialiseController ( + IN MVPP2_SHARED *Mvpp2Shared, + IN UINTN BaseAddress, + IN UINTN ClockFrequency ) { PP2DXE_CONTEXT *Pp2Context =3D NULL; @@ -1179,19 +1188,12 @@ Pp2DxeInitialise ( return EFI_INVALID_PARAMETER; } =20 - /* Initialize private data */ - Mvpp2Shared =3D AllocateZeroPool (sizeof (MVPP2_SHARED)); - if (Mvpp2Shared =3D=3D NULL) { - DEBUG((DEBUG_ERROR, "Allocation fail.\n")); - return EFI_OUT_OF_RESOURCES; - } - - Mvpp2Shared->Base =3D PcdGet64 (PcdPp2SharedAddress); + Mvpp2Shared->Base =3D BaseAddress; Mvpp2Shared->Rfu1Base =3D Mvpp2Shared->Base + MVPP22_RFU1_OFFSET; Mvpp2Shared->XpcsBase =3D Mvpp2Shared->Base + MVPP22_XPCS_OFFSET; Mvpp2Shared->MpcsBase =3D Mvpp2Shared->Base + MVPP22_MPCS_OFFSET; Mvpp2Shared->SmiBase =3D Mvpp2Shared->Base + MVPP22_SMI_OFFSET; - Mvpp2Shared->Tclk =3D PcdGet32 (PcdPp2ClockFrequency); + Mvpp2Shared->Tclk =3D ClockFrequency; =20 /* Prepare buffers */ Status =3D DmaAllocateAlignedBuffer (EfiBootServicesData, @@ -1206,21 +1208,21 @@ Pp2DxeInitialise ( ZeroMem (BufferSpace, BD_SPACE); =20 for (Index =3D 0; Index < MVPP2_MAX_PORT; Index++) { - BufferLocation.TxDescs[Index] =3D (MVPP2_TX_DESC *) + Mvpp2Shared->BufferLocation.TxDescs[Index] =3D (MVPP2_TX_DESC *) (BufferSpace + Index * MVPP2_MAX_TXD * sizeof(MVPP2_TX_DESC)); } =20 - BufferLocation.AggrTxDescs =3D (MVPP2_TX_DESC *) + Mvpp2Shared->BufferLocation.AggrTxDescs =3D (MVPP2_TX_DESC *) ((UINTN)BufferSpace + MVPP2_MAX_TXD * MVPP2_MAX_PORT * sizeof(MVPP2_TX= _DESC)); =20 for (Index =3D 0; Index < MVPP2_MAX_PORT; Index++) { - BufferLocation.RxDescs[Index] =3D (MVPP2_RX_DESC *) + Mvpp2Shared->BufferLocation.RxDescs[Index] =3D (MVPP2_RX_DESC *) ((UINTN)BufferSpace + (MVPP2_MAX_TXD * MVPP2_MAX_PORT + MVPP2_AGGR_T= XQ_SIZE) * sizeof(MVPP2_TX_DESC) + Index * MVPP2_MAX_RXD * sizeof(MVPP2_RX_DESC= )); } =20 for (Index =3D 0; Index < MVPP2_MAX_PORT; Index++) { - BufferLocation.RxBuffers[Index] =3D (DmaAddrT) + Mvpp2Shared->BufferLocation.RxBuffers[Index] =3D (DmaAddrT) (BufferSpace + (MVPP2_MAX_TXD * MVPP2_MAX_PORT + MVPP2_AGGR_TXQ_SIZE= ) * sizeof(MVPP2_TX_DESC) + MVPP2_MAX_RXD * MVPP2_MAX_PORT * sizeof(MVPP= 2_RX_DESC) + Index * MVPP2_BM_SIZE * RX_BUFFER_SIZE); @@ -1228,7 +1230,7 @@ Pp2DxeInitialise ( =20 /* Initialize HW */ Mvpp2AxiConfig(Mvpp2Shared); - Pp2DxeBmPoolInit(); + Pp2DxeBmPoolInit (Mvpp2Shared); Mvpp2RxFifoInit(Mvpp2Shared); =20 Mvpp2Shared->PrsShadow =3D AllocateZeroPool (sizeof(MVPP2_PRS_SHADOW) * = MVPP2_PRS_TCAM_SRAM_SIZE); @@ -1245,7 +1247,7 @@ Pp2DxeInitialise ( =20 Mvpp2ClsInit(Mvpp2Shared); =20 - Status =3D Pp2DxeBmStart(); + Status =3D Pp2DxeBmStart (Mvpp2Shared); if (EFI_ERROR(Status)) { DEBUG((DEBUG_ERROR, "Pp2Dxe: BM start error\n")); return Status; @@ -1258,7 +1260,7 @@ Pp2DxeInitialise ( return EFI_OUT_OF_RESOURCES; } =20 - Mvpp2Shared->AggrTxqs->Descs =3D BufferLocation.AggrTxDescs; + Mvpp2Shared->AggrTxqs->Descs =3D Mvpp2Shared->BufferLocation.AggrTxDescs; Mvpp2Shared->AggrTxqs->Id =3D 0; Mvpp2Shared->AggrTxqs->LogId =3D 0; Mvpp2Shared->AggrTxqs->Size =3D MVPP2_AGGR_TXQ_SIZE; @@ -1316,3 +1318,56 @@ Pp2DxeInitialise ( =20 return EFI_SUCCESS; } + +EFI_STATUS +EFIAPI +Pp2DxeInitialise ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + MVHW_PP2_DESC *Desc =3D &mA7k8kPp2DescTemplate; + UINT8 *Pp2DeviceTable, Index; + MVPP2_SHARED *Mvpp2Shared; + EFI_STATUS Status; + + /* Obtain table with enabled Pp2 devices */ + Pp2DeviceTable =3D (UINT8 *)PcdGetPtr (PcdPp2Controllers); + if (Pp2DeviceTable =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Missing PcdPp2Controllers\n")); + return EFI_INVALID_PARAMETER; + } + + if (PcdGetSize (PcdPp2Controllers) > MVHW_MAX_PP2_DEVS) { + DEBUG ((DEBUG_ERROR, "Wrong PcdPp2Controllers format\n")); + return EFI_INVALID_PARAMETER; + } + + /* Initialize enabled chips */ + for (Index =3D 0; Index < PcdGetSize (PcdPp2Controllers); Index++) { + if (!MVHW_DEV_ENABLED (Pp2, Index)) { + DEBUG ((DEBUG_ERROR, "Skip Pp2 controller %d\n", Index)); + continue; + } + + /* Initialize private data */ + Mvpp2Shared =3D AllocateZeroPool (sizeof (MVPP2_SHARED)); + if (Mvpp2Shared =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Pp2Dxe #%d: Mvpp2Shared allocation fail\n", In= dex)); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D Pp2DxeInitialiseController ( + Mvpp2Shared, + Desc->Pp2BaseAddresses[Index], + Desc->Pp2ClockFrequency[Index] + ); + if (EFI_ERROR(Status)) { + FreePool (Mvpp2Shared); + DEBUG ((DEBUG_ERROR, "Pp2Dxe #%d: Controller initialisation fail\n",= Index)); + return Status; + } + } + + return EFI_SUCCESS; +} diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h b/Platform/Marvel= l/Drivers/Net/Pp2Dxe/Pp2Dxe.h index 9e71ec9..7071cef 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.h @@ -262,6 +262,14 @@ typedef struct { =20 typedef struct Pp2DxePort PP2DXE_PORT; =20 +/* Structure for preallocation for buffer */ +typedef struct { + MVPP2_TX_DESC *TxDescs[MVPP2_MAX_PORT]; + MVPP2_TX_DESC *AggrTxDescs; + MVPP2_RX_DESC *RxDescs[MVPP2_MAX_PORT]; + DmaAddrT RxBuffers[MVPP2_MAX_PORT]; +} BUFFER_LOCATION; + /* Shared Packet Processor resources */ typedef struct { /* Shared registers' base addresses */ @@ -271,6 +279,9 @@ typedef struct { UINT64 SmiBase; UINT64 XpcsBase; =20 + /* Preallocated buffers */ + BUFFER_LOCATION BufferLocation; + /* List of pointers to Port structures */ PP2DXE_PORT **PortList; =20 @@ -330,14 +341,6 @@ struct Pp2DxePort { UINT8 FirstRxq; }; =20 -/* Structure for preallocation for buffer */ -typedef struct { - MVPP2_TX_DESC *TxDescs[MVPP2_MAX_PORT]; - MVPP2_TX_DESC *AggrTxDescs; - MVPP2_RX_DESC *RxDescs[MVPP2_MAX_PORT]; - DmaAddrT RxBuffers[MVPP2_MAX_PORT]; -} BUFFER_LOCATION; - typedef struct { MAC_ADDR_DEVICE_PATH Pp2Mac; EFI_DEVICE_PATH_PROTOCOL End; diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf b/Platform/Marv= ell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf index ecd82b6..b67162d 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf @@ -73,13 +73,12 @@ [Pcd] gMarvellTokenSpaceGuid.PcdPhyConnectionTypes gMarvellTokenSpaceGuid.PcdPhySmiAddresses - gMarvellTokenSpaceGuid.PcdPp2ClockFrequency + gMarvellTokenSpaceGuid.PcdPp2Controllers gMarvellTokenSpaceGuid.PcdPp2GopIndexes gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed gMarvellTokenSpaceGuid.PcdPp2NumPorts gMarvellTokenSpaceGuid.PcdPp2PortIds - gMarvellTokenSpaceGuid.PcdPp2SharedAddress =20 [Depex] TRUE diff --git a/Platform/Marvell/Include/Library/MvHwDescLib.h b/Platform/Marv= ell/Include/Library/MvHwDescLib.h index ac8dc37..6a86865 100644 --- a/Platform/Marvell/Include/Library/MvHwDescLib.h +++ b/Platform/Marvell/Include/Library/MvHwDescLib.h @@ -85,6 +85,17 @@ typedef struct { } MVHW_NONDISCOVERABLE_DESC; =20 // +// PP2 NIC devices description template definition +// +#define MVHW_MAX_PP2_DEVS 4 + +typedef struct { + UINT8 Pp2DevCount; + UINTN Pp2BaseAddresses[MVHW_MAX_PP2_DEVS]; + UINTN Pp2ClockFrequency[MVHW_MAX_PP2_DEVS]; +} MVHW_PP2_DESC; + +// // RealTimeClock devices description template definition // #define MVHW_MAX_RTC_DEVS 2 @@ -153,6 +164,21 @@ MVHW_NONDISCOVERABLE_DESC mA7k8kNonDiscoverableDescTem= plate =3D {\ } =20 // +// Platform description of Pp2 NIC devices +// +#define MVHW_CP0_PP2_BASE 0xF2000000 +#define MVHW_CP1_PP2_BASE 0xF4000000 +#define MVHW_PP2_CLK_FREQ 333333333 + +#define DECLARE_A7K8K_PP2_TEMPLATE \ +STATIC \ +MVHW_PP2_DESC mA7k8kPp2DescTemplate =3D {\ + 2,\ + { MVHW_CP0_PP2_BASE, MVHW_CP1_PP2_BASE },\ + { MVHW_PP2_CLK_FREQ, MVHW_PP2_CLK_FREQ } \ +} + +// // Platform description of RealTimeClock devices // #define MVHW_CP0_RTC0_BASE 0xF2284000 diff --git a/Platform/Marvell/Marvell.dec b/Platform/Marvell/Marvell.dec index 9e2f706..e6a3621 100644 --- a/Platform/Marvell/Marvell.dec +++ b/Platform/Marvell/Marvell.dec @@ -169,13 +169,12 @@ =20 #NET gMarvellTokenSpaceGuid.PcdPhySmiAddresses|{ 0x0 }|VOID*|0x3000024 - gMarvellTokenSpaceGuid.PcdPp2ClockFrequency|0|UINT32|0x3000026 + gMarvellTokenSpaceGuid.PcdPp2Controllers|{ 0x0 }|VOID*|0x3000028 gMarvellTokenSpaceGuid.PcdPp2GopIndexes|{ 0x0 }|VOID*|0x3000029 gMarvellTokenSpaceGuid.PcdPp2InterfaceAlwaysUp|{ 0x0 }|VOID*|0x300002A gMarvellTokenSpaceGuid.PcdPp2InterfaceSpeed|{ 0x0 }|VOID*|0x300002B gMarvellTokenSpaceGuid.PcdPp2NumPorts|0|UINT32|0x300002D gMarvellTokenSpaceGuid.PcdPp2PortIds|{ 0x0 }|VOID*|0x300002C - gMarvellTokenSpaceGuid.PcdPp2SharedAddress|0|UINT64|0x300002F =20 #PciEmulation gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x0 }|VOID*|0x3000033 --=20 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel