Source-Changes-HG archive

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

[src/trunk]: src/sys Update for sys/buf.h/disksort_*() changes.



details:   https://anonhg.NetBSD.org/src/rev/62bf2c692e5a
branches:  trunk
changeset: 480860:62bf2c692e5a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Jan 21 23:39:55 2000 +0000

description:
Update for sys/buf.h/disksort_*() changes.

diffstat:

 sys/arch/sun3/dev/fd.c             |  43 +++++++++++++++++----------------
 sys/arch/sun3/dev/xd.c             |  37 +++++++---------------------
 sys/arch/sun3/dev/xdvar.h          |   4 +-
 sys/arch/sun3/dev/xy.c             |  17 +++++-------
 sys/arch/sun3/dev/xyvar.h          |   4 +-
 sys/arch/vax/mba/hp.c              |  15 ++++++-----
 sys/arch/vax/mba/mba.c             |  13 +++++----
 sys/arch/vax/mba/mbavar.h          |   4 +-
 sys/arch/vax/vax/ctu.c             |  25 ++++++++++---------
 sys/arch/x68k/dev/fd.c             |  48 +++++++++++++++++++-------------------
 sys/dev/ata/wd.c                   |  21 ++++++++-------
 sys/dev/ic/rrunner.c               |  23 +++++------------
 sys/dev/ic/rrunnervar.h            |   5 +--
 sys/dev/isa/mcd.c                  |  22 +++++++++-------
 sys/dev/md.c                       |  17 ++++++-------
 sys/dev/mscp/mscp_disk.c           |   4 +-
 sys/dev/mscp/mscp_subr.c           |  19 ++++----------
 sys/dev/mscp/mscpvar.h             |   4 +-
 sys/dev/pci/if_esh_pci.c           |   3 +-
 sys/dev/qbus/uda.c                 |  20 ++-------------
 sys/dev/raidframe/rf_netbsdkintf.c |  31 ++++-------------------
 sys/dev/scsipi/cd.c                |  16 ++++++------
 sys/dev/scsipi/cdvar.h             |   4 +-
 sys/dev/scsipi/sd.c                |  16 ++++++------
 sys/dev/scsipi/sdvar.h             |   4 +-
 sys/dev/scsipi/ss.c                |  24 ++++--------------
 sys/dev/scsipi/ssvar.h             |   4 +-
 sys/dev/scsipi/st.c                |  26 +++++---------------
 sys/dev/vnd.c                      |  28 +++++++++++-----------
 sys/dev/vndvar.h                   |   5 ++-
 30 files changed, 210 insertions(+), 296 deletions(-)

diffs (truncated from 1717 to 300 lines):

diff -r 6b1bfbbd6fdc -r 62bf2c692e5a sys/arch/sun3/dev/fd.c
--- a/sys/arch/sun3/dev/fd.c    Fri Jan 21 23:28:59 2000 +0000
+++ b/sys/arch/sun3/dev/fd.c    Fri Jan 21 23:39:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.11 1999/02/08 16:33:17 bouyer Exp $   */
+/*     $NetBSD: fd.c,v 1.12 2000/01/21 23:39:55 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@@ -86,7 +86,6 @@
 
 /* XXX misuse a flag to identify format operation */
 #define B_FORMAT B_XXX
-#define b_cylin b_resid
 
 #ifdef FD_DEBUG
 int    fdc_debug = 0;
@@ -211,7 +210,8 @@
 
        TAILQ_ENTRY(fd_softc) sc_drivechain;
        int sc_ops;             /* I/O ops since last switch */
-       struct buf sc_q;        /* head of buf chain */
+       struct buf_queue sc_q;  /* pending I/O requests */
+       int sc_active;          /* number of active I/O operations */
 };
 
 bdev_decl(fd);
@@ -504,6 +504,7 @@
        else
                printf(": density unknown\n");
 
+       BUFQ_FIRST(&fd->sc_q);
        fd->sc_cylin = -1;
        fd->sc_drive = drive;
        fd->sc_deftype = type;
@@ -610,19 +611,19 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
-       bp->b_cylin = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
+       bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
        if (fdc_debug > 1)
            printf("fdstrategy: b_blkno %d b_bcount %ld blkno %d cylin %ld\n",
-                   bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylin);
+                   bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylinder);
 #endif
 
        /* Queue transfer on drive, activate drive and controller if idle. */
        s = splbio();
-       disksort(&fd->sc_q, bp);
+       disksort_cylinder(&fd->sc_q, bp);
        untimeout(fd_motor_off, fd); /* a good idea */
-       if (!fd->sc_q.b_active)
+       if (fd->sc_active == 0)
                fdstart(fd);
 #ifdef DIAGNOSTIC
        else {
@@ -651,7 +652,7 @@
        int active = fdc->sc_drives.tqh_first != 0;
 
        /* Link into controller queue. */
-       fd->sc_q.b_active = 1;
+       fd->sc_active = 1;
        TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
 
        /* If controller not already active, start it. */
@@ -675,14 +676,14 @@
        if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
                fd->sc_ops = 0;
                TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
-               if (bp->b_actf) {
+               if (BUFQ_NEXT(bp) != NULL) {
                        TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
                } else
-                       fd->sc_q.b_active = 0;
+                       fd->sc_active = 0;
        }
        bp->b_resid = fd->sc_bcount;
        fd->sc_skip = 0;
-       fd->sc_q.b_actf = bp->b_actf;
+       BUFQ_REMOVE(&fd->sc_q);
 
        biodone(bp);
        /* turn off motor 5s from now */
@@ -973,7 +974,7 @@
        s = splbio();
        fdcstatus(&fd->sc_dv, 0, "timeout");
 
-       if (fd->sc_q.b_actf)
+       if (BUFQ_FIRST(&fd->sc_q) != NULL)
                fdc->sc_state++;
        else
                fdc->sc_state = DEVIDLE;
@@ -1125,11 +1126,11 @@
        }
 
        /* Is there a transfer to this drive?  If not, deactivate drive. */
-       bp = fd->sc_q.b_actf;
+       bp = BUFQ_FIRST(&fd->sc_q);
        if (bp == NULL) {
                fd->sc_ops = 0;
                TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
-               fd->sc_q.b_active = 0;
+               fd->sc_active = 0;
                goto loop;
        }
 
@@ -1174,12 +1175,12 @@
        doseek:
                if ((fdc->sc_flags & FDC_EIS) &&
                    (bp->b_flags & B_FORMAT) == 0) {
-                       fd->sc_cylin = bp->b_cylin;
+                       fd->sc_cylin = bp->b_cylinder;
                        /* We use implied seek */
                        goto doio;
                }
 
-               if (fd->sc_cylin == bp->b_cylin)
+               if (fd->sc_cylin == bp->b_cylinder)
                        goto doio;
 
                /* specify command */
@@ -1191,7 +1192,7 @@
                /* seek function */
                OUT_FDC(fdc, NE7CMD_SEEK, SEEKTIMEDOUT);
                OUT_FDC(fdc, fd->sc_drive, SEEKTIMEDOUT); /* drive number */
-               OUT_FDC(fdc, bp->b_cylin * fd->sc_type->step, SEEKTIMEDOUT);
+               OUT_FDC(fdc, bp->b_cylinder * fd->sc_type->step, SEEKTIMEDOUT);
 
                fd->sc_cylin = -1;
                fdc->sc_state = SEEKWAIT;
@@ -1297,7 +1298,7 @@
 
                /* Make sure seek really happened. */
                if (fdc->sc_nstat != 2 || (st0 & 0xf8) != 0x20 ||
-                   cyl != bp->b_cylin * fd->sc_type->step) {
+                   cyl != bp->b_cylinder * fd->sc_type->step) {
 #ifdef FD_DEBUG
                        if (fdc_debug)
                                fdcstatus(&fd->sc_dv, 2, "seek failed");
@@ -1305,7 +1306,7 @@
                        fdcretry(fdc);
                        goto loop;
                }
-               fd->sc_cylin = bp->b_cylin;
+               fd->sc_cylin = bp->b_cylinder;
                goto doio;
 
        case IOTIMEDOUT:
@@ -1389,7 +1390,7 @@
                fd->sc_skip += fd->sc_nbytes;
                fd->sc_bcount -= fd->sc_nbytes;
                if (!finfo && fd->sc_bcount > 0) {
-                       bp->b_cylin = fd->sc_blkno / fd->sc_type->seccyl;
+                       bp->b_cylinder = fd->sc_blkno / fd->sc_type->seccyl;
                        goto doseek;
                }
                fdfinish(fd, bp);
@@ -1469,7 +1470,7 @@
        struct buf *bp;
 
        fd = fdc->sc_drives.tqh_first;
-       bp = fd->sc_q.b_actf;
+       bp = BUFQ_FIRST(&fd->sc_q);
 
        fdc->sc_overruns = 0;
        if (fd->sc_opts & FDOPT_NORETRY)
diff -r 6b1bfbbd6fdc -r 62bf2c692e5a sys/arch/sun3/dev/xd.c
--- a/sys/arch/sun3/dev/xd.c    Fri Jan 21 23:28:59 2000 +0000
+++ b/sys/arch/sun3/dev/xd.c    Fri Jan 21 23:39:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xd.c,v 1.24 1999/09/17 20:07:18 thorpej Exp $  */
+/*     $NetBSD: xd.c,v 1.25 2000/01/21 23:39:55 thorpej Exp $  */
 
 /*
  *
@@ -439,9 +439,7 @@
 
        /* init queue of waiting bufs */
 
-       xdc->sc_wq.b_active = 0;
-       xdc->sc_wq.b_actf = 0;
-       xdc->sc_wq.b_actb = &xdc->sc_wq.b_actf;
+       BUFQ_INIT(&xdc->sc_wq);
 
        /*
         * section 7 of the manual tells us how to init the controller:
@@ -1026,7 +1024,6 @@
 {
        struct xd_softc *xd;
        struct xdc_softc *parent;
-       struct buf *wq;
        int     s, unit;
 
        unit = DISKUNIT(bp->b_dev);
@@ -1077,7 +1074,7 @@
 
        /* first, give jobs in front of us a chance */
        parent = xd->parent;
-       while (parent->nfree > 0 && parent->sc_wq.b_actf)
+       while (parent->nfree > 0 && BUFQ_FIRST(&parent->sc_wq) != NULL)
                if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK)
                        break;
 
@@ -1086,11 +1083,7 @@
         * buffs will get picked up later by xdcintr().
         */
        if (parent->nfree == 0) {
-               wq = &xd->parent->sc_wq;
-               bp->b_actf = 0;
-               bp->b_actb = wq->b_actb;
-               *wq->b_actb = bp;
-               wq->b_actb = &bp->b_actf;
+               BUFQ_INSERT_TAIL(&parent->sc_wq, bp);
                splx(s);
                return;
        }
@@ -1138,7 +1131,7 @@
        xdc_start(xdcsc, XDC_MAXIOPB);
 
        /* fill up any remaining iorq's with queue'd buffers */
-       while (xdcsc->nfree > 0 && xdcsc->sc_wq.b_actf)
+       while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL)
                if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
                        break;
 
@@ -1369,7 +1362,6 @@
        int     rqno, partno;
        struct xd_iorq *iorq;
        struct xd_iopb *iopb;
-       struct buf *wq;
        u_long  block;
        caddr_t dbuf;
 
@@ -1382,15 +1374,10 @@
        /* get buf */
 
        if (bp == NULL) {
-               bp = xdcsc->sc_wq.b_actf;
-               if (!bp)
+               bp = BUFQ_FIRST(&xdcsc->sc_wq);
+               if (bp == NULL)
                        panic("xdc_startbuf bp");
-               wq = bp->b_actf;
-               if (wq)
-                       wq->b_actb = bp->b_actb;
-               else
-                       xdcsc->sc_wq.b_actb = bp->b_actb;
-               *bp->b_actb = wq;
+               BUFQ_REMOVE(&xdcsc->sc_wq, bp);
                xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)];
        }
        partno = DISKPART(bp->b_dev);
@@ -1431,11 +1418,7 @@
                printf("%s: warning: out of DVMA space\n",
                           xdcsc->sc_dev.dv_xname);
                XDC_FREE(xdcsc, rqno);
-               wq = &xdcsc->sc_wq;     /* put at end of queue */
-               bp->b_actf = 0;
-               bp->b_actb = wq->b_actb;
-               *wq->b_actb = bp;
-               wq->b_actb = &bp->b_actf;
+               BUFQ_INSERT_TAIL(&xdcsc->sc_wq, bp);
                return (XD_ERR_FAIL);   /* XXX: need some sort of
                                         * call-back scheme here? */
        }
@@ -1636,7 +1619,7 @@
        /* now that we've drained everything, start up any bufs that have
         * queued */
 
-       while (xdcsc->nfree > 0 && xdcsc->sc_wq.b_actf)
+       while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL)
                if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
                        break;
 
diff -r 6b1bfbbd6fdc -r 62bf2c692e5a sys/arch/sun3/dev/xdvar.h
--- a/sys/arch/sun3/dev/xdvar.h Fri Jan 21 23:28:59 2000 +0000
+++ b/sys/arch/sun3/dev/xdvar.h Fri Jan 21 23:39:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xdvar.h,v 1.5 1998/01/26 21:03:43 gwr Exp $    */
+/*     $NetBSD: xdvar.h,v 1.6 2000/01/21 23:39:55 thorpej Exp $        */
 
 /*
  *
@@ -149,7 +149,7 @@
   struct xd_iorq *reqs;            /* i/o requests */
   struct xd_iopb *iopbase;         /* iopb base addr (maps iopb->iorq) */
   struct xd_iopb *dvmaiopb;        /* iopb base in DVMA space, not kvm */
-  struct buf sc_wq;                /* queue'd IOPBs for this controller */
+  struct buf_queue sc_wq;         /* queue'd IOPBs for this controller */
   char freereq[XDC_MAXIOPB];       /* free list (stack) */
   char waitq[XDC_MAXIOPB];         /* wait queue */
   u_char nfree;                    /* number of iopbs free */
diff -r 6b1bfbbd6fdc -r 62bf2c692e5a sys/arch/sun3/dev/xy.c
--- a/sys/arch/sun3/dev/xy.c    Fri Jan 21 23:28:59 2000 +0000
+++ b/sys/arch/sun3/dev/xy.c    Fri Jan 21 23:39:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xy.c,v 1.23 1999/09/17 20:07:18 thorpej Exp $  */



Home | Main Index | Thread Index | Old Index