From patchwork Thu Aug 28 14:14:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36221 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 677BC202DD for ; Thu, 28 Aug 2014 14:15:08 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id i138sf7408116oig.8 for ; Thu, 28 Aug 2014 07:15:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=6Y8WqAaAb6et7CCFjVuJmfGt9g4AZTNtUUajmmlHuZg=; b=k6V1DdKFF94ElwOGCW5lITmSNL+n1cqelkD8f1cQs9eZrRljVqMI8FubR4Qac+LI8q 674hyc9UEAtNkt2cFcLmJ69xVf0h1Lnt/53W+f1KkbDy0KmaY0W1MLuopF+fyD9FC43x 9KXHWnxYdjzmJRTd64sC9D4sfMWWfIRQlgUS0wI+1PXfkizzPKn+WjV98C+6wi/OROV9 kMpF9H7UxIbGYoBze2qPXEWT7F00EC7ME4M9R41GNgCqnUIMy1MlLfjXZJQSE/OIxiy+ 0iL+XE0VS3MjCGD6q90vFheQLy1cKfrNeM6VImjgUhGU6ka1QmIYbFKs6WOx/r5bfACu VZDw== X-Gm-Message-State: ALoCoQmmoHxpSt8pgLhtGSr6ZGHhtS4H1Kzj5LkQ2lAJ8ltUCFZww1h93Dq36al5bk239sTURFw0 X-Received: by 10.42.18.2 with SMTP id v2mr2788690ica.25.1409235308023; Thu, 28 Aug 2014 07:15:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.230 with SMTP id j93ls567680qgf.31.gmail; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr933470vcq.50.1409235307904; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id lr17si3588117vdb.24.2014.08.28.07.15.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so867146vcb.33 for ; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) X-Received: by 10.52.120.51 with SMTP id kz19mr718114vdb.95.1409235307772; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp243519vcb; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) X-Received: by 10.42.35.8 with SMTP id o8mr4710088icd.41.1409235307161; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id lq8si4230804igb.35.2014.08.28.07.15.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XN0Ta-00050N-Uk; Thu, 28 Aug 2014 14:14:58 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XN0TZ-0004zy-1z for edk2-devel@lists.sourceforge.net; Thu, 28 Aug 2014 14:14:57 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.174 as permitted sender) client-ip=74.125.82.174; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f174.google.com; Received: from mail-we0-f174.google.com ([74.125.82.174]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XN0TY-0000pb-2G for edk2-devel@lists.sourceforge.net; Thu, 28 Aug 2014 14:14:57 +0000 Received: by mail-we0-f174.google.com with SMTP id u57so833792wes.5 for ; Thu, 28 Aug 2014 07:14:49 -0700 (PDT) X-Received: by 10.180.207.105 with SMTP id lv9mr6264437wic.23.1409235289831; Thu, 28 Aug 2014 07:14:49 -0700 (PDT) Received: from ards-macbook-pro.local (BSN-61-108-214.dial-up.dsl.siol.net. [86.61.108.214]) by mx.google.com with ESMTPSA id bk6sm10278657wjb.26.2014.08.28.07.14.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:14:49 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, edk2-devel@lists.sourceforge.net, peter.maydell@linaro.org, christoffer.dall@linaro.org, drjones@redhat.com, ilias.biris@linaro.org, leif.lindholm@linaro.org Date: Thu, 28 Aug 2014 16:14:03 +0200 Message-Id: <1409235244-25783-16-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409235244-25783-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409235244-25783-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1XN0TY-0000pb-2G Subject: [edk2] [PATCH v4 15/16] ArmVirtualizationPkg: add driver for QEMU's NOR flash X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This adds an implementation of NorFlashPlatformLib that exposes the two 64 MB NOR flash banks that are provided by QEMU's mach-virt emulation both in 32-bit and 64-bit mode. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Laszlo Ersek Signed-off-by: Ard Biesheuvel --- .../Library/NorFlashQemuLib/NorFlashQemuLib.c | 63 ++++++++++++++++++++++ .../Library/NorFlashQemuLib/NorFlashQemuLib.inf | 35 ++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c new file mode 100644 index 000000000000..1e50ed9d9b1b --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c @@ -0,0 +1,63 @@ +/** @file + + Copyright (c) 2014, Linaro 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. + + **/ + +#ifndef _NORFLASHQEMULIB_H_ +#define _NORFLASHQEMULIB_H_ + +#include + +typedef struct { + UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA) + UINTN RegionBaseAddress; // Start address of one single region + UINTN Size; + UINTN BlockSize; + EFI_GUID Guid; +} NOR_FLASH_DESCRIPTION; + +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + return EFI_SUCCESS; +} + +NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { + { + QEMU_NOR0_BASE, + QEMU_NOR0_BASE, + QEMU_NOR0_SIZE, + QEMU_NOR_BSIZE, + {0xF9B94AE2, 0x8BA6, 0x409B, {0x9D, 0x56, 0xB9, 0xB4, 0x17, 0xF5, 0x3C, 0xB3}} + }, { + QEMU_NOR1_BASE, + QEMU_NOR1_BASE, + QEMU_NOR1_SIZE, + QEMU_NOR_BSIZE, + {0x8047DB4B, 0x7E9C, 0x4C0C, {0x8E, 0xBC, 0xDF, 0xBB, 0xAA, 0xCA, 0xCE, 0x8F}} + } +}; + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDescriptions, + OUT UINT32 *Count + ) +{ + *NorFlashDescriptions = mNorFlashDevices; + *Count = sizeof (mNorFlashDevices) / sizeof (mNorFlashDevices[0]); + return EFI_SUCCESS; +} + +#endif /* _NORFLASHPLATFORMLIB_H_ */ diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf new file mode 100644 index 000000000000..8717df5070d1 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf @@ -0,0 +1,35 @@ +#/** @file +# +# Component description file for NorFlashQemuLib module +# +# Copyright (c) 2014, Linaro 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 = 0x00010005 + BASE_NAME = NorFlashQemuLib + FILE_GUID = 339B7829-4C5F-4EFC-B2DD-5050E530DECE + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NorFlashPlatformLib + +[Sources.common] + NorFlashQemuLib.c + +[Packages] + MdePkg/MdePkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib