fw_cfg: hard separation between the MMIO and I/O port mappings
commit5712db6ae5101db645f71edc393368cd59bfd314
authorLaszlo Ersek <lersek@redhat.com>
Mon, 22 Dec 2014 12:11:35 +0000 (22 13:11 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 22 Dec 2014 23:13:10 +0000 (22 23:13 +0000)
tree67a9e64952bcc9c39babfea217f7e0f80c1a722d
parentc0ccb02db46c72b4b0fa8a475a6890c1e28064f0
fw_cfg: hard separation between the MMIO and I/O port mappings

We are going to introduce a wide data register for fw_cfg, but only for
the MMIO mapped device. The wide data register will also require the
tightening of endiannesses.

However we don't want to touch the I/O port mapped fw_cfg device at all.

Currently QEMU provides a single fw_cfg device type that can handle both
I/O port and MMIO mapping. This flexibility is not actually exploited by
any board in the tree, but it renders restricting the above changes to
MMIO very hard.

Therefore, let's derive two classes from TYPE_FW_CFG: TYPE_FW_CFG_IO and
TYPE_FW_CFG_MEM.

TYPE_FW_CFG_IO incorporates the base I/O port and the related combined
MemoryRegion. (NB: all boards in the tree that use the I/O port mapped
flavor opt for the combined mapping; that is, when the data port overlays
the high address byte of the selector port. Therefore we can drop the
capability to map those I/O ports separately.)

TYPE_FW_CFG_MEM incorporates the base addresses for the MMIO selector and
data registers, and their respective MemoryRegions.

The "realize" and "props" class members are specific to each new derived
class, and become unused for the base class. The base class retains the
"reset" member and the "vmsd" member, because the reset functionality and
the set of migrated data are not specific to the mapping.

The new functions fw_cfg_init_io() and fw_cfg_init_mem() expose the
possible mappings in separation. For now fw_cfg_init() is retained as a
compatibility shim that enforces the above assumptions.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1419250305-31062-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/nvram/fw_cfg.c
include/hw/nvram/fw_cfg.h
include/qemu/typedefs.h