aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/pci.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-12-20 13:45:48 +0100
committerKevin Wolf <kwolf@redhat.com>2011-01-24 11:08:50 +0100
commitcd369c4634e58a99fb82f076e6117bfdf0012b8e (patch)
treef5eee0d38844ef367c06b1d0a04e97dbdda20eae /hw/ide/pci.c
parent8b6b2afcf85dd5ff33075e93a2e30fbea34c5a55 (diff)
ide: factor dma handling helpers
Factor the DMA I/O path that is duplicated between read and write commands, into common helpers using the s->is_read flag added for the macio ATA controller. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/pci.c')
-rw-r--r--hw/ide/pci.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 510b2de597..987caffa3a 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -178,14 +178,9 @@ static void bmdma_restart_dma(BMDMAState *bm, int is_read)
s->io_buffer_index = 0;
s->io_buffer_size = 0;
s->nsector = bm->nsector;
+ s->is_read = is_read;
bm->cur_addr = bm->addr;
-
- if (is_read) {
- bm->dma_cb = ide_read_dma_cb;
- } else {
- bm->dma_cb = ide_write_dma_cb;
- }
-
+ bm->dma_cb = ide_dma_cb;
bmdma_start_dma(&bm->dma, s, bm->dma_cb);
}