Source-Changes-HG archive

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

[src/jdolecek-ncq]: src/sys/arch/atari pass ata channel interlock to st_dmagr...



details:   https://anonhg.NetBSD.org/src/rev/b49c1dd88e47
branches:  jdolecek-ncq
changeset: 823040:b49c1dd88e47
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Sep 27 19:11:35 2017 +0000

description:
pass ata channel interlock to st_dmagrab() so that it can release
and reacquire it if it sleeps

diffstat:

 sys/arch/atari/dev/atari5380.c |   8 ++++----
 sys/arch/atari/dev/dma.c       |   9 +++++----
 sys/arch/atari/dev/fd.c        |  15 ++++++++-------
 sys/arch/atari/dev/wdc_mb.c    |   8 +++++---
 sys/arch/atari/include/dma.h   |   4 ++--
 5 files changed, 24 insertions(+), 20 deletions(-)

diffs (198 lines):

diff -r 6dae64f642f8 -r b49c1dd88e47 sys/arch/atari/dev/atari5380.c
--- a/sys/arch/atari/dev/atari5380.c    Wed Sep 27 19:05:57 2017 +0000
+++ b/sys/arch/atari/dev/atari5380.c    Wed Sep 27 19:11:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atari5380.c,v 1.62 2014/10/18 08:33:25 snj Exp $       */
+/*     $NetBSD: atari5380.c,v 1.62.8.1 2017/09/27 19:11:35 jdolecek Exp $      */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.62 2014/10/18 08:33:25 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.62.8.1 2017/09/27 19:11:35 jdolecek Exp $");
 
 #include "opt_atariscsi.h"
 
@@ -794,7 +794,7 @@
                        return 0;
                }
                if (st_dmagrab((dma_farg)ncr_ctrl_intr, (dma_farg)run_main,
-                   cur_softc, &falcon_lock, 1) == 0)
+                   cur_softc, &falcon_lock, 1, NULL) == 0)
                        return 0;
        }
        return 1;
@@ -819,7 +819,7 @@
                 * waiting in the issue queue.
                 */
                st_dmagrab((dma_farg)ncr_ctrl_intr, (dma_farg)run_main,
-                   cur_softc, &falcon_lock, 0);
+                   cur_softc, &falcon_lock, 0, NULL);
        }
 }
 
diff -r 6dae64f642f8 -r b49c1dd88e47 sys/arch/atari/dev/dma.c
--- a/sys/arch/atari/dev/dma.c  Wed Sep 27 19:05:57 2017 +0000
+++ b/sys/arch/atari/dev/dma.c  Wed Sep 27 19:11:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dma.c,v 1.27 2010/04/12 12:43:39 tsutsui Exp $ */
+/*     $NetBSD: dma.c,v 1.27.48.1 2017/09/27 19:11:35 jdolecek Exp $   */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.27 2010/04/12 12:43:39 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.27.48.1 2017/09/27 19:11:35 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,7 +103,7 @@
 
 int
 st_dmagrab(dma_farg int_func, dma_farg call_func, void *softc, int *lock_stat,
-    int rcaller)
+    int rcaller, kmutex_t *interlock)
 {
        int s;
        DMA_ENTRY *req;
@@ -131,7 +131,8 @@
        if (TAILQ_FIRST(&dma_active) != req) {
                if (call_func == NULL) {
                        do {
-                               tsleep(&dma_active, PRIBIO, "dmalck", 0);
+                               mtsleep(&dma_active, PRIBIO, "dmalck", 0,
+                                   interlock);
                        } while (*req->lock_stat != DMA_LOCK_GRANT);
                        splx(s);
                        return 1;
diff -r 6dae64f642f8 -r b49c1dd88e47 sys/arch/atari/dev/fd.c
--- a/sys/arch/atari/dev/fd.c   Wed Sep 27 19:05:57 2017 +0000
+++ b/sys/arch/atari/dev/fd.c   Wed Sep 27 19:11:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.84 2015/04/26 15:15:19 mlelstv Exp $  */
+/*     $NetBSD: fd.c,v 1.84.6.1 2017/09/27 19:11:35 jdolecek Exp $     */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.84 2015/04/26 15:15:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.84.6.1 2017/09/27 19:11:35 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -334,7 +334,7 @@
                fdsoftc.unit  = i;
                fdsoftc.flags = 0;
                st_dmagrab((dma_farg)fdcint, (dma_farg)fdtestdrv, &fdsoftc,
-                   &lock_stat, 0);
+                   &lock_stat, 0, NULL);
                st_dmafree(&fdsoftc, &lock_stat);
 
                if ((fdsoftc.flags & FLPF_NOTRESP) == 0) {
@@ -532,7 +532,7 @@
                sc->flags |= FLPF_INOPEN|FLPF_GETSTAT;
                s = splbio();
                st_dmagrab((dma_farg)fdcint, (dma_farg)fdstatus, sc,
-                   &lock_stat, 0);
+                   &lock_stat, 0, NULL);
                while ((sc->flags & FLPF_GETSTAT) != 0)
                        tsleep((void *)sc, PRIBIO, "fdopen", 0);
                splx(s);
@@ -638,7 +638,7 @@
                        callout_stop(&sc->sc_motor_ch);
                fd_state = FLP_IDLE;
                st_dmagrab((dma_farg)fdcint, (dma_farg)fdstart, sc,
-                   &lock_stat, 0);
+                   &lock_stat, 0, NULL);
        }
        splx(s);
 
@@ -769,7 +769,8 @@
 #ifdef FLP_DEBUG
        printf("fddone: Staring job on unit %d\n", sc1->unit);
 #endif
-       st_dmagrab((dma_farg)fdcint, (dma_farg)fdstart, sc1, &lock_stat, 0);
+       st_dmagrab((dma_farg)fdcint, (dma_farg)fdstart, sc1, &lock_stat, 0,
+           NULL);
 }
 
 static int
@@ -1187,7 +1188,7 @@
                        int tmp;
 
                        st_dmagrab((dma_farg)fdcint, (dma_farg)fdmoff, sc,
-                           &tmp, 0);
+                           &tmp, 0, NULL);
                } else
                        fd_state = FLP_IDLE;
                break;
diff -r 6dae64f642f8 -r b49c1dd88e47 sys/arch/atari/dev/wdc_mb.c
--- a/sys/arch/atari/dev/wdc_mb.c       Wed Sep 27 19:05:57 2017 +0000
+++ b/sys/arch/atari/dev/wdc_mb.c       Wed Sep 27 19:11:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_mb.c,v 1.38.28.3 2017/09/27 19:04:05 jdolecek Exp $        */
+/*     $NetBSD: wdc_mb.c,v 1.38.28.4 2017/09/27 19:11:35 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.38.28.3 2017/09/27 19:04:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.38.28.4 2017/09/27 19:11:35 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -220,6 +220,7 @@
 static int
 claim_hw(struct ata_channel *chp, int maysleep)
 {
+       ata_channel_lock_owned(chp);
 
        if (wd_lock != DMA_LOCK_GRANT) {
                if (wd_lock == DMA_LOCK_REQ) {
@@ -230,7 +231,7 @@
                }
                if (!st_dmagrab((dma_farg)wdcintr,
                    (dma_farg)(maysleep ? NULL : wdcrestart), chp,
-                   &wd_lock, 1))
+                   &wd_lock, 1, &chp->ch_lock))
                        return 0;
        }
        return 1;       
@@ -239,6 +240,7 @@
 static void
 free_hw(struct ata_channel *chp)
 {
+       ata_channel_lock_owned(chp);
 
        /*
         * Flush pending interrupts before giving-up lock
diff -r 6dae64f642f8 -r b49c1dd88e47 sys/arch/atari/include/dma.h
--- a/sys/arch/atari/include/dma.h      Wed Sep 27 19:05:57 2017 +0000
+++ b/sys/arch/atari/include/dma.h      Wed Sep 27 19:11:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dma.h,v 1.11 2009/10/20 19:10:11 snj Exp $     */
+/*     $NetBSD: dma.h,v 1.11.52.1 2017/09/27 19:11:35 jdolecek Exp $   */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -91,7 +91,7 @@
 #ifdef _KERNEL
 typedef void (*dma_farg)(void*);
 
-int    st_dmagrab(dma_farg, dma_farg, void *, int *, int);
+int    st_dmagrab(dma_farg, dma_farg, void *, int *, int, kmutex_t *);
 void   st_dmafree(void *, int *);
 int    st_dmawanted(void);
 void   st_dmaaddr_set(void *);



Home | Main Index | Thread Index | Old Index