aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/dma/i82374.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 83c87d92e0..892f655a7e 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "hw/isa/isa.h"
#include "hw/dma/i8257.h"
@@ -118,13 +119,19 @@ static const MemoryRegionPortio i82374_portio_list[] = {
static void i82374_realize(DeviceState *dev, Error **errp)
{
I82374State *s = I82374(dev);
+ ISABus *isa_bus = isa_bus_from_device(ISA_DEVICE(dev));
+
+ if (isa_get_dma(isa_bus, 0)) {
+ error_setg(errp, "DMA already initialized on ISA bus");
+ return;
+ }
+ i8257_dma_init(isa_bus, true);
portio_list_init(&s->port_list, OBJECT(s), i82374_portio_list, s,
"i82374");
portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj),
s->iobase);
- i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
memset(s->commands, 0, sizeof(s->commands));
}