From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::243; helo=mail-it0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) (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 61736207E4E1C for ; Mon, 21 May 2018 01:53:30 -0700 (PDT) Received: by mail-it0-x243.google.com with SMTP id z6-v6so20200399iti.4 for ; Mon, 21 May 2018 01:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=npTSYxJH9W+a1BqTHDkUWU8pmlpMUPOUlOKaMqch/i8=; b=E7xpH7OqMbHISkEQLPMnqBOUyikVUujRB+M++3jRyc2bMMz3hY+xsKiWwazj11bZ1j skTEglMcrythO9rgmXHSKjcRWizw5NV/YX0HSbremjN/P6UfLQbs5ZbOtvNqkprl+hCU igPPr9WwWPxbRrARs38Pm3pEyUiFZAl8YXM40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=npTSYxJH9W+a1BqTHDkUWU8pmlpMUPOUlOKaMqch/i8=; b=irbqJvXqfrRCW2IlHschhd3BNdpDp5ZRrIcKfGVGjJ29u4TZ51r27kxKzbDY++CX9R gvEciiJpEe27MCPffEDmBPotSyW/c+Pv+fIrLCVDQF5Lvi16RaUN516HYuu3jS0AmpUn XPCV2GE5n1R87/BvxLw0kHm8iphY2sEIgcgteR9VOM/o73eayjTg6nKpRMQZmJU/BW9W DqgNrB3PgIf7sENT1jZ+9KJI2b4tOXZLzV6HZuW4atWLk8apH7eV504nUvrntxODnXHM kBvFdln2JmNFXtKJ2pNeLjL/C0osVepj47EwOVVMA82s3MTBdwAoCRFYycN3Hk3v/iDP Z+Ig== X-Gm-Message-State: ALKqPweGfUfoNunMvum2GlALWawv5vZCq/xPazJYOZZ41P4TEdV9Repq Z7TPgFR1uH4kr01p7wO1e38h1LbD+A/7bglxQH7X4vDi2y8= X-Google-Smtp-Source: AB8JxZrtmILGVS+W4PyBTKXnwcZ5zFC1Cx4vBHW+HVRquT7hzSZ0/Qm7lez2ugjhGCQYeHI2P6K+/1suKDey1hQT6PU= X-Received: by 2002:a24:e103:: with SMTP id n3-v6mr16861810ith.68.1526892809459; Mon, 21 May 2018 01:53:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.187.134 with HTTP; Mon, 21 May 2018 01:53:29 -0700 (PDT) In-Reply-To: <1526891152-18739-3-git-send-email-thomas.abraham@arm.com> References: <1526891152-18739-1-git-send-email-thomas.abraham@arm.com> <1526891152-18739-3-git-send-email-thomas.abraham@arm.com> From: Ard Biesheuvel Date: Mon, 21 May 2018 10:53:29 +0200 Message-ID: To: Thomas Abraham Cc: "edk2-devel@lists.01.org" , Leif Lindholm , Vishwanatha HG Subject: Re: [PATCH edk2-platforms v4 2/9] Platform/ARM/Sgi: add NOR flash platform library implementation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 08:53:30 -0000 Content-Type: text/plain; charset="UTF-8" On 21 May 2018 at 10:25, Thomas Abraham wrote: > From: Vishwanatha HG > > Add a initial NOR flash driver platform wrapper as part of the platform > library. Access to NOR flash devices connected to CS0 and CS1 is enabled > in this initial implementation. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Vishwanatha HG > Signed-off-by: Thomas Abraham > --- > .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c | 66 ++++++++++++++++++++++ > .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 +++++++++++ > 2 files changed, 100 insertions(+) > create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c > create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf > > diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c > new file mode 100644 > index 0000000..9b4981f > --- /dev/null > +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c > @@ -0,0 +1,66 @@ > +/** @file > + > + Copyright (c) 2018, ARM Ltd. All rights reserved. > + > + 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 > + > +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { > + { > + SGI_EXP_SMC_CS0_BASE, > + SGI_EXP_SMC_CS0_BASE, > + SIZE_256KB * 256, > + SIZE_256KB, > + {0xEBF0B9DF, 0x17d0, 0x4812, { 0xA9, 0x59, 0xCF, 0xD7, 0x92, 0xEE, 0x31, 0x13} } > + }, > + { > + SGI_EXP_SMC_CS1_BASE, > + SGI_EXP_SMC_CS1_BASE, > + SIZE_256KB * 256, > + SIZE_256KB, > + { 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 0x4A } } Please use consistent whitespace in these GUID definitions. > + }, > +}; > + > +EFI_STATUS > +NorFlashPlatformInitialization ( > + VOID > + ) > +{ > + UINT64 SysRegFlash; > + > + SysRegFlash = SGI_EXP_SYSPH_SYSTEM_REGISTERS + SGI_SYSPH_SYS_REG_FLASH; > + if ((MmioRead32 (SysRegFlash) & SGI_SYSPH_SYS_REG_FLASH_RWEN) == 0) { > + MmioWrite32 (SysRegFlash, 1); SGI_SYSPH_SYS_REG_FLASH_RWEN? Should you use MmioOr32() here? (I can't tell, I don't have the docs) > + } > + > + return EFI_SUCCESS; > +} > + > +EFI_STATUS > +NorFlashPlatformGetDevices ( > + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, > + OUT UINT32 *Count > + ) > +{ > + if ((NorFlashDevices == NULL) || (Count == NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + *NorFlashDevices = mNorFlashDevices; > + *Count = ARRAY_SIZE (mNorFlashDevices); > + return EFI_SUCCESS; > +} > diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf > new file mode 100644 > index 0000000..3a6b33b > --- /dev/null > +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf > @@ -0,0 +1,34 @@ > +#/** @file > +# > +# Copyright (c) 2018, ARM Ltd. All rights reserved. > + > +# 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 = NorFlashSgiLib > + FILE_GUID = 3f021755-6d74-4065-9ee4-98225267b36e > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = NorFlashPlatformLib > + > +[Sources.common] > + NorFlashLib.c > + > +[Packages] > + ArmPlatformPkg/ArmPlatformPkg.dec > + MdePkg/MdePkg.dec > + Platform/ARM/SgiPkg/SgiPlatform.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + IoLib > -- > 2.7.4 >