diff --git a/sys/arch/arm26/arm26/db_interface.c b/sys/arch/arm26/arm26/db_interface.c index 87f173414582..d6962d528024 100644 --- a/sys/arch/arm26/arm26/db_interface.c +++ b/sys/arch/arm26/arm26/db_interface.c @@ -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 @@ db_write_bytes(addr, size, data) 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 --git a/sys/arch/arm26/arm26/db_machdep.c b/sys/arch/arm26/arm26/db_machdep.c index 3168987c005c..742767eff57e 100644 --- a/sys/arch/arm26/arm26/db_machdep.c +++ b/sys/arch/arm26/arm26/db_machdep.c @@ -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 #include +#include #include #include @@ -112,3 +113,13 @@ db_bus_write_cmd(addr, have_addr, count, modif) 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 --git a/sys/arch/arm26/arm26/irq.c b/sys/arch/arm26/arm26/irq.c index 1e11c35319cb..fd87728f6794 100644 --- a/sys/arch/arm26/arm26/irq.c +++ b/sys/arch/arm26/arm26/irq.c @@ -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 -__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 #include /* for cold */ @@ -52,9 +52,13 @@ __RCSID("$NetBSD: irq.c,v 1.8 2001/01/07 15:56:01 bjh21 Exp $"); #include #include +#include "opt_ddb.h" #include "ioeb.h" #include "unixbp.h" +#ifdef DDB +#include +#endif #if NIOEB > 0 #include #endif @@ -91,7 +95,7 @@ struct irq_handler { int irqnum; int ipl; int enabled; - char const *name; + struct evcnt ev; }; volatile static int current_spl = IPL_HIGH; @@ -160,6 +164,7 @@ irq_handler(struct irqframe *irqf) 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 @@ irq_establish(int irqnum, int ipl, int (*func)(void *), void *arg, 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 @@ hardsplx(int s) 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 --git a/sys/arch/arm26/include/irq.h b/sys/arch/arm26/include/irq.h index 6d02e19afa83..e151664922d5 100644 --- a/sys/arch/arm26/include/irq.h +++ b/sys/arch/arm26/include/irq.h @@ -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 char const *irq_string(struct irq_handler *); 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