Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 1998 20:45:17 +0900
From:      Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
To:        freebsd-alpha@FreeBSD.ORG
Subject:   vmstat -i
Message-ID:  <19981127204517A.simokawa@sat.t.u-tokyo.ac.jp>

next in thread | raw e-mail | index | archive | help
Hi,

  Here is a patch to make vmstat -i work correctly.
It needs NetBSD's src/sys/arch/alpha/include/intrcnt.h
in addtion. I don't know whether INTRCNT_EB164_IRQ is
a good choice for cia.

/\ Hidetoshi Shimokawa
\/  simokawa@sat.t.u-tokyo.ac.jp
PGP public key: finger -l simokawa@sat.t.u-tokyo.ac.jp

Index: alpha/interrupt.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/alpha/alpha/interrupt.c,v
retrieving revision 1.7
diff -c -r1.7 interrupt.c
*** interrupt.c	1998/11/18 23:51:40	1.7
--- interrupt.c	1998/11/25 12:33:18
***************
*** 50,63 ****
  #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;
  
--- 50,61 ----
***************
*** 84,95 ****
  		
  	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);
--- 82,91 ----
Index: alpha/locore.s
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/alpha/alpha/locore.s,v
retrieving revision 1.5
diff -c -r1.5 locore.s
*** locore.s	1998/11/15 00:50:59	1.5
--- locore.s	1998/11/25 14:07:36
***************
*** 56,61 ****
--- 56,66 ----
  #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,305 ****
  /* XXX: make systat/vmstat happy */
  	.data
  EXPORT(intrnames)
! 	ASCIZ	"foobar"
  EXPORT(eintrnames)
  	.align	3
  EXPORT(intrcnt)
! 	.quad	0
  EXPORT(eintrcnt)
  	.text
--- 301,314 ----
  /* XXX: make systat/vmstat happy */
  	.data
  EXPORT(intrnames)
! #ifndef EVCNT_COUNTERS
! 	INTRNAMES_DEFINITION
! #endif
  EXPORT(eintrnames)
  	.align	3
  EXPORT(intrcnt)
! #ifndef EVCNT_COUNTERS
! 	INTRCNT_DEFINITION
! #endif
  EXPORT(eintrcnt)
  	.text
Index: isa/isa.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/alpha/isa/isa.c,v
retrieving revision 1.7
diff -c -r1.7 isa.c
*** isa.c	1998/11/18 23:53:11	1.7
--- isa.c	1998/11/27 08:50:04
***************
*** 37,42 ****
--- 37,43 ----
  #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");
***************
*** 627,632 ****
--- 628,634 ----
  	struct isa_intr *ii = arg;
  	int irq = ii->irq;
  
+ 	intrcnt[INTRCNT_ISA_IRQ + irq] ++;
  	ii->intr(ii->arg);
  
  	if (ii->irq > 7)
Index: pci/cia.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/alpha/pci/cia.c,v
retrieving revision 1.11
diff -c -r1.11 cia.c
*** cia.c	1998/11/15 18:25:16	1.11
--- cia.c	1998/11/27 11:22:55
***************
*** 96,101 ****
--- 96,102 ----
  #include <sys/kernel.h>
  #include <sys/module.h>
  #include <sys/bus.h>
+ #include <sys/malloc.h>
  #include <sys/rman.h>
  
  #include <alpha/pci/ciareg.h>
***************
*** 104,109 ****
--- 105,111 ----
  #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>
***************
*** 820,841 ****
  	return 0;
  }
  
  static int
  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);
  	if (error)
  		return error;
  
  	error = alpha_setup_intr(0x900 + (irq->r_start << 4),
! 				 intr, arg, cookiep);
! 	if (error)
  		return error;
  
  	/* Enable PCI interrupt */
  	platform.pci_intr_enable(irq->r_start);
--- 822,876 ----
  	return 0;
  }
  
+ struct pci_intr {
+ #if 0
+ 	void *ih;
+ #endif
+ 	driver_intr_t *intr;
+ 	void *arg;
+ 	int irq;
+ };
+ 
+ /*
+  * Wrap PCI interrupt just for counting
+  */
+ 
+ static void
+ pci_handle_intr(void *arg)
+ {
+ 	struct pci_intr *pi = arg;
+ 	int irq = pi->irq;
+ 
+ 	intrcnt[INTRCNT_EB164_IRQ + irq] ++;
+ 	pi->intr(pi->arg);
+ }
+ 
+ 
  static int
  cia_setup_intr(device_t dev, device_t child,
  	       struct resource *irq,
  	       driver_intr_t *intr, void *arg, void **cookiep)
  {
! 	struct pci_intr *pi;
  	int error;
  	
  	error = rman_activate_resource(irq);
  	if (error)
  		return error;
  
+ 	pi = malloc(sizeof(struct pci_intr), M_DEVBUF, M_NOWAIT);
+ 	if (!pi)
+ 		return ENOMEM;
+ 	pi->intr = intr;
+ 	pi->arg = arg;
+ 	pi->irq = irq->r_start;
+ 
  	error = alpha_setup_intr(0x900 + (irq->r_start << 4),
! 				 pci_handle_intr, pi, cookiep);
! 	if (error) {
! 		free(pi, M_DEVBUF);
  		return error;
+ 	}
  
  	/* Enable PCI interrupt */
  	platform.pci_intr_enable(irq->r_start);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981127204517A.simokawa>