Commit e3044e23 authored by John Snow's avatar John Snow
Browse files

ide: Add silent DRQ cancellation



Split apart the ide_transfer_stop function into two versions: one that
interrupts and one that doesn't. The one that doesn't can be used to
halt any PIO transfers that are in the DRQ phase. It will not halt
any PIO transfers that are currently in the process of buffering data
for the guest to read.

Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
Reported-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
[Renamed 'etf' to 'end_transfer_func' --js]
Message-id: 1453225191-11871-6-git-send-email-jsnow@redhat.com
parent 51f7b5b8
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -487,14 +487,29 @@ static void ide_cmd_done(IDEState *s)
    }
}

void ide_transfer_stop(IDEState *s)
static void ide_transfer_halt(IDEState *s,
                              void(*end_transfer_func)(IDEState *),
                              bool notify)
{
    s->end_transfer_func = ide_transfer_stop;
    s->end_transfer_func = end_transfer_func;
    s->data_ptr = s->io_buffer;
    s->data_end = s->io_buffer;
    s->status &= ~DRQ_STAT;
    if (notify) {
        ide_cmd_done(s);
    }
}

void ide_transfer_stop(IDEState *s)
{
    ide_transfer_halt(s, ide_transfer_stop, true);
}

__attribute__((__unused__))
static void ide_transfer_cancel(IDEState *s)
{
    ide_transfer_halt(s, ide_transfer_cancel, false);
}

int64_t ide_get_sector(IDEState *s)
{