Switch shark from intrcnt to evcnt

This commit is contained in:
matt 2007-02-20 01:51:16 +00:00
parent 562219389b
commit 2c6d199d35
5 changed files with 62 additions and 192 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: irqhandler.h,v 1.1 2002/02/10 01:57:23 thorpej Exp $ */
/* $NetBSD: irqhandler.h,v 1.2 2007/02/20 01:51:16 matt Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -45,6 +45,7 @@
#ifndef _LOCORE
#include <sys/types.h>
#include <sys/evcnt.h>
#endif /* _LOCORE */
/* Define the IRQ bits */
@ -127,11 +128,12 @@ typedef struct irqhandler {
void *ih_arg; /* Argument to handler */
int ih_level; /* Interrupt level */
int ih_num; /* Interrupt number (for accounting) */
const char *ih_name; /* Name of interrupt (for vmstat -i) */
u_int ih_flags; /* Interrupt flags */
u_int ih_maskaddr; /* mask address for expansion cards */
u_int ih_maskbits; /* interrupt bit for expansion cards */
struct irqhandler *ih_next; /* next handler */
struct evcnt ih_ev; /* evcnt structure */
char ih_evname[8]; /* name buffer */
} irqhandler_t;
#ifdef _KERNEL

View File

@ -1,4 +1,4 @@
/* $NetBSD: isa_irq.S,v 1.4 2005/12/11 12:19:02 christos Exp $ */
/* $NetBSD: isa_irq.S,v 1.5 2007/02/20 01:51:16 matt Exp $ */
/*
* Copyright 1997
@ -239,25 +239,16 @@ irqloop:
add r1, r1, #0x00000001
str r1, [r0, #(V_INTR)]
/*
* XXX: Should stats be accumlated for every interrupt routine called
* or for every physical interrupt that is serviced.
*/
#ifdef IRQSTATS
ldr r0, Lintrcnt
ldr r1, [r6, #(IH_NUM)]
add r0, r0, r1, lsl #2
ldr r1, [r0]
add r1, r1, #0x00000001
str r1, [r0]
#endif /* IRQSTATS */
irqchainloop:
ldr r0, [r6, #(IH_ARG)] /* Get argument pointer */
teq r0, #0x00000000 /* If arg is zero pass stack frame */
addeq r0, sp, #8 /* ... stack frame */
add r3, r6, #IH_EV_COUNT /* get address of ih's ev_count */
ldmia r3, {r1-r2} /* load ev_count */
adds r1, r1, #0x00000001 /* 64bit incr (lo) */
adc r2, r2, #0x00000000 /* 64bit incr (hi) */
stmia r3, {r1-r2} /* store ev_count */
mov lr, pc /* return address */
ldr pc, [r6, #(IH_FUNC)] /* Call handler */
@ -389,114 +380,8 @@ ENTRY(irq_setmasks)
Lcnt:
.word _C_LABEL(uvmexp)
Lintrcnt:
.word _C_LABEL(intrcnt)
Li8259_mask:
.word _C_LABEL(i8259_mask)
Lirqhandlers:
.word _C_LABEL(irqhandlers) /* Pointer to array of irqhandlers */
#ifdef IRQSTATS
/* These symbols are used by vmstat */
.text
.global _C_LABEL(_intrnames)
_C_LABEL(_intrnames):
.word _C_LABEL(intrnames)
.data
/* XXX fix */
.globl _C_LABEL(intrnames), _C_LABEL(eintrnames), _C_LABEL(intrcnt), _C_LABEL(sintrcnt), _C_LABEL(eintrcnt)
_C_LABEL(intrnames):
.asciz "interrupt 0 "
.asciz "interrupt 1 "
.asciz "interrupt 2 "
.asciz "interrupt 3 "
.asciz "interrupt 4 "
.asciz "interrupt 5 "
.asciz "interrupt 6 "
.asciz "interrupt 7 "
.asciz "interrupt 8 "
.asciz "interrupt 9 "
.asciz "interrupt 10 "
.asciz "interrupt 11 "
.asciz "interrupt 12 "
.asciz "interrupt 13 "
.asciz "interrupt 14 "
.asciz "interrupt 15 "
.asciz "interrupt 16 "
.asciz "interrupt 17 "
.asciz "interrupt 18 "
.asciz "interrupt 19 "
.asciz "interrupt 20 "
.asciz "interrupt 21 "
.asciz "interrupt 22 "
.asciz "interrupt 23 "
.asciz "interrupt 24 "
.asciz "interrupt 25 "
.asciz "interrupt 26 "
.asciz "interrupt 27 "
.asciz "interrupt 28 "
.asciz "interrupt 29 "
.asciz "interrupt 30 "
.asciz "interrupt 31 "
_C_LABEL(sintrnames):
.asciz "soft int 0 "
.asciz "soft int 1 "
.asciz "soft int 2 "
.asciz "soft int 3 "
.asciz "soft int 4 "
.asciz "soft int 5 "
.asciz "soft int 6 "
.asciz "soft int 7 "
.asciz "soft int 8 "
.asciz "soft int 9 "
.asciz "soft int 10 "
.asciz "soft int 11 "
.asciz "soft int 12 "
.asciz "soft int 13 "
.asciz "soft int 14 "
.asciz "soft int 15 "
.asciz "soft int 16 "
.asciz "soft int 17 "
.asciz "soft int 18 "
.asciz "soft int 19 "
.asciz "soft int 20 "
.asciz "soft int 21 "
.asciz "soft int 22 "
.asciz "soft int 23 "
.asciz "soft int 24 "
.asciz "soft int 25 "
.asciz "soft int 26 "
.asciz "soft int 27 "
.asciz "soft int 28 "
.asciz "soft int 29 "
.asciz "soft int 30 "
.asciz "soft int 31 "
_C_LABEL(eintrnames):
.bss
.align 0
_C_LABEL(intrcnt):
.space 32*4 /* XXX Should be linked to number of interrupts */
_C_LABEL(sintrcnt):
.space 32*4 /* XXX Should be linked to number of soft ints */
_C_LABEL(eintrcnt):
#else /* IRQSTATS */
/* Dummy entries to keep vmstat happy */
.text
.globl _C_LABEL(intrnames), _C_LABEL(eintrnames), _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
_C_LABEL(intrnames):
.long 0
_C_LABEL(eintrnames):
_C_LABEL(intrcnt):
.long 0
_C_LABEL(eintrcnt):
#endif /* IRQSTATS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: isa_irqhandler.c,v 1.11 2007/02/19 21:38:37 matt Exp $ */
/* $NetBSD: isa_irqhandler.c,v 1.12 2007/02/20 01:51:16 matt Exp $ */
/*
* Copyright 1997
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.11 2007/02/19 21:38:37 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.12 2007/02/20 01:51:16 matt Exp $");
#include "opt_irqstats.h"
@ -197,19 +197,6 @@ irq_claim(irq, handler)
*/
handler->ih_num = irq;
#ifdef IRQSTATS
/* Get the interrupt name from the head of the list */
if (handler->ih_name) {
char *ptr = _intrnames + (irq * 14);
strcpy(ptr, " ");
strncpy(ptr, handler->ih_name,
min(strlen(handler->ih_name), 13));
} else {
char *ptr = _intrnames + (irq * 14);
sprintf(ptr, "irq %2d ", irq);
}
#endif /* IRQSTATS */
irq_calculatemasks();
enable_irq(irq);
@ -231,9 +218,6 @@ irq_release(irq, handler)
{
irqhandler_t *irqhand;
irqhandler_t **prehand;
#ifdef IRQSTATS
extern char *_intrnames;
#endif
/*
* IRQ_INSTRUCT indicates that we should get the irq number
@ -268,19 +252,6 @@ irq_release(irq, handler)
if (irqhandlers[irq])
irqhandlers[irq]->ih_flags |= IRQ_FLAG_ACTIVE;
#ifdef IRQSTATS
/* Get the interrupt name from the head of the list */
if (irqhandlers[irq] && irqhandlers[irq]->ih_name) {
char *ptr = _intrnames + (irq * 14);
strcpy(ptr, " ");
strncpy(ptr, irqhandlers[irq]->ih_name,
min(strlen(irqhandlers[irq]->ih_name), 13));
} else {
char *ptr = _intrnames + (irq * 14);
sprintf(ptr, "irq %2d ", irq);
}
#endif /* IRQSTATS */
irq_calculatemasks();
/*
@ -370,18 +341,24 @@ intr_claim(irq, level, name, ih_func, ih_arg)
{
irqhandler_t *ih;
ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT);
ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT | M_ZERO);
if (!ih)
panic("intr_claim(): Cannot malloc handler memory");
ih->ih_level = level;
ih->ih_name = name;
ih->ih_func = ih_func;
ih->ih_arg = ih_arg;
ih->ih_flags = 0;
if (name == NULL) {
snprintf(ih->ih_evname, sizeof(ih->ih_evname), "irq %2d", irq);
name = ih->ih_evname;
}
evcnt_attach_dynamic(&ih->ih_ev, EVCNT_TYPE_INTR, NULL, NULL, name);
if (irq_claim(irq, ih) != 0)
if (irq_claim(irq, ih) != 0) {
evcnt_detach(&ih->ih_ev);
return(NULL);
}
return(ih);
}
@ -392,6 +369,7 @@ intr_release(arg)
irqhandler_t *ih = (irqhandler_t *)arg;
if (irq_release(ih->ih_num, ih) == 0) {
evcnt_detach(&ih->ih_ev);
free(ih, M_DEVBUF);
return(0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isa_shark_machdep.c,v 1.6 2005/12/11 12:19:02 christos Exp $ */
/* $NetBSD: isa_shark_machdep.c,v 1.7 2007/02/20 01:51:16 matt Exp $ */
/*
* Copyright 1997
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isa_shark_machdep.c,v 1.6 2005/12/11 12:19:02 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: isa_shark_machdep.c,v 1.7 2007/02/20 01:51:16 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -144,6 +144,8 @@ isa_init8259s(void)
const struct evcnt *
isa_intr_evcnt(isa_chipset_tag_t ic, int irq)
{
if (irqhandlers[irq] != NULL)
return &irqhandlers[irq]->ih_ev;
/* XXX for now, no evcnt parent reported */
return NULL;
@ -153,10 +155,10 @@ isa_intr_evcnt(isa_chipset_tag_t ic, int irq)
* Set up an interrupt handler to start being called.
*/
static const char * const isa_intr_names[16] = {
"isa intr 0", "isa intr 1", "isa intr 2", "isa intr 3",
"isa intr 4", "isa intr 5", "isa intr 6", "isa intr 7",
"isa intr 8", "isa intr 9", "isa intr 10", "isa intr 11",
"isa intr 12", "isa intr 13", "isa intr 14", "isa intr 15"
"irq 0", "irq 1", "irq 2", "irq 3",
"irq 4", "irq 5", "irq 6", "irq 7",
"irq 8", "irq 9", "irq 10", "irq 11",
"irq 12", "irq 13", "irq 14", "irq 15"
};
void *
@ -168,35 +170,37 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg)
int (*ih_fun) __P((void *));
void *ih_arg;
{
irqhandler_t *ih;
const char *name;
irqhandler_t *ih;
/* no point in sleeping unless someone can free memory. */
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
if (ih == NULL)
/* no point in sleeping unless someone can free memory. */
ih = malloc(sizeof *ih, M_DEVBUF, M_ZERO | (cold ? M_NOWAIT : M_WAITOK));
if (ih == NULL)
panic("isa_intr_establish: can't malloc handler info");
if (!LEGAL_IRQ(irq) || type == IST_NONE)
if (!LEGAL_IRQ(irq) || type == IST_NONE)
panic("intr_establish: bogus irq or type");
/* Note: sequoia doesn't allow configuration of edge vs. level
on an IRQ-by-IRQ basis. */
if (type != IST_LEVEL)
printf("WARNING: irq %d not level triggered\n", irq);
/* Note: sequoia doesn't allow configuration of edge vs. level
on an IRQ-by-IRQ basis. */
if (type != IST_LEVEL)
printf("WARNING: irq %d not level triggered\n", irq);
memset(ih, 0, sizeof *ih);
ih->ih_func = ih_fun;
ih->ih_arg = ih_arg;
ih->ih_level = level;
if (irq >= 0 &&
irq < (sizeof isa_intr_names / sizeof isa_intr_names[0]))
ih->ih_name = isa_intr_names[irq];
else
ih->ih_name = "isa intr";
ih->ih_func = ih_fun;
ih->ih_arg = ih_arg;
ih->ih_level = level;
if (irq >= 0 && irq < __arraycount(isa_intr_names)) {
name = isa_intr_names[irq];
} else {
snprintf(ih->ih_evname, sizeof(ih->ih_evname), "irq %2d", irq);
name = ih->ih_evname;
}
evcnt_attach_dynamic(&ih->ih_ev, EVCNT_TYPE_INTR, NULL, "isa", name);
if (irq_claim(irq, ih) == -1)
if (irq_claim(irq, ih) == -1)
panic("isa_intr_establish: can't install handler");
return (ih);
return (ih);
}
@ -208,21 +212,21 @@ isa_intr_disestablish(ic, arg)
isa_chipset_tag_t ic;
void *arg;
{
panic("isa_intr_disestablish");
panic("isa_intr_disestablish");
}
/* isa_init() might eventually become the ISA attach routine */
void
isa_init(vaddr_t isa_io_addr, vaddr_t isa_mem_addr)
{
/* initialize the bus space functions */
isa_io_init(isa_io_addr, isa_mem_addr);
/* initialize the bus space functions */
isa_io_init(isa_io_addr, isa_mem_addr);
/* Clear the IRQ/FIQ masks */
isa_init8259s();
/* Clear the IRQ/FIQ masks */
isa_init8259s();
/* Initialize the ISA interrupt handling code */
irq_init();
/* Initialize the ISA interrupt handling code */
irq_init();
}
void

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.1 2002/02/10 01:58:03 thorpej Exp $
# $NetBSD: genassym.cf,v 1.2 2007/02/20 01:51:16 matt Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@ -44,3 +44,4 @@ define IH_NUM offsetof(struct irqhandler, ih_num)
define IH_MASKADDR offsetof(struct irqhandler, ih_maskaddr)
define IH_MASKBITS offsetof(struct irqhandler, ih_maskbits)
define IH_NEXT offsetof(struct irqhandler, ih_next)
define IH_EV_COUNT offsetof(struct irqhandler, ih_ev.ev_count)