Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/arch/sparc64/dev Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/52b1ea339813
branches:  netbsd-7
changeset: 799015:52b1ea339813
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Feb 21 18:28:13 2015 +0000

description:
Pull up following revision(s) (requested by nakayama in ticket #539):
        sys/arch/sparc64/dev/lom.c: revision 1.14
Fix queue handling to make the watchdog timer actually works on
netbsd-7 if it is configured by wdogctl=YES in rc.conf, and also
avoid a hangup duaring shutdown.
- don't put an entry which is already in the queue.
- read a first entry properly to handle the queue.
- check the lom status if input buffer is empty before writing.

diffstat:

 sys/arch/sparc64/dev/lom.c |  29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diffs (79 lines):

diff -r 8925ac8e5abb -r 52b1ea339813 sys/arch/sparc64/dev/lom.c
--- a/sys/arch/sparc64/dev/lom.c        Sat Feb 21 18:24:51 2015 +0000
+++ b/sys/arch/sparc64/dev/lom.c        Sat Feb 21 18:28:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lom.c,v 1.13 2014/02/25 18:30:08 pooka Exp $   */
+/*     $NetBSD: lom.c,v 1.13.4.1 2015/02/21 18:28:13 martin Exp $      */
 /*     $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $       */
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.13 2014/02/25 18:30:08 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.13.4.1 2015/02/21 18:28:13 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -600,7 +600,15 @@
 static void
 lom1_queue_cmd(struct lom_softc *sc, struct lom_cmd *lc)
 {
+       struct lom_cmd *lcp;
+
        mutex_enter(&sc->sc_queue_mtx);
+       TAILQ_FOREACH(lcp, &sc->sc_queue, lc_next) {
+               if (lcp == lc) {
+                       mutex_exit(&sc->sc_queue_mtx);
+                       return;
+               }
+       }
        TAILQ_INSERT_TAIL(&sc->sc_queue, lc, lc_next);
        if (sc->sc_state == LOM_STATE_IDLE) {
                sc->sc_state = LOM_STATE_CMD;
@@ -818,13 +826,21 @@
 static void
 lom2_queue_cmd(struct lom_softc *sc, struct lom_cmd *lc)
 {
+       struct lom_cmd *lcp;
        uint8_t str;
 
        mutex_enter(&sc->sc_queue_mtx);
+       TAILQ_FOREACH(lcp, &sc->sc_queue, lc_next) {
+               if (lcp == lc) {
+                       mutex_exit(&sc->sc_queue_mtx);
+                       return;
+               }
+       }
        TAILQ_INSERT_TAIL(&sc->sc_queue, lc, lc_next);
        if (sc->sc_state == LOM_STATE_IDLE) {
                str = bus_space_read_1(sc->sc_iot, sc->sc_ioh, LOM2_STATUS);
                if ((str & LOM2_STATUS_IBF) == 0) {
+                       lc = TAILQ_FIRST(&sc->sc_queue);
                        bus_space_write_1(sc->sc_iot, sc->sc_ioh,
                            LOM2_CMD, lc->lc_cmd);
                        sc->sc_state = LOM_STATE_DATA;
@@ -852,9 +868,11 @@
        }
 
        if (lc->lc_cmd & LOM_IDX_WRITE) {
-               bus_space_write_1(sc->sc_iot, sc->sc_ioh,
-                   LOM2_DATA, lc->lc_data);
-               lc->lc_cmd &= ~LOM_IDX_WRITE;
+               if ((str & LOM2_STATUS_IBF) == 0) {
+                       bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+                           LOM2_DATA, lc->lc_data);
+                       lc->lc_cmd &= ~LOM_IDX_WRITE;
+               }
                mutex_exit(&sc->sc_queue_mtx);
                return (1);
        }
@@ -871,6 +889,7 @@
        if (!TAILQ_EMPTY(&sc->sc_queue)) {
                str = bus_space_read_1(sc->sc_iot, sc->sc_ioh, LOM2_STATUS);
                if ((str & LOM2_STATUS_IBF) == 0) {
+                       lc = TAILQ_FIRST(&sc->sc_queue);
                        bus_space_write_1(sc->sc_iot, sc->sc_ioh,
                            LOM2_CMD, lc->lc_cmd);
                        sc->sc_state = LOM_STATE_DATA;



Home | Main Index | Thread Index | Old Index