From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::144; helo=mail-it1-x144.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x144.google.com (mail-it1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (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 3EF362118A5AD for ; Mon, 12 Nov 2018 02:29:20 -0800 (PST) Received: by mail-it1-x144.google.com with SMTP id m34-v6so11843505iti.1 for ; Mon, 12 Nov 2018 02:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=juMwaZMMHSWVP5qu/Lh/DmEd1ktSOTrwj9Hpd0SqSlI=; b=AFuIe9n0BF0P4ehBUTZRN/wIvGQWdUpr//tCKSSGZASLWPjga/5sH+ll+Zxs5++EYC ZueopGC6D2yVFcJsTO2d48mt4NufpTejVuLUqj1isB3dVL0zVV7/uVIXyRusrzvOYwYd yhUENJ6sED/uZskA+MIFKTPC9WQvrHpK4HZYM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=juMwaZMMHSWVP5qu/Lh/DmEd1ktSOTrwj9Hpd0SqSlI=; b=PNLqq38JIBnYUWPnRuVD3hwzZR+Qp86/esc841cK6yuY6+tZ2S1bU84gQz3ul+pzvA GVaFsZz0rL8QtklOdrkEJRBDtENFViwkBJdQ7Lify84IB9OI0Rn/riKw/vQkPyzX2onT OsSqS6r87wEoSJ3fgzyEYzXzyaIxzDHtox02LjXiRBbTeYIFp+qNq55d8T1oa60BsZDe fuYNYCanaWTPCR3DJnBVdpF1eHogpmDqSEWTYwmxl88GYj5Wd1iGYMVmannF0ePYADGM opJLn9dnfyE1SphSUnPI31tXRR9Er6IMsgV6ylzo+pXzUKiJrRnLvu0DKHiOrx3n+yVF urRg== X-Gm-Message-State: AGRZ1gIqpI0eqpYpEAwoN0dQHhXIr32+JLA9DB2srzQBXgVFiCGwsMM8 RlV2tgqlk8/aOv3nQQJx6wXjfhCOv0zhs61/hG7IPg== X-Google-Smtp-Source: AJdET5fv/aFZ/1Fvx4/NhHgbu9tSrF+ccYGmmNEBotVRhyNo8r0RbDrBk86h5BfhrQ7nXHXGYVPCUdCzhHiBoGTGSzo= X-Received: by 2002:a02:8449:: with SMTP id l9-v6mr280150jah.130.1542018559522; Mon, 12 Nov 2018 02:29:19 -0800 (PST) MIME-Version: 1.0 References: <1541804508-27499-1-git-send-email-mw@semihalf.com> <1541804508-27499-7-git-send-email-mw@semihalf.com> In-Reply-To: <1541804508-27499-7-git-send-email-mw@semihalf.com> From: Ard Biesheuvel Date: Mon, 12 Nov 2018 11:29:07 +0100 Message-ID: To: Marcin Wojtas Cc: "edk2-devel@lists.01.org" , Leif Lindholm , "Wu, Hao A" , Nadav Haklai , =?UTF-8?B?SmFuIETEhWJyb8Wb?= , Grzegorz Jaszczyk , Kostya Porotchkin , Tomasz Michalec Subject: Re: [platforms: PATCH v4 6/7] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2018 10:29:20 -0000 Content-Type: text/plain; charset="UTF-8" On Sat, 10 Nov 2018 at 00:02, Marcin Wojtas wrote: > > From: Tomasz Michalec > > 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 Reviewed-by: Ard Biesheuvel > --- > 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 >