Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/e839b68ecdf7
branches:  trunk
changeset: 534398:e839b68ecdf7
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Jul 24 19:34:57 2002 +0000

description:
Convert to new device buffer queue interface.

diffstat:

 sys/dev/ic/rrunner.c    |  13 ++++++-------
 sys/dev/ic/rrunnervar.h |   4 ++--
 sys/dev/isa/fd.c        |  20 ++++++++++----------
 sys/dev/isa/mcd.c       |  15 +++++++--------
 4 files changed, 25 insertions(+), 27 deletions(-)

diffs (229 lines):

diff -r 0699fbdb50a4 -r e839b68ecdf7 sys/dev/ic/rrunner.c
--- a/sys/dev/ic/rrunner.c      Wed Jul 24 17:03:00 2002 +0000
+++ b/sys/dev/ic/rrunner.c      Wed Jul 24 19:34:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rrunner.c,v 1.30 2002/02/14 07:08:02 chs Exp $ */
+/*     $NetBSD: rrunner.c,v 1.31 2002/07/24 19:34:57 hannken Exp $     */
 
 /*
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.30 2002/02/14 07:08:02 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.31 2002/07/24 19:34:57 hannken Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -301,7 +301,7 @@
        sc->sc_send.ec_offset = 0;
        sc->sc_send.ec_descr = sc->sc_send_ring;
        TAILQ_INIT(&sc->sc_send.ec_di_queue);
-       BUFQ_INIT(&sc->sc_send.ec_buf_queue);
+       bufq_alloc(&sc->sc_send.ec_buf_queue, BUFQ_FCFS);
 
        for (i = 0; i < RR_MAX_SNAP_RECV_RING_SIZE; i++)
                if (bus_dmamap_create(sc->sc_dmat, RR_DMA_MAX, 1, RR_DMA_MAX, 
@@ -1397,7 +1397,7 @@
                 */
 
                struct esh_send_ring_ctl *ring = &sc->sc_send;
-               BUFQ_INSERT_TAIL(&ring->ec_buf_queue, bp);
+               BUFQ_PUT(&ring->ec_buf_queue, bp);
 #ifdef ESH_PRINTF
                printf("esh_fpstrategy:  ready to call eshstart to write!\n");
 #endif
@@ -2041,7 +2041,7 @@
        if ((sc->sc_flags & ESH_FL_FP_RING_UP) != 0 &&
            send->ec_cur_mbuf == NULL && send->ec_cur_buf == NULL &&
            send->ec_cur_dmainfo == NULL &&
-           BUFQ_FIRST(&send->ec_buf_queue) != NULL) {
+           BUFQ_PEEK(&send->ec_buf_queue) != NULL) {
                struct buf *bp;
 
 #ifdef ESH_PRINTF
@@ -2049,8 +2049,7 @@
                       send->ec_queue);
 #endif
 
-               bp = send->ec_cur_buf = BUFQ_FIRST(&send->ec_buf_queue);
-               BUFQ_REMOVE(&send->ec_buf_queue, bp);
+               bp = send->ec_cur_buf = BUFQ_GET(&send->ec_buf_queue);
                send->ec_offset = 0;
                send->ec_len = bp->b_bcount;
 
diff -r 0699fbdb50a4 -r e839b68ecdf7 sys/dev/ic/rrunnervar.h
--- a/sys/dev/ic/rrunnervar.h   Wed Jul 24 17:03:00 2002 +0000
+++ b/sys/dev/ic/rrunnervar.h   Wed Jul 24 19:34:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rrunnervar.h,v 1.6 2000/01/21 23:39:58 thorpej Exp $   */
+/*     $NetBSD: rrunnervar.h,v 1.7 2002/07/24 19:34:57 hannken Exp $   */
 
 /* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -114,7 +114,7 @@
        struct buf *ec_cur_buf;         /* current buf being processed */
        struct esh_dmainfo *ec_cur_dmainfo;     
                                        /* current dmainfo being processed */
-       struct buf_queue ec_buf_queue;  /* queue of bufs to send */
+       struct bufq_state ec_buf_queue; /* queue of bufs to send */
        int ec_error;                   /* encountered error? */
        u_int16_t ec_producer;          /* latest buffer driver produced */
        u_int16_t ec_consumer;          /* latest buffer runcode consumed */
diff -r 0699fbdb50a4 -r e839b68ecdf7 sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c  Wed Jul 24 17:03:00 2002 +0000
+++ b/sys/dev/isa/fd.c  Wed Jul 24 19:34:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.23 2002/06/26 09:47:08 simonb Exp $   */
+/*     $NetBSD: fd.c,v 1.24 2002/07/24 19:34:58 hannken Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.23 2002/06/26 09:47:08 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.24 2002/07/24 19:34:58 hannken Exp $");
 
 #include "rnd.h"
 #include "opt_ddb.h"
@@ -259,7 +259,7 @@
 
        TAILQ_ENTRY(fd_softc) sc_drivechain;
        int sc_ops;             /* I/O ops since last switch */
-       struct buf_queue sc_q;  /* pending I/O requests */
+       struct bufq_state sc_q; /* pending I/O requests */
        int sc_active;          /* number of active I/O operations */
 
 #if NRND > 0
@@ -492,7 +492,7 @@
        else
                printf(": density unknown\n");
 
-       BUFQ_INIT(&fd->sc_q);
+       bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
        fd->sc_cylin = -1;
        fd->sc_drive = drive;
        fd->sc_deftype = type;
@@ -624,7 +624,7 @@
 
        /* Queue transfer on drive, activate drive and controller if idle. */
        s = splbio();
-       disksort_cylinder(&fd->sc_q, bp);
+       BUFQ_PUT(&fd->sc_q, bp);
        callout_stop(&fd->sc_motoroff_ch);              /* a good idea */
        if (fd->sc_active == 0)
                fdstart(fd);
@@ -677,17 +677,17 @@
         * another drive is waiting to be serviced, since there is a long motor
         * startup delay whenever we switch.
         */
+       (void)BUFQ_GET(&fd->sc_q);
        if (TAILQ_NEXT(fd, sc_drivechain) && ++fd->sc_ops >= 8) {
                fd->sc_ops = 0;
                TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
-               if (BUFQ_NEXT(bp) != NULL)
+               if (BUFQ_PEEK(&fd->sc_q) != NULL)
                        TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
                else
                        fd->sc_active = 0;
        }
        bp->b_resid = fd->sc_bcount;
        fd->sc_skip = 0;
-       BUFQ_REMOVE(&fd->sc_q, bp);
 
 #if NRND > 0
        rnd_add_uint32(&fd->rnd_source, bp->b_blkno);
@@ -933,7 +933,7 @@
 #endif
        fdcstatus(&fd->sc_dev, 0, "timeout");
 
-       if (BUFQ_FIRST(&fd->sc_q) != NULL)
+       if (BUFQ_PEEK(&fd->sc_q) != NULL)
                fdc->sc_state++;
        else
                fdc->sc_state = DEVIDLE;
@@ -978,7 +978,7 @@
        }
 
        /* Is there a transfer to this drive?  If not, deactivate drive. */
-       bp = BUFQ_FIRST(&fd->sc_q);
+       bp = BUFQ_PEEK(&fd->sc_q);
        if (bp == NULL) {
                fd->sc_ops = 0;
                TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1246,7 +1246,7 @@
        struct buf *bp;
 
        fd = TAILQ_FIRST(&fdc->sc_drives);
-       bp = BUFQ_FIRST(&fd->sc_q);
+       bp = BUFQ_PEEK(&fd->sc_q);
 
        if (fd->sc_opts & FDOPT_NORETRY)
            goto fail;
diff -r 0699fbdb50a4 -r e839b68ecdf7 sys/dev/isa/mcd.c
--- a/sys/dev/isa/mcd.c Wed Jul 24 17:03:00 2002 +0000
+++ b/sys/dev/isa/mcd.c Wed Jul 24 19:34:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mcd.c,v 1.74 2002/01/07 21:47:11 thorpej Exp $ */
+/*     $NetBSD: mcd.c,v 1.75 2002/07/24 19:34:58 hannken Exp $ */
 
 /*
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.  All rights reserved.
@@ -56,7 +56,7 @@
 /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.74 2002/01/07 21:47:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.75 2002/07/24 19:34:58 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -149,7 +149,7 @@
 #define        MCD_MD_UNKNOWN  -1
        int     lastupc;
 #define        MCD_UPC_UNKNOWN -1
-       struct buf_queue buf_queue;
+       struct bufq_state buf_queue;
        int     active;
        u_char  readcmd;
        u_char  debug;
@@ -251,7 +251,7 @@
                return;
        }
 
-       BUFQ_INIT(&sc->buf_queue);
+       bufq_alloc(&sc->buf_queue, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
        callout_init(&sc->sc_pintr_ch);
 
        /*
@@ -506,7 +506,7 @@
 
        /* Queue it. */
        s = splbio();
-       disksort_blkno(&sc->buf_queue, bp);
+       BUFQ_PUT(&sc->buf_queue, bp);
        splx(s);
        if (!sc->active)
                mcdstart(sc);
@@ -529,16 +529,15 @@
 loop:
        s = splbio();
 
-       if ((bp = BUFQ_FIRST(&sc->buf_queue)) == NULL) {
+       if ((bp = BUFQ_GET(&sc->buf_queue)) == NULL) {
                /* Nothing to do. */
                sc->active = 0;
                splx(s);
                return;
        }
 
-       /* Block found to process; dequeue. */
+       /* Block found to process. */
        MCD_TRACE("start: found block bp=0x%x\n", bp, 0, 0, 0);
-       BUFQ_REMOVE(&sc->buf_queue, bp);
        splx(s);
 
        /* Changed media? */



Home | Main Index | Thread Index | Old Index