From owner-svn-src-projects@FreeBSD.ORG Wed Dec 23 14:55:33 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E8C01065676; Wed, 23 Dec 2009 14:55:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EAEA8FC16; Wed, 23 Dec 2009 14:55:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNEtXYZ001092; Wed, 23 Dec 2009 14:55:33 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNEtXqT001090; Wed, 23 Dec 2009 14:55:33 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200912231455.nBNEtXqT001090@svn.freebsd.org> From: Randall Stewart Date: Wed, 23 Dec 2009 14:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200901 - projects/mips/sys/mips/rmi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2009 14:55:33 -0000 Author: rrs Date: Wed Dec 23 14:55:33 2009 New Revision: 200901 URL: http://svn.freebsd.org/changeset/base/200901 Log: Add missing function that doesintr naming and init. Modified: projects/mips/sys/mips/rmi/intr_machdep.c Modified: projects/mips/sys/mips/rmi/intr_machdep.c ============================================================================== --- projects/mips/sys/mips/rmi/intr_machdep.c Wed Dec 23 14:48:26 2009 (r200900) +++ projects/mips/sys/mips/rmi/intr_machdep.c Wed Dec 23 14:55:33 2009 (r200901) @@ -50,8 +50,9 @@ __FBSDID("$FreeBSD$"); #include /*#include */ - +static mips_intrcnt_t mips_intr_counters[XLR_MAX_INTR]; struct mips_intrhand mips_intr_handlers[XLR_MAX_INTR]; +static int intrcnt_index; static void mips_mask_hard_irq(void *source) @@ -113,8 +114,6 @@ cpu_establish_softintr(const char *name, cpu_establish_hardintr(name, filt, handler, arg, irq, flags, cookiep); } - - void cpu_intr(struct trapframe *tf) { @@ -180,3 +179,39 @@ cpu_intr(struct trapframe *tf) } critical_exit(); } + +void +mips_intrcnt_setname(mips_intrcnt_t counter, const char *name) +{ + int idx = counter - intrcnt; + + KASSERT(counter != NULL, ("mips_intrcnt_setname: NULL counter")); + + snprintf(intrnames + (MAXCOMLEN + 1) * idx, + MAXCOMLEN + 1, "%-*s", MAXCOMLEN, name); +} + +mips_intrcnt_t +mips_intrcnt_create(const char* name) +{ + mips_intrcnt_t counter = &intrcnt[intrcnt_index++]; + + mips_intrcnt_setname(counter, name); + return counter; +} + +void +cpu_init_interrupts() +{ + int i; + char name[MAXCOMLEN + 1]; + + /* + * Initialize all available vectors so spare IRQ + * would show up in systat output + */ + for (i = 0; i < XLR_MAX_INTR; i++) { + snprintf(name, MAXCOMLEN + 1, "int%d:", i); + mips_intr_counters[i] = mips_intrcnt_create(name); + } +}