static void bmdma_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { BMDMAState *bm = opaque; PCIIDEState *pci_dev = bm->pci_dev; if (size != 1) { return; } #ifdef DEBUG_IDE printf("bmdma: writeb 0x%02" TARGET_PRIxPHYS " : 0x%02" PRIx64 "\n", addr, val); #endif switch(addr & 3) { case 0: bmdma_cmd_writeb(bm, val); break; case 1: pci_dev->dev.config[MRDMODE] = (pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30); cmd646_update_irq(pci_dev); break; case 2: bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06); break; case 3: if (bm == &pci_dev->bmdma[0]) pci_dev->dev.config[UDIDETCR0] = val; else pci_dev->dev.config[UDIDETCR1] = val; break; } }
static void bmdma_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { BMDMAState *bm = opaque; PCIDevice *pci_dev = PCI_DEVICE(bm->pci_dev); if (size != 1) { return; } #ifdef DEBUG_IDE printf("bmdma: writeb " TARGET_FMT_plx " : 0x%" PRIx64 "\n", addr, val); #endif switch(addr & 3) { case 0: bmdma_cmd_writeb(bm, val); break; case 1: pci_dev->config[MRDMODE] = (pci_dev->config[MRDMODE] & ~0x30) | (val & 0x30); cmd646_update_irq(bm->pci_dev); break; case 2: bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06); break; case 3: if (bm == &bm->pci_dev->bmdma[0]) { pci_dev->config[UDIDETCR0] = val; } else { pci_dev->config[UDIDETCR1] = val; } break; } }
/* the PCI irq level is the logical OR of the two channels */ static void cmd646_set_irq(void *opaque, int channel, int level) { PCIIDEState *d = opaque; int irq_mask; irq_mask = MRDMODE_INTR_CH0 << channel; if (level) d->dev.config[MRDMODE] |= irq_mask; else d->dev.config[MRDMODE] &= ~irq_mask; cmd646_update_irq(d); }
/* the PCI irq level is the logical OR of the two channels */ static void cmd646_set_irq(void *opaque, int channel, int level) { PCIIDEState *d = opaque; PCIDevice *pd = PCI_DEVICE(d); int irq_mask; irq_mask = MRDMODE_INTR_CH0 << channel; if (level) { pd->config[MRDMODE] |= irq_mask; } else { pd->config[MRDMODE] &= ~irq_mask; } cmd646_update_irq(d); }