From patchwork Fri Dec 2 20:20:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 86359 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp429031qgi; Fri, 2 Dec 2016 12:21:15 -0800 (PST) X-Received: by 10.84.216.8 with SMTP id m8mr99802773pli.116.1480710075139; Fri, 02 Dec 2016 12:21:15 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 206si6398587pfw.94.2016.12.02.12.21.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Dec 2016 12:21:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DEE8E81F64; Fri, 2 Dec 2016 12:21:14 -0800 (PST) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2CEB781F19 for ; Fri, 2 Dec 2016 12:21:14 -0800 (PST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9877FC05AA4A; Fri, 2 Dec 2016 20:21:13 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-87.phx2.redhat.com [10.3.116.87]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB2KL4BG010188; Fri, 2 Dec 2016 15:21:11 -0500 From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 2 Dec 2016 21:20:56 +0100 Message-Id: <20161202202059.5061-4-lersek@redhat.com> In-Reply-To: <20161202202059.5061-1-lersek@redhat.com> References: <20161202202059.5061-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 02 Dec 2016 20:21:13 +0000 (UTC) Subject: [edk2] [PATCH v2 3/6] ArmVirtPkg, OvmfPkg: QemuFwCfgLib: move DMA-related defs to lib class X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Move the type and macro definitions related to QEMU's DMA-like fw_cfg access method to the library class header. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- Notes: v2: - move definitions to lib class header rather than to a new IndustryStandard include [Jordan] - because ArmVirtPkg's library instance already includes the lib class header, the code movement must be atomic and straddle both packages - restrict patch to code movement solely; FW_CFG_F_DMA and FW_CFG_DMA_CTL_WRITE will be added separately OvmfPkg/Include/Library/QemuFwCfgLib.h | 19 +++++++++++++++++++ ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 20 -------------------- 2 files changed, 19 insertions(+), 20 deletions(-) -- 2.9.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h index 7c29422fbd72..40a07456c530 100644 --- a/OvmfPkg/Include/Library/QemuFwCfgLib.h +++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h @@ -23,6 +23,14 @@ // #define QEMU_FW_CFG_FNAME_SIZE 56 +// +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding). +// +#define FW_CFG_DMA_CTL_ERROR BIT0 +#define FW_CFG_DMA_CTL_READ BIT1 +#define FW_CFG_DMA_CTL_SKIP BIT2 +#define FW_CFG_DMA_CTL_SELECT BIT3 + typedef enum { QemuFwCfgItemSignature = 0x0000, QemuFwCfgItemInterfaceVersion = 0x0001, @@ -59,6 +67,17 @@ typedef enum { } FIRMWARE_CONFIG_ITEM; +// +// Communication structure for the DMA access method. All fields are encoded in +// big endian. +// +#pragma pack (1) +typedef struct { + UINT32 Control; + UINT32 Length; + UINT64 Address; +} FW_CFG_DMA_ACCESS; +#pragma pack () /** Returns a boolean indicating if the firmware configuration interface diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c index 2fd8d9050566..6033a2a14c42 100644 --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -53,26 +53,6 @@ STATIC READ_BYTES_FUNCTION DmaReadBytes; // STATIC READ_BYTES_FUNCTION *InternalQemuFwCfgReadBytes = MmioReadBytes; -// -// Communication structure for DmaReadBytes(). All fields are encoded in big -// endian. -// -#pragma pack (1) -typedef struct { - UINT32 Control; - UINT32 Length; - UINT64 Address; -} FW_CFG_DMA_ACCESS; -#pragma pack () - -// -// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding). -// -#define FW_CFG_DMA_CTL_ERROR BIT0 -#define FW_CFG_DMA_CTL_READ BIT1 -#define FW_CFG_DMA_CTL_SKIP BIT2 -#define FW_CFG_DMA_CTL_SELECT BIT3 - /** Returns a boolean indicating if the firmware configuration interface