Source-Changes-HG archive

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

[src/trunk]: src/sys Convert to new device buffer queue interface.



details:   https://anonhg.NetBSD.org/src/rev/0d9c45937724
branches:  trunk
changeset: 534359:0d9c45937724
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Jul 22 21:48:36 2002 +0000

description:
Convert to new device buffer queue interface.

Approved by: Anders Magnusson <ragge%netbsd.org@localhost>

diffstat:

 sys/arch/vax/mba/hp.c      |  16 ++++++++--------
 sys/arch/vax/mba/mba.c     |  10 +++++-----
 sys/arch/vax/mba/mbavar.h  |   4 ++--
 sys/arch/vax/vax/ctu.c     |  20 ++++++++++----------
 sys/arch/vax/vsa/hdc9224.c |  13 ++++++-------
 sys/dev/mscp/mscp_disk.c   |   6 +++---
 sys/dev/mscp/mscp_subr.c   |  14 +++++++-------
 sys/dev/mscp/mscpvar.h     |   4 ++--
 sys/dev/qbus/rl.c          |  13 ++++++-------
 sys/dev/qbus/rlvar.h       |   6 +++---
 sys/dev/qbus/ts.c          |  20 +++++++++-----------
 11 files changed, 61 insertions(+), 65 deletions(-)

diffs (truncated from 520 to 300 lines):

diff -r 0f5fa20c509f -r 0d9c45937724 sys/arch/vax/mba/hp.c
--- a/sys/arch/vax/mba/hp.c     Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/arch/vax/mba/hp.c     Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hp.c,v 1.24 2000/06/04 18:04:38 ragge Exp $ */
+/*     $NetBSD: hp.c,v 1.25 2002/07/22 21:48:36 hannken Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -130,7 +130,7 @@
        /*
         * Init the common struct for both the adapter and its slaves.
         */
-       BUFQ_INIT(&sc->sc_md.md_q);
+       bufq_alloc(&sc->sc_md.md_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
        sc->sc_md.md_softc = (void *)sc;        /* Pointer to this softc */
        sc->sc_md.md_mba = (void *)parent;      /* Pointer to parent softc */
        sc->sc_md.md_start = hpstart;           /* Disk start routine */
@@ -187,8 +187,8 @@
 
        s = splbio();
 
-       gp = BUFQ_FIRST(&sc->sc_md.md_q);
-       disksort_cylinder(&sc->sc_md.md_q, bp);
+       gp = BUFQ_PEEK(&sc->sc_md.md_q);
+       BUFQ_PUT(&sc->sc_md.md_q, bp);
        if (gp == 0)
                mbaqueue(&sc->sc_md);
 
@@ -208,7 +208,7 @@
 {
        struct  hp_softc *sc = md->md_softc;
        struct  disklabel *lp = sc->sc_disk.dk_label;
-       struct  buf *bp = BUFQ_FIRST(&md->md_q);
+       struct  buf *bp = BUFQ_PEEK(&md->md_q);
        unsigned bn, cn, sn, tn;
 
        /*
@@ -346,7 +346,7 @@
 hpfinish(struct mba_device *md, int mbasr, int *attn)
 {
        struct  hp_softc *sc = md->md_softc;
-       struct  buf *bp = BUFQ_FIRST(&md->md_q);
+       struct  buf *bp = BUFQ_PEEK(&md->md_q);
        int er1, er2, bc;
        unsigned byte;
 
@@ -385,8 +385,8 @@
                printf("massbuss error :%s %x\n",
                    sc->sc_dev.dv_xname, mbasr);
 
-       BUFQ_FIRST(&md->md_q)->b_resid = 0;
-       disk_unbusy(&sc->sc_disk, BUFQ_FIRST(&md->md_q)->b_bcount);
+       BUFQ_PEEK(&md->md_q)->b_resid = 0;
+       disk_unbusy(&sc->sc_disk, BUFQ_PEEK(&md->md_q)->b_bcount);
        return XFER_FINISH;
 }
 
diff -r 0f5fa20c509f -r 0d9c45937724 sys/arch/vax/mba/mba.c
--- a/sys/arch/vax/mba/mba.c    Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/arch/vax/mba/mba.c    Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mba.c,v 1.25 2000/07/10 09:14:32 ragge Exp $ */
+/*     $NetBSD: mba.c,v 1.26 2002/07/22 21:48:36 hannken Exp $ */
 /*
  * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -186,7 +186,7 @@
                return; /* During autoconfig */
 
        md = sc->sc_first;
-       bp = BUFQ_FIRST(&md->md_q);
+       bp = BUFQ_PEEK(&md->md_q);
        /*
         * A data-transfer interrupt. Current operation is finished,
         * call that device's finish routine to see what to do next.
@@ -203,13 +203,13 @@
                         * If more to transfer, start the adapter again
                         * by calling mbastart().
                         */
-                       BUFQ_REMOVE(&md->md_q, bp);
+                       (void)BUFQ_GET(&md->md_q);
                        sc->sc_first = md->md_back;
                        md->md_back = 0;
                        if (sc->sc_first == 0)
                                sc->sc_last = (void *)&sc->sc_first;
 
-                       if (BUFQ_FIRST(&md->md_q) != NULL) {
+                       if (BUFQ_PEEK(&md->md_q) != NULL) {
                                sc->sc_last->md_back = md;
                                sc->sc_last = md;
                        }
@@ -279,7 +279,7 @@
 mbastart(struct mba_softc *sc)
 {
        struct  mba_device *md = sc->sc_first;
-       struct  buf *bp = BUFQ_FIRST(&md->md_q);
+       struct  buf *bp = BUFQ_PEEK(&md->md_q);
 
        disk_reallymapin(bp, (void *)(sc->sc_ioh + MAPREG(0)), 0, PG_V);
 
diff -r 0f5fa20c509f -r 0d9c45937724 sys/arch/vax/mba/mbavar.h
--- a/sys/arch/vax/mba/mbavar.h Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/arch/vax/mba/mbavar.h Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbavar.h,v 1.7 2000/06/04 18:04:39 ragge Exp $ */
+/*     $NetBSD: mbavar.h,v 1.8 2002/07/22 21:48:37 hannken Exp $ */
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden
  * All rights reserved.
@@ -100,7 +100,7 @@
        enum    xfer_action (*md_finish)(struct mba_device *, int, int *);
        void    *md_softc;      /* Backpointer to this units softc. */
        struct  mba_softc *md_mba;
-       struct  buf_queue md_q; /* queue of I/O requests */
+       struct  bufq_state md_q;        /* queue of I/O requests */
 };
 
 struct mba_softc {
diff -r 0f5fa20c509f -r 0d9c45937724 sys/arch/vax/vax/ctu.c
--- a/sys/arch/vax/vax/ctu.c    Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/arch/vax/vax/ctu.c    Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctu.c,v 1.15 2002/07/01 16:20:35 ragge Exp $ */
+/*     $NetBSD: ctu.c,v 1.16 2002/07/22 21:48:38 hannken Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -75,7 +75,7 @@
        int     sc_wto;         /* Timeout counter */
        int     sc_xbytes;      /* Number of xfer'd bytes */
        int     sc_op;          /* Read/write */
-       struct  buf_queue sc_bufq;      /* pending I/O requests */
+       struct  bufq_state sc_bufq;     /* pending I/O requests */
 } tu_sc;
 
 struct ivec_dsp tu_recv, tu_xmit;
@@ -94,7 +94,7 @@
 void
 ctuattach()
 {
-       BUFQ_INIT(&tu_sc.sc_bufq);
+       bufq_alloc(&tu_sc.sc_bufq, BUFQ_FCFS);
 
        tu_recv = idsptch;
        tu_recv.hoppaddr = cturintr;
@@ -157,8 +157,8 @@
 {
        struct buf *bp;
        int s = spl7();
-       while ((bp = BUFQ_FIRST(&tu_sc.sc_bufq)))
-               BUFQ_REMOVE(&tu_sc.sc_bufq, bp);
+       while ((bp = BUFQ_GET(&tu_sc.sc_bufq)))
+               ;
        splx(s);
 
        mtpr(0, PR_CSRS);
@@ -185,8 +185,8 @@
                return;
        }
 
-       empty = TAILQ_EMPTY(&tu_sc.sc_bufq.bq_head);
-       BUFQ_INSERT_TAIL(&tu_sc.sc_bufq, bp);
+       empty = (BUFQ_PEEK(&tu_sc.sc_bufq) == NULL);
+       BUFQ_PUT(&tu_sc.sc_bufq, bp);
        if (empty)
                ctustart();
        splx(s);
@@ -198,7 +198,7 @@
        struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp;
        struct buf *bp;
 
-       bp = BUFQ_FIRST(&tu_sc.sc_bufq);
+       bp = BUFQ_PEEK(&tu_sc.sc_bufq);
        if (bp == NULL)
                return;
 #ifdef TUDEBUG
@@ -264,7 +264,7 @@
        int i, c, tck;
        unsigned short ck;
 
-       bp = BUFQ_FIRST(&tu_sc.sc_bufq);
+       bp = BUFQ_PEEK(&tu_sc.sc_bufq);
        switch (tu_sc.sc_state) {
        case TU_RESET:
                if (status != RSP_TYP_CONTINUE)
@@ -383,7 +383,7 @@
                return;
        }
        if ((bp->b_flags & B_ERROR) == 0) {
-               BUFQ_REMOVE(&tu_sc.sc_bufq, bp);
+               (void)BUFQ_GET(&tu_sc.sc_bufq);
                biodone(bp);
 #ifdef TUDEBUG
                printf("biodone %p\n", bp);
diff -r 0f5fa20c509f -r 0d9c45937724 sys/arch/vax/vsa/hdc9224.c
--- a/sys/arch/vax/vsa/hdc9224.c        Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/arch/vax/vsa/hdc9224.c        Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hdc9224.c,v 1.17 2001/11/09 05:31:44 matt Exp $ */
+/*     $NetBSD: hdc9224.c,v 1.18 2002/07/22 21:48:38 hannken Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -141,7 +141,7 @@
        struct evcnt sc_intrcnt;
        struct vsbus_dma sc_vd;
        vaddr_t sc_regs;                /* register addresses */
-       struct buf_queue sc_q;
+       struct bufq_state sc_q;
        struct buf *sc_active;
        struct hdc9224_UDCreg sc_creg;  /* (command) registers to be written */
        struct hdc9224_UDCreg sc_sreg;  /* (status) registers being read */
@@ -289,7 +289,7 @@
                        sc->sc_dev.dv_xname, status);
                return;
        }
-       BUFQ_INIT(&sc->sc_q);
+       bufq_alloc(&sc->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
 
        /*
         * now probe for all possible hard drives
@@ -447,7 +447,7 @@
        bp->b_cylinder = bp->b_rawblkno / lp->d_secpercyl;
 
        s = splbio();
-       disksort_cylinder(&sc->sc_q, bp);
+       BUFQ_PUT(&sc->sc_q, bp);
        if (inq == 0) {
                inq = 1;
                vsbus_dma_start(&sc->sc_vd);
@@ -466,7 +466,7 @@
        inq = 0;
 
        hdcstart(sc, 0);
-       if (BUFQ_FIRST(&sc->sc_q)) {
+       if (BUFQ_PEEK(&sc->sc_q)) {
                vsbus_dma_start(&sc->sc_vd); /* More to go */
                inq = 1;
        }
@@ -487,10 +487,9 @@
 
 
        if (ob == 0) {
-               bp = BUFQ_FIRST(&sc->sc_q);
+               bp = BUFQ_GET(&sc->sc_q);
                if (bp == NULL)
                        return; /* Nothing to do */
-               BUFQ_REMOVE(&sc->sc_q, bp);
                sc->sc_bufaddr = bp->b_data;
                sc->sc_diskblk = bp->b_rawblkno;
                sc->sc_bytecnt = bp->b_bcount;
diff -r 0f5fa20c509f -r 0d9c45937724 sys/dev/mscp/mscp_disk.c
--- a/sys/dev/mscp/mscp_disk.c  Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/dev/mscp/mscp_disk.c  Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $     */
+/*     $NetBSD: mscp_disk.c,v 1.31 2002/07/22 21:48:39 hannken Exp $   */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * Copyright (c) 1988 Regents of the University of California.
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.31 2002/07/22 21:48:39 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -267,7 +267,7 @@
 #if notyet
        if (ra->ra_openpart == 0) {
                s = spluba();
-               while (BUFQ_FIRST(&udautab[unit]) != NULL)
+               while (BUFQ_PEEK(&udautab[unit]) != NULL)
                        (void) tsleep(&udautab[unit], PZERO - 1,
                            "raclose", 0);
                splx(s);
diff -r 0f5fa20c509f -r 0d9c45937724 sys/dev/mscp/mscp_subr.c
--- a/sys/dev/mscp/mscp_subr.c  Mon Jul 22 20:56:57 2002 +0000
+++ b/sys/dev/mscp/mscp_subr.c  Mon Jul 22 21:48:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mscp_subr.c,v 1.18 2001/11/13 07:38:28 lukem Exp $     */
+/*     $NetBSD: mscp_subr.c,v 1.19 2002/07/22 21:48:40 hannken Exp $   */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * Copyright (c) 1988 Regents of the University of California.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mscp_subr.c,v 1.18 2001/11/13 07:38:28 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_subr.c,v 1.19 2002/07/22 21:48:40 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -163,7 +163,7 @@
        mi->mi_rsp.mri_size = NRSP;
        mi->mi_rsp.mri_desc = mi->mi_uda->mp_ca.ca_rspdsc;



Home | Main Index | Thread Index | Old Index