[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/15] fw_cfg: move QOM type defines and fw_cfg types
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 09/15] fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h |
Date: |
Mon, 17 Jul 2017 15:50:45 -0300 |
From: Mark Cave-Ayland <address@hidden>
By exposing FWCfgIoState and FWCfgMemState internals we allow the possibility
for the internal MemoryRegion fields to be mapped by name for boards that wish
to wire up the fw_cfg device themselves.
Signed-off-by: Mark Cave-Ayland <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
include/hw/nvram/fw_cfg.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++
include/qemu/typedefs.h | 1 +
hw/nvram/fw_cfg.c | 49 +---------------------------------------------
3 files changed, 52 insertions(+), 48 deletions(-)
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index b980cba..b77ea48 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -1,8 +1,19 @@
#ifndef FW_CFG_H
#define FW_CFG_H
+#include "qemu/typedefs.h"
#include "exec/hwaddr.h"
#include "hw/nvram/fw_cfg_keys.h"
+#include "hw/sysbus.h"
+#include "sysemu/dma.h"
+
+#define TYPE_FW_CFG "fw_cfg"
+#define TYPE_FW_CFG_IO "fw_cfg_io"
+#define TYPE_FW_CFG_MEM "fw_cfg_mem"
+
+#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG)
+#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO)
+#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM)
typedef struct FWCfgFile {
uint32_t size; /* file size */
@@ -35,6 +46,45 @@ typedef struct FWCfgDmaAccess {
typedef void (*FWCfgReadCallback)(void *opaque);
+struct FWCfgState {
+ /*< private >*/
+ SysBusDevice parent_obj;
+ /*< public >*/
+
+ uint16_t file_slots;
+ FWCfgEntry *entries[2];
+ int *entry_order;
+ FWCfgFiles *files;
+ uint16_t cur_entry;
+ uint32_t cur_offset;
+ Notifier machine_ready;
+
+ int fw_cfg_order_override;
+
+ bool dma_enabled;
+ dma_addr_t dma_addr;
+ AddressSpace *dma_as;
+ MemoryRegion dma_iomem;
+};
+
+struct FWCfgIoState {
+ /*< private >*/
+ FWCfgState parent_obj;
+ /*< public >*/
+
+ MemoryRegion comb_iomem;
+};
+
+struct FWCfgMemState {
+ /*< private >*/
+ FWCfgState parent_obj;
+ /*< public >*/
+
+ MemoryRegion ctl_iomem, data_iomem;
+ uint32_t data_width;
+ MemoryRegionOps wide_data_ops;
+};
+
/**
* fw_cfg_add_bytes:
* @s: fw_cfg device being modified
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index b191591..7b0d4e7 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -30,6 +30,7 @@ typedef struct DisplaySurface DisplaySurface;
typedef struct DriveInfo DriveInfo;
typedef struct Error Error;
typedef struct EventNotifier EventNotifier;
+typedef struct FWCfgEntry FWCfgEntry;
typedef struct FWCfgIoState FWCfgIoState;
typedef struct FWCfgMemState FWCfgMemState;
typedef struct FWCfgState FWCfgState;
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 97c7677..5bd9044 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -37,14 +37,6 @@
#define FW_CFG_FILE_SLOTS_DFLT 0x20
-#define TYPE_FW_CFG "fw_cfg"
-#define TYPE_FW_CFG_IO "fw_cfg_io"
-#define TYPE_FW_CFG_MEM "fw_cfg_mem"
-
-#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG)
-#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO)
-#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM)
-
/* FW_CFG_VERSION bits */
#define FW_CFG_VERSION 0x01
#define FW_CFG_VERSION_DMA 0x02
@@ -58,51 +50,12 @@
#define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */
-typedef struct FWCfgEntry {
+struct FWCfgEntry {
uint32_t len;
bool allow_write;
uint8_t *data;
void *callback_opaque;
FWCfgReadCallback read_callback;
-} FWCfgEntry;
-
-struct FWCfgState {
- /*< private >*/
- SysBusDevice parent_obj;
- /*< public >*/
-
- uint16_t file_slots;
- FWCfgEntry *entries[2];
- int *entry_order;
- FWCfgFiles *files;
- uint16_t cur_entry;
- uint32_t cur_offset;
- Notifier machine_ready;
-
- int fw_cfg_order_override;
-
- bool dma_enabled;
- dma_addr_t dma_addr;
- AddressSpace *dma_as;
- MemoryRegion dma_iomem;
-};
-
-struct FWCfgIoState {
- /*< private >*/
- FWCfgState parent_obj;
- /*< public >*/
-
- MemoryRegion comb_iomem;
-};
-
-struct FWCfgMemState {
- /*< private >*/
- FWCfgState parent_obj;
- /*< public >*/
-
- MemoryRegion ctl_iomem, data_iomem;
- uint32_t data_width;
- MemoryRegionOps wide_data_ops;
};
#define JPG_FILE 0
--
2.9.4
- [Qemu-devel] [PULL 00/15] x86 and machine queue for 2.10 soft freeze, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 01/15] device-crash-test: Fix regexp on whitelist, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 02/15] tests: Test case for object_resolve_path*(), Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 03/15] qdev: fix the order compat and global properties are applied, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 04/15] test-qdev-global-props: Test global property ordering, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 07/15] fw_cfg: switch fw_cfg_find() to locate the fw_cfg device by type rather than path, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 05/15] Revert "machine: Convert abstract typename on compat_props to subclass names", Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 08/15] fw_cfg: move qdev_init_nofail() from fw_cfg_init1() to callers, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 06/15] qom: Fix ambiguous path detection when ambiguous=NULL, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 09/15] fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h,
Eduardo Habkost <=
- [Qemu-devel] [PULL 10/15] i386: expose "TCGTCGTCGTCG" in the 0x40000000 CPUID leaf, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 12/15] i386: add Skylake-Server cpu model, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 13/15] tests: Simplify abstract-interfaces check with a helper, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 11/15] i386: Update comment about XSAVES on Skylake-Client, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 14/15] qmp: Include 'abstract' field on 'qom-list-types' output, Eduardo Habkost, 2017/07/17
- [Qemu-devel] [PULL 15/15] qmp: Include parent type on 'qom-list-types' output, Eduardo Habkost, 2017/07/17
- Re: [Qemu-devel] [PULL 00/15] x86 and machine queue for 2.10 soft freeze, Peter Maydell, 2017/07/18