Add missing function that doesintr naming and

init.
This commit is contained in:
Randall Stewart 2009-12-23 14:55:33 +00:00
parent d0a679ea35
commit 0e39bbc4dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/mips/; revision=200901

View File

@ -50,8 +50,9 @@ __FBSDID("$FreeBSD$");
#include <mips/rmi/pic.h>
/*#include <machine/intrcnt.h>*/
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);
}
}