summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2004-06-28 01:41:54 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2004-06-28 01:41:54 +0000
commit5ace53400392da2da58c82ee9fc7b5dde2f499df (patch)
tree728356b506a6044902844476ee2624df1ae444fc /sys
parentfb8afb0fc41ef3fe4cd5cc7bdb475fd4156c546f (diff)
Use new event counter API for interrupt counting on i386. deraadt@ tholo@
drahn@ millert@ ok
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/genassym.cf4
-rw-r--r--sys/arch/i386/i386/ioapic.c9
-rw-r--r--sys/arch/i386/i386/lapic.c10
-rw-r--r--sys/arch/i386/include/psl.h17
-rw-r--r--sys/arch/i386/include/types.h3
-rw-r--r--sys/arch/i386/isa/isa_machdep.c7
6 files changed, 31 insertions, 19 deletions
diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf
index cc5149eb722..e59ee379c90 100644
--- a/sys/arch/i386/i386/genassym.cf
+++ b/sys/arch/i386/i386/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.14 2004/06/13 21:49:15 niklas Exp $
+# $OpenBSD: genassym.cf,v 1.15 2004/06/28 01:41:52 aaron Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -172,7 +172,7 @@ if NISA > 0
struct intrhand
member ih_fun
member ih_arg
-member ih_count
+member IH_COUNT ih_count.ec_count32
member ih_next
endif
diff --git a/sys/arch/i386/i386/ioapic.c b/sys/arch/i386/i386/ioapic.c
index 6bcf6d8d840..0ec3795e0c4 100644
--- a/sys/arch/i386/i386/ioapic.c
+++ b/sys/arch/i386/i386/ioapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioapic.c,v 1.3 2004/06/23 17:14:31 niklas Exp $ */
+/* $OpenBSD: ioapic.c,v 1.4 2004/06/28 01:41:53 aaron Exp $ */
/* $NetBSD: ioapic.c,v 1.7 2003/07/14 22:32:40 lukem Exp $ */
/*-
@@ -596,7 +596,7 @@ ioapic_enable(void)
void *
apic_intr_establish(int irq, int type, int level, int (*ih_fun)(void *),
- void *ih_arg, char *what)
+ void *ih_arg, char *ih_what)
{
unsigned int ioapic = APIC_IRQ_APIC(irq);
unsigned int intr = APIC_IRQ_PIN(irq);
@@ -682,11 +682,11 @@ apic_intr_establish(int irq, int type, int level, int (*ih_fun)(void *),
*/
ih->ih_fun = ih_fun;
ih->ih_arg = ih_arg;
- ih->ih_count = 0;
ih->ih_next = NULL;
ih->ih_level = level;
ih->ih_irq = irq;
- ih->ih_what = what;
+ evcount_attach(&ih->ih_count, ih_what, (void *)&pin->ip_vector,
+ &evcount_intr);
*p = ih;
return (ih);
@@ -754,6 +754,7 @@ apic_intr_disestablish(void *arg)
if (!ioapic_cold)
apic_vectorset(sc, intr, minlevel, maxlevel);
+ evcount_detach(&ih->ih_count);
free(ih, M_DEVBUF);
}
diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c
index e0a9a60444d..bc58300a73b 100644
--- a/sys/arch/i386/i386/lapic.c
+++ b/sys/arch/i386/i386/lapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lapic.c,v 1.3 2004/06/14 00:06:32 deraadt Exp $ */
+/* $OpenBSD: lapic.c,v 1.4 2004/06/28 01:41:53 aaron Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
@@ -63,6 +63,8 @@
#include <i386/isa/timerreg.h> /* XXX for TIMER_FREQ */
+struct evcount clk_count;
+
void lapic_delay(int);
void lapic_microtime(struct timeval *);
static __inline u_int32_t lapic_gettick(void);
@@ -162,6 +164,8 @@ void
lapic_boot_init(lapic_base)
paddr_t lapic_base;
{
+ static int clk_irq = 0;
+
lapic_map(lapic_base);
#ifdef MULTIPROCESSOR
@@ -169,6 +173,8 @@ lapic_boot_init(lapic_base)
#endif
idt_vec_set(LAPIC_SPURIOUS_VECTOR, Xintrspurious);
idt_vec_set(LAPIC_TIMER_VECTOR, Xintrltimer);
+
+ evcount_attach(&clk_count, "clock", (void *)&clk_irq, &evcount_intr);
}
static __inline u_int32_t
@@ -197,6 +203,8 @@ lapic_clockintr(arg)
struct clockframe *frame = arg;
hardclock(frame);
+
+ clk_count.ec_count32++;
}
void
diff --git a/sys/arch/i386/include/psl.h b/sys/arch/i386/include/psl.h
index 7fa516a214c..27545225f3d 100644
--- a/sys/arch/i386/include/psl.h
+++ b/sys/arch/i386/include/psl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: psl.h,v 1.15 2004/02/02 23:02:42 deraadt Exp $ */
+/* $OpenBSD: psl.h,v 1.16 2004/06/28 01:41:53 aaron Exp $ */
/* $NetBSD: psl.h,v 1.30 1996/05/13 01:28:05 mycroft Exp $ */
/*-
@@ -75,19 +75,20 @@
#ifndef _LOCORE
+#include <sys/evcount.h>
+
/*
* Interrupt handler chains. isa_intr_establish() inserts a handler into
* the list. The handler is called with its (single) argument.
*/
struct intrhand {
- int (*ih_fun)(void *);
- void *ih_arg;
- u_long ih_count;
- struct intrhand *ih_next;
- int ih_level;
- int ih_irq;
- char *ih_what;
+ int (*ih_fun)(void *);
+ void *ih_arg;
+ struct intrhand *ih_next;
+ int ih_level;
+ int ih_irq;
+ struct evcount ih_count;
};
#endif /* _LOCORE */
diff --git a/sys/arch/i386/include/types.h b/sys/arch/i386/include/types.h
index 53f8a187136..7262847c9cc 100644
--- a/sys/arch/i386/include/types.h
+++ b/sys/arch/i386/include/types.h
@@ -1,5 +1,5 @@
/* $NetBSD: types.h,v 1.12 1995/12/24 01:08:03 mycroft Exp $ */
-/* $OpenBSD: types.h,v 1.14 2004/06/13 21:49:16 niklas Exp $ */
+/* $OpenBSD: types.h,v 1.15 2004/06/28 01:41:53 aaron Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -72,6 +72,7 @@ typedef unsigned long long uint64_t;
typedef int32_t register_t;
#define __HAVE_NWSCONS
+#define __HAVE_EVCOUNT
#define __HAVE_CPUINFO
#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c
index 0df077cdb19..1346d76882a 100644
--- a/sys/arch/i386/isa/isa_machdep.c
+++ b/sys/arch/i386/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.49 2004/06/13 21:49:16 niklas Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.50 2004/06/28 01:41:53 aaron Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -618,11 +618,11 @@ isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
*/
ih->ih_fun = ih_fun;
ih->ih_arg = ih_arg;
- ih->ih_count = 0;
ih->ih_next = NULL;
ih->ih_level = level;
ih->ih_irq = irq;
- ih->ih_what = ih_what;
+ evcount_attach(&ih->ih_count, ih_what, (void *)&ih->ih_irq,
+ &evcount_intr);
*p = ih;
return (ih);
@@ -660,6 +660,7 @@ isa_intr_disestablish(ic, arg)
*p = q->ih_next;
else
panic("intr_disestablish: handler not registered");
+ evcount_detach(&ih->ih_count);
free(ih, M_DEVBUF);
intr_calculatemasks();