Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata add wddebug() which dumps some status for attach...



details:   https://anonhg.NetBSD.org/src/rev/2b3786583629
branches:  trunk
changeset: 365215:2b3786583629
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Aug 06 20:07:05 2018 +0000

description:
add wddebug() which dumps some status for attached disks; indended for
debugging of PR kern/52783

diffstat:

 sys/dev/ata/ata_subr.c |  32 ++++++++++++++++++++++++++++++--
 sys/dev/ata/atavar.h   |   6 +++++-
 sys/dev/ata/wd.c       |  27 +++++++++++++++++++++++++--
 3 files changed, 60 insertions(+), 5 deletions(-)

diffs (115 lines):

diff -r 6d766ee4089d -r 2b3786583629 sys/dev/ata/ata_subr.c
--- a/sys/dev/ata/ata_subr.c    Mon Aug 06 20:05:26 2018 +0000
+++ b/sys/dev/ata/ata_subr.c    Mon Aug 06 20:07:05 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata_subr.c,v 1.4 2017/10/20 07:06:07 jdolecek Exp $    */
+/*     $NetBSD: ata_subr.c,v 1.5 2018/08/06 20:07:05 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.4 2017/10/20 07:06:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.5 2018/08/06 20:07:05 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -436,3 +436,31 @@
 {
        KASSERT(mutex_owned(&chp->ch_lock));
 }
+
+#ifdef ATADEBUG
+void
+atachannel_debug(struct ata_channel *chp)
+{
+       struct ata_queue *chq = chp->ch_queue;
+
+       printf("  ch %s flags 0x%x ndrives %d\n",
+           device_xname(chp->atabus), chp->ch_flags, chp->ch_ndrives);
+       printf("  que: flags 0x%x avail 0x%x used 0x%x\n",
+           chq->queue_flags, chq->queue_xfers_avail, chq->active_xfers_used);
+       printf("        act %d freez %d open %u\n",
+           chq->queue_active, chq->queue_freeze, chq->queue_openings);
+
+#if 0
+       printf("  xfers:\n");
+       for(int i=0; i < chq->queue_openings; i++) {
+               struct ata_xfer *xfer = &chq->queue_xfers[i];
+
+               printf("    #%d sl %d drv %d retr %d fl %x",
+                   i, xfer->c_slot, xfer->c_drive, xfer->c_retries,
+                   xfer->c_flags);
+               printf(" data %p bcount %d skip %d\n",
+                   xfer->c_databuf, xfer->c_bcount, xfer->c_skip);
+       }
+#endif
+}
+#endif /* ATADEBUG */
diff -r 6d766ee4089d -r 2b3786583629 sys/dev/ata/atavar.h
--- a/sys/dev/ata/atavar.h      Mon Aug 06 20:05:26 2018 +0000
+++ b/sys/dev/ata/atavar.h      Mon Aug 06 20:07:05 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atavar.h,v 1.97 2018/06/01 18:13:30 macallan Exp $     */
+/*     $NetBSD: atavar.h,v 1.98 2018/08/06 20:07:05 jdolecek Exp $     */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -575,6 +575,10 @@
 void   atacmd_toncq(struct ata_xfer *, uint8_t *, uint16_t *, uint16_t *,
            uint8_t *);
 
+#ifdef ATADEBUG
+void   atachannel_debug(struct ata_channel *);
+#endif
+
 #endif /* _KERNEL */
 
 #endif /* _DEV_ATA_ATAVAR_H_ */
diff -r 6d766ee4089d -r 2b3786583629 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Mon Aug 06 20:05:26 2018 +0000
+++ b/sys/dev/ata/wd.c  Mon Aug 06 20:07:05 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.439 2018/06/03 18:38:35 jdolecek Exp $ */
+/*     $NetBSD: wd.c,v 1.440 2018/08/06 20:07:05 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.439 2018/06/03 18:38:35 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.440 2018/08/06 20:07:05 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -2162,3 +2162,26 @@
        sysctl_teardown(&wd->nodelog);
 }
 
+#ifdef ATADEBUG
+int wddebug(void);
+
+int
+wddebug(void)
+{
+       struct wd_softc *wd;
+         struct dk_softc *dksc;
+         int unit;
+
+         for (unit = 0; unit <= 3; unit++) {
+                   wd = device_lookup_private(&wd_cd, unit);
+                   if (wd == NULL)
+                               continue;
+                   dksc = &wd->sc_dksc;
+               printf("%s fl %x bufq %p:\n",
+                   dksc->sc_xname, wd->sc_flags, bufq_peek(dksc->sc_bufq));
+
+               atachannel_debug(wd->drvp->chnl_softc);
+       }
+       return 0;
+}
+#endif /* ATADEBUG */



Home | Main Index | Thread Index | Old Index