svn commit: r219337 - head/sys/dev/ata/chipsets

Marius Strobl marius at FreeBSD.org
Sun Mar 6 13:06:41 UTC 2011


Author: marius
Date: Sun Mar  6 13:06:41 2011
New Revision: 219337
URL: http://svn.freebsd.org/changeset/base/219337

Log:
  Add missing bus_dmamap_sync() calls for the work DMA map.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/ata/chipsets/ata-ahci.c

Modified: head/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-ahci.c	Sun Mar  6 12:54:00 2011	(r219336)
+++ head/sys/dev/ata/chipsets/ata-ahci.c	Sun Mar  6 13:06:41 2011	(r219337)
@@ -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_re
 		 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_requ
     /* 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
     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
             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));


More information about the svn-src-head mailing list