summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/mfi.c17
-rw-r--r--sys/dev/ic/mfivar.h3
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index f0ab43580ab..4ce063eedc6 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.124 2012/08/13 03:04:51 dlg Exp $ */
+/* $OpenBSD: mfi.c,v 1.125 2012/08/13 05:20:30 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -455,6 +455,10 @@ mfi_initialize_firmware(struct mfi_softc *sc)
init->mif_header.mfh_data_len = htole32(sizeof(*qinfo));
init->mif_qinfo_new_addr = htole64(ccb->ccb_pframe + MFI_FRAME_SIZE);
+ bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_pcq),
+ 0, MFIMEM_LEN(sc->sc_pcq),
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
rv = mfi_poll(ccb);
mfi_put_ccb(sc, ccb);
@@ -828,7 +832,7 @@ int
mfi_intr(void *arg)
{
struct mfi_softc *sc = arg;
- struct mfi_prod_cons *pcq;
+ struct mfi_prod_cons *pcq = MFIMEM_KVA(sc->sc_pcq);
struct mfi_ccb *ccb;
uint32_t producer, consumer, ctx;
int claimed = 0;
@@ -836,7 +840,10 @@ mfi_intr(void *arg)
if (!mfi_my_intr(sc))
return (0);
- pcq = MFIMEM_KVA(sc->sc_pcq);
+ bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_pcq),
+ 0, MFIMEM_LEN(sc->sc_pcq),
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
producer = letoh32(pcq->mpc_producer);
consumer = letoh32(pcq->mpc_consumer);
@@ -867,6 +874,10 @@ mfi_intr(void *arg)
pcq->mpc_consumer = htole32(consumer);
+ bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_pcq),
+ 0, MFIMEM_LEN(sc->sc_pcq),
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
return (claimed);
}
diff --git a/sys/dev/ic/mfivar.h b/sys/dev/ic/mfivar.h
index ac4ceec60c3..84987fcbac1 100644
--- a/sys/dev/ic/mfivar.h
+++ b/sys/dev/ic/mfivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfivar.h,v 1.42 2012/01/12 06:12:30 dlg Exp $ */
+/* $OpenBSD: mfivar.h,v 1.43 2012/08/13 05:20:30 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -43,6 +43,7 @@ struct mfi_mem {
};
#define MFIMEM_MAP(_am) ((_am)->am_map)
+#define MFIMEM_LEN(_am) ((_am)->am_map->dm_mapsize)
#define MFIMEM_DVA(_am) ((_am)->am_map->dm_segs[0].ds_addr)
#define MFIMEM_KVA(_am) ((void *)(_am)->am_kva)