[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 46/69] ide: commonize io_buffer_index initialization
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 46/69] ide: commonize io_buffer_index initialization |
Date: |
Fri, 27 Feb 2015 18:18:44 +0000 |
From: Paolo Bonzini <address@hidden>
Resetting the io_buffer_index to 0 is commonized,
with the exception of the case within ide_atapi_cmd_reply,
where we need to reset this index to 0 prior to the
ide_atapi_cmd_reply_end call.
Note that not all calls to ide_atapi_cmd_reply_end
expect the index to be 0, so setting it there is
not appropriate.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/atapi.c | 3 +--
hw/ide/core.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 1bf8b34..950e311 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -252,7 +252,6 @@ static void ide_atapi_cmd_reply(IDEState *s, int size, int
max_size)
s->packet_transfer_size = size;
s->io_buffer_size = size; /* dma: send the reply data as one chunk */
s->elementary_transfer_size = 0;
- s->io_buffer_index = 0;
if (s->atapi_dma) {
block_acct_start(blk_get_stats(s->blk), &s->acct, size,
@@ -261,6 +260,7 @@ static void ide_atapi_cmd_reply(IDEState *s, int size, int
max_size)
ide_start_dma(s, ide_atapi_cmd_read_dma_cb);
} else {
s->status = READY_STAT | SEEK_STAT;
+ s->io_buffer_index = 0;
ide_atapi_cmd_reply_end(s);
}
}
@@ -368,7 +368,6 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba,
int nb_sectors,
{
s->lba = lba;
s->packet_transfer_size = nb_sectors * sector_size;
- s->io_buffer_index = 0;
s->io_buffer_size = 0;
s->cd_sector_size = sector_size;
diff --git a/hw/ide/core.c b/hw/ide/core.c
index b62a94a..ff28db0 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -780,7 +780,6 @@ eot:
static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
{
s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
- s->io_buffer_index = 0;
s->io_buffer_size = 0;
s->dma_cmd = dma_cmd;
@@ -802,6 +801,7 @@ static void ide_sector_start_dma(IDEState *s, enum
ide_dma_cmd dma_cmd)
void ide_start_dma(IDEState *s, BlockCompletionFunc *cb)
{
+ s->io_buffer_index = 0;
s->bus->retry_unit = s->unit;
s->bus->retry_sector_num = ide_get_sector(s);
s->bus->retry_nsector = s->nsector;
@@ -2341,7 +2341,6 @@ static void ide_restart_dma(IDEState *s, enum ide_dma_cmd
dma_cmd)
ide_set_sector(s, s->bus->retry_sector_num);
s->nsector = s->bus->retry_nsector;
s->bus->dma->ops->restart_dma(s->bus->dma);
- s->io_buffer_index = 0;
s->io_buffer_size = 0;
s->dma_cmd = dma_cmd;
ide_start_dma(s, ide_dma_cb);
--
2.1.0
- [Qemu-devel] [PULL 37/69] ide: prepare to move restart to common code, (continued)
- [Qemu-devel] [PULL 37/69] ide: prepare to move restart to common code, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 38/69] ide: introduce ide_register_restart_cb, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 40/69] ide: pass IDEBus to the restart_cb, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 42/69] ide: remove restart_cb callback, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 41/69] ide: move restart callback to common code, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 32/69] raw-posix: Factor block size detection out of raw_probe_alignment(), Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 43/69] ide: replace set_unit callback with more IDEBus state, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 44/69] ide: place initial state of the current request to IDEBus, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 35/69] BlockConf: Call backend functions to detect geometry and blocksizes, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 45/69] ide: migrate initial request state via IDEBus, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 46/69] ide: commonize io_buffer_index initialization,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 47/69] ide: make more functions static, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 48/69] ide: support PIO restart for the ISA controller, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 50/69] ahci: add support for restarting non-queued commands, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 49/69] ahci: Migrate IDEStatus, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 53/69] libqos/ahci: Zero-fill AHCI headers, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 51/69] ahci: Recompute cur_cmd on migrate post load, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 52/69] qtest/ide: Test flush / retry for ISA and PCI, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 56/69] qtest/ahci: Add DMA test variants, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 54/69] qtest/ahci: Add a macro bootup routine, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 58/69] qtest/ahci: add fragmented dma test, Stefan Hajnoczi, 2015/02/27