The 8257 has 4 DMA channels, reflect that to denote than when 8 channels are used, this is not a single 8257 (but probably two cascaded).
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- include/hw/dma/i8257.h | 4 +++- hw/dma/i8257.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/hw/dma/i8257.h b/include/hw/dma/i8257.h index 2cab50bb6c..3053f18797 100644 --- a/include/hw/dma/i8257.h +++ b/include/hw/dma/i8257.h @@ -7,6 +7,8 @@ #define TYPE_I8257 "i8257" +#define I8257_CHANNEL_COUNT 4 + typedef struct I8257Regs { int now[2]; uint16_t base[2]; @@ -33,7 +35,7 @@ typedef struct I8257State { uint8_t command; uint8_t mask; uint8_t flip_flop; - I8257Regs regs[4]; + I8257Regs regs[I8257_CHANNEL_COUNT]; MemoryRegion channel_io; MemoryRegion cont_io; diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index 52675e97c9..df030f934c 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -361,7 +361,7 @@ static void i8257_dma_run(void *opaque) d->running = 1; } - for (ichan = 0; ichan < 4; ichan++) { + for (ichan = 0; ichan < I8257_CHANNEL_COUNT; ichan++) { int mask; mask = 1 << ichan; @@ -536,8 +536,8 @@ static const VMStateDescription vmstate_i8257 = { VMSTATE_UINT8(mask, I8257State), VMSTATE_UINT8(flip_flop, I8257State), VMSTATE_INT32(dshift, I8257State), - VMSTATE_STRUCT_ARRAY(regs, I8257State, 4, 1, vmstate_i8257_regs, - I8257Regs), + VMSTATE_STRUCT_ARRAY(regs, I8257State, I8257_CHANNEL_COUNT, 1, + vmstate_i8257_regs, I8257Regs), VMSTATE_END_OF_LIST() } }; -- 2.16.3