summaryrefslogtreecommitdiff
path: root/sys/dev/ic/ahci.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-10-02 18:51:45 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-10-02 18:51:45 +0000
commit1fd447882b95ebf3b29bca73039223b116c4db2d (patch)
tree125c25ae356e09207256fa5dae58c33d7de68d0f /sys/dev/ic/ahci.c
parente2e68a301f2e4c3117bde6fefec46090196ef00c (diff)
Contrary to e. g. the xHCI specification, the AHCI rev. 1.3 spec
does not say anything about which type (snoopable/uncached etc.) of bus transactions are issued by HBAs on accesses to the descriptors. Thus, the right assumption would be "classical" concurrent accesses by both CPU/driver as well as hardware to the descriptors and their DMA memory backings respectively, which is also confirmed by actual testing. Consequently, switch to BUS_DMA_COHERENT mappings for said DMA memory as otherwise corruption of descriptors is seen. From Marius Strobl tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7) ok jmatthew@
Diffstat (limited to 'sys/dev/ic/ahci.c')
-rw-r--r--sys/dev/ic/ahci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c
index 0188ab32010..1026e1e9046 100644
--- a/sys/dev/ic/ahci.c
+++ b/sys/dev/ic/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.24 2016/03/10 13:56:14 krw Exp $ */
+/* $OpenBSD: ahci.c,v 1.25 2016/10/02 18:51:44 patrick Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -2610,7 +2610,7 @@ ahci_dmamem_alloc(struct ahci_softc *sc, size_t size)
goto destroy;
if (bus_dmamem_map(sc->sc_dmat, &adm->adm_seg, nsegs, size,
- &adm->adm_kva, BUS_DMA_NOWAIT) != 0)
+ &adm->adm_kva, BUS_DMA_NOWAIT | BUS_DMA_COHERENT) != 0)
goto free;
if (bus_dmamap_load(sc->sc_dmat, adm->adm_map, adm->adm_kva, size,