Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej_scsipi]: src/sys/dev/ic Eliminate sleeping from adapter routines.



details:   https://anonhg.NetBSD.org/src/rev/2d704549ccb5
branches:  thorpej_scsipi
changeset: 477292:2d704549ccb5
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Oct 20 20:40:51 1999 +0000

description:
Eliminate sleeping from adapter routines.

diffstat:

 sys/dev/ic/adv.c     |  33 ++++++++++++++++-----------------
 sys/dev/ic/adw.c     |  32 ++++++++++++++++----------------
 sys/dev/ic/aha.c     |  35 ++++++++++++++++++-----------------
 sys/dev/ic/aic7xxx.c |  30 ++++++++++++++++--------------
 sys/dev/ic/bha.c     |  33 +++++++++++++++++----------------
 sys/dev/ic/dpt.c     |  35 ++++++++++++++++++-----------------
 sys/dev/ic/uha.c     |  33 +++++++++++++++++----------------
 7 files changed, 118 insertions(+), 113 deletions(-)

diffs (truncated from 387 to 300 lines):

diff -r e90383c286e1 -r 2d704549ccb5 sys/dev/ic/adv.c
--- a/sys/dev/ic/adv.c  Wed Oct 20 20:39:29 1999 +0000
+++ b/sys/dev/ic/adv.c  Wed Oct 20 20:40:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adv.c,v 1.14.2.2 1999/10/19 22:53:43 thorpej Exp $     */
+/*     $NetBSD: adv.c,v 1.14.2.3 1999/10/20 20:40:51 thorpej Exp $     */
 
 /*
  * Generic driver for the Advanced Systems Inc. Narrow SCSI controllers
@@ -596,31 +596,30 @@
                        if (flags & SCSI_DATA_UIO) {
                                error = bus_dmamap_load_uio(dmat,
                                    ccb->dmamap_xfer, (struct uio *) xs->data,
-                                   (flags & XS_CTL_NOSLEEP) ?
-                                    BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+                                   BUS_DMA_NOWAIT);
                        } else
 #endif /* TFS */
                        {
                                error = bus_dmamap_load(dmat, ccb->dmamap_xfer,
                                    xs->data, xs->datalen, NULL,
-                                   (flags & XS_CTL_NOSLEEP) ?
-                                    BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+                                   BUS_DMA_NOWAIT);
                        }
 
-                       if (error) {
-                               if (error == EFBIG) {
-                                       printf("%s: adv_scsipi_request, "
-                                           "more than %d dma segments\n",
-                                           sc->sc_dev.dv_xname,
-                                           ASC_MAX_SG_LIST);
-                               } else {
-                                       printf("%s: adv_scsipi_request, "
-                                           "error %d loading dma map\n",
-                                           sc->sc_dev.dv_xname, error);
-                               }
+                       switch (error) {
+                       case 0:
+                               break;
 
+                       case ENOMEM:
+                       case EAGAIN:
+                               xs->error = XS_RESOURCE_SHORTAGE;
+                               goto out_bad;
+
+                       default:
+                               xs->error = XS_DRIVER_STUFFUP;
+                               printf("%s: error %d loading DMA map\n",
+                                   sc->sc_dev.dv_xname, error);
+ out_bad:
                                adv_free_ccb(sc, ccb);
-                               xs->error = XS_DRIVER_STUFFUP;
                                scsipi_done(xs);
                                return;
                        }
diff -r e90383c286e1 -r 2d704549ccb5 sys/dev/ic/adw.c
--- a/sys/dev/ic/adw.c  Wed Oct 20 20:39:29 1999 +0000
+++ b/sys/dev/ic/adw.c  Wed Oct 20 20:40:51 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adw.c,v 1.12.2.2 1999/10/19 22:53:43 thorpej Exp $  */
+/* $NetBSD: adw.c,v 1.12.2.3 1999/10/20 20:40:51 thorpej Exp $  */
 
 /*
  * Generic driver for the Advanced Systems Inc. SCSI controllers
@@ -582,30 +582,30 @@
                if (xs->xs_control & SCSI_DATA_UIO) {
                        error = bus_dmamap_load_uio(dmat,
                            ccb->dmamap_xfer, (struct uio *) xs->data,
-                           (xs->xs_control & XS_CTL_NOSLEEP) ?
-                            BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+                           BUS_DMA_NOWAIT);
                } else
 #endif /* TFS */
                {
                        error = bus_dmamap_load(dmat,
                            ccb->dmamap_xfer, xs->data, xs->datalen, NULL,
-                           (xs->xs_control & XS_CTL_NOSLEEP) ?
-                            BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+                           BUS_DMA_NOWAIT);
                }
 
-               if (error) {
-                       if (error == EFBIG) {
-                               printf("%s: adw_scsipi_request, more than "
-                                   "%d dma segments\n",
-                                   sc->sc_dev.dv_xname, ADW_MAX_SG_LIST);
-                       } else {
-                               printf("%s: adw_scsipi_request, error %d "
-                                   "loading dma map\n",
-                                   sc->sc_dev.dv_xname, error);
-                       }
+               switch (error) {
+               case 0:
+                       break;
 
+               case ENOMEM:
+               case EAGAIN:
+                       xs->error = XS_RESOURCE_SHORTAGE;
+                       goto out_bad;
+
+               default:
+                       xs->error = XS_DRIVER_STUFFUP;
+                       printf("%s: error %d loading DMA map\n",
+                           sc->sc_dev.dv_xname, error);
+ out_bad:
                        adw_free_ccb(sc, ccb);
-                       xs->error = XS_DRIVER_STUFFUP;
                        scsipi_done(xs);
                        return (0);
                }
diff -r e90383c286e1 -r 2d704549ccb5 sys/dev/ic/aha.c
--- a/sys/dev/ic/aha.c  Wed Oct 20 20:39:29 1999 +0000
+++ b/sys/dev/ic/aha.c  Wed Oct 20 20:40:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aha.c,v 1.24.2.2 1999/10/19 22:53:43 thorpej Exp $     */
+/*     $NetBSD: aha.c,v 1.24.2.3 1999/10/20 20:40:51 thorpej Exp $     */
 
 #include "opt_ddb.h"
 
@@ -1196,29 +1196,30 @@
                        if (flags & XS_CTL_DATA_UIO) {
                                error = bus_dmamap_load_uio(dmat,
                                    ccb->dmamap_xfer, (struct uio *)xs->data,
-                                   (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT :
-                                   BUS_DMA_WAITOK);
+                                   BUS_DMA_NOWAIT);
                        } else
 #endif
                        {
                                error = bus_dmamap_load(dmat,
                                    ccb->dmamap_xfer, xs->data, xs->datalen,
-                                   NULL, (flags & XS_CTL_NOSLEEP) ?
-                                   BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+                                   NULL, BUS_DMA_NOWAIT);
                        }
-               
-                       if (error) {
-                               if (error == EFBIG) {
-                                       printf("%s: aha_scsi_cmd, more than %d"
-                                           " dma segments\n",
-                                           sc->sc_dev.dv_xname, AHA_NSEG);
-                               } else {
-                                       printf("%s: aha_scsi_cmd, error %d "
-                                           "loading dma map\n",
-                                           sc->sc_dev.dv_xname, error);
-                               }
+
+                       switch (error) {
+                       case 0:
+                               break;
+
+                       case ENOMEM:
+                       case EAGAIN:
+                               xs->error = XS_RESOURCE_SHORTAGE;
+                               goto out_bad;
+
+                       default:
+                               xs->error = XS_DRIVER_STUFFUP;
+                               printf("%s: error %d loading DMA map\n",
+                                   sc->sc_dev.dv_xname, error);
+ out_bad:
                                aha_free_ccb(sc, ccb);
-                               xs->error = XS_DRIVER_STUFFUP;
                                scsipi_done(xs);
                                return;
                        }
diff -r e90383c286e1 -r 2d704549ccb5 sys/dev/ic/aic7xxx.c
--- a/sys/dev/ic/aic7xxx.c      Wed Oct 20 20:39:29 1999 +0000
+++ b/sys/dev/ic/aic7xxx.c      Wed Oct 20 20:40:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic7xxx.c,v 1.37.2.2 1999/10/19 23:15:30 thorpej Exp $ */
+/*     $NetBSD: aic7xxx.c,v 1.37.2.3 1999/10/20 20:40:51 thorpej Exp $ */
 
 /*
  * Generic driver for the aic7xxx based adaptec SCSI controllers
@@ -2491,21 +2491,23 @@
 
                        error = bus_dmamap_load(ahc->sc_dt, scb->dmamap_xfer,
                                    xs->data, xs->datalen, NULL,
-                                   (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT :
-                                   BUS_DMA_WAITOK);
-                       if (error) {
-                               if (error == EFBIG) {
-                                       printf("%s: ahc_scsi_cmd: more "
-                                           "than %d DMA segs\n",
-                                           ahc_name(ahc), AHC_NSEG);
-                               } else {
-                                       printf("%s: ahc_scsi_cmd: error %d "
-                                           "loading dma map\n",
-                                           ahc_name(ahc), error);
-                               }
+                                   BUS_DMA_NOWAIT);
+                       switch (error) {
+                       case 0:
+                               break;
+
+                       case ENOMEM:
+                       case EAGAIN:
+                               xs->error = XS_RESOURCE_SHORTAGE;
+                               goto out_bad;
+
+                       default:
+                               xs->error = XS_DRIVER_STUFFUP;
                                SC_DEBUGN(xs->sc_link, SDEV_DB4, ("\n"));
+                               printf("%s: error %d loading DMA map\n",
+                                   ahc_name(ahc), error);
+ out_bad:
                                ahc_free_scb(ahc, scb);
-                               xs->error = XS_DRIVER_STUFFUP;
                                scsipi_done(xs);
                                return;
                        }
diff -r e90383c286e1 -r 2d704549ccb5 sys/dev/ic/bha.c
--- a/sys/dev/ic/bha.c  Wed Oct 20 20:39:29 1999 +0000
+++ b/sys/dev/ic/bha.c  Wed Oct 20 20:40:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bha.c,v 1.33.2.3 1999/10/19 22:48:31 thorpej Exp $     */
+/*     $NetBSD: bha.c,v 1.33.2.4 1999/10/20 20:40:52 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -344,29 +344,30 @@
                        if (flags & XS_CTL_DATA_UIO) {
                                error = bus_dmamap_load_uio(dmat,
                                    ccb->dmamap_xfer, (struct uio *)xs->data,
-                                   (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT :
-                                   BUS_DMA_WAITOK);
+                                   BUS_DMA_NOWAIT);
                        } else
 #endif /* TFS */
                        {
                                error = bus_dmamap_load(dmat,
                                    ccb->dmamap_xfer, xs->data, xs->datalen,
-                                   NULL, (flags & XS_CTL_NOSLEEP) ?
-                                   BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
+                                   NULL, BUS_DMA_NOWAIT);
                        }
 
-                       if (error) {
-                               if (error == EFBIG) {
-                                       printf("%s: bha_scsipi_request, more "
-                                           "than %d dma segments\n",
-                                           sc->sc_dev.dv_xname, BHA_NSEG);
-                               } else {
-                                       printf("%s: bha_scsipi_request, "
-                                           "error %d loading dma map\n",
-                                           sc->sc_dev.dv_xname, error);
-                               }
+                       switch (error) {
+                       case 0:
+                               break;
+
+                       case ENOMEM:
+                       case EAGAIN:
+                               xs->error = XS_RESOURCE_SHORTAGE;
+                               goto out_bad;
+
+                       default:
+                               xs->error = XS_DRIVER_STUFFUP;
+                               printf("%s: error %d loading DMA map\n",
+                                   sc->sc_dev.dv_xname, error);
+ out_bad:
                                bha_free_ccb(sc, ccb);
-                               xs->error = XS_DRIVER_STUFFUP;
                                scsipi_done(xs);
                                return;
                        }
diff -r e90383c286e1 -r 2d704549ccb5 sys/dev/ic/dpt.c
--- a/sys/dev/ic/dpt.c  Wed Oct 20 20:39:29 1999 +0000
+++ b/sys/dev/ic/dpt.c  Wed Oct 20 20:40:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dpt.c,v 1.8.2.5 1999/10/20 11:54:56 ad Exp $   */
+/*     $NetBSD: dpt.c,v 1.8.2.6 1999/10/20 20:40:52 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.8.2.5 1999/10/20 11:54:56 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.8.2.6 1999/10/20 20:40:52 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -897,29 +897,30 @@
                        if (flags & XS_CTL_DATA_UIO) {
                                error = bus_dmamap_load_uio(dmat, xfer,
                                    (struct uio *)xs->data,
-                                   (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT :
-                                   BUS_DMA_WAITOK);
+                                   BUS_DMA_NOWAIT);
                        } else
 #endif /*TFS */
                        {
                                error = bus_dmamap_load(dmat, xfer,
                                    xs->data, xs->datalen, NULL,
-                                   (flags & XS_CTL_NOSLEEP) ? BUS_DMA_NOWAIT :
-                                   BUS_DMA_WAITOK);



Home | Main Index | Thread Index | Old Index