From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaGE-0005tW-AW for qemu-devel@nongnu.org; Tue, 19 Jan 2016 12:40:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLaG9-00018B-1G for qemu-devel@nongnu.org; Tue, 19 Jan 2016 12:40:06 -0500 From: John Snow Date: Tue, 19 Jan 2016 12:39:51 -0500 Message-Id: <1453225191-11871-7-git-send-email-jsnow@redhat.com> In-Reply-To: <1453225191-11871-1-git-send-email-jsnow@redhat.com> References: <1453225191-11871-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PATCH v2 6/6] ide: fix device_reset to not ignore pending AIO List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, John Snow , qemu-devel@nongnu.org, stefanha@redhat.com Signed-off-by: John Snow --- hw/ide/core.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 9bc8e58..c68d1d4 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -502,7 +502,6 @@ 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); @@ -1295,6 +1294,23 @@ static bool cmd_nop(IDEState *s, uint8_t cmd) return true; } +static bool cmd_device_reset(IDEState *s, uint8_t cmd) +{ + /* Halt PIO (in the DRQ phase), then DMA */ + ide_transfer_cancel(s); + ide_cancel_dma_sync(s); + + /* Reset any PIO commands, reset signature, etc */ + ide_reset(s); + + /* RESET: ATA8-ACS3 7.10.4 "Normal Outputs"; + * ATA8-ACS3 Table 184 "Device Signatures for Normal Output" */ + s->status = 0x00; + + /* Do not overwrite status register */ + return false; +} + static bool cmd_data_set_management(IDEState *s, uint8_t cmd) { switch (s->feature) { @@ -1611,15 +1627,6 @@ static bool cmd_exec_dev_diagnostic(IDEState *s, uint8_t cmd) return false; } -static bool cmd_device_reset(IDEState *s, uint8_t cmd) -{ - ide_set_signature(s); - s->status = 0x00; /* NOTE: READY is _not_ set */ - s->error = 0x01; - - return false; -} - static bool cmd_packet(IDEState *s, uint8_t cmd) { /* overlapping commands not supported */ -- 2.4.3