diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2010-11-30 15:25:34 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-11-30 15:25:34 -0600 |
commit | 09fa35e5cdc7d17ed3e1528ca743893ae77a0ea2 (patch) | |
tree | b11bb495700b297a4d49692bfd8d6070a1b74e0b /hw/ide/core.c | |
parent | 9233da785f55c924c5850cd1ce1b7f5f200d631b (diff) | |
parent | b76876e602ca09ff848d99595a506feb1fd54ff4 (diff) | |
download | qemu-09fa35e5cdc7d17ed3e1528ca743893ae77a0ea2.zip qemu-09fa35e5cdc7d17ed3e1528ca743893ae77a0ea2.tar.gz qemu-09fa35e5cdc7d17ed3e1528ca743893ae77a0ea2.tar.bz2 |
Merge remote branch 'kwolf/for-anthony' into staging
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r-- | hw/ide/core.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c index 484e0ca..430350f 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -473,11 +473,21 @@ static void dma_buf_commit(IDEState *s, int is_write) qemu_sglist_destroy(&s->sg); } +static void ide_dma_set_inactive(BMDMAState *bm) +{ + bm->status &= ~BM_STATUS_DMAING; + bm->dma_cb = NULL; + bm->unit = -1; + bm->aiocb = NULL; +} + void ide_dma_error(IDEState *s) { ide_transfer_stop(s); s->error = ABRT_ERR; s->status = READY_STAT | ERR_STAT; + ide_dma_set_inactive(s->bus->bmdma); + s->bus->bmdma->status |= BM_STATUS_INT; ide_set_irq(s->bus); } @@ -587,11 +597,8 @@ static void ide_read_dma_cb(void *opaque, int ret) s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); eot: - bm->status &= ~BM_STATUS_DMAING; bm->status |= BM_STATUS_INT; - bm->dma_cb = NULL; - bm->unit = -1; - bm->aiocb = NULL; + ide_dma_set_inactive(bm); return; } @@ -733,11 +740,8 @@ static void ide_write_dma_cb(void *opaque, int ret) s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); eot: - bm->status &= ~BM_STATUS_DMAING; bm->status |= BM_STATUS_INT; - bm->dma_cb = NULL; - bm->unit = -1; - bm->aiocb = NULL; + ide_dma_set_inactive(bm); return; } @@ -1061,11 +1065,8 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; ide_set_irq(s->bus); eot: - bm->status &= ~BM_STATUS_DMAING; bm->status |= BM_STATUS_INT; - bm->dma_cb = NULL; - bm->unit = -1; - bm->aiocb = NULL; + ide_dma_set_inactive(bm); return; } @@ -2954,12 +2955,10 @@ void ide_dma_cancel(BMDMAState *bm) printf("aio_cancel\n"); #endif bdrv_aio_cancel(bm->aiocb); - bm->aiocb = NULL; } - bm->status &= ~BM_STATUS_DMAING; + /* cancel DMA request */ - bm->unit = -1; - bm->dma_cb = NULL; + ide_dma_set_inactive(bm); } } |