Add support for 'vmstat -i'.

Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
Obtained from: NetBSD
This commit is contained in:
Doug Rabson 1998-11-28 09:55:16 +00:00
parent 9f9930a2de
commit e63149c330
6 changed files with 120 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $Id: interrupt.c,v 1.6 1998/11/15 18:25:15 dfr Exp $ */
/* $Id: interrupt.c,v 1.7 1998/11/18 23:51:40 dfr Exp $ */
/* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */
/*
@ -50,14 +50,12 @@
#include <machine/bwx.h>
#include <machine/intr.h>
#if 0
#ifdef EVCNT_COUNTERS
#include <sys/device.h>
struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */
#else
#include <machine/intrcnt.h>
#endif
#endif
volatile int mc_expected, mc_received;
@ -84,12 +82,10 @@ interrupt(a0, a1, a2, framep)
case ALPHA_INTR_CLOCK: /* clock interrupt */
cnt.v_intr++;
#if 0
#ifdef EVCNT_COUNTERS
clock_intr_evcnt.ev_count++;
#else
intrcnt[INTRCNT_CLOCK]++;
#endif
#endif
if (platform.clockintr)
(*platform.clockintr)(framep);
@ -287,12 +283,13 @@ struct alpha_intr {
int vector; /* vector to match */
driver_intr_t *intr; /* handler function */
void *arg; /* argument to handler */
volatile long *cntp; /* interrupt counter */
};
static struct alpha_intr_list alpha_intr_hash[31];
int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg,
void **cookiep)
void **cookiep, volatile long *cntp)
{
int h = HASHVEC(vector);
struct alpha_intr *i;
@ -304,6 +301,10 @@ int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg,
i->vector = vector;
i->intr = intr;
i->arg = arg;
if (cntp)
i->cntp = cntp;
else
i->cntp = NULL;
s = splhigh();
LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list);
@ -331,8 +332,13 @@ void
alpha_dispatch_intr(void *frame, unsigned long vector)
{
struct alpha_intr *i;
volatile long *cntp;
int h = HASHVEC(vector);
for (i = LIST_FIRST(&alpha_intr_hash[h]); i; i = LIST_NEXT(i, list))
if (i->vector == vector)
if (i->vector == vector) {
if (cntp = i->cntp)
(*cntp) ++;
i->intr(i->arg);
}
}

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: locore.s,v 1.4 1998/11/09 10:47:19 dima Exp $
* $Id: locore.s,v 1.5 1998/11/15 00:50:59 dima Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -56,6 +56,11 @@
#include <sys/syscall.h>
#include <assym.s>
#ifndef EVCNT_COUNTERS
#define _LOCORE
#include <machine/intrcnt.h>
#endif
/*
* PTmap is recursive pagemap at top of virtual address space.
* Within PTmap, the lev1 and lev0 page tables can be found.
@ -296,10 +301,17 @@ LEAF(restorefpstate, 1)
/* XXX: make systat/vmstat happy */
.data
EXPORT(intrnames)
ASCIZ "foobar"
.asciz "clock"
intr_n = 0
.rept INTRCNT_COUNT
.ascii "intr "
.byte intr_n / 10 + '0, intr_n % 10 + '0
.asciz " " # space for platform-specific rewrite
intr_n = intr_n + 1
.endr
EXPORT(eintrnames)
.align 3
.align 3
EXPORT(intrcnt)
.quad 0
.fill INTRCNT_COUNT + 1, 8, 0
EXPORT(eintrcnt)
.text

View File

@ -23,14 +23,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: intr.h,v 1.3 1998/08/10 07:53:58 dfr Exp $
* $Id: intr.h,v 1.4 1998/11/15 18:25:16 dfr Exp $
*/
#ifndef _MACHINE_INTR_H_
#define _MACHINE_INTR_H_
int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg,
void **cookiep);
void **cookiep, volatile long *cntp);
int alpha_teardown_intr(void *cookie);
void alpha_dispatch_intr(void *frame, unsigned long vector);

View File

@ -0,0 +1,79 @@
/* $Id$ */
/* $NetBSD: intrcnt.h,v 1.17 1998/11/19 01:48:04 ross Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#define INTRCNT_CLOCK 0
#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1)
#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_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
#ifdef KERNEL
#ifndef _LOCORE
extern volatile long intrcnt[];
#endif
#endif

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: isa.c,v 1.6 1998/11/15 18:25:16 dfr Exp $
* $Id: isa.c,v 1.7 1998/11/18 23:53:11 dfr Exp $
*/
#include <sys/param.h>
@ -37,6 +37,7 @@
#include <isa/isareg.h>
#include <isa/isavar.h>
#include <machine/intr.h>
#include <machine/intrcnt.h>
#include <machine/resource.h>
MALLOC_DEFINE(M_ISADEV, "isadev", "ISA device");
@ -654,7 +655,8 @@ isa_setup_intr(device_t dev, device_t child,
ii->irq = irq->r_start;
error = alpha_setup_intr(0x800 + (irq->r_start << 4),
isa_handle_intr, ii, &ii->ih);
isa_handle_intr, ii, &ii->ih,
&intrcnt[INTRCNT_ISA_IRQ + irq->r_start]);
if (error) {
free(ii, M_DEVBUF);
return error;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cia.c,v 1.10 1998/10/06 14:18:40 dfr Exp $
* $Id: cia.c,v 1.11 1998/11/15 18:25:16 dfr Exp $
*/
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -104,6 +104,7 @@
#include <machine/bwx.h>
#include <machine/swiz.h>
#include <machine/intr.h>
#include <machine/intrcnt.h>
#include <machine/cpuconf.h>
#include <machine/rpb.h>
#include <machine/resource.h>
@ -718,8 +719,9 @@ cia_init()
chipset = cia_bwx_chipset;
cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM);
#if 0
#if 1
chipset = cia_swiz_chipset; /* XXX */
cia_ispyxis = 0;
#endif
if (platform.pci_intr_init)
@ -825,7 +827,6 @@ cia_setup_intr(device_t dev, device_t child,
struct resource *irq,
driver_intr_t *intr, void *arg, void **cookiep)
{
struct alpha_intr *i;
int error;
error = rman_activate_resource(irq);
@ -833,7 +834,8 @@ cia_setup_intr(device_t dev, device_t child,
return error;
error = alpha_setup_intr(0x900 + (irq->r_start << 4),
intr, arg, cookiep);
intr, arg, cookiep,
&intrcnt[INTRCNT_EB164_IRQ + irq->r_start]);
if (error)
return error;