Skip to content

Commit

Permalink
ide: fix cmd_read_pio when nsectors > 1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jnsnow committed Mar 23, 2015
1 parent 6aff22c commit dd0bf7b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions hw/ide/core.c
Expand Up @@ -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)
Expand Down

0 comments on commit dd0bf7b

Please sign in to comment.