From patchwork Wed Sep 3 11:18:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36586 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A21C3202E4 for ; Wed, 3 Sep 2014 11:19:20 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id m1sf44872910oag.3 for ; Wed, 03 Sep 2014 04:19:20 -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=v31OkKh9Sw+jvoOV2DS1eZek/H6gdjszMmuYXv24XVQ=; b=MHv47ARUK1Wcifcc/BYm3NdfFxDCj4PSpgYyXh1UKTRGWe7Ow1NHFcXZ84aTsXulcv Ap2lYY5DSqG7IH+CtpScWFEYfApCQibsxzzXTJkYAVWch6cOQ9M5XWk4fNsaLDbBeOMc oFGK873gnKGWO77Gd7Q1lCx/3TcVYOtyugOLqoTkjQ1m0RkHIiT4TJihbN+/knJ8VjMQ 6/EF0vWdV9HKqiEl/h3QWkOOtQUYu9r0HalZD4dBVWGnwHl9fn1tqP7I1qw0HG8iFfLt JdyY/x7DlTUZtMhGqfWebqM4IA73nwwsiH7N434m5nj1IlEckT34uETA79zBtWP8DdsD jKRA== X-Gm-Message-State: ALoCoQkvQDXVNJK0X/XPGh3RcVZsWXhuIZBUl0matbXxh1D3BrUBXsqnd+q05tMQ0HlkxmUr0bl6 X-Received: by 10.50.126.9 with SMTP id mu9mr19057468igb.6.1409743160292; Wed, 03 Sep 2014 04:19:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.45 with SMTP id l42ls2897293qga.61.gmail; Wed, 03 Sep 2014 04:19:20 -0700 (PDT) X-Received: by 10.221.21.201 with SMTP id qt9mr1047250vcb.39.1409743160199; Wed, 03 Sep 2014 04:19:20 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id d6si727113vdq.25.2014.09.03.04.19.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ij19so8729204vcb.3 for ; Wed, 03 Sep 2014 04:19:20 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr38541vcq.50.1409743160073; Wed, 03 Sep 2014 04:19:20 -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 uj3csp664014vcb; Wed, 3 Sep 2014 04:19:19 -0700 (PDT) X-Received: by 10.50.147.38 with SMTP id th6mr30775042igb.31.1409743159452; Wed, 03 Sep 2014 04:19:19 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id i11si11412420icc.66.2014.09.03.04.19.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:19 -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-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8ak-0004KN-GF; Wed, 03 Sep 2014 11:19:10 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aj-0004Ju-Ic for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:19:09 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.172 as permitted sender) client-ip=209.85.212.172; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f172.google.com; Received: from mail-wi0-f172.google.com ([209.85.212.172]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XP8ai-0007b5-G4 for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:19:09 +0000 Received: by mail-wi0-f172.google.com with SMTP id n3so691566wiv.5 for ; Wed, 03 Sep 2014 04:19:02 -0700 (PDT) X-Received: by 10.194.174.39 with SMTP id bp7mr1873126wjc.131.1409743142265; Wed, 03 Sep 2014 04:19:02 -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 p1sm15258661wjy.22.2014.09.03.04.19.00 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:01 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Wed, 3 Sep 2014 13:18:15 +0200 Message-Id: <1409743096-14919-23-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409743096-14919-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409743096-14919-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: 1XP8ai-0007b5-G4 Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v6 22/23] 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.172 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 --- Retained the 'Reviewed-by: Laszlo Ersek ' as the only change is removing a duplicated (so identical) typedef of NOR_FLASH_DESCRIPTION. .../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