From nobody Sat Dec 28 10:30:32 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 1499174702795933.9448680858715; Tue, 4 Jul 2017 06:25:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B0D1220945619; Tue, 4 Jul 2017 06:23:01 -0700 (PDT) Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) (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 AD94520945610 for ; Tue, 4 Jul 2017 06:22:59 -0700 (PDT) Received: by mail-lf0-x22d.google.com with SMTP id t72so9320328lff.1 for ; Tue, 04 Jul 2017 06:24:37 -0700 (PDT) Received: from mw-mint.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id c185sm4980970lfc.43.2017.07.04.06.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 06:24:34 -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=0nB+SGF5sC9IK48WVdVczTCMaK5LJyMlz+eApJSCGjM=; b=htFhwPGnWEJb4sN6BiKAsYdSsnqmlRUmkwRhA2aWi9Zb5dItOIseC7j0IdMaG6PJH3 NqX6I52MBNLhIu/vzeSRB1HGVydY421tVqDODu5n2GqqeLLfdjBrcm2DZVtbqrnbfEjs lRj9cyx3xPczBQJTwgqFfTV8JcUHtAfm1WBuaCz+i4jNuK/6hBEsXdmsvFxwWDqHikZS bjb7gQXb1XILD4xLJ41Kzv50VLYas7b2Ol8a6FCHkuRWgjctzpMLVG9DehPTM4zebqIY UHx720hyOYR5abywiiFzcY/m1F6g/TylDZMHZ6xIV3ii+a/NDGkmAQ9nz2d4xz6qE4l3 PqOQ== 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=0nB+SGF5sC9IK48WVdVczTCMaK5LJyMlz+eApJSCGjM=; b=IqzprX8+hWerACnNwogXhL7JMNM6mgxArJJF3UJ7HU9SEa4zFNh6vvFKJQfOrWSe2O aJjIVT/E+QdZtBhuy3Vp1zq9X06XgleQf0QwSQzTVMxzennNwNVpvBxSm5Qhqg9JkIaN uriUcHIYCGarK5dlxwKU5jtpRgPH0YP+iYpIthrAcVAhDUqJCNiYsVdUtkMhP0JaQshg aKmDSsy+yxa42g4B0SXmysS9ZqwV8iNWraxZ0OQ1CPHFfMEqYdFvL+fEdVRmolRQfDm8 RHnXOZfRIh+fWOhf/wOOL7TQGpBGCkXVqsVNiL8wro+p/kLltMfCtN5DkqtuMk1SGnUU WHXg== X-Gm-Message-State: AKS2vOx4Q0dHZTaBmxilSDJU++G7V+gXhfUJPv/OTQYAAfT6LNIH5PMW 2lh7ine5K4qCqBRZj/gbIg== X-Received: by 10.25.145.82 with SMTP id y18mr13078301lfj.158.1499174675742; Tue, 04 Jul 2017 06:24:35 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Tue, 4 Jul 2017 15:24:11 +0200 Message-Id: <1499174653-330-9-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499174653-330-1-git-send-email-mw@semihalf.com> References: <1499174653-330-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH 08/10] Platform/Marvell: ComPhyLib: 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, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org 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 ComPhy description, using the new structures and template in MvHwDescLib. This change enables more flexible addition of multiple ComPhy chips and also significantly reduces amount of used PCD's for that purpose. Update PortingGuide documentation accordingly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Documentation/Marvell/PortingGuide/ComPhy.txt | 64 ++++------------- Platform/Marvell/Armada/Armada70x0.dsc | 13 +--- Platform/Marvell/Include/Library/MvComPhyLib.h | 5 ++ Platform/Marvell/Include/Library/MvHwDescLib.h | 38 ++++++++++ Platform/Marvell/Library/ComPhyLib/ComPhyLib.c | 89 ++++++++++++++++----= ---- Platform/Marvell/Library/ComPhyLib/ComPhyLib.h | 14 +--- Platform/Marvell/Library/ComPhyLib/ComPhyLib.inf | 26 +------ Platform/Marvell/Marvell.dec | 28 +------- 8 files changed, 122 insertions(+), 155 deletions(-) diff --git a/Documentation/Marvell/PortingGuide/ComPhy.txt b/Documentation/= Marvell/PortingGuide/ComPhy.txt index b5c4727..a96015e 100644 --- a/Documentation/Marvell/PortingGuide/ComPhy.txt +++ b/Documentation/Marvell/PortingGuide/ComPhy.txt @@ -2,44 +2,18 @@ COMPHY configuration --------------------------- In order to configure ComPhy library, following PCDs are available: =20 - gMarvellTokenSpaceGuid.PcdComPhyChipCount + gMarvellTokenSpaceGuid.PcdComPhyDevices =20 -Indicates how many different chips are placed on board. So far, up to 4 ch= ips -are supported. +This array indicates, which ones of the ComPhy chips defined in +MVHW_COMPHY_DESC template will be configured. =20 Every ComPhy PCD has part where stands for chip ID (order is n= ot important, but configuration will be set for first PcdComPhyChipCount chip= s). =20 -Every chip has 8 ComPhy PCDs and three of them concern lanes settings for = this -chip. Below is example for the first chip (Chip0). - -General PCDs: - - gMarvellTokenSpaceGuid.PcdChip0Compatible - -Unicode string indicating type of chip - currently supported is -{ L"Cp110" } - - gMarvellTokenSpaceGuid.PcdChip0ComPhyBaseAddress - -Indicates COMPHY unit base address. - - gMarvellTokenSpaceGuid.PcdChip0Hpipe3BaseAddress - -Indicates Hpipe3 unit base address. - - gMarvellTokenSpaceGuid.PcdChip0ComPhyMuxBitCount - -Indicates number of bits that are allocated for every MUX in the -COMPHY-selector register. - - gMarvellTokenSpaceGuid.PcdChip0ComPhyMaxLanes - -Indicates maximum ComPhy lanes number. - -Next three PCDs are in unicode string format containing settings for up to= 10 -lanes. Setting for each one is separated with semicolon. These PCDs form -structure describing outputs of PHY integrated in simple cihp. +Every chip has 3 ComPhy PCDs and three of them comprise per-board lanes +settings for this chip. Their format is unicode string, containing settings +for up to 10 lanes. Setting for each one is separated with semicolon. +These PCDs together describe outputs of PHY integrated in simple cihp. Below is example for the first chip (Chip0). =20 gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes @@ -48,16 +22,9 @@ Unicode string indicating PHY types. Currently supported= are: =20 { L"unconnected", L"PCIE0", L"PCIE1", L"PCIE2", L"PCIE3", L"SATA0", L"SATA1", L"SATA2", L"SATA3", L"SGMII0", -L"SGMII1", L"SGMII2", L"SGMII3", L"QSGMII", +L"SGMII1", L"SGMII2", L"SGMII3", L"USB3_HOST0", L"USB3_HOST1", L"USB3_DEVICE", -L"XAUI0", L"XAUI1", L"XAUI2", L"XAUI3", L"RXAUI0", -L"RXAUI1", L"KR" } - -Below documents describes some of above interfaces' types: - -SGMII, QSGMII, XAUI - IEEE 802.3 -KR - IEEE 802.3a -RXAUI - RXAUI Interface and RXAUI Adapter Specification, Marvell +L"RXAUI0", L"RXAUI1", L"SFI" } =20 gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds =20 @@ -72,14 +39,7 @@ Indicates lane polarity invert. Example ------- #ComPhy - gMarvellTokenSpaceGuid.PcdComPhyChipCount|1 - - gMarvellTokenSpaceGuid.PcdChip0ComPhyMaxLanes|6 - gMarvellTokenSpaceGuid.PcdChip0ComPhyBaseAddress|0xF2441000 - gMarvellTokenSpaceGuid.PcdChip0Hpipe3BaseAddress|0xF2120000 - gMarvellTokenSpaceGuid.PcdChip0ComPhyMuxBitCount|4 - gMarvellTokenSpaceGuid.PcdChip0Compatible|L"Cp110" - - gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes|L"SGMII2;USB3_HOST0;SGMII0;SA= TA1;USB3_HOST1;PCIE2" - gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds|L"1250;5000;1250;5000;5000;5= 000" + gMarvellTokenSpaceGuid.PcdComPhyDevices|{ 0x1 } + gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes|L"SGMII1;USB3_HOST0;SFI;SATA1= ;USB3_HOST1;PCIE2" + gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds|L"1250;5000;10310;5000;5000;= 5000" =20 diff --git a/Platform/Marvell/Armada/Armada70x0.dsc b/Platform/Marvell/Arma= da/Armada70x0.dsc index af602d5..3440038 100644 --- a/Platform/Marvell/Armada/Armada70x0.dsc +++ b/Platform/Marvell/Armada/Armada70x0.dsc @@ -97,13 +97,9 @@ gMarvellTokenSpaceGuid.PcdSpiFlashId|0x20BA18 =20 #ComPhy - gMarvellTokenSpaceGuid.PcdComPhyChipCount|1 - - gMarvellTokenSpaceGuid.PcdChip0ComPhyMaxLanes|6 - gMarvellTokenSpaceGuid.PcdChip0ComPhyBaseAddress|0xF2441000 - gMarvellTokenSpaceGuid.PcdChip0Hpipe3BaseAddress|0xF2120000 - gMarvellTokenSpaceGuid.PcdChip0ComPhyMuxBitCount|4 - gMarvellTokenSpaceGuid.PcdChip0Compatible|L"Cp110m" + gMarvellTokenSpaceGuid.PcdComPhyDevices|{ 0x1 } + gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes|L"SGMII1;USB3_HOST0;SGMII0;SA= TA1;USB3_HOST1;PCIE2" + gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds|L"3125;5000;1250;5000;5000;5= 000" =20 #UtmiPhy gMarvellTokenSpaceGuid.PcdUtmiPhyCount|2 @@ -112,9 +108,6 @@ gMarvellTokenSpaceGuid.PcdUtmiPhyRegUtmiUnit|L"0xF2580000;0xF2581000" gMarvellTokenSpaceGuid.PcdUtmiPhyUtmiPort|L"0x0;0x1" =20 - gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes|L"SGMII1;USB3_HOST0;SGMII0;SA= TA1;USB3_HOST1;PCIE2" - gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds|L"3125;5000;1250;5000;5000;5= 000" - #MDIO gMarvellTokenSpaceGuid.PcdMdioBaseAddress|0xF212A200 =20 diff --git a/Platform/Marvell/Include/Library/MvComPhyLib.h b/Platform/Marv= ell/Include/Library/MvComPhyLib.h index 6bd6243..6076ede 100644 --- a/Platform/Marvell/Include/Library/MvComPhyLib.h +++ b/Platform/Marvell/Include/Library/MvComPhyLib.h @@ -35,6 +35,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM= AGE. #ifndef __MVCOMPHYLIB_H__ #define __MVCOMPHYLIB_H__ =20 +typedef enum { + MvComPhyTypeCp110, + MvComPhyTypeMax, +} MV_COMPHY_CHIP_TYPE; + EFI_STATUS MvComPhyInit ( VOID diff --git a/Platform/Marvell/Include/Library/MvHwDescLib.h b/Platform/Marv= ell/Include/Library/MvHwDescLib.h index 32284a0..ac8dc37 100644 --- a/Platform/Marvell/Include/Library/MvHwDescLib.h +++ b/Platform/Marvell/Include/Library/MvHwDescLib.h @@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA= GE. #ifndef __MVHWDESCLIB_H__ #define __MVHWDESCLIB_H__ =20 +#include #include =20 // @@ -45,6 +46,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM= AGE. #define MVHW_DEV_ENABLED(type, index) (type ## DeviceTable[index]) =20 // +// CommonPhy devices description template definition +// +#define MVHW_MAX_COMPHY_DEVS 4 + +typedef struct { + UINT8 ComPhyDevCount; + UINTN ComPhyBaseAddresses[MVHW_MAX_COMPHY_DEVS]; + UINTN ComPhyHpipe3BaseAddresses[MVHW_MAX_COMPHY_DEVS]; + UINTN ComPhyLaneCount[MVHW_MAX_COMPHY_DEVS]; + UINTN ComPhyMuxBitCount[MVHW_MAX_COMPHY_DEVS]; + MV_COMPHY_CHIP_TYPE ComPhyChipType[MVHW_MAX_COMPHY_DEVS]; +} MVHW_COMPHY_DESC; + +// // NonDiscoverable devices description template definition // #define MVHW_MAX_XHCI_DEVS 4 @@ -81,6 +96,29 @@ typedef struct { } MVHW_RTC_DESC; =20 // +// Platform description of CommonPhy devices +// +#define MVHW_CP0_COMPHY_BASE 0xF2441000 +#define MVHW_CP0_HPIPE3_BASE 0xF2120000 +#define MVHW_CP0_COMPHY_LANES 6 +#define MVHW_CP0_COMPHY_MUX_BITS 4 +#define MVHW_CP1_COMPHY_BASE 0xF4441000 +#define MVHW_CP1_HPIPE3_BASE 0xF4120000 +#define MVHW_CP1_COMPHY_LANES 6 +#define MVHW_CP1_COMPHY_MUX_BITS 4 + +#define DECLARE_A7K8K_COMPHY_TEMPLATE \ +STATIC \ +MVHW_COMPHY_DESC mA7k8kComPhyDescTemplate =3D {\ + 2,\ + { MVHW_CP0_COMPHY_BASE, MVHW_CP1_COMPHY_BASE },\ + { MVHW_CP0_HPIPE3_BASE, MVHW_CP1_HPIPE3_BASE },\ + { MVHW_CP0_COMPHY_LANES, MVHW_CP1_COMPHY_LANES },\ + { MVHW_CP0_COMPHY_MUX_BITS, MVHW_CP1_COMPHY_MUX_BITS },\ + { MvComPhyTypeCp110, MvComPhyTypeCp110 }\ +} + +// // Platform description of NonDiscoverable devices // #define MVHW_CP0_XHCI0_BASE 0xF2500000 diff --git a/Platform/Marvell/Library/ComPhyLib/ComPhyLib.c b/Platform/Marv= ell/Library/ComPhyLib/ComPhyLib.c index 174f10d..b61ccb6 100644 --- a/Platform/Marvell/Library/ComPhyLib/ComPhyLib.c +++ b/Platform/Marvell/Library/ComPhyLib/ComPhyLib.c @@ -33,6 +33,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM= AGE. **************************************************************************= *****/ =20 #include "ComPhyLib.h" +#include +#include + +DECLARE_A7K8K_COMPHY_TEMPLATE; =20 CHAR16 * TypeStringTable [] =3D {L"unconnected", L"PCIE0", L"PCIE1", L"PCI= E2", L"PCIE3", L"SATA0", L"SATA1", L"SATA2", L"SATA3= ", @@ -46,14 +50,10 @@ CHAR16 * SpeedStringTable [] =3D {L"-", L"1.25 Gbps", L= "1.5 Gbps", L"2.5 Gbps", L"6 Gbps", L"6.25 Gbps", L"10.31 Gbps"}; =20 CHIP_COMPHY_CONFIG ChipCfgTbl[] =3D { - { /* CP master */ - .ChipType =3D L"Cp110m", + { + .ChipType =3D MvComPhyTypeCp110, .Init =3D ComPhyCp110Init }, - { /* CP slave */ - .ChipType =3D L"Cp110s", - .Init =3D ComPhyCp110Init - } }; =20 VOID @@ -208,13 +208,12 @@ GetChipComPhyInit ( TblSize =3D sizeof(ChipCfgTbl) / sizeof(ChipCfgTbl[0]); =20 for (i =3D 0; i < TblSize ; i++) { - if (StrCmp (PtrChipCfg->ChipType, ChipCfgTbl[i].ChipType) =3D=3D 0) { + if (PtrChipCfg->ChipType =3D=3D ChipCfgTbl[i].ChipType) { PtrChipCfg->Init =3D ChipCfgTbl[i].Init; return EFI_SUCCESS; } } =20 - DEBUG((DEBUG_ERROR, "ComPhy: Empty ChipType string\n")); return EFI_D_ERROR; } =20 @@ -222,18 +221,35 @@ STATIC VOID InitComPhyConfig ( IN OUT CHIP_COMPHY_CONFIG *ChipConfig, - IN OUT PCD_LANE_MAP *LaneData + IN OUT PCD_LANE_MAP *LaneData, + IN UINT8 Id ) { + MVHW_COMPHY_DESC *Desc =3D &mA7k8kComPhyDescTemplate; + + ChipConfig->ChipType =3D Desc->ComPhyChipType[Id]; + ChipConfig->ComPhyBaseAddr =3D Desc->ComPhyBaseAddresses[Id]; + ChipConfig->Hpipe3BaseAddr =3D Desc->ComPhyHpipe3BaseAddresses[Id]; + ChipConfig->LanesCount =3D Desc->ComPhyLaneCount[Id]; + ChipConfig->MuxBitCount =3D Desc->ComPhyMuxBitCount[Id]; + /* - * Below macro contains variable name concatenation (used to form PCD's = name) - * and that's why invoking it cannot be automated, e.g. using for loop. - * Currently up to 4 ComPhys might be configured. + * Below macro contains variable name concatenation (used to form PCD's = name). */ - GetComPhyPcd(ChipConfig, LaneData, 0); - GetComPhyPcd(ChipConfig, LaneData, 1); - GetComPhyPcd(ChipConfig, LaneData, 2); - GetComPhyPcd(ChipConfig, LaneData, 3); + switch (Id) { + case 0: + GetComPhyPcd (ChipConfig, LaneData, 0); + break; + case 1: + GetComPhyPcd (ChipConfig, LaneData, 1); + break; + case 2: + GetComPhyPcd (ChipConfig, LaneData, 2); + break; + case 3: + GetComPhyPcd (ChipConfig, LaneData, 3); + break; + } } =20 EFI_STATUS @@ -242,29 +258,42 @@ MvComPhyInit ( ) { EFI_STATUS Status; - CHIP_COMPHY_CONFIG ChipConfig[MAX_CHIPS], *PtrChipCfg; - PCD_LANE_MAP LaneData[MAX_CHIPS]; - UINT32 Lane, ChipCount, i, MaxComphyCount; - - ChipCount =3D PcdGet32 (PcdComPhyChipCount); - - InitComPhyConfig(ChipConfig, LaneData); + CHIP_COMPHY_CONFIG ChipConfig[MVHW_MAX_COMPHY_DEVS], *PtrChipCfg; + PCD_LANE_MAP LaneData[MVHW_MAX_COMPHY_DEVS]; + UINT32 Lane, MaxComphyCount; + UINT8 *ComPhyDeviceTable, Index; + + /* Obtain table with enabled ComPhy devices */ + ComPhyDeviceTable =3D (UINT8 *)PcdGetPtr (PcdComPhyDevices); + if (ComPhyDeviceTable =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Missing PcdComPhyDevices\n")); + return EFI_INVALID_PARAMETER; + } =20 - if (ChipCount <=3D 0 || ChipCount > MAX_CHIPS) + if (PcdGetSize (PcdComPhyDevices) > MVHW_MAX_COMPHY_DEVS) { + DEBUG ((DEBUG_ERROR, "Wrong PcdComPhyDevices format\n")); return EFI_INVALID_PARAMETER; + } + + /* Initialize enabled chips */ + for (Index =3D 0; Index < PcdGetSize (PcdComPhyDevices); Index++) { + if (!MVHW_DEV_ENABLED (ComPhy, Index)) { + DEBUG ((DEBUG_ERROR, "Skip ComPhy chip %d\n", Index)); + continue; + } =20 - for (i =3D 0; i < ChipCount ; i++) { - PtrChipCfg =3D &ChipConfig[i]; + PtrChipCfg =3D &ChipConfig[Index]; + InitComPhyConfig(PtrChipCfg, LaneData, Index); =20 /* Get the count of the SerDes of the specific chip */ MaxComphyCount =3D PtrChipCfg->LanesCount; for (Lane =3D 0; Lane < MaxComphyCount; Lane++) { /* Parse PCD with string indicating SerDes Type */ PtrChipCfg->MapData[Lane].Type =3D - ParseSerdesTypeString (LaneData[i].TypeStr[Lane]); + ParseSerdesTypeString (LaneData[Index].TypeStr[Lane]); PtrChipCfg->MapData[Lane].Speed =3D - ParseSerdesSpeed (LaneData[i].SpeedValue[Lane]); - PtrChipCfg->MapData[Lane].Invert =3D (UINT32) LaneData[i].InvFlag[La= ne]; + ParseSerdesSpeed (LaneData[Index].SpeedValue[Lane]); + PtrChipCfg->MapData[Lane].Invert =3D (UINT32)LaneData[Index].InvFlag= [Lane]; =20 if ((PtrChipCfg->MapData[Lane].Speed =3D=3D PHY_SPEED_INVALID) || (PtrChipCfg->MapData[Lane].Speed =3D=3D PHY_SPEED_ERROR) || @@ -278,7 +307,7 @@ MvComPhyInit ( =20 Status =3D GetChipComPhyInit (PtrChipCfg); if (EFI_ERROR(Status)) { - DEBUG((DEBUG_ERROR, "ComPhy: Invalid Chip%dType name\n", i)); + DEBUG ((DEBUG_ERROR, "ComPhy: Invalid Chip%d type\n", Index)); return Status; } =20 diff --git a/Platform/Marvell/Library/ComPhyLib/ComPhyLib.h b/Platform/Marv= ell/Library/ComPhyLib/ComPhyLib.h index 56bb991..3c589f2 100644 --- a/Platform/Marvell/Library/ComPhyLib/ComPhyLib.h +++ b/Platform/Marvell/Library/ComPhyLib/ComPhyLib.h @@ -40,22 +40,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DA= MAGE. #include #include #include +#include #include #include #include =20 #define MAX_LANE_OPTIONS 10 -#define MAX_CHIPS 4 =20 /***** Parsing PCD *****/ -#define GET_TYPE_STRING(id) PcdGetPtr(PcdChip##id##Compatible) #define GET_LANE_TYPE(id) PcdGetPtr(PcdChip##id##ComPhyTypes) #define GET_LANE_SPEED(id) PcdGetPtr(PcdChip##id##ComPhySpeeds) #define GET_LANE_INV(id) PcdGetPtr(PcdChip##id##ComPhyInvFlags) -#define GET_COMPHY_BASE_ADDR(id) PcdGet64(PcdChip##id##ComPhyBaseAddress) -#define GET_HPIPE3_BASE_ADDR(id) PcdGet64(PcdChip##id##Hpipe3BaseAddress) -#define GET_MUX_BIT_COUNT(id) PcdGet32(PcdChip##id##ComPhyMuxBitCount) -#define GET_MAX_LANES(id) PcdGet32(PcdChip##id##ComPhyMaxLanes) =20 #define FillLaneMap(chip_struct, lane_struct, id) { \ ParsePcdString((CHAR16 *) GET_LANE_TYPE(id), chip_struct[id].LanesCount,= NULL, lane_struct[id].TypeStr); \ @@ -64,11 +59,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM= AGE. } =20 #define GetComPhyPcd(chip_struct, lane_struct, id) { \ - chip_struct[id].ChipType =3D (CHAR16 *) GET_TYPE_STRING(id); \ - chip_struct[id].ComPhyBaseAddr =3D GET_COMPHY_BASE_ADDR(id); \ - chip_struct[id].Hpipe3BaseAddr =3D GET_HPIPE3_BASE_ADDR(id); \ - chip_struct[id].MuxBitCount =3D GET_MUX_BIT_COUNT(id); \ - chip_struct[id].LanesCount =3D GET_MAX_LANES(id); \ FillLaneMap(chip_struct, lane_struct, id); \ } =20 @@ -601,7 +591,7 @@ VOID ); =20 struct _CHIP_COMPHY_CONFIG { - CHAR16* ChipType; + MV_COMPHY_CHIP_TYPE ChipType; COMPHY_MAP MapData[MAX_LANE_OPTIONS]; COMPHY_MUX_DATA *MuxData; EFI_PHYSICAL_ADDRESS ComPhyBaseAddr; diff --git a/Platform/Marvell/Library/ComPhyLib/ComPhyLib.inf b/Platform/Ma= rvell/Library/ComPhyLib/ComPhyLib.inf index 45bfef2..e0f4634 100644 --- a/Platform/Marvell/Library/ComPhyLib/ComPhyLib.inf +++ b/Platform/Marvell/Library/ComPhyLib/ComPhyLib.inf @@ -59,48 +59,24 @@ ComPhyMux.c =20 [FixedPcd] - gMarvellTokenSpaceGuid.PcdComPhyChipCount + gMarvellTokenSpaceGuid.PcdComPhyDevices =20 #Chip0 - gMarvellTokenSpaceGuid.PcdChip0Compatible - gMarvellTokenSpaceGuid.PcdChip0ComPhyBaseAddress - gMarvellTokenSpaceGuid.PcdChip0Hpipe3BaseAddress - gMarvellTokenSpaceGuid.PcdChip0ComPhyMuxBitCount - gMarvellTokenSpaceGuid.PcdChip0ComPhyMaxLanes - gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds gMarvellTokenSpaceGuid.PcdChip0ComPhyInvFlags =20 #Chip1 - gMarvellTokenSpaceGuid.PcdChip1Compatible - gMarvellTokenSpaceGuid.PcdChip1ComPhyBaseAddress - gMarvellTokenSpaceGuid.PcdChip1Hpipe3BaseAddress - gMarvellTokenSpaceGuid.PcdChip1ComPhyMuxBitCount - gMarvellTokenSpaceGuid.PcdChip1ComPhyMaxLanes - gMarvellTokenSpaceGuid.PcdChip1ComPhyTypes gMarvellTokenSpaceGuid.PcdChip1ComPhySpeeds gMarvellTokenSpaceGuid.PcdChip1ComPhyInvFlags =20 #Chip2 - gMarvellTokenSpaceGuid.PcdChip2Compatible - gMarvellTokenSpaceGuid.PcdChip2ComPhyBaseAddress - gMarvellTokenSpaceGuid.PcdChip2Hpipe3BaseAddress - gMarvellTokenSpaceGuid.PcdChip2ComPhyMuxBitCount - gMarvellTokenSpaceGuid.PcdChip2ComPhyMaxLanes - gMarvellTokenSpaceGuid.PcdChip2ComPhyTypes gMarvellTokenSpaceGuid.PcdChip2ComPhySpeeds gMarvellTokenSpaceGuid.PcdChip2ComPhyInvFlags =20 #Chip3 - gMarvellTokenSpaceGuid.PcdChip3Compatible - gMarvellTokenSpaceGuid.PcdChip3ComPhyBaseAddress - gMarvellTokenSpaceGuid.PcdChip3Hpipe3BaseAddress - gMarvellTokenSpaceGuid.PcdChip3ComPhyMuxBitCount - gMarvellTokenSpaceGuid.PcdChip3ComPhyMaxLanes - gMarvellTokenSpaceGuid.PcdChip3ComPhyTypes gMarvellTokenSpaceGuid.PcdChip3ComPhySpeeds gMarvellTokenSpaceGuid.PcdChip3ComPhyInvFlags diff --git a/Platform/Marvell/Marvell.dec b/Platform/Marvell/Marvell.dec index 735a71f..5cbf0c3 100644 --- a/Platform/Marvell/Marvell.dec +++ b/Platform/Marvell/Marvell.dec @@ -130,48 +130,24 @@ gMarvellTokenSpaceGuid.PcdSpiFlashId|0|UINT32|0x3000056 =20 #ComPhy - #Chip0 - gMarvellTokenSpaceGuid.PcdComPhyChipCount|0|UINT32|0x30000098 - - gMarvellTokenSpaceGuid.PcdChip0Compatible|{ 0x0 }|VOID*|0x30000064 - gMarvellTokenSpaceGuid.PcdChip0ComPhyBaseAddress|0|UINT64|0x30000065 - gMarvellTokenSpaceGuid.PcdChip0Hpipe3BaseAddress|0|UINT64|0x30000066 - gMarvellTokenSpaceGuid.PcdChip0ComPhyMuxBitCount|0|UINT32|0x30000067 - gMarvellTokenSpaceGuid.PcdChip0ComPhyMaxLanes|0|UINT32|0x30001267 + gMarvellTokenSpaceGuid.PcdComPhyDevices|{ 0x0 }|VOID*|0x30000098 =20 + #Chip0 gMarvellTokenSpaceGuid.PcdChip0ComPhyTypes|{ 0x0 }|VOID*|0x30000068 gMarvellTokenSpaceGuid.PcdChip0ComPhySpeeds|{ 0x0 }|VOID*|0x30000069 gMarvellTokenSpaceGuid.PcdChip0ComPhyInvFlags|{ 0x0 }|VOID*|0x30000070 =20 #Chip1 - gMarvellTokenSpaceGuid.PcdChip1Compatible|{ 0x0 }|VOID*|0x30000100 - gMarvellTokenSpaceGuid.PcdChip1ComPhyBaseAddress|0|UINT64|0x30000101 - gMarvellTokenSpaceGuid.PcdChip1Hpipe3BaseAddress|0|UINT64|0x30000102 - gMarvellTokenSpaceGuid.PcdChip1ComPhyMuxBitCount|0|UINT32|0x30000103 - gMarvellTokenSpaceGuid.PcdChip1ComPhyMaxLanes|0|UINT32|0x30001304 - gMarvellTokenSpaceGuid.PcdChip1ComPhyTypes|{ 0x0 }|VOID*|0x30000105 gMarvellTokenSpaceGuid.PcdChip1ComPhySpeeds|{ 0x0 }|VOID*|0x30000106 gMarvellTokenSpaceGuid.PcdChip1ComPhyInvFlags|{ 0x0 }|VOID*|0x30000107 =20 #Chip2 - gMarvellTokenSpaceGuid.PcdChip2Compatible|{ 0x0 }|VOID*|0x30000135 - gMarvellTokenSpaceGuid.PcdChip2ComPhyBaseAddress|0|UINT64|0x30000136 - gMarvellTokenSpaceGuid.PcdChip2Hpipe3BaseAddress|0|UINT64|0x30000137 - gMarvellTokenSpaceGuid.PcdChip2ComPhyMuxBitCount|0|UINT32|0x30000138 - gMarvellTokenSpaceGuid.PcdChip2ComPhyMaxLanes|0|UINT32|0x30000139 - gMarvellTokenSpaceGuid.PcdChip2ComPhyTypes|{ 0x0 }|VOID*|0x30000140 gMarvellTokenSpaceGuid.PcdChip2ComPhySpeeds|{ 0x0 }|VOID*|0x30000141 gMarvellTokenSpaceGuid.PcdChip2ComPhyInvFlags|{ 0x0 }|VOID*|0x30000142 =20 #Chip3 - gMarvellTokenSpaceGuid.PcdChip3Compatible|{ 0x0 }|VOID*|0x30000170 - gMarvellTokenSpaceGuid.PcdChip3ComPhyBaseAddress|0|UINT64|0x30000171 - gMarvellTokenSpaceGuid.PcdChip3Hpipe3BaseAddress|0|UINT64|0x30000172 - gMarvellTokenSpaceGuid.PcdChip3ComPhyMuxBitCount|0|UINT32|0x30000173 - gMarvellTokenSpaceGuid.PcdChip3ComPhyMaxLanes|0|UINT32|0x30000174 - gMarvellTokenSpaceGuid.PcdChip3ComPhyTypes|{ 0x0 }|VOID*|0x30000175 gMarvellTokenSpaceGuid.PcdChip3ComPhySpeeds|{ 0x0 }|VOID*|0x30000176 gMarvellTokenSpaceGuid.PcdChip3ComPhyInvFlags|{ 0x0 }|VOID*|0x30000177 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel