Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm26 Add facilities for counting interrupts, and a...



details:   https://anonhg.NetBSD.org/src/rev/b25ce41b7a51
branches:  trunk
changeset: 501794:b25ce41b7a51
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sun Jan 07 17:01:53 2001 +0000

description:
Add facilities for counting interrupts, and a "machine irqstat" command to
DDB to tell us what's going on.

diffstat:

 sys/arch/arm26/arm26/db_interface.c |   4 +++-
 sys/arch/arm26/arm26/db_machdep.c   |  13 ++++++++++++-
 sys/arch/arm26/arm26/irq.c          |  36 +++++++++++++++++++++++++++++++-----
 sys/arch/arm26/include/irq.h        |   3 ++-
 4 files changed, 48 insertions(+), 8 deletions(-)

diffs (155 lines):

diff -r e96730afc06d -r b25ce41b7a51 sys/arch/arm26/arm26/db_interface.c
--- a/sys/arch/arm26/arm26/db_interface.c       Sun Jan 07 16:01:10 2001 +0000
+++ b/sys/arch/arm26/arm26/db_interface.c       Sun Jan 07 17:01:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.4 2000/12/23 15:18:34 bjh21 Exp $   */
+/*     $NetBSD: db_interface.c,v 1.5 2001/01/07 17:01:53 bjh21 Exp $   */
 
 /* 
  * Copyright (c) 1996 Scott K. Stevens
@@ -206,10 +206,12 @@
 void db_show_panic_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
 void db_show_frame_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
 void db_bus_write_cmd  __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
+void db_irqstat_cmd    __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
 
 struct db_command arm26_db_command_table[] = {
        { "bsw",        db_bus_write_cmd,       CS_MORE, NULL },
        { "frame",      db_show_frame_cmd,      0, NULL },
+       { "irqstat",    db_irqstat_cmd,         0, NULL },
        { "panic",      db_show_panic_cmd,      0, NULL },
        { NULL,         NULL,                   0, NULL }
 };
diff -r e96730afc06d -r b25ce41b7a51 sys/arch/arm26/arm26/db_machdep.c
--- a/sys/arch/arm26/arm26/db_machdep.c Sun Jan 07 16:01:10 2001 +0000
+++ b/sys/arch/arm26/arm26/db_machdep.c Sun Jan 07 17:01:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.c,v 1.3 2000/12/23 15:18:34 bjh21 Exp $     */
+/*     $NetBSD: db_machdep.c,v 1.4 2001/01/07 17:01:53 bjh21 Exp $     */
 
 /* 
  * Copyright (c) 1996 Mark Brinicombe
@@ -33,6 +33,7 @@
 
 #include <machine/bus.h>
 #include <machine/db_machdep.h>
+#include <machine/irq.h>
 
 #include <ddb/db_access.h>
 #include <ddb/db_sym.h>
@@ -112,3 +113,13 @@
        db_skip_to_eol();
 }
 
+void
+db_irqstat_cmd(addr, have_addr, count, modif)
+       db_expr_t       addr;
+       int             have_addr;
+       db_expr_t       count;
+       char            *modif;
+{
+
+       irq_stat(db_printf);
+}
diff -r e96730afc06d -r b25ce41b7a51 sys/arch/arm26/arm26/irq.c
--- a/sys/arch/arm26/arm26/irq.c        Sun Jan 07 16:01:10 2001 +0000
+++ b/sys/arch/arm26/arm26/irq.c        Sun Jan 07 17:01:53 2001 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: irq.c,v 1.8 2001/01/07 15:56:01 bjh21 Exp $ */
+/* $NetBSD: irq.c,v 1.9 2001/01/07 17:01:54 bjh21 Exp $ */
 
 /*-
- * Copyright (c) 2000 Ben Harris
+ * Copyright (c) 2000, 2001 Ben Harris
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
 
 #include <sys/param.h>
 
-__RCSID("$NetBSD: irq.c,v 1.8 2001/01/07 15:56:01 bjh21 Exp $");
+__RCSID("$NetBSD: irq.c,v 1.9 2001/01/07 17:01:54 bjh21 Exp $");
 
 #include <sys/device.h>
 #include <sys/kernel.h> /* for cold */
@@ -52,9 +52,13 @@
 #include <arch/arm26/iobus/iocreg.h>
 #include <arch/arm26/iobus/iocvar.h>
 
+#include "opt_ddb.h"
 #include "ioeb.h"
 #include "unixbp.h"
 
+#ifdef DDB
+#include <ddb/db_output.h>
+#endif
 #if NIOEB > 0
 #include <arch/arm26/ioc/ioebvar.h>
 #endif
@@ -91,7 +95,7 @@
        int     irqnum;
        int     ipl;
        int     enabled;
-       char    const *name;
+       struct  evcnt ev;
 };
 
 volatile static int current_spl = IPL_HIGH;
@@ -160,6 +164,7 @@
                                result = (h->func)(h->arg);
                        if (result == IRQ_HANDLED) {
                                stray = 0;
+                               h->ev.ev_count++;
                                break; /* XXX handle others? */
                        }
                        if (result == IRQ_MAYBE_HANDLED)
@@ -200,7 +205,7 @@
        new->ipl = ipl;
        new->func = func;
        new->arg = arg;
-       new->name = name;
+       evcnt_attach_dynamic(&new->ev, EVCNT_TYPE_INTR, NULL, "irq", name);
        new->enabled = 1;
        if (irq_list_head.lh_first == NULL ||
            irq_list_head.lh_first->ipl <= ipl)
@@ -319,3 +324,24 @@
        current_spl = s;
        return was; /* Restore interrupt state */
 }
+
+#ifdef DDB
+void
+irq_stat(void (*pr)(const char *, ...))
+{
+       struct irq_handler *h;
+       int i;
+       u_int32_t last;
+
+       for (h = irq_list_head.lh_first; h != NULL; h = h->link.le_next)
+               (*pr)("%12s: ipl %2d, IRQ %2d, mask 0x%05x, count %llu\n",
+                   h->ev.ev_name, h->ipl, h->irqnum, h->mask, h->ev.ev_count);
+       (*pr)("\n");
+       last = -1;
+       for (i = 0; i < NIPL; i++)
+               if (irqmask[i] != last) { 
+                       (*pr)("ipl %2d: mask 0x%05x\n", i, irqmask[i]);
+                       last = irqmask[i];
+               }
+}
+#endif
diff -r e96730afc06d -r b25ce41b7a51 sys/arch/arm26/include/irq.h
--- a/sys/arch/arm26/include/irq.h      Sun Jan 07 16:01:10 2001 +0000
+++ b/sys/arch/arm26/include/irq.h      Sun Jan 07 17:01:53 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irq.h,v 1.6 2001/01/07 15:56:02 bjh21 Exp $ */
+/* $NetBSD: irq.h,v 1.7 2001/01/07 17:01:59 bjh21 Exp $ */
 /*-
  * Copyright (c) 2000 Ben Harris
  * All rights reserved.
@@ -74,4 +74,5 @@
 extern void irq_enable(struct irq_handler *);
 extern void irq_disable(struct irq_handler *);
 extern void irq_genmasks(void);
+extern void irq_stat(void (*)(const char *, ...));
 #endif



Home | Main Index | Thread Index | Old Index