public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <leif@nuviainc.com>
To: Pankaj Bansal <pankaj.bansal@nxp.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Varun Sethi <V.Sethi@nxp.com>,
	devel@edk2.groups.io
Subject: Re: [EXTERNAL] [PATCH 06/19] Silicon/NXP: remove print information from Soc lib
Date: Mon, 10 Feb 2020 17:09:11 +0000	[thread overview]
Message-ID: <20200210170911.GK23627@bivouac.eciton.net> (raw)
In-Reply-To: <20200207124328.8723-7-pankaj.bansal@nxp.com>

On Fri, Feb 07, 2020 at 18:13:15 +0530, Pankaj Bansal wrote:
> The Soc info being printed can be removed from SOC lib.
> We are in the process of implementing PEI Phase.
> After PEI phase impelmentation this info would be printed in
> common PEIM based on the information retrieved from PPIs.
> e.g. gArmMpCoreInfoPpiGuid can be used to print cluser and
> core info.
> 
> Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>

Reviewed-by: Leif Lindholm <leif@nuviainc.com>

/
    Leif

> ---
>  Silicon/NXP/Include/Chassis2/LsSerDes.h      |  62 ----
>  Silicon/NXP/LS1043A/Include/SocSerDes.h      |  51 ---
>  Silicon/NXP/Library/SocLib/Chassis.c         | 337 -------------------
>  Silicon/NXP/Library/SocLib/Chassis2/Soc.c    |   8 -
>  Silicon/NXP/Library/SocLib/LS1043aSocLib.inf |   1 -
>  Silicon/NXP/Library/SocLib/SerDes.c          | 268 ---------------
>  6 files changed, 727 deletions(-)
>  delete mode 100644 Silicon/NXP/Include/Chassis2/LsSerDes.h
>  delete mode 100644 Silicon/NXP/LS1043A/Include/SocSerDes.h
>  delete mode 100644 Silicon/NXP/Library/SocLib/SerDes.c
> 
> diff --git a/Silicon/NXP/Include/Chassis2/LsSerDes.h b/Silicon/NXP/Include/Chassis2/LsSerDes.h
> deleted file mode 100644
> index 9afbc52239..0000000000
> --- a/Silicon/NXP/Include/Chassis2/LsSerDes.h
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/** LsSerDes.h
> - The Header file of SerDes Module for Chassis 2
> -
> - Copyright 2017-2019 NXP
> -
> - SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifndef LS_SERDES_H_
> -#define LS_SERDES_H_
> -
> -#include <Uefi/UefiBaseType.h>
> -
> -#define SRDS_MAX_LANES     4
> -
> -typedef enum {
> -  None = 0,
> -  Pcie1,
> -  Pcie2,
> -  Pcie3,
> -  Sata,
> -  SgmiiFm1Dtsec1,
> -  SgmiiFm1Dtsec2,
> -  SgmiiFm1Dtsec5,
> -  SgmiiFm1Dtsec6,
> -  SgmiiFm1Dtsec9,
> -  SgmiiFm1Dtsec10,
> -  QsgmiiFm1A,
> -  XfiFm1Mac9,
> -  XfiFm1Mac10,
> -  Sgmii2500Fm1Dtsec2,
> -  Sgmii2500Fm1Dtsec5,
> -  Sgmii2500Fm1Dtsec9,
> -  Sgmii2500Fm1Dtsec10,
> -  SerdesPrtclCount
> -} SERDES_PROTOCOL;
> -
> -typedef enum {
> -  Srds1  = 0,
> -  Srds2,
> -  SrdsMaxNum
> -} SERDES_NUMBER;
> -
> -typedef struct {
> -  UINT16 Protocol;
> -  UINT8  SrdsLane[SRDS_MAX_LANES];
> -} SERDES_CONFIG;
> -
> -typedef VOID
> -(*SERDES_PROBE_LANES_CALLBACK) (
> -  IN SERDES_PROTOCOL LaneProtocol,
> -  IN VOID *Arg
> -  );
> -
> -VOID
> -SerDesProbeLanes(
> -  IN SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback,
> -  IN VOID *Arg
> -  );
> -
> -#endif /* LS_SERDES_H_ */
> diff --git a/Silicon/NXP/LS1043A/Include/SocSerDes.h b/Silicon/NXP/LS1043A/Include/SocSerDes.h
> deleted file mode 100644
> index 2d1c6f10f9..0000000000
> --- a/Silicon/NXP/LS1043A/Include/SocSerDes.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/** @file
> - The Header file of SerDes Module for LS1043A
> -
> - Copyright 2017-2019 NXP
> -
> - SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifndef SOC_SERDES_H_
> -#define SOC_SERDES_H_
> -
> -#ifdef CHASSIS2
> -#include <Chassis2/LsSerDes.h>
> -#endif
> -
> -SERDES_CONFIG SerDes1ConfigTbl[] = {
> -        /* SerDes 1 */
> -  {0x1555, {XfiFm1Mac9, Pcie1, Pcie2, Pcie3 } },
> -  {0x2555, {Sgmii2500Fm1Dtsec9, Pcie1, Pcie2, Pcie3 } },
> -  {0x4555, {QsgmiiFm1A, Pcie1, Pcie2, Pcie3 } },
> -  {0x4558, {QsgmiiFm1A,  Pcie1, Pcie2, Sata } },
> -  {0x1355, {XfiFm1Mac9, SgmiiFm1Dtsec2, Pcie2, Pcie3 } },
> -  {0x2355, {Sgmii2500Fm1Dtsec9, SgmiiFm1Dtsec2, Pcie2, Pcie3 } },
> -  {0x3335, {SgmiiFm1Dtsec9, SgmiiFm1Dtsec2, SgmiiFm1Dtsec5, Pcie3 } },
> -  {0x3355, {SgmiiFm1Dtsec9, SgmiiFm1Dtsec2, Pcie2, Pcie3 } },
> -  {0x3358, {SgmiiFm1Dtsec9, SgmiiFm1Dtsec2, Pcie2, Sata } },
> -  {0x3555, {SgmiiFm1Dtsec9, Pcie1, Pcie2, Pcie3 } },
> -  {0x3558, {SgmiiFm1Dtsec9, Pcie1, Pcie2, Sata } },
> -  {0x7000, {Pcie1, Pcie1, Pcie1, Pcie1 } },
> -  {0x9998, {Pcie1, Pcie2, Pcie3, Sata } },
> -  {0x6058, {Pcie1, Pcie1, Pcie2, Sata } },
> -  {0x1455, {XfiFm1Mac9, QsgmiiFm1A, Pcie2, Pcie3 } },
> -  {0x2455, {Sgmii2500Fm1Dtsec9, QsgmiiFm1A, Pcie2, Pcie3 } },
> -  {0x2255, {Sgmii2500Fm1Dtsec9, Sgmii2500Fm1Dtsec2, Pcie2, Pcie3 } },
> -  {0x3333, {SgmiiFm1Dtsec9, SgmiiFm1Dtsec2, SgmiiFm1Dtsec5, SgmiiFm1Dtsec6 } },
> -  {0x1460, {XfiFm1Mac9, QsgmiiFm1A, Pcie3, Pcie3 } },
> -  {0x2460, {Sgmii2500Fm1Dtsec9, QsgmiiFm1A, Pcie3, Pcie3 } },
> -  {0x3460, {SgmiiFm1Dtsec9, QsgmiiFm1A, Pcie3, Pcie3 } },
> -  {0x3455, {SgmiiFm1Dtsec9, QsgmiiFm1A, Pcie2, Pcie3 } },
> -  {0x9960, {Pcie1, Pcie2, Pcie3, Pcie3 } },
> -  {0x2233, {Sgmii2500Fm1Dtsec9, SgmiiFm1Dtsec2, SgmiiFm1Dtsec5, SgmiiFm1Dtsec6 }},
> -  {0x2533, {Sgmii2500Fm1Dtsec9, Pcie1, SgmiiFm1Dtsec5, SgmiiFm1Dtsec6 } },
> -  {}
> -};
> -
> -SERDES_CONFIG *SerDesConfigTbl[] = {
> -  SerDes1ConfigTbl
> -};
> -
> -#endif /* SOC_SERDES_H_ */
> diff --git a/Silicon/NXP/Library/SocLib/Chassis.c b/Silicon/NXP/Library/SocLib/Chassis.c
> index b8a8118c5e..18a1f5e4e1 100644
> --- a/Silicon/NXP/Library/SocLib/Chassis.c
> +++ b/Silicon/NXP/Library/SocLib/Chassis.c
> @@ -25,16 +25,6 @@
>  #include <DramInfo.h>
>  #include "NxpChassis.h"
>  
> -/*
> - *  Structure to list available SOCs.
> - *  Name, Soc Version, Number of Cores
> - */
> -STATIC CPU_TYPE mCpuTypeList[] = {
> -  CPU_TYPE_ENTRY (LS1043A, LS1043A, 4),
> -  CPU_TYPE_ENTRY (LS1046A, LS1046A, 4),
> -  CPU_TYPE_ENTRY (LS2088A, LS2088A, 8),
> -};
> -
>  UINT32
>  EFIAPI
>  GurRead (
> @@ -48,235 +38,6 @@ GurRead (
>    }
>  }
>  
> -/*
> - * Return the type of initiator (core or hardware accelerator)
> - */
> -UINT32
> -InitiatorType (
> -  IN UINT32 Cluster,
> -  IN UINTN  InitId
> -  )
> -{
> -  CCSR_GUR *GurBase;
> -  UINT32   Idx;
> -  UINT32   Type;
> -
> -  GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -  Idx = (Cluster >> (InitId * 8)) & TP_CLUSTER_INIT_MASK;
> -  Type = GurRead ((UINTN)&GurBase->TpItyp[Idx]);
> -
> -  if (Type & TP_ITYP_AV_MASK) {
> -    return Type;
> -  }
> -
> -  return 0;
> -}
> -
> -/*
> - *  Return the mask for number of cores on this SOC.
> - */
> -UINT32
> -CpuMask (
> -  VOID
> -  )
> -{
> -  CCSR_GUR  *GurBase;
> -  UINTN     ClusterIndex;
> -  UINTN     Count;
> -  UINT32    Cluster;
> -  UINT32    Type;
> -  UINT32    Mask;
> -  UINTN     InitiatorIndex;
> -
> -  GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -  ClusterIndex = 0;
> -  Count = 0;
> -  Mask = 0;
> -
> -  do {
> -    Cluster = GurRead ((UINTN)&GurBase->TpCluster[ClusterIndex].Lower);
> -    for (InitiatorIndex = 0; InitiatorIndex < TP_INIT_PER_CLUSTER; InitiatorIndex++) {
> -      Type = InitiatorType (Cluster, InitiatorIndex);
> -      if (Type) {
> -        if (TP_ITYP_TYPE_MASK (Type) == TP_ITYP_TYPE_ARM) {
> -          Mask |= 1 << Count;
> -        }
> -        Count++;
> -      }
> -    }
> -    ClusterIndex++;
> -  } while (CHECK_CLUSTER (Cluster));
> -
> -  return Mask;
> -}
> -
> -/*
> - *  Return the number of cores on this SOC.
> - */
> -UINTN
> -CpuNumCores (
> -  VOID
> -  )
> -{
> -  UINTN Count;
> -  UINTN Num;
> -
> -  Count = 0;
> -  Num = CpuMask ();
> -
> -  while (Num) {
> -    Count += Num & 1;
> -    Num >>= 1;
> -  }
> -
> -  return Count;
> -}
> -
> -/*
> - *  Return core's cluster
> - */
> -INT32
> -QoriqCoreToCluster (
> -  IN UINTN Core
> -  )
> -{
> -  CCSR_GUR  *GurBase;
> -  UINTN     ClusterIndex;
> -  UINTN     Count;
> -  UINT32    Cluster;
> -  UINT32    Type;
> -  UINTN     InitiatorIndex;
> -
> -  GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -  ClusterIndex = 0;
> -  Count = 0;
> -  do {
> -    Cluster = GurRead ((UINTN)&GurBase->TpCluster[ClusterIndex].Lower);
> -    for (InitiatorIndex = 0; InitiatorIndex < TP_INIT_PER_CLUSTER; InitiatorIndex++) {
> -      Type = InitiatorType (Cluster, InitiatorIndex);
> -      if (Type) {
> -        if (Count == Core) {
> -          return ClusterIndex;
> -        }
> -        Count++;
> -      }
> -    }
> -    ClusterIndex++;
> -  } while (CHECK_CLUSTER (Cluster));
> -
> -  return -1;      // cannot identify the cluster
> -}
> -
> -/*
> - *  Return the type of core i.e. A53, A57 etc of inputted
> - *  core number.
> - */
> -UINTN
> -QoriqCoreToType (
> -  IN UINTN Core
> -  )
> -{
> -  CCSR_GUR  *GurBase;
> -  UINTN     ClusterIndex;
> -  UINTN     Count;
> -  UINT32    Cluster;
> -  UINT32    Type;
> -  UINTN     InitiatorIndex;
> -
> -  GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -  ClusterIndex = 0;
> -  Count = 0;
> -
> -  do {
> -    Cluster = GurRead ((UINTN)&GurBase->TpCluster[ClusterIndex].Lower);
> -    for (InitiatorIndex = 0; InitiatorIndex < TP_INIT_PER_CLUSTER; InitiatorIndex++) {
> -      Type = InitiatorType (Cluster, InitiatorIndex);
> -      if (Type) {
> -        if (Count == Core) {
> -          return Type;
> -        }
> -        Count++;
> -      }
> -    }
> -    ClusterIndex++;
> -  } while (CHECK_CLUSTER (Cluster));
> -
> -  return EFI_NOT_FOUND;      /* cannot identify the cluster */
> -}
> -
> -STATIC
> -UINTN
> -CpuMaskNext (
> -  IN  UINTN  Cpu,
> -  IN  UINTN  Mask
> -  )
> -{
> -  for (Cpu++; !((1 << Cpu) & Mask); Cpu++);
> -
> -  return Cpu;
> -}
> -
> -/*
> - * Print CPU information
> - */
> -VOID
> -PrintCpuInfo (
> -  VOID
> -  )
> -{
> -  SYS_INFO SysInfo;
> -  UINTN    CoreIndex;
> -  UINTN    Core;
> -  UINT32   Type;
> -  UINT32   NumCpus;
> -  UINT32   Mask;
> -  CHAR8    *CoreName;
> -
> -  GetSysInfo (&SysInfo);
> -  DEBUG ((DEBUG_INIT, "Clock Configuration:"));
> -
> -  NumCpus = CpuNumCores ();
> -  Mask = CpuMask ();
> -
> -  for (CoreIndex = 0, Core = CpuMaskNext(-1, Mask);
> -       CoreIndex < NumCpus;
> -       CoreIndex++, Core = CpuMaskNext(Core, Mask))
> -  {
> -    if (!(CoreIndex % 3)) {
> -      DEBUG ((DEBUG_INIT, "\n      "));
> -    }
> -
> -    Type = TP_ITYP_VERSION (QoriqCoreToType (Core));
> -    switch (Type) {
> -      case TY_ITYP_VERSION_A7:
> -        CoreName = "A7";
> -        break;
> -      case TY_ITYP_VERSION_A53:
> -        CoreName = "A53";
> -        break;
> -      case TY_ITYP_VERSION_A57:
> -        CoreName = "A57";
> -        break;
> -      case TY_ITYP_VERSION_A72:
> -        CoreName = "A72";
> -        break;
> -      default:
> -        CoreName = " Unknown Core ";
> -    }
> -    DEBUG ((DEBUG_INIT, "CPU%d(%a):%-4d MHz  ",
> -      Core, CoreName, SysInfo.FreqProcessor[Core] / MHZ));
> -  }
> -
> -  DEBUG ((DEBUG_INIT, "\n      Bus:      %-4d MHz  ", SysInfo.FreqSystemBus / MHZ));
> -  DEBUG ((DEBUG_INIT, "DDR:      %-4d MT/s", SysInfo.FreqDdrBus / MHZ));
> -
> -  if (SysInfo.FreqFman[0] != 0) {
> -    DEBUG ((DEBUG_INIT, "\n      FMAN:     %-4d MHz  ",  SysInfo.FreqFman[0] / MHZ));
> -  }
> -
> -  DEBUG ((DEBUG_INIT, "\n"));
> -}
> -
>  /*
>   * Return system bus frequency
>   */
> @@ -307,77 +68,6 @@ GetSdxcFrequency (
>    return SocSysInfo.FreqSdhc;
>  }
>  
> -/*
> - * Print Soc information
> - */
> -VOID
> -PrintSoc (
> -  VOID
> -  )
> -{
> -  CHAR8    Buf[20];
> -  CCSR_GUR *GurBase;
> -  UINTN    Count;
> -  //
> -  // Svr : System Version Register
> -  //
> -  UINTN    Svr;
> -  UINTN    Ver;
> -
> -  GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -
> -  Svr = GurRead ((UINTN)&GurBase->Svr);
> -  Ver = SVR_SOC_VER (Svr);
> -
> -  for (Count = 0; Count < ARRAY_SIZE (mCpuTypeList); Count++) {
> -    if ((mCpuTypeList[Count].SocVer & SVR_WO_E) == Ver) {
> -      AsciiStrCpyS (Buf, sizeof (Buf), mCpuTypeList[Count].Name);
> -
> -      if (IS_E_PROCESSOR (Svr)) {
> -        AsciiStrCatS (Buf, sizeof (Buf), "E");
> -      }
> -      break;
> -    }
> -  }
> -
> -  DEBUG ((DEBUG_INFO, "SoC: %a (0x%x); Rev %d.%d\n",
> -          Buf, Svr, SVR_MAJOR (Svr), SVR_MINOR (Svr)));
> -
> -  return;
> -}
> -
> -/*
> - * Dump RCW (Reset Control Word) on console
> - */
> -VOID
> -PrintRCW (
> -  VOID
> -  )
> -{
> -  CCSR_GUR *Base;
> -  UINTN    Count;
> -
> -  Base = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -
> -  /*
> -   * Display the RCW, so that no one gets confused as to what RCW
> -   * we're actually using for this boot.
> -   */
> -
> -  DEBUG ((DEBUG_INIT, "Reset Configuration Word (RCW):"));
> -  for (Count = 0; Count < ARRAY_SIZE (Base->RcwSr); Count++) {
> -    UINT32 Rcw = SwapMmioRead32 ((UINTN)&Base->RcwSr[Count]);
> -
> -    if ((Count % 4) == 0) {
> -      DEBUG ((DEBUG_INIT, "\n      %08x:", Count * 4));
> -    }
> -
> -    DEBUG ((DEBUG_INIT, " %08x", Rcw));
> -  }
> -
> -  DEBUG ((DEBUG_INIT, "\n"));
> -}
> -
>  /*
>   * Setup SMMU in bypass mode
>   * and also set its pagesize
> @@ -400,33 +90,6 @@ SmmuInit (
>    MmioWrite32 ((UINTN)SMMU_REG_NSCR0, Value);
>  }
>  
> -/*
> - * Return current Soc Name form mCpuTypeList
> - */
> -CHAR8 *
> -GetSocName (
> -  VOID
> -  )
> -{
> -  UINT8     Count;
> -  UINTN     Svr;
> -  UINTN     Ver;
> -  CCSR_GUR  *GurBase;
> -
> -  GurBase = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -
> -  Svr = GurRead ((UINTN)&GurBase->Svr);
> -  Ver = SVR_SOC_VER (Svr);
> -
> -  for (Count = 0; Count < ARRAY_SIZE (mCpuTypeList); Count++) {
> -    if ((mCpuTypeList[Count].SocVer & SVR_WO_E) == Ver) {
> -      return (CHAR8 *)mCpuTypeList[Count].Name;
> -    }
> -  }
> -
> -  return NULL;
> -}
> -
>  UINTN
>  GetDramSize (
>    IN VOID
> diff --git a/Silicon/NXP/Library/SocLib/Chassis2/Soc.c b/Silicon/NXP/Library/SocLib/Chassis2/Soc.c
> index 5a1a7376cd..3d803716c9 100644
> --- a/Silicon/NXP/Library/SocLib/Chassis2/Soc.c
> +++ b/Silicon/NXP/Library/SocLib/Chassis2/Soc.c
> @@ -171,13 +171,5 @@ SocInit (
>    DEBUG ((DEBUG_INIT, "\nUEFI firmware (version %s built at %a on %a)\n",
>            (CHAR16*)PcdGetPtr (PcdFirmwareVersionString), __TIME__, __DATE__));
>  
> -  PrintCpuInfo ();
> -
> -  //
> -  // Print Reset control Word
> -  //
> -  PrintRCW ();
> -  PrintSoc ();
> -
>    return;
>  }
> diff --git a/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf b/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf
> index 3334d4d4f1..fe77717337 100644
> --- a/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf
> +++ b/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf
> @@ -30,7 +30,6 @@
>  [Sources.common]
>    Chassis.c
>    Chassis2/Soc.c
> -  SerDes.c
>  
>  [BuildOptions]
>    GCC:*_*_*_CC_FLAGS = -DCHASSIS2
> diff --git a/Silicon/NXP/Library/SocLib/SerDes.c b/Silicon/NXP/Library/SocLib/SerDes.c
> deleted file mode 100644
> index b9909d9221..0000000000
> --- a/Silicon/NXP/Library/SocLib/SerDes.c
> +++ /dev/null
> @@ -1,268 +0,0 @@
> -/** SerDes.c
> -  Provides the basic interfaces for SerDes Module
> -
> -  Copyright 2017-2019 NXP
> -
> -  SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -#ifdef CHASSIS2
> -#include <Chassis2/LsSerDes.h>
> -#include <Chassis2/NxpSoc.h>
> -#elif CHASSIS3
> -#include <Chassis3/LsSerDes.h>
> -#include <Chassis3/NxpSoc.h>
> -#endif
> -#include <Library/DebugLib.h>
> -#include <SocSerDes.h>
> -#include <Uefi.h>
> -
> -/**
> -  Function to get serdes Lane protocol corresponding to
> -  serdes protocol.
> -
> -  @param  SerDes    Serdes number.
> -  @param  Cfg       Serdes Protocol.
> -  @param  Lane      Serdes Lane number.
> -
> -  @return           Serdes Lane protocol.
> -
> -**/
> -STATIC
> -SERDES_PROTOCOL
> -GetSerDesPrtcl (
> -  IN  INTN          SerDes,
> -  IN  INTN          Cfg,
> -  IN  INTN          Lane
> -  )
> -{
> -  SERDES_CONFIG     *Config;
> -
> -  if (SerDes >= ARRAY_SIZE (SerDesConfigTbl)) {
> -    return 0;
> -  }
> -
> -  Config = SerDesConfigTbl[SerDes];
> -  while (Config->Protocol) {
> -    if (Config->Protocol == Cfg) {
> -      return Config->SrdsLane[Lane];
> -    }
> -    Config++;
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> -
> -/**
> -  Function to check if inputted protocol is a valid serdes protocol.
> -
> -  @param  SerDes                   Serdes number.
> -  @param  Prtcl                    Serdes Protocol to be verified.
> -
> -  @return EFI_INVALID_PARAMETER    Input parameter in invalid.
> -  @return EFI_NOT_FOUND            Serdes Protocol not a valid protocol.
> -  @return EFI_SUCCESS              Serdes Protocol is a valid protocol.
> -
> -**/
> -STATIC
> -EFI_STATUS
> -CheckSerDesPrtclValid (
> -  IN  INTN      SerDes,
> -  IN  UINT32    Prtcl
> -  )
> -{
> -  SERDES_CONFIG *Config;
> -  INTN          Cnt;
> -
> -  if (SerDes >= ARRAY_SIZE (SerDesConfigTbl)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  Config = SerDesConfigTbl[SerDes];
> -  while (Config->Protocol) {
> -    if (Config->Protocol == Prtcl) {
> -      DEBUG ((DEBUG_INFO, "Protocol: %x Matched with the one in Table\n", Prtcl));
> -      break;
> -    }
> -    Config++;
> -  }
> -
> -  if (!Config->Protocol) {
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  for (Cnt = 0; Cnt < SRDS_MAX_LANES; Cnt++) {
> -    if (Config->SrdsLane[Cnt] != None) {
> -      return EFI_SUCCESS;
> -    }
> -  }
> -
> -  return EFI_NOT_FOUND;
> -}
> -
> -/**
> -  Function to fill serdes map information.
> -
> -  @param  Srds                  Serdes number.
> -  @param  SerdesProtocolMask    Serdes Protocol Mask.
> -  @param  SerdesProtocolShift   Serdes Protocol shift value.
> -  @param  SerDesPrtclMap        Pointer to Serdes Protocol map.
> -
> -**/
> -STATIC
> -VOID
> -LSSerDesMap (
> -  IN  UINT32                    Srds,
> -  IN  UINT32                    SerdesProtocolMask,
> -  IN  UINT32                    SerdesProtocolShift,
> -  OUT UINT64                    *SerDesPrtclMap
> -  )
> -{
> -  CCSR_GUR                      *Gur;
> -  UINT32                        SrdsProt;
> -  INTN                          Lane;
> -  UINT32                        Flag;
> -
> -  Gur = (VOID *)PcdGet64 (PcdGutsBaseAddr);
> -  *SerDesPrtclMap = 0x0;
> -  Flag = 0;
> -
> -  SrdsProt = GurRead ((UINTN)&Gur->RcwSr[RCWSR_INDEX]) & SerdesProtocolMask;
> -  SrdsProt >>= SerdesProtocolShift;
> -
> -  DEBUG ((DEBUG_INFO, "Using SERDES%d Protocol: %d (0x%x)\n",
> -          Srds + 1, SrdsProt, SrdsProt));
> -
> -  if (EFI_SUCCESS != CheckSerDesPrtclValid (Srds, SrdsProt)) {
> -    DEBUG ((DEBUG_ERROR, "SERDES%d[PRTCL] = 0x%x is not valid\n",
> -            Srds + 1, SrdsProt));
> -    Flag++;
> -  }
> -
> -  for (Lane = 0; Lane < SRDS_MAX_LANES; Lane++) {
> -    SERDES_PROTOCOL LanePrtcl = GetSerDesPrtcl (Srds, SrdsProt, Lane);
> -    if (LanePrtcl >= SerdesPrtclCount) {
> -      DEBUG ((DEBUG_ERROR, "Unknown SerDes lane protocol %d\n", LanePrtcl));
> -      Flag++;
> -    } else {
> -      *SerDesPrtclMap |= (1u << LanePrtcl);
> -    }
> -  }
> -
> -  if (Flag) {
> -    DEBUG ((DEBUG_ERROR, "Could not configure SerDes module!!\n"));
> -  } else {
> -    DEBUG ((DEBUG_INFO, "Successfully configured SerDes module!!\n"));
> -  }
> -}
> -
> -/**
> -  Get lane protocol on provided serdes lane and execute callback function.
> -
> -  @param  Srds                    Serdes number.
> -  @param  SerdesProtocolMask      Mask to get Serdes Protocol for Srds
> -  @param  SerdesProtocolShift     Shift value to get Serdes Protocol for Srds.
> -  @param  SerDesLaneProbeCallback Pointer Callback function to be called for Lane protocol
> -  @param  Arg                     Pointer to Arguments to be passed to callback function.
> -
> -**/
> -STATIC
> -VOID
> -SerDesInstanceProbeLanes (
> -  IN  UINT32                      Srds,
> -  IN  UINT32                      SerdesProtocolMask,
> -  IN  UINT32                      SerdesProtocolShift,
> -  IN  SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback,
> -  IN  VOID                        *Arg
> -  )
> -{
> -
> -  CCSR_GUR                        *Gur;
> -  UINT32                          SrdsProt;
> -  INTN                            Lane;
> -
> -  Gur = (VOID *)PcdGet64 (PcdGutsBaseAddr);;
> -
> -  SrdsProt = GurRead ((UINTN)&Gur->RcwSr[RCWSR_INDEX]) & SerdesProtocolMask;
> -  SrdsProt >>= SerdesProtocolShift;
> -
> -  /*
> -   * Invoke callback for all lanes in the SerDes instance:
> -   */
> -  for (Lane = 0; Lane < SRDS_MAX_LANES; Lane++) {
> -    SERDES_PROTOCOL LanePrtcl = GetSerDesPrtcl (Srds, SrdsProt, Lane);
> -    if ((LanePrtcl >= SerdesPrtclCount) || (LanePrtcl < None)) {
> -      DEBUG ((DEBUG_ERROR, "Unknown SerDes lane protocol %d\n", LanePrtcl));
> -    } else if (LanePrtcl != None) {
> -      SerDesLaneProbeCallback (LanePrtcl, Arg);
> -    }
> -  }
> -}
> -
> -/**
> -  Probe all serdes lanes for lane protocol and execute provided callback function.
> -
> -  @param  SerDesLaneProbeCallback Pointer Callback function to be called for Lane protocol
> -  @param  Arg                     Pointer to Arguments to be passed to callback function.
> -
> -**/
> -VOID
> -SerDesProbeLanes (
> -  IN SERDES_PROBE_LANES_CALLBACK SerDesLaneProbeCallback,
> -  IN VOID                        *Arg
> -  )
> -{
> -  SerDesInstanceProbeLanes (Srds1,
> -                            RCWSR_SRDS1_PRTCL_MASK,
> -                            RCWSR_SRDS1_PRTCL_SHIFT,
> -                            SerDesLaneProbeCallback,
> -                            Arg);
> -
> -  if (PcdGetBool (PcdSerdes2Enabled)) {
> -   SerDesInstanceProbeLanes (Srds2,
> -                             RCWSR_SRDS2_PRTCL_MASK,
> -                             RCWSR_SRDS2_PRTCL_SHIFT,
> -                             SerDesLaneProbeCallback,
> -                             Arg);
> -  }
> -}
> -
> -/**
> -  Function to return Serdes protocol map for all serdes available on board.
> -
> -  @param  SerDesPrtclMap   Pointer to Serdes protocl map.
> -
> -**/
> -VOID
> -GetSerdesProtocolMaps (
> -  OUT UINT64               *SerDesPrtclMap
> -  )
> -{
> -  LSSerDesMap (Srds1,
> -               RCWSR_SRDS1_PRTCL_MASK,
> -               RCWSR_SRDS1_PRTCL_SHIFT,
> -               SerDesPrtclMap);
> -
> -  if (PcdGetBool (PcdSerdes2Enabled)) {
> -    LSSerDesMap (Srds2,
> -                 RCWSR_SRDS2_PRTCL_MASK,
> -                 RCWSR_SRDS2_PRTCL_SHIFT,
> -                 SerDesPrtclMap);
> -  }
> -
> -}
> -
> -BOOLEAN
> -IsSerDesLaneProtocolConfigured (
> -  IN UINT64          SerDesPrtclMap,
> -  IN SERDES_PROTOCOL Device
> -  )
> -{
> -  if ((Device >= SerdesPrtclCount) || (Device < None)) {
> -    ASSERT ((Device > None) && (Device < SerdesPrtclCount));
> -    DEBUG ((DEBUG_ERROR, "Unknown SerDes lane protocol Device %d\n", Device));
> -  }
> -
> -  return (SerDesPrtclMap & (1u << Device)) != 0 ;
> -}
> -- 
> 2.17.1
> 

  reply	other threads:[~2020-02-10 17:09 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 12:43 [PATCH 00/19] ADD LX2160ARDB Platform Support Pankaj Bansal
2020-02-07 12:43 ` [PATCH 01/19] Silicon/NXP: Add I2c lib Pankaj Bansal
2020-02-08 17:13   ` Leif Lindholm
2020-02-09 11:49     ` [edk2-devel] " Ard Biesheuvel
2020-02-07 12:43 ` [PATCH 02/19] Silicon/NXP: changes to use I2clib in i2cdxe Pankaj Bansal
2020-02-08 17:23   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 03/19] NXP/LS1043aRdb: Move Soc specific components to soc files Pankaj Bansal
2020-02-08 17:27   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 04/19] Silicon/NXP: Remove DuartLib and use BaseSerialPortLib16550 Pankaj Bansal
2020-02-08 17:46   ` Leif Lindholm
2020-02-10  5:48     ` Pankaj Bansal
2020-02-12 23:27       ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 05/19] NXP/BaseSerialPortLib16550: remove SerialPortInitalize functionality Pankaj Bansal
2020-02-07 12:43 ` [PATCH 06/19] Silicon/NXP: remove print information from Soc lib Pankaj Bansal
2020-02-10 17:09   ` Leif Lindholm [this message]
2020-02-07 12:43 ` [PATCH 07/19] Silicon/NXP: remove not needed components Pankaj Bansal
2020-02-10 17:11   ` Leif Lindholm
2020-02-11  7:24     ` Pankaj Bansal
2020-02-20 19:05       ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 08/19] Silicon/NXP: Remove unnecessary PCDs Pankaj Bansal
2020-02-10 17:32   ` Leif Lindholm
2020-02-11  8:45     ` Pankaj Bansal
2020-02-20 18:56       ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 09/19] Silicon/NXP: Move dsc file Pankaj Bansal
2020-02-11 11:35   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 10/19] Platform/NXP: rename the ArmPlatformLib as per ArmPlatformPkg Pankaj Bansal
2020-02-11 11:40   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 11/19] Silicon/NXP: Add Chassis Lib for Chassis2 Pankaj Bansal
2020-02-11 12:28   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 12/19] Silicon/NXP/LS1043A: Add SocLib Pankaj Bansal
2020-02-11 12:38   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 13/19] Silicon/NXP: Move RAM retrieval from SocLib Pankaj Bansal
2020-02-11 13:28   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 14/19] Silicon/NXP/LS1043A: Replce SocLib Pankaj Bansal
2020-02-11 13:35   ` Leif Lindholm
2020-02-12  9:37     ` Pankaj Bansal
2020-02-12 22:50       ` Leif Lindholm
2020-02-13 11:00         ` Pankaj Bansal
2020-02-20 18:45           ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 15/19] Platform/NXP/LS1043ARDB: introduce PEI Phase Pankaj Bansal
2020-02-12 20:24   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 16/19] Silicon/NXP: Add Pl011 Serial port lib Pankaj Bansal
2020-02-12 20:26   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 17/19] Silicon/NXP: Add Chassis3V2 Pankaj Bansal
2020-02-12 20:33   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 18/19] Silicon/NXP: Add LX2160A SocLib Pankaj Bansal
2020-02-12 21:39   ` Leif Lindholm
2020-02-07 12:43 ` [PATCH 19/19] Platform/NXP: Add LX2160ARDBPKG Pankaj Bansal
2020-02-12 21:36   ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200210170911.GK23627@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox