提交 049a9f7b 编写于 作者: H Hervé Poussineau 提交者: Andreas Färber

i82378/i82374: Do not create DMA controller twice

This fixes a crash in PReP emulation when using DMA controller to access
floppy drive.
Signed-off-by: NHervé Poussineau <hpoussin@reactos.org>
Signed-off-by: NAndreas Färber <andreas.faerber@web.de>
上级 42fe1c24
...@@ -38,6 +38,7 @@ do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0) ...@@ -38,6 +38,7 @@ do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
typedef struct I82374State { typedef struct I82374State {
uint8_t commands[8]; uint8_t commands[8];
qemu_irq out;
} I82374State; } I82374State;
static const VMStateDescription vmstate_i82374 = { static const VMStateDescription vmstate_i82374 = {
...@@ -99,7 +100,7 @@ static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport) ...@@ -99,7 +100,7 @@ static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
static void i82374_init(I82374State *s) static void i82374_init(I82374State *s)
{ {
DMA_init(1, NULL); DMA_init(1, &s->out);
memset(s->commands, 0, sizeof(s->commands)); memset(s->commands, 0, sizeof(s->commands));
} }
...@@ -132,6 +133,8 @@ static int i82374_isa_init(ISADevice *dev) ...@@ -132,6 +133,8 @@ static int i82374_isa_init(ISADevice *dev)
i82374_init(s); i82374_init(s);
qdev_init_gpio_out(&dev->qdev, &s->out, 1);
return 0; return 0;
} }
......
...@@ -170,6 +170,7 @@ static void i82378_init(DeviceState *dev, I82378State *s) ...@@ -170,6 +170,7 @@ static void i82378_init(DeviceState *dev, I82378State *s)
{ {
ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0")); ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0"));
ISADevice *pit; ISADevice *pit;
ISADevice *isa;
qemu_irq *out0_irq; qemu_irq *out0_irq;
/* This device has: /* This device has:
...@@ -199,8 +200,8 @@ static void i82378_init(DeviceState *dev, I82378State *s) ...@@ -199,8 +200,8 @@ static void i82378_init(DeviceState *dev, I82378State *s)
pcspk_init(isabus, pit); pcspk_init(isabus, pit);
/* 2 82C37 (dma) */ /* 2 82C37 (dma) */
DMA_init(1, &s->out[1]); isa = isa_create_simple(isabus, "i82374");
isa_create_simple(isabus, "i82374"); qdev_connect_gpio_out(&isa->qdev, 0, s->out[1]);
/* timer */ /* timer */
isa_create_simple(isabus, "mc146818rtc"); isa_create_simple(isabus, "mc146818rtc");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册