aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-02-23 11:17:57 -0500
committerKevin Wolf <kwolf@redhat.com>2015-03-10 14:02:22 +0100
commita96cb236290ef8e54b061b30c41835e435905d7a (patch)
treeadc651b6b426c316d311b859b79eeb2ec2c73fb7 /hw/ide/core.c
parentfe09c7c9f0e8ed8793e986cf616c8de0a9518fd7 (diff)
ide: replace set_unit callback with more IDEBus state
Start moving the initial state of the current request to IDEBus, so that AHCI can use it. The set_unit callback is not used anymore once this is done. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424708286-16483-9-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r--hw/ide/core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0a3d244fe0..7607d03170 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -646,6 +646,7 @@ static void dma_buf_commit(IDEState *s, uint32_t tx_bytes)
void ide_set_inactive(IDEState *s, bool more)
{
s->bus->dma->aiocb = NULL;
+ s->bus->retry_unit = -1;
if (s->bus->dma->ops->set_inactive) {
s->bus->dma->ops->set_inactive(s->bus->dma, more);
}
@@ -666,7 +667,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
BlockErrorAction action = blk_get_error_action(s->blk, is_read, error);
if (action == BLOCK_ERROR_ACTION_STOP) {
- s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
+ assert(s->bus->retry_unit == s->unit);
s->bus->error_status = op;
} else if (action == BLOCK_ERROR_ACTION_REPORT) {
if (op & IDE_RETRY_DMA) {
@@ -799,6 +800,7 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
void ide_start_dma(IDEState *s, BlockCompletionFunc *cb)
{
+ s->bus->retry_unit = s->unit;
if (s->bus->dma->ops->start_dma) {
s->bus->dma->ops->start_dma(s->bus->dma, s, cb);
}
@@ -2327,11 +2329,11 @@ static const IDEDMAOps ide_dma_nop_ops = {
.prepare_buf = ide_nop_int32,
.restart_dma = ide_nop,
.rw_buf = ide_nop_int,
- .set_unit = ide_nop_int,
};
static void ide_restart_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
{
+ s->unit = s->bus->retry_unit;
s->bus->dma->ops->restart_dma(s->bus->dma);
s->io_buffer_index = 0;
s->io_buffer_size = 0;