public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Marcin Wojtas <mw@semihalf.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Leif Lindholm" <leif.lindholm@linaro.org>,
	"Wu, Hao A" <hao.a.wu@intel.com>,
	"Nadav Haklai" <nadavh@marvell.com>,
	"Jan Dąbroś" <jsd@semihalf.com>,
	"Grzegorz Jaszczyk" <jaz@semihalf.com>,
	"Kostya Porotchkin" <kostap@marvell.com>,
	"Tomasz Michalec" <tm@semihalf.com>
Subject: Re: [platforms: PATCH v4 6/7] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc
Date: Mon, 12 Nov 2018 11:29:07 +0100	[thread overview]
Message-ID: <CAKv+Gu-WR3R6653SRzYW840uyZo3ud4BHn_2uAcFOi0W__ciZA@mail.gmail.com> (raw)
In-Reply-To: <1541804508-27499-7-git-send-email-mw@semihalf.com>

On Sat, 10 Nov 2018 at 00:02, Marcin Wojtas <mw@semihalf.com> wrote:
>
> From: Tomasz Michalec <tm@semihalf.com>
>
> Extend MvBoardDescSdMmcGet function to fill MV_BOARD_SDMMC_DESC
> with Xenon specific info obtained from ArmadaBoardDescLib.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf |  1 +
>  Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c   | 24 +++++++++++++-------
>  2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf
> index 41f72d6..0b93948 100644
> --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf
> +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf
> @@ -47,6 +47,7 @@
>    Silicon/Marvell/Marvell.dec
>
>  [LibraryClasses]
> +  ArmadaBoardDescLib
>    ArmadaSoCDescLib
>    DebugLib
>    MemoryAllocationLib
> diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
> index 39dc06c..f71bfc4 100644
> --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
> +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
> @@ -270,6 +270,7 @@ MvBoardDescSdMmcGet (
>  {
>    UINT8 *SdMmcDeviceEnabled;
>    UINTN SdMmcCount, SdMmcDeviceTableSize, SdMmcIndex, Index;
> +  UINTN SdMmcDevCount;
>    MV_BOARD_SDMMC_DESC *BoardDesc;
>    MV_SOC_SDMMC_DESC *SoCDesc;
>    EFI_STATUS Status;
> @@ -280,6 +281,13 @@ MvBoardDescSdMmcGet (
>      return Status;
>    }
>
> +  /* Get per-board configuration of the controllers */
> +  Status = ArmadaBoardDescSdMmcGet (&SdMmcDevCount, &BoardDesc);
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "%a: ArmadaBoardDescSdMmcGet filed\n", __FUNCTION__));
> +    return Status;
> +  }
> +
>    /*
>     * Obtain table with enabled SDMMC controllers
>     * which is represented as an array of UINT8 values
> @@ -294,18 +302,12 @@ MvBoardDescSdMmcGet (
>    SdMmcDeviceTableSize = PcdGetSize (PcdPciESdhci);
>
>    /* Check if PCD with SDMMC controllers is correctly defined */
> -  if (SdMmcDeviceTableSize > SdMmcCount) {
> +  if ((SdMmcDeviceTableSize > SdMmcCount) ||
> +      (SdMmcDeviceTableSize < SdMmcDevCount)) {
>      DEBUG ((DEBUG_ERROR, "%a: Wrong PcdPciESdhci format\n", __FUNCTION__));
>      return EFI_INVALID_PARAMETER;
>    }
>
> -  /* Allocate and fill board description */
> -  BoardDesc = AllocateZeroPool (SdMmcDeviceTableSize * sizeof (MV_BOARD_SDMMC_DESC));
> -  if (BoardDesc == NULL) {
> -    DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__));
> -    return EFI_OUT_OF_RESOURCES;
> -  }
> -
>    SdMmcIndex = 0;
>    for (Index = 0; Index < SdMmcDeviceTableSize; Index++) {
>      if (!SdMmcDeviceEnabled[Index]) {
> @@ -313,6 +315,12 @@ MvBoardDescSdMmcGet (
>        continue;
>      }
>
> +    if (SdMmcIndex >= SdMmcDevCount) {
> +      DEBUG ((DEBUG_ERROR,
> +        "%a: More enabled devices than returned by ArmadaBoardDescSdMmcGet\n",
> +        __FUNCTION__));
> +      return EFI_INVALID_PARAMETER;
> +    }
>      BoardDesc[SdMmcIndex].SoC = &SoCDesc[Index];
>      SdMmcIndex++;
>    }
> --
> 2.7.4
>


  reply	other threads:[~2018-11-12 10:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 23:01 [platforms: PATCH v4 0/7] Armada7k8k Xenon driver rework Marcin Wojtas
2018-11-09 23:01 ` [platforms: PATCH v4 1/7] Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride Marcin Wojtas
2018-11-12 10:24   ` Ard Biesheuvel
2018-11-09 23:01 ` [platforms: PATCH v4 2/7] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information Marcin Wojtas
2018-11-12 10:24   ` Ard Biesheuvel
2018-11-09 23:01 ` [platforms: PATCH v4 3/7] SolidRun/Armada80x0McBin: Introduce board description library Marcin Wojtas
2018-11-12 10:26   ` Ard Biesheuvel
2018-11-09 23:01 ` [platforms: PATCH v4 5/7] Marvell/Armada80x0Db: " Marcin Wojtas
2018-11-12 10:28   ` Ard Biesheuvel
2018-11-09 23:01 ` [platforms: PATCH v4 6/7] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc Marcin Wojtas
2018-11-12 10:29   ` Ard Biesheuvel [this message]
2018-11-09 23:01 ` [platforms: PATCH v4 7/7] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe Marcin Wojtas
2018-11-12 10:36   ` Ard Biesheuvel
     [not found] ` <1541804508-27499-5-git-send-email-mw@semihalf.com>
2018-11-12 10:27   ` [platforms: PATCH v4 4/7] Marvell/Armada70x0Db: Introduce board description library Ard Biesheuvel

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=CAKv+Gu-WR3R6653SRzYW840uyZo3ud4BHn_2uAcFOi0W__ciZA@mail.gmail.com \
    --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