Now than all calls to fw_cfg_init_io_dma() pass DMA arguments,
the 'dma_enabled' of the TYPE_FW_CFG_IO type is not used anymore.
Remove it, simplifying fw_cfg_init_io_dma() and fw_cfg_io_realize().
Note, we can not remove the equivalent in fw_cfg_mem_properties[]
because it is still used in HPPA and MIPS Loongson3 machines:
$ git grep -w fw_cfg_init_mem_nodma
hw/hppa/machine.c:204: fw_cfg = fw_cfg_init_mem_nodma(addr, addr + 4, 1);
hw/mips/loongson3_virt.c:289: fw_cfg = fw_cfg_init_mem_nodma(cfg_addr, cfg_addr + 8, 8);
'linuxboot.bin' isn't used anymore, we'll remove it in the
next commit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/i386/fw_cfg.c | 15 +++++++--------
hw/nvram/fw_cfg.c | 26 ++++++++------------------
2 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index 498da9ec69c..bf38338fb47 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -216,18 +216,17 @@ void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg)
#ifdef CONFIG_ACPI
void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)
{
+ uint8_t io_size;
+ Aml *dev = aml_device("FWCF");
+ Aml *crs = aml_resource_template();
+
/*
* when using port i/o, the 8-bit data register *always* overlaps
* with half of the 16-bit control register. Hence, the total size
- * of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the
- * DMA control register is located at FW_CFG_DMA_IO_BASE + 4
+ * of the i/o region used is FW_CFG_CTL_SIZE; And the DMA control
+ * register is located at FW_CFG_DMA_IO_BASE + 4
*/
- Object *obj = OBJECT(fw_cfg);
- uint8_t io_size = object_property_get_bool(obj, "dma_enabled", NULL) ?
- ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) :
- FW_CFG_CTL_SIZE;
- Aml *dev = aml_device("FWCF");
- Aml *crs = aml_resource_template();
+ io_size = ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t);
aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002")));
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 079c28f9212..e0a140d01c0 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1027,12 +1027,9 @@ static FWCfgState *fw_cfg_init_io_internal(MemoryRegion *iomem,
SysBusDevice *sbd;
FWCfgIoState *ios;
FWCfgState *s;
- bool dma_requested = dma_iobase && dma_as;
+ assert(dma_iobase);
dev = qdev_new(TYPE_FW_CFG_IO);
- if (!dma_requested) {
- qdev_prop_set_bit(dev, "dma_enabled", false);
- }
object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
OBJECT(dev));
@@ -1043,13 +1040,10 @@ static FWCfgState *fw_cfg_init_io_internal(MemoryRegion *iomem,
memory_region_add_subregion(iomem, iobase, &ios->comb_iomem);
s = FW_CFG(dev);
-
- if (s->dma_enabled) {
- /* 64 bits for the address field */
- s->dma_as = dma_as;
- s->dma_addr = 0;
- memory_region_add_subregion(iomem, dma_iobase, &s->dma_iomem);
- }
+ /* 64 bits for the address field */
+ s->dma_as = dma_as;
+ s->dma_addr = 0;
+ memory_region_add_subregion(iomem, dma_iobase, &s->dma_iomem);
return s;
}
@@ -1198,8 +1192,6 @@ static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp)
}
static const Property fw_cfg_io_properties[] = {
- DEFINE_PROP_BOOL("dma_enabled", FWCfgIoState, parent_obj.dma_enabled,
- true),
DEFINE_PROP_UINT16("x-file-slots", FWCfgIoState, parent_obj.file_slots,
FW_CFG_FILE_SLOTS_DFLT),
};
@@ -1220,11 +1212,9 @@ static void fw_cfg_io_realize(DeviceState *dev, Error **errp)
memory_region_init_io(&s->comb_iomem, OBJECT(s), &fw_cfg_comb_mem_ops,
FW_CFG(s), "fwcfg", FW_CFG_CTL_SIZE);
- if (FW_CFG(s)->dma_enabled) {
- memory_region_init_io(&FW_CFG(s)->dma_iomem, OBJECT(s),
- &fw_cfg_dma_mem_ops, FW_CFG(s), "fwcfg.dma",
- sizeof(dma_addr_t));
- }
+ memory_region_init_io(&FW_CFG(s)->dma_iomem, OBJECT(s),
+ &fw_cfg_dma_mem_ops, FW_CFG(s), "fwcfg.dma",
+ sizeof(dma_addr_t));
fw_cfg_common_realize(dev, errp);
}
--
2.51.0