Module Name: src Committed By: jdolecek Date: Thu Oct 19 20:45:07 UTC 2017
Modified Files: src/sys/dev/ata: ata.c ata_subr.c wd.c Log Message: more detailed debug info; also sync DEBUG_* values in wd.c with ata.c To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 src/sys/dev/ata/ata.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ata/ata_subr.c cvs rdiff -u -r1.432 -r1.433 src/sys/dev/ata/wd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ata/ata.c diff -u src/sys/dev/ata/ata.c:1.138 src/sys/dev/ata/ata.c:1.139 --- src/sys/dev/ata/ata.c:1.138 Wed Oct 18 08:38:35 2017 +++ src/sys/dev/ata/ata.c Thu Oct 19 20:45:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.138 2017/10/18 08:38:35 jdolecek Exp $ */ +/* $NetBSD: ata.c,v 1.139 2017/10/19 20:45:07 jdolecek Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.138 2017/10/18 08:38:35 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.139 2017/10/19 20:45:07 jdolecek Exp $"); #include "opt_ata.h" @@ -1132,15 +1132,15 @@ atastart(struct ata_channel *chp) again: KASSERT(chq->queue_active <= chq->queue_openings); if (chq->queue_active == chq->queue_openings) { - ATADEBUG_PRINT(("%s: channel completely busy\n", __func__), - DEBUG_XFERS); + ATADEBUG_PRINT(("%s(chp=%p): channel %d completely busy\n", + __func__, chp, chp->ch_channel), DEBUG_XFERS); goto out; } /* is there a xfer ? */ if ((xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer)) == NULL) { - ATADEBUG_PRINT(("%s: queue_xfer is empty\n", __func__), - DEBUG_XFERS); + ATADEBUG_PRINT(("%s(chp=%p): channel %d queue_xfer is empty\n", + __func__, chp, chp->ch_channel), DEBUG_XFERS); goto out; } Index: src/sys/dev/ata/ata_subr.c diff -u src/sys/dev/ata/ata_subr.c:1.2 src/sys/dev/ata/ata_subr.c:1.3 --- src/sys/dev/ata/ata_subr.c:1.2 Tue Oct 17 18:52:50 2017 +++ src/sys/dev/ata/ata_subr.c Thu Oct 19 20:45:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ata_subr.c,v 1.2 2017/10/17 18:52:50 jdolecek Exp $ */ +/* $NetBSD: ata_subr.c,v 1.3 2017/10/19 20:45:07 jdolecek Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.2 2017/10/17 18:52:50 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.3 2017/10/19 20:45:07 jdolecek Exp $"); #include "opt_ata.h" @@ -248,8 +248,9 @@ ata_get_xfer_ext(struct ata_channel *chp uint32_t avail, slot, mask; int error; - ATADEBUG_PRINT(("%s: channel %d flags %x openings %d\n", - __func__, chp->ch_channel, flags, openings), + ATADEBUG_PRINT(("%s: channel %d fl 0x%x op %d qavail 0x%x qact %d", + __func__, chp->ch_channel, flags, openings, + chq->queue_xfers_avail, chq->queue_active), DEBUG_XFERS); ata_channel_lock(chp); @@ -307,6 +308,8 @@ retry: out: ata_channel_unlock(chp); + + ATADEBUG_PRINT((" xfer %p\n", xfer), DEBUG_XFERS); return xfer; } @@ -352,6 +355,11 @@ out: } ata_channel_unlock(chp); + + ATADEBUG_PRINT(("%s: channel %d xfer %p qavail 0x%x qact %d\n", + __func__, chp->ch_channel, xfer, chq->queue_xfers_avail, + chq->queue_active), + DEBUG_XFERS); } /* Index: src/sys/dev/ata/wd.c diff -u src/sys/dev/ata/wd.c:1.432 src/sys/dev/ata/wd.c:1.433 --- src/sys/dev/ata/wd.c:1.432 Sat Oct 14 13:20:32 2017 +++ src/sys/dev/ata/wd.c Thu Oct 19 20:45:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.432 2017/10/14 13:20:32 jdolecek Exp $ */ +/* $NetBSD: wd.c,v 1.433 2017/10/19 20:45:07 jdolecek Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -54,7 +54,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.432 2017/10/14 13:20:32 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.433 2017/10/19 20:45:07 jdolecek Exp $"); #include "opt_ata.h" #include "opt_wd.h" @@ -102,11 +102,10 @@ __KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.432 #define WDLABELDEV(dev) (MAKEWDDEV(major(dev), WDUNIT(dev), RAW_PART)) -#define DEBUG_INTR 0x01 -#define DEBUG_XFERS 0x02 -#define DEBUG_STATUS 0x04 #define DEBUG_FUNCS 0x08 #define DEBUG_PROBE 0x10 +#define DEBUG_DETACH 0x20 +#define DEBUG_XFERS 0x40 #ifdef ATADEBUG int wdcdebug_wd_mask = 0x0; #define ATADEBUG_PRINT(args, level) \ @@ -659,15 +658,21 @@ wdstart(device_t self) * once flush is pending, it will get handled as soon as xfer * is available. */ - if (ISSET(wd->sc_flags, WDF_FLUSH_PEND)) + if (ISSET(wd->sc_flags, WDF_FLUSH_PEND)) { + ATADEBUG_PRINT(("wdstart %s flush pend\n", + device_xname(wd->sc_dev)), DEBUG_XFERS); goto out; + } while (bufq_peek(wd->sc_q) != NULL) { /* First try to get xfer. Limit to drive openings iff NCQ. */ xfer = ata_get_xfer_ext(wd->drvp->chnl_softc, 0, WD_USE_NCQ(wd) ? WD_MAX_OPENINGS(wd) : 0); - if (xfer == NULL) + if (xfer == NULL) { + ATADEBUG_PRINT(("wdstart %s no xfer\n", + device_xname(wd->sc_dev)), DEBUG_XFERS); break; + } /* There is got to be a buf for us */ bp = bufq_get(wd->sc_q);