From 84903f7f4e12af1253bf9ae9b67fb1f981b4d924 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 28 Oct 2002 00:50:39 +0000 Subject: [PATCH] Make vmstat -i work: o Properly set the pointer to the counter for each interrupt and update the intrnames table. o Remove Alpha cruft from intrcnt.h. o Create INTRNAME_LEN as the single entity that defines the width of the names in the intrnames table (incl. terminatinf '\0'). --- sys/ia64/ia64/interrupt.c | 15 ++++++++++--- sys/ia64/ia64/locore.S | 21 ++++++++++++------ sys/ia64/ia64/locore.s | 21 ++++++++++++------ sys/ia64/include/intrcnt.h | 45 +++++++------------------------------- 4 files changed, 48 insertions(+), 54 deletions(-) diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c index b82d6d1a3558..da807772f8d7 100644 --- a/sys/ia64/ia64/interrupt.c +++ b/sys/ia64/ia64/interrupt.c @@ -111,7 +111,6 @@ interrupt(u_int64_t vector, struct trapframe *framep) if (vector == 0) { vector = ib->ib_inta; printf("ExtINT interrupt: vector=%ld\n", vector); - goto out; /* XXX */ } if (vector == 255) {/* clock interrupt */ @@ -177,7 +176,6 @@ interrupt(u_int64_t vector, struct trapframe *framep) ia64_dispatch_intr(framep, vector); } - out: atomic_subtract_int(&td->td_intr_nesting_level, 1); } @@ -267,6 +265,7 @@ ia64_setup_intr(const char *name, int irq, driver_intr_t handler, void *arg, struct ia64_intr *i; int errcode; int vector = irq + IA64_HARDWARE_IRQ_BASE; + char *intrname; /* * XXX - Can we have more than one device on a vector? If so, we have @@ -284,7 +283,17 @@ ia64_setup_intr(const char *name, int irq, driver_intr_t handler, void *arg, i = malloc(sizeof(struct ia64_intr), M_DEVBUF, M_NOWAIT); if (i == NULL) return ENOMEM; - i->cntp = cntp; + if (cntp == NULL) + i->cntp = intrcnt + irq + INTRCNT_ISA_IRQ; + else + i->cntp = cntp; + if (name != NULL && *name != '\0') { + /* XXX needs abstraction. Too error phrone. */ + intrname = intrnames + (irq + INTRCNT_ISA_IRQ) * + INTRNAME_LEN; + memset(intrname, ' ', INTRNAME_LEN - 1); + bcopy(name, intrname, strlen(name)); + } errcode = ithread_create(&i->ithd, vector, 0, 0, ia64_send_eoi, "intr:"); if (errcode) { diff --git a/sys/ia64/ia64/locore.S b/sys/ia64/ia64/locore.S index 080dfd961899..c7dc7a74773c 100644 --- a/sys/ia64/ia64/locore.S +++ b/sys/ia64/ia64/locore.S @@ -347,25 +347,32 @@ XENTRY(esigcode) EXPORT(szsigcode) .quad esigcode-sigcode .text - -/* XXX: make systat/vmstat happy */ + +/* + * Create a default interrupt name table. The first entry (vector 0) is + * hardwaired to the clock interrupt. + */ .data + .align 8 EXPORT(intrnames) - .asciz "clock" + .ascii "clock" + .fill INTRNAME_LEN - 5 - 1, 1, ' ' + .byte 0 intr_n = 0 -.rept INTRCNT_COUNT +.rept INTRCNT_COUNT - 1 .ascii "intr " .byte intr_n / 10 + '0, intr_n % 10 + '0 - .asciz " " /* space for platform-specific rewrite */ + .fill INTRNAME_LEN - 5 - 2 - 1, 1, ' ' + .byte 0 intr_n = intr_n + 1 .endr EXPORT(eintrnames) .align 8 EXPORT(intrcnt) - .fill INTRCNT_COUNT + 1, 8, 0 + .fill INTRCNT_COUNT, 8, 0 EXPORT(eintrcnt) + .text - // in0: image base STATIC_ENTRY(_reloc, 1) alloc loc0=ar.pfs,1,2,0,0 diff --git a/sys/ia64/ia64/locore.s b/sys/ia64/ia64/locore.s index 080dfd961899..c7dc7a74773c 100644 --- a/sys/ia64/ia64/locore.s +++ b/sys/ia64/ia64/locore.s @@ -347,25 +347,32 @@ XENTRY(esigcode) EXPORT(szsigcode) .quad esigcode-sigcode .text - -/* XXX: make systat/vmstat happy */ + +/* + * Create a default interrupt name table. The first entry (vector 0) is + * hardwaired to the clock interrupt. + */ .data + .align 8 EXPORT(intrnames) - .asciz "clock" + .ascii "clock" + .fill INTRNAME_LEN - 5 - 1, 1, ' ' + .byte 0 intr_n = 0 -.rept INTRCNT_COUNT +.rept INTRCNT_COUNT - 1 .ascii "intr " .byte intr_n / 10 + '0, intr_n % 10 + '0 - .asciz " " /* space for platform-specific rewrite */ + .fill INTRNAME_LEN - 5 - 2 - 1, 1, ' ' + .byte 0 intr_n = intr_n + 1 .endr EXPORT(eintrnames) .align 8 EXPORT(intrcnt) - .fill INTRCNT_COUNT + 1, 8, 0 + .fill INTRCNT_COUNT, 8, 0 EXPORT(eintrcnt) + .text - // in0: image base STATIC_ENTRY(_reloc, 1) alloc loc0=ar.pfs,1,2,0,0 diff --git a/sys/ia64/include/intrcnt.h b/sys/ia64/include/intrcnt.h index 4f7dcf463333..bb1830e791ff 100644 --- a/sys/ia64/include/intrcnt.h +++ b/sys/ia64/include/intrcnt.h @@ -33,41 +33,12 @@ #define INTRCNT_ISA_IRQ_LEN 16 #define INTRCNT_OTHER_BASE (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN) #define INTRCNT_OTHER_LEN 48 -#define INTRCNT_COUNT (INTRCNT_OTHER_BASE + INTRCNT_OTHER_LEN) +#define INTRCNT_COUNT (INTRCNT_OTHER_BASE + INTRCNT_OTHER_LEN) -#define INTRCNT_A12_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_1000A_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_1000_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_2100_A500_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_550_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB164_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB64PLUS_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB66_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_IOASIC INTRCNT_OTHER_BASE -#define INTRCNT_KN15 INTRCNT_OTHER_BASE -#define INTRCNT_KN16 INTRCNT_OTHER_BASE -#define INTRCNT_KN20AA_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_KN300_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_KN8AE_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_TCDS INTRCNT_OTHER_BASE - -#define INTRCNT_A12_IRQ_LEN 10 -#define INTRCNT_DEC_1000A_IRQ_LEN 32 -#define INTRCNT_DEC_1000_IRQ_LEN 16 -#define INTRCNT_DEC_2100_A500_IRQ_LEN 16 -#define INTRCNT_DEC_550_IRQ_LEN 48 -#define INTRCNT_EB164_IRQ_LEN 24 -#define INTRCNT_EB64PLUS_IRQ_LEN 32 -#define INTRCNT_EB66_IRQ_LEN 32 -#define INTRCNT_IOASIC_LEN 4 -#define INTRCNT_ISA_IRQ_LEN 16 -#define INTRCNT_KN15_LEN 9 -#define INTRCNT_KN16_LEN 5 -#define INTRCNT_KN20AA_IRQ_LEN 32 -#define INTRCNT_KN300_LEN 19 -#define INTRCNT_KN8AE_IRQ_LEN 2 -#define INTRCNT_TCDS_LEN 2 - -# 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 +/* + * Maximum name length in intrnames table (including terminating '\0'. + * Since vmstat(8) assumes a maximum length of 13 (including '\0'), we're + * pretty much limited to that (unless we don't care about the alignment + * of the columns :-) + */ +#define INTRNAME_LEN 13