[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 01/17] ide: start extracting ide_restart_dma out
From: |
John Snow |
Subject: |
[Qemu-devel] [PATCH v4 01/17] ide: start extracting ide_restart_dma out of bmdma_restart_dma |
Date: |
Mon, 23 Feb 2015 11:17:50 -0500 |
From: Paolo Bonzini <address@hidden>
This patch begins refactoring the restart dma functions
out of bmdma to be shared with AHCI and other future
IDE HBA implementations.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: John Snow <address@hidden>
---
hw/ide/pci.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index e3f2054..da3e392 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -184,18 +184,24 @@ static void bmdma_set_inactive(IDEDMA *dma, bool more)
}
}
-static void bmdma_restart_dma(BMDMAState *bm, enum ide_dma_cmd dma_cmd)
+static void bmdma_restart_dma(BMDMAState *bm)
{
IDEState *s = bmdma_active_if(bm);
ide_set_sector(s, bm->sector_num);
- s->io_buffer_index = 0;
- s->io_buffer_size = 0;
s->nsector = bm->nsector;
- s->dma_cmd = dma_cmd;
bm->cur_addr = bm->addr;
- bm->dma_cb = ide_dma_cb;
- bmdma_start_dma(&bm->dma, s, bm->dma_cb);
+}
+
+static void ide_restart_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
+{
+ BMDMAState *bm = DO_UPCAST(BMDMAState, dma, s->bus->dma);
+
+ bmdma_restart_dma(bm);
+ s->io_buffer_index = 0;
+ s->io_buffer_size = 0;
+ s->dma_cmd = dma_cmd;
+ bmdma_start_dma(&bm->dma, s, ide_dma_cb);
}
/* TODO This should be common IDE code */
@@ -203,6 +209,7 @@ static void bmdma_restart_bh(void *opaque)
{
BMDMAState *bm = opaque;
IDEBus *bus = bm->bus;
+ IDEState *s;
bool is_read;
int error_status;
@@ -213,6 +220,7 @@ static void bmdma_restart_bh(void *opaque)
return;
}
+ s = bmdma_active_if(bm);
is_read = (bus->error_status & IDE_RETRY_READ) != 0;
/* The error status must be cleared before resubmitting the request: The
@@ -223,18 +231,18 @@ static void bmdma_restart_bh(void *opaque)
if (error_status & IDE_RETRY_DMA) {
if (error_status & IDE_RETRY_TRIM) {
- bmdma_restart_dma(bm, IDE_DMA_TRIM);
+ ide_restart_dma(s, IDE_DMA_TRIM);
} else {
- bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
+ ide_restart_dma(s, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
}
} else if (error_status & IDE_RETRY_PIO) {
if (is_read) {
- ide_sector_read(bmdma_active_if(bm));
+ ide_sector_read(s);
} else {
- ide_sector_write(bmdma_active_if(bm));
+ ide_sector_write(s);
}
} else if (error_status & IDE_RETRY_FLUSH) {
- ide_flush_cache(bmdma_active_if(bm));
+ ide_flush_cache(s);
} else {
IDEState *s = bmdma_active_if(bm);
--
1.9.3
- [Qemu-devel] [PATCH v4 00/17] ide: rerror/werror migration fixes for IDE/ISA and AHCI, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 04/17] ide: do not use BMDMA in restart callback, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 01/17] ide: start extracting ide_restart_dma out of bmdma_restart_dma,
John Snow <=
- [Qemu-devel] [PATCH v4 03/17] ide: introduce ide_register_restart_cb, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 08/17] ide: replace set_unit callback with more IDEBus state, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 02/17] ide: prepare to move restart to common code, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 09/17] ide: place initial state of the current request to IDEBus, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 06/17] ide: move restart callback to common code, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 10/17] ide: migrate initial request state via IDEBus, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 05/17] ide: pass IDEBus to the restart_cb, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 07/17] ide: remove restart_cb callback, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 15/17] ahci: add support for restarting non-queued commands, John Snow, 2015/02/23
- [Qemu-devel] [PATCH v4 13/17] ide: support PIO restart for the ISA controller, John Snow, 2015/02/23