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::143; helo=mail-it1-x143.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (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 5691021959CB2 for ; Mon, 12 Nov 2018 02:27:03 -0800 (PST) Received: by mail-it1-x143.google.com with SMTP id k141-v6so12437713itk.3 for ; Mon, 12 Nov 2018 02:27:03 -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=pPTKPGr/udzK8RhAcasuJpSYSr+pcIcSLe9wAzIZQLg=; b=BGgezSwoUglOB4mjIyoeIsj6RlYP5SwoPNpVfXhjMRzngm1xWhz8yqjRDxW+MNkD60 OsXkOzcJr21qEVqUg3ePj1YHIFsPeklGARgF/UbM3e/q1LqdvV0qRelMfgQz0OfWJtIm loxuAZ2b3yv/RvXvJLzBEVEDJUWHKEcwrvpJs= 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=pPTKPGr/udzK8RhAcasuJpSYSr+pcIcSLe9wAzIZQLg=; b=bfWQS7YlWy62ZD4DWJ3kEuq51dKFAd6GqsOy4DWtGWomRkjq/JHBwvnqC5r2xme44C zgT+i1Pr7JDiKsEd/5myHfZsupEdxmtSSyPefW5lj51CBJlPI4Z262ZDYKwDX5H4CZry SJnEHvnuwU7unnFZVHCBPV4JOStjCVvgq3Lx5wHDGFyTW2T9YufE6Ll5/Z0L2YPEBOd0 6CX1ZOr5saTbJHIkZYitBNdE4AdUZbYRhV10NG6ASqwOSOXV4uv4toQJhSjl2oTVaTEo f0Qs29kjm2kjJp7stiHOBtFi1v5+hqeJNdt8gtZCqdigASI7fyoPG++5rHdGx290Bb7j /yDg== X-Gm-Message-State: AGRZ1gJvKEPDWmJKsti7ObKSMr1YfJsdlMiSjDDPj4c3/5tb10KDoJWN TXOAfa4q63VYQXtqTUeWirgdVpwjXSQ36ltT6vpQiQ== X-Google-Smtp-Source: AJdET5cARBAoyYQzEvmhlk7tb0Mc8B7kbUYE12otqZgweTOTk754dVUald93QNmQ5edxScBt/egTB3JsP0vtS4VaI9w= X-Received: by 2002:a24:2190:: with SMTP id e138-v6mr11598689ita.71.1542018422183; Mon, 12 Nov 2018 02:27:02 -0800 (PST) MIME-Version: 1.0 References: <1541804508-27499-1-git-send-email-mw@semihalf.com> <1541804508-27499-4-git-send-email-mw@semihalf.com> In-Reply-To: <1541804508-27499-4-git-send-email-mw@semihalf.com> From: Ard Biesheuvel Date: Mon, 12 Nov 2018 11:26:50 +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 3/7] SolidRun/Armada80x0McBin: Introduce board description library 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:27:03 -0000 Content-Type: text/plain; charset="UTF-8" On Sat, 10 Nov 2018 at 00:02, Marcin Wojtas wrote: > > From: Tomasz Michalec > > This patch implements ArmadaBoarDescLib library for > Armada80x0McBin comunity board and add to it ArmadaBoardDescSdMmcGet > function with description of connected Xenon host controllers. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas > --- > Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + > Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 ++++++++++ > Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 66 ++++++++++++++++++++ > 3 files changed, 103 insertions(+) > create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf > create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c > > diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc > index 52e2b9b..077224d 100644 > --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc > +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc > @@ -55,6 +55,9 @@ > [Components.AARCH64] > Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0McBin.inf > > +[LibraryClasses.common] > + ArmadaBoardDescLib|Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf > + > ################################################################################ > # > # Pcd Section - list of all EDK II PCD Entries defined by this Platform > diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf > new file mode 100644 > index 0000000..63a4f66 > --- /dev/null > +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf > @@ -0,0 +1,34 @@ > +## @file > +# > +# Copyright (C) 2018, Marvell International Ltd. and its affiliates
> +# > +# This program and the accompanying materials are licensed and made available > +# under the terms and conditions of the BSD License which accompanies this > +# distribution. The full text of the license may be found at > +# http://opensource.org/licenses/bsd-license.php > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > +# IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION = 0x0001001A > + BASE_NAME = ArmadaMcBinBoardDescLib > + FILE_GUID = 8208558f-5f33-46e2-b5c5-43354384389e > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = ArmadaBoardDescLib > + > +[Sources] > + Armada80x0McBinBoardDescLib.c > + > +[Packages] > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + Silicon/Marvell/Marvell.dec > + > +[LibraryClasses] > + DebugLib > + IoLib > diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c > new file mode 100644 > index 0000000..9e38ce0 > --- /dev/null > +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c > @@ -0,0 +1,66 @@ > +/** > +* > +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. > +* > +* This program and the accompanying materials are licensed and made available > +* under the terms and conditions of the BSD License which accompanies this > +* distribution. The full text of the license may be found at > +* http://opensource.org/licenses/bsd-license.php > +* > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > +* > +**/ > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +// > +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib > +// > +STATIC > +MV_BOARD_SDMMC_DESC mMcBinSdMmcDescTemplate[] = { > + { /* eMMC 0xF06E0000 */ > + 0, /* SOC will be filled by MvBoardDescDxe */ > + 0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ > + FALSE, /* Xenon1v8Enabled */ > + TRUE, /* Xenon8BitBusEnabled */ > + TRUE, /* XenonSlowModeEnabled */ > + 0x40, /* XenonTuningStepDivisor */ > + EmbeddedSlot /* SlotType */ > + }, > + { /* SD/MMC 0xF2780000 */ > + 0, /* SOC will be filled by MvBoardDescDxe */ > + 0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ > + FALSE, /* Xenon1v8Enabled */ > + FALSE, /* Xenon8BitBusEnabled */ > + FALSE, /* XenonSlowModeEnabled */ > + 0x19, /* XenonTuningStepDivisor */ > + EmbeddedSlot /* SlotType */ > + } > +}; > + > +EFI_STATUS > +EFIAPI > +ArmadaBoardDescSdMmcGet ( > + IN OUT UINTN *SdMmcDevCount, > + IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc There are OUT not IN OUT > + ) > +{ > + *SdMmcDevCount = ARRAY_SIZE (mMcBinSdMmcDescTemplate); > + > + *SdMmcDesc = AllocateCopyPool (sizeof (mMcBinSdMmcDescTemplate), > + &mMcBinSdMmcDescTemplate); > + if (*SdMmcDesc == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; Please do the checks first, and only assign the outputs when it is guaranteed that you will return succes. With those changes: Reviewed-by: Ard Biesheuvel > + } > + > + return EFI_SUCCESS; > +} > -- > 2.7.4 >