[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/24] ide: add trigger_irq callback
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 10/24] ide: add trigger_irq callback |
Date: |
Mon, 28 Oct 2013 17:43:26 +0100 |
AHCIDevice does not have a dma_status field. The add_status callback thus
does not make sense, start moving its functionality to new callbacks.
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/ide/ahci.c | 12 ++++++++----
hw/ide/atapi.c | 4 +++-
hw/ide/internal.h | 1 +
hw/ide/pci.c | 7 +++++++
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 23f3f22..7b47053 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1097,13 +1097,16 @@ 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);
- if (status & BM_STATUS_INT) {
- ahci_trigger_irq(ad->hba, ad, PORT_IRQ_STAT_DSS);
- }
-
return 0;
}
+static void ahci_dma_trigger_irq(IDEDMA *dma)
+{
+ AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
+ DPRINTF(ad->port_no, "trigger irq\n");
+ ahci_trigger_irq(ad->hba, ad, PORT_IRQ_STAT_DSS);
+}
+
static void ahci_async_cmd_done(IDEDMA *dma)
{
AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
@@ -1134,6 +1137,7 @@ static const IDEDMAOps ahci_dma_ops = {
.prepare_buf = ahci_dma_prepare_buf,
.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 a7688bf..814cffb 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -355,7 +355,9 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)
eot:
bdrv_acct_done(s->bs, &s->acct);
- s->bus->dma->ops->add_status(s->bus->dma, BM_STATUS_INT);
+ if (s->bus->dma->ops->trigger_irq) {
+ s->bus->dma->ops->trigger_irq(s->bus->dma);
+ }
ide_set_inactive(s);
}
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 92f25ef..08230be 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -432,6 +432,7 @@ struct IDEDMAOps {
DMAIntFunc *rw_buf;
DMAIntFunc *set_unit;
DMAIntFunc *add_status;
+ DMAVoidFunc *trigger_irq;
DMAVoidFunc *set_inactive;
DMAVoidFunc *async_cmd_done;
DMARestartFunc *restart_cb;
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 78c47a3..68d560d 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -152,6 +152,12 @@ static int bmdma_set_unit(IDEDMA *dma, int unit)
return 0;
}
+static void bmdma_trigger_irq(IDEDMA *dma)
+{
+ BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
+ bm->status |= BM_STATUS_INT;
+}
+
static int bmdma_add_status(IDEDMA *dma, int status)
{
BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
@@ -502,6 +508,7 @@ static const struct IDEDMAOps bmdma_ops = {
.prepare_buf = bmdma_prepare_buf,
.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,
--
1.8.3.1
- Re: [Qemu-devel] [PATCH 03/24] libqtest: add QTEST_LOG for debugging qtest testcases, (continued)
- [Qemu-devel] [PATCH 04/24] ide-test: add test for werror=stop, Paolo Bonzini, 2013/10/28
- [Qemu-devel] [PATCH 05/24] ide: simplify reset callbacks, Paolo Bonzini, 2013/10/28
- [Qemu-devel] [PATCH 06/24] ide: simplify set_inactive callbacks, Paolo Bonzini, 2013/10/28
- [Qemu-devel] [PATCH 07/24] ide: simplify async_cmd_done callbacks, Paolo Bonzini, 2013/10/28
- [Qemu-devel] [PATCH 08/24] ide: simplify start_transfer callbacks, Paolo Bonzini, 2013/10/28
- [Qemu-devel] [PATCH 09/24] ide: wrap start_dma callback, Paolo Bonzini, 2013/10/28
- [Qemu-devel] [PATCH 10/24] ide: add trigger_irq callback,
Paolo Bonzini <=
[Qemu-devel] [PATCH 11/24] ide: fold add_status callback into set_inactive, Paolo Bonzini, 2013/10/28
[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