From dfd6258259633b47f6230f9047727fde2f1c4dc3 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 23 Mar 2004 00:17:12 +0000 Subject: [PATCH] Replace intrcnts by evcnts. XXX - needs slight tweaking for MULTIPROCESSOR. --- sys/arch/sparc64/sparc64/autoconf.c | 31 ++++++++++++++++++-- sys/arch/sparc64/sparc64/genassym.cf | 5 +++- sys/arch/sparc64/sparc64/locore.s | 43 +++++++++++----------------- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 1a4d3b56e065..ef8a5efed872 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.95 2004/03/21 14:10:08 pk Exp $ */ +/* $NetBSD: autoconf.c,v 1.96 2004/03/23 00:17:12 martin Exp $ */ /* * Copyright (c) 1996 @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.95 2004/03/21 14:10:08 pk Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.96 2004/03/23 00:17:12 martin Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -95,6 +95,25 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.95 2004/03/21 14:10:08 pk Exp $"); #include "ksyms.h" +struct evcnt intr_evcnts[] = { + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "spur"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev1"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev2"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev3"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev4"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev5"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev6"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev7"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev8"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev9"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "clock"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev11"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev12"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev13"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "prof"), + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev15") +}; + int printspl = 0; #ifdef KGDB @@ -580,7 +599,7 @@ extern struct sparc_bus_space_tag mainbus_space_tag; struct mainbus_attach_args ma; char buf[32]; const char *const *ssp, *sp = NULL; - int node0, node, rv; + int node0, node, rv, i; static const char *const openboot_special[] = { /* ignore these (end with NULL) */ @@ -611,6 +630,12 @@ extern struct sparc_bus_space_tag mainbus_space_tag; if (ncpus == 0) panic("None of the CPUs found"); + /* + * Init static interrupt eventcounters + */ + for (i = 0; i < sizeof(intr_evcnts)/sizeof(intr_evcnts[0]); i++) + evcnt_attach_static(&intr_evcnts[i]); + node = findroot(); /* Establish the first component of the boot path */ diff --git a/sys/arch/sparc64/sparc64/genassym.cf b/sys/arch/sparc64/sparc64/genassym.cf index 6ad50447863e..cc903b38bac5 100644 --- a/sys/arch/sparc64/sparc64/genassym.cf +++ b/sys/arch/sparc64/sparc64/genassym.cf @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.34 2004/03/14 18:18:54 chs Exp $ +# $NetBSD: genassym.cf,v 1.35 2004/03/23 00:17:12 martin Exp $ # # Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -265,6 +265,9 @@ define M_NEXT offsetof(struct mbuf, m_next) define M_DATA offsetof(struct mbuf, m_data) define M_LEN offsetof(struct mbuf, m_len) +# event counters +define EVC_SIZE sizeof(struct evcnt) + ifdef notyet # floppy trap handler fields define FDC_REG_MSR offsetof(struct fdcio, fdcio_reg_msr) diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 6dc001358ebf..359d9f772498 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.194 2004/03/14 18:18:54 chs Exp $ */ +/* $NetBSD: locore.s,v 1.195 2004/03/23 00:17:12 martin Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath @@ -4463,18 +4463,18 @@ _C_LABEL(sparc_interrupt): stx %l2, [%sp + CC64FSZ + STKB + TF_NPC] sub %l5, 0x40, %l6 ! Convert to interrupt level - sethi %hi(_C_LABEL(intrcnt)), %l4 + sethi %hi(_C_LABEL(intr_evcnts)), %l4 stb %l6, [%sp + CC64FSZ + STKB + TF_PIL] ! set up intrframe/clockframe rdpr %pil, %o1 - sll %l6, LNGSHFT, %l3 - or %l4, %lo(_C_LABEL(intrcnt)), %l4 ! intrcnt[intlev]++; + mulx %l6, EVC_SIZE, %l3 + or %l4, %lo(_C_LABEL(intr_evcnts)), %l4 ! intrcnt[intlev]++; stb %o1, [%sp + CC64FSZ + STKB + TF_OLDPIL] ! old %pil - LDULNG [%l4 + %l3], %o0 + ldx [%l4 + %l3], %o0 add %l4, %l3, %l4 clr %l5 ! Zero handled count - mov 1, %l3 ! Ack softint inc %o0 - STULNG %o0, [%l4] + mov 1, %l3 ! Ack softint + stx %o0, [%l4] sll %l3, %l6, %l3 ! Generate IRQ mask wrpr %l6, %pil @@ -12133,31 +12133,20 @@ _C_LABEL(ssym): _C_LABEL(proc0paddr): POINTER _C_LABEL(u0) ! KVA of proc0 uarea -/* interrupt counters XXX THESE BELONG ELSEWHERE (if anywhere) */ - .globl _C_LABEL(intrcnt), _C_LABEL(eintrcnt), _C_LABEL(intrnames), _C_LABEL(eintrnames) +/* + * Symbols that vmstat -i wants, even though they're not used. + */ +.globl _C_LABEL(intrnames) _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" +.globl _C_LABEL(eintrnames) _C_LABEL(eintrnames): - _ALIGN + +.globl _C_LABEL(intrcnt) _C_LABEL(intrcnt): - .space 16 * LNGSZ +.globl _C_LABEL(eintrcnt) _C_LABEL(eintrcnt): + #if !defined(MULTIPROCESSOR) .comm _C_LABEL(curlwp), PTRSZ #endif