[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 11/15] PPC: dbdma: macio: Add DMA callback
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 11/15] PPC: dbdma: macio: Add DMA callback |
Date: |
Sun, 30 Jun 2013 03:27:05 +0200 |
We need to know when the IDE core starts a DMA transfer. Add a notifier
function so we have the chance to start transmitting data.
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ide/macio.c | 40 ++++++++++++++++++++++++++++++++++++++++
hw/ppc/mac.h | 2 ++
2 files changed, 42 insertions(+)
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 5cbc923..bd1b972 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -359,11 +359,50 @@ static void macio_ide_reset(DeviceState *dev)
ide_bus_reset(&d->bus);
}
+static int ide_nop(IDEDMA *dma)
+{
+ return 0;
+}
+
+static int ide_nop_int(IDEDMA *dma, int x)
+{
+ return 0;
+}
+
+static void ide_nop_restart(void *opaque, int x, RunState y)
+{
+}
+
+static void ide_dbdma_start(IDEDMA *dma, IDEState *s,
+ BlockDriverCompletionFunc *cb)
+{
+ MACIOIDEState *m = container_of(dma, MACIOIDEState, dma);
+
+ MACIO_DPRINTF("\n", __LINE__);
+ DBDMA_kick(m->dbdma);
+}
+
+static const IDEDMAOps dbdma_ops = {
+ .start_dma = ide_dbdma_start,
+ .start_transfer = ide_nop,
+ .prepare_buf = ide_nop_int,
+ .rw_buf = ide_nop_int,
+ .set_unit = ide_nop_int,
+ .add_status = ide_nop_int,
+ .set_inactive = ide_nop,
+ .restart_cb = ide_nop_restart,
+ .reset = ide_nop,
+};
+
static void macio_ide_realizefn(DeviceState *dev, Error **errp)
{
MACIOIDEState *s = MACIO_IDE(dev);
ide_init2(&s->bus, s->irq);
+
+ /* Register DMA callbacks */
+ s->dma.ops = &dbdma_ops;
+ s->bus.dma = &s->dma;
}
static void macio_ide_initfn(Object *obj)
@@ -414,6 +453,7 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo
**hd_table)
void macio_ide_register_dma(MACIOIDEState *s, void *dbdma, int channel)
{
+ s->dbdma = dbdma;
DBDMA_register_channel(dbdma, channel, s->dma_irq,
pmac_ide_transfer, pmac_ide_flush, s);
}
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 54efaed..27c4ca3 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -131,6 +131,8 @@ typedef struct MACIOIDEState {
MemoryRegion mem;
IDEBus bus;
BlockDriverAIOCB *aiocb;
+ IDEDMA dma;
+ void *dbdma;
} MACIOIDEState;
void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table);
--
1.8.1.4
- [Qemu-ppc] [PATCH 00/15] PPC: Mac OS X guest bringup, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 03/15] PPC: Macio: Replace tabs with spaces, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 06/15] PPC: dbdma: Fix debug print, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 01/15] PPC: Mac: Fix guest exported tbfreq values, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 07/15] PPC: dbdma: Allow new commands in RUN state, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 09/15] PPC: dbdma: Introduce kick function, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 12/15] PPC: dbdma: Move processing to io, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 13/15] PPC: dbdma: Wait for DMA until we have data, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 11/15] PPC: dbdma: macio: Add DMA callback,
Alexander Graf <=
- [Qemu-ppc] [PATCH 10/15] PPC: dbdma: Move static bh variable to device struct, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 04/15] PPC: dbdma: Replace tabs with spaces, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 05/15] PPC: Mac: Add debug prints in macio and dbdma code, Alexander Graf, 2013/06/29
- [Qemu-ppc] [PATCH 02/15] PPC: g3beige: Move secondary IDE bus to mac-io, Alexander Graf, 2013/06/29