cmd646: fix abort due to changed opaque pointer for ioport read

We cannot install different opaque pointer for read and write
of the same i/o address.

- handle zero address in bmdma_writeb_common and install
  the same opaque pointer for both read and write access.

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Igor V. Kovalenko 2010-04-23 01:54:50 +04:00 committed by Blue Swirl
parent 70ae65f5d9
commit 50a480946b
1 changed files with 5 additions and 4 deletions

View File

@ -123,6 +123,9 @@ static void bmdma_writeb_common(PCIIDEState *pci_dev, BMDMAState *bm,
printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val);
#endif
switch(addr & 3) {
case 0:
bmdma_cmd_writeb(bm, addr, val);
break;
case 1:
pci_dev->dev.config[MRDMODE] =
(pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30);
@ -168,13 +171,11 @@ static void bmdma_map(PCIDevice *pci_dev, int region_num,
bm->bus = d->bus+i;
qemu_add_vm_change_state_handler(ide_dma_restart_cb, bm);
register_ioport_write(addr, 1, 1, bmdma_cmd_writeb, bm);
if (i == 0) {
register_ioport_write(addr + 1, 3, 1, bmdma_writeb_0, d);
register_ioport_write(addr, 4, 1, bmdma_writeb_0, d);
register_ioport_read(addr, 4, 1, bmdma_readb_0, d);
} else {
register_ioport_write(addr + 1, 3, 1, bmdma_writeb_1, d);
register_ioport_write(addr, 4, 1, bmdma_writeb_1, d);
register_ioport_read(addr, 4, 1, bmdma_readb_1, d);
}