Module Name:    src
Committed By:   matt
Date:           Sun Feb 20 07:52:43 UTC 2011

Modified Files:
        src/sys/arch/arc/arc: autoconf.c bus_dma.c bus_space_sparse.c
            c_magnum.c c_nec_eisa.c c_nec_pci.c cpu.c interrupt.c machdep.c
            p_dti_arcstation.c p_dti_tyne.c p_sni_rm200pci.c
        src/sys/arch/arc/conf: files.arc
        src/sys/arch/arc/include: intr.h
        src/sys/arch/arc/isa: isadma_bounce.c
        src/sys/arch/arc/pci: necpb.c
        src/sys/arch/arc/stand/boot: Makefile boot.c disk.c getchar.c putchar.c
            start.S
Added Files:
        src/sys/arch/arc/include: netbsd32_machdep.h

Log Message:
Merge forward from matt-nb5-mips64.
Adapt to new interrupt/spl framework.
Add LP64 support.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arc/arc/autoconf.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arc/arc/bus_dma.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arc/arc/bus_space_sparse.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arc/arc/c_magnum.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arc/arc/c_nec_eisa.c \
    src/sys/arch/arc/arc/p_dti_arcstation.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arc/arc/c_nec_pci.c \
    src/sys/arch/arc/arc/cpu.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arc/arc/interrupt.c
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arc/arc/p_dti_tyne.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arc/arc/p_sni_rm200pci.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/arc/conf/files.arc
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arc/include/intr.h
cvs rdiff -u -r0 -r1.2 src/sys/arch/arc/include/netbsd32_machdep.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arc/isa/isadma_bounce.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arc/pci/necpb.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arc/stand/boot/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arc/stand/boot/boot.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arc/stand/boot/disk.c \
    src/sys/arch/arc/stand/boot/start.S
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arc/stand/boot/getchar.c \
    src/sys/arch/arc/stand/boot/putchar.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/arc/arc/autoconf.c
diff -u src/sys/arch/arc/arc/autoconf.c:1.32 src/sys/arch/arc/arc/autoconf.c:1.33
--- src/sys/arch/arc/arc/autoconf.c:1.32	Mon Dec  3 15:33:12 2007
+++ src/sys/arch/arc/arc/autoconf.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.32 2007/12/03 15:33:12 ad Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.33 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $	*/
 
 /*
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.32 2007/12/03 15:33:12 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.33 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -148,9 +148,10 @@
 	 * to disable it other than setting status register by spl(9).
 	 */
 	_spllower(MIPS_INT_MASK_5);
+#error need fix
 #else
 	/* enable all source forcing SOFT_INTs cleared */
-	_splnone();
+	spl0();
 #endif
 }
 

Index: src/sys/arch/arc/arc/bus_dma.c
diff -u src/sys/arch/arc/arc/bus_dma.c:1.31 src/sys/arch/arc/arc/bus_dma.c:1.32
--- src/sys/arch/arc/arc/bus_dma.c:1.31	Fri Nov 12 13:18:56 2010
+++ src/sys/arch/arc/arc/bus_dma.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.31 2010/11/12 13:18:56 uebayasi Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.32 2011/02/20 07:52:42 matt Exp $	*/
 /*	NetBSD: bus_dma.c,v 1.20 2000/01/10 03:24:36 simonb Exp 	*/
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.31 2010/11/12 13:18:56 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.32 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,8 +53,6 @@
 		    void *, bus_size_t, struct vmspace *, int, paddr_t *,
 		    int *, int);
 
-extern paddr_t avail_start, avail_end;	/* from pmap.c */
-
 void
 _bus_dma_tag_init(bus_dma_tag_t t)
 {
@@ -405,6 +403,7 @@
 _bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
     bus_size_t len, int ops)
 {
+	const struct mips_cache_info * const mci = &mips_cache_info;
 	bus_size_t minlen;
 	bus_addr_t addr, start, end, preboundary, firstboundary, lastboundary;
 	int i, useindex;
@@ -517,19 +516,19 @@
 
 		case BUS_DMASYNC_PREREAD:
 			end = start + minlen;
-			preboundary = start & ~mips_dcache_align_mask;
-			firstboundary = (start + mips_dcache_align_mask)
-			    & ~mips_dcache_align_mask;
-			lastboundary = end & ~mips_dcache_align_mask;
+			preboundary = start & ~mci->mci_dcache_align_mask;
+			firstboundary = (start + mci->mci_dcache_align_mask)
+			    & ~mci->mci_dcache_align_mask;
+			lastboundary = end & ~mci->mci_dcache_align_mask;
 			if (preboundary < start && preboundary < lastboundary)
 				mips_dcache_wbinv_range(preboundary,
-				    mips_dcache_align);
+				    mci->mci_dcache_align);
 			if (firstboundary < lastboundary)
 				mips_dcache_inv_range(firstboundary,
 				    lastboundary - firstboundary);
 			if (lastboundary < end)
 				mips_dcache_wbinv_range(lastboundary,
-				    mips_dcache_align);
+				    mci->mci_dcache_align);
 			break;
 
 		case BUS_DMASYNC_PREWRITE:
@@ -555,7 +554,8 @@
 {
 
 	return _bus_dmamem_alloc_range(t, size, alignment, boundary,
-	    segs, nsegs, rsegs, flags, avail_start, trunc_page(avail_end));
+	    segs, nsegs, rsegs, flags, mips_avail_start,
+	    trunc_page(mips_avail_end));
 }
 
 /*
@@ -575,7 +575,7 @@
 	/* Always round the size. */
 	size = round_page(size);
 
-	high = avail_end - PAGE_SIZE;
+	high = mips_avail_end - PAGE_SIZE;
 
 	/*
 	 * Allocate pages from the VM system.
@@ -599,7 +599,7 @@
 	for (; m != NULL; m = TAILQ_NEXT(m, pageq.queue)) {
 		curaddr = VM_PAGE_TO_PHYS(m);
 #ifdef DIAGNOSTIC
-		if (curaddr < avail_start || curaddr >= high) {
+		if (curaddr < mips_avail_start || curaddr >= high) {
 			printf("uvm_pglistalloc returned non-sensical"
 			    " address 0x%llx\n", (long long)curaddr);
 			panic("_bus_dmamem_alloc_range");

Index: src/sys/arch/arc/arc/bus_space_sparse.c
diff -u src/sys/arch/arc/arc/bus_space_sparse.c:1.16 src/sys/arch/arc/arc/bus_space_sparse.c:1.17
--- src/sys/arch/arc/arc/bus_space_sparse.c:1.16	Sat Nov  7 07:27:41 2009
+++ src/sys/arch/arc/arc/bus_space_sparse.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_sparse.c,v 1.16 2009/11/07 07:27:41 cegger Exp $	*/
+/*	$NetBSD: bus_space_sparse.c,v 1.17 2011/02/20 07:52:42 matt Exp $	*/
 /*	NetBSD: bus_machdep.c,v 1.1 2000/01/26 18:48:00 drochner Exp 	*/
 
 /*-
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.16 2009/11/07 07:27:41 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space_sparse.c,v 1.17 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -71,7 +71,7 @@
 		pte = kvtopte(start);
 		entry = pte->pt_entry & mask;
 		pte->pt_entry &= entry;
-		MachTLBUpdate(start, entry);
+		tlb_update(start, entry);
 	}
 }
 

Index: src/sys/arch/arc/arc/c_magnum.c
diff -u src/sys/arch/arc/arc/c_magnum.c:1.20 src/sys/arch/arc/arc/c_magnum.c:1.21
--- src/sys/arch/arc/arc/c_magnum.c:1.20	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/arc/arc/c_magnum.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_magnum.c,v 1.20 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: c_magnum.c,v 1.21 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $	*/
 
 /*
@@ -43,11 +43,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.20 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.21 2011/02/20 07:52:42 matt Exp $");
 
+#define __INTR_PRIVATE
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/intr.h>
 #include <sys/device.h>
+
 #include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
@@ -83,26 +86,20 @@
  * This is a mask of bits to clear in the SR when we go to a
  * given interrupt priority level.
  */
-static const uint32_t magnum_ipl_sr_bits[_IPL_N] = {
-	[IPL_NONE] = 0,
-	[IPL_SOFTCLOCK] =
-	    MIPS_SOFT_INT_MASK_0,
-	[IPL_SOFTNET] = 
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1,
-	[IPL_VM] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2 |
-	    MIPS_INT_MASK_3,
-	[IPL_SCHED] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2 |
-	    MIPS_INT_MASK_3 |
-	    MIPS_INT_MASK_4 |
-	    MIPS_INT_MASK_5,
+static const struct ipl_sr_map magnum_ipl_sr_map = {
+    .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
+				| MIPS_INT_MASK_1
+				| MIPS_INT_MASK_2
+				| MIPS_INT_MASK_3,
+	[IPL_SCHED] =		MIPS_INT_MASK,
+	[IPL_DDB] =		MIPS_INT_MASK,
+	[IPL_HIGH] =		MIPS_INT_MASK,
+    },
 };
 
 uint32_t
@@ -193,7 +190,7 @@
 	/*
 	 * Initialize interrupt priority
 	 */
-	ipl_sr_bits = magnum_ipl_sr_bits;
+	ipl_sr_map = magnum_ipl_sr_map;
 
 	/*
 	 * Initialize I/O address offset

Index: src/sys/arch/arc/arc/c_nec_eisa.c
diff -u src/sys/arch/arc/arc/c_nec_eisa.c:1.15 src/sys/arch/arc/arc/c_nec_eisa.c:1.16
--- src/sys/arch/arc/arc/c_nec_eisa.c:1.15	Wed May 14 13:29:27 2008
+++ src/sys/arch/arc/arc/c_nec_eisa.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_nec_eisa.c,v 1.15 2008/05/14 13:29:27 tsutsui Exp $	*/
+/*	$NetBSD: c_nec_eisa.c,v 1.16 2011/02/20 07:52:42 matt Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -55,12 +55,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.15 2008/05/14 13:29:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: c_nec_eisa.c,v 1.16 2011/02/20 07:52:42 matt Exp $");
 
+#define __INTR_PRIVATE
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kcore.h>
 #include <sys/device.h>
+#include <sys/intr.h>
+
 #include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
@@ -103,25 +106,19 @@
  * This is a mask of bits to clear in the SR when we go to a
  * given interrupt priority level.
  */
-static const uint32_t nec_eisa_ipl_sr_bits[_IPL_N] = {
-	[IPL_NONE] = 0,
-	[IPL_SOFTCLOCK] =
-	    MIPS_SOFT_INT_MASK_0,
-	[IPL_SOFTNET] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1,
-	[IPL_VM] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2,
-	[IPL_SCHED] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2 |
-	    MIPS_INT_MASK_3 |
-	    MIPS_INT_MASK_4 |
-	    MIPS_INT_MASK_5,
+static const struct ipl_sr_map nec_eisa_ipl_sr_map = {
+    .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
+				| MIPS_INT_MASK_1
+				| MIPS_INT_MASK_2,
+	[IPL_SCHED] =		MIPS_INT_MASK,
+	[IPL_DDB] =		MIPS_INT_MASK,
+	[IPL_HIGH] =		MIPS_INT_MASK,
+    },
 };
 
 int
@@ -161,7 +158,7 @@
 	/*
 	 * Initialize interrupt priority
 	 */
-	ipl_sr_bits = nec_eisa_ipl_sr_bits;
+	ipl_sr_map = nec_eisa_ipl_sr_map;
 
 	/*
 	 * Initialize I/O address offset
Index: src/sys/arch/arc/arc/p_dti_arcstation.c
diff -u src/sys/arch/arc/arc/p_dti_arcstation.c:1.15 src/sys/arch/arc/arc/p_dti_arcstation.c:1.16
--- src/sys/arch/arc/arc/p_dti_arcstation.c:1.15	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/arc/arc/p_dti_arcstation.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: p_dti_arcstation.c,v 1.15 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: p_dti_arcstation.c,v 1.16 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $	*/
 
 /*
@@ -39,12 +39,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: p_dti_arcstation.c,v 1.15 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: p_dti_arcstation.c,v 1.16 2011/02/20 07:52:42 matt Exp $");
 
+#define __INTR_PRIVATE
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <uvm/uvm.h>
+#include <sys/intr.h>
+
+#include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
 #include <machine/bus.h>
@@ -100,28 +103,16 @@
  * given interrupt priority level.
  */
 /* XXX see comments in p_dti_arcstation_init() */
-static const uint32_t dti_arcstation_ipl_sr_bits[_IPL_N] = {
-	[IPL_NONE] = 0,
-	[IPL_SOFTCLOCK] =
-	    MIPS_SOFT_INT_MASK_0,
-	[IPL_SOFTNET] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1,
-	[IPL_VM] =	/* XXX */
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0|
-	    MIPS_INT_MASK_1|
-	    MIPS_INT_MASK_2|
-	    MIPS_INT_MASK_3|
-	    MIPS_INT_MASK_4|
-	    MIPS_INT_MASK_5,
-	[IPL_SCHED] =	/* XXX */
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0|
-	    MIPS_INT_MASK_1|
-	    MIPS_INT_MASK_2|
-	    MIPS_INT_MASK_3|
-	    MIPS_INT_MASK_4|
-	    MIPS_INT_MASK_5,
+static const struct ipl_sr_map dti_arcstation_ipl_sr_map = {
+    .sr_bits = {
+	[IPL_NONE] =		0,
+	[IPL_SOFTCLOCK] =	MIPS_SOFT_INT_MASK_0,
+	[IPL_SOFTNET] =		MIPS_SOFT_INT_MASK,
+	[IPL_VM] =		MIPS_INT_MASK,	/* XXX */
+	[IPL_SCHED] =		MIPS_INT_MASK,
+	[IPL_DDB] =		MIPS_INT_MASK,
+	[IPL_HIGH] =		MIPS_INT_MASK,
+     },
 };
 
 #if NPC_ISA > 0 || NOPMS_ISA > 0
@@ -211,7 +202,7 @@
 	 * or
 	 *	- use MIP3_INTERNAL_TIMER_INTERRUPT for clock
 	 */
-	ipl_sr_bits = dti_arcstation_ipl_sr_bits;
+	ipl_sr_map = dti_arcstation_ipl_sr_map;
 
 	/*
 	 * XXX - should be enabled, if tested.

Index: src/sys/arch/arc/arc/c_nec_pci.c
diff -u src/sys/arch/arc/arc/c_nec_pci.c:1.17 src/sys/arch/arc/arc/c_nec_pci.c:1.18
--- src/sys/arch/arc/arc/c_nec_pci.c:1.17	Mon Dec  3 15:33:13 2007
+++ src/sys/arch/arc/arc/c_nec_pci.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_nec_pci.c,v 1.17 2007/12/03 15:33:13 ad Exp $	*/
+/*	$NetBSD: c_nec_pci.c,v 1.18 2011/02/20 07:52:42 matt Exp $	*/
 
 /*-
  * Copyright (C) 2000 Shuichiro URATA.  All rights reserved.
@@ -31,12 +31,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: c_nec_pci.c,v 1.17 2007/12/03 15:33:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: c_nec_pci.c,v 1.18 2011/02/20 07:52:42 matt Exp $");
 
+#define __INTR_PRIVATE
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kcore.h>
 #include <sys/device.h>
+#include <sys/intr.h>
+
 #include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
@@ -110,25 +113,19 @@
  * This is a mask of bits to clear in the SR when we go to a
  * given interrupt priority level.
  */
-static const uint32_t nec_pci_ipl_sr_bits[_IPL_N] = {
-	[IPL_NONE] = 0,
-	[IPL_SOFTCLOCK] =
-	    MIPS_SOFT_INT_MASK_0,
-	[IPL_SOFTNET] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1,
-	[IPL_VM] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 | 
-	    MIPS_INT_MASK_2,
-	[IPL_SCHED] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2 |
-	    MIPS_INT_MASK_3 |
-	    MIPS_INT_MASK_4 |
-	    MIPS_INT_MASK_5,
+static const struct ipl_sr_map nec_pci_ipl_sr_map = {
+    .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
+				| MIPS_INT_MASK_1
+				| MIPS_INT_MASK_2,
+	[IPL_SCHED] =		MIPS_INT_MASK,
+	[IPL_DDB] =		MIPS_INT_MASK,
+	[IPL_HIGH] =		MIPS_INT_MASK,
+    },
 };
 
 static u_int
@@ -186,7 +183,7 @@
 	/*
 	 * Initialize interrupt priority
 	 */
-	ipl_sr_bits = nec_pci_ipl_sr_bits;
+	ipl_sr_map = nec_pci_ipl_sr_map;
 
 	/*
 	 * Initialize I/O address offset
Index: src/sys/arch/arc/arc/cpu.c
diff -u src/sys/arch/arc/arc/cpu.c:1.17 src/sys/arch/arc/arc/cpu.c:1.18
--- src/sys/arch/arc/arc/cpu.c:1.17	Fri Nov 27 03:23:04 2009
+++ src/sys/arch/arc/arc/cpu.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.17 2009/11/27 03:23:04 rmind Exp $	*/
+/*	$NetBSD: cpu.c,v 1.18 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: cpu.c,v 1.8 1997/04/19 17:19:41 pefo Exp $ */
 
 /*
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.17 2009/11/27 03:23:04 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -71,11 +71,12 @@
 cpuattach(device_t parent, device_t self, void *aux)
 {
 
+	struct cpu_info * const ci = curcpu();
+
+	ci->ci_dev = self;
+	self->dv_private = ci;
+
 	aprint_normal(": ");
 
-#if 1
-	cpu_identify();
-#else /* XXX - before do this, fix pmax, newsmips */
-	cpu_identify(dev);
-#endif
+	cpu_identify(self);
 }

Index: src/sys/arch/arc/arc/interrupt.c
diff -u src/sys/arch/arc/arc/interrupt.c:1.7 src/sys/arch/arc/arc/interrupt.c:1.8
--- src/sys/arch/arc/arc/interrupt.c:1.7	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/arc/arc/interrupt.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.7 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.8 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: trap.c,v 1.22 1999/05/24 23:08:59 jason Exp $	*/
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.7 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.8 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,74 +95,58 @@
 
 /*
  * Handle an interrupt.
- * N.B., curlwp might be NULL.
  */
 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)
 {
-	struct clockframe cf;
 	struct cpu_inttab *inttab;
-	struct cpu_info *ci;
-	uint32_t handled;
+	struct clockframe cf;
+	uint32_t ipending;
 	u_int i;
+	int ipl;
 
-	handled = 0;
-	ci = curcpu();
-	ci->ci_data.cpu_nintr++;
-	ci->ci_idepth++;
+	curcpu()->ci_data.cpu_nintr++;
 
 	cf.pc = pc;
 	cf.sr = status;
+	cf.intr = (curcpu()->ci_idepth > 1);
 
-	/* check MIPS3 internal clock interrupt */
-	if (ipending & MIPS_INT_MASK_5) {
+	while (ppl < (ipl = splintr(&ipending))) {
+		/* check MIPS3 internal clock interrupt */
+		if (ipending & MIPS_INT_MASK_5) {
 #ifdef ENABLE_INT5_STATCLOCK
-		/* call statclock(9) handler */
-		statclockintr(&cf);
-		statclock_ev.ev_count++;
+			/* call statclock(9) handler */
+			statclockintr(&cf);
+			statclock_ev.ev_count++;
 #else
-		/*
-		 *  Writing a value to the Compare register,
-		 *  as a side effect, clears the timer interrupt request.
-		 */
-		mips3_cp0_compare_write(0);
+			/*
+			 * Writing a value to the Compare register, as a side
+			 * effect, clears the timer interrupt request.
+			 */
+			mips3_cp0_compare_write(0);
+		}
 #endif
-		handled |= MIPS_INT_MASK_5;
-	}
-	_splset((status & handled) | MIPS_SR_INT_IE);
-
-	/*
-	 *  If there is an independent timer interrupt handler, call it first.
-	 *  Called interrupt routine returns mask of interrupts to be reenabled.
-	 */
-	inttab = &cpu_int_tab[ARC_INTPRI_TIMER_INT];
-	if (inttab->int_mask & ipending) {
-		handled |= (*inttab->int_hand)(ipending, &cf);
-	}
-	_splset((status & handled) | MIPS_SR_INT_IE);
 
-	inttab++;
-
-	/*
-	 *  Check off all other enabled interrupts.
-	 *  Called handlers return mask of interrupts to be reenabled.
-	 */
-	for (i = ARC_INTPRI_TIMER_INT + 1; i < ARC_NINTPRI; i++) {
+		/*
+		 * If there is an independent timer interrupt handler,
+		 * call it first.
+		 */
+		inttab = &cpu_int_tab[ARC_INTPRI_TIMER_INT];
 		if (inttab->int_mask & ipending) {
-			handled |= (*inttab->int_hand)(ipending, &cf);
+			(*inttab->int_hand)(ipending, &cf);
+		}
+
+		/*
+		 *  Check off all other enabled interrupts.
+		 *  Called handlers return mask of interrupts to be reenabled.
+		 */
+		for (inttab++, i = ARC_INTPRI_TIMER_INT + 1;
+		     i < ARC_NINTPRI;
+		     inttab++, i++) {
+			if (inttab->int_mask & ipending) {
+				(*inttab->int_hand)(ipending, &cf);
+			}
 		}
-		inttab++;
+		(void)splhigh();
 	}
-	cause &= ~handled;
-	_splset((status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
-	ci->ci_idepth--;
-
-#ifdef __HAVE_FAST_SOFTINTS
-	/* software interrupts */
-	ipending &= (MIPS_SOFT_INT_MASK_1|MIPS_SOFT_INT_MASK_0);
-	if (ipending == 0)
-		return;
-	_clrsoftintr(ipending);
-	softintr_dispatch(ipending);
-#endif
 }

Index: src/sys/arch/arc/arc/machdep.c
diff -u src/sys/arch/arc/arc/machdep.c:1.122 src/sys/arch/arc/arc/machdep.c:1.123
--- src/sys/arch/arc/arc/machdep.c:1.122	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/arc/arc/machdep.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.122 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.123 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $	*/
 
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.122 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.123 2011/02/20 07:52:42 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ddbparam.h"
@@ -163,16 +163,6 @@
 const char *firmware_getenv(const char *env);
 void arc_sysreset(bus_addr_t, bus_size_t);
 
-/*
- * 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.
- */
-int	safepri = MIPS3_PSL_LOWIPL;
-
-const uint32_t *ipl_sr_bits;
-
 extern char kernel_text[], edata[], end[];
 
 /*
@@ -334,7 +324,7 @@
 	 *
 	 * This may clobber PTEs needed by the BIOS.
 	 */
-	mips_vector_init();
+	mips_vector_init(NULL, false);
 
 	/*
 	 * Map critical I/O spaces (e.g. for console printf(9)) on KSEG2.
@@ -352,9 +342,11 @@
 	curcpu()->ci_cycles_per_hz = (curcpu()->ci_cpu_freq + hz / 2) / hz;
 	curcpu()->ci_divisor_delay =
 	    ((curcpu()->ci_cpu_freq + 500000) / 1000000);
-	if (mips_cpu_flags & CPU_MIPS_DOUBLE_COUNT) {
+	curcpu()->ci_cctr_freq = curcpu()->ci_cpu_freq;
+	if (mips_options.mips_cpu_flags & CPU_MIPS_DOUBLE_COUNT) {
 		curcpu()->ci_cycles_per_hz /= 2;
 		curcpu()->ci_divisor_delay /= 2;
+		curcpu()->ci_cctr_freq /= 2;
 	}
 	sprintf(cpu_model, "%s %s%s",
 	    platform->vendor, platform->model, platform->variant);
@@ -445,14 +437,13 @@
 	 * Allocate uarea page for lwp0 and set it.
 	 */
 	mips_init_lwp0_uarea();
-
 }
 
 void
 mips_machdep_cache_config(void)
 {
 
-	mips_sdcache_size = arc_cpu_l2cache_size;
+	mips_cache_info.mci_sdcache_size = arc_cpu_l2cache_size;
 }
 
 /*
@@ -574,8 +565,7 @@
 {
 
 	/* take a snap shot before clobbering any registers */
-	if (curlwp)
-		savectx(curpcb);
+	savectx(curpcb);
 
 #ifdef DEBUG
 	if (panicstr)

Index: src/sys/arch/arc/arc/p_dti_tyne.c
diff -u src/sys/arch/arc/arc/p_dti_tyne.c:1.18 src/sys/arch/arc/arc/p_dti_tyne.c:1.19
--- src/sys/arch/arc/arc/p_dti_tyne.c:1.18	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/arc/arc/p_dti_tyne.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: p_dti_tyne.c,v 1.18 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: p_dti_tyne.c,v 1.19 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $	*/
 
 /*
@@ -38,16 +38,19 @@
  *	from: @(#)machdep.c	8.3 (Berkeley) 1/12/94
  */
 
+#define __INTR_PRIVATE
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: p_dti_tyne.c,v 1.18 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: p_dti_tyne.c,v 1.19 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <uvm/uvm.h>
+#include <sys/bus.h>
+#include <sys/intr.h>
+
+#include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
-#include <machine/bus.h>
 #include <machine/pio.h>
 #include <machine/platform.h>
 #include <machine/wired_map.h>
@@ -101,28 +104,18 @@
  * given interrupt priority level.
  */
 /* XXX see comments in p_dti_tyne_init() */
-static const uint32_t dti_tyne_ipl_sr_bits[_IPL_N] = {
-	[IPL_NONE] =0,
-	[IPL_SOFTCLOCK] =
-	    MIPS_SOFT_INT_MASK_0,
-	[IPL_SOFTNET] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1,
-	[IPL_VM] =	/* XXX */
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0|
-	    MIPS_INT_MASK_1|
-	    MIPS_INT_MASK_2|
-	    MIPS_INT_MASK_3|
-	    MIPS_INT_MASK_4|
-	    MIPS_INT_MASK_5,
-	[IPL_SCHED] =	/* XXX */
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0|
-	    MIPS_INT_MASK_1|
-	    MIPS_INT_MASK_2|
-	    MIPS_INT_MASK_3|
-	    MIPS_INT_MASK_4|
-	    MIPS_INT_MASK_5,
+static const struct ipl_sr_map dti_tyne_ipl_sr_map = {
+    .sr_bits = {
+	[IPL_NONE] = 0,
+	[IPL_SOFTCLOCK] = MIPS_SOFT_INT_MASK_0,
+	[IPL_SOFTBIO] = MIPS_SOFT_INT_MASK_0,
+	[IPL_SOFTNET] = MIPS_SOFT_INT_MASK,
+	[IPL_SOFTSERIAL] = MIPS_SOFT_INT_MASK,
+	[IPL_VM] =	MIPS_INT_MASK, /* XXX */
+	[IPL_SCHED] =	MIPS_INT_MASK,
+	[IPL_DDB] =	MIPS_INT_MASK,
+	[IPL_HIGH] =	MIPS_INT_MASK,
+    },
 };
 
 #if NPC_ISA > 0 || NOPMS_ISA > 0
@@ -204,7 +197,7 @@
 	 * or
 	 *	- use MIP3_INTERNAL_TIMER_INTERRUPT for clock
 	 */
-	ipl_sr_bits = dti_tyne_ipl_sr_bits;
+	ipl_sr_map = dti_tyne_ipl_sr_map;
 
 	/*
 	 * XXX - should be enabled, if tested.

Index: src/sys/arch/arc/arc/p_sni_rm200pci.c
diff -u src/sys/arch/arc/arc/p_sni_rm200pci.c:1.14 src/sys/arch/arc/arc/p_sni_rm200pci.c:1.15
--- src/sys/arch/arc/arc/p_sni_rm200pci.c:1.14	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/arc/arc/p_sni_rm200pci.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: p_sni_rm200pci.c,v 1.14 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: p_sni_rm200pci.c,v 1.15 2011/02/20 07:52:42 matt Exp $	*/
 /*	$OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $	*/
 
 /*
@@ -38,16 +38,19 @@
  *	from: @(#)machdep.c	8.3 (Berkeley) 1/12/94
  */
 
+#define __INTR_PRIVATE
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: p_sni_rm200pci.c,v 1.14 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: p_sni_rm200pci.c,v 1.15 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <uvm/uvm.h>
+#include <sys/intr.h>
+#include <sys/bus.h>
+
+#include <uvm/uvm_extern.h>
 
 #include <machine/autoconf.h>
-#include <machine/bus.h>
 #include <machine/pio.h>
 #include <machine/platform.h>
 #include <machine/wired_map.h>
@@ -84,28 +87,16 @@
  * given interrupt priority level.
  */
 /* XXX lack of hardware info for sni_rm200pci */
-static const uint32_t sni_rm200pci_ipl_sr_bits[_IPL_N] = {
+static const struct ipl_sr_map sni_rm200pci_ipl_sr_map = {
+    .sr_bits = {
 	[IPL_NONE] = 0,
-	[IPL_SOFTCLOCK] =
-	    MIPS_SOFT_INT_MASK_0,
-	[IPL_SOFTNET] =
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1,
-	[IPL_VM] =	/* XXX */
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2 |
-	    MIPS_INT_MASK_3 |
-	    MIPS_INT_MASK_4 |
-	    MIPS_INT_MASK_5,
-	[IPL_SCHED] =	/* XXX */
-	    MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
-	    MIPS_INT_MASK_0 |
-	    MIPS_INT_MASK_1 |
-	    MIPS_INT_MASK_2 |
-	    MIPS_INT_MASK_3 |
-	    MIPS_INT_MASK_4 |
-	    MIPS_INT_MASK_5,
+	[IPL_SOFTCLOCK] =	MIPS_SOFT_INT_MASK_0,
+	[IPL_SOFTNET] =		MIPS_SOFT_INT_MASK,
+	[IPL_VM] =		MIPS_INT_MASK, 	/* XXX */
+	[IPL_SCHED] =		MIPS_INT_MASK,
+	[IPL_DDB] =		MIPS_INT_MASK,
+	[IPL_HIGH] =		MIPS_INT_MASK,
+    },
 };
 
 /*
@@ -122,7 +113,7 @@
 	/*
 	 * Initialize interrupt priority
 	 */
-	ipl_sr_bits = sni_rm200pci_ipl_sr_bits;
+	ipl_sr_map = sni_rm200pci_ipl_sr_map;
 
 	/*
 	 * XXX - should be enabled, if tested.

Index: src/sys/arch/arc/conf/files.arc
diff -u src/sys/arch/arc/conf/files.arc:1.63 src/sys/arch/arc/conf/files.arc:1.64
--- src/sys/arch/arc/conf/files.arc:1.63	Tue Nov  2 15:50:09 2010
+++ src/sys/arch/arc/conf/files.arc	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arc,v 1.63 2010/11/02 15:50:09 tsutsui Exp $
+#	$NetBSD: files.arc,v 1.64 2011/02/20 07:52:42 matt Exp $
 #	$OpenBSD: files.arc,v 1.21 1999/09/11 10:20:20 niklas Exp $
 #
 # maxpartitions must be first item in files.${ARCH}
@@ -79,7 +79,6 @@
 file	arch/arc/arc/arcbios.c
 
 file	arch/mips/mips/mips3_clock.c
-file	arch/mips/mips/softintr.c
 
 ##
 ##	Machine-independent ATAPI drivers

Index: src/sys/arch/arc/include/intr.h
diff -u src/sys/arch/arc/include/intr.h:1.22 src/sys/arch/arc/include/intr.h:1.23
--- src/sys/arch/arc/include/intr.h:1.22	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/arc/include/intr.h	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.22 2008/04/28 20:23:13 martin Exp $	*/
+/*	$NetBSD: intr.h,v 1.23 2011/02/20 07:52:42 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,63 +32,11 @@
 #ifndef _ARC_INTR_H_
 #define _ARC_INTR_H_
 
-#define IPL_NONE	0	/* disable only this interrupt */
-#define IPL_SOFTCLOCK	1	/* generic software interrupts (SI 0) */
-#define IPL_SOFTBIO	1	/* clock 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
-
-#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_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/locore.h>
-
-extern const uint32_t *ipl_sr_bits;
-
-#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>
-
-#include <mips/softintr.h>
-
-struct clockframe;
 void arc_set_intr(uint32_t, uint32_t (*)(uint32_t, struct clockframe *), int);
 extern uint32_t cpu_int_mask;
 

Index: src/sys/arch/arc/isa/isadma_bounce.c
diff -u src/sys/arch/arc/isa/isadma_bounce.c:1.11 src/sys/arch/arc/isa/isadma_bounce.c:1.12
--- src/sys/arch/arc/isa/isadma_bounce.c:1.11	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/arc/isa/isadma_bounce.c	Sun Feb 20 07:52:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isadma_bounce.c,v 1.11 2008/04/28 20:23:13 martin Exp $ */
+/* $NetBSD: isadma_bounce.c,v 1.12 2011/02/20 07:52:42 matt Exp $ */
 /* NetBSD: isadma_bounce.c,v 1.2 2000/06/01 05:49:36 thorpej Exp  */
 
 /*-
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isadma_bounce.c,v 1.11 2008/04/28 20:23:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isadma_bounce.c,v 1.12 2011/02/20 07:52:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,8 +51,6 @@
 
 #include <uvm/uvm_extern.h>
 
-extern paddr_t avail_end;	/* from pmap.c */
-
 /*
  * Cookie used by bouncing ISA DMA.  A pointer to one of these is stashed
  * in the DMA map.
@@ -174,7 +172,7 @@
 	 * ISA DMA controller), we may have to bounce it as well.
 	 */
 	cookieflags = 0;
-	if (avail_end > ISA_DMA_BOUNCE_THRESHOLD ||
+	if (mips_avail_end > ISA_DMA_BOUNCE_THRESHOLD ||
 	    ((map->_dm_size / PAGE_SIZE) + 1) > map->_dm_segcnt) {
 		cookieflags |= ID_MIGHT_NEED_BOUNCE;
 		cookiesize += (sizeof(bus_dma_segment_t) *
@@ -570,10 +568,10 @@
 {
 	paddr_t high;
 
-	if (avail_end > ISA_DMA_BOUNCE_THRESHOLD)
+	if (mips_avail_end > ISA_DMA_BOUNCE_THRESHOLD)
 		high = trunc_page(ISA_DMA_BOUNCE_THRESHOLD);
 	else
-		high = trunc_page(avail_end);
+		high = trunc_page(mips_avail_end);
 
 	return _bus_dmamem_alloc_range(t, size, alignment, boundary,
 	    segs, nsegs, rsegs, flags, 0, high);

Index: src/sys/arch/arc/pci/necpb.c
diff -u src/sys/arch/arc/pci/necpb.c:1.33 src/sys/arch/arc/pci/necpb.c:1.34
--- src/sys/arch/arc/pci/necpb.c:1.33	Tue Nov  2 16:03:47 2010
+++ src/sys/arch/arc/pci/necpb.c	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: necpb.c,v 1.33 2010/11/02 16:03:47 tsutsui Exp $	*/
+/*	$NetBSD: necpb.c,v 1.34 2011/02/20 07:52:43 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.33 2010/11/02 16:03:47 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.34 2011/02/20 07:52:43 matt Exp $");
 
 #include "opt_pci.h"
 
@@ -246,7 +246,7 @@
 	pc->pc_memext = extent_create("necpbmem", 0x08000000, 0x3fffffff,
 	    M_DEVBUF, NULL, 0, EX_NOWAIT);
 	pci_configure_bus(pc, pc->pc_ioext, pc->pc_memext, NULL, 0,
-	    mips_dcache_align);
+	    mips_cache_info.mci_dcache_align);
 #endif
 
 	out32(RD94_SYS_PCI_INTMASK, 0xf);

Index: src/sys/arch/arc/stand/boot/Makefile
diff -u src/sys/arch/arc/stand/boot/Makefile:1.11 src/sys/arch/arc/stand/boot/Makefile:1.12
--- src/sys/arch/arc/stand/boot/Makefile:1.11	Sat Jan 22 19:19:16 2011
+++ src/sys/arch/arc/stand/boot/Makefile	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2011/01/22 19:19:16 joerg Exp $
+# $NetBSD: Makefile,v 1.12 2011/02/20 07:52:43 matt Exp $
 
 .include <bsd.own.mk>
 .include <bsd.sys.mk>	# for ${HOST_SH}
@@ -12,9 +12,13 @@
 
 NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
 
-SRCS=	start.S
+.PATH:		${S}/dev/arcbios
+
+SRCS=	start.S arcbios_calls.S
 SRCS+=	boot.c bootinfo.c conf.c devopen.c disk.c getchar.c getopt.c putchar.c
 
+.include "${S}/dev/arcbios/Makefile.inc"
+
 # XXX SHOULD NOT NEED TO DEFINE THESE!
 LIBCRT0=
 LIBC=
@@ -24,7 +28,7 @@
 AFLAGS=    -x assembler-with-cpp -mno-abicalls -mips2
 AFLAGS+=   -D_LOCORE -D_KERNEL
 CFLAGS=    -Os -mmemcpy -G 1024
-CFLAGS+=   -ffreestanding -mno-abicalls -msoft-float -mips2
+CFLAGS+=   -ffreestanding -mno-abicalls -msoft-float -mips2 -mabi=32
 CFLAGS+=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
 CPPFLAGS+= -nostdinc -I. -I${S}
 CPPFLAGS+= -D_STANDALONE -DNO_ABICALLS -D${MACHINE}

Index: src/sys/arch/arc/stand/boot/boot.c
diff -u src/sys/arch/arc/stand/boot/boot.c:1.7 src/sys/arch/arc/stand/boot/boot.c:1.8
--- src/sys/arch/arc/stand/boot/boot.c:1.7	Sat Jan 22 19:19:16 2011
+++ src/sys/arch/arc/stand/boot/boot.c	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.7 2011/01/22 19:19:16 joerg Exp $	*/
+/*	$NetBSD: boot.c,v 1.8 2011/02/20 07:52:43 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -113,8 +113,6 @@
 
 static char bootinfo[BOOTINFO_SIZE];
 
-extern const struct arcbios_fv *ARCBIOS;
-
 int main(int, char **);
 static char *firmware_getenv(char *);
 
@@ -168,7 +166,7 @@
 	bootpath = firmware_getenv("OSLoadPartition");
 	if (bootpath == NULL)
 		bootpath =
-		    (*ARCBIOS->GetEnvironmentVariable)("OSLoadPartition");
+		    arcbios_GetEnvironmentVariable("OSLoadPartition");
 
 	if (bootpath == NULL) {
 		/* XXX need to actually do the fixup */
@@ -183,7 +181,7 @@
 
 	kernel = firmware_getenv("OSLoadFilename");
 	if (kernel == NULL)
-		kernel = (*ARCBIOS->GetEnvironmentVariable)("OSLoadFilename");
+		kernel = arcbios_GetEnvironmentVariable("OSLoadFilename");
 
 	DPRINTF("kernel = %s\n", kernel ? kernel : "<null>");
 
@@ -276,5 +274,5 @@
 _rtt(void)
 {
 
-	(*ARCBIOS->Halt)();
+	arcbios_Halt();
 }

Index: src/sys/arch/arc/stand/boot/disk.c
diff -u src/sys/arch/arc/stand/boot/disk.c:1.4 src/sys/arch/arc/stand/boot/disk.c:1.5
--- src/sys/arch/arc/stand/boot/disk.c:1.4	Wed Jan 25 18:28:26 2006
+++ src/sys/arch/arc/stand/boot/disk.c	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: disk.c,v 1.4 2006/01/25 18:28:26 christos Exp $	*/
+/*	$NetBSD: disk.c,v 1.5 2011/02/20 07:52:43 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -47,8 +47,6 @@
 
 #define	RF_PROTECTED_SECTORS	64	/* XXX refer to <.../rf_optnames.h> */
 
-extern const struct arcbios_fv *ARCBIOS;
-
 struct	disk_softc {
 	u_long	sc_fd;			/* ARCBIOS file id */
 	int	sc_part;		/* disk partition number */
@@ -86,10 +84,10 @@
 	 */
 	offset *= DEV_BSIZE;
 
-	error = (*ARCBIOS->Seek)(sc->sc_fd, &offset, 0);
+	error = arcbios_Seek(sc->sc_fd, &offset, 0);
 	if (error != ARCBIOS_ESUCCESS)
 		return EIO;
-	error = (*ARCBIOS->Read)(sc->sc_fd, addr, reqcnt, &count);
+	error = arcbios_Read(sc->sc_fd, addr, reqcnt, &count);
 	if (error != ARCBIOS_ESUCCESS)
 		return EIO;
 
@@ -133,7 +131,7 @@
 	if (part >= MAXPARTITIONS)
 		return ENXIO;
 
-	error = (*ARCBIOS->Open)(device, 0, &fd);
+	error = arcbios_Open(device, 0, &fd);
 	if (error) {
 		printf("diskopen: open failed, errno = %d\n", error);
 		return ENXIO;
@@ -197,7 +195,7 @@
 diskclose(struct open_file *f)
 {
 
-	(*ARCBIOS->Close)(((struct disk_softc *)(f->f_devdata))->sc_fd);
+	arcbios_Close(((struct disk_softc *)(f->f_devdata))->sc_fd);
 	dealloc(f->f_devdata, sizeof(struct disk_softc));
 	f->f_devdata = NULL;
 	return 0;
Index: src/sys/arch/arc/stand/boot/start.S
diff -u src/sys/arch/arc/stand/boot/start.S:1.4 src/sys/arch/arc/stand/boot/start.S:1.5
--- src/sys/arch/arc/stand/boot/start.S:1.4	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/arc/stand/boot/start.S	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: start.S,v 1.4 2008/04/28 20:23:13 martin Exp $	*/
+/*	$NetBSD: start.S,v 1.5 2011/02/20 07:52:43 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -83,6 +83,8 @@
 #include <mips/asm.h>
 #include <mips/cpuregs.h>
 
+#include "assym.h"
+
 	.globl	start
 start:
 	.set	noreorder

Index: src/sys/arch/arc/stand/boot/getchar.c
diff -u src/sys/arch/arc/stand/boot/getchar.c:1.3 src/sys/arch/arc/stand/boot/getchar.c:1.4
--- src/sys/arch/arc/stand/boot/getchar.c:1.3	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/arc/stand/boot/getchar.c	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getchar.c,v 1.3 2008/04/28 20:23:13 martin Exp $	 */
+/*	$NetBSD: getchar.c,v 1.4 2011/02/20 07:52:43 matt Exp $	 */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -32,15 +32,13 @@
 #include <lib/libsa/stand.h>
 #include <dev/arcbios/arcbios.h>
 
-extern const struct arcbios_fv *ARCBIOS;
-
 int
 getchar(void)
 {
 	char ch;
 	u_long count;
 
-	if ((*ARCBIOS->Read)(0, &ch, 1, &count) != ARCBIOS_ESUCCESS)
+	if (arcbios_Read(0, &ch, 1, &count) != ARCBIOS_ESUCCESS)
 		return -1;
 
 	return ch;
Index: src/sys/arch/arc/stand/boot/putchar.c
diff -u src/sys/arch/arc/stand/boot/putchar.c:1.3 src/sys/arch/arc/stand/boot/putchar.c:1.4
--- src/sys/arch/arc/stand/boot/putchar.c:1.3	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/arc/stand/boot/putchar.c	Sun Feb 20 07:52:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: putchar.c,v 1.3 2008/04/28 20:23:13 martin Exp $	 */
+/*	$NetBSD: putchar.c,v 1.4 2011/02/20 07:52:43 matt Exp $	 */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
 #include <lib/libsa/stand.h>
 #include <dev/arcbios/arcbios.h>
 
-extern const struct arcbios_fv *ARCBIOS;
-
 void
 putchar(int c)
 {
@@ -42,9 +40,9 @@
 
 	if (c == '\n') {
 		ch = '\r';
-		(*ARCBIOS->Write)(1, &ch, 1, &count);
+		arcbios_Write(1, &ch, 1, &count);
 	}
 
 	ch = c;
-	(*ARCBIOS->Write)(1, &ch, 1, &count);
+	arcbios_Write(1, &ch, 1, &count);
 }

Added files:

Index: src/sys/arch/arc/include/netbsd32_machdep.h
diff -u /dev/null src/sys/arch/arc/include/netbsd32_machdep.h:1.2
--- /dev/null	Sun Feb 20 07:52:43 2011
+++ src/sys/arch/arc/include/netbsd32_machdep.h	Sun Feb 20 07:52:42 2011
@@ -0,0 +1,3 @@
+/* $NetBSD: netbsd32_machdep.h,v 1.2 2011/02/20 07:52:42 matt Exp $ */
+
+#include <mips/netbsd32_machdep.h>

Reply via email to