Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev/sdmmc Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/6731ba6e3bd8
branches:  netbsd-7
changeset: 799373:6731ba6e3bd8
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue May 26 01:29:53 2015 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #794):
        sys/dev/sdmmc/sdmmc.c: revision 1.25
        sys/dev/sdmmc/sdmmc.c: revision 1.26
        sys/dev/sdmmc/ld_sdmmc.c: revision 1.13
        sys/dev/sdmmc/ld_sdmmc.c: revision 1.16
- Be a bit more verbose about errors, also pass through error code
  from lower layer like other drivers.
- need to call lddone with splbio and kernel lock held
- sdmmc_task_thread isn't MPSAFE so instead of just wrapping the callback
  in KERNEL_LOCK/KERNEL_UNLOCK_ONE, remove KTHREAD_MPSAFE. While here, use
  PRI_BIO instead of PRI_NONE for the task thread priority. Since this is
  how all transfers are queued, and we have a 1 second timeout on the task
  being picked up off the queue (!), better not to rely on a PRI_NONE thread.

diffstat:

 sys/dev/sdmmc/ld_sdmmc.c |  23 ++++++++++++++---------
 sys/dev/sdmmc/sdmmc.c    |   6 +++---
 2 files changed, 17 insertions(+), 12 deletions(-)

diffs (102 lines):

diff -r 295d0281d4d7 -r 6731ba6e3bd8 sys/dev/sdmmc/ld_sdmmc.c
--- a/sys/dev/sdmmc/ld_sdmmc.c  Mon May 25 09:24:37 2015 +0000
+++ b/sys/dev/sdmmc/ld_sdmmc.c  Tue May 26 01:29:53 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_sdmmc.c,v 1.12 2013/10/12 16:49:01 christos Exp $   */
+/*     $NetBSD: ld_sdmmc.c,v 1.12.4.1 2015/05/26 01:29:53 msaitoh Exp $        */
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.12 2013/10/12 16:49:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.12.4.1 2015/05/26 01:29:53 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -118,7 +118,7 @@
            sa->sf->cid.rev, sa->sf->cid.psn, sa->sf->cid.mdt);
        aprint_naive("\n");
 
-       callout_init(&sc->sc_task.task_callout, CALLOUT_MPSAFE);
+       callout_init(&sc->sc_task.task_callout, 0);
 
        sc->sc_hwunit = 0;      /* always 0? */
        sc->sc_sf = sa->sf;
@@ -211,11 +211,14 @@
        /* is everything done in terms of blocks? */
        if (bp->b_rawblkno >= sc->sc_sf->csd.capacity) {
                /* trying to read or write past end of device */
-               DPRINTF(("%s: blkno exceeds capacity 0x%x\n",
-                   device_xname(sc->sc_ld.sc_dv), sc->sc_sf->csd.capacity));
-               bp->b_error = EIO; /* XXX  */
+               aprint_error_dev(sc->sc_ld.sc_dv,
+                   "blkno 0x%" PRIu64 " exceeds capacity %d\n",
+                   bp->b_rawblkno, sc->sc_sf->csd.capacity);
+               bp->b_error = EINVAL;
                bp->b_resid = bp->b_bcount;
+               s = splbio();
                lddone(&sc->sc_ld, bp);
+               splx(s);
                return;
        }
 
@@ -229,14 +232,14 @@
        if (error) {
                DPRINTF(("%s: error %d\n", device_xname(sc->sc_ld.sc_dv),
                    error));
-               bp->b_error = EIO;      /* XXXX */
+               bp->b_error = error;
                bp->b_resid = bp->b_bcount;
        } else {
                bp->b_resid = 0;
        }
-       splx(s);
 
        lddone(&sc->sc_ld, bp);
+       splx(s);
 }
 
 static void
@@ -255,9 +258,11 @@
        bp->b_error = EIO;      /* XXXX */
        bp->b_resid = bp->b_bcount;
        sdmmc_del_task(&task->task);
-       splx(s);
+
+       aprint_error_dev(sc->sc_ld.sc_dv, "task timeout");
 
        lddone(&sc->sc_ld, bp);
+       splx(s);
 }
 
 static int
diff -r 295d0281d4d7 -r 6731ba6e3bd8 sys/dev/sdmmc/sdmmc.c
--- a/sys/dev/sdmmc/sdmmc.c     Mon May 25 09:24:37 2015 +0000
+++ b/sys/dev/sdmmc/sdmmc.c     Tue May 26 01:29:53 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmc.c,v 1.22.4.2 2015/03/09 09:29:33 snj Exp $       */
+/*     $NetBSD: sdmmc.c,v 1.22.4.3 2015/05/26 01:29:53 msaitoh Exp $   */
 /*     $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $  */
 
 /*
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.22.4.2 2015/03/09 09:29:33 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.22.4.3 2015/05/26 01:29:53 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -217,7 +217,7 @@
 {
        struct sdmmc_softc *sc = device_private(dev);
 
-       if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
+       if (kthread_create(PRI_BIO, 0, NULL,
            sdmmc_task_thread, sc, &sc->sc_tskq_lwp, "%s", device_xname(dev))) {
                aprint_error_dev(dev, "couldn't create task thread\n");
        }



Home | Main Index | Thread Index | Old Index