Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Fix queue handling to make the watchdog...
details: https://anonhg.NetBSD.org/src/rev/d7d29b6060ae
branches: trunk
changeset: 806382:d7d29b6060ae
user: nakayama <nakayama%NetBSD.org@localhost>
date: Sat Feb 21 07:40:01 2015 +0000
description:
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 984b0a45c01b -r d7d29b6060ae sys/arch/sparc64/dev/lom.c
--- a/sys/arch/sparc64/dev/lom.c Sat Feb 21 07:36:59 2015 +0000
+++ b/sys/arch/sparc64/dev/lom.c Sat Feb 21 07:40:01 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.14 2015/02/21 07:40:01 nakayama 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.14 2015/02/21 07:40:01 nakayama 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