[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/24] ide: fold add_status callback into set_inacti
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 11/24] ide: fold add_status callback into set_inactive |
Date: |
Mon, 28 Oct 2013 17:43:27 +0100 |
It is now called only after the set_inactive callback. Put the two together.
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/ide/ahci.c | 9 ---------
hw/ide/atapi.c | 2 +-
hw/ide/core.c | 12 ++++--------
hw/ide/internal.h | 6 +++---
hw/ide/macio.c | 1 -
hw/ide/pci.c | 19 +++++++------------
6 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 7b47053..1d4fb17 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1092,14 +1092,6 @@ static int ahci_dma_set_unit(IDEDMA *dma, int unit)
return 0;
}
-static int ahci_dma_add_status(IDEDMA *dma, int status)
-{
- AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
- DPRINTF(ad->port_no, "set status: %x\n", status);
-
- return 0;
-}
-
static void ahci_dma_trigger_irq(IDEDMA *dma)
{
AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
@@ -1138,7 +1130,6 @@ static const IDEDMAOps ahci_dma_ops = {
.rw_buf = ahci_dma_rw_buf,
.set_unit = ahci_dma_set_unit,
.trigger_irq = ahci_dma_trigger_irq,
- .add_status = ahci_dma_add_status,
.async_cmd_done = ahci_async_cmd_done,
.restart_cb = ahci_dma_restart_cb,
};
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 814cffb..6b3f6c1 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -358,7 +358,7 @@ eot:
if (s->bus->dma->ops->trigger_irq) {
s->bus->dma->ops->trigger_irq(s->bus->dma);
}
- ide_set_inactive(s);
+ ide_set_inactive(s, false);
}
/* start a CD-CDROM read command with DMA */
diff --git a/hw/ide/core.c b/hw/ide/core.c
index bd4a9f2..a62654f 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -577,11 +577,11 @@ static void ide_async_cmd_done(IDEState *s)
}
}
-void ide_set_inactive(IDEState *s)
+void ide_set_inactive(IDEState *s, bool more)
{
s->bus->dma->aiocb = NULL;
if (s->bus->dma->ops->set_inactive) {
- s->bus->dma->ops->set_inactive(s->bus->dma);
+ s->bus->dma->ops->set_inactive(s->bus->dma, more);
}
ide_async_cmd_done(s);
}
@@ -591,7 +591,7 @@ void ide_dma_error(IDEState *s)
ide_transfer_stop(s);
s->error = ABRT_ERR;
s->status = READY_STAT | ERR_STAT;
- ide_set_inactive(s);
+ ide_set_inactive(s, false);
ide_set_irq(s->bus);
}
@@ -696,10 +696,7 @@ eot:
if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) {
bdrv_acct_done(s->bs, &s->acct);
}
- ide_set_inactive(s);
- if (stay_active) {
- s->bus->dma->ops->add_status(s->bus->dma, BM_STATUS_DMAING);
- }
+ ide_set_inactive(s, stay_active);
}
static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
@@ -2193,7 +2190,6 @@ static const IDEDMAOps ide_dma_nop_ops = {
.prepare_buf = ide_nop_int,
.rw_buf = ide_nop_int,
.set_unit = ide_nop_int,
- .add_status = ide_nop_int,
.restart_cb = ide_nop_restart,
};
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 08230be..cd5e77c 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -322,6 +322,7 @@ typedef void EndTransferFunc(IDEState *);
typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockDriverCompletionFunc *);
typedef void DMAVoidFunc(IDEDMA *);
typedef int DMAIntFunc(IDEDMA *, int);
+typedef void DMAStopFunc(IDEDMA *, bool);
typedef void DMARestartFunc(void *, int, RunState);
struct unreported_events {
@@ -431,9 +432,8 @@ struct IDEDMAOps {
DMAIntFunc *prepare_buf;
DMAIntFunc *rw_buf;
DMAIntFunc *set_unit;
- DMAIntFunc *add_status;
DMAVoidFunc *trigger_irq;
- DMAVoidFunc *set_inactive;
+ DMAStopFunc *set_inactive;
DMAVoidFunc *async_cmd_done;
DMARestartFunc *restart_cb;
DMAVoidFunc *reset;
@@ -568,7 +568,7 @@ void ide_flush_cache(IDEState *s);
void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
EndTransferFunc *end_transfer_func);
void ide_transfer_stop(IDEState *s);
-void ide_set_inactive(IDEState *s);
+void ide_set_inactive(IDEState *s, bool more);
BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque);
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 56e2b0c..3635ddf 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -519,7 +519,6 @@ static const IDEDMAOps dbdma_ops = {
.prepare_buf = ide_nop_int,
.rw_buf = ide_nop_int,
.set_unit = ide_nop_int,
- .add_status = ide_nop_int,
.restart_cb = ide_nop_restart,
};
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 68d560d..e4fcf5a 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -158,21 +158,17 @@ static void bmdma_trigger_irq(IDEDMA *dma)
bm->status |= BM_STATUS_INT;
}
-static int bmdma_add_status(IDEDMA *dma, int status)
+static void bmdma_set_inactive(IDEDMA *dma, bool more)
{
BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
- bm->status |= status;
- return 0;
-}
-
-static void bmdma_set_inactive(IDEDMA *dma)
-{
- BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
-
- bm->status &= ~BM_STATUS_DMAING;
bm->dma_cb = NULL;
bm->unit = -1;
+ if (more) {
+ bm->status |= BM_STATUS_DMAING;
+ } else {
+ bm->status &= ~BM_STATUS_DMAING;
+ }
}
static void bmdma_restart_dma(BMDMAState *bm, enum ide_dma_cmd dma_cmd)
@@ -247,7 +243,7 @@ static void bmdma_cancel(BMDMAState *bm)
{
if (bm->status & BM_STATUS_DMAING) {
/* cancel DMA request */
- bmdma_set_inactive(&bm->dma);
+ bmdma_set_inactive(&bm->dma, false);
}
}
@@ -509,7 +505,6 @@ static const struct IDEDMAOps bmdma_ops = {
.rw_buf = bmdma_rw_buf,
.set_unit = bmdma_set_unit,
.trigger_irq = bmdma_trigger_irq,
- .add_status = bmdma_add_status,
.set_inactive = bmdma_set_inactive,
.restart_cb = bmdma_restart_cb,
.reset = bmdma_reset,
--
1.8.3.1
- [Qemu-devel] [PATCH 07/24] ide: simplify async_cmd_done callbacks, (continued)
[Qemu-devel] [PATCH 11/24] ide: fold add_status callback into set_inactive,
Paolo Bonzini <=
[Qemu-devel] [PATCH 12/24] ide: move BM_STATUS bits to pci.[ch], Paolo Bonzini, 2013/10/28
[Qemu-devel] [PATCH 13/24] ide: move retry constants out of BM_STATUS_* namespace, Paolo Bonzini, 2013/10/28
[Qemu-devel] [PATCH 14/24] ide: start extracting ide_restart_dma out of bmdma_restart_dma, Paolo Bonzini, 2013/10/28
[Qemu-devel] [PATCH 15/24] ide: prepare to move restart to common code, Paolo Bonzini, 2013/10/28
[Qemu-devel] [PATCH 16/24] ide: introduce ide_register_restart_cb, Paolo Bonzini, 2013/10/28
[Qemu-devel] [PATCH 17/24] ide: do not use BMDMA in restart callback, Paolo Bonzini, 2013/10/28