Module Name:    src
Committed By:   matt
Date:           Sun Feb 20 07:58:14 UTC 2011

Modified Files:
        src/sys/arch/hpcmips/conf: std.hpcmips std.lcard
        src/sys/arch/hpcmips/hpcmips: autoconf.c bus_dma.c bus_space.c cpu.c
            hpcapm_machdep.c interrupt.c machdep.c mainbus.c
        src/sys/arch/hpcmips/include: intr.h sysconf.h
        src/sys/arch/hpcmips/tx: tx39.c tx39icu.c
        src/sys/arch/hpcmips/vr: vr.c vrdcu.c

Log Message:
Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
(XXX don't know how to deal with use of spllower in sleep/pause code so
hpcmips kernel will fail to compile).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hpcmips/conf/std.hpcmips
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hpcmips/conf/std.lcard
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hpcmips/hpcmips/autoconf.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/hpcmips/hpcmips/bus_dma.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/hpcmips/hpcmips/bus_space.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hpcmips/hpcmips/cpu.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hpcmips/hpcmips/interrupt.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/hpcmips/hpcmips/machdep.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/hpcmips/hpcmips/mainbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hpcmips/include/intr.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hpcmips/include/sysconf.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/hpcmips/tx/tx39.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/hpcmips/tx/tx39icu.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/hpcmips/vr/vr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hpcmips/vr/vrdcu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hpcmips/conf/std.hpcmips
diff -u src/sys/arch/hpcmips/conf/std.hpcmips:1.19 src/sys/arch/hpcmips/conf/std.hpcmips:1.20
--- src/sys/arch/hpcmips/conf/std.hpcmips:1.19	Sun Dec 11 12:17:33 2005
+++ src/sys/arch/hpcmips/conf/std.hpcmips	Sun Feb 20 07:58:13 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: std.hpcmips,v 1.19 2005/12/11 12:17:33 christos Exp $
+#	$NetBSD: std.hpcmips,v 1.20 2011/02/20 07:58:13 matt Exp $
 # standard, required hpcmips info
 
 machine hpcmips mips
@@ -6,7 +6,7 @@
 makeoptions	MACHINE_ARCH="mipsel"
 
 options 	NOFPU			# No FPU
-options 	SOFTFLOAT		# emulate FPU insn
+options 	FPEMUL			# emulate FPU insn
 
 mainbus0 at root
 cpu* at mainbus0

Index: src/sys/arch/hpcmips/conf/std.lcard
diff -u src/sys/arch/hpcmips/conf/std.lcard:1.7 src/sys/arch/hpcmips/conf/std.lcard:1.8
--- src/sys/arch/hpcmips/conf/std.lcard:1.7	Sat Sep 16 02:14:56 2006
+++ src/sys/arch/hpcmips/conf/std.lcard	Sun Feb 20 07:58:13 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: std.lcard,v 1.7 2006/09/16 02:14:56 gdamore Exp $
+#	$NetBSD: std.lcard,v 1.8 2011/02/20 07:58:13 matt Exp $
 # standard, required hpcmips info
 
 machine hpcmips mips
@@ -6,7 +6,7 @@
 makeoptions	MACHINE_ARCH="mipsel"
 
 options 	NOFPU			# No FPU
-options 	SOFTFLOAT		# emulate FPU insn
+options 	FPEMUL			# emulate FPU insn
 
 options 	MIPS3			# R4000/R4400/R4600 CPUs
 options 	MIPS3_4100		# VR4100 core

Index: src/sys/arch/hpcmips/hpcmips/autoconf.c
diff -u src/sys/arch/hpcmips/hpcmips/autoconf.c:1.23 src/sys/arch/hpcmips/hpcmips/autoconf.c:1.24
--- src/sys/arch/hpcmips/hpcmips/autoconf.c:1.23	Tue Feb  8 20:20:14 2011
+++ src/sys/arch/hpcmips/hpcmips/autoconf.c	Sun Feb 20 07:58:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.23 2011/02/08 20:20:14 rmind Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.24 2011/02/20 07:58:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2011/02/08 20:20:14 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.24 2011/02/20 07:58:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -76,7 +76,7 @@
 		panic("no mainbus found");
 
 	/* Configuration is finished, turn on interrupts. */
-	_splnone();	/* enable all source forcing SOFT_INTs cleared */
+	spl0();		/* enable all source forcing SOFT_INTs cleared */
 }
 
 void

Index: src/sys/arch/hpcmips/hpcmips/bus_dma.c
diff -u src/sys/arch/hpcmips/hpcmips/bus_dma.c:1.35 src/sys/arch/hpcmips/hpcmips/bus_dma.c:1.36
--- src/sys/arch/hpcmips/hpcmips/bus_dma.c:1.35	Mon Dec 14 00:46:03 2009
+++ src/sys/arch/hpcmips/hpcmips/bus_dma.c	Sun Feb 20 07:58:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.35 2009/12/14 00:46:03 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.36 2011/02/20 07:58:13 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2009/12/14 00:46:03 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2011/02/20 07:58:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -516,13 +516,12 @@
     bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
     int flags)
 {
-	extern paddr_t avail_start, avail_end;		/* XXX */
 	psize_t high;
 
-	high = avail_end - PAGE_SIZE;
+	high = mips_avail_end - PAGE_SIZE;
 
 	return (_hpcmips_bd_mem_alloc_range(t, size, alignment, boundary,
-	    segs, nsegs, rsegs, flags, avail_start, high));
+	    segs, nsegs, rsegs, flags, mips_avail_start, high));
 }
 
 /*
@@ -536,10 +535,9 @@
     int flags, paddr_t low, paddr_t high)
 {
 #ifdef DIAGNOSTIC
-	extern paddr_t avail_start, avail_end;		/* XXX */
 
-	high = high<(avail_end - PAGE_SIZE)? high: (avail_end - PAGE_SIZE);
-	low = low>avail_start? low: avail_start;
+	high = high<(mips_avail_end - PAGE_SIZE)? high: (mips_avail_end - PAGE_SIZE);
+	low = low>mips_avail_start? low: mips_avail_start;
 #endif
 
 	return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,

Index: src/sys/arch/hpcmips/hpcmips/bus_space.c
diff -u src/sys/arch/hpcmips/hpcmips/bus_space.c:1.28 src/sys/arch/hpcmips/hpcmips/bus_space.c:1.29
--- src/sys/arch/hpcmips/hpcmips/bus_space.c:1.28	Sat Nov  7 07:27:43 2009
+++ src/sys/arch/hpcmips/hpcmips/bus_space.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.28 2009/11/07 07:27:43 cegger Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.29 2011/02/20 07:58:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.28 2009/11/07 07:27:43 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.29 2011/02/20 07:58:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -250,7 +250,7 @@
 			/*
 			 * Update the same virtual address entry.
 			 */
-			MachTLBUpdate(va, opte);
+			tlb_update(va, opte);
 		}
 		return (bpa);
 	}

Index: src/sys/arch/hpcmips/hpcmips/cpu.c
diff -u src/sys/arch/hpcmips/hpcmips/cpu.c:1.16 src/sys/arch/hpcmips/hpcmips/cpu.c:1.17
--- src/sys/arch/hpcmips/hpcmips/cpu.c:1.16	Mon Dec 14 00:46:04 2009
+++ src/sys/arch/hpcmips/hpcmips/cpu.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.16 2009/12/14 00:46:04 matt Exp $	*/
+/*	$NetBSD: cpu.c,v 1.17 2011/02/20 07:58:14 matt Exp $	*/
 /*-
  * Copyright (c) 1999 Shin Takemura, All rights reserved.
  * Copyright (c) 1999-2001 SATO Kazumi, All rights reserved.
@@ -56,27 +56,28 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.16 2009/12/14 00:46:04 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.17 2011/02/20 07:58:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
+#include <sys/cpu.h>
 #include <sys/bus.h>
 
 #include <machine/sysconf.h>
 #include <machine/autoconf.h>
 
 /* Definition of the driver for autoconfig. */
-static int	cpumatch(struct device *, struct cfdata *, void *);
-static void	cpuattach(struct device *, struct device *, void *);
+static int	cpumatch(device_t, cfdata_t, void *);
+static void	cpuattach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof (struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
 
 extern struct cfdriver cpu_cd;
 
 static int
-cpumatch(struct device *parent, struct cfdata *cf, void *aux)
+cpumatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -85,12 +86,16 @@
 }
 
 static void
-cpuattach(struct device *parent, struct device *dev, void *aux)
+cpuattach(device_t parent, device_t self, void *aux)
 {
+	struct cpu_info * const ci = curcpu();
 
-	printf(": ");
+	ci->ci_dev = self;
+	self->dv_private = ci;
 
-	cpu_identify();
+	aprint_normal(": ");
+
+	cpu_identify(self);
 
 	/* install CPU specific idle routine if any. */
 	if (platform.cpu_idle != NULL)

Index: src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c
diff -u src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.3 src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.4
--- src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.3	Wed Mar 18 10:22:29 2009
+++ src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcapm_machdep.c,v 1.3 2009/03/18 10:22:29 cegger Exp $	*/
+/*	$NetBSD: hpcapm_machdep.c,v 1.4 2011/02/20 07:58:14 matt Exp $	*/
 
 /*
  * Copyright (c) 2000 Takemura Shin
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.3 2009/03/18 10:22:29 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.4 2011/02/20 07:58:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -91,35 +91,35 @@
 machine_sleep(void)
 {
 #if NVRIP_COMMON > 0
-	 if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) {
-		 /*
-		  * disable all interrupts except PIU interrupt
-		  */
-		 vrip_intr_suspend();
-		 _spllower(~MIPS_INT_MASK_0);
-
-		 /*
-		  * SUSPEND instruction puts the CPU into power saveing
-		  * state until some interrupt occuer.
-		  * It sleeps until you push the power button.
-		  */
-		 __asm(".set noreorder");
-		 __asm(".word	" ___STRING(VR_OPCODE_SUSPEND));
-		 __asm("nop");
-		 __asm("nop");
-		 __asm("nop");
-		 __asm("nop");
-		 __asm("nop");
-		 __asm(".set reorder");
-
-		 splhigh();
-		 vrip_intr_resume();
-		 delay(1000); /* 1msec */
-	 }
+	if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) {
+		/*
+		 * disable all interrupts except PIU interrupt
+		 */
+		vrip_intr_suspend();
+		_spllower(~MIPS_INT_MASK_0);
+
+		/*
+		 * SUSPEND instruction puts the CPU into power saveing
+		 * state until some interrupt occuer.
+		 * It sleeps until you push the power button.
+		 */
+		__asm(".set noreorder");
+		__asm(".word	" ___STRING(VR_OPCODE_SUSPEND));
+		__asm("nop");
+		__asm("nop");
+		__asm("nop");
+		__asm("nop");
+		__asm("nop");
+		__asm(".set reorder");
+
+		splhigh();
+		vrip_intr_resume();
+		delay(1000); /* 1msec */
+	}
 #endif /* NVRIP_COMMON > 0 */
 #ifdef TX39XX
-	 if (platid_match(&platid, &platid_mask_CPU_MIPS_TX)) {
-		 tx39power_suspend_cpu();
-	 }
+	if (platid_match(&platid, &platid_mask_CPU_MIPS_TX)) {
+		tx39power_suspend_cpu();
+	}
 #endif
 }

Index: src/sys/arch/hpcmips/hpcmips/interrupt.c
diff -u src/sys/arch/hpcmips/hpcmips/interrupt.c:1.17 src/sys/arch/hpcmips/hpcmips/interrupt.c:1.18
--- src/sys/arch/hpcmips/hpcmips/interrupt.c:1.17	Mon Dec 20 00:25:34 2010
+++ src/sys/arch/hpcmips/hpcmips/interrupt.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.17 2010/12/20 00:25:34 matt Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.18 2011/02/20 07:58:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,26 +30,24 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.17 2010/12/20 00:25:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.18 2011/02/20 07:58:14 matt Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
 
+#define __INTR_PRIVATE
+
 #include <sys/param.h>
 #include <sys/malloc.h>
+#include <sys/intr.h>
 
 #include <machine/sysconf.h>
 
-extern const u_int32_t __ipl_sr_bits_vr[];
-extern const u_int32_t __ipl_sr_bits_tx[];
-
-const u_int32_t *ipl_sr_bits;
-
 void
 intr_init(void)
 {
 
-	ipl_sr_bits = CPUISMIPS3 ? __ipl_sr_bits_vr : __ipl_sr_bits_tx;
+	ipl_sr_map = CPUISMIPS3 ? __ipl_sr_map_vr : __ipl_sr_map_tx;
 }
 
 #if defined(VR41XX) && defined(TX39XX)
@@ -62,9 +60,9 @@
  * 
  */
 void
-cpu_intr(uint32_t status, uint32_t cause, vaddr_t pc, uint32_t ipending)
+cpu_intr(int ppl, vaddr_t pc, uint32_t status)
 {
 
-	(*platform.cpu_intr)(status, cause, pc, ipending);
+	(*platform.cpu_intr)(ppl, pc, status);
 }
 #endif /* VR41XX && TX39XX */

Index: src/sys/arch/hpcmips/hpcmips/machdep.c
diff -u src/sys/arch/hpcmips/hpcmips/machdep.c:1.113 src/sys/arch/hpcmips/hpcmips/machdep.c:1.114
--- src/sys/arch/hpcmips/hpcmips/machdep.c:1.113	Tue Feb  8 20:20:15 2011
+++ src/sys/arch/hpcmips/hpcmips/machdep.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.113 2011/02/08 20:20:15 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.114 2011/02/20 07:58:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999 Shin Takemura, All rights reserved.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.113 2011/02/08 20:20:15 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.114 2011/02/20 07:58:14 matt Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
@@ -103,6 +103,7 @@
 #include <ufs/mfs/mfs_extern.h>	/* mfs_initminiroot() */
 #include <dev/cons.h>		/* cntab access (cpu_reboot) */
 
+#include <machine/locore.h>
 #include <machine/psl.h>
 #include <machine/sysconf.h>
 #include <machine/platid.h>
@@ -184,15 +185,6 @@
 int	mem_cluster_cnt;
 phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
 
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- * Used as an argument to splx().
- * XXX disables interrupt 5 to disable mips3 on-chip clock, which also
- * disables mips1 FPU interrupts.
- */
-int	safepri = MIPS3_PSL_LOWIPL;	/* XXX */
-
 void mach_init(int, char *[], struct bootinfo *);
 
 #ifdef DEBUG
@@ -326,7 +318,7 @@
 	 * Initialize locore-function vector.
 	 * Clear out the I and D caches.
 	 */
-	mips_vector_init();
+	mips_vector_init(NULL, false);
 	intr_init();
 
 #ifdef DEBUG
@@ -448,22 +440,8 @@
 		physmem += atop(mem_clusters[i].size);
 	}
 
-	/* Cluster 0 is always the kernel, which doesn't get loaded. */
-	for (i = 1; i < mem_cluster_cnt; i++) {
-		paddr_t start;
-		psize_t size;
-
-		start = (paddr_t)mem_clusters[i].start;
-		size = (psize_t)mem_clusters[i].size;
-
-		printf("loading %#"PRIxPADDR",%#"PRIxPSIZE"\n", start, size);
-
-		memset((void *)MIPS_PHYS_TO_KSEG1(start), 0, size);
-
-		uvm_page_physload(atop(start), atop(start + size),
-		    atop(start), atop(start + size),
-		    VM_FREELIST_DEFAULT);
-	}
+	mips_page_physload(MIPS_KSEG0_START, (vaddr_t)kernend,
+	    mem_clusters, mem_cluster_cnt, NULL, 0);
 
 	/*
 	 * Initialize error message buffer (at end of core).
@@ -544,7 +522,6 @@
 {
 
 	/* take a snap shot before clobbering any registers */
-	if (curlwp)
 		savectx(curpcb);
 
 #ifdef DEBUG

Index: src/sys/arch/hpcmips/hpcmips/mainbus.c
diff -u src/sys/arch/hpcmips/hpcmips/mainbus.c:1.30 src/sys/arch/hpcmips/hpcmips/mainbus.c:1.31
--- src/sys/arch/hpcmips/hpcmips/mainbus.c:1.30	Fri Jan  4 22:13:56 2008
+++ src/sys/arch/hpcmips/hpcmips/mainbus.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.30 2008/01/04 22:13:56 ad Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.31 2011/02/20 07:58:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2008/01/04 22:13:56 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.31 2011/02/20 07:58:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,28 +54,27 @@
 #define STATIC	static
 #endif
 
-STATIC int mainbus_match(struct device *, struct cfdata *, void *);
-STATIC void mainbus_attach(struct device *, struct device *, void *);
-STATIC int mainbus_search(struct device *, struct cfdata *,
-			  const int *, void *);
+STATIC int mainbus_match(device_t, cfdata_t, void *);
+STATIC void mainbus_attach(device_t, device_t, void *);
+STATIC int mainbus_search(device_t, cfdata_t, const int *, void *);
 STATIC int mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 STATIC int __mainbus_attached;
 
 int
-mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return (__mainbus_attached ? 0 : 1);	/* don't attach twice */
 }
 
 void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	static const char *devnames[] = {	/* ATTACH ORDER */
+	static const char * const devnames[] = {	/* ATTACH ORDER */
 		"cpu",				/* 1. CPU */
 		"vrip", "vr4102ip", "vr4122ip",
 		"vr4181ip",			/* 2. System BUS */
@@ -106,8 +105,7 @@
 }
 
 int
-mainbus_search(struct device *parent, struct cfdata *cf,
-	       const int *ldesc, void *aux)
+mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct mainbus_attach_args *ma = (void *)aux;
 	int locator = cf->cf_loc[MAINBUSCF_PLATFORM];

Index: src/sys/arch/hpcmips/include/intr.h
diff -u src/sys/arch/hpcmips/include/intr.h:1.22 src/sys/arch/hpcmips/include/intr.h:1.23
--- src/sys/arch/hpcmips/include/intr.h:1.22	Fri Jan  4 22:03:25 2008
+++ src/sys/arch/hpcmips/include/intr.h	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.22 2008/01/04 22:03:25 ad Exp $	*/
+/*	$NetBSD: intr.h,v 1.23 2011/02/20 07:58:14 matt Exp $	*/
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -33,62 +33,17 @@
 #ifndef _HPCMIPS_INTR_H_
 #define _HPCMIPS_INTR_H_
 
-#define	IPL_NONE	0	/* disable only this interrupt */
-#define	IPL_SOFTCLOCK	1	/* clock software interrupts (SI 0) */
-#define	IPL_SOFTBIO	1	/* bio software interrupts (SI 0) */
-#define	IPL_SOFTNET	2	/* network software interrupts (SI 1) */
-#define	IPL_SOFTSERIAL	2	/* serial software interrupts (SI 1) */
-#define	IPL_VM		3
-#define	IPL_SCHED	4
-#define	IPL_HIGH	4	/* disable all interrupts */
-
-#define	_IPL_N		5
-
-#define	_IPL_SI0_FIRST	IPL_SOFTCLOCK
-#define	_IPL_SI0_LAST	IPL_SOFTBIO
-
-#define	_IPL_SI1_FIRST	IPL_SOFTNET
-#define	_IPL_SI1_LAST	IPL_SOFTSERIAL
-
-/* Interrupt sharing types. */
-#define	IST_UNUSABLE	-1	/* interrupt cannot be used */
-#define	IST_NONE	0	/* none */
-#define	IST_PULSE	1	/* pulsed */
-#define	IST_EDGE	2	/* edge-triggered */
-#define	IST_LEVEL	3	/* level-triggered */
+#include <mips/intr.h>
 
 #ifdef _KERNEL
 #ifndef _LOCORE
-#include <mips/cpuregs.h>
-#include <mips/locore.h>
-
-extern const u_int32_t *ipl_sr_bits;
 
 void	intr_init(void);
 
-#define	spl0()		(void) _spllower(0)
-#define	splx(s)		(void) _splset(s)
-
-typedef int ipl_t;
-typedef struct {
-	ipl_t _sr;
-} ipl_cookie_t;
-
-static inline ipl_cookie_t
-makeiplcookie(ipl_t ipl)
-{
-
-	return (ipl_cookie_t){._sr = ipl_sr_bits[ipl]};
-}
-
-static inline int
-splraiseipl(ipl_cookie_t icookie)
-{
-
-	return _splraise(icookie._sr);
-}
-
-#include <sys/spl.h>
+#ifdef __INTR_PRIVATE
+extern const struct ipl_sr_map __ipl_sr_map_vr;
+extern const struct ipl_sr_map __ipl_sr_map_tx;
+#endif
 
 #endif /* !_LOCORE */
 #endif /* _KERNEL */

Index: src/sys/arch/hpcmips/include/sysconf.h
diff -u src/sys/arch/hpcmips/include/sysconf.h:1.15 src/sys/arch/hpcmips/include/sysconf.h:1.16
--- src/sys/arch/hpcmips/include/sysconf.h:1.15	Tue Dec 15 06:01:43 2009
+++ src/sys/arch/hpcmips/include/sysconf.h	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysconf.h,v 1.15 2009/12/15 06:01:43 mrg Exp $	*/
+/*	$NetBSD: sysconf.h,v 1.16 2011/02/20 07:58:14 matt Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -62,7 +62,7 @@
 	 *	reboot		-	reboot or powerdown
 	 *	clock		-
 	 */
-	void	(*cpu_intr)(uint32_t, uint32_t, vaddr_t, uint32_t);
+	void	(*cpu_intr)(int, vaddr_t, u_int32_t);
 	void	(*cpu_idle)(void);
 	void	(*cons_init)(void);
 	void	(*fb_init)(void **);

Index: src/sys/arch/hpcmips/tx/tx39.c
diff -u src/sys/arch/hpcmips/tx/tx39.c:1.41 src/sys/arch/hpcmips/tx/tx39.c:1.42
--- src/sys/arch/hpcmips/tx/tx39.c:1.41	Thu Jan 21 01:23:15 2010
+++ src/sys/arch/hpcmips/tx/tx39.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tx39.c,v 1.41 2010/01/21 01:23:15 pooka Exp $ */
+/*	$NetBSD: tx39.c,v 1.42 2011/02/20 07:58:14 matt Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tx39.c,v 1.41 2010/01/21 01:23:15 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tx39.c,v 1.42 2011/02/20 07:58:14 matt Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
@@ -39,12 +39,12 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/intr.h>
 
 #include <uvm/uvm_extern.h>
 
 #include <mips/cache.h>
 
-#include <machine/locore.h>   /* cpu_id */
 #include <machine/bootinfo.h> /* bootinfo */
 #include <machine/sysconf.h>  /* platform */
 
@@ -84,7 +84,7 @@
 #define	TX_INTR	cpu_intr	/* locore_mips3 directly call this */
 #endif
 
-extern void TX_INTR(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
+extern void TX_INTR(int, vaddr_t, uint32_t);
 
 void	tx39clock_cpuspeed(int *, int *);
 
@@ -114,7 +114,7 @@
 	platform.reboot		= tx_reboot;
 
 
-	model = MIPS_PRID_REV(cpu_id);
+	model = MIPS_PRID_REV(mips_options.mips_cpu_id);
 
 	switch (model) {
 	default:
@@ -181,9 +181,9 @@
 tx_find_dram(paddr_t start, paddr_t end)
 {
 	char *page, *startaddr, *endaddr;
-	u_int32_t magic0, magic1;
-#define MAGIC0		(*(volatile u_int32_t *)(page + 0))
-#define MAGIC1		(*(volatile u_int32_t *)(page + 4))
+	uint32_t magic0, magic1;
+#define MAGIC0		(*(volatile uint32_t *)(page + 0))
+#define MAGIC1		(*(volatile uint32_t *)(page + 4))
 
 	startaddr = (char *)MIPS_PHYS_TO_KSEG1(start);
 	endaddr = (char *)MIPS_PHYS_TO_KSEG1(end);
@@ -238,7 +238,7 @@
 tx_reboot(int howto, char *bootstr)
 {
 
-	goto *(u_int32_t *)MIPS_RESET_EXC_VEC;
+	goto *(uint32_t *)MIPS_RESET_EXC_VEC;
 }
 
 void

Index: src/sys/arch/hpcmips/tx/tx39icu.c
diff -u src/sys/arch/hpcmips/tx/tx39icu.c:1.27 src/sys/arch/hpcmips/tx/tx39icu.c:1.28
--- src/sys/arch/hpcmips/tx/tx39icu.c:1.27	Mon Dec 20 00:25:34 2010
+++ src/sys/arch/hpcmips/tx/tx39icu.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tx39icu.c,v 1.27 2010/12/20 00:25:34 matt Exp $ */
+/*	$NetBSD: tx39icu.c,v 1.28 2011/02/20 07:58:14 matt Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.27 2010/12/20 00:25:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.28 2011/02/20 07:58:14 matt Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
@@ -305,7 +305,7 @@
 }
 
 void
-TX_INTR(u_int32_t status, u_int32_t cause, u_int32_t pc, u_int32_t ipending)
+TX_INTR(u_int32_t status, u_int32_t cause, vaddr_t pc, u_int32_t ipending)
 {
 	struct tx39icu_softc *sc;
 	tx_chipset_tag_t tc;
@@ -417,8 +417,10 @@
 #endif
 	ci->ci_idepth--;
 #ifdef __HAVE_FAST_SOFTINTS
-	_splset((status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
-	softintr(ipending);
+	ipending &= MIPS_SOFT_INT_MASK;
+	if (ipending == 0)
+		return;
+	softint_process(ipending);
 #endif
 }
 

Index: src/sys/arch/hpcmips/vr/vr.c
diff -u src/sys/arch/hpcmips/vr/vr.c:1.58 src/sys/arch/hpcmips/vr/vr.c:1.59
--- src/sys/arch/hpcmips/vr/vr.c:1.58	Mon Dec 20 00:25:34 2010
+++ src/sys/arch/hpcmips/vr/vr.c	Sun Feb 20 07:58:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vr.c,v 1.58 2010/12/20 00:25:34 matt Exp $	*/
+/*	$NetBSD: vr.c,v 1.59 2011/02/20 07:58:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002
@@ -35,12 +35,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vr.c,v 1.58 2010/12/20 00:25:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vr.c,v 1.59 2011/02/20 07:58:14 matt Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
 #include "opt_kgdb.h"
 
+#define	__INTR_PRIVATE
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/reboot.h>
@@ -127,22 +129,19 @@
  * This is a mask of bits to clear in the SR when we go to a
  * given interrupt priority level.
  */
-const u_int32_t __ipl_sr_bits_vr[_IPL_N] = {
-	0,					/* IPL_NONE */
-
-	MIPS_SOFT_INT_MASK_0,			/* IPL_SOFTCLOCK */
-
-	MIPS_SOFT_INT_MASK_0|
-		MIPS_SOFT_INT_MASK_1,		/* IPL_SOFTNET */
-
-	MIPS_SOFT_INT_MASK_0|
-		MIPS_SOFT_INT_MASK_1|
-		MIPS_INT_MASK_0,		/* IPL_VM */
-
-	MIPS_SOFT_INT_MASK_0|
-		MIPS_SOFT_INT_MASK_1|
-		MIPS_INT_MASK_0|
-		MIPS_INT_MASK_1,		/* IPL_SCHED */
+const struct ipl_sr_map __ipl_sr_map_vr = {
+    .sr_bits = {
+	[IPL_NONE] =		0,
+	[IPL_SOFTCLOCK] =	MIPS_SOFT_INT_MASK_0,
+	[IPL_SOFTNET] =		MIPS_SOFT_INT_MASK,
+	[IPL_VM] =		MIPS_SOFT_INT_MASK
+				| MIPS_INT_MASK_0,
+	[IPL_SCHED] =		MIPS_SOFT_INT_MASK
+				| MIPS_INT_MASK_0
+				| MIPS_INT_MASK_1,
+	[IPL_DDB] =		MIPS_INT_MASK,
+	[IPL_VM] =		MIPS_INT_MASK,
+    },
 };
 
 #if defined(VR41XX) && defined(TX39XX)
@@ -152,7 +151,7 @@
 #endif
 
 void vr_init(void);
-void VR_INTR(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
+void VR_INTR(int, vaddr_t, uint32_t);
 extern void vr_idle(void);
 STATIC void vr_cons_init(void);
 STATIC void vr_fb_init(void **);
@@ -163,8 +162,8 @@
 /*
  * CPU interrupt dispatch table (HwInt[0:3])
  */
-STATIC int vr_null_handler(void *, u_int32_t, u_int32_t);
-STATIC int (*vr_intr_handler[4])(void *, u_int32_t, u_int32_t) = 
+STATIC int vr_null_handler(void *, uint32_t, uint32_t);
+STATIC int (*vr_intr_handler[4])(void *, uint32_t, uint32_t) = 
 {
 	vr_null_handler,
 	vr_null_handler,
@@ -535,51 +534,30 @@
  * Handle interrupts.
  */
 void
-VR_INTR(u_int32_t status, u_int32_t cause, u_int32_t pc, u_int32_t ipending)
+VR_INTR(int ppl, vaddr_t pc, uint32_t status)
 {
-	struct cpu_info *ci;
-
-	ci = curcpu();
-	ci->ci_idepth++;
-	ci->ci_data.cpu_nintr++;
-
-	/* Deal with unneded compare interrupts occasionally so that we can
-	 * keep spllowersoftclock. */
-	if (ipending & MIPS_INT_MASK_5) {
-		mips3_cp0_compare_write(0);
-	}
-
-	if (ipending & MIPS_INT_MASK_1) {
-		_splset(MIPS_SR_INT_IE); /* for spllowersoftclock */
-		/* Remove the lower priority pending bits from status so that
-		 * spllowersoftclock will not happen if other interrupts are
-		 * pending. */
-		(*vr_intr_handler[1])(vr_intr_arg[1], pc, status & ~(ipending
-		& (MIPS_INT_MASK_0|MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)));
-	}
+	uint32_t ipending;
+	int ipl;
 
-	if (ipending & MIPS_INT_MASK_0) {
-		_splset(MIPS_INT_MASK_1|MIPS_SR_INT_IE);
-		(*vr_intr_handler[0])(vr_intr_arg[0], pc, status);
-	}
-	ci->ci_idepth--;
+	while (ppl < (ipl = splintr(&ipending))) {
+		/* Deal with unneded compare interrupts occasionally so that
+		 * we can keep spllowersoftclock. */
+		if (ipending & MIPS_INT_MASK_5) {
+			mips3_cp0_compare_write(0);
+		}
 
-#ifdef __HAVE_FAST_SOFTINTS
-	if (ipending & MIPS_SOFT_INT_MASK_1) {
-		_splset(MIPS_INT_MASK_1|MIPS_INT_MASK_0|MIPS_SR_INT_IE);
-		softintr(MIPS_SOFT_INT_MASK_1);
-	}
+		if (ipending & MIPS_INT_MASK_1) {
+			(*vr_intr_handler[1])(vr_intr_arg[1], pc, ipending);
+		}
 
-	if (ipending & MIPS_SOFT_INT_MASK_0) {
-		_splset(MIPS_SOFT_INT_MASK_1|MIPS_INT_MASK_1|MIPS_INT_MASK_0|
-		    MIPS_SR_INT_IE);
-		softintr(MIPS_SOFT_INT_MASK_0);
+		if (ipending & MIPS_INT_MASK_0) {
+			(*vr_intr_handler[0])(vr_intr_arg[0], pc, status);
+		}
 	}
-#endif
 }
 
 void *
-vr_intr_establish(int line, int (*ih_fun)(void *, u_int32_t, u_int32_t),
+vr_intr_establish(int line, int (*ih_fun)(void *, uint32_t, uint32_t),
     void *ih_arg)
 {
 
@@ -601,7 +579,7 @@
 }
 
 int
-vr_null_handler(void *arg, u_int32_t pc, u_int32_t status)
+vr_null_handler(void *arg, uint32_t pc, uint32_t status)
 {
 
 	printf("vr_null_handler\n");

Index: src/sys/arch/hpcmips/vr/vrdcu.c
diff -u src/sys/arch/hpcmips/vr/vrdcu.c:1.5 src/sys/arch/hpcmips/vr/vrdcu.c:1.6
--- src/sys/arch/hpcmips/vr/vrdcu.c:1.5	Sun Dec 11 12:17:34 2005
+++ src/sys/arch/hpcmips/vr/vrdcu.c	Sun Feb 20 07:58:14 2011
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vrdcu.c,v 1.5 2005/12/11 12:17:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vrdcu.c,v 1.6 2011/02/20 07:58:14 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -219,17 +219,16 @@
 		    bus_size_t boundary, bus_dma_segment_t *segs,
 		    int nsegs, int *rsegs, int flags)
 {
-	extern paddr_t avail_start, avail_end;		/* XXX */
 	paddr_t high;
 
 	DPRINTFN(1, ("_vrdcu_dmamem_alloc\n"));
 
-	high = (avail_end < VRDMAAU_BOUNCE_THRESHOLD ?
-		avail_end : VRDMAAU_BOUNCE_THRESHOLD) - PAGE_SIZE;
+	high = (mips_avail_end < VRDMAAU_BOUNCE_THRESHOLD ?
+		mips_avail_end : VRDMAAU_BOUNCE_THRESHOLD) - PAGE_SIZE;
 	alignment = alignment > VRDMAAU_ALIGNMENT ?
 		    alignment : VRDMAAU_ALIGNMENT;
 
 	return _hpcmips_bd_mem_alloc_range(t, size, alignment, boundary,
 					   segs, nsegs, rsegs, flags,
-					   avail_start, high);
+					   mips_avail_start, high);
 }

Reply via email to