From 398e5bdd7b58b9d806d61cc86ae1fb6027bcb8a7 Mon Sep 17 00:00:00 2001 From: mrg Date: Sat, 17 Mar 2012 23:47:13 +0000 Subject: [PATCH] count ECC corrected traps with evcnt(9). --- sys/arch/sparc64/sparc64/trap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index 66a330aaa718..adc3525e6037 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.170 2012/03/17 22:19:53 mrg Exp $ */ +/* $NetBSD: trap.c,v 1.171 2012/03/17 23:47:13 mrg Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.170 2012/03/17 22:19:53 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.171 2012/03/17 23:47:13 mrg Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -159,6 +159,10 @@ int trapdebug = 0/*|TDB_SYSCALL|TDB_STOPSIG|TDB_STOPCPIO|TDB_ADDFLT|TDB_FOLLOW*/ #define Debugger() #endif +struct evcnt ecc_corrected = + EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"ECC","corrected"); +EVCNT_ATTACH_STATIC(ecc_corrected); + /* * Initial FPU state is all registers == all 1s, everything else == all 0s. * This makes every floating point register a signalling NaN, with sign bit @@ -1653,7 +1657,7 @@ ecc_corrected_error(unsigned int type, vaddr_t pc) stxa(0, ASI_AFSR, ldxa(0, ASI_AFSR)); membar_Sync(); intr_restore(s); - /* XXX: count the error */ + ecc_corrected.ev_count++; snprintb(buf, sizeof(buf), AFSR_BITS, afsr); printf("corrected ECC error: pc %p afsr %"PRIx64" (%s) addr %"PRIx64"\n", (void *)pc, afsr, buf, afar);