summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2001-08-26 02:39:06 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2001-08-26 02:39:06 +0000
commit1a3ab74be6a248a9ce5e4f1a69e64bdf72ec1028 (patch)
tree2b4768bea9b83ebfe3ed4bd9825d4cf3874ddda8
parent40fa393c45fd6ea6f962a70da026768f6ad9ffa1 (diff)
Prepare for transition to 5-parameter bus_dmamap_sync() by creating and
using *_bus_dmamap_sync() defines that are defined appropriately depending on __HAS_NEW_BUS_DMAMAP_SYNC. Most of the code changes are simple reversions to the original NetBSD code. Slip in a siop_script_sync() instead of a manually done code section.
-rw-r--r--sys/dev/ic/adw.c16
-rw-r--r--sys/dev/ic/adw.h11
-rw-r--r--sys/dev/ic/iha.c12
-rw-r--r--sys/dev/ic/iha.h11
-rw-r--r--sys/dev/ic/siop.c28
-rw-r--r--sys/dev/ic/siopvar_common.h17
6 files changed, 65 insertions, 30 deletions
diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c
index ad2c2abcf3e..cd7b4a81bd9 100644
--- a/sys/dev/ic/adw.c
+++ b/sys/dev/ic/adw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adw.c,v 1.20 2001/07/11 17:31:24 krw Exp $ */
+/* $OpenBSD: adw.c,v 1.21 2001/08/26 02:39:05 krw Exp $ */
/* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */
/*
@@ -854,9 +854,10 @@ adw_build_req(xs, ccb, flags)
adw_free_ccb(sc, ccb);
return (0);
}
- bus_dmamap_sync(dmat, ccb->dmamap_xfer,
- (xs->flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
+ adw_bus_dmamap_sync(dmat, ccb->dmamap_xfer,
+ 0, ccb->dmamap_xfer->dm_mapsize,
+ (xs->flags & SCSI_DATA_IN) ?
+ BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
/*
* Build scatter-gather list.
@@ -1205,9 +1206,10 @@ adw_isr_callback(sc, scsiq)
*/
dmat = sc->sc_dmat;
if (xs->datalen) {
- bus_dmamap_sync(dmat, ccb->dmamap_xfer,
- (xs->flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+ adw_bus_dmamap_sync(dmat, ccb->dmamap_xfer,
+ 0, ccb->dmamap_xfer->dm_mapsize,
+ ((xs->flags & SCSI_DATA_IN) ?
+ BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE));
bus_dmamap_unload(dmat, ccb->dmamap_xfer);
}
diff --git a/sys/dev/ic/adw.h b/sys/dev/ic/adw.h
index 2d965d725e1..00eccde2028 100644
--- a/sys/dev/ic/adw.h
+++ b/sys/dev/ic/adw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adw.h,v 1.6 2001/01/15 16:27:53 krw Exp $ */
+/* $OpenBSD: adw.h,v 1.7 2001/08/26 02:39:05 krw Exp $ */
/* $NetBSD: adw.h,v 1.9 2000/05/26 15:13:43 dante Exp $ */
/*
@@ -116,4 +116,13 @@ ADW_CCB *adw_ccb_phys_kv __P((ADW_SOFTC *, u_int32_t));
/******************************************************************************/
+#ifdef __HAS_NEW_BUS_DMAMAP_SYNC
+#define adw_bus_dmamap_sync(tag, map, off, len, op) \
+ bus_dmamap_sync((tag), (map), (off), (len), (op))
+#else
+#define adw_bus_dmamap_sync(tag, map, off, len, op) \
+ bus_dmamap_sync((tag), (map), (op))
+#endif
+
+
#endif /* _ADVANSYS_ADW_H_ */
diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c
index 15203a41c5c..d86a7d64581 100644
--- a/sys/dev/ic/iha.c
+++ b/sys/dev/ic/iha.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iha.c,v 1.8 2001/07/13 04:27:09 krw Exp $ */
+/* $OpenBSD: iha.c,v 1.9 2001/08/26 02:39:05 krw Exp $ */
/*
* Initio INI-9xxxU/UW SCSI Device Driver
*
@@ -308,7 +308,8 @@ iha_scsi_cmd(xs)
} else
pScb->SCB_BufPAddr = dm->dm_segs[0].ds_addr;
- bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap,
+ iha_bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap,
+ 0, pScb->SCB_Dmamap->dm_mapsize,
(pScb->SCB_Flags & SCSI_DATA_IN) ?
BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
}
@@ -2475,9 +2476,10 @@ iha_done_scb(sc, pScb)
}
if (xs->datalen > 0) {
- bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap
- ,(xs->flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+ iha_bus_dmamap_sync(sc->sc_dmat, pScb->SCB_Dmamap,
+ 0, pScb->SCB_Dmamap->dm_mapsize,
+ ((xs->flags & SCSI_DATA_IN) ?
+ BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE));
bus_dmamap_unload(sc->sc_dmat, pScb->SCB_Dmamap);
}
diff --git a/sys/dev/ic/iha.h b/sys/dev/ic/iha.h
index dcfecb3b2e3..1f1aa3e7592 100644
--- a/sys/dev/ic/iha.h
+++ b/sys/dev/ic/iha.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iha.h,v 1.6 2001/07/13 04:27:09 krw Exp $ */
+/* $OpenBSD: iha.h,v 1.7 2001/08/26 02:39:05 krw Exp $ */
/*
* Initio INI-9xxxU/UW SCSI Device Driver
*
@@ -446,8 +446,13 @@ int iha_intr __P((void *));
void iha_minphys __P((struct buf *));
int iha_init_tulip __P((struct iha_softc *));
-
-
+#ifdef __HAS_NEW_BUS_DMAMAP_SYNC
+#define iha_bus_dmamap_sync(tag, map, off, len, op) \
+ bus_dmamap_sync((tag), (map), (off), (len), (op))
+#else
+#define iha_bus_dmamap_sync(tag, map, off, len, op) \
+ bus_dmamap_sync((tag), (map), (op))
+#endif
diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c
index 1fc52c2e858..da327c0cba5 100644
--- a/sys/dev/ic/siop.c
+++ b/sys/dev/ic/siop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop.c,v 1.12 2001/08/18 02:24:02 krw Exp $ */
+/* $OpenBSD: siop.c,v 1.13 2001/08/26 02:39:05 krw Exp $ */
/* $NetBSD: siop.c,v 1.39 2001/02/11 18:04:49 bouyer Exp $ */
/*
@@ -126,7 +126,8 @@ siop_script_sync(sc, ops)
int ops;
{
if ((sc->features & SF_CHIP_RAM) == 0)
- bus_dmamap_sync(sc->sc_dmat, sc->sc_scriptdma, ops);
+ siop_bus_dmamap_sync(sc->sc_dmat, sc->sc_scriptdma,
+ 0, PAGE_SIZE, ops);
}
static __inline__ u_int32_t siop_script_read __P((struct siop_softc *, u_int));
@@ -332,10 +333,7 @@ siop_reset(sc)
}
/* start script */
- if ((sc->features & SF_CHIP_RAM) == 0) {
- bus_dmamap_sync(sc->sc_dmat, sc->sc_scriptdma,
- BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
- }
+ siop_script_sync(sc, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
bus_space_write_4(sc->sc_rt, sc->sc_rh, SIOP_DSP,
sc->sc_scriptaddr + Ent_reselect);
}
@@ -1049,7 +1047,8 @@ siop_scsicmd_end(siop_cmd)
}
if (siop_cmd->status != CMDST_SENSE_DONE &&
xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ 0, siop_cmd->dmamap_data->dm_mapsize,
(xs->flags & SCSI_DATA_IN) ?
BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_data);
@@ -1085,9 +1084,11 @@ siop_scsicmd_end(siop_cmd)
bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_cmd);
goto out;
}
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ 0, siop_cmd->dmamap_data->dm_mapsize,
BUS_DMASYNC_PREREAD);
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd,
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd,
+ 0, siop_cmd->dmamap_data->dm_mapsize,
BUS_DMASYNC_PREWRITE);
siop_setuptables(siop_cmd);
@@ -1095,7 +1096,8 @@ siop_scsicmd_end(siop_cmd)
TAILQ_INSERT_HEAD(&sc->urgent_list, siop_cmd, next);
return;
} else if (siop_cmd->status == CMDST_SENSE_DONE) {
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ 0, siop_cmd->dmamap_data->dm_mapsize,
BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_data);
}
@@ -1354,11 +1356,13 @@ siop_scsicmd(xs)
splx(s);
return(TRY_AGAIN_LATER);
}
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data,
+ 0, siop_cmd->dmamap_data->dm_mapsize,
(xs->flags & SCSI_DATA_IN) ?
BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
}
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd,
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd,
+ 0, siop_cmd->dmamap_data->dm_mapsize,
BUS_DMASYNC_PREWRITE);
siop_setuptables(siop_cmd);
diff --git a/sys/dev/ic/siopvar_common.h b/sys/dev/ic/siopvar_common.h
index 6b2b8991b5d..da286cd0926 100644
--- a/sys/dev/ic/siopvar_common.h
+++ b/sys/dev/ic/siopvar_common.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: siopvar_common.h,v 1.6 2001/06/25 23:14:40 krw Exp $ */
+/* $OpenBSD: siopvar_common.h,v 1.7 2001/08/26 02:39:05 krw Exp $ */
/* $NetBSD: siopvar_common.h,v 1.10 2001/01/26 21:58:56 bouyer Exp $ */
/*
@@ -182,6 +182,14 @@ struct siop_lunsw {
u_int32_t lunsw_size; /* size of this lun sw */
};
+#ifdef __HAS_NEW_BUS_DMAMAP_SYNC
+#define siop_bus_dmamap_sync(tag, map, off, len, op) \
+ bus_dmamap_sync((tag), (map), (off), (len), (op))
+#else
+#define siop_bus_dmamap_sync(tag, map, off, len, op) \
+ bus_dmamap_sync((tag), (map), (op))
+#endif
+
static __inline__ void siop_table_sync __P((struct siop_cmd *, int));
static __inline__ void
siop_table_sync(siop_cmd, ops)
@@ -189,7 +197,12 @@ siop_table_sync(siop_cmd, ops)
int ops;
{
struct siop_softc *sc = siop_cmd->siop_sc;
- bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, ops);
+ bus_addr_t offset;
+
+ offset = siop_cmd->dsa -
+ siop_cmd->siop_cbdp->xferdma->dm_segs[0].ds_addr;
+ siop_bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, offset,
+ sizeof(struct siop_xfer), ops);
}
void siop_common_reset __P((struct siop_softc *));