summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2011-03-06 13:06:41 +0000
committermarius <marius@FreeBSD.org>2011-03-06 13:06:41 +0000
commite2cad91205b15e5149225a2c4b18f15f70017513 (patch)
tree5832e919e00a0a67a1370986c12fc29592c12d33
parentc4b1dac511ff046dc7fe03184246f8e364ecdf89 (diff)
downloadFreeBSD-src-e2cad91205b15e5149225a2c4b18f15f70017513.zip
FreeBSD-src-e2cad91205b15e5149225a2c4b18f15f70017513.tar.gz
Add missing bus_dmamap_sync() calls for the work DMA map.
MFC after: 2 weeks
-rw-r--r--sys/dev/ata/chipsets/ata-ahci.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/ata/chipsets/ata-ahci.c b/sys/dev/ata/chipsets/ata-ahci.c
index 2b6f860..4ba1f48 100644
--- a/sys/dev/ata/chipsets/ata-ahci.c
+++ b/sys/dev/ata/chipsets/ata-ahci.c
@@ -320,7 +320,11 @@ ata_ahci_ch_attach(device_t dev)
static int
ata_ahci_ch_detach(device_t dev)
{
-
+ struct ata_channel *ch = device_get_softc(dev);
+
+ if (ch->dma.work_tag && ch->dma.work_map)
+ bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
ata_ahci_ch_suspend(dev);
ata_dmafini(dev);
return (0);
@@ -495,6 +499,9 @@ ata_ahci_begin_transaction(struct ata_request *request)
ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset) &
~ATA_AHCI_P_CMD_ATAPI);
+ bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
/* issue command to controller */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, 1);
@@ -537,6 +544,9 @@ ata_ahci_end_transaction(struct ata_request *request)
/* kill the timeout */
callout_stop(&request->callout);
+ bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
/* get status */
tf_data = ATA_INL(ctlr->r_res2, ATA_AHCI_P_TFD + offset);
request->status = tf_data;
@@ -590,6 +600,9 @@ ata_ahci_issue_cmd(device_t dev, u_int16_t flags, int timeout)
clp->bytecount = 0;
clp->cmd_table_phys = htole64(ch->dma.work_bus + ATA_AHCI_CT_OFFSET);
+ bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
/* issue command to controller */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, 1);
@@ -600,6 +613,9 @@ ata_ahci_issue_cmd(device_t dev, u_int16_t flags, int timeout)
break;
}
+ bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
/* clear interrupts */
ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_IS + offset,
ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset));
OpenPOWER on IntegriCloud