diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-09-12 11:14:05 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-09-12 11:14:05 +0000 |
commit | 19df77e4137aaf9261cf8b8f72e6bb66ea8fda77 (patch) | |
tree | 30c9d7d025c987d1a7485cbc3f7d7c5178712115 /sys/dev | |
parent | 8efa688f67e8149536c1a09aa34320c3bf9cf5cb (diff) |
SCSI_DATA_UIO is never used. Code which checks for it is either dead or
commented out, remove it. Unifdef TFS while there.
ok marco@ krw@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/eisa/aha1742.c | 117 | ||||
-rw-r--r-- | sys/dev/ic/adv.c | 17 | ||||
-rw-r--r-- | sys/dev/ic/adw.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/bha.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/dpt.c | 31 | ||||
-rw-r--r-- | sys/dev/ic/iha.c | 18 | ||||
-rw-r--r-- | sys/dev/ic/ncr5380sbc.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/osiop.c | 6 | ||||
-rw-r--r-- | sys/dev/ic/uha.c | 114 | ||||
-rw-r--r-- | sys/dev/isa/aha.c | 55 | ||||
-rw-r--r-- | sys/dev/isa/wds.c | 148 |
11 files changed, 197 insertions, 354 deletions
diff --git a/sys/dev/eisa/aha1742.c b/sys/dev/eisa/aha1742.c index b0b1a690b6d..c9775e042a7 100644 --- a/sys/dev/eisa/aha1742.c +++ b/sys/dev/eisa/aha1742.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aha1742.c,v 1.26 2007/11/05 17:12:41 krw Exp $ */ +/* $OpenBSD: aha1742.c,v 1.27 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: aha1742.c,v 1.61 1996/05/12 23:40:01 mycroft Exp $ */ /* @@ -953,9 +953,6 @@ ahb_scsi_cmd(xs) int seg; /* scatter gather seg being worked on */ u_long thiskv, thisphys, nextphys; int bytes_this_seg, bytes_this_page, datalen, flags; -#ifdef TFS - struct iovec *iovp; -#endif int s; SC_DEBUG(sc_link, SDEV_DB2, ("ahb_scsi_cmd\n")); @@ -1026,76 +1023,56 @@ ahb_scsi_cmd(xs) ecb->data_addr = KVTOPHYS(ecb->ahb_dma); sg = ecb->ahb_dma; seg = 0; -#ifdef TFS - if (flags & SCSI_DATA_UIO) { - iovp = ((struct uio *) xs->data)->uio_iov; - datalen = ((struct uio *) xs->data)->uio_iovcnt; - xs->datalen = 0; - while (datalen && seg < AHB_NSEG) { - sg->seg_addr = (physaddr)iovp->iov_base; - sg->seg_len = iovp->iov_len; - xs->datalen += iovp->iov_len; - SC_DEBUGN(sc_link, SDEV_DB4, ("(0x%x@0x%x)", - iovp->iov_len, iovp->iov_base)); - sg++; - iovp++; - seg++; - datalen--; - } - } - else -#endif /*TFS */ - { - /* - * Set up the scatter gather block - */ - SC_DEBUG(sc_link, SDEV_DB4, - ("%d @0x%x:- ", xs->datalen, xs->data)); - datalen = xs->datalen; - thiskv = (long) xs->data; - thisphys = KVTOPHYS(thiskv); - - while (datalen && seg < AHB_NSEG) { - bytes_this_seg = 0; - - /* put in the base address */ - sg->seg_addr = thisphys; - - SC_DEBUGN(sc_link, SDEV_DB4, ("0x%x", thisphys)); - - /* do it at least once */ - nextphys = thisphys; - while (datalen && thisphys == nextphys) { - /* - * This page is contiguous (physically) - * with the last, just extend the - * length - */ - /* how far to the end of the page */ - nextphys = (thisphys & ~PGOFSET) + NBPG; - bytes_this_page = nextphys - thisphys; - /**** or the data ****/ - bytes_this_page = min(bytes_this_page, - datalen); - bytes_this_seg += bytes_this_page; - datalen -= bytes_this_page; - - /* get more ready for the next page */ - thiskv = (thiskv & ~PGOFSET) + NBPG; - if (datalen) - thisphys = KVTOPHYS(thiskv); - } + + /* + * Set up the scatter gather block + */ + SC_DEBUG(sc_link, SDEV_DB4, + ("%d @0x%x:- ", xs->datalen, xs->data)); + datalen = xs->datalen; + thiskv = (long) xs->data; + thisphys = KVTOPHYS(thiskv); + + while (datalen && seg < AHB_NSEG) { + bytes_this_seg = 0; + + /* put in the base address */ + sg->seg_addr = thisphys; + + SC_DEBUGN(sc_link, SDEV_DB4, ("0x%x", thisphys)); + + /* do it at least once */ + nextphys = thisphys; + while (datalen && thisphys == nextphys) { /* - * next page isn't contiguous, finish the seg + * This page is contiguous (physically) + * with the last, just extend the + * length */ - SC_DEBUGN(sc_link, SDEV_DB4, - ("(0x%x)", bytes_this_seg)); - sg->seg_len = bytes_this_seg; - sg++; - seg++; + /* how far to the end of the page */ + nextphys = (thisphys & ~PGOFSET) + NBPG; + bytes_this_page = nextphys - thisphys; + /**** or the data ****/ + bytes_this_page = min(bytes_this_page, + datalen); + bytes_this_seg += bytes_this_page; + datalen -= bytes_this_page; + + /* get more ready for the next page */ + thiskv = (thiskv & ~PGOFSET) + NBPG; + if (datalen) + thisphys = KVTOPHYS(thiskv); } + /* + * next page isn't contiguous, finish the seg + */ + SC_DEBUGN(sc_link, SDEV_DB4, + ("(0x%x)", bytes_this_seg)); + sg->seg_len = bytes_this_seg; + sg++; + seg++; } - /*end of iov/kv decision */ + ecb->data_length = seg * sizeof(struct ahb_dma_seg); SC_DEBUGN(sc_link, SDEV_DB4, ("\n")); if (datalen) { diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index ee5e537abe3..e7468436966 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.c,v 1.19 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: adv.c,v 1.20 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* @@ -743,18 +743,9 @@ adv_scsi_cmd(xs) /* * Map the DMA transfer. */ -#ifdef TFS - if (flags & SCSI_DATA_UIO) { - error = bus_dmamap_load_uio(dmat, - ccb->dmamap_xfer, (struct uio *) xs->data, - (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK); - } else -#endif /* TFS */ - { - error = bus_dmamap_load(dmat, - ccb->dmamap_xfer, xs->data, xs->datalen, NULL, - (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK); - } + error = bus_dmamap_load(dmat, + ccb->dmamap_xfer, xs->data, xs->datalen, NULL, + (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK); if (error) { if (error == EFBIG) { diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index 7175d024d54..0a4b998e285 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.33 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: adw.c,v 1.34 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -816,20 +816,10 @@ adw_build_req(xs, ccb, flags) /* * Map the DMA transfer. */ -#ifdef TFS - if (xs->flags & SCSI_DATA_UIO) { - error = bus_dmamap_load_uio(dmat, - ccb->dmamap_xfer, (struct uio *) xs->data, - (flags & SCSI_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); - } else -#endif /* TFS */ - { - error = bus_dmamap_load(dmat, - ccb->dmamap_xfer, xs->data, xs->datalen, NULL, - (flags & SCSI_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); - } + error = bus_dmamap_load(dmat, + ccb->dmamap_xfer, xs->data, xs->datalen, NULL, + (flags & SCSI_NOSLEEP) ? + BUS_DMA_NOWAIT : BUS_DMA_WAITOK); if (error) { if (error == EFBIG) { diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index dda7190a81f..f69e88b38cc 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha.c,v 1.12 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: bha.c,v 1.13 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: bha.c,v 1.27 1998/11/19 21:53:00 thorpej Exp $ */ #undef BHADEBUG @@ -1430,20 +1430,10 @@ bha_scsi_cmd(xs) /* * Map the DMA transfer. */ -#ifdef TFS - if (flags & SCSI_DATA_UIO) { - error = bus_dmamap_load_uio(dmat, - ccb->dmamap_xfer, (struct uio *)xs->data, - (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : - BUS_DMA_WAITOK); - } else -#endif /* TFS */ - { - error = bus_dmamap_load(dmat, - ccb->dmamap_xfer, xs->data, xs->datalen, NULL, - (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : - BUS_DMA_WAITOK); - } + error = bus_dmamap_load(dmat, + ccb->dmamap_xfer, xs->data, xs->datalen, NULL, + (flags & SCSI_NOSLEEP) ? BUS_DMA_NOWAIT : + BUS_DMA_WAITOK); if (error) { if (error == EFBIG) { diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index c863ca47c57..9ec45f0827c 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dpt.c,v 1.16 2008/07/30 18:08:04 miod Exp $ */ +/* $OpenBSD: dpt.c,v 1.17 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: dpt.c,v 1.12 1999/10/23 16:26:33 ad Exp $ */ /*- @@ -1115,33 +1115,16 @@ dpt_scsi_cmd(xs) if (xs->datalen) { xfer = ccb->ccb_dmamap_xfer; -#ifdef TFS #ifdef __NetBSD__ - if ((flags & XS_CTL_DATA_UIO) != 0) { - error = bus_dmamap_load_uio(dmat, xfer, - (struct uio *)xs->data, (flags & XS_CTL_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); + error = bus_dmamap_load(dmat, xfer, xs->data, + xs->datalen, NULL, (flags & XS_CTL_NOSLEEP) ? + BUS_DMA_NOWAIT : BUS_DMA_WAITOK); #endif /* __NetBSD__ */ #ifdef __OpenBSD__ - if ((xs->flags & SCSI_DATA_UIO) != 0) { - error = bus_dmamap_load_uio(dmat, xfer, - (xs->flags & SCSI_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); + error = bus_dmamap_load(dmat, xfer, xs->data, + xs->datalen, NULL, (xs->flags & SCSI_NOSLEEP) ? + BUS_DMA_NOWAIT : BUS_DMA_WAITOK); #endif /* __OpenBSD__ */ - } else -#endif /*TFS */ - { -#ifdef __NetBSD__ - error = bus_dmamap_load(dmat, xfer, xs->data, - xs->datalen, NULL, (flags & XS_CTL_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); -#endif /* __NetBSD__ */ -#ifdef __OpenBSD__ - error = bus_dmamap_load(dmat, xfer, xs->data, - xs->datalen, NULL, (xs->flags & SCSI_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); -#endif /* __OpenBSD__ */ - } if (error) { printf("%s: dpt_scsi_cmd: ", sc->sc_dv.dv_xname); diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index d4873fd6cb1..4584ffddf14 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.c,v 1.29 2007/12/29 03:04:19 dlg Exp $ */ +/* $OpenBSD: iha.c,v 1.30 2008/09/12 11:14:04 miod Exp $ */ /*------------------------------------------------------------------------- * * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. @@ -298,18 +298,10 @@ iha_scsi_cmd(xs) pScb->SCB_BufCharsLeft = pScb->SCB_BufChars = xs->datalen; if ((pScb->SCB_Flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) != 0) { -#ifdef TFS - if (pScb->SCB_Flags & SCSI_DATA_UIO) - error = bus_dmamap_load_uio(sc->sc_dmat, - pScb->SCB_DataDma, (struct uio *)xs->data, - (pScb->SCB_Flags & SCSI_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); - else -#endif /* TFS */ - error = bus_dmamap_load(sc->sc_dmat, pScb->SCB_DataDma, - xs->data, pScb->SCB_BufChars, NULL, - (pScb->SCB_Flags & SCSI_NOSLEEP) ? - BUS_DMA_NOWAIT : BUS_DMA_WAITOK); + error = bus_dmamap_load(sc->sc_dmat, pScb->SCB_DataDma, + xs->data, pScb->SCB_BufChars, NULL, + (pScb->SCB_Flags & SCSI_NOSLEEP) ? + BUS_DMA_NOWAIT : BUS_DMA_WAITOK); if (error) { sc_print_addr(xs->sc_link); diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c index 66ec5b0b6c3..8577d1b42dc 100644 --- a/sys/dev/ic/ncr5380sbc.c +++ b/sys/dev/ic/ncr5380sbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380sbc.c,v 1.19 2006/12/10 16:15:37 miod Exp $ */ +/* $OpenBSD: ncr5380sbc.c,v 1.20 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: ncr5380sbc.c,v 1.13 1996/10/13 01:37:25 christos Exp $ */ /* @@ -607,9 +607,6 @@ ncr5380_scsi_cmd(xs) if (sc->sc_flags & NCR5380_FORCE_POLLING) flags |= SCSI_POLL; - if (flags & SCSI_DATA_UIO) - panic("ncr5380: scsi data uio requested"); - s = splbio(); if (flags & SCSI_POLL) { diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c index a5af4c8e1d0..ce6615d2d27 100644 --- a/sys/dev/ic/osiop.c +++ b/sys/dev/ic/osiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: osiop.c,v 1.33 2008/05/27 21:08:48 kettenis Exp $ */ +/* $OpenBSD: osiop.c,v 1.34 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: osiop.c,v 1.9 2002/04/05 18:27:54 bouyer Exp $ */ /* @@ -378,10 +378,6 @@ osiop_scsicmd(xs) int err, s; /* XXXX ?? */ - if (xs->flags & SCSI_DATA_UIO) - panic("osiop: scsi data uio requested"); - - /* XXXX ?? */ if (sc->sc_nexus && (xs->flags & SCSI_POLL)) #if 0 panic("osiop_scsicmd: busy"); diff --git a/sys/dev/ic/uha.c b/sys/dev/ic/uha.c index 600203ee182..84cbda43bc1 100644 --- a/sys/dev/ic/uha.c +++ b/sys/dev/ic/uha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uha.c,v 1.9 2006/11/28 23:59:45 dlg Exp $ */ +/* $OpenBSD: uha.c,v 1.10 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: uha.c,v 1.3 1996/10/13 01:37:29 christos Exp $ */ #undef UHADEBUG @@ -405,76 +405,56 @@ uha_scsi_cmd(xs) if (xs->datalen) { sg = mscp->uha_dma; seg = 0; -#ifdef TFS - if (flags & SCSI_DATA_UIO) { - struct iovec *iovp; - iovp = ((struct uio *) xs->data)->uio_iov; - datalen = ((struct uio *) xs->data)->uio_iovcnt; - xs->datalen = 0; - while (datalen && seg < UHA_NSEG) { - sg->seg_addr = (physaddr)iovp->iov_base; - sg->seg_len = iovp->iov_len; - xs->datalen += iovp->iov_len; - SC_DEBUGN(sc_link, SDEV_DB4, ("(0x%x@0x%x)", - iovp->iov_len, iovp->iov_base)); - sg++; - iovp++; - seg++; - datalen--; - } - } else -#endif /*TFS */ - { - /* - * Set up the scatter gather block - */ - SC_DEBUG(sc_link, SDEV_DB4, - ("%d @0x%x:- ", xs->datalen, xs->data)); - datalen = xs->datalen; - thiskv = (int) xs->data; - thisphys = KVTOPHYS(thiskv); - - while (datalen && seg < UHA_NSEG) { - bytes_this_seg = 0; - - /* put in the base address */ - sg->seg_addr = thisphys; - - SC_DEBUGN(sc_link, SDEV_DB4, ("0x%x", thisphys)); - - /* do it at least once */ - nextphys = thisphys; - while (datalen && thisphys == nextphys) { - /* - * This page is contiguous (physically) - * with the last, just extend the - * length - */ - /* how far to the end of the page */ - nextphys = (thisphys & ~PGOFSET) + NBPG; - bytes_this_page = nextphys - thisphys; - /**** or the data ****/ - bytes_this_page = min(bytes_this_page, - datalen); - bytes_this_seg += bytes_this_page; - datalen -= bytes_this_page; - - /* get more ready for the next page */ - thiskv = (thiskv & ~PGOFSET) + NBPG; - if (datalen) - thisphys = KVTOPHYS(thiskv); - } + + /* + * Set up the scatter gather block + */ + SC_DEBUG(sc_link, SDEV_DB4, + ("%d @0x%x:- ", xs->datalen, xs->data)); + datalen = xs->datalen; + thiskv = (int) xs->data; + thisphys = KVTOPHYS(thiskv); + + while (datalen && seg < UHA_NSEG) { + bytes_this_seg = 0; + + /* put in the base address */ + sg->seg_addr = thisphys; + + SC_DEBUGN(sc_link, SDEV_DB4, ("0x%x", thisphys)); + + /* do it at least once */ + nextphys = thisphys; + while (datalen && thisphys == nextphys) { /* - * next page isn't contiguous, finish the seg + * This page is contiguous (physically) + * with the last, just extend the + * length */ - SC_DEBUGN(sc_link, SDEV_DB4, - ("(0x%x)", bytes_this_seg)); - sg->seg_len = bytes_this_seg; - sg++; - seg++; + /* how far to the end of the page */ + nextphys = (thisphys & ~PGOFSET) + NBPG; + bytes_this_page = nextphys - thisphys; + /**** or the data ****/ + bytes_this_page = min(bytes_this_page, + datalen); + bytes_this_seg += bytes_this_page; + datalen -= bytes_this_page; + + /* get more ready for the next page */ + thiskv = (thiskv & ~PGOFSET) + NBPG; + if (datalen) + thisphys = KVTOPHYS(thiskv); } + /* + * next page isn't contiguous, finish the seg + */ + SC_DEBUGN(sc_link, SDEV_DB4, + ("(0x%x)", bytes_this_seg)); + sg->seg_len = bytes_this_seg; + sg++; + seg++; } - /* end of iov/kv decision */ + SC_DEBUGN(sc_link, SDEV_DB4, ("\n")); if (datalen) { /* diff --git a/sys/dev/isa/aha.c b/sys/dev/isa/aha.c index 06ae3f935bf..d4b8cb799cb 100644 --- a/sys/dev/isa/aha.c +++ b/sys/dev/isa/aha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aha.c,v 1.58 2007/10/09 17:06:18 gilles Exp $ */ +/* $OpenBSD: aha.c,v 1.59 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */ #undef AHADIAG @@ -1261,10 +1261,6 @@ aha_scsi_cmd(xs) struct aha_ccb *ccb; struct aha_scat_gath *sg; int seg, flags; -#ifdef TFS - struct iovec *iovp; - int datalen; -#endif int s; SC_DEBUG(sc_link, SDEV_DB2, ("aha_scsi_cmd\n")); @@ -1297,40 +1293,21 @@ aha_scsi_cmd(xs) if (xs->datalen) { sg = ccb->scat_gath; seg = 0; -#ifdef TFS - if (flags & SCSI_DATA_UIO) { - iovp = ((struct uio *)xs->data)->uio_iov; - datalen = ((struct uio *)xs->data)->uio_iovcnt; - xs->datalen = 0; - while (datalen && seg < AHA_NSEG) { - ltophys(iovp->iov_base, sg->seg_addr); - ltophys(iovp->iov_len, sg->seg_len); - xs->datalen += iovp->iov_len; - SC_DEBUGN(sc_link, SDEV_DB4, ("UIO(0x%x@0x%x)", - iovp->iov_len, iovp->iov_base)); - sg++; - iovp++; - seg++; - datalen--; - } - } else -#endif /* TFS */ - { - /* - * Set up the scatter-gather block. - */ - if (bus_dmamap_load(sc->sc_dmat, ccb->dmam, xs->data, - xs->datalen, NULL, BUS_DMA_NOWAIT) != 0) { - aha_free_ccb(sc, ccb); - xs->error = XS_DRIVER_STUFFUP; - return (TRY_AGAIN_LATER); - } - for (seg = 0; seg < ccb->dmam->dm_nsegs; seg++) { - ltophys(ccb->dmam->dm_segs[seg].ds_addr, - sg[seg].seg_addr); - ltophys(ccb->dmam->dm_segs[seg].ds_len, - sg[seg].seg_len); - } + + /* + * Set up the scatter-gather block. + */ + if (bus_dmamap_load(sc->sc_dmat, ccb->dmam, xs->data, + xs->datalen, NULL, BUS_DMA_NOWAIT) != 0) { + aha_free_ccb(sc, ccb); + xs->error = XS_DRIVER_STUFFUP; + return (TRY_AGAIN_LATER); + } + for (seg = 0; seg < ccb->dmam->dm_nsegs; seg++) { + ltophys(ccb->dmam->dm_segs[seg].ds_addr, + sg[seg].seg_addr); + ltophys(ccb->dmam->dm_segs[seg].ds_len, + sg[seg].seg_len); } if (flags & SCSI_DATA_OUT) bus_dmamap_sync(sc->sc_dmat, ccb->dmam, 0, diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c index 1ec6603b487..09c695991f2 100644 --- a/sys/dev/isa/wds.c +++ b/sys/dev/isa/wds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wds.c,v 1.24 2007/11/05 17:12:41 krw Exp $ */ +/* $OpenBSD: wds.c,v 1.25 2008/09/12 11:14:04 miod Exp $ */ /* $NetBSD: wds.c,v 1.13 1996/11/03 16:20:31 mycroft Exp $ */ #undef WDSDIAG @@ -1056,9 +1056,6 @@ wds_scsi_cmd(xs) int seg; u_long thiskv, thisphys, nextphys; int bytes_this_seg, bytes_this_page, datalen, flags; -#ifdef TFS - struct iovec *iovp; -#endif int s; #ifdef notyet int mflags; @@ -1084,14 +1081,6 @@ wds_scsi_cmd(xs) scb->xs = xs; scb->timeout = xs->timeout; - if (xs->flags & SCSI_DATA_UIO) { - /* XXX Fix me! */ - /* Let's not worry about UIO. There isn't any code for the * - * non-SG boards anyway! */ - printf("%s: UIO is untested and disabled!\n", sc->sc_dev.dv_xname); - goto bad; - } - /* Zero out the command structure. */ bzero(&scb->cmd, sizeof scb->cmd); bcopy(xs->cmd, &scb->cmd.scb, xs->cmdlen < 12 ? xs->cmdlen : 12); @@ -1107,94 +1096,75 @@ wds_scsi_cmd(xs) if (!NEEDBUFFER(sc) && xs->datalen) { sg = scb->scat_gath; seg = 0; -#ifdef TFS - if (flags & SCSI_DATA_UIO) { - iovp = ((struct uio *)xs->data)->uio_iov; - datalen = ((struct uio *)xs->data)->uio_iovcnt; - xs->datalen = 0; - while (datalen && seg < WDS_NSEG) { - ltophys(iovp->iov_base, sg->seg_addr); - ltophys(iovp->iov_len, sg->seg_len); - xs->datalen += iovp->iov_len; - SC_DEBUGN(sc_link, SDEV_DB4, ("UIO(0x%x@0x%x)", - iovp->iov_len, iovp->iov_base)); - sg++; - iovp++; - seg++; - datalen--; - } - } else -#endif /* TFS */ - { - /* - * Set up the scatter-gather block. - */ - SC_DEBUG(sc_link, SDEV_DB4, - ("%d @0x%x:- ", xs->datalen, xs->data)); + + /* + * Set up the scatter-gather block. + */ + SC_DEBUG(sc_link, SDEV_DB4, + ("%d @0x%x:- ", xs->datalen, xs->data)); #ifdef notyet - scb->data_nseg = isadma_map(xs->data, xs->datalen, - scb->data_phys, mflags); - for (seg = 0; seg < scb->data_nseg; seg++) { - ltophys(scb->data_phys[seg].addr, - sg[seg].seg_addr); - ltophys(scb->data_phys[seg].length, - sg[seg].seg_len); - } + scb->data_nseg = isadma_map(xs->data, xs->datalen, + scb->data_phys, mflags); + for (seg = 0; seg < scb->data_nseg; seg++) { + ltophys(scb->data_phys[seg].addr, + sg[seg].seg_addr); + ltophys(scb->data_phys[seg].length, + sg[seg].seg_len); + } #else - datalen = xs->datalen; - thiskv = (int)xs->data; - thisphys = KVTOPHYS(xs->data); + datalen = xs->datalen; + thiskv = (int)xs->data; + thisphys = KVTOPHYS(xs->data); - while (datalen && seg < WDS_NSEG) { - bytes_this_seg = 0; + while (datalen && seg < WDS_NSEG) { + bytes_this_seg = 0; - /* put in the base address */ - ltophys(thisphys, sg->seg_addr); + /* put in the base address */ + ltophys(thisphys, sg->seg_addr); - SC_DEBUGN(sc_link, SDEV_DB4, ("0x%x", thisphys)); + SC_DEBUGN(sc_link, SDEV_DB4, ("0x%x", thisphys)); - /* do it at least once */ - nextphys = thisphys; - while (datalen && thisphys == nextphys) { - /* - * This page is contiguous (physically) - * with the last, just extend the - * length - */ - /* check it fits on the ISA bus */ - if (thisphys > 0xFFFFFF) { - printf("%s: DMA beyond" - " end of ISA\n", - sc->sc_dev.dv_xname); - goto bad; - } - /* how far to the end of the page */ - nextphys = (thisphys & ~PGOFSET) + NBPG; - bytes_this_page = nextphys - thisphys; - /**** or the data ****/ - bytes_this_page = min(bytes_this_page, - datalen); - bytes_this_seg += bytes_this_page; - datalen -= bytes_this_page; - - /* get more ready for the next page */ - thiskv = (thiskv & ~PGOFSET) + NBPG; - if (datalen) - thisphys = KVTOPHYS(thiskv); - } + /* do it at least once */ + nextphys = thisphys; + while (datalen && thisphys == nextphys) { /* - * next page isn't contiguous, finish the seg + * This page is contiguous (physically) + * with the last, just extend the + * length */ - SC_DEBUGN(sc_link, SDEV_DB4, - ("(0x%x)", bytes_this_seg)); - ltophys(bytes_this_seg, sg->seg_len); - sg++; - seg++; -#endif + /* check it fits on the ISA bus */ + if (thisphys > 0xFFFFFF) { + printf("%s: DMA beyond" + " end of ISA\n", + sc->sc_dev.dv_xname); + goto bad; + } + /* how far to the end of the page */ + nextphys = (thisphys & ~PGOFSET) + NBPG; + bytes_this_page = nextphys - thisphys; + /**** or the data ****/ + bytes_this_page = min(bytes_this_page, + datalen); + bytes_this_seg += bytes_this_page; + datalen -= bytes_this_page; + + /* get more ready for the next page */ + thiskv = (thiskv & ~PGOFSET) + NBPG; + if (datalen) + thisphys = KVTOPHYS(thiskv); } + /* + * next page isn't contiguous, finish the seg + */ + SC_DEBUGN(sc_link, SDEV_DB4, + ("(0x%x)", bytes_this_seg)); + ltophys(bytes_this_seg, sg->seg_len); + sg++; + seg++; +#endif } - /* end of iov/kv decision */ + SC_DEBUGN(sc_link, SDEV_DB4, ("\n")); if (datalen) { /* |