SHA256
1
0
forked from pool/qemu
qemu/0040-ide-fix-cmd_read_pio-when-nsectors-.patch
2015-03-21 11:46:36 +00:00

40 lines
1.2 KiB
Diff

From bac9220185506f9d0c5ad93a23789334898c3860 Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Thu, 19 Mar 2015 20:24:14 -0400
Subject: [PATCH] ide: fix cmd_read_pio when nsectors > 1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Similar to the cmd_write_pio fix, update the nsector count and
ide sector before we invoke ide_transfer_start.
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/ide/core.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0e9da64..a895fd8 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -587,14 +587,12 @@ static void ide_sector_read_cb(void *opaque, int ret)
n = s->req_nb_sectors;
}
- /* Allow the guest to read the io_buffer */
- ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);
-
- ide_set_irq(s->bus);
-
ide_set_sector(s, ide_get_sector(s) + n);
s->nsector -= n;
+ /* Allow the guest to read the io_buffer */
+ ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);
s->io_buffer_offset += 512 * n;
+ ide_set_irq(s->bus);
}
static void ide_sector_read(IDEState *s)