From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <lersek@redhat.com>
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 E869E82218
 for <edk2-devel@ml01.01.org>; Tue, 21 Feb 2017 07:38:24 -0800 (PST)
Received: from int-mx14.intmail.prod.int.phx2.redhat.com
 (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27])
 (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 8461B81255;
 Tue, 21 Feb 2017 15:38:25 +0000 (UTC)
Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com
 [10.3.116.47])
 by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 v1LFcGVD015879; Tue, 21 Feb 2017 10:38:24 -0500
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@ml01.01.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Date: Tue, 21 Feb 2017 16:38:09 +0100
Message-Id: <20170221153812.1420-4-lersek@redhat.com>
In-Reply-To: <20170221153812.1420-1-lersek@redhat.com>
References: <20170221153812.1420-1-lersek@redhat.com>
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.25]); Tue, 21 Feb 2017 15:38:25 +0000 (UTC)
Subject: [PATCH 3/6] OvmfPkg/QemuFwCfgLib: move types/macros from lib class to IndustryStandard
X-BeenThere: edk2-devel@lists.01.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: EDK II Development  <edk2-devel.lists.01.org>
List-Unsubscribe: <https://lists.01.org/mailman/options/edk2-devel>,
 <mailto:edk2-devel-request@lists.01.org?subject=unsubscribe>
List-Archive: <http://lists.01.org/pipermail/edk2-devel/>
List-Post: <mailto:edk2-devel@lists.01.org>
List-Help: <mailto:edk2-devel-request@lists.01.org?subject=help>
List-Subscribe: <https://lists.01.org/mailman/listinfo/edk2-devel>,
 <mailto:edk2-devel-request@lists.01.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Feb 2017 15:38:25 -0000

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 96 ++++++++++++++++++++
 OvmfPkg/Include/Library/QemuFwCfgLib.h       | 70 +-------------
 2 files changed, 97 insertions(+), 69 deletions(-)

diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
new file mode 100644
index 000000000000..c7e9b5c382a5
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
@@ -0,0 +1,96 @@
+/** @file
+  Macro and type definitions corresponding to the QEMU fw_cfg interface.
+
+  Refer to "docs/specs/fw_cfg.txt" in the QEMU source directory.
+
+  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
+  Copyright (C) 2013 - 2017, Red Hat, Inc.
+
+  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 __FW_CFG_H__
+#define __FW_CFG_H__
+
+#include <Base.h>
+
+//
+// The size, in bytes, of names of firmware configuration files, including at
+// least one terminating NUL byte.
+//
+#define QEMU_FW_CFG_FNAME_SIZE 56
+
+//
+// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap
+// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the
+// DMA interface is available.
+//
+#define FW_CFG_F_DMA BIT1
+
+//
+// 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
+#define FW_CFG_DMA_CTL_WRITE  BIT4
+
+//
+// Numerically defined keys.
+//
+typedef enum {
+  QemuFwCfgItemSignature            = 0x0000,
+  QemuFwCfgItemInterfaceVersion     = 0x0001,
+  QemuFwCfgItemSystemUuid           = 0x0002,
+  QemuFwCfgItemRamSize              = 0x0003,
+  QemuFwCfgItemGraphicsEnabled      = 0x0004,
+  QemuFwCfgItemSmpCpuCount          = 0x0005,
+  QemuFwCfgItemMachineId            = 0x0006,
+  QemuFwCfgItemKernelAddress        = 0x0007,
+  QemuFwCfgItemKernelSize           = 0x0008,
+  QemuFwCfgItemKernelCommandLine    = 0x0009,
+  QemuFwCfgItemInitrdAddress        = 0x000a,
+  QemuFwCfgItemInitrdSize           = 0x000b,
+  QemuFwCfgItemBootDevice           = 0x000c,
+  QemuFwCfgItemNumaData             = 0x000d,
+  QemuFwCfgItemBootMenu             = 0x000e,
+  QemuFwCfgItemMaximumCpuCount      = 0x000f,
+  QemuFwCfgItemKernelEntry          = 0x0010,
+  QemuFwCfgItemKernelData           = 0x0011,
+  QemuFwCfgItemInitrdData           = 0x0012,
+  QemuFwCfgItemCommandLineAddress   = 0x0013,
+  QemuFwCfgItemCommandLineSize      = 0x0014,
+  QemuFwCfgItemCommandLineData      = 0x0015,
+  QemuFwCfgItemKernelSetupAddress   = 0x0016,
+  QemuFwCfgItemKernelSetupSize      = 0x0017,
+  QemuFwCfgItemKernelSetupData      = 0x0018,
+  QemuFwCfgItemFileDir              = 0x0019,
+
+  QemuFwCfgItemX86AcpiTables        = 0x8000,
+  QemuFwCfgItemX86SmbiosTables      = 0x8001,
+  QemuFwCfgItemX86Irq0Override      = 0x8002,
+  QemuFwCfgItemX86E820Table         = 0x8003,
+  QemuFwCfgItemX86HpetData          = 0x8004,
+
+} 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 ()
+
+#endif
diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
index 41c3817470a2..2a1261327b01 100644
--- a/OvmfPkg/Include/Library/QemuFwCfgLib.h
+++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h
@@ -17,75 +17,7 @@
 #ifndef __FW_CFG_LIB__
 #define __FW_CFG_LIB__
 
-//
-// The size, in bytes, of names of firmware configuration files, including at
-// least one terminating NUL byte.
-//
-#define QEMU_FW_CFG_FNAME_SIZE 56
-
-//
-// If the following bit is set in the UINT32 fw_cfg revision / feature bitmap
-// -- read from key 0x0001 with the basic IO Port or MMIO method --, then the
-// DMA interface is available.
-//
-#define FW_CFG_F_DMA BIT1
-
-//
-// 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
-#define FW_CFG_DMA_CTL_WRITE  BIT4
-
-typedef enum {
-  QemuFwCfgItemSignature            = 0x0000,
-  QemuFwCfgItemInterfaceVersion     = 0x0001,
-  QemuFwCfgItemSystemUuid           = 0x0002,
-  QemuFwCfgItemRamSize              = 0x0003,
-  QemuFwCfgItemGraphicsEnabled      = 0x0004,
-  QemuFwCfgItemSmpCpuCount          = 0x0005,
-  QemuFwCfgItemMachineId            = 0x0006,
-  QemuFwCfgItemKernelAddress        = 0x0007,
-  QemuFwCfgItemKernelSize           = 0x0008,
-  QemuFwCfgItemKernelCommandLine    = 0x0009,
-  QemuFwCfgItemInitrdAddress        = 0x000a,
-  QemuFwCfgItemInitrdSize           = 0x000b,
-  QemuFwCfgItemBootDevice           = 0x000c,
-  QemuFwCfgItemNumaData             = 0x000d,
-  QemuFwCfgItemBootMenu             = 0x000e,
-  QemuFwCfgItemMaximumCpuCount      = 0x000f,
-  QemuFwCfgItemKernelEntry          = 0x0010,
-  QemuFwCfgItemKernelData           = 0x0011,
-  QemuFwCfgItemInitrdData           = 0x0012,
-  QemuFwCfgItemCommandLineAddress   = 0x0013,
-  QemuFwCfgItemCommandLineSize      = 0x0014,
-  QemuFwCfgItemCommandLineData      = 0x0015,
-  QemuFwCfgItemKernelSetupAddress   = 0x0016,
-  QemuFwCfgItemKernelSetupSize      = 0x0017,
-  QemuFwCfgItemKernelSetupData      = 0x0018,
-  QemuFwCfgItemFileDir              = 0x0019,
-
-  QemuFwCfgItemX86AcpiTables        = 0x8000,
-  QemuFwCfgItemX86SmbiosTables      = 0x8001,
-  QemuFwCfgItemX86Irq0Override      = 0x8002,
-  QemuFwCfgItemX86E820Table         = 0x8003,
-  QemuFwCfgItemX86HpetData          = 0x8004,
-
-} 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 ()
+#include <IndustryStandard/QemuFwCfg.h>
 
 /**
   Returns a boolean indicating if the firmware configuration interface
-- 
2.9.3