Module Name: src
Committed By: matt
Date: Sun Feb 20 07:56:32 UTC 2011
Modified Files:
src/sys/arch/newsmips/apbus: apbus.c if_snvar.h if_tlp_ap.c
src/sys/arch/newsmips/conf: files.newsmips
src/sys/arch/newsmips/dev: hb.c scsi_1185.c
src/sys/arch/newsmips/include: intr.h
src/sys/arch/newsmips/newsmips: autoconf.c bus.c clock.c cpu.c
locore_machdep.S machdep.c news3400.c news5000.c
Log Message:
Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/newsmips/apbus/apbus.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/newsmips/apbus/if_snvar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/newsmips/apbus/if_tlp_ap.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/newsmips/conf/files.newsmips
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/newsmips/dev/hb.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/newsmips/dev/scsi_1185.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/newsmips/include/intr.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/newsmips/newsmips/autoconf.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/newsmips/newsmips/bus.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/newsmips/newsmips/clock.c \
src/sys/arch/newsmips/newsmips/locore_machdep.S
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/newsmips/newsmips/cpu.c
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/newsmips/newsmips/machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/newsmips/newsmips/news3400.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/newsmips/newsmips/news5000.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/newsmips/apbus/apbus.c
diff -u src/sys/arch/newsmips/apbus/apbus.c:1.21 src/sys/arch/newsmips/apbus/apbus.c:1.22
--- src/sys/arch/newsmips/apbus/apbus.c:1.21 Wed Apr 9 15:40:30 2008
+++ src/sys/arch/newsmips/apbus/apbus.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: apbus.c,v 1.21 2008/04/09 15:40:30 tsutsui Exp $ */
+/* $NetBSD: apbus.c,v 1.22 2011/02/20 07:56:31 matt Exp $ */
/*-
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
@@ -27,13 +27,16 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.21 2008/04/09 15:40:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.22 2011/02/20 07:56:31 matt Exp $");
+
+#define __INTR_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/proc.h>
+#include <sys/intr.h>
#include <uvm/uvm_extern.h>
@@ -41,7 +44,6 @@
#include <machine/autoconf.h>
#define _NEWSMIPS_BUS_DMA_PRIVATE
#include <machine/bus.h>
-#include <machine/intr.h>
#include <newsmips/apbus/apbusvar.h>
static int apbusmatch(device_t, cfdata_t, void *);
@@ -97,6 +99,8 @@
struct newsmips_intr *ip;
int i;
+ mips_set_wbflush(apbus_wbflush);
+
*(volatile uint32_t *)(NEWS5000_APBUS_INTST) = 0xffffffff;
*(volatile uint32_t *)(NEWS5000_APBUS_INTMSK) = 0xffffffff;
*(volatile uint32_t *)(NEWS5000_APBUS_CTRL) = 0x00000004;
@@ -176,9 +180,10 @@
void
apbus_wbflush(void)
{
- volatile int32_t *wbflush = (uint32_t *)NEWS5000_WBFLUSH;
+ volatile int32_t * const our_wbflush = (int32_t *)NEWS5000_WBFLUSH;
- (void)*wbflush;
+ (*mips_locore_jumpvec.ljv_wbflush)();
+ (void)*our_wbflush;
}
/*
Index: src/sys/arch/newsmips/apbus/if_snvar.h
diff -u src/sys/arch/newsmips/apbus/if_snvar.h:1.12 src/sys/arch/newsmips/apbus/if_snvar.h:1.13
--- src/sys/arch/newsmips/apbus/if_snvar.h:1.12 Wed Apr 9 15:40:30 2008
+++ src/sys/arch/newsmips/apbus/if_snvar.h Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: if_snvar.h,v 1.12 2008/04/09 15:40:30 tsutsui Exp $ */
+/* $NetBSD: if_snvar.h,v 1.13 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
@@ -32,14 +32,6 @@
#define SN_REGSIZE (SN_NREGS * 4)
#include <mips/locore.h>
-#undef wbflush /* XXX */
-
-static inline void
-wbflush(void)
-{
- mips3_wbflush();
- apbus_wbflush();
-};
/*
* buffer sizes in 32 bit mode
Index: src/sys/arch/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.11 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.12
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.11 Fri Apr 17 14:48:17 2009
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $ */
+/* $NetBSD: if_tlp_ap.c,v 1.12 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.12 2011/02/20 07:56:31 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -155,10 +155,10 @@
/*
* Initialize bus specific parameters.
*/
- if (mips_sdcache_line_size > 0)
- sc->sc_cacheline = mips_sdcache_line_size / 4;
- else if (mips_pdcache_line_size > 0)
- sc->sc_cacheline = mips_pdcache_line_size / 4;
+ if (mips_cache_info.mci_sdcache_line_size > 0)
+ sc->sc_cacheline = mips_cache_info.mci_sdcache_line_size / 4;
+ else if (mips_cache_info.mci_pdcache_line_size > 0)
+ sc->sc_cacheline = mips_cache_info.mci_pdcache_line_size / 4;
else
sc->sc_cacheline = 4;
sc->sc_maxburst = sc->sc_cacheline; /* XXX */
Index: src/sys/arch/newsmips/conf/files.newsmips
diff -u src/sys/arch/newsmips/conf/files.newsmips:1.27 src/sys/arch/newsmips/conf/files.newsmips:1.28
--- src/sys/arch/newsmips/conf/files.newsmips:1.27 Fri Aug 21 04:03:01 2009
+++ src/sys/arch/newsmips/conf/files.newsmips Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.newsmips,v 1.27 2009/08/21 04:03:01 thorpej Exp $
+# $NetBSD: files.newsmips,v 1.28 2011/02/20 07:56:31 matt Exp $
# NEWSMIPS-specific configuration info
@@ -98,8 +98,6 @@
file common/bus_dma/bus_dmamem_common.c
-file arch/mips/mips/softintr.c
-
#
# Machine-independent SCSI driver.
#
Index: src/sys/arch/newsmips/dev/hb.c
diff -u src/sys/arch/newsmips/dev/hb.c:1.18 src/sys/arch/newsmips/dev/hb.c:1.19
--- src/sys/arch/newsmips/dev/hb.c:1.18 Wed Apr 9 15:40:30 2008
+++ src/sys/arch/newsmips/dev/hb.c Sun Feb 20 07:56:31 2011
@@ -1,15 +1,16 @@
-/* $NetBSD: hb.c,v 1.18 2008/04/09 15:40:30 tsutsui Exp $ */
+/* $NetBSD: hb.c,v 1.19 2011/02/20 07:56:31 matt Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.18 2008/04/09 15:40:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.19 2011/02/20 07:56:31 matt Exp $");
+#define __INTR_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
+#include <sys/intr.h>
#include <machine/autoconf.h>
-#include <machine/intr.h>
#include <newsmips/dev/hbvar.h>
Index: src/sys/arch/newsmips/dev/scsi_1185.c
diff -u src/sys/arch/newsmips/dev/scsi_1185.c:1.19 src/sys/arch/newsmips/dev/scsi_1185.c:1.20
--- src/sys/arch/newsmips/dev/scsi_1185.c:1.19 Wed Apr 9 15:40:30 2008
+++ src/sys/arch/newsmips/dev/scsi_1185.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: scsi_1185.c,v 1.19 2008/04/09 15:40:30 tsutsui Exp $ */
+/* $NetBSD: scsi_1185.c,v 1.20 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -53,11 +53,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.19 2008/04/09 15:40:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.20 2011/02/20 07:56:31 matt Exp $");
+#define __INTR_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <sys/intr.h>
#include <uvm/uvm_extern.h>
Index: src/sys/arch/newsmips/include/intr.h
diff -u src/sys/arch/newsmips/include/intr.h:1.24 src/sys/arch/newsmips/include/intr.h:1.25
--- src/sys/arch/newsmips/include/intr.h:1.24 Fri Apr 10 13:29:30 2009
+++ src/sys/arch/newsmips/include/intr.h Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.24 2009/04/10 13:29:30 tsutsui Exp $ */
+/* $NetBSD: intr.h,v 1.25 2011/02/20 07:56:31 matt Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,56 +32,15 @@
#ifndef _MACHINE_INTR_H_
#define _MACHINE_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 /* disable clock interrupts */
-#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
+#include <mips/intr.h>
#ifdef _KERNEL
-#ifndef _LOCORE
+#ifdef __INTR_PRIVATE
#include <sys/evcnt.h>
#include <mips/locore.h>
-extern const uint32_t ipl_sr_bits[_IPL_N];
-
-#define spl0() (void)_spllower(0)
-#define splx(s) (void)_splset(s)
-
-#define splsoft() _splraise(ipl_sr_bits[IPL_SOFT])
-
-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>
+extern const struct ipl_sr_map newmips_ipl_sr_map;
struct newsmips_intrhand {
LIST_ENTRY(newsmips_intrhand) ih_q;
@@ -117,18 +76,14 @@
extern u_int intrcnt[];
/* handle i/o device interrupts */
-#ifdef news3400
-void news3400_intr(uint32_t, uint32_t, uint32_t, uint32_t);
-#endif
-#ifdef news5000
-void news5000_intr(uint32_t, uint32_t, uint32_t, uint32_t);
-#endif
-extern void (*hardware_intr)(uint32_t, uint32_t, uint32_t, uint32_t);
+void news3400_intr(int, vaddr_t, uint32_t);
+void news5000_intr(int, vaddr_t, uint32_t);
+extern void (*hardware_intr)(int, vaddr_t, uint32_t);
extern void (*enable_intr)(void);
extern void (*disable_intr)(void);
extern void (*enable_timer)(void);
-#endif /* !_LOCORE */
+#endif /* __INTR_PRIVATE */
#endif /* _KERNEL */
#endif /* _MACHINE_INTR_H_ */
Index: src/sys/arch/newsmips/newsmips/autoconf.c
diff -u src/sys/arch/newsmips/newsmips/autoconf.c:1.33 src/sys/arch/newsmips/newsmips/autoconf.c:1.34
--- src/sys/arch/newsmips/newsmips/autoconf.c:1.33 Tue Feb 8 20:20:21 2011
+++ src/sys/arch/newsmips/newsmips/autoconf.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.33 2011/02/08 20:20:21 rmind Exp $ */
+/* $NetBSD: autoconf.c,v 1.34 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -46,8 +46,10 @@
* and the drivers are initialized.
*/
+#define __INTR_PRIVATE
+
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.33 2011/02/08 20:20:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.34 2011/02/20 07:56:31 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,12 +57,13 @@
#include <sys/conf.h>
#include <sys/reboot.h>
#include <sys/device.h>
+#include <sys/intr.h>
+#include <sys/cpu.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
-#include <machine/cpu.h>
#include <machine/adrsmap.h>
#include <machine/romcall.h>
@@ -91,7 +94,7 @@
/*
* Kick off autoconfiguration
*/
- _splnone(); /* enable all interrupts */
+ spl0(); /* enable all interrupts */
splhigh(); /* ...then disable device interrupts */
if (systype == NEWS3400) {
@@ -106,7 +109,7 @@
enable_intr();
/* 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/newsmips/newsmips/bus.c
diff -u src/sys/arch/newsmips/newsmips/bus.c:1.30 src/sys/arch/newsmips/newsmips/bus.c:1.31
--- src/sys/arch/newsmips/newsmips/bus.c:1.30 Mon Dec 14 00:46:09 2009
+++ src/sys/arch/newsmips/newsmips/bus.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.c,v 1.30 2009/12/14 00:46:09 matt Exp $ */
+/* $NetBSD: bus.c,v 1.31 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.30 2009/12/14 00:46:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.31 2011/02/20 07:56:31 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -515,7 +515,7 @@
* NOTE: Even though this is `wbinv_all', since the cache is
* write-though, it just invalidates it.
*/
- if (len >= mips_pdcache_size) {
+ if (len >= mips_cache_info.mci_pdcache_size) {
mips_dcache_wbinv_all();
return;
}
@@ -703,12 +703,9 @@
bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
int flags)
{
- extern paddr_t avail_start, avail_end;
-
return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,
- segs, nsegs, rsegs, flags,
- avail_start /*low*/,
- avail_end - PAGE_SIZE /*high*/));
+ segs, nsegs, rsegs, flags,
+ mips_avail_start /*low*/, mips_avail_end - PAGE_SIZE /*high*/));
}
/*
Index: src/sys/arch/newsmips/newsmips/clock.c
diff -u src/sys/arch/newsmips/newsmips/clock.c:1.15 src/sys/arch/newsmips/newsmips/clock.c:1.16
--- src/sys/arch/newsmips/newsmips/clock.c:1.15 Mon Sep 4 20:33:24 2006
+++ src/sys/arch/newsmips/newsmips/clock.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.15 2006/09/04 20:33:24 tsutsui Exp $ */
+/* $NetBSD: clock.c,v 1.16 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,15 +41,15 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.15 2006/09/04 20:33:24 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.16 2011/02/20 07:56:31 matt Exp $");
+#define __INTR_PRIVATE
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
-
-#include <machine/cpu.h>
-#include <machine/intr.h>
+#include <sys/cpu.h>
+#include <sys/intr.h>
/*
* Set up the real-time and statistics clocks. Leave stathz 0 only
Index: src/sys/arch/newsmips/newsmips/locore_machdep.S
diff -u src/sys/arch/newsmips/newsmips/locore_machdep.S:1.15 src/sys/arch/newsmips/newsmips/locore_machdep.S:1.16
--- src/sys/arch/newsmips/newsmips/locore_machdep.S:1.15 Thu Dec 17 05:29:56 2009
+++ src/sys/arch/newsmips/newsmips/locore_machdep.S Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: locore_machdep.S,v 1.15 2009/12/17 05:29:56 matt Exp $ */
+/* $NetBSD: locore_machdep.S,v 1.16 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -133,9 +133,7 @@
/*
* Interrupt counters for vmstat.
*/
- .data
- .globl _C_LABEL(intrcnt)
- .globl _C_LABEL(eintrcnt)
+ .rdata
.globl _C_LABEL(intrnames)
.globl _C_LABEL(eintrnames)
_C_LABEL(intrnames):
@@ -155,7 +153,11 @@
.asciiz "nmi"
.asciiz "lostclock"
_C_LABEL(eintrnames):
- .align 2
+
+ .data
+ .globl _C_LABEL(intrcnt)
+ .globl _C_LABEL(eintrcnt)
+ .p2align 2
_C_LABEL(intrcnt):
.word 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0
_C_LABEL(eintrcnt):
Index: src/sys/arch/newsmips/newsmips/cpu.c
diff -u src/sys/arch/newsmips/newsmips/cpu.c:1.11 src/sys/arch/newsmips/newsmips/cpu.c:1.12
--- src/sys/arch/newsmips/newsmips/cpu.c:1.11 Sun Dec 11 12:18:25 2005
+++ src/sys/arch/newsmips/newsmips/cpu.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.11 2005/12/11 12:18:25 christos Exp $ */
+/* $NetBSD: cpu.c,v 1.12 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,28 +28,28 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.11 2005/12/11 12:18:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.12 2011/02/20 07:56:31 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/cpu.h>
#include <sys/systm.h>
#include <mips/locore.h>
-#include <machine/cpu.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 *cfdata, void *aux)
+cpumatch(device_t parent, cfdata_t cfdata, void *aux)
{
struct confargs *ca = aux;
@@ -61,9 +61,13 @@
}
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(": ");
- cpu_identify();
+ ci->ci_dev = self;
+ self->dv_private = ci;
+
+ aprint_normal(": ");
+ cpu_identify(self);
}
Index: src/sys/arch/newsmips/newsmips/machdep.c
diff -u src/sys/arch/newsmips/newsmips/machdep.c:1.111 src/sys/arch/newsmips/newsmips/machdep.c:1.112
--- src/sys/arch/newsmips/newsmips/machdep.c:1.111 Tue Feb 8 20:20:21 2011
+++ src/sys/arch/newsmips/newsmips/machdep.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.111 2011/02/08 20:20:21 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.112 2011/02/20 07:56:31 matt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.111 2011/02/08 20:20:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.112 2011/02/20 07:56:31 matt Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
@@ -47,6 +47,8 @@
#include "opt_execfmt.h"
#include "opt_modular.h"
+#define __INTR_PRIVATE
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
@@ -66,13 +68,13 @@
#include <sys/syscallargs.h>
#include <sys/kcore.h>
#include <sys/ksyms.h>
+#include <sys/cpu.h>
+#include <sys/intr.h>
#include <uvm/uvm_extern.h>
#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
-#include <machine/cpu.h>
-#include <machine/intr.h>
#include <machine/reg.h>
#include <machine/psl.h>
#include <machine/pte.h>
@@ -116,7 +118,7 @@
int mem_cluster_cnt;
struct idrom idrom;
-void (*hardware_intr)(uint32_t, uint32_t, uint32_t, uint32_t);
+void (*hardware_intr)(int, vaddr_t, uint32_t);
void (*enable_intr)(void);
void (*disable_intr)(void);
void (*enable_timer)(void);
@@ -137,32 +139,24 @@
#endif
/*
- * 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 */
-
-/*
* This is a mask of bits to clear in the SR when we go to a
* given interrupt priority level.
*/
-const uint32_t 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,
- [IPL_SCHED] =
- MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1 |
- MIPS_INT_MASK_0 |
- MIPS_INT_MASK_1 |
- MIPS_INT_MASK_2,
+const struct ipl_sr_map newsmips_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,
+ [IPL_SCHED] = MIPS_SOFT_INT_MASK
+ | MIPS_INT_MASK_0
+ | MIPS_INT_MASK_1
+ | MIPS_INT_MASK_2,
+ [IPL_DDB] = MIPS_INT_MASK,
+ [IPL_HIGH] = MIPS_INT_MASK,
+ },
};
extern u_long bootdev;
@@ -290,7 +284,8 @@
* Initialize locore-function vector.
* Clear out the I and D caches.
*/
- mips_vector_init();
+ ipl_sr_map = newsmips_ipl_sr_map;
+ mips_vector_init(NULL, false);
/*
* We know the CPU type now. Initialize our DMA tags (might
@@ -389,7 +384,7 @@
{
/* All r4k news boxen have a 1MB L2 cache. */
if (CPUISMIPS3)
- mips_sdcache_size = 1024 * 1024;
+ mips_cache_info.mci_sdcache_size = 1024 * 1024;
}
/*
@@ -487,8 +482,7 @@
{
/* take a snap shot before clobbering any registers */
- if (curlwp)
- savectx(curpcb);
+ savectx(curpcb);
#ifdef DEBUG
if (panicstr)
@@ -557,24 +551,10 @@
}
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 cpu_info *ci;
-
- ci = curcpu();
- ci->ci_data.cpu_nintr++;
+ curcpu()->ci_data.cpu_nintr++;
/* device interrupts */
- ci->ci_idepth++;
- (*hardware_intr)(status, cause, pc, ipending);
- 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
+ (*hardware_intr)(ppl, pc, status);
}
Index: src/sys/arch/newsmips/newsmips/news3400.c
diff -u src/sys/arch/newsmips/newsmips/news3400.c:1.19 src/sys/arch/newsmips/newsmips/news3400.c:1.20
--- src/sys/arch/newsmips/newsmips/news3400.c:1.19 Mon Dec 3 15:34:05 2007
+++ src/sys/arch/newsmips/newsmips/news3400.c Sun Feb 20 07:56:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: news3400.c,v 1.19 2007/12/03 15:34:05 ad Exp $ */
+/* $NetBSD: news3400.c,v 1.20 2011/02/20 07:56:31 matt Exp $ */
/*-
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
@@ -27,25 +27,24 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: news3400.c,v 1.19 2007/12/03 15:34:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: news3400.c,v 1.20 2011/02/20 07:56:31 matt Exp $");
+#define __INTR_PRIVATE
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/systm.h>
+#include <sys/cpu.h>
+#include <sys/intr.h>
+
+#include <mips/locore.h>
#include <machine/adrsmap.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
#include <machine/psl.h>
#include <newsmips/newsmips/machid.h>
#include <newsmips/dev/hbvar.h>
-#if !defined(SOFTFLOAT)
-extern void MachFPInterrupt(unsigned, unsigned, unsigned, struct frame *);
-#endif
-
int news3400_badaddr(void *, u_int);
static void news3400_level0_intr(void);
@@ -63,76 +62,67 @@
* Handle news3400 interrupts.
*/
void
-news3400_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
+news3400_intr(int ppl, uint32_t pc, uint32_t status)
{
- struct clockframe cf;
- struct cpu_info *ci;
+ uint32_t ipending;
+ int ipl;
- ci = curcpu();
- ci->ci_idepth++;
+ while (ppl < (ipl = splintr(&ipending))) {
/* handle clock interrupts ASAP */
- if (ipending & MIPS_INT_MASK_2) {
- int stat;
+ if (ipending & MIPS_INT_MASK_2) {
+ int stat;
- stat = *(volatile uint8_t *)INTST0;
- stat &= INTST0_TIMINT|INTST0_KBDINT|INTST0_MSINT;
+ stat = *(volatile uint8_t *)INTST0;
+ stat &= INTST0_TIMINT|INTST0_KBDINT|INTST0_MSINT;
- *(volatile uint8_t *)INTCLR0 = stat;
- if (stat & INTST0_TIMINT) {
- cf.pc = pc;
- cf.sr = status;
- hardclock(&cf);
- intrcnt[HARDCLOCK_INTR]++;
- stat &= ~INTST0_TIMINT;
- }
+ *(volatile uint8_t *)INTCLR0 = stat;
+ if (stat & INTST0_TIMINT) {
+ struct clockframe cf = {
+ .pc = pc,
+ .sr = status,
+ .intr = (curcpu()->ci_idepth > 0),
+ };
+ hardclock(&cf);
+ intrcnt[HARDCLOCK_INTR]++;
+ }
- if (stat)
- hb_intr_dispatch(2, stat);
+ if (stat)
+ hb_intr_dispatch(2, stat);
- cause &= ~MIPS_INT_MASK_2;
- }
- /* If clock interrupts were enabled, re-enable them ASAP. */
- _splset(MIPS_SR_INT_IE | (status & MIPS_INT_MASK_2));
-
- if (ipending & MIPS_INT_MASK_5) {
- *(volatile uint8_t *)INTCLR0 = INTCLR0_PERR;
- printf("Memory error interrupt(?) at 0x%x\n", pc);
- cause &= ~MIPS_INT_MASK_5;
- }
+ }
- /* asynchronous bus error */
- if (ipending & MIPS_INT_MASK_4) {
- *(volatile uint8_t *)INTCLR0 = INTCLR0_BERR;
- cause &= ~MIPS_INT_MASK_4;
- badaddr_flag = 1;
- }
+ if (ipending & MIPS_INT_MASK_5) {
+ *(volatile uint8_t *)INTCLR0 = INTCLR0_PERR;
+ printf("Memory error interrupt(?) at 0x%x\n", pc);
+ }
- if (ipending & MIPS_INT_MASK_1) {
- news3400_level1_intr();
- cause &= ~MIPS_INT_MASK_1;
- }
+ /* asynchronous bus error */
+ if (ipending & MIPS_INT_MASK_4) {
+ *(volatile uint8_t *)INTCLR0 = INTCLR0_BERR;
+ badaddr_flag = 1;
+ }
- if (ipending & MIPS_INT_MASK_0) {
- news3400_level0_intr();
- cause &= ~MIPS_INT_MASK_0;
- }
+ if (ipending & MIPS_INT_MASK_1) {
+ news3400_level1_intr();
+ }
- _splset((status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
+ if (ipending & MIPS_INT_MASK_0) {
+ news3400_level0_intr();
+ }
- /* FPU nofiticaition */
- if (ipending & INT_MASK_FPU) {
- if (!USERMODE(status))
- panic("kernel used FPU: PC %x, CR %x, SR %x",
- pc, cause, status);
-
- intrcnt[FPU_INTR]++;
-#if !defined(SOFTFLOAT)
- MachFPInterrupt(status, cause, pc, curlwp->l_md.md_regs);
+ /* FPU nofiticaition */
+ if (ipending & INT_MASK_FPU) {
+ if (!USERMODE(status))
+ panic("kernel used FPU: PC %x, SR %x",
+ pc, status);
+
+ intrcnt[FPU_INTR]++;
+#if !defined(FPEMUL)
+ mips_fpu_intr(pc, curlwp->l_md.md_utf);
#endif
+ }
}
-
- ci->ci_idepth--;
}
#define LEVEL0_MASK \
Index: src/sys/arch/newsmips/newsmips/news5000.c
diff -u src/sys/arch/newsmips/newsmips/news5000.c:1.17 src/sys/arch/newsmips/newsmips/news5000.c:1.18
--- src/sys/arch/newsmips/newsmips/news5000.c:1.17 Mon Dec 3 15:34:05 2007
+++ src/sys/arch/newsmips/newsmips/news5000.c Sun Feb 20 07:56:32 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: news5000.c,v 1.17 2007/12/03 15:34:05 ad Exp $ */
+/* $NetBSD: news5000.c,v 1.18 2011/02/20 07:56:32 matt Exp $ */
/*-
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
@@ -27,16 +27,17 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: news5000.c,v 1.17 2007/12/03 15:34:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: news5000.c,v 1.18 2011/02/20 07:56:32 matt Exp $");
+#define __INTR_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/timetc.h>
#include <sys/cpu.h>
+#include <sys/intr.h>
#include <machine/adrsmap.h>
-#include <machine/intr.h>
#include <newsmips/apbus/apbusvar.h>
#include <newsmips/newsmips/machid.h>
@@ -55,112 +56,102 @@
* Handle news5000 interrupts.
*/
void
-news5000_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
+news5000_intr(int ppl, vaddr_t pc, uint32_t status)
{
- struct cpu_info *ci;
+ uint32_t ipending;
+ int ipl;
- ci = curcpu();
- ci->ci_idepth++;
+ while (ppl < (ipl = splintr(&ipending))) {
- if (ipending & MIPS_INT_MASK_2) {
+ if (ipending & MIPS_INT_MASK_2) {
#ifdef DEBUG
- static int l2cnt = 0;
+ static int l2cnt = 0;
#endif
- uint32_t int2stat;
- struct clockframe cf;
+ uint32_t int2stat;
+ struct clockframe cf;
- int2stat = *(volatile uint32_t *)NEWS5000_INTST2;
+ int2stat = *(volatile uint32_t *)NEWS5000_INTST2;
#ifdef DEBUG
- l2cnt++;
- if (l2cnt == 50) {
- *(volatile uint32_t *)NEWS5000_LED_SEC = 1;
- }
- if (l2cnt == 100) {
- *(volatile uint32_t *)NEWS5000_LED_SEC = 0;
- l2cnt = 0;
- }
+ l2cnt++;
+ if (l2cnt == 50) {
+ *(volatile uint32_t *)NEWS5000_LED_SEC = 1;
+ }
+ if (l2cnt == 100) {
+ *(volatile uint32_t *)NEWS5000_LED_SEC = 0;
+ l2cnt = 0;
+ }
#endif
- if (int2stat & NEWS5000_INT2_TIMER0) {
- *(volatile uint32_t *)NEWS5000_TIMER0 = 1;
+ if (int2stat & NEWS5000_INT2_TIMER0) {
+ *(volatile uint32_t *)NEWS5000_TIMER0 = 1;
- cf.pc = pc;
- cf.sr = status;
+ cf.pc = pc;
+ cf.sr = status;
- hardclock(&cf);
- intrcnt[HARDCLOCK_INTR]++;
- }
+ hardclock(&cf);
+ intrcnt[HARDCLOCK_INTR]++;
+ }
- apbus_wbflush();
- cause &= ~MIPS_INT_MASK_2;
- }
- /* If clock interrupts were enabled, re-enable them ASAP. */
- _splset(MIPS_SR_INT_IE | (status & MIPS_INT_MASK_2));
+ apbus_wbflush();
+ }
- if (ipending & MIPS_INT_MASK_5) {
- uint32_t int5stat;
+ if (ipending & MIPS_INT_MASK_5) {
+ uint32_t int5stat;
- int5stat = *(volatile u_int *)NEWS5000_INTST5;
- printf("level5 interrupt (%08x)\n", int5stat);
+ int5stat = *(volatile u_int *)NEWS5000_INTST5;
+ printf("level5 interrupt (%08x)\n", int5stat);
- apbus_wbflush();
- cause &= ~MIPS_INT_MASK_5;
- }
+ apbus_wbflush();
+ }
- if (ipending & MIPS_INT_MASK_4) {
- uint32_t int4stat;
+ if (ipending & MIPS_INT_MASK_4) {
+ uint32_t int4stat;
- int4stat = *(volatile uint32_t *)NEWS5000_INTST4;
- printf("level4 interrupt (%08x)\n", int4stat);
- if (int4stat & NEWS5000_INT4_APBUS) {
- uint32_t stat;
-
- stat = *(volatile uint32_t *)NEWS5000_APBUS_INTST;
- printf("APbus error 0x%04x\n", stat & 0xffff);
- if (stat & NEWS5000_APBUS_INT_DMAADDR) {
- printf("DMA Address Error: "
- "slot=%x, addr=0x%08x\n",
- *(volatile uint32_t *)NEWS5000_APBUS_DER_S,
- *(volatile uint32_t *)NEWS5000_APBUS_DER_A);
+ int4stat = *(volatile uint32_t *)NEWS5000_INTST4;
+ printf("level4 interrupt (%08x)\n", int4stat);
+ if (int4stat & NEWS5000_INT4_APBUS) {
+ uint32_t stat;
+
+ stat = *(volatile uint32_t *)NEWS5000_APBUS_INTST;
+ printf("APbus error 0x%04x\n", stat & 0xffff);
+ if (stat & NEWS5000_APBUS_INT_DMAADDR) {
+ printf("DMA Address Error: "
+ "slot=%x, addr=0x%08x\n",
+ *(volatile uint32_t *)NEWS5000_APBUS_DER_S,
+ *(volatile uint32_t *)NEWS5000_APBUS_DER_A);
+ }
+ if (stat & NEWS5000_APBUS_INT_RDTIMEO)
+ printf("IO Read Timeout: addr=0x%08x\n",
+ *(volatile uint32_t *)NEWS5000_APBUS_BER_A);
+ if (stat & NEWS5000_APBUS_INT_WRTIMEO)
+ printf("IO Write Timeout: addr=0x%08x\n",
+ *(volatile uint32_t *)NEWS5000_APBUS_BER_A);
+ *(volatile uint32_t *)0xb4c00014 = stat;
}
- if (stat & NEWS5000_APBUS_INT_RDTIMEO)
- printf("IO Read Timeout: addr=0x%08x\n",
- *(volatile uint32_t *)NEWS5000_APBUS_BER_A);
- if (stat & NEWS5000_APBUS_INT_WRTIMEO)
- printf("IO Write Timeout: addr=0x%08x\n",
- *(volatile uint32_t *)NEWS5000_APBUS_BER_A);
- *(volatile uint32_t *)0xb4c00014 = stat;
- }
- apbus_wbflush();
- cause &= ~MIPS_INT_MASK_4;
- }
+ apbus_wbflush();
+ }
- if (ipending & MIPS_INT_MASK_3) {
- uint32_t int3stat;
+ if (ipending & MIPS_INT_MASK_3) {
+ uint32_t int3stat;
- int3stat = *(volatile uint32_t *)NEWS5000_INTST3;
- printf("level3 interrupt (%08x)\n", int3stat);
+ int3stat = *(volatile uint32_t *)NEWS5000_INTST3;
+ printf("level3 interrupt (%08x)\n", int3stat);
- apbus_wbflush();
- cause &= ~MIPS_INT_MASK_3;
- }
+ apbus_wbflush();
+ }
- if (ipending & MIPS_INT_MASK_1) {
- news5000_level1_intr();
- apbus_wbflush();
- cause &= ~MIPS_INT_MASK_1;
- }
+ if (ipending & MIPS_INT_MASK_1) {
+ news5000_level1_intr();
+ apbus_wbflush();
+ }
- if (ipending & MIPS_INT_MASK_0) {
- news5000_level0_intr();
- apbus_wbflush();
- cause &= ~MIPS_INT_MASK_0;
+ if (ipending & MIPS_INT_MASK_0) {
+ news5000_level0_intr();
+ apbus_wbflush();
+ }
}
-
- ci->ci_idepth--;
- _splset((status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
}