Add facilities for counting interrupts, and a "machine irqstat" command to
DDB to tell us what's going on.
This commit is contained in:
parent
dc084200cc
commit
d6bd1012e3
|
@ -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 }
|
||||
};
|
||||
|
|
|
@ -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_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);
|
||||
}
|
||||
|
|
|
@ -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 @@ __RCSID("$NetBSD: irq.c,v 1.8 2001/01/07 15:56:01 bjh21 Exp $");
|
|||
#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 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue