From 0e39bbc4dd2ae38d35a37cd8f1d498d4bc473668 Mon Sep 17 00:00:00 2001 From: Randall Stewart Date: Wed, 23 Dec 2009 14:55:33 +0000 Subject: [PATCH] Add missing function that doesintr naming and init. --- sys/mips/rmi/intr_machdep.c | 41 ++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/sys/mips/rmi/intr_machdep.c b/sys/mips/rmi/intr_machdep.c index 07a9dab76f9b..dc34fda9c7c1 100644 --- a/sys/mips/rmi/intr_machdep.c +++ b/sys/mips/rmi/intr_machdep.c @@ -50,8 +50,9 @@ __FBSDID("$FreeBSD$"); #include /*#include */ - +static mips_intrcnt_t mips_intr_counters[XLR_MAX_INTR]; struct mips_intrhand mips_intr_handlers[XLR_MAX_INTR]; +static int intrcnt_index; static void mips_mask_hard_irq(void *source) @@ -113,8 +114,6 @@ cpu_establish_softintr(const char *name, driver_filter_t * filt, cpu_establish_hardintr(name, filt, handler, arg, irq, flags, cookiep); } - - void cpu_intr(struct trapframe *tf) { @@ -180,3 +179,39 @@ cpu_intr(struct trapframe *tf) } critical_exit(); } + +void +mips_intrcnt_setname(mips_intrcnt_t counter, const char *name) +{ + int idx = counter - intrcnt; + + KASSERT(counter != NULL, ("mips_intrcnt_setname: NULL counter")); + + snprintf(intrnames + (MAXCOMLEN + 1) * idx, + MAXCOMLEN + 1, "%-*s", MAXCOMLEN, name); +} + +mips_intrcnt_t +mips_intrcnt_create(const char* name) +{ + mips_intrcnt_t counter = &intrcnt[intrcnt_index++]; + + mips_intrcnt_setname(counter, name); + return counter; +} + +void +cpu_init_interrupts() +{ + int i; + char name[MAXCOMLEN + 1]; + + /* + * Initialize all available vectors so spare IRQ + * would show up in systat output + */ + for (i = 0; i < XLR_MAX_INTR; i++) { + snprintf(name, MAXCOMLEN + 1, "int%d:", i); + mips_intr_counters[i] = mips_intrcnt_create(name); + } +}