summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc64/include/intr.h8
-rw-r--r--sys/arch/sparc64/include/types.h3
-rw-r--r--sys/arch/sparc64/sparc64/clock.c11
-rw-r--r--sys/arch/sparc64/sparc64/genassym.cf1
-rw-r--r--sys/arch/sparc64/sparc64/intr.c7
-rw-r--r--sys/arch/sparc64/sparc64/locore.s40
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c10
7 files changed, 36 insertions, 44 deletions
diff --git a/sys/arch/sparc64/include/intr.h b/sys/arch/sparc64/include/intr.h
index d073d649b2e..539e41abc4c 100644
--- a/sys/arch/sparc64/include/intr.h
+++ b/sys/arch/sparc64/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.7 2004/06/23 01:17:01 aaron Exp $ */
+/* $OpenBSD: intr.h,v 1.8 2004/06/28 01:47:41 aaron Exp $ */
/* $NetBSD: intr.h,v 1.8 2001/01/14 23:50:30 thorpej Exp $ */
/*-
@@ -44,6 +44,8 @@
#include <sparc64/sparc64/intreg.h>
#endif
+#include <sys/evcount.h>
+
/*
* Interrupt handler chains. Interrupt handlers should return 0 for
* ``not me'' or 1 (``I took care of it''). intr_establish() inserts a
@@ -61,9 +63,9 @@ struct intrhand {
struct intrhand *ih_pending; /* pending list */
volatile u_int64_t *ih_map; /* interrupt map reg */
volatile u_int64_t *ih_clr; /* clear interrupt reg */
- u_int64_t ih_count; /* # of interrupts */
+ struct evcount ih_count; /* # of interrupts */
const void *ih_bus; /* parent bus */
- char ih_name[1]; /* device name */
+ char ih_name[32]; /* device name */
};
extern struct intrhand *intrlev[MAXINTNUM];
diff --git a/sys/arch/sparc64/include/types.h b/sys/arch/sparc64/include/types.h
index 22ab098fb4a..f89b648b667 100644
--- a/sys/arch/sparc64/include/types.h
+++ b/sys/arch/sparc64/include/types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: types.h,v 1.6 2003/06/02 23:27:56 millert Exp $ */
+/* $OpenBSD: types.h,v 1.7 2004/06/28 01:47:41 aaron Exp $ */
/* $NetBSD: types.h,v 1.17 2001/05/12 22:42:07 kleink Exp $ */
/*
@@ -68,5 +68,6 @@ typedef paddr_t psize_t;
#define __HAVE_NWSCONS
#define __HAVE_DEVICE_REGISTER
#define __HAVE_GENERIC_SOFT_INTERRUPTS
+#define __HAVE_EVCOUNT
#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c
index e6af667f323..874c71b4908 100644
--- a/sys/arch/sparc64/sparc64/clock.c
+++ b/sys/arch/sparc64/sparc64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.19 2004/04/08 01:11:22 deraadt Exp $ */
+/* $OpenBSD: clock.c,v 1.20 2004/06/28 01:47:41 aaron Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
@@ -552,11 +552,13 @@ timerattach(parent, self, aux)
level10.ih_number = ma->ma_interrupts[0];
level10.ih_clr = (void *)&timerreg_4u.t_clrintr[0];
level10.ih_map = (void *)&timerreg_4u.t_mapintr[0];
+ strlcpy(level10.ih_name, "clock", sizeof(level10.ih_name));
intr_establish(10, &level10);
level14.ih_number = ma->ma_interrupts[1];
level14.ih_clr = (void *)&timerreg_4u.t_clrintr[1];
level14.ih_map = (void *)&timerreg_4u.t_mapintr[1];
+ strlcpy(level14.ih_name, "prof", sizeof(level14.ih_name));
intr_establish(14, &level14);
printf(" irq vectors %lx and %lx",
@@ -674,6 +676,7 @@ cpu_initclocks()
* so we set the ih_number to 1.
*/
level0.ih_number = 1;
+ strlcpy(level0.ih_name, "clock", sizeof(level0.ih_name));
intr_establish(10, &level0);
/* We only have one timer so we have no statclock */
stathz = 0;
@@ -796,6 +799,8 @@ clockintr(cap)
lasttick = tick() & TICK_TICKS;
+ level10.ih_count.ec_count++;
+
return (1);
}
@@ -824,6 +829,7 @@ tickintr(cap)
lasttick &= TICK_TICKS;
/* Reset the interrupt */
next_tick(tick_increment);
+ level0.ih_count.ec_count++;
splx(s);
return (1);
@@ -867,6 +873,9 @@ statintr(cap)
send_softint(-1, PIL_SCHED, &schedint);
stxa((vaddr_t)&timerreg_4u.t_timer[1].t_limit, ASI_NUCLEUS,
tmr_ustolim(newint)|TMR_LIM_IEN|TMR_LIM_RELOAD);
+
+ level14.ih_count.ec_count++;
+
return (1);
}
diff --git a/sys/arch/sparc64/sparc64/genassym.cf b/sys/arch/sparc64/sparc64/genassym.cf
index a6fa20de01c..e7651df2d9d 100644
--- a/sys/arch/sparc64/sparc64/genassym.cf
+++ b/sys/arch/sparc64/sparc64/genassym.cf
@@ -241,6 +241,7 @@ member IH_PEND ih_pending
member ih_next
member ih_map
member ih_clr
+member IH_COUNT ih_count.ec_count
# mbuf fields of import
struct mbuf
diff --git a/sys/arch/sparc64/sparc64/intr.c b/sys/arch/sparc64/sparc64/intr.c
index 0f733452011..7d5c812bfdb 100644
--- a/sys/arch/sparc64/sparc64/intr.c
+++ b/sys/arch/sparc64/sparc64/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.21 2004/06/20 04:50:24 miod Exp $ */
+/* $OpenBSD: intr.c,v 1.22 2004/06/28 01:47:41 aaron Exp $ */
/* $NetBSD: intr.c,v 1.39 2001/07/19 23:38:11 eeh Exp $ */
/*
@@ -241,6 +241,11 @@ intr_establish(level, ih)
if (ih->ih_number <= 0 || ih->ih_number >= MAXINTNUM)
panic("intr_establish: bad intr number %x", ih->ih_number);
+ if (strlen(ih->ih_name) == 0)
+ evcount_attach(&ih->ih_count, "unknown", NULL, &evcount_intr);
+ else
+ evcount_attach(&ih->ih_count, ih->ih_name, NULL, &evcount_intr);
+
q = intrlev[ih->ih_number];
if (q == NULL) {
/* No interrupt already there, just put handler in place. */
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 61a536c8665..702ff3368c8 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.46 2004/06/20 04:30:34 aaron Exp $ */
+/* $OpenBSD: locore.s,v 1.47 2004/06/28 01:47:41 aaron Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -3309,18 +3309,11 @@ _C_LABEL(sparc_interrupt):
stx %fp, [%sp + CC64FSZ + BIAS + TF_KSTACK] ! old frame pointer
sub %l5, 0x40, %l6 ! Convert to interrupt level
- sethi %hi(_C_LABEL(intrcnt)), %l4
stb %l6, [%sp + CC64FSZ + BIAS + TF_PIL] ! set up intrframe/clockframe
rdpr %pil, %o1
- sll %l6, 2, %l3
- or %l4, %lo(_C_LABEL(intrcnt)), %l4 ! intrcnt[intlev]++;
stb %o1, [%sp + CC64FSZ + BIAS + TF_OLDPIL] ! old %pil
- ld [%l4 + %l3], %o0
- add %l4, %l3, %l4
clr %l5 ! Zero handled count
mov 1, %l3 ! Ack softint
- inc %o0
- st %o0, [%l4]
sll %l3, %l6, %l3 ! Generate IRQ mask
sethi %hi(_C_LABEL(handled_intr_level)), %l4
@@ -3386,7 +3379,10 @@ sparc_intr_retry:
brz,pn %l1, 0f
add %l5, %o0, %l5 ! Add handler return value
+ ldx [%l2 + IH_COUNT], %o0 ! ih->ih_count.ec_count++;
stx %g0, [%l1] ! Clear intr source
+ inc %o0
+ stx %o0, [%l2 + IH_COUNT]
0:
brnz,pn %l7, 2b ! 'Nother?
mov %l7, %l2
@@ -9517,34 +9513,14 @@ _C_LABEL(ssym):
_C_LABEL(proc0paddr):
.xword _C_LABEL(u0) ! KVA of proc0 uarea
-/* interrupt counters XXX THESE BELONG ELSEWHERE (if anywhere) */
+/* Some bogus data, to keep vmstat happy, for now. */
+ .globl _C_LABEL(intrnames), _C_LABEL(eintrnames)
.globl _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
- .globl _C_LABEL(intrnames), _C_LABEL(eintrnames)
- OTYPE(intrcnt)
- OTYPE(eintrcnt)
- OTYPE(intrnames)
- OTYPE(eintrnames)
_C_LABEL(intrnames):
- .asciz "spur"
- .asciz "lev1"
- .asciz "lev2"
- .asciz "lev3"
- .asciz "lev4"
- .asciz "lev5"
- .asciz "lev6"
- .asciz "lev7"
- .asciz "lev8"
- .asciz "lev9"
- .asciz "clock"
- .asciz "lev11"
- .asciz "lev12"
- .asciz "lev13"
- .asciz "prof"
- .asciz "lev15"
+ .long 0
_C_LABEL(eintrnames):
- _ALIGN
_C_LABEL(intrcnt):
- .space 16 * 4
+ .long 0
_C_LABEL(eintrcnt):
.comm _C_LABEL(nwindows), 4
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 39a65dd9ab4..81a8228d8c2 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.68 2004/06/23 04:40:05 aaron Exp $ */
+/* $OpenBSD: machdep.c,v 1.69 2004/06/28 01:47:41 aaron Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -1900,14 +1900,12 @@ bus_intr_allocate(bus_space_tag_t t, int (*handler)(void *), void *arg,
const char *what)
{
struct intrhand *ih;
- size_t namelen = strlen(what) + 1;
- ih = (struct intrhand *)
- malloc(sizeof(struct intrhand) + namelen - 1, M_DEVBUF, M_NOWAIT);
+ ih = (struct intrhand *)malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
if (ih == NULL)
return (NULL);
- memset(ih, 0, sizeof(struct intrhand) + namelen - 1);
+ memset(ih, 0, sizeof(struct intrhand));
ih->ih_fun = handler;
ih->ih_arg = arg;
@@ -1916,7 +1914,7 @@ bus_intr_allocate(bus_space_tag_t t, int (*handler)(void *), void *arg,
ih->ih_map = mapper;
ih->ih_clr = clearer;
ih->ih_bus = t;
- strlcpy(ih->ih_name, what, namelen);
+ strlcpy(ih->ih_name, what, sizeof(ih->ih_name));
return (ih);
}