From patchwork Fri Sep 5 11:56:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36837 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D30D202E4 for ; Fri, 5 Sep 2014 11:57:50 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf67890553pde.11 for ; Fri, 05 Sep 2014 04:57:49 -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:cc: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=4c+/mLZ8214OyXa2L9iWQGZkqOEaj19MbrSULiIZOV4=; b=W/e+3O70UU8KfvZylzr01wxu+x8KLXJlDIx4BJdiwo92nN1enw/AYjotNB/ZH/FtTc Xdkx429KNSEwsPppp4bDJMERHDkpmtEFoKvwt5aZsAf3fhE240OUCtUqwetBQ0jsyIjj 2YIaaN+bcwsWEgAxCFiMAoUvsZLX5zZehi6Yur+RzWyPYZc7xdd0AUQFLunf/nGXYpii KxiwTFAozuQVyJLYXoQWio5N97sYc1jnmI8WE/u+1CG7wY2xvSSjsKi+0dQpxG1bJggh Z0lWAWwFOpvsV5hxBGC4bXu1douxvEduByVETSc5sRDbN5yX8cV6IxRb4nZGl+D0m3cx +0zA== X-Gm-Message-State: ALoCoQnIpuTn+C+MCeipTCwyY7mZ++mVgBqRfnrDFG7xXinx6J08tGKP+xkIGPMDHHCH8lYng7/+ X-Received: by 10.66.66.170 with SMTP id g10mr6632157pat.12.1409918269407; Fri, 05 Sep 2014 04:57:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.6 with SMTP id q6ls743406qgd.82.gmail; Fri, 05 Sep 2014 04:57:49 -0700 (PDT) X-Received: by 10.52.94.36 with SMTP id cz4mr144896vdb.75.1409918269278; Fri, 05 Sep 2014 04:57:49 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id re1si378518vcb.6.2014.09.05.04.57.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so11960618vcb.7 for ; Fri, 05 Sep 2014 04:57:49 -0700 (PDT) X-Received: by 10.52.166.80 with SMTP id ze16mr159335vdb.59.1409918269187; Fri, 05 Sep 2014 04:57:49 -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 uj3csp71109vcb; Fri, 5 Sep 2014 04:57:48 -0700 (PDT) X-Received: by 10.50.142.100 with SMTP id rv4mr3744212igb.43.1409918268548; Fri, 05 Sep 2014 04:57:48 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id dx7si4905296igb.42.2014.09.05.04.57.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:48 -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 1XPs96-0001aO-Ue; Fri, 05 Sep 2014 11:57:40 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XPs94-0001ZR-Ns for edk2-devel@lists.sourceforge.net; Fri, 05 Sep 2014 11:57:38 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.49 as permitted sender) client-ip=74.125.82.49; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f49.google.com; Received: from mail-wg0-f49.google.com ([74.125.82.49]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XPs93-0000RM-OX for edk2-devel@lists.sourceforge.net; Fri, 05 Sep 2014 11:57:38 +0000 Received: by mail-wg0-f49.google.com with SMTP id y10so11536980wgg.20 for ; Fri, 05 Sep 2014 04:57:31 -0700 (PDT) X-Received: by 10.194.63.241 with SMTP id j17mr14138639wjs.115.1409918251307; Fri, 05 Sep 2014 04:57:31 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id dc9sm1758798wib.5.2014.09.05.04.57.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:30 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Fri, 5 Sep 2014 13:56:53 +0200 Message-Id: <1409918214-29584-24-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409918214-29584-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409918214-29584-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: 1XPs93-0000RM-OX Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v7 23/24] 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.176 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 | 56 ++++++++++++++++++++++ .../Library/NorFlashQemuLib/NorFlashQemuLib.inf | 35 ++++++++++++++ 2 files changed, 91 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..79040232e843 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c @@ -0,0 +1,56 @@ +/** @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 +#include + +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..bb767d7806a9 --- /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