diff options
author | tmm <tmm@FreeBSD.org> | 2001-06-01 13:23:28 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2001-06-01 13:23:28 +0000 |
commit | 9ce8a6234736b0446ecc22b1092f693c658a25be (patch) | |
tree | dfa10a376890935609a85e9cf3ff54855c2ff66c /sys | |
parent | 831472121170bbeebce019cd7be85fb15d34bd31 (diff) | |
download | FreeBSD-src-9ce8a6234736b0446ecc22b1092f693c658a25be.zip FreeBSD-src-9ce8a6234736b0446ecc22b1092f693c658a25be.tar.gz |
Clean up the code exporting interrupt statistics via sysctl a bit:
- move the sysctl code to kern_intr.c
- do not use INTRCNT_COUNT, but rather eintrcnt - intrcnt to determine
the length of the intrcnt array
- move the declarations of intrnames, eintrnames, intrcnt and eintrcnt
from machine-dependent include files to sys/interrupt.h
- remove the hw.nintr sysctl, it is not needed.
- fix various style bugs
Requested by: bde
Reviewed by: bde (some time ago)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/include/intrcnt.h | 8 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 1 | ||||
-rw-r--r-- | sys/amd64/isa/icu.h | 2 | ||||
-rw-r--r-- | sys/amd64/isa/intr_machdep.c | 1 | ||||
-rw-r--r-- | sys/amd64/isa/nmi.c | 1 | ||||
-rw-r--r-- | sys/amd64/isa/vector.S | 2 | ||||
-rw-r--r-- | sys/amd64/isa/vector.s | 2 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 1 | ||||
-rw-r--r-- | sys/i386/isa/icu.h | 2 | ||||
-rw-r--r-- | sys/i386/isa/intr_machdep.c | 1 | ||||
-rw-r--r-- | sys/i386/isa/nmi.c | 1 | ||||
-rw-r--r-- | sys/i386/isa/vector.s | 2 | ||||
-rw-r--r-- | sys/ia64/include/intrcnt.h | 8 | ||||
-rw-r--r-- | sys/kern/kern_intr.c | 30 | ||||
-rw-r--r-- | sys/sys/interrupt.h | 6 | ||||
-rw-r--r-- | sys/vm/vm_meter.c | 30 |
16 files changed, 40 insertions, 58 deletions
diff --git a/sys/alpha/include/intrcnt.h b/sys/alpha/include/intrcnt.h index 5d2ce0b..4f7dcf4 100644 --- a/sys/alpha/include/intrcnt.h +++ b/sys/alpha/include/intrcnt.h @@ -71,11 +71,3 @@ # define INTRCNT_KN300_NCR810 INTRCNT_KN300_IRQ + 16 # define INTRCNT_KN300_I2C_CTRL INTRCNT_KN300_IRQ + 17 # define INTRCNT_KN300_I2C_BUS INTRCNT_KN300_IRQ + 18 - -#ifdef _KERNEL -#ifndef _LOCORE -extern volatile long intrcnt[]; -extern char intrnames[]; -extern char eintrnames[]; -#endif -#endif diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index e02569c1..7fdb9be 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -103,7 +103,6 @@ #include <machine/pc/bios.h> #include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */ #include <machine/globals.h> -#include <machine/intrcnt.h> #ifdef PERFMON #include <machine/perfmon.h> #endif diff --git a/sys/amd64/isa/icu.h b/sys/amd64/isa/icu.h index 0176541..3a7390c 100644 --- a/sys/amd64/isa/icu.h +++ b/sys/amd64/isa/icu.h @@ -126,4 +126,6 @@ extern unsigned imen; /* interrupt mask enable */ #endif /* APIC_IO */ +#define INTRCNT_COUNT (1 + ICU_LEN + 2 * ICU_LEN) + #endif /* !_I386_ISA_ICU_H_ */ diff --git a/sys/amd64/isa/intr_machdep.c b/sys/amd64/isa/intr_machdep.c index 7eb99a6..503163f 100644 --- a/sys/amd64/isa/intr_machdep.c +++ b/sys/amd64/isa/intr_machdep.c @@ -58,7 +58,6 @@ #include <machine/md_var.h> #include <machine/segments.h> -#include <machine/intrcnt.h> #if defined(APIC_IO) #include <machine/smptests.h> /** FAST_HI */ diff --git a/sys/amd64/isa/nmi.c b/sys/amd64/isa/nmi.c index 7eb99a6..503163f 100644 --- a/sys/amd64/isa/nmi.c +++ b/sys/amd64/isa/nmi.c @@ -58,7 +58,6 @@ #include <machine/md_var.h> #include <machine/segments.h> -#include <machine/intrcnt.h> #if defined(APIC_IO) #include <machine/smptests.h> /** FAST_HI */ diff --git a/sys/amd64/isa/vector.S b/sys/amd64/isa/vector.S index 981b858..d3b7a89 100644 --- a/sys/amd64/isa/vector.S +++ b/sys/amd64/isa/vector.S @@ -16,8 +16,6 @@ #include <i386/isa/isa.h> #endif -#include <machine/intrcnt.h> - #define FAST_INTR_HANDLER_USES_ES 1 #ifdef FAST_INTR_HANDLER_USES_ES #define ACTUALLY_PUSHED 1 diff --git a/sys/amd64/isa/vector.s b/sys/amd64/isa/vector.s index 981b858..d3b7a89 100644 --- a/sys/amd64/isa/vector.s +++ b/sys/amd64/isa/vector.s @@ -16,8 +16,6 @@ #include <i386/isa/isa.h> #endif -#include <machine/intrcnt.h> - #define FAST_INTR_HANDLER_USES_ES 1 #ifdef FAST_INTR_HANDLER_USES_ES #define ACTUALLY_PUSHED 1 diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index e02569c1..7fdb9be 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -103,7 +103,6 @@ #include <machine/pc/bios.h> #include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */ #include <machine/globals.h> -#include <machine/intrcnt.h> #ifdef PERFMON #include <machine/perfmon.h> #endif diff --git a/sys/i386/isa/icu.h b/sys/i386/isa/icu.h index 0176541..3a7390c 100644 --- a/sys/i386/isa/icu.h +++ b/sys/i386/isa/icu.h @@ -126,4 +126,6 @@ extern unsigned imen; /* interrupt mask enable */ #endif /* APIC_IO */ +#define INTRCNT_COUNT (1 + ICU_LEN + 2 * ICU_LEN) + #endif /* !_I386_ISA_ICU_H_ */ diff --git a/sys/i386/isa/intr_machdep.c b/sys/i386/isa/intr_machdep.c index 7eb99a6..503163f 100644 --- a/sys/i386/isa/intr_machdep.c +++ b/sys/i386/isa/intr_machdep.c @@ -58,7 +58,6 @@ #include <machine/md_var.h> #include <machine/segments.h> -#include <machine/intrcnt.h> #if defined(APIC_IO) #include <machine/smptests.h> /** FAST_HI */ diff --git a/sys/i386/isa/nmi.c b/sys/i386/isa/nmi.c index 7eb99a6..503163f 100644 --- a/sys/i386/isa/nmi.c +++ b/sys/i386/isa/nmi.c @@ -58,7 +58,6 @@ #include <machine/md_var.h> #include <machine/segments.h> -#include <machine/intrcnt.h> #if defined(APIC_IO) #include <machine/smptests.h> /** FAST_HI */ diff --git a/sys/i386/isa/vector.s b/sys/i386/isa/vector.s index 981b858..d3b7a89 100644 --- a/sys/i386/isa/vector.s +++ b/sys/i386/isa/vector.s @@ -16,8 +16,6 @@ #include <i386/isa/isa.h> #endif -#include <machine/intrcnt.h> - #define FAST_INTR_HANDLER_USES_ES 1 #ifdef FAST_INTR_HANDLER_USES_ES #define ACTUALLY_PUSHED 1 diff --git a/sys/ia64/include/intrcnt.h b/sys/ia64/include/intrcnt.h index 5d2ce0b..4f7dcf4 100644 --- a/sys/ia64/include/intrcnt.h +++ b/sys/ia64/include/intrcnt.h @@ -71,11 +71,3 @@ # define INTRCNT_KN300_NCR810 INTRCNT_KN300_IRQ + 16 # define INTRCNT_KN300_I2C_CTRL INTRCNT_KN300_IRQ + 17 # define INTRCNT_KN300_I2C_BUS INTRCNT_KN300_IRQ + 18 - -#ifdef _KERNEL -#ifndef _LOCORE -extern volatile long intrcnt[]; -extern char intrnames[]; -extern char eintrnames[]; -#endif -#endif diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 5b376c1..59ef7ff 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -42,6 +42,7 @@ #include <sys/proc.h> #include <sys/random.h> #include <sys/resourcevar.h> +#include <sys/sysctl.h> #include <sys/unistd.h> #include <sys/vmmeter.h> #include <machine/atomic.h> @@ -620,3 +621,32 @@ swi_net(void *dummy) bits &= ~(1 << i); } } + +/* + * Sysctls used by systat and others: hw.intrnames and hw.intrcnt. + * The data for this machine dependent, and the declarations are in machine + * dependent code. The layout of intrnames and intrcnt however is machine + * independent. + * + * We do not know the length of intrcnt and intrnames at compile time, so + * calculate things at run time. + */ +static int +sysctl_intrnames(SYSCTL_HANDLER_ARGS) +{ + return (sysctl_handle_opaque(oidp, intrnames, eintrnames - intrnames, + req)); +} + +SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD, + NULL, 0, sysctl_intrnames, "", "Interrupt Names"); + +static int +sysctl_intrcnt(SYSCTL_HANDLER_ARGS) +{ + return (sysctl_handle_opaque(oidp, intrcnt, + (char *)eintrcnt - (char *)intrcnt, req)); +} + +SYSCTL_PROC(_hw, OID_AUTO, intrcnt, CTLTYPE_OPAQUE | CTLFLAG_RD, + NULL, 0, sysctl_intrcnt, "", "Interrupt Counts"); diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 4b444de..fefa2a7 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -105,6 +105,12 @@ extern void *net_ih; extern void *softclock_ih; extern void *vm_ih; +/* Counts and names for statistics (defined in MD code). */ +extern u_long eintrcnt[]; /* end of intrcnt[] */ +extern char eintrnames[]; /* end of intrnames[] */ +extern u_long intrcnt[]; /* counts for for each device and stray */ +extern char intrnames[]; /* string table containing device names */ + int ithread_create __P((struct ithd **ithread, int vector, int flags, void (*disable)(int), void (*enable)(int), const char *fmt, ...)) __printflike(6, 7); diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 0f4e107..24af2ec 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -363,33 +363,3 @@ SYSCTL_INT(_vm_stats_misc, OID_AUTO, SYSCTL_INT(_vm_stats_misc, OID_AUTO, vm_page_hash_mask, CTLFLAG_RD, &vm_page_hash_mask, 0, ""); #endif - -/* - * Further sysctls used by systat: hw.nintr, hw.intrnames, hw.intrcnt. - * This does probably not really fit in here, but it is somehow connected. - * The definitions for this are machdep, but are currently defined for - * any architecture. - */ - -/* include the machdep stuff */ -#include <machine/intrcnt.h> - -int nintr = INTRCNT_COUNT; -SYSCTL_INT(_hw, OID_AUTO, nintr, CTLFLAG_RD, &nintr, 0, "Number of Interrupts"); - -SYSCTL_OPAQUE(_hw, OID_AUTO, intrcnt, CTLFLAG_RD, &intrcnt, - sizeof(long) * INTRCNT_COUNT, "", "Interrupt Counts"); - -/* - * We do not know the length in advance (in an MI fashion), so calculate things - * at run-time. - */ -static int -sysctl_intrnames(SYSCTL_HANDLER_ARGS) -{ - return sysctl_handle_opaque(oidp, intrnames, eintrnames - intrnames, - req); -} - -SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD, NULL, 0, - sysctl_intrnames, "", "Interrupt Names"); |