aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2015-03-19 20:24:14 -0400
committerJohn Snow <jsnow@redhat.com>2015-03-23 12:24:16 -0400
commitdd0bf7baab2201bd8f834be9eb87766662f50b19 (patch)
treea931fbed594aad608b6ce8f6b04f3c7b27bc1cbe
parent6aff22c013ab6f5f711665e7031fd555086d4464 (diff)
ide: fix cmd_read_pio when nsectors > 1
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> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Tested-by: Andreas Färber <afaerber@suse.de> Message-id: 1426811056-2202-3-git-send-email-jsnow@redhat.com
-rw-r--r--hw/ide/core.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0e9da648ea..a895fd86f6 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)