CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2013-11-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 14 01:36:00 UTC 2013

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c

Log Message:
Deal with new interrupt structure.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/rmi/rmixl_gpio_pci.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/mips/rmi/rmixl_gpio_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.7 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.8
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.7	Sat Dec 15 03:05:56 2012
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Thu Nov 14 01:36:00 2013
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.7 2012/12/15 03:05:56 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.8 2013/11/14 01:36:00 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -93,11 +93,9 @@ static int (* const xlgpio_intrs[])(void
 };
 
 struct xlgpio_intrpin {
-	int (*gip_func)(void *);
-	void *gip_arg;
+	struct rmixl_intrhand_common gip_ihc;
 	uint8_t gip_ipl;
 	uint8_t gip_ist;
-	bool gip_mpsafe;
 	char gip_pin_name[sizeof(pin XX)];
 };
 
@@ -142,7 +140,10 @@ static struct xlgpio_softc xlgpio_sc = {
 		[0 ... 2*PINGROUP-1] = {
 			.gip_ipl = IPL_NONE,
 			.gip_ist = IST_NONE,
-			.gip_func = xlgpio_stray_intr,
+			.gip_ihc = {
+.ihc_func = xlgpio_stray_intr,
+.ihc_disestablish = gpio_intr_disestablish,
+			},
 		},
 	},
 	.sc_groups = {
@@ -260,7 +261,7 @@ xlgpio_pci_attach(device_t parent, devic
 		snprintf(gip-gip_pin_name, sizeof(gip-gip_pin_name),
 		pin %zu, pin);
 
-		KASSERT(gip-gip_func == xlgpio_stray_intr);
+		KASSERT(gip-gip_ihc.ihc_func == xlgpio_stray_intr);
 	}
 
 	/*
@@ -367,8 +368,8 @@ xlgpio_group_intr(struct xlgpio_softc *s
 		struct xlgpio_intrpin * const gip = gg-gg_pins[pin];
 
 		KASSERT(gip-gip_ipl == ipl);
-		const int nrv = rmixl_intr_deliver(gip-gip_func, gip-gip_arg,
-		 gip-gip_mpsafe, evs[pin], ipl);
+		const int nrv = rmixl_intr_deliver(gip-gip_ihc, 
+		 evs[pin], ipl);
 		if (nrv)
 			rv = nrv;
 		sts = PIN_MASK(pin);
@@ -469,16 +470,18 @@ gpio_intr_establish(size_t pin, int ipl,
 		return NULL;
 
 	KASSERT((*inten_p  mask) == 0);
-	KASSERT(gip-gip_func != xlgpio_stray_intr);
+	KASSERT(gip-gip_ihc.ihc_func != xlgpio_stray_intr);
 	KASSERT(gip-gip_ipl == IPL_NONE);
 	KASSERT(gip-gip_ist == IST_NONE);
 
 	mutex_enter(sc-sc_intr_lock);
 
 	gip-gip_ipl = ipl;
-	gip-gip_func = func;
-	gip-gip_arg = arg;
-	gip-gip_mpsafe = mpsafe;
+	gip-gip_ihc.ihc_func = func;
+	gip-gip_ihc.ihc_arg = arg;
+#ifdef MULTIPROCESSOR
+	gip-gip_ihc.ihc_mpsafe = mpsafe;
+#endif
 
 	if (ist == IST_EDGE) {
 		atomic_or_32(gg-gg_inttype, mask);
@@ -519,7 +522,7 @@ gpio_intr_disestablish(void *v)
 
 	KASSERT(sc-sc_pins[pin] == gip);
 	KASSERT(pin  __arraycount(sc-sc_pins));
-	KASSERT(gip-gip_func != xlgpio_stray_intr);
+	KASSERT(gip-gip_ihc.ihc_func != xlgpio_stray_intr);
 
 	*inten_p = ~mask;
 	xlgpio_write_4(sc, gg-gg_r_inten[gip-gip_ipl - IPL_VM], *inten_p);



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2013-11-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 14 01:36:00 UTC 2013

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c

Log Message:
Deal with new interrupt structure.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/rmi/rmixl_gpio_pci.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2013-11-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov  5 18:44:02 UTC 2013

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_nand_pci.c

Log Message:
Start of a nand for xlp3xx/xlp2xx.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_nand_pci.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/mips/rmi/rmixl_nand_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_nand_pci.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_nand_pci.c:1.1.2.3
--- src/sys/arch/mips/rmi/rmixl_nand_pci.c:1.1.2.2	Fri Dec 30 06:48:56 2011
+++ src/sys/arch/mips/rmi/rmixl_nand_pci.c	Tue Nov  5 18:44:02 2013
@@ -27,16 +27,18 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include locators.h
+
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_nand_pci.c,v 1.1.2.2 2011/12/30 06:48:56 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_nand_pci.c,v 1.1.2.3 2013/11/05 18:44:02 matt Exp $);
 
 #include sys/param.h
+#include sys/condvar.h
 #include sys/device.h
+#include sys/mutex.h
 #include sys/bus.h
 
-#include locators.h
-
 #include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
 #include dev/pci/pcidevs.h
@@ -51,27 +53,118 @@ __KERNEL_RCSID(1, $NetBSD: rmixl_nand_p
 
 static	int xlnand_pci_match(device_t, cfdata_t, void *);
 static	void xlnand_pci_attach(device_t, device_t, void *);
+static	int xlnand_pci_detach(device_t, int);
+
+static	int xlnand_read_page(device_t, size_t, uint8_t *);
+static	int xlnand_program_page(device_t, size_t, const uint8_t *);
+
+static	void xlnand_select(device_t, bool);
+static	void xlnand_command(device_t, uint8_t);
+static	void xlnand_address(device_t, uint8_t);
+static	void xlnand_busy(device_t);
+static	void xlnand_read_buf(device_t, void *, size_t);
+static	void xlnand_write_buf(device_t, const void *, size_t);
+
+static	void xlnand_read_1(device_t, uint8_t *);
+static	void xlnand_read_2(device_t, uint16_t *);
+static	void xlnand_write_1(device_t, uint8_t);
+static	void xlnand_write_2(device_t, uint16_t);
+
+static	int xlnand_intr(void *);
+
+struct	xlnand_chip {
+	device_t xlch_nanddev;
+	kcondvar_t xlch_cv_ready;
+
+	uint32_t xlch_cmds;
+	uint64_t xlch_addrs;
+	uint32_t xlch_data;
+	uint32_t xlch_int_mask;
+	uint8_t xlch_cmdshift;
+	uint8_t xlch_addrshift;
+	uint8_t xlch_num;
+	uint8_t xlch_datalen;
+	uint8_t xlch_chipnum;
+
+	struct nand_interface xlch_nand_if;
+	char xlch_wmesg[16];
+};
 
 struct	xlnand_softc {
-	device_t sc_dev;
-	bus_space_tag_t sc_bst;
-	bus_space_handle_t sc_bsh;
+	device_t xlsc_dev;
+	bus_dma_tag_t xlsc_dmat;
+	bus_space_tag_t xlsc_bst;
+	bus_space_handle_t xlsc_bsh;
+	void *xlsc_ih;
+	uint8_t xlsc_buswidth;
+
+	kcondvar_t xlsc_cv_available;
+	struct xlnand_chip *xlsc_active_chip;
+
+	bus_dma_segment_t xlsc_xferseg;
+	bus_dmamap_t xlsc_xfermap;
+	void *xlsc_xferbuf;
+
+	struct xlnand_chip xlsc_chips[8];
+
+	kmutex_t xlsc_intr_lock __aligned(64);
+	kmutex_t xlsc_wait_lock __aligned(64);
+};
+
+#define CMDSEQ1(a,b)		(((ONFI_ ## b)  8) | RMIXLP_NAND_CMD_ ## a)
+#define CMDSEQ2(a,b,c)		(((ONFI_ ## c)  16) | CMDSEQ1(a,b))
+#define CMDSEQ3(a,b,c,d)	(((ONFI_ ## d)  14) | CMDSEQ2(a,b,c))
+
+static const uint32_t xlnand_cmdseqs[] = {
+	CMDSEQ1(SEQ_0, RESET),
+	//CMDSEQ1(SEQ_0, SYNCRONOUS_RESET),
+	CMDSEQ1(SEQ_1, READ_ID),
+	CMDSEQ1(SEQ_2, READ_UNIQUE_ID),
+	CMDSEQ1(SEQ_2, READ_PARAMETER_PAGE),
+	CMDSEQ1(SEQ_2, GET_FEATURES),
+	CMDSEQ1(SEQ_3, SET_FEATURES),
+	//CMDSEQ1(SEQ_17, SET_FEATURES2),
+	CMDSEQ1(SEQ_4, READ_STATUS),
+	//CMDSEQ1(SEQ_5, SELECT_LUN_WITH_STATUS),
+	CMDSEQ2(SEQ_6, CHANGE_READ_COLUMN, CHANGE_READ_COLUMN_START),
+	//CMDSEQ2(SEQ_7, SELECT_CACHE_REGISTER, CHANGE_READ_COLUMN_START),
+	//CMDSEQ1(SEQ_8, CHANGE_WRITE_COLUMN),
+	//CMDSEQ1(SEQ_12, CHANGE_ROW_ADDRESS),
+	CMDSEQ2(SEQ_10, READ, READ_START),
+	CMDSEQ2(SEQ_10, READ, READ_CACHE_RANDOM),
+	CMDSEQ1(SEQ_11, READ_CACHE_SEQUENTIAL),
+	CMDSEQ1(SEQ_11, READ_CACHE_END),
+	CMDSEQ2(SEQ_12, READ, READ_INTERLEAVED),
+	//CMDSEQ2(SEQ_15, READ, READ, READ_START),
+	CMDSEQ2(SEQ_12, PAGE_PROGRAM, PAGE_PROGRAM_START),
+	CMDSEQ1(SEQ_13, PAGE_PROGRAM),
+	CMDSEQ2(SEQ_12, PAGE_PROGRAM, PAGE_CACHE_PROGRAM),
+	CMDSEQ2(SEQ_12, PAGE_PROGRAM, PAGE_PROGRAM_INTERLEAVED),
+	//CMDSEQ1(SEQ_0, WRITE_PAGE),
+	//CMDSEQ1(SEQ_0, WRITE_PAGE_CACHE),
+	//CMDSEQ1(SEQ_0, WRITE_PAGE_INTERLEAVED),
+	CMDSEQ2(SEQ_10, READ, READ_COPYBACK),
+	CMDSEQ2(SEQ_9, COPYBACK_PROGRAM, COPYBACK_PROGRAM_START),
+	CMDSEQ2(SEQ_12, COPYBACK_PROGRAM, COPYBACK_PROGRAM_INTERLEAVED),
+	CMDSEQ1(SEQ_13, COPYBACK_PROGRAM),
+	CMDSEQ2(SEQ_14, BLOCK_ERASE, BLOCK_ERASE_START),
+	CMDSEQ2(SEQ_14, BLOCK_ERASE, BLOCK_ERASE_INTERLEAVED),
 };
 
 static inline uint32_t
-xlnand_read_4(struct xlnand_softc *sc, bus_size_t off)
+xlnand_read_4(struct xlnand_softc *xlsc, bus_size_t off)
 {
-	return bus_space_read_4(sc-sc_bst, sc-sc_bsh, off);
+	return bus_space_read_4(xlsc-xlsc_bst, xlsc-xlsc_bsh, off);
 }
 
 static inline void

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2013-11-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov  5 18:43:31 UTC 2013

Modified Files:
src/sys/arch/mips/conf [matt-nb5-mips64]: files.rmixl
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_intr.c rmixl_intr.h
rmixl_pcie.c rmixl_pcievar.h rmixlp_pcie.c rmixlreg.h
Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_pcie_subr.c

Log Message:
Add XLP2XX support.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/conf/files.rmixl
cvs rdiff -u -r1.1.2.37 -r1.1.2.38 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/rmi/rmixl_intr.h
cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/sys/arch/mips/rmi/rmixl_pcie.c \
src/sys/arch/mips/rmi/rmixlreg.h
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_pcie_subr.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_pcievar.h \
src/sys/arch/mips/rmi/rmixlp_pcie.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2013-11-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Nov  5 18:44:02 UTC 2013

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_nand_pci.c

Log Message:
Start of a nand for xlp3xx/xlp2xx.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_nand_pci.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-12-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 15 03:05:56 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpuregs.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn.c rmixl_gpio_pci.c
rmixl_intr.c rmixl_machdep.c rmixlp_pcie.c rmixlreg.h rmixlvar.h

Log Message:
Add initial support for XLP II (XLP2XX/XLP1XX).


To generate a diff of this commit:
cvs rdiff -u -r1.74.28.25 -r1.74.28.26 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.205.4.1.2.1.2.68 -r1.205.4.1.2.1.2.69 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/rmi/rmixl_fmn.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_machdep.c
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixlp_pcie.c
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/sys/arch/mips/rmi/rmixlreg.h
cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/arch/mips/rmi/rmixlvar.h

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/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.74.28.25 src/sys/arch/mips/include/cpuregs.h:1.74.28.26
--- src/sys/arch/mips/include/cpuregs.h:1.74.28.25	Thu Jan 19 08:28:48 2012
+++ src/sys/arch/mips/include/cpuregs.h	Sat Dec 15 03:05:55 2012
@@ -911,10 +911,11 @@
 #define	MIPS_XLR_C4	0x91	/* RMI XLR Production Rev C4		*/
 
 /*
- * CPU processor IDs for company ID == 12 (RMI)
+ * CPU processor IDs for company ID == 12 (RMI, NetLogic, Broadcom)
  */
 #define	MIPS_XLP8XX	0x10	/* RMI XLP8XX/XLP4XX 		ISA 64  Rel 2 */
 #define	MIPS_XLP3XX	0x11	/* RMI XLP3XX	 		ISA 64  Rel 2 */
+#define	MIPS_XLP2XX	0x12	/* Broadcom XLP2XX/XLP1XX	ISA 64  Rel 2 */
 #define	MIPS_XLR308B	0x06	/* RMI XLR308-B	 		ISA 64  */
 #define	MIPS_XLR508B	0x07	/* RMI XLR508-B	 		ISA 64  */
 #define	MIPS_XLR516B	0x08	/* RMI XLR516-B	 		ISA 64  */

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.68 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.69
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.68	Sat Aug  4 07:20:31 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Sat Dec 15 03:05:55 2012
@@ -630,6 +630,18 @@ static const struct pridtab cputab[] = {
 	  CIDFL_RMI_TYPE_XLS|MIPS_CIDFL_RMI_CPUS(1,4)|MIPS_CIDFL_RMI_L2(256KB),
 	  XLS104		},
 
+	{ MIPS_PRID_CID_RMI, MIPS_XLP2XX, -1, -1, -1, 0,
+	  MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR |
+	  CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR,
+	  MIPS_CP0FL_USE |
+	  MIPS_CP0FL_EBASE | MIPS_CP0FL_USERLOCAL | MIPS_CP0FL_HWRENA |
+	  MIPS_CP0FL_EIRR | MIPS_CP0FL_EIMR |
+	  MIPS_CP0FL_CONFIG | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 |
+	  MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7,
+	  CIDFL_RMI_TYPE_XLP | MIPS_CIDFL_RMI_CPUS(1,4) |
+	  MIPS_CIDFL_RMI_L2(512KB) | MIPS_CIDFL_RMI_L3(2MB),
+	  XLP2XX		},
+
 	{ MIPS_PRID_CID_RMI, MIPS_XLP3XX, -1, -1, -1, 0,
 	  MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR |
 	  CPU_MIPS_I_D_CACHE_COHERENT | CPU_MIPS_HAVE_MxCR,

Index: src/sys/arch/mips/rmi/rmixl_fmn.c
diff -u src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.12 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.13
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.12	Fri Mar 30 01:04:47 2012
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Sat Dec 15 03:05:56 2012
@@ -364,7 +364,7 @@ fmn_init_xlp(fmn_info_t *fmn)
 		si-si_qid_first = 1000;
 		si-si_qid_last = 1019;
 	} else {
-		KASSERT(RMIXLP_3XX_P);
+		KASSERT(RMIXLP_3XX_P || RMIXLP_2XX_P);
 		si-si_qid_first = 496;
 		si-si_qid_last = 504;
 	}

Index: src/sys/arch/mips/rmi/rmixl_gpio_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.6 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.7
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.6	Thu Jan 19 17:28:50 2012
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Sat Dec 15 03:05:56 2012
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.6 2012/01/19 17:28:50 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.7 2012/12/15 03:05:56 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -81,6 +81,7 @@ static const uint8_t xlgpio_pincnt_by_va
 [RMIXLP_3XXL] = RMIXLP_GPIO_3XXL_MAXPINS,
 [RMIXLP_3XXH] = RMIXLP_GPIO_3XXL_MAXPINS,
 [RMIXLP_3XXQ] = RMIXLP_GPIO_3XXL_MAXPINS,
+[RMIXLP_2XX] = RMIXLP_GPIO_2XXL_MAXPINS,
 };
 
 
@@ -286,7 +287,7 @@ xlgpio_pci_attach(device_t parent, devic
 		/*
 		 * These are at different offsets on the 3xx than the 8xx/4xx.
 		 */
-		if (rcp-rc_xlp_variant = RMIXLP_3XX) {
+		if (RMIXLP_3XX_P || RMIXLP_2XX_P) {
 			gg-gg_r_intpol = RMIXLP_GPIO_3XX_INTPOL(group);
 			gg-gg_r_inttype = 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-12-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 15 03:05:56 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpuregs.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn.c rmixl_gpio_pci.c
rmixl_intr.c rmixl_machdep.c rmixlp_pcie.c rmixlreg.h rmixlvar.h

Log Message:
Add initial support for XLP II (XLP2XX/XLP1XX).


To generate a diff of this commit:
cvs rdiff -u -r1.74.28.25 -r1.74.28.26 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.205.4.1.2.1.2.68 -r1.205.4.1.2.1.2.69 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/rmi/rmixl_fmn.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_machdep.c
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixlp_pcie.c
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/sys/arch/mips/rmi/rmixlreg.h
cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/arch/mips/rmi/rmixlvar.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-08-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug  9 19:46:40 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn_pci.c

Log Message:
Deal with unallocated spill area in the fmn.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_fmn_pci.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/mips/rmi/rmixl_fmn_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_fmn_pci.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_fmn_pci.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_fmn_pci.c:1.1.2.1	Thu Jan 19 17:34:18 2012
+++ src/sys/arch/mips/rmi/rmixl_fmn_pci.c	Thu Aug  9 19:46:40 2012
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_fmn_pci.c,v 1.1.2.1 2012/01/19 17:34:18 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_fmn_pci.c,v 1.1.2.2 2012/08/09 19:46:40 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -237,10 +237,14 @@ xlfmn_pci_attach(device_t parent, device
 		 * allocated to it.
 		 */
 		if (oq_config  RMIXLP_FMN_OQ_CONFIG_SE) {
-			if (((64 * sb + ss)  12)  sc-sc_spill_base)
-sc-sc_spill_base = (64 * sb + ss)  12;
-			if (((64 * sb + sl + 1)  12)  sc-sc_spill_limit)
-sc-sc_spill_limit = (64 * sb + sl + 1)  12;
+			paddr_t spill_base = (64 * sb + ss)  12;
+			paddr_t spill_limit =  (64 * sb + sl + 1)  12;
+			if (spill_base  spill_limit) {
+if (spill_base  sc-sc_spill_base)
+	sc-sc_spill_base = spill_base;
+if (spill_limit  sc-sc_spill_limit)
+	sc-sc_spill_limit = spill_limit;
+			}
 		}
 
 		if ((oq_config  RMIXLP_FMN_OQ_CONFIG_OE) == 0)
@@ -297,15 +301,19 @@ xlfmn_pci_attach(device_t parent, device
 	spill area: %s: base=%#PRIxPADDR, limit=%#PRIxPADDR\n,
 	buf, sc-sc_spill_base, sc-sc_spill_limit);
 
-	/*
-	 * Let's try to allocate the spill area.
-	 */
-	struct pglist mlist;
-	int error = uvm_pglistalloc(sc-sc_spill_limit - sc-sc_spill_base,
-	sc-sc_spill_base, sc-sc_spill_limit, 0, 0, mlist, 1, true);
-	if (error)
-		aprint_error_dev(sc-sc_dev,
-		failed to allocate spill area: %d\n, error);
+	if (sc-sc_spill_base  sc-sc_spill_limit) {
+		/*
+		 * Let's try to allocate the spill area.
+		 */
+		struct pglist mlist;
+		int error = uvm_pglistalloc(
+		sc-sc_spill_limit - sc-sc_spill_base,
+		sc-sc_spill_base, sc-sc_spill_limit,
+		0, 0, mlist, 1, true);
+		if (error)
+			aprint_error_dev(sc-sc_dev,
+			failed to allocate spill area: %d\n, error);
+	}
 
 	aprint_normal_dev(sc-sc_dev, active queues: );
 	const char *pfx = ;



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-08-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug  9 19:46:40 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn_pci.c

Log Message:
Deal with unallocated spill area in the fmn.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_fmn_pci.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-08-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug  8 22:10:21 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap_segtab.c trap.c

Log Message:
Fix some LP64 bugs


To generate a diff of this commit:
cvs rdiff -u -r1.54.26.27 -r1.54.26.28 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.217.12.45 -r1.217.12.46 src/sys/arch/mips/mips/trap.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/mips/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.54.26.27 src/sys/arch/mips/include/pmap.h:1.54.26.28
--- src/sys/arch/mips/include/pmap.h:1.54.26.27	Sat Aug  4 07:20:31 2012
+++ src/sys/arch/mips/include/pmap.h	Wed Aug  8 22:10:21 2012
@@ -113,7 +113,7 @@ union pt_entry;
 
 typedef union pmap_segtab {
 	union pmap_segtab *	seg_seg[NSEGPG];
-	union pt_entry	*	seg_tab[NPTEPG];
+	union pt_entry	*	seg_tab[NSEGPG];
 } pmap_segtab_t;
 #else
 /*

Index: src/sys/arch/mips/mips/pmap_segtab.c
diff -u src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.18 src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.19
--- src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.18	Sat Aug  4 07:20:31 2012
+++ src/sys/arch/mips/mips/pmap_segtab.c	Wed Aug  8 22:10:21 2012
@@ -130,6 +130,7 @@ __KERNEL_RCSID(0, pmap_segtab.c,v 1.1.2
 #include mips/pte.h
 
 CTASSERT(NBPG = sizeof(pmap_segtab_t));
+
 #define PMAP_PTP_CACHE
 
 struct pmap_segtab_info {

Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.45 src/sys/arch/mips/mips/trap.c:1.217.12.46
--- src/sys/arch/mips/mips/trap.c:1.217.12.45	Sat Aug  4 07:20:31 2012
+++ src/sys/arch/mips/mips/trap.c	Wed Aug  8 22:10:21 2012
@@ -378,9 +378,9 @@ trap(uint32_t status, uint32_t cause, va
 		 */
 		struct cpu_info * const ci = curcpu();
 		if ((va  XSEGSHIFT) == 0 
-		__predict_false(ci-ci_pmap_seg0tab == NULL
- ci-ci_pmap_segtab-seg_seg[0] != NULL)) {
-			ci-ci_pmap_seg0tab = ci-ci_pmap_segtab-seg_seg[0];
+		__predict_false(ci-ci_pmap_seg0tab[0] == NULL
+ ci-ci_pmap_segtab[0]-seg_seg[0] != NULL)) {
+			ci-ci_pmap_seg0tab[0] = ci-ci_pmap_segtab[0]-seg_seg[0];
 			kpreempt_enable();
 			if (type  T_USER) {
 userret(l);



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-08-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug  8 22:10:21 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap_segtab.c trap.c

Log Message:
Fix some LP64 bugs


To generate a diff of this commit:
cvs rdiff -u -r1.54.26.27 -r1.54.26.28 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.217.12.45 -r1.217.12.46 src/sys/arch/mips/mips/trap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-08-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug  4 07:17:06 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: mips_opcode.h
src/sys/arch/mips/mips [matt-nb5-mips64]: db_disasm.c

Log Message:
disasm special2 and special3 opcodes (and ehb and ssnop too).


To generate a diff of this commit:
cvs rdiff -u -r1.12.96.3 -r1.12.96.4 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.19.62.4 -r1.19.62.5 src/sys/arch/mips/mips/db_disasm.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/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.12.96.3 src/sys/arch/mips/include/mips_opcode.h:1.12.96.4
--- src/sys/arch/mips/include/mips_opcode.h:1.12.96.3	Fri Apr 29 08:26:21 2011
+++ src/sys/arch/mips/include/mips_opcode.h	Sat Aug  4 07:17:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.12.96.3 2011/04/29 08:26:21 matt Exp $	*/
+/*	mips_opcode.h,v 1.12.96.3 2011/04/29 08:26:21 matt Exp	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -145,9 +145,10 @@ typedef union {
 #define OP_DADDIU	031		/* MIPS-II, for r4000 port */
 #define OP_LDL		032		/* MIPS-II, for r4000 port */
 #define OP_LDR		033		/* MIPS-II, for r4000 port */
-
-#define OP_SPECIAL2	034		/* QED opcodes */
-#define OP_SPECIAL3	037		/* QED opcodes */
+#define OP_SPECIAL2	034		/* QED/MIPS{32,64}R{1,2} opcodes */
+#define	OP_JALX		035
+#define	OP_MDMX		036
+#define OP_SPECIAL3	037		/* QED/MIPS{32,64}R{1,2} opcodes */
 
 #define OP_LB		040
 #define OP_LH		041
@@ -156,8 +157,6 @@ typedef union {
 #define OP_LBU		044
 #define OP_LHU		045
 #define OP_LWR		046
-#define OP_LHU		045
-#define OP_LWR		046
 #define OP_LWU		047		/* MIPS-II, for r4000 port */
 
 #define OP_SB		050
@@ -262,13 +261,27 @@ typedef union {
 #define OP_CLO		041		/* MIPS32/64 */
 #define OP_DCLZ		044		/* MIPS32/64 */
 #define OP_DCLO		045		/* MIPS32/64 */
+#define	OP_SDBBP	077		/* MIPS32/64 */
 
 /*
  * Values for the 'func' field when 'op' == OP_SPECIAL3.
  */
+#define	OP_EXT		000		/* MIPS32/64 r2 */
+#define	OP_DEXTM	001		/* MIPS32/64 r2 */
+#define	OP_DEXTU	002		/* MIPS32/64 r2 */
+#define	OP_DEXT		003		/* MIPS32/64 r2 */
+#define	OP_INS		004		/* MIPS32/64 r2 */
+#define	OP_DINSM	004		/* MIPS32/64 r2 */
+#define	OP_DINSU	006		/* MIPS32/64 r2 */
+#define	OP_DINS		007		/* MIPS32/64 r2 */
+#define	OP_BSHFL	040		/* MIPS32/64 r2 */
+#define	OP_DBSHFL	044		/* MIPS32/64 r2 */
 #define OP_RDHWR	073		/* MIPS32/64 r2 */
 
-
+#define	BSHFL_SBH	002		/* MIPS32/64 r2 */
+#define	BSHFL_SHD	005		/* MIPS32/64 r2 */
+#define	BSHFL_SEB	020		/* MIPS32/64 r2 */
+#define	BSHFL_SEH	030		/* MIPS32/64 r2 */
 /*
  * Values for the 'func' field when 'op' == OP_BCOND.
  */

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.19.62.4 src/sys/arch/mips/mips/db_disasm.c:1.19.62.5
--- src/sys/arch/mips/mips/db_disasm.c:1.19.62.4	Thu Feb 16 10:45:17 2012
+++ src/sys/arch/mips/mips/db_disasm.c	Sat Aug  4 07:17:05 2012
@@ -56,7 +56,7 @@ static const char * const op_name[64] = 
 /* 0 */ spec, bcond,j,	jal,	beq,	bne,	blez, bgtz,
 /* 8 */ addi, addiu,slti, sltiu,andi, ori,	xori, lui,
 /*16 */ cop0, cop1, cop2, cop3, beql, bnel, blezl,bgtzl,
-/*24 */ daddi,daddiu,ldl, ldr,	op34, op35, op36, op37,
+/*24 */ daddi,daddiu,ldl, ldr,	spec2, jalx, mdmx, spec3,
 /*32 */ lb,	lh,	lwl,	lw,	lbu,	lhu,	lwr,	lwu,
 /*40 */ sb,	sh,	swl,	sw,	sdl,	sdr,	swr,	cache,
 /*48 */ ll,	lwc1, lwc2, lwc3, lld,	ldc1, ldc2, ld,
@@ -74,8 +74,26 @@ static const char * const spec_name[64] 
 /*56 */ dsll,spec71,dsrl,dsra,dsll32,spec75,dsrl32,dsra32
 };
 
-static const char * const spec2_name[4] = {		/* QED RM4650, R5000, etc. */
-/* 0 */ mad, madu, mul, spec3
+static const char const spec2_name[64][8] = {	/* MIPSxxR{1,2} */
+/*  0 */ mad, madu, mul, sp2?3, msub, msubu, sp2?6, sp2?7,
+/*  8 */ sp2?8, sp2?9, sp2?10, sp2?11, sp2?12, sp2?13, sp2?14, sp2?15,
+/* 16 */ sp2?16, sp2?17, sp2?18, sp2?19, sp2?20, sp2?21, sp2?22, sp2?23,
+/* 24 */ sp2?24, sp2?25, sp2?26, sp2?27, sp2?28, sp2?29, sp2?30, sp2?31,
+/* 32 */ clz, clo, sp2?34, sp2?35, dclz, dclo, sp2?38, sp2?39,
+/* 40 */ sp2?40, sp2?41, sp2?42, sp2?43, sp2?44, sp2?45, sp2?46, sp2?47,
+/* 48 */ sp2?48, sp2?49, sp2?50, sp2?51, sp2?52, sp2?53, sp2?54, sp2?55,
+/* 56 */ sp2?56, sp2?57, sp2?58, sp2?59, sp2?60, sp2?61, sp2?62, sdbbp,
+};
+
+static const char const spec3_name[64][8] = {	/* MIPSxxR2 */
+/*  0 */ ext, dextm, dextu, dext, ins, dinsm, dinsu, dins,
+/*  8 */ sp3?8, sp3?9, sp3?10, sp3?11, sp3?12, sp3?13, sp3?14, sp3?15,
+/* 16 */ sp3?16, sp3?17, sp3?18, sp3?19, sp3?20, sp3?21, sp3?22, sp3?23,
+/* 24 */ sp3?24, sp3?25, sp3?26, sp3?27, sp3?28, sp3?29, sp3?30, sp3?31,
+/* 32 */ bshfl, sp3?33, sp3?34, sp3?35, dbshfl, sp3?37, sp3?38, sp3?39,
+/* 40 */ sp3?40, sp3?41, sp3?42, sp3?43, sp3?44, sp3?45, sp3?46, sp3?47,
+/* 48 */ sp3?48, sp3?49, sp3?50, sp3?51, sp3?52, sp3?53, sp3?54, sp3?55,
+/* 56 */ sp3?56, 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-08-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug  4 07:20:32 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h mips_param.h pmap.h
pte.h vmparam.h
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c genassym.cf
mipsX_subr.S mips_machdep.c pmap.c pmap_segtab.c trap.c
vm_machdep.c

Log Message:
Make MIPS use a multi-level page table for the kernel address space.
(just like the user address does).   XXX fix mips1


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.45 -r1.90.16.46 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.23.78.12 -r1.23.78.13 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.54.26.26 -r1.54.26.27 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.19.18.4 -r1.19.18.5 src/sys/arch/mips/include/pte.h
cvs rdiff -u -r1.41.28.27 -r1.41.28.28 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.44.12.33 -r1.44.12.34 src/sys/arch/mips/mips/genassym.cf
cvs rdiff -u -r1.26.36.1.2.57 -r1.26.36.1.2.58 \
src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.205.4.1.2.1.2.67 -r1.205.4.1.2.1.2.68 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.45 -r1.179.16.46 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.217.12.44 -r1.217.12.45 src/sys/arch/mips/mips/trap.c
cvs rdiff -u -r1.121.6.1.2.29 -r1.121.6.1.2.30 \
src/sys/arch/mips/mips/vm_machdep.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.45 src/sys/arch/mips/include/cpu.h:1.90.16.46
--- src/sys/arch/mips/include/cpu.h:1.90.16.45	Mon Jul  9 17:23:37 2012
+++ src/sys/arch/mips/include/cpu.h	Sat Aug  4 07:20:31 2012
@@ -120,9 +120,9 @@ struct cpu_info {
 	int ci_tlb_slot;		/* reserved tlb entry for cpu_info */
 	u_int ci_pmap_asid_cur;		/* current ASID */
 	struct pmap_tlb_info *ci_tlb_info; /* tlb information for this cpu */
-	union pmap_segtab *ci_pmap_seg0tab;
+	union pmap_segtab *ci_pmap_seg0tab[2];
 #ifdef _LP64
-	union pmap_segtab *ci_pmap_segtab;
+	union pmap_segtab *ci_pmap_segtab[2];
 #else
 	vaddr_t ci_pmap_srcbase;	/* starting VA of ephemeral src space */
 	vaddr_t ci_pmap_dstbase;	/* starting VA of ephemeral dst space */

Index: src/sys/arch/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.23.78.12 src/sys/arch/mips/include/mips_param.h:1.23.78.13
--- src/sys/arch/mips/include/mips_param.h:1.23.78.12	Mon Feb 27 16:57:58 2012
+++ src/sys/arch/mips/include/mips_param.h	Sat Aug  4 07:20:31 2012
@@ -87,18 +87,24 @@
 #define	PGSHIFT		PAGE_SHIFT	/* LOG2(NBPG) */
 #define	NBPG		(1  PGSHIFT)	/* bytes/page */
 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
-#define	NPTEPG		(NBPG/4)
+#define	PTPSHIFT	(2)
+#define	PTPLENGTH	(PGSHIFT-PTPSHIFT)
+#define	NPTEPG		(1  PTPLENGTH)
 
 #define NBSEG		(NBPG*NPTEPG)	/* bytes/segment */
 #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
-#define	SEGSHIFT	(PGSHIFT+(PGSHIFT-2))	/* LOG2(NBSEG) */
+#define	SEGSHIFT	(PGSHIFT+PTPLENGTH)	/* LOG2(NBSEG) */
 
 #ifdef _LP64
-#define	NSEGPG		(NBPG/8)
+#define	SEGLENGTH	(PGSHIFT-3)
 #define NBXSEG		((uint64_t)NSEGPG*NBSEG)	/* bytes/xsegment */
 #define	XSEGOFSET	(NBXSEG-1)	/* byte offset into xsegment */
-#define	XSEGSHIFT	(SEGSHIFT+(PGSHIFT-3))	/* LOG2(NBXSEG) */
+#define	XSEGSHIFT	(SEGSHIFT+SEGLENGTH)	/* LOG2(NBXSEG) */
+#define	XSEGLENGTH	(PGSHIFT-3)
+#else
+#define	SEGLENGTH	(31-SEGSHIFT)
 #endif
+#define	NSEGPG		(1  SEGLENGTH)
 
 /*
  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized

Index: src/sys/arch/mips/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.54.26.26 src/sys/arch/mips/include/pmap.h:1.54.26.27
--- src/sys/arch/mips/include/pmap.h:1.54.26.26	Mon Jul  9 17:23:37 2012
+++ src/sys/arch/mips/include/pmap.h	Sat Aug  4 07:20:31 2012
@@ -109,17 +109,11 @@
 #define mips_trunc_seg(x)	((vaddr_t)(x)  ~SEGOFSET)
 #define mips_round_seg(x)	(((vaddr_t)(x) + SEGOFSET)  ~SEGOFSET)
 
-#ifdef _LP64
-#define PMAP_SEGTABSIZE		NSEGPG
-#else
-#define PMAP_SEGTABSIZE		(1  (31 - SEGSHIFT))
-#endif
-
 union pt_entry;
 
 typedef union pmap_segtab {
-	union pmap_segtab *	seg_seg[PMAP_SEGTABSIZE];
-	union pt_entry	*	seg_tab[PMAP_SEGTABSIZE];
+	union pmap_segtab *	seg_seg[NSEGPG];
+	union pt_entry	*	seg_tab[NPTEPG];
 } pmap_segtab_t;
 #else
 /*

Index: src/sys/arch/mips/include/pte.h
diff -u src/sys/arch/mips/include/pte.h:1.19.18.4 src/sys/arch/mips/include/pte.h:1.19.18.5
--- src/sys/arch/mips/include/pte.h:1.19.18.4	Thu Mar 11 08:13:18 2010
+++ src/sys/arch/mips/include/pte.h	Sat Aug  4 07:20:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte.h,v 1.19.18.4 2010/03/11 08:13:18 matt Exp $	*/
+/*	pte.h,v 1.19.18.4 2010/03/11 08:13:18 matt Exp	*/
 
 /*-
  * Copyright (c) 1997 The 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-08-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug  4 07:17:06 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: mips_opcode.h
src/sys/arch/mips/mips [matt-nb5-mips64]: db_disasm.c

Log Message:
disasm special2 and special3 opcodes (and ehb and ssnop too).


To generate a diff of this commit:
cvs rdiff -u -r1.12.96.3 -r1.12.96.4 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.19.62.4 -r1.19.62.5 src/sys/arch/mips/mips/db_disasm.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-08-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug  4 07:20:32 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h mips_param.h pmap.h
pte.h vmparam.h
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c genassym.cf
mipsX_subr.S mips_machdep.c pmap.c pmap_segtab.c trap.c
vm_machdep.c

Log Message:
Make MIPS use a multi-level page table for the kernel address space.
(just like the user address does).   XXX fix mips1


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.45 -r1.90.16.46 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.23.78.12 -r1.23.78.13 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.54.26.26 -r1.54.26.27 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.19.18.4 -r1.19.18.5 src/sys/arch/mips/include/pte.h
cvs rdiff -u -r1.41.28.27 -r1.41.28.28 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.44.12.33 -r1.44.12.34 src/sys/arch/mips/mips/genassym.cf
cvs rdiff -u -r1.26.36.1.2.57 -r1.26.36.1.2.58 \
src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.205.4.1.2.1.2.67 -r1.205.4.1.2.1.2.68 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.45 -r1.179.16.46 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.217.12.44 -r1.217.12.45 src/sys/arch/mips/mips/trap.c
cvs rdiff -u -r1.121.6.1.2.29 -r1.121.6.1.2.30 \
src/sys/arch/mips/mips/vm_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:11:32 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: locore_mips1.S mipsX_subr.S

Log Message:
Add code to panic if/when a kthread return to lwp_startup.
Add a workaround for the XLP which requires a EHB at the start of the interrupt
vector.


To generate a diff of this commit:
cvs rdiff -u -r1.64.26.1.2.15 -r1.64.26.1.2.16 \
src/sys/arch/mips/mips/locore_mips1.S
cvs rdiff -u -r1.26.36.1.2.56 -r1.26.36.1.2.57 \
src/sys/arch/mips/mips/mipsX_subr.S

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/mips/mips/locore_mips1.S
diff -u src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.15 src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.16
--- src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.15	Thu Feb  9 20:01:21 2012
+++ src/sys/arch/mips/mips/locore_mips1.S	Mon Jul  9 17:11:32 2012
@@ -1511,6 +1511,15 @@ LEAF(MIPSX(lwp_trampoline))
 	jalr	s0			
 	 move	a0, s1
 
+#ifdef DIAGNOSTIC
+	INT_L	v0, L_FLAG(MIPS_CURLWP)
+	and	v0, LW_SYSTEM
+	beqz	v0, 1f
+	 nop
+	PANIC(kthread failed to call kthread_exit!)
+1:
+#endif
+
 	# Return to user (won't happen if a kernel thread)
 	.set	noat
 MIPSX(user_return):

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.56 src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.57
--- src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.56	Mon Feb 27 17:04:39 2012
+++ src/sys/arch/mips/mips/mipsX_subr.S	Mon Jul  9 17:11:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.56 2012/02/27 17:04:39 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.57 2012/07/09 17:11:32 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -601,8 +601,13 @@ _VECTOR_END(MIPSX(exception))
  */
 VECTOR(MIPSX(intr), unknown)
 	.set	noat
+#if (MIPS64R2_RMIXL)  0
+	EHB	#work around chip bug
+#endif
 	mfc0	k1, MIPS_COP_0_STATUS		#00: get the status register
+#if (MIPS3)  0
 	nop	#01: stall
+#endif
 	and	k1, k1, MIPS3_SR_KSU_USER	#02: test for user mode
 	PTR_LA	k0, MIPSX(user_intr)		#03: assume user mode
 	bnez	k1, 1f#05: yep, do it
@@ -2598,6 +2603,14 @@ LEAF(MIPSX(lwp_trampoline))
 	jalr	s0			
 	 move	a0, s1
 
+#ifdef DIAGNOSTIC
+	INT_L	v0, L_FLAG(MIPS_CURLWP)
+	and	v0, LW_SYSTEM
+	beqz	v0, 1f
+	 nop
+	PANIC(kthread failed to call kthread_exit!)
+1:
+#endif
 	#
 	# Return to user (won't happen if a kernel thread)
 	#



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:12:39 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cache_r4k_subr.S

Log Message:
Add a .set mips32 so that O32 kernels can compile.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/mips/mips/cache_r4k_subr.S

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/mips/mips/cache_r4k_subr.S
diff -u src/sys/arch/mips/mips/cache_r4k_subr.S:1.1.2.3 src/sys/arch/mips/mips/cache_r4k_subr.S:1.1.2.4
--- src/sys/arch/mips/mips/cache_r4k_subr.S:1.1.2.3	Thu Feb 16 10:44:30 2012
+++ src/sys/arch/mips/mips/cache_r4k_subr.S	Mon Jul  9 17:12:39 2012
@@ -37,7 +37,7 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: cache_r4k_subr.S,v 1.1.2.3 2012/02/16 10:44:30 matt Exp $)
+RCSID($NetBSD: cache_r4k_subr.S,v 1.1.2.4 2012/07/09 17:12:39 matt Exp $)
 
 #include mips/cache_r4k.h
 
@@ -45,6 +45,12 @@ RCSID($NetBSD: cache_r4k_subr.S,v 1.1.2
 #error LINE_SHIFT undefined
 #endif
 
+#ifdef __mips_o32
+	.set	mips32
+#else
+	.set	mips3
+#endif
+
 #define	LINE_SIZE		(1  LINE_SHIFT)
 
 #ifdef __STDC__



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:13:06 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: genassym.cf

Log Message:
Add L_FLAG / LW_SYSTEM


To generate a diff of this commit:
cvs rdiff -u -r1.44.12.32 -r1.44.12.33 src/sys/arch/mips/mips/genassym.cf

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/mips/mips/genassym.cf
diff -u src/sys/arch/mips/mips/genassym.cf:1.44.12.32 src/sys/arch/mips/mips/genassym.cf:1.44.12.33
--- src/sys/arch/mips/mips/genassym.cf:1.44.12.32	Mon Feb 27 17:04:39 2012
+++ src/sys/arch/mips/mips/genassym.cf	Mon Jul  9 17:13:06 2012
@@ -109,6 +109,7 @@ define	MIPS_XKSEG_START	MIPS_XKSEG_START
 # Important offsets into the lwp and proc structs  associated constants
 define	L_CPU			offsetof(struct lwp, l_cpu)
 define	L_CTXSWITCH		offsetof(struct lwp, l_ctxswtch)
+define	L_FLAG			offsetof(struct lwp, l_flag)
 define	L_PCB			offsetof(struct lwp, l_addr)
 define	L_PRIORITY		offsetof(struct lwp, l_priority)
 define	L_PRIVATE		offsetof(struct lwp, l_private)
@@ -120,6 +121,8 @@ define	L_MD_UPTE_1		offsetof(struct lwp,
 define	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)
 define	L_WCHAN			offsetof(struct lwp, l_wchan)
 
+define	LW_SYSTEM		LW_SYSTEM
+
 define	P_RASLIST		offsetof(struct proc, p_raslist)
 define	P_MD_SYSCALL		offsetof(struct proc, p_md.md_syscall)
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:14:47 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c

Log Message:
It's mips_cpu_switchto now.


To generate a diff of this commit:
cvs rdiff -u -r1.217.12.43 -r1.217.12.44 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.43 src/sys/arch/mips/mips/trap.c:1.217.12.44
--- src/sys/arch/mips/mips/trap.c:1.217.12.43	Mon Feb 27 17:04:39 2012
+++ src/sys/arch/mips/mips/trap.c	Mon Jul  9 17:14:47 2012
@@ -1195,7 +1195,7 @@ const static struct { void *addr; const 
 #endif	/* MIPS64R2_RMIXL */
 
 	Name(cpu_idle),
-	Name(cpu_switchto),
+	Name(mips_cpu_switchto),
 	{0, 0}
 };
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:15:17 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h

Log Message:
Add mips_cpu_switchto prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.35 -r1.78.36.1.2.36 \
src/sys/arch/mips/include/locore.h

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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.78.36.1.2.35 src/sys/arch/mips/include/locore.h:1.78.36.1.2.36
--- src/sys/arch/mips/include/locore.h:1.78.36.1.2.35	Tue Feb 14 01:51:11 2012
+++ src/sys/arch/mips/include/locore.h	Mon Jul  9 17:15:17 2012
@@ -44,12 +44,15 @@ struct trapframe;
 void	trap(uint32_t, uint32_t, vaddr_t, vaddr_t, struct trapframe *);
 void	ast(void);
 
+struct lwp *
+	mips_cpu_switchto(struct lwp *, struct lwp *, bool);
+
 /*
  * Perform a trapsignal, and if cpu_printfataltraps is true, print the trap info
  * to the console.
  */
 extern bool cpu_printfataltraps;
-void cpu_trapsignal(struct lwp *, ksiginfo_t *, struct trapframe *);
+void	cpu_trapsignal(struct lwp *, ksiginfo_t *, struct trapframe *);
 
 void	mips_fpu_trap(vaddr_t, struct trapframe *);
 void	mips_fpu_intr(vaddr_t, struct trapframe *);



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:23:37 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_segtab.c
pmap_tlb.c

Log Message:
Use a spinlock to protect the segtab queues.  Use union pmap_segmap and
pmap_segmap_t to track -HEAD.  Use KERNEL_PID for the same reason.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.44 -r1.90.16.45 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.54.26.25 -r1.54.26.26 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.179.16.44 -r1.179.16.45 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/arch/mips/mips/pmap_tlb.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.44 src/sys/arch/mips/include/cpu.h:1.90.16.45
--- src/sys/arch/mips/include/cpu.h:1.90.16.44	Mon Feb 27 17:04:39 2012
+++ src/sys/arch/mips/include/cpu.h	Mon Jul  9 17:23:37 2012
@@ -120,9 +120,9 @@ struct cpu_info {
 	int ci_tlb_slot;		/* reserved tlb entry for cpu_info */
 	u_int ci_pmap_asid_cur;		/* current ASID */
 	struct pmap_tlb_info *ci_tlb_info; /* tlb information for this cpu */
-	union segtab *ci_pmap_seg0tab;
+	union pmap_segtab *ci_pmap_seg0tab;
 #ifdef _LP64
-	union segtab *ci_pmap_segtab;
+	union pmap_segtab *ci_pmap_segtab;
 #else
 	vaddr_t ci_pmap_srcbase;	/* starting VA of ephemeral src space */
 	vaddr_t ci_pmap_dstbase;	/* starting VA of ephemeral dst space */

Index: src/sys/arch/mips/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.54.26.25 src/sys/arch/mips/include/pmap.h:1.54.26.26
--- src/sys/arch/mips/include/pmap.h:1.54.26.25	Mon Feb 27 16:57:05 2012
+++ src/sys/arch/mips/include/pmap.h	Mon Jul  9 17:23:37 2012
@@ -104,6 +104,8 @@
  * dynamically allocated at boot time.
  */
 
+#define	KERNEL_PID		0
+
 #define mips_trunc_seg(x)	((vaddr_t)(x)  ~SEGOFSET)
 #define mips_round_seg(x)	(((vaddr_t)(x) + SEGOFSET)  ~SEGOFSET)
 
@@ -115,17 +117,15 @@
 
 union pt_entry;
 
-union segtab {
-#ifdef _LP64
-	union segtab	*seg_seg[PMAP_SEGTABSIZE];
-#endif
-	union pt_entry	*seg_tab[PMAP_SEGTABSIZE];
-};
+typedef union pmap_segtab {
+	union pmap_segtab *	seg_seg[PMAP_SEGTABSIZE];
+	union pt_entry	*	seg_tab[PMAP_SEGTABSIZE];
+} pmap_segtab_t;
 #else
 /*
  * Modules don't need to know this.
  */
-union segtab;
+typedef union pmap_segtab pmap_segtab_t;
 #endif
 
 /*
@@ -155,6 +155,7 @@ void pmap_pte_process(struct pmap *, vad
 void pmap_segtab_activate(struct pmap *, struct lwp *);
 void pmap_segtab_init(struct pmap *);
 void pmap_segtab_destroy(struct pmap *, pte_callback_t, uintptr_t);
+extern kmutex_t pmap_segtab_lock;
 #endif /* _KERNEL */
 
 /*
@@ -182,7 +183,7 @@ typedef struct pmap {
 	volatile uint32_t	pm_onproc;	/* pmap is active on ... */
 	volatile uint32_t	pm_shootdown_pending;
 #endif
-	union segtab		*pm_segtab;	/* pointers to pages of PTEs */
+	pmap_segtab_t *		pm_segtab;	/* pointers to pages of PTEs */
 	u_int			pm_count;	/* pmap reference count */
 	u_int			pm_flags;
 #define	PMAP_DEFERRED_ACTIVATE	0x0001
@@ -304,8 +305,10 @@ struct vm_page *mips_pmap_alloc_poolpage
 #define	POOL_VTOPHYS(va)	(MIPS_KSEG0_P(va) \
 ? MIPS_KSEG0_TO_PHYS(va) \
 : MIPS_XKPHYS_TO_PHYS(va))
+#define	POOL_PHYSTOV(pa)	MIPS_PHYS_TO_XKPHYS_CACHED((paddr_t)(pa))
 #else
 #define	POOL_VTOPHYS(va)	MIPS_KSEG0_TO_PHYS((vaddr_t)(va))
+#define	POOL_PHYSTOV(pa)	MIPS_PHYS_TO_KSEG0((paddr_t)(pa))
 #endif
 
 /*

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.44 src/sys/arch/mips/mips/pmap.c:1.179.16.45
--- src/sys/arch/mips/mips/pmap.c:1.179.16.44	Mon Feb 27 16:57:06 2012
+++ src/sys/arch/mips/mips/pmap.c	Mon Jul  9 17:23:37 2012
@@ -760,6 +760,11 @@ pmap_init(void)
 #endif
 
 	/*
+	 * Initialize the segtab lock.
+	 */
+	mutex_init(pmap_segtab_lock, MUTEX_DEFAULT, IPL_HIGH);  
+
+	/*
 	 * Set a low water mark on the pv_entry pool, so that we are
 	 * more likely to have these around even in extreme memory
 	 * starvation.

Index: src/sys/arch/mips/mips/pmap_segtab.c
diff -u src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.16 src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.17
--- src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.16	Thu Jul  5 17:28:39 2012
+++ src/sys/arch/mips/mips/pmap_segtab.c	Mon Jul  9 17:23:37 2012
@@ -119,13 +119,8 @@ __KERNEL_RCSID(0, pmap_segtab.c,v 1.1.2
 #include sys/param.h
 #include sys/systm.h
 #include sys/proc.h
-#include sys/pool.h
 #include sys/mutex.h
 #include sys/atomic.h
-#ifdef SYSVSHM
-#include sys/shm.h
-#endif
-#include sys/socketvar.h	/* XXX: for sock_loan_thresh */
 
 #include uvm/uvm.h
 
@@ -134,25 +129,29 @@ __KERNEL_RCSID(0, pmap_segtab.c,v 1.1.2
 #include mips/locore.h
 #include mips/pte.h
 
-CTASSERT(NBPG = sizeof(union 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:11:32 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: locore_mips1.S mipsX_subr.S

Log Message:
Add code to panic if/when a kthread return to lwp_startup.
Add a workaround for the XLP which requires a EHB at the start of the interrupt
vector.


To generate a diff of this commit:
cvs rdiff -u -r1.64.26.1.2.15 -r1.64.26.1.2.16 \
src/sys/arch/mips/mips/locore_mips1.S
cvs rdiff -u -r1.26.36.1.2.56 -r1.26.36.1.2.57 \
src/sys/arch/mips/mips/mipsX_subr.S

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:12:39 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cache_r4k_subr.S

Log Message:
Add a .set mips32 so that O32 kernels can compile.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/mips/mips/cache_r4k_subr.S

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:13:06 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: genassym.cf

Log Message:
Add L_FLAG / LW_SYSTEM


To generate a diff of this commit:
cvs rdiff -u -r1.44.12.32 -r1.44.12.33 src/sys/arch/mips/mips/genassym.cf

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:14:47 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c

Log Message:
It's mips_cpu_switchto now.


To generate a diff of this commit:
cvs rdiff -u -r1.217.12.43 -r1.217.12.44 src/sys/arch/mips/mips/trap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:15:17 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h

Log Message:
Add mips_cpu_switchto prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.35 -r1.78.36.1.2.36 \
src/sys/arch/mips/include/locore.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-07-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul  9 17:23:37 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_segtab.c
pmap_tlb.c

Log Message:
Use a spinlock to protect the segtab queues.  Use union pmap_segmap and
pmap_segmap_t to track -HEAD.  Use KERNEL_PID for the same reason.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.44 -r1.90.16.45 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.54.26.25 -r1.54.26.26 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.179.16.44 -r1.179.16.45 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/arch/mips/mips/pmap_tlb.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  5 17:28:39 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap_segtab.c

Log Message:
Fix typo (assigned wrong variable).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/arch/mips/mips/pmap_segtab.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/mips/mips/pmap_segtab.c
diff -u src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.15 src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.16
--- src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.15	Mon Feb 27 16:57:06 2012
+++ src/sys/arch/mips/mips/pmap_segtab.c	Thu Jul  5 17:28:39 2012
@@ -469,7 +469,7 @@ pmap_pte_reserve(pmap_t pmap, vaddr_t va
 			union segtab *ostp = atomic_cas_ptr(stp_p, NULL, nstp);
 			if (__predict_false(ostp != NULL)) {
 pmap_segtab_free(nstp);
-stp = ostp;
+nstp = ostp;
 			}
 #else
 			*stp_p = nstp;



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-07-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul  5 17:28:39 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap_segtab.c

Log Message:
Fix typo (assigned wrong variable).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/arch/mips/mips/pmap_segtab.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-03-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 30 01:04:48 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn.c

Log Message:
Deal with station ids without names (not all XLS have all stations).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/rmi/rmixl_fmn.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/mips/rmi/rmixl_fmn.c
diff -u src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.11 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.12
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.11	Thu Jan 19 10:29:34 2012
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Fri Mar 30 01:04:47 2012
@@ -790,8 +790,10 @@ rmixl_fmn_cpu_attach(struct cpu_info *ci
 	KASSERT(xname != NULL);
 
 	for (size_t i = 1; i  fmn_info.fmn_nstid; i++) {
-		evcnt_attach_dynamic(sc-sc_fmn_stid_evcnts[i],
-		EVCNT_TYPE_MISC, NULL, xname, fmn_stid_ev_names[i]);
+		if (fmn_stid_ev_names[i][0] != '\0') {
+			evcnt_attach_dynamic(sc-sc_fmn_stid_evcnts[i],
+			EVCNT_TYPE_MISC, NULL, xname, fmn_stid_ev_names[i]);
+		}
 	}
 
 	for (size_t i = 0; i  fmn_info.fmn_nbucket; i++) {
@@ -811,9 +813,11 @@ rmixl_fmn_init_thread(void)
 
 	KASSERT(fmn-fmn_stinfo[0].si_name == NULL);
 	for (size_t i = 1; i  fmn_info.fmn_nstid; i++) {
-		KASSERT(fmn-fmn_stinfo[i].si_name != NULL);
-		snprintf(fmn_stid_ev_names[i], sizeof(fmn_stid_ev_names[i]),
-		fmn %s rx msgs, fmn-fmn_stinfo[i].si_name);
+		if (fmn-fmn_stinfo[i].si_name != NULL) {
+			snprintf(fmn_stid_ev_names[i],
+			sizeof(fmn_stid_ev_names[i]),
+			fmn %s rx msgs, fmn-fmn_stinfo[i].si_name);
+		}
 	}
 
 	if (CPU_IS_PRIMARY(ci)) {



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-03-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar 30 01:04:48 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn.c

Log Message:
Deal with station ids without names (not all XLS have all stations).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/rmi/rmixl_fmn.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 29 01:55:45 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c

Log Message:
Improve conditions for send_sigsegv.


To generate a diff of this commit:
cvs rdiff -u -r1.14.78.15 -r1.14.78.16 src/sys/arch/mips/mips/mips_emul.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/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.14.78.15 src/sys/arch/mips/mips/mips_emul.c:1.14.78.16
--- src/sys/arch/mips/mips/mips_emul.c:1.14.78.15	Mon Feb 27 16:59:42 2012
+++ src/sys/arch/mips/mips/mips_emul.c	Wed Feb 29 01:55:44 2012
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, mips_emul.c,v 1.14.78
 #include mips/vmparam.h			/* for VM_MAX_ADDRESS */
 #include mips/trap.h
 
-#ifndef NOMIPSEMUL
+#if (!defined(NOMIPSEMUL)  (MIPS1 + MIPS2)  0) || defined(FPEMUL) 
 static void	send_sigsegv(intptr_t, uint32_t, struct trapframe *, uint32_t);
 #endif
 static void	send_sigill(intptr_t, uint32_t, struct trapframe *, uint32_t,
@@ -263,7 +263,7 @@ mips_emul_inst(uint32_t status, uint32_t
 	}
 }
 
-#ifndef NOMIPSEMUL
+#if (!defined(NOMIPSEMUL)  (MIPS1 + MIPS2)  0) || defined(FPEMUL)
 static void
 send_sigsegv(intptr_t vaddr, uint32_t exccode, struct trapframe *tf,
 uint32_t cause)
@@ -821,7 +821,7 @@ mips_emul_lwr(uint32_t inst, struct trap
 	update_pc(tf, cause);
 }
 
-#if defined(__mips_n32) || defined(__mips_n64) || defined(__mips_o64)
+#if !defined(__mips_o32)
 void
 mips_emul_lwu(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
@@ -938,7 +938,7 @@ mips_emul_ldr(uint32_t inst, struct trap
 
 	update_pc(tf, cause);
 }
-#endif /* defined(__mips_n32) || defined(__mips_n64) || defined(__mips_o64) */
+#endif /* !defined(__mips_o32) */
 
 void
 mips_emul_sb(uint32_t inst, struct trapframe *tf, uint32_t cause)
@@ -1081,7 +1081,7 @@ mips_emul_swr(uint32_t inst, struct trap
 	update_pc(tf, cause);
 }
 
-#if defined(__mips_n32) || defined(__mips_n64) || defined(__mips_o64)
+#if !defined(__mips_o32)
 void
 mips_emul_sd(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
@@ -1178,5 +1178,5 @@ mips_emul_sdr(uint32_t inst, struct trap
 
 	update_pc(tf, cause);
 }
-#endif /* defined(__mips_n32) || defined(__mips_n64) || defined(__mips_o64) */
+#endif /* !defined(__mips_o32) */
 #endif /* defined(FPEMUL) */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 29 02:02:57 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c

Log Message:
Fix $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.14.78.16 -r1.14.78.17 src/sys/arch/mips/mips/mips_emul.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/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.14.78.16 src/sys/arch/mips/mips/mips_emul.c:1.14.78.17
--- src/sys/arch/mips/mips/mips_emul.c:1.14.78.16	Wed Feb 29 01:55:44 2012
+++ src/sys/arch/mips/mips/mips_emul.c	Wed Feb 29 02:02:57 2012
@@ -1,4 +1,4 @@
-/*	mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp */
+/*	$NetBSD: mips_emul.c,v 1.14.78.17 2012/02/29 02:02:57 matt Exp $	*/
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 29 01:55:45 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c

Log Message:
Improve conditions for send_sigsegv.


To generate a diff of this commit:
cvs rdiff -u -r1.14.78.15 -r1.14.78.16 src/sys/arch/mips/mips/mips_emul.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb 29 02:02:57 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c

Log Message:
Fix $NetBSD$


To generate a diff of this commit:
cvs rdiff -u -r1.14.78.16 -r1.14.78.17 src/sys/arch/mips/mips/mips_emul.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 16:57:06 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_segtab.c

Log Message:
Add a page-table-page cache to keep reuse just released page table tables.
Actually remove the addresses in pmap_remove_all.


To generate a diff of this commit:
cvs rdiff -u -r1.54.26.24 -r1.54.26.25 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.179.16.43 -r1.179.16.44 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/arch/mips/mips/pmap_segtab.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/mips/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.54.26.24 src/sys/arch/mips/include/pmap.h:1.54.26.25
--- src/sys/arch/mips/include/pmap.h:1.54.26.24	Thu Feb 16 23:02:21 2012
+++ src/sys/arch/mips/include/pmap.h	Mon Feb 27 16:57:05 2012
@@ -154,7 +154,7 @@ void pmap_pte_process(struct pmap *, vad
 	uintptr_t);
 void pmap_segtab_activate(struct pmap *, struct lwp *);
 void pmap_segtab_init(struct pmap *);
-void pmap_segtab_destroy(struct pmap *);
+void pmap_segtab_destroy(struct pmap *, pte_callback_t, uintptr_t);
 #endif /* _KERNEL */
 
 /*

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.43 src/sys/arch/mips/mips/pmap.c:1.179.16.44
--- src/sys/arch/mips/mips/pmap.c:1.179.16.43	Thu Feb 16 23:02:22 2012
+++ src/sys/arch/mips/mips/pmap.c	Mon Feb 27 16:57:06 2012
@@ -865,7 +865,7 @@ pmap_destroy(pmap_t pmap)
 	PMAP_COUNT(destroy);
 	kpreempt_disable();
 	pmap_tlb_asid_release_all(pmap);
-	pmap_segtab_destroy(pmap);
+	pmap_segtab_destroy(pmap, NULL, 0);
 
 	pool_put(pmap_pmap_pool, pmap);
 	kpreempt_enable();
@@ -1754,6 +1754,7 @@ pmap_remove_all(struct pmap *pmap)
 		pmap_tlb_asid_deactivate(pmap);
 #endif
 	pmap_tlb_asid_release_all(pmap);
+	pmap_segtab_destroy(pmap, pmap_pte_remove, 0);
 	pmap-pm_flags |= PMAP_DEFERRED_ACTIVATE;
 
 #ifdef PMAP_FAULTINFO
@@ -2503,6 +2504,10 @@ pmap_pv_page_alloc(struct pool *pp, int 
 	struct vm_page * const pg = PMAP_ALLOC_POOLPAGE(UVM_PGA_USERESERVE);
 	if (pg == NULL)
 		return NULL;
+#ifdef UVM_PAGE_TRKOWN
+	pg-owner_tag = NULL;
+#endif
+	UVM_PAGE_OWN(pg, pp-pr_wchan, NULL);
 
 	uvm_km_pageclaim(pg);
 	return (void *)mips_pmap_map_poolpage(VM_PAGE_TO_PHYS(pg));

Index: src/sys/arch/mips/mips/pmap_segtab.c
diff -u src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.14 src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.15
--- src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.14	Mon Feb 13 18:20:26 2012
+++ src/sys/arch/mips/mips/pmap_segtab.c	Mon Feb 27 16:57:06 2012
@@ -146,14 +146,27 @@ uint32_t npage_segtab;
 #define	SEGTAB_ADD(n, v)	((void) 0)
 #endif
 
+/*
+ * Keep a list of idle page tables.
+ */
+#define PMAP_PTP_CACHE
+#ifdef PMAP_PTP_CACHE
+static struct pgflist ptp_pgflist = LIST_HEAD_INITIALIZER(ptp_pgflist);
+#endif
+
 static inline struct vm_page *
 pmap_pte_pagealloc(void)
 {
 	struct vm_page *pg;
 
 	pg = PMAP_ALLOC_POOLPAGE(UVM_PGA_ZERO|UVM_PGA_USERESERVE);
-	if (pg)
+	if (pg) {
+#ifdef UVM_PAGE_TRKOWN
+		pg-owner_tag = NULL;
+#endif
+		UVM_PAGE_OWN(pg, pmap-ptp, NULL);
 		uvm_km_pageclaim(pg);
+	}
 
 	return pg;
 }
@@ -199,28 +212,41 @@ pmap_segtab_free(union segtab *stp)
 }
 
 static void
-pmap_segtab_release(union segtab *stp, u_int level)
+pmap_segtab_release(pmap_t pmap, union segtab **stp_p, bool free_stp,
+	pte_callback_t callback, uintptr_t flags,
+	vaddr_t va, vsize_t vinc)
 {
+	union segtab *stp = *stp_p;
 
-	for (size_t i = 0; i  PMAP_SEGTABSIZE; i++) {
+	for (size_t i = 0; i  PMAP_SEGTABSIZE; i++, va += vinc) {
 #ifdef _LP64
-		if (level  0) {
+		if (vinc  NBSEG) {
 			if (stp-seg_seg[i] != NULL) {
-pmap_segtab_release(stp-seg_seg[i], level - 1);
-stp-seg_seg[i] = NULL;
+pmap_segtab_release(pmap, stp-seg_seg[i],
+true, callback, flags, va, vinc / NSEGPG);
+KASSERT(stp-seg_seg[i] == NULL);
 			}
 			continue;
 		}
 #endif
+		KASSERT(vinc == NBSEG);
 
 		/* get pointer to segment map */
 		pt_entry_t *pte = stp-seg_tab[i];
 		if (pte == NULL)
 			continue;
-#ifdef PARANOIADIAG
+
+		/*
+		 * If our caller want a callback, do so.
+		 */
+		if (callback != NULL) {
+			(*callback)(pmap, va, va + vinc, pte, flags);
+		} 
+#ifdef DEBUG
 		for (size_t j = 0; j  NPTEPG; j++) {
-			if ((pte + j)-pt_entry)
-panic(pmap_destroy: segmap not empty);
+			if (pte[j].pt_entry)
+panic(%s: pte entry %p not 0 (%#x),
+   __func__, pte[j], pte[j].pt_entry);
 		}
 #endif
 
@@ -238,12 +264,21 @@ pmap_segtab_release(union segtab *stp, u
 #endif	/* MIPS3_PLUS */
 		paddr_t pa = mips_pmap_unmap_poolpage((vaddr_t)pte);
 		struct vm_page *pg = PHYS_TO_VM_PAGE(pa);
+#ifdef PMAP_PTP_CACHE
+		mutex_spin_enter(uvm_fpageqlock);
+		LIST_INSERT_HEAD(ptp_pgflist, pg, listq.list);
+		mutex_spin_exit(uvm_fpageqlock);
+#else
 		uvm_km_pagefree(pg);
+#endif
 
 		

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 16:57:58 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: mips_param.h

Log Message:
Make sure we don't overflow a 32-bit integer.


To generate a diff of this commit:
cvs rdiff -u -r1.23.78.11 -r1.23.78.12 src/sys/arch/mips/include/mips_param.h

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/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.23.78.11 src/sys/arch/mips/include/mips_param.h:1.23.78.12
--- src/sys/arch/mips/include/mips_param.h:1.23.78.11	Tue Dec 27 16:09:36 2011
+++ src/sys/arch/mips/include/mips_param.h	Mon Feb 27 16:57:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.23.78.11 2011/12/27 16:09:36 matt Exp $	*/
+/*	mips_param.h,v 1.23.78.11 2011/12/27 16:09:36 matt Exp	*/
 
 #ifdef _KERNEL
 #include machine/cpu.h
@@ -95,8 +95,8 @@
 
 #ifdef _LP64
 #define	NSEGPG		(NBPG/8)
-#define NBXSEG		(NSEGPG*NBSEG)	/* bytes/xsegment */
-#define	XSEGOFSET	(NBSEG-1)	/* byte offset into segment */
+#define NBXSEG		((uint64_t)NSEGPG*NBSEG)	/* bytes/xsegment */
+#define	XSEGOFSET	(NBXSEG-1)	/* byte offset into xsegment */
 #define	XSEGSHIFT	(SEGSHIFT+(PGSHIFT-3))	/* LOG2(NBXSEG) */
 #endif
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 16:59:43 UTC 2012

Modified Files:
src/sys/arch/mips/conf [matt-nb5-mips64]: files.mips
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c

Log Message:
Add option NOMIPSEMUL so disable (almost) all emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.58.24.19 -r1.58.24.20 src/sys/arch/mips/conf/files.mips
cvs rdiff -u -r1.14.78.14 -r1.14.78.15 src/sys/arch/mips/mips/mips_emul.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/mips/conf/files.mips
diff -u src/sys/arch/mips/conf/files.mips:1.58.24.19 src/sys/arch/mips/conf/files.mips:1.58.24.20
--- src/sys/arch/mips/conf/files.mips:1.58.24.19	Tue Dec 27 06:55:38 2011
+++ src/sys/arch/mips/conf/files.mips	Mon Feb 27 16:59:42 2012
@@ -14,6 +14,7 @@ defflag	opt_cputype.h		NOFPU FPEMUL
 	# ENABLE_MIPS_R4700
 	# ENABLE_MIPS_R3NKK
 defparam opt_cputype.h		MIPS_PAGE_SHIFT
+defflag opt_mips_emul.h		NOMIPSEMUL
 defflag	opt_mips_cache.h	MIPS3_NO_PV_UNCACHED
 ENABLE_MIPS4_CACHE_R10K
 defflag opt_mips3_wired.h	ENABLE_MIPS3_WIRED_MAP

Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.14.78.14 src/sys/arch/mips/mips/mips_emul.c:1.14.78.15
--- src/sys/arch/mips/mips/mips_emul.c:1.14.78.14	Mon Feb 13 08:13:42 2012
+++ src/sys/arch/mips/mips/mips_emul.c	Mon Feb 27 16:59:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp $ */
+/*	mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp $);
+__KERNEL_RCSID(0, mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp);
+
+#include opt_mips_emul.h
 
 #include sys/param.h
 #include sys/systm.h
@@ -43,11 +45,14 @@ __KERNEL_RCSID(0, $NetBSD: mips_emul.c,
 #include mips/vmparam.h			/* for VM_MAX_ADDRESS */
 #include mips/trap.h
 
+#ifndef NOMIPSEMUL
 static void	send_sigsegv(intptr_t, uint32_t, struct trapframe *, uint32_t);
+#endif
 static void	send_sigill(intptr_t, uint32_t, struct trapframe *, uint32_t,
 		uint32_t);
 static void	update_pc(struct trapframe *, uint32_t);
 
+#if (MIPS1 + MIPS2)  0
 /*
  * MIPS2 LL instruction emulation state
  */
@@ -56,6 +61,7 @@ struct {
 	vaddr_t addr;
 	uint32_t value;
 } llstate;
+#endif
 
 /*
  * Analyse 'next' PC address taking account of branch/jump instructions
@@ -206,18 +212,24 @@ mips_emul_inst(uint32_t status, uint32_t
 		inst = ufetch_uint32((uint32_t *)opc);
 
 	switch (((InstFmt)inst).FRType.op) {
+#ifndef NOMIPSEMUL
+#if (MIPS1 + MIPS2)  0
 	case OP_LWC0:
 		mips_emul_lwc0(inst, tf, cause);
 		break;
 	case OP_SWC0:
 		mips_emul_swc0(inst, tf, cause);
 		break;
+#endif
 	case OP_SPECIAL:
 		mips_emul_special(inst, tf, cause);
 		break;
+#endif
+#if (MIPS1 + MIPS2 + MIPS3 + MIPS32 + MIPS64 + MIPS64_RMIXL)  0
 	case OP_SPECIAL3:
 		mips_emul_special3(inst, tf, cause);
 		break;
+#endif
 	case OP_COP1:
 #if defined(FPEMUL)
 		mips_emul_fp(inst, tf, cause);
@@ -251,6 +263,7 @@ mips_emul_inst(uint32_t status, uint32_t
 	}
 }
 
+#ifndef NOMIPSEMUL
 static void
 send_sigsegv(intptr_t vaddr, uint32_t exccode, struct trapframe *tf,
 uint32_t cause)
@@ -266,6 +279,7 @@ send_sigsegv(intptr_t vaddr, uint32_t ex
 	ksi.ksi_addr = (void *)vaddr;
 	cpu_trapsignal(curlwp, ksi, tf);
 }
+#endif /* NOMIPSEMUL */
 
 static void
 send_sigill(intptr_t vaddr, uint32_t exccode, struct trapframe *tf,
@@ -295,6 +309,7 @@ update_pc(struct trapframe *tf, uint32_t
 		tf-tf_regs[_R_PC] += 4;
 }
 
+#if !defined(NOMIPSEMUL)  (MIPS1 + MIPS2)  0
 /*
  * MIPS2 LL instruction
  */
@@ -381,7 +396,9 @@ mips_emul_swc0(uint32_t inst, struct tra
 	*t = 0;
 	update_pc(tf, cause);
 }
+#endif /* !defined(NOMIPSEMUL)  (MIPS1 + MIPS2)  0 */
 
+#ifndef NOMIPSEMUL
 void
 mips_emul_special(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
@@ -399,6 +416,9 @@ mips_emul_special(uint32_t inst, struct 
 	update_pc(tf, cause);
 }
 
+#endif /* NOMIPSEMUL */
+
+#if (MIPS1 + MIPS2 + MIPS3 + MIPS32 + MIPS64 + MIPS64_RMIXL)  0
 void
 mips_emul_special3(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
@@ -419,6 +439,7 @@ mips_emul_special3(uint32_t inst, struct
 
 	update_pc(tf, cause);
 }
+#endif
 
 #if defined(FPEMUL)
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 17:00:28 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: db_interface.c

Log Message:
Make sure to properly cast pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.64.16.24 -r1.64.16.25 src/sys/arch/mips/mips/db_interface.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/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.64.16.24 src/sys/arch/mips/mips/db_interface.c:1.64.16.25
--- src/sys/arch/mips/mips/db_interface.c:1.64.16.24	Thu Feb 16 10:45:17 2012
+++ src/sys/arch/mips/mips/db_interface.c	Mon Feb 27 17:00:28 2012
@@ -202,7 +202,7 @@ db_write_bytes(vaddr_t addr, size_t size
 		*p++ = *data++;
 
 	wbflush();
-	mips_icache_sync_range(addr, size);
+	mips_icache_sync_range((intptr_t)addr, size);
 }
 
 #ifndef KGDB



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 17:04:40 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c genassym.cf
mipsX_subr.S syscall.c trap.c

Log Message:
Count all traps types.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.43 -r1.90.16.44 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.44.12.31 -r1.44.12.32 src/sys/arch/mips/mips/genassym.cf
cvs rdiff -u -r1.26.36.1.2.55 -r1.26.36.1.2.56 \
src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.37.12.15 -r1.37.12.16 src/sys/arch/mips/mips/syscall.c
cvs rdiff -u -r1.217.12.42 -r1.217.12.43 src/sys/arch/mips/mips/trap.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.43 src/sys/arch/mips/include/cpu.h:1.90.16.44
--- src/sys/arch/mips/include/cpu.h:1.90.16.43	Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/include/cpu.h	Mon Feb 27 17:04:39 2012
@@ -107,9 +107,12 @@ struct cpu_info {
 	volatile u_int ci_softints;
 	struct evcnt ci_ev_fpu_loads;	/* fpu load counter */
 	struct evcnt ci_ev_fpu_saves;	/* fpu save counter */
-	struct evcnt ci_ev_kern_tlbmisses;
-	struct evcnt ci_ev_user_tlbmisses;
+	struct evcnt ci_ev_traps[2][32];
+	struct evcnt ci_ev_kern_tlb_misses;
+	struct evcnt ci_ev_user_tlb_misses;
 	struct evcnt ci_ev_tlblocked;
+	char ci_ev_kern_trap_group[12];
+	char ci_ev_user_trap_group[12];
 
 	/*
 	 * Per-cpu pmap information

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.1.2.24 src/sys/arch/mips/mips/cpu_subr.c:1.1.2.25
--- src/sys/arch/mips/mips/cpu_subr.c:1.1.2.24	Thu Feb 16 10:47:06 2012
+++ src/sys/arch/mips/mips/cpu_subr.c	Mon Feb 27 17:04:39 2012
@@ -138,18 +138,15 @@ cpu_info_alloc(struct pmap_tlb_info *ti,
 	 * it and its locks.
 	 */
 	if (ti == NULL) {
-		const size_t ti_size = roundup2(sizeof(*ti), COHERENCY_UNIT)
-		+ 2*COHERENCY_UNIT;
+		const size_t ti_size = roundup2(sizeof(*ti), COHERENCY_UNIT);
 		if (cpu_info_offset = ti_size) {
-			ti = (void *) (va + cpu_info_offset - ti_size);
+			ti = (void *) (va + cpu_info_offset);
 		} else {
 			KASSERT(PAGE_SIZE - cpu_info_offset + sizeof(*ci) = ti_size);
 			ti = (struct pmap_tlb_info *)(va + PAGE_SIZE - ti_size);
 		}
-		ti-ti_lock = (kmutex_t *)
-		roundup2((intptr_t)ti + sizeof(*ti), COHERENCY_UNIT);
-		ti-ti_hwlock = (kmutex_t *)
-		((intptr_t)ti-ti_lock + COHERENCY_UNIT);
+		ti-ti_lock = (kmutex_t *)((intptr_t)ti - COHERENCY_UNIT);
+		ti-ti_hwlock = (kmutex_t *)((intptr_t)ti - 2*COHERENCY_UNIT);
 		pmap_tlb_info_init(ti);
 	}
 
@@ -225,6 +222,41 @@ cpu_hwrena_setup(void)
 #endif
 }
 
+static const char * const ev_trap_names[32] = {
+	interrupts,
+	TLB modifications,
+	load TLB invalid,
+	store TLB invalid,
+	load address errors,
+	store address errors,
+	I-fetch bus errors,
+	load/store bus errors,
+	system calls,
+	breakpoints,
+	reserved instructions,
+	unusable coprocessors,
+	arithmetic overflows,
+	trap exceptions,
+	VCI exceptions,
+	FP exceptions,
+	reserved 16,
+	reserved 17,
+	COP2 exceptions,
+	TLB RI exceptions,
+	TLB XI exceptions,
+	reserved 21,
+	MDMX exceptions,
+	watch exceptions,
+	machine checks,
+	thread activations,
+	DSP exceptions,
+	reserved 27,
+	reserved 28,
+	reserved 29,
+	cache errors,
+	VCD exceptions,
+};
+
 void
 cpu_attach_common(device_t self, struct cpu_info *ci)
 {
@@ -249,12 +281,24 @@ cpu_attach_common(device_t self, struct 
 	evcnt_attach_dynamic(ci-ci_ev_fpu_saves,
 		EVCNT_TYPE_MISC, NULL, xname,
 		fpu saves);
-	evcnt_attach_dynamic(ci-ci_ev_user_tlbmisses,
-		EVCNT_TYPE_TRAP, NULL, xname,
-		user tlb misses);
-	evcnt_attach_dynamic(ci-ci_ev_kern_tlbmisses,
-		EVCNT_TYPE_TRAP, NULL, xname,
-		kern tlb misses);
+	snprintf(ci-ci_ev_kern_trap_group, sizeof(ci-ci_ev_kern_trap_group),
+	%s kern, xname);
+	snprintf(ci-ci_ev_user_trap_group, sizeof(ci-ci_ev_user_trap_group),
+	%s user, xname);
+	evcnt_attach_dynamic(ci-ci_ev_kern_tlb_misses,
+		EVCNT_TYPE_TRAP, NULL, ci-ci_ev_kern_trap_group,
+		TLB misses);
+	evcnt_attach_dynamic(ci-ci_ev_user_tlb_misses,
+		EVCNT_TYPE_TRAP, NULL, ci-ci_ev_user_trap_group,
+		TLB misses);
+	for (u_int i = 0; i  32; i++) {
+		evcnt_attach_dynamic(ci-ci_ev_traps[0][i],
+			EVCNT_TYPE_TRAP, NULL, ci-ci_ev_kern_trap_group,
+			ev_trap_names[i]);
+		evcnt_attach_dynamic(ci-ci_ev_traps[1][i],
+			EVCNT_TYPE_TRAP, NULL, ci-ci_ev_user_trap_group,
+			ev_trap_names[i]);
+	}
 	evcnt_attach_dynamic(ci-ci_ev_tlblocked,
 		EVCNT_TYPE_MISC, NULL, xname,
 		tlb locked);

Index: src/sys/arch/mips/mips/genassym.cf
diff -u src/sys/arch/mips/mips/genassym.cf:1.44.12.31 src/sys/arch/mips/mips/genassym.cf:1.44.12.32
--- src/sys/arch/mips/mips/genassym.cf:1.44.12.31	Fri Dec 23 22:48:07 2011
+++ 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 17:03:37 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_cpuvar.h rmixl_intr.c

Log Message:
Add a test for recursive IPIs.
use __builtin_clzll


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/rmi/rmixl_cpuvar.h
cvs rdiff -u -r1.1.2.35 -r1.1.2.36 src/sys/arch/mips/rmi/rmixl_intr.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/mips/rmi/rmixl_cpuvar.h
diff -u src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.5 src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.6
--- src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.5	Thu Jan 19 08:05:24 2012
+++ src/sys/arch/mips/rmi/rmixl_cpuvar.h	Mon Feb 27 17:03:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpuvar.h,v 1.1.2.5 2012/01/19 08:05:24 matt Exp $	*/
+/*	rmixl_cpuvar.h,v 1.1.2.5 2012/01/19 08:05:24 matt Exp	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -49,6 +49,7 @@ struct cpu_softc {
 	struct evcnt sc_irt_evcnts[160];
 	struct evcnt sc_fmn_stid_evcnts[RMIXL_FMN_NSTID];
 	struct evcnt sc_fmn_cpu_evcnts[8];
+	bool sc_in_ipi;
 };
 
 #endif	/* _ARCH_MIPS_RMI_RMIXL_CPUVAR_H_ */

Index: src/sys/arch/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.35 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.36
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.35	Thu Jan 19 08:05:24 2012
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Mon Feb 27 17:03:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.35 2012/01/19 08:05:24 matt Exp $	*/
+/*	rmixl_intr.c,v 1.1.2.35 2012/01/19 08:05:24 matt Exp	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.35 2012/01/19 08:05:24 matt Exp $);
+__KERNEL_RCSID(0, rmixl_intr.c,v 1.1.2.35 2012/01/19 08:05:24 matt Exp);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -761,16 +761,6 @@ void rmixl_ipl_eimr_map_print(void);
 #endif
 
 
-static inline u_int
-dclz(uint64_t val)
-{
-	u_int nlz;
-
-	__asm volatile(dclz %0, %1 : =r(nlz) : r(val));
-	
-	return nlz;
-}
-
 void
 evbmips_intr_init(void)
 {
@@ -1412,7 +1402,7 @@ evbmips_iointr(int ipl, vaddr_t pc, uint
 		if (eirr == 0)
 			break;
 
-		vec = 63 - dclz(eirr);
+		vec = 63 - __builtin_clzll(eirr);
 		rmixl_intrvec_t * const iv = rmixl_intrvec[vec];
 		vecbit = 1ULL  vec;
 		KASSERT (iv-iv_ipl == ipl);
@@ -1495,11 +1485,14 @@ rmixl_ipi_intr(void *arg)
 
 	KASSERT(ci-ci_cpl = IPL_SCHED);
 	KASSERT((uintptr_t)arg  NIPIS);
+	KASSERT(!ci-ci_softc-sc_in_ipi);
 
 	/* if the request is clear, it was previously processed */
 	if ((ci-ci_request_ipis  ipi_mask) == 0)
 		return 0;
 
+	ci-ci_softc-sc_in_ipi = true;
+
 	atomic_or_64(ci-ci_active_ipis, ipi_mask);
 	atomic_and_64(ci-ci_request_ipis, ~ipi_mask);
 
@@ -1507,6 +1500,7 @@ rmixl_ipi_intr(void *arg)
 
 	atomic_and_64(ci-ci_active_ipis, ~ipi_mask);
 
+	ci-ci_softc-sc_in_ipi = false;
 	return 1;
 }
 #endif	/* MULTIPROCESSOR */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 16:57:06 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_segtab.c

Log Message:
Add a page-table-page cache to keep reuse just released page table tables.
Actually remove the addresses in pmap_remove_all.


To generate a diff of this commit:
cvs rdiff -u -r1.54.26.24 -r1.54.26.25 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.179.16.43 -r1.179.16.44 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/arch/mips/mips/pmap_segtab.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 16:57:58 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: mips_param.h

Log Message:
Make sure we don't overflow a 32-bit integer.


To generate a diff of this commit:
cvs rdiff -u -r1.23.78.11 -r1.23.78.12 src/sys/arch/mips/include/mips_param.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 16:59:43 UTC 2012

Modified Files:
src/sys/arch/mips/conf [matt-nb5-mips64]: files.mips
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c

Log Message:
Add option NOMIPSEMUL so disable (almost) all emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.58.24.19 -r1.58.24.20 src/sys/arch/mips/conf/files.mips
cvs rdiff -u -r1.14.78.14 -r1.14.78.15 src/sys/arch/mips/mips/mips_emul.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 17:00:28 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: db_interface.c

Log Message:
Make sure to properly cast pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.64.16.24 -r1.64.16.25 src/sys/arch/mips/mips/db_interface.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 17:03:37 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_cpuvar.h rmixl_intr.c

Log Message:
Add a test for recursive IPIs.
use __builtin_clzll


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/rmi/rmixl_cpuvar.h
cvs rdiff -u -r1.1.2.35 -r1.1.2.36 src/sys/arch/mips/rmi/rmixl_intr.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 27 17:04:40 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c genassym.cf
mipsX_subr.S syscall.c trap.c

Log Message:
Count all traps types.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.43 -r1.90.16.44 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.44.12.31 -r1.44.12.32 src/sys/arch/mips/mips/genassym.cf
cvs rdiff -u -r1.26.36.1.2.55 -r1.26.36.1.2.56 \
src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.37.12.15 -r1.37.12.16 src/sys/arch/mips/mips/syscall.c
cvs rdiff -u -r1.217.12.42 -r1.217.12.43 src/sys/arch/mips/mips/trap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:44:30 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cache_r4k_subr.S

Log Message:
PTR_DSRL - PTR_DSLL typo


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/mips/cache_r4k_subr.S

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/mips/mips/cache_r4k_subr.S
diff -u src/sys/arch/mips/mips/cache_r4k_subr.S:1.1.2.2 src/sys/arch/mips/mips/cache_r4k_subr.S:1.1.2.3
--- src/sys/arch/mips/mips/cache_r4k_subr.S:1.1.2.2	Thu Jan 19 08:28:49 2012
+++ src/sys/arch/mips/mips/cache_r4k_subr.S	Thu Feb 16 10:44:30 2012
@@ -37,7 +37,7 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: cache_r4k_subr.S,v 1.1.2.2 2012/01/19 08:28:49 matt Exp $)
+RCSID($NetBSD: cache_r4k_subr.S,v 1.1.2.3 2012/02/16 10:44:30 matt Exp $)
 
 #include mips/cache_r4k.h
 
@@ -103,7 +103,7 @@ STATIC_LEAF_NOPROFILE(OPNAME(doop))
 	beqz	t0, 3f# no more to do?
 	 move	ra, ta0# restore return address
 2:
-	PTR_SRL	t0, INT_SCALESHIFT		# shift to instruction index
+	PTR_SLL	t0, INT_SCALESHIFT		# shift to instruction index
 	PTR_ADDU t9, 32  INT_SCALESHIFT	# point to end of table
 	PTR_SUBU t9, t0# backup N cacheops
 	jr	t9# and do them.



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:45:17 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: db_machdep.h
src/sys/arch/mips/mips [matt-nb5-mips64]: db_disasm.c db_interface.c
db_trace.c

Log Message:
Change db_expr_t to an register_t so we can see the full register contents
on N32 kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.22.62.4 -r1.22.62.5 src/sys/arch/mips/include/db_machdep.h
cvs rdiff -u -r1.19.62.3 -r1.19.62.4 src/sys/arch/mips/mips/db_disasm.c
cvs rdiff -u -r1.64.16.23 -r1.64.16.24 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.35.38.5 -r1.35.38.6 src/sys/arch/mips/mips/db_trace.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/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.22.62.4 src/sys/arch/mips/include/db_machdep.h:1.22.62.5
--- src/sys/arch/mips/include/db_machdep.h:1.22.62.4	Fri Apr 29 08:26:21 2011
+++ src/sys/arch/mips/include/db_machdep.h	Thu Feb 16 10:45:16 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.22.62.4 2011/04/29 08:26:21 matt Exp $ */
+/* db_machdep.h,v 1.22.62.4 2011/04/29 08:26:21 matt Exp */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -42,7 +42,7 @@
 
 
 typedef	vaddr_t		db_addr_t;	/* address - unsigned */
-typedef	long		db_expr_t;	/* expression - signed */
+typedef	register_t	db_expr_t;	/* expression - signed */
 
 typedef struct reg db_regs_t;
 

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.19.62.3 src/sys/arch/mips/mips/db_disasm.c:1.19.62.4
--- src/sys/arch/mips/mips/db_disasm.c:1.19.62.3	Fri Apr 29 08:26:24 2011
+++ src/sys/arch/mips/mips/db_disasm.c	Thu Feb 16 10:45:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.19.62.3 2011/04/29 08:26:24 matt Exp $	*/
+/*	db_disasm.c,v 1.19.62.3 2011/04/29 08:26:24 matt Exp	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.19.62.3 2011/04/29 08:26:24 matt Exp $);
+__KERNEL_RCSID(0, db_disasm.c,v 1.19.62.3 2011/04/29 08:26:24 matt Exp);
 
 #include sys/types.h
 #include sys/systm.h
@@ -157,7 +157,7 @@ static void print_addr(db_addr_t);
 db_addr_t
 db_disasm(db_addr_t loc, bool altfmt)
 {
-	u_int32_t instr;
+	uint32_t instr;
 
 	/*
 	 * Take some care with addresses to not UTLB here as it
@@ -172,7 +172,7 @@ db_disasm(db_addr_t loc, bool altfmt)
 		}
 	}
 	else {
-		instr =  *(u_int32_t *)loc;
+		instr =  *(uint32_t *)(intptr_t)loc;
 	}
 
 	return (db_disasm_insn(instr, loc, altfmt));
@@ -596,7 +596,7 @@ print_addr(db_addr_t loc)
 		if (diff == 0)
 			db_printf(%s, symname);
 		else
-			db_printf(%s+%lx, symname, diff);
+			db_printf(%s+%#PRIxREGISTER, symname, diff);
 		db_printf(\t[addr:%#PRIxVADDR], loc);
 	} else {
 		db_printf(%#PRIxVADDR, loc);

Index: src/sys/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.64.16.23 src/sys/arch/mips/mips/db_interface.c:1.64.16.24
--- src/sys/arch/mips/mips/db_interface.c:1.64.16.23	Thu May 26 19:21:56 2011
+++ src/sys/arch/mips/mips/db_interface.c	Thu Feb 16 10:45:17 2012
@@ -266,7 +266,7 @@ db_kvtophys_cmd(db_expr_t addr, bool hav
 		 * Cast the physical address -- some platforms, while
 		 * being ILP32, may be using 64-bit paddr_t's.
 		 */
-		db_printf(0x%lx - 0x% PRIx64 \n, addr,
+		db_printf(%#PRIxPTR - 0x% PRIx64 \n, (intptr_t) addr,
 		(uint64_t) kvtophys(addr));
 	} else
 		printf(not a kernel virtual address\n);
@@ -672,7 +672,7 @@ db_mfcr_cmd(db_expr_t addr, bool have_ad
 		.set pop 			\n\t			\
 	: =r(value) : r(addr));
 	
-	db_printf(control reg 0x%lx = 0x% PRIx64 \n, addr, value);
+	db_printf(control reg %#PRIx64 = %# PRIx64 \n, addr, value);
 }
 
 void
@@ -702,7 +702,7 @@ db_mtcr_cmd(db_expr_t addr, bool have_ad
 		.set pop 			\n\t			\
 	:: r(value), r(addr));
 
-	db_printf(control reg 0x%lx = 0x%lx\n, addr, value);
+	db_printf(control reg %#PRIx64 = %#PRIx64\n, addr, value);
 }
 #endif /* (MIPS64_RMIXL + MIPS64R2_RMIXL)  0 */
 

Index: src/sys/arch/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.35.38.5 src/sys/arch/mips/mips/db_trace.c:1.35.38.6
--- src/sys/arch/mips/mips/db_trace.c:1.35.38.5	Fri Apr 29 08:26:25 2011
+++ src/sys/arch/mips/mips/db_trace.c	Thu Feb 16 10:45:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.35.38.5 2011/04/29 08:26:25 matt Exp $	*/
+/*	db_trace.c,v 1.35.38.5 2011/04/29 08:26:25 matt Exp	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.35.38.5 2011/04/29 08:26:25 matt Exp $);
+__KERNEL_RCSID(0, db_trace.c,v 1.35.38.5 2011/04/29 08:26:25 matt Exp);
 
 #include opt_ddb.h
 
@@ -169,7 +169,7 @@ db_stack_trace_print(db_expr_t addr, boo
 	}
 
 	if (lwpaddr) {
-		l = (struct lwp *)addr;
+		l = (struct lwp 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:47:07 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c

Log Message:
When booting a N32 MP kernel, make sure to setup the ksegx mapping.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.1.2.23 src/sys/arch/mips/mips/cpu_subr.c:1.1.2.24
--- src/sys/arch/mips/mips/cpu_subr.c:1.1.2.23	Thu Jan 19 08:28:49 2012
+++ src/sys/arch/mips/mips/cpu_subr.c	Thu Feb 16 10:47:06 2012
@@ -141,7 +141,7 @@ cpu_info_alloc(struct pmap_tlb_info *ti,
 		const size_t ti_size = roundup2(sizeof(*ti), COHERENCY_UNIT)
 		+ 2*COHERENCY_UNIT;
 		if (cpu_info_offset = ti_size) {
-			ti = (void *) va;
+			ti = (void *) (va + cpu_info_offset - ti_size);
 		} else {
 			KASSERT(PAGE_SIZE - cpu_info_offset + sizeof(*ci) = ti_size);
 			ti = (struct pmap_tlb_info *)(va + PAGE_SIZE - ti_size);
@@ -930,6 +930,10 @@ cpu_hatch(struct cpu_info *ci)
 	tlb_invalidate_all();
 	mips3_cp0_wired_write(ti-ti_wired);
 
+#ifdef ENABLE_MIPS_KSEGX
+	pmap_ksegx_bootstrap();
+#endif
+
 	/*
 	 * Setup HWRENA and USERLOCAL COP0 registers (MIPSxxR2).
 	 */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:48:39 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_machdep.c

Log Message:
Add mips_ksegx_tlb_slot.
When casting pointers, use intptr_t so we get proper sign extension.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/mips/rmi/rmixl_machdep.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/mips/rmi/rmixl_machdep.c
diff -u src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.3 src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.4
--- src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.3	Thu Feb  2 00:21:00 2012
+++ src/sys/arch/mips/rmi/rmixl_machdep.c	Thu Feb 16 10:48:39 2012
@@ -204,6 +204,7 @@ struct rmixl_config rmixl_configuration 
 #ifdef ENABLE_MIPS_KSEGX
 pt_entry_t mips_ksegx_pte;
 paddr_t mips_ksegx_start;
+int mips_ksegx_tlb_slot = -1;
 #endif
 
 /*
@@ -847,7 +848,7 @@ rmixl_fixup_curcpu(void)
 			 * just change the instruction bits around it.
 			 */
 			*insnp = insn ^ LOAD_CURCPU ^ MFC0_CURCPU;
-			mips_icache_sync_range((vaddr_t)insnp, 4);
+			mips_icache_sync_range((intptr_t)insnp, 4);
 		}
 	}
 }



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:51:33 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_fixup.c

Log Message:
Use (intptr_t) when casting pointers to get proper sign extension.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/mips/mips_fixup.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/mips/mips/mips_fixup.c
diff -u src/sys/arch/mips/mips/mips_fixup.c:1.1.2.13 src/sys/arch/mips/mips/mips_fixup.c:1.1.2.14
--- src/sys/arch/mips/mips/mips_fixup.c:1.1.2.13	Thu Feb  9 20:01:21 2012
+++ src/sys/arch/mips/mips/mips_fixup.c	Thu Feb 16 10:51:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fixup.c,v 1.1.2.13 2012/02/09 20:01:21 matt Exp $	*/
+/*	mips_fixup.c,v 1.1.2.13 2012/02/09 20:01:21 matt Exp	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mips_fixup.c,v 1.1.2.13 2012/02/09 20:01:21 matt Exp $);
+__KERNEL_RCSID(0, mips_fixup.c,v 1.1.2.13 2012/02/09 20:01:21 matt Exp);
 
 #include opt_mips3_wired.h
 #include opt_multiprocessor.h
@@ -138,9 +138,9 @@ mips_fixup_exceptions(mips_fixup_callbac
 	}
 
 	if (fixed)
-		mips_icache_sync_range((vaddr_t)start,
+		mips_icache_sync_range((intptr_t)start,
 		   sizeof(start[0]) * (end - start));
-		
+
 	return fixed;
 }
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:52:13 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: vmparam.h

Log Message:
Add extern int mips_ksegx_tlb_slot;


To generate a diff of this commit:
cvs rdiff -u -r1.41.28.26 -r1.41.28.27 src/sys/arch/mips/include/vmparam.h

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/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.41.28.26 src/sys/arch/mips/include/vmparam.h:1.41.28.27
--- src/sys/arch/mips/include/vmparam.h:1.41.28.26	Thu Feb  9 03:14:45 2012
+++ src/sys/arch/mips/include/vmparam.h	Thu Feb 16 10:52:13 2012
@@ -217,6 +217,7 @@
 extern int mips_poolpage_vmfreelist;
 #ifdef ENABLE_MIPS_KSEGX
 extern paddr_t mips_ksegx_start;
+extern int mips_ksegx_tlb_slot;
 #endif
 #endif
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 18:57:16 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmnvar.h

Log Message:
enable_cp2 needs a early clobber


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixl_fmnvar.h

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/mips/rmi/rmixl_fmnvar.h
diff -u src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.8 src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.9
--- src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.8	Thu Jan 19 10:29:34 2012
+++ src/sys/arch/mips/rmi/rmixl_fmnvar.h	Thu Feb 16 18:57:15 2012
@@ -239,7 +239,7 @@ rmixl_cp2_enable(void)
 		or	%[sr],%[mask]		\n\t
 		mtc0	%[sr],$%[c0_status]	\n\t
 		.set pop			\n\t
-	:	[rv] =r (rv),
+	:	[rv] =r (rv),
 		[sr] =r (sr)
 	:	[c0_status] n (MIPS_COP_0_STATUS),
 		[mask] r (MIPS_SR_COP_2_BIT));



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 18:58:01 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]:
bus_space_alignstride_chipdep.c

Log Message:
Allow KSEG1 even on _LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.10.18.15 -r1.10.18.16 \
src/sys/arch/mips/mips/bus_space_alignstride_chipdep.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/mips/mips/bus_space_alignstride_chipdep.c
diff -u src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c:1.10.18.15 src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c:1.10.18.16
--- src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c:1.10.18.15	Thu Jan 19 08:28:49 2012
+++ src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c	Thu Feb 16 18:58:01 2012
@@ -896,8 +896,10 @@ __BS(unmap)(void *v, bus_space_handle_t 
 #if !defined(_LP64) || defined(CHIP_EXTENT)
 	bus_addr_t addr = 0;	/* initialize to appease gcc */
 #endif
+#if defined(CHIP_EXTENT) || !defined(_LP64)
+	bool handle_is_km = false;
+#endif
 #ifndef _LP64
-	bool handle_is_km;
 
 	/* determine if h is addr obtained from uvm_km_alloc */
 	handle_is_km = !(MIPS_KSEG0_P(h) || MIPS_KSEG1_P(h));
@@ -936,15 +938,11 @@ __BS(unmap)(void *v, bus_space_handle_t 
 	if (acct == 0)
 		return;
 
-#ifdef EXTENT_DEBUG
+#if defined(EXTENT_DEBUG) || 1
 	printf(%s: freeing handle %#PRIxBSH for %#PRIxBUSSIZE\n,
 		__S(__BS(unmap)), h, size);
 #endif
 
-#ifdef _LP64
-	KASSERT(MIPS_XKPHYS_P(h));
-	addr = MIPS_XKPHYS_TO_PHYS(h);
-#else
 	if (handle_is_km == false) {
 		if (MIPS_KSEG0_P(h)) {
 			addr = MIPS_KSEG0_TO_PHYS(h);
@@ -952,11 +950,12 @@ __BS(unmap)(void *v, bus_space_handle_t 
 		} else if (MIPS_XKPHYS_P(h)) {
 			addr = MIPS_XKPHYS_TO_PHYS(h);
 #endif
-		} else {
+		} else if (MIPS_KSEG1_P(h)) {
 			addr = MIPS_KSEG1_TO_PHYS(h);
+		} else {
+			panic(%s: unknown handle %#PRIxBSH, __func__, h);
 		}
 	}
-#endif
 
 #ifdef CHIP_W1_BUS_START
 	if (addr = CHIP_W1_SYS_START(v)  addr = CHIP_W1_SYS_END(v)) {



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 18:58:58 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c vm_machdep.c

Log Message:
mips_nfreelist is the one past the highest freelist used.


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.66 -r1.205.4.1.2.1.2.67 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.121.6.1.2.28 -r1.121.6.1.2.29 \
src/sys/arch/mips/mips/vm_machdep.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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.66 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.67
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.66	Tue Feb 14 01:51:11 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Thu Feb 16 18:58:57 2012
@@ -2392,7 +2392,7 @@ mips_page_physload(vaddr_t vkernstart, v
 	/*
 	 * Now to get the number of freelists in use.
 	 */
-	mips_nfreelist = popcount32(mips_freelist_mask);
+	mips_nfreelist = 32 - __builtin_clz(mips_freelist_mask);
 }
 
 /* 

Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.28 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.29
--- src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.28	Tue Feb 14 01:51:12 2012
+++ src/sys/arch/mips/mips/vm_machdep.c	Thu Feb 16 18:58:57 2012
@@ -102,7 +102,7 @@ mips_page_to_pggroup(struct vm_page *pg,
 		lcv = VM_FREELIST_DEFAULT;
 	}
 	KDASSERT(lcv == uvm_page_lookup_freelist(pg));
-	KASSERT(lcv  mips_nfreelist);
+	KASSERT((1  lcv)  mips_freelist_mask);
 	return lcv * ncolors + color;
 #endif
 }



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 23:02:22 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pmap.h
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_tlb.c

Log Message:
Move the ksegx tlb init code into its own function.
Fix a problem with concurrent shootdowns by tracking what cpus want a
shootdown for a pmap, and if anoter cpu wants a shootdown, perform the
shootdown on ourselves.


To generate a diff of this commit:
cvs rdiff -u -r1.54.26.23 -r1.54.26.24 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.179.16.42 -r1.179.16.43 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/sys/arch/mips/mips/pmap_tlb.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/mips/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.54.26.23 src/sys/arch/mips/include/pmap.h:1.54.26.24
--- src/sys/arch/mips/include/pmap.h:1.54.26.23	Thu Jan 19 08:28:48 2012
+++ src/sys/arch/mips/include/pmap.h	Thu Feb 16 23:02:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.54.26.23 2012/01/19 08:28:48 matt Exp $	*/
+/*	pmap.h,v 1.54.26.23 2012/01/19 08:28:48 matt Exp	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -180,7 +180,7 @@ typedef struct pmap {
 #ifdef MULTIPROCESSOR
 	volatile uint32_t	pm_active;	/* pmap was active on ... */
 	volatile uint32_t	pm_onproc;	/* pmap is active on ... */
-	volatile u_int		pm_shootdown_pending;
+	volatile uint32_t	pm_shootdown_pending;
 #endif
 	union segtab		*pm_segtab;	/* pointers to pages of PTEs */
 	u_int			pm_count;	/* pmap reference count */
@@ -254,6 +254,7 @@ extern vaddr_t mips_virtual_end;
  *	Bootstrap the system enough to run with virtual memory.
  */
 void	pmap_bootstrap(void);
+void	pmap_ksegx_bootstrap(void);
 
 void	pmap_remove_all(pmap_t);
 void	pmap_set_modified(paddr_t);
@@ -262,7 +263,7 @@ void	pmap_procwr(struct proc *, vaddr_t,
 
 #ifdef MULTIPROCESSOR
 void	pmap_tlb_shootdown_process(void);
-bool	pmap_tlb_shootdown_bystanders(pmap_t pmap);
+bool	pmap_tlb_shootdown_bystanders(pmap_t pmap, uint32_t);
 void	pmap_tlb_info_attach(struct pmap_tlb_info *, struct cpu_info *);
 #endif
 void	pmap_syncicache_page(struct vm_page *, uint32_t);

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.42 src/sys/arch/mips/mips/pmap.c:1.179.16.43
--- src/sys/arch/mips/mips/pmap.c:1.179.16.42	Tue Feb 14 01:51:11 2012
+++ src/sys/arch/mips/mips/pmap.c	Thu Feb 16 23:02:22 2012
@@ -443,6 +443,37 @@ pmap_unmap_ephemeral_page(struct vm_page
 #endif
 }
 
+#ifdef ENABLE_MIPS_KSEGX
+void
+pmap_ksegx_bootstrap(void)
+{
+	const vaddr_t kva_inc = 1  ((VM_KSEGX_SHIFT - 1)  ~1);
+	const uint32_t tlb_mask = (2 * kva_inc - 1)  0x1c00;
+
+	if (mips_ksegx_tlb_slot  0) {
+		mips_ksegx_tlb_slot = pmap_tlb0_info.ti_wired;
+		pmap_tlb0_info.ti_wired += VM_KSEGX_SIZE / (2 * kva_inc);
+		mips3_cp0_wired_write(pmap_tlb0_info.ti_wired);
+	}
+
+	u_int tlb_slot = mips_ksegx_tlb_slot;
+	for (vaddr_t kva = 0;
+	 kva  VM_KSEGX_SIZE;
+	 kva += 2 * kva_inc, tlb_slot++) {
+		extern pt_entry_t mips_ksegx_pte;
+		struct tlbmask tlb = {
+		.tlb_hi = VM_KSEGX_ADDRESS + kva,
+		.tlb_lo0 = mips_ksegx_pte.pt_entry
+			+ mips_paddr_to_tlbpfn(kva),
+		.tlb_lo1 = mips_ksegx_pte.pt_entry
+			+ mips_paddr_to_tlbpfn(kva + kva_inc),
+		.tlb_mask = tlb_mask,
+		};
+		tlb_write_indexed(tlb_slot, tlb);
+	}
+}
+#endif
+
 /*
  *	Bootstrap the system enough to run with virtual memory.
  *	firstaddr is the first unused kseg0 address (not page aligned).
@@ -460,22 +491,7 @@ pmap_bootstrap(void)
 	pmap_tlb_info_init(pmap_tlb0_info);		/* init the lock */
 
 #ifdef ENABLE_MIPS_KSEGX
-	const vaddr_t kva_inc = 1  ((VM_KSEGX_SHIFT - 1)  ~1);
-	const uint32_t tlb_mask = (2 * kva_inc - 1)  0x1c00;
-	for (vaddr_t kva = 0; kva  VM_KSEGX_SIZE; kva += 2 * kva_inc) {
-		extern pt_entry_t mips_ksegx_pte;
-		struct tlbmask tlb = {
-		.tlb_hi = VM_KSEGX_ADDRESS + kva,
-		.tlb_lo0 = mips_ksegx_pte.pt_entry
-			+ mips_paddr_to_tlbpfn(kva),
-		.tlb_lo1 = mips_ksegx_pte.pt_entry
-			+ mips_paddr_to_tlbpfn(kva + kva_inc),
-		.tlb_mask = tlb_mask,
-		};
-		tlb_write_indexed(pmap_tlb0_info.ti_wired, tlb);
-		pmap_tlb0_info.ti_wired++;
-	}
-	mips3_cp0_wired_write(pmap_tlb0_info.ti_wired);
+	pmap_ksegx_bootstrap();
 #endif
 
 	/*
@@ -918,7 +934,7 @@ pmap_update(struct pmap *pm)
 	kpreempt_disable();
 #ifdef MULTIPROCESSOR
 	u_int pending = atomic_swap_uint(pm-pm_shootdown_pending, 0);
-	if (pending  pmap_tlb_shootdown_bystanders(pm))
+	if (pending  pmap_tlb_shootdown_bystanders(pm, pending))
 		PMAP_COUNT(shootdown_ipis);
 #endif
 	/*

Index: src/sys/arch/mips/mips/pmap_tlb.c
diff -u src/sys/arch/mips/mips/pmap_tlb.c:1.1.2.22 src/sys/arch/mips/mips/pmap_tlb.c:1.1.2.23
--- src/sys/arch/mips/mips/pmap_tlb.c:1.1.2.22	Thu Jan 19 08:28:50 2012
+++ src/sys/arch/mips/mips/pmap_tlb.c	Thu Feb 16 23:02:22 2012
@@ -1,4 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:44:30 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cache_r4k_subr.S

Log Message:
PTR_DSRL - PTR_DSLL typo


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/mips/cache_r4k_subr.S

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:45:17 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: db_machdep.h
src/sys/arch/mips/mips [matt-nb5-mips64]: db_disasm.c db_interface.c
db_trace.c

Log Message:
Change db_expr_t to an register_t so we can see the full register contents
on N32 kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.22.62.4 -r1.22.62.5 src/sys/arch/mips/include/db_machdep.h
cvs rdiff -u -r1.19.62.3 -r1.19.62.4 src/sys/arch/mips/mips/db_disasm.c
cvs rdiff -u -r1.64.16.23 -r1.64.16.24 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.35.38.5 -r1.35.38.6 src/sys/arch/mips/mips/db_trace.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:47:07 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c

Log Message:
When booting a N32 MP kernel, make sure to setup the ksegx mapping.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/arch/mips/mips/cpu_subr.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:51:33 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_fixup.c

Log Message:
Use (intptr_t) when casting pointers to get proper sign extension.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/mips/mips_fixup.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 10:52:13 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: vmparam.h

Log Message:
Add extern int mips_ksegx_tlb_slot;


To generate a diff of this commit:
cvs rdiff -u -r1.41.28.26 -r1.41.28.27 src/sys/arch/mips/include/vmparam.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 18:57:16 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmnvar.h

Log Message:
enable_cp2 needs a early clobber


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixl_fmnvar.h

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 18:58:01 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]:
bus_space_alignstride_chipdep.c

Log Message:
Allow KSEG1 even on _LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.10.18.15 -r1.10.18.16 \
src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 16 18:58:58 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c vm_machdep.c

Log Message:
mips_nfreelist is the one past the highest freelist used.


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.66 -r1.205.4.1.2.1.2.67 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.121.6.1.2.28 -r1.121.6.1.2.29 \
src/sys/arch/mips/mips/vm_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 13 08:13:42 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c mips_machdep.c
trap.c

Log Message:
Fix emulation to not panic when it encounters something it doesn't like.
(so running crashme won't crash the system).
Centralize the trapsignal processing so we can print out the trap info if
so desired.
Add a machdep.printfataltraps sysctl knob.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.41 -r1.90.16.42 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.78.36.1.2.32 -r1.78.36.1.2.33 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.14.78.13 -r1.14.78.14 src/sys/arch/mips/mips/mips_emul.c
cvs rdiff -u -r1.205.4.1.2.1.2.63 -r1.205.4.1.2.1.2.64 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.217.12.41 -r1.217.12.42 src/sys/arch/mips/mips/trap.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.41 src/sys/arch/mips/include/cpu.h:1.90.16.42
--- src/sys/arch/mips/include/cpu.h:1.90.16.41	Sat Jan 28 00:56:34 2012
+++ src/sys/arch/mips/include/cpu.h	Mon Feb 13 08:13:41 2012
@@ -163,6 +163,7 @@ struct cpu_info {
 #define CPU_BOOTED_KERNEL	2	/* string: booted kernel name */
 #define CPU_ROOT_DEVICE		3	/* string: root device name */
 #define CPU_LLSC		4	/* OS/CPU supports LL/SC instruction */
+#define CPU_PRINTFATALTRAPS	5	/* bool: print fatal traps */
 
 /*
  * Platform can override, but note this breaks userland compatibility

Index: src/sys/arch/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.78.36.1.2.32 src/sys/arch/mips/include/locore.h:1.78.36.1.2.33
--- src/sys/arch/mips/include/locore.h:1.78.36.1.2.32	Thu Feb  9 20:01:21 2012
+++ src/sys/arch/mips/include/locore.h	Mon Feb 13 08:13:41 2012
@@ -42,6 +42,13 @@ struct trapframe;
 void	trap(uint32_t, uint32_t, vaddr_t, vaddr_t, struct trapframe *);
 void	ast(void);
 
+/*
+ * Perform a trapsignal, and if cpu_printfataltraps is true, print the trap info
+ * to the console.
+ */
+extern bool cpu_printfataltraps;
+void cpu_trapsignal(struct lwp *, ksiginfo_t *, struct trapframe *);
+
 void	mips_fpu_trap(vaddr_t, struct trapframe *);
 void	mips_fpu_intr(vaddr_t, struct trapframe *);
 

Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.14.78.13 src/sys/arch/mips/mips/mips_emul.c:1.14.78.14
--- src/sys/arch/mips/mips/mips_emul.c:1.14.78.13	Fri Apr 29 08:26:28 2011
+++ src/sys/arch/mips/mips/mips_emul.c	Mon Feb 13 08:13:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.14.78.13 2011/04/29 08:26:28 matt Exp $ */
+/*	$NetBSD: mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mips_emul.c,v 1.14.78.13 2011/04/29 08:26:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_emul.c,v 1.14.78.14 2012/02/13 08:13:42 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -43,9 +43,10 @@ __KERNEL_RCSID(0, $NetBSD: mips_emul.c,
 #include mips/vmparam.h			/* for VM_MAX_ADDRESS */
 #include mips/trap.h
 
-static inline void	send_sigsegv(intptr_t, uint32_t, struct trapframe *,
-			uint32_t);
-static inline void	update_pc(struct trapframe *, uint32_t);
+static void	send_sigsegv(intptr_t, uint32_t, struct trapframe *, uint32_t);
+static void	send_sigill(intptr_t, uint32_t, struct trapframe *, uint32_t,
+		uint32_t);
+static void	update_pc(struct trapframe *, uint32_t);
 
 /*
  * MIPS2 LL instruction emulation state
@@ -78,9 +79,11 @@ mips_emul_branch(struct trapframe *tf, v
 			nextpc = tf-tf_regs[inst.RType.rs];
 		else if (allowNonBranch)
 			nextpc = instpc + 4;
-		else
-			panic(%s: %s instruction %08x at pc 0x%PRIxVADDR,
-			__func__, non-branch, inst.word, instpc);
+		else {
+			send_sigill(instpc, T_RES_INST, tf,
+			tf-tf_regs[_R_CAUSE], inst.word);
+			nextpc = instpc;
+		}
 		break;
 
 	case OP_BCOND:
@@ -106,8 +109,10 @@ mips_emul_branch(struct trapframe *tf, v
 			break;
 
 		default:
-			panic(%s: %s instruction 0x%08x at pc 0x%PRIxVADDR,
-			__func__, bad branch, inst.word, instpc);
+			send_sigill(instpc, T_RES_INST, tf,
+			tf-tf_regs[_R_CAUSE], inst.word);
+			nextpc = instpc;
+			break;
 		}
 		break;
 
@@ -161,16 +166,22 @@ mips_emul_branch(struct trapframe *tf, v
 		}
 		else if (allowNonBranch)
 			nextpc = instpc + 4;
-		else
-			panic(%s: %s instruction 0x%08x at pc 0x%PRIxVADDR,
-			__func__, bad COP1 branch, inst.word, instpc);
+		else {
+			send_sigill(instpc, T_RES_INST, tf,
+			tf-tf_regs[_R_CAUSE], inst.word);
+			nextpc = instpc;
+		}
 		break;
 
 	default:
-		if (!allowNonBranch)
-			panic(%s: %s instruction 0x%08x at pc 0x%PRIxVADDR,
-			   

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 13 18:20:26 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: bus_dma.c mem.c
mips_machdep.c pmap.c pmap_segtab.c vm_machdep.c

Log Message:
Add mm_md_direct_mapped_virt (inverse of mm_md_direct_mapped_phys).  Add a
third argument, vsize_t *, which, if not NULL, returns the amount of virtual
space left in that direct mapped segment.
Get rid most of the individual direct_mapped assert and use the above
routines instead.
Improve kernel core dump code.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.42 -r1.90.16.43 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.78.36.1.2.33 -r1.78.36.1.2.34 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.22.16.21 -r1.22.16.22 src/sys/arch/mips/mips/bus_dma.c
cvs rdiff -u -r1.35.38.10 -r1.35.38.11 src/sys/arch/mips/mips/mem.c
cvs rdiff -u -r1.205.4.1.2.1.2.64 -r1.205.4.1.2.1.2.65 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.40 -r1.179.16.41 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.121.6.1.2.26 -r1.121.6.1.2.27 \
src/sys/arch/mips/mips/vm_machdep.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.42 src/sys/arch/mips/include/cpu.h:1.90.16.43
--- src/sys/arch/mips/include/cpu.h:1.90.16.42	Mon Feb 13 08:13:41 2012
+++ src/sys/arch/mips/include/cpu.h	Mon Feb 13 18:20:25 2012
@@ -637,7 +637,8 @@ void	fpusave_cpu(struct cpu_info *);
 void	dumpsys(void);
 int	savectx(struct pcb *);
 void	cpu_identify(device_t, const char *);
-bool	mm_md_direct_mapped_phys(paddr_t, vaddr_t *);
+bool	mm_md_direct_mapped_phys(paddr_t, vaddr_t *, vsize_t *);
+bool	mm_md_direct_mapped_virt(vaddr_t, paddr_t *, vsize_t *);
 
 /* locore*.S */
 int	badaddr(void *, size_t);

Index: src/sys/arch/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.78.36.1.2.33 src/sys/arch/mips/include/locore.h:1.78.36.1.2.34
--- src/sys/arch/mips/include/locore.h:1.78.36.1.2.33	Mon Feb 13 08:13:41 2012
+++ src/sys/arch/mips/include/locore.h	Mon Feb 13 18:20:25 2012
@@ -32,6 +32,8 @@
 #include opt_cputype.h
 #endif
 
+#include sys/kcore.h
+
 #include mips/mutex.h
 #include mips/cpuregs.h
 #include mips/reg.h
@@ -417,6 +419,19 @@ void	mips_page_physload(vaddr_t, vaddr_t
 	const struct phys_ram_seg *, size_t,
 	const struct mips_vmfreelist *, size_t);
 
+paddr_t	kvtophys(vaddr_t);
+
+extern struct phys_ram_seg mem_clusters[];
+extern u_int mem_cluster_cnt;
+
+#ifndef _LP64
+/*
+ * Helper routines for kernel coredumps.
+ */
+bool	mips_kcore_window_vtophys(vaddr_t, paddr_t *);
+vaddr_t	mips_kcore_window_map(paddr_t, vsize_t *);
+#endif
+
 
 /*
  * CPU identification, from PRID register.

Index: src/sys/arch/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.22.16.21 src/sys/arch/mips/mips/bus_dma.c:1.22.16.22
--- src/sys/arch/mips/mips/bus_dma.c:1.22.16.21	Tue Dec  6 17:37:55 2011
+++ src/sys/arch/mips/mips/bus_dma.c	Mon Feb 13 18:20:25 2012
@@ -1009,18 +1009,22 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 		return 0;
 	}
 #else
-	if ((nsegs == 1)  (segs[0].ds_addr  MIPS_PHYS_MASK)) {
-		if (((mips_options.mips_cpu_flags  CPU_MIPS_D_CACHE_COHERENT) == 0)
-		  (flags  BUS_DMA_COHERENT))
+	if (nsegs == 1) {
+		vsize_t vs;
+		if (!(mips_options.mips_cpu_flags  CPU_MIPS_D_CACHE_COHERENT)
+		 segs[0].ds_addr  MIPS_PHYS_MASK
+		 segs[0].ds_addr + segs[0].ds_len = MIPS_PHYS_MASK + 1
+		 (flags  BUS_DMA_COHERENT)) {
 			*kvap = (void *)MIPS_PHYS_TO_KSEG1(segs[0].ds_addr);
-#ifdef ENABLE_MIPS_KSEGX
-		else if (mips_ksegx_start  segs[0].ds_addr
-		 segs[0].ds_addr  mips_ksegx_start + VM_KSEGX_SIZE)
-			*kvap = (void *)(vaddr_t)(VM_KSEGX_ADDRESS + segs[0].ds_addr);
-#endif
-		else
-			*kvap = (void *)MIPS_PHYS_TO_KSEG0(segs[0].ds_addr);
-		return (0);
+			return (0);
+		}
+		if (((mips_options.mips_cpu_flags  CPU_MIPS_D_CACHE_COHERENT)
+		 || (flags  BUS_DMA_COHERENT) == 0)
+		 mm_md_direct_mapped_phys(segs[0].ds_addr, va, vs)
+		 segs[0].ds_len = vs) {
+			*kvap = (void *)va;
+			return (0);
+		}
 	}
 #endif	/* _LP64 */
 
@@ -1068,17 +1072,9 @@ _bus_dmamem_unmap(bus_dma_tag_t t, void 
 	 * Nothing to do if we mapped it with KSEG0 or KSEG1 (i.e.
 	 * not in KSEG2 or XKSEG).
 	 */
-	if (MIPS_KSEG0_P(kva) || MIPS_KSEG1_P(kva))
-		return;
-#ifdef ENABLE_MIPS_KSEGX
-	if (VM_KSEGX_ADDRESS = (vaddr_t)kva
-	 (vaddr_t)kva  VM_KSEGX_ADDRESS + VM_KSEGX_SIZE)
+	if (mm_md_direct_mapped_virt((vaddr_t)kva, NULL, NULL)
+	|| MIPS_KSEG1_P(kva))
 		return;
-#endif
-#ifdef _LP64
-	if (MIPS_XKPHYS_P((vaddr_t)kva))
-		return;
-#endif
 
 	size = round_page(size);
 	pmap_remove(pmap_kernel(), (vaddr_t)kva, (vaddr_t)kva + size);

Index: 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 14 01:51:12 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mem.c mips_machdep.c pmap.c
vm_machdep.c

Log Message:
Fix various LP64 thinkos.


To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.34 -r1.78.36.1.2.35 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.35.38.11 -r1.35.38.12 src/sys/arch/mips/mips/mem.c
cvs rdiff -u -r1.205.4.1.2.1.2.65 -r1.205.4.1.2.1.2.66 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.41 -r1.179.16.42 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.121.6.1.2.27 -r1.121.6.1.2.28 \
src/sys/arch/mips/mips/vm_machdep.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.78.36.1.2.34 src/sys/arch/mips/include/locore.h:1.78.36.1.2.35
--- src/sys/arch/mips/include/locore.h:1.78.36.1.2.34	Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/include/locore.h	Tue Feb 14 01:51:11 2012
@@ -424,12 +424,12 @@ paddr_t	kvtophys(vaddr_t);
 extern struct phys_ram_seg mem_clusters[];
 extern u_int mem_cluster_cnt;
 
-#ifndef _LP64
 /*
  * Helper routines for kernel coredumps.
  */
-bool	mips_kcore_window_vtophys(vaddr_t, paddr_t *);
 vaddr_t	mips_kcore_window_map(paddr_t, vsize_t *);
+#ifndef _LP64
+bool	mips_kcore_window_vtophys(vaddr_t, paddr_t *);
 #endif
 
 

Index: src/sys/arch/mips/mips/mem.c
diff -u src/sys/arch/mips/mips/mem.c:1.35.38.11 src/sys/arch/mips/mips/mem.c:1.35.38.12
--- src/sys/arch/mips/mips/mem.c:1.35.38.11	Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/mips/mem.c	Tue Feb 14 01:51:11 2012
@@ -133,10 +133,10 @@ mmrw(dev_t dev, struct uio *uio, int fla
 if (c  vs)
 	c = vs;
 if (pa  mips_avail_end
-+ mips_round_page(MSGBUFSIZE) - c)) {
++ mips_round_page(MSGBUFSIZE) - c)
 	return (EFAULT);
 			} else if (MIPS_XKSEG_P(va)
-			 v  MIPS_KSEG0_START
+			 va  MIPS_KSEG0_START
 			 !uvm_kernacc((void *)va, c,
 			uio-uio_rw == UIO_READ ? B_READ : B_WRITE)) {
 return (EFAULT);

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.65 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.66
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.65	Mon Feb 13 18:20:25 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Tue Feb 14 01:51:11 2012
@@ -2052,7 +2052,7 @@ dumpsys(void)
 	delay(500);		/* 5 seconds */
 }
 
-#ifdef MIPS3_PLUS
+#if defined(MIPS3_PLUS)  !defined(_LP64)
 static struct mips_kcore_window_info {
 	struct tlbmask mkwi_tlb;
 	int mkwi_tlb_slot;
@@ -2063,12 +2063,10 @@ static struct mips_kcore_window_info {
 	},
 	.mkwi_tlb_slot = -1,
 };
-#endif
 
 bool
 mips_kcore_window_vtophys(vaddr_t va, paddr_t *pap)
 {
-#ifdef MIPS3_PLUS
 	struct mips_kcore_window_info * const mkwi = mips_kcore_window_info;
 	const vaddr_t tlb_va = mkwi-mkwi_tlb.tlb_hi  -PAGE_SIZE;
 	psize_t tlb_size = MIPS3_PG_SIZE_MASK_TO_SIZE(mkwi-mkwi_tlb.tlb_mask);
@@ -2078,9 +2076,9 @@ mips_kcore_window_vtophys(vaddr_t va, pa
 		+ mips_tlbpfn_to_paddr(mkwi-mkwi_tlb.tlb_lo0);
 		return true;
 	}
-#endif
 	return false;
 }
+#endif
 
 vaddr_t
 mips_kcore_window_map(paddr_t pa, vsize_t *vsp)
@@ -2553,7 +2551,7 @@ mm_md_direct_mapped_phys(paddr_t pa, vad
 	if (vap != NULL)
 		*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
 	if (vsp != NULL)
-		*vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XKPHYS_MASK) - pa + 1;
+		*vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XSEG_MASK) - pa + 1;
 	return true;
 #else
 #ifdef ENABLE_MIPS_KSEGX
@@ -2585,7 +2583,7 @@ mm_md_direct_mapped_virt(vaddr_t va, pad
 		if (pap != NULL)
 			*pap = pa;
 		if (vsp != NULL)
-			*vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XKPHYS_MASK) - pa + 1;
+			*vsp = MIPS_XKPHYS_TO_PHYS(MIPS_XSEG_MASK) - pa + 1;
 		return true;
 	}
 #endif

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.41 src/sys/arch/mips/mips/pmap.c:1.179.16.42
--- src/sys/arch/mips/mips/pmap.c:1.179.16.41	Mon Feb 13 18:20:26 2012
+++ src/sys/arch/mips/mips/pmap.c	Tue Feb 14 01:51:11 2012
@@ -367,6 +367,10 @@ pmap_map_ephemeral_page(struct vm_page *
 	vaddr_t va;
 
 	if (!mm_md_direct_mapped_phys(pa, va, NULL)) {
+#ifdef _LP64
+		panic(%s: direct_mapped_phys failed for pa %#PRIxPADDR,
+		__func__, pa);
+#else
 		KASSERT(pmap_initialized);
 		/*
 		 * Make sure to use a congruent mapping to the last mapped
@@ -379,6 +383,7 @@ pmap_map_ephemeral_page(struct vm_page *
 		+ mips_cache_indexof(MIPS_CACHE_VIRTUAL_ALIAS ? pv-pv_va : pa);
 		*old_pt_entry_p = *kvtopte(va);
 		pmap_kenter_pa(va, pa, prot);
+#endif
 	}
 	if (MIPS_CACHE_VIRTUAL_ALIAS) {
 		/*

Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.27 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.28
--- 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 13 08:13:42 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_emul.c mips_machdep.c
trap.c

Log Message:
Fix emulation to not panic when it encounters something it doesn't like.
(so running crashme won't crash the system).
Centralize the trapsignal processing so we can print out the trap info if
so desired.
Add a machdep.printfataltraps sysctl knob.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.41 -r1.90.16.42 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.78.36.1.2.32 -r1.78.36.1.2.33 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.14.78.13 -r1.14.78.14 src/sys/arch/mips/mips/mips_emul.c
cvs rdiff -u -r1.205.4.1.2.1.2.63 -r1.205.4.1.2.1.2.64 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.217.12.41 -r1.217.12.42 src/sys/arch/mips/mips/trap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb 13 18:20:26 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: bus_dma.c mem.c
mips_machdep.c pmap.c pmap_segtab.c vm_machdep.c

Log Message:
Add mm_md_direct_mapped_virt (inverse of mm_md_direct_mapped_phys).  Add a
third argument, vsize_t *, which, if not NULL, returns the amount of virtual
space left in that direct mapped segment.
Get rid most of the individual direct_mapped assert and use the above
routines instead.
Improve kernel core dump code.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.42 -r1.90.16.43 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.78.36.1.2.33 -r1.78.36.1.2.34 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.22.16.21 -r1.22.16.22 src/sys/arch/mips/mips/bus_dma.c
cvs rdiff -u -r1.35.38.10 -r1.35.38.11 src/sys/arch/mips/mips/mem.c
cvs rdiff -u -r1.205.4.1.2.1.2.64 -r1.205.4.1.2.1.2.65 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.40 -r1.179.16.41 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.121.6.1.2.26 -r1.121.6.1.2.27 \
src/sys/arch/mips/mips/vm_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Feb 14 01:51:12 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mem.c mips_machdep.c pmap.c
vm_machdep.c

Log Message:
Fix various LP64 thinkos.


To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.34 -r1.78.36.1.2.35 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.35.38.11 -r1.35.38.12 src/sys/arch/mips/mips/mem.c
cvs rdiff -u -r1.205.4.1.2.1.2.65 -r1.205.4.1.2.1.2.66 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.41 -r1.179.16.42 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.121.6.1.2.27 -r1.121.6.1.2.28 \
src/sys/arch/mips/mips/vm_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 12 07:48:37 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c

Log Message:
pmap pv pages can come from KSEGX too.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.39 -r1.179.16.40 src/sys/arch/mips/mips/pmap.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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.39 src/sys/arch/mips/mips/pmap.c:1.179.16.40
--- src/sys/arch/mips/mips/pmap.c:1.179.16.39	Fri Feb 10 08:15:58 2012
+++ src/sys/arch/mips/mips/pmap.c	Sun Feb 12 07:48:37 2012
@@ -2538,8 +2538,15 @@ pmap_pv_page_free(struct pool *pp, void 
 	KASSERT(MIPS_XKPHYS_P(va));
 	pa = MIPS_XKPHYS_TO_PHYS(va);
 #else
-	KASSERT(MIPS_KSEG0_P(va));
-	pa = MIPS_KSEG0_TO_PHYS(va);
+#ifdef ENABLE_MIPS_KSEGX
+	if (VM_KSEGX_ADDRESS = va  va = VM_KSEGX_ADDRESS + VM_KSEGX_SIZE) { 
+		pa = mips_ksegx_start + va - VM_KSEGX_ADDRESS;
+	} else
+#endif
+	{
+		KASSERT(MIPS_KSEG0_P(va));
+		pa = MIPS_KSEG0_TO_PHYS(va);
+	}
 #endif
 #ifdef MIPS3_PLUS
 	if (MIPS_CACHE_VIRTUAL_ALIAS)



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb 12 07:48:37 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c

Log Message:
pmap pv pages can come from KSEGX too.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.39 -r1.179.16.40 src/sys/arch/mips/mips/pmap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 08:15:58 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.38 -r1.179.16.39 src/sys/arch/mips/mips/pmap.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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.38 src/sys/arch/mips/mips/pmap.c:1.179.16.39
--- src/sys/arch/mips/mips/pmap.c:1.179.16.38	Fri Feb 10 07:19:44 2012
+++ src/sys/arch/mips/mips/pmap.c	Fri Feb 10 08:15:58 2012
@@ -1840,7 +1840,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 		}
 #elif defined(ENABLE_MIPS_KSEGX)
 		if (VM_KSEGX_ADDRESS = va
-		 va  VM_KSEGX_ADDRESS + VM_KSEGX_SIZE)
+		 va  VM_KSEGX_ADDRESS + VM_KSEGX_SIZE) {
 			pa = mips_ksegx_start + va - VM_KSEGX_ADDRESS;
 			goto done;
 		}



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 08:15:58 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.38 -r1.179.16.39 src/sys/arch/mips/mips/pmap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 20:01:21 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: locore.S locore_mips1.S
mipsX_subr.S mips_fixup.c

Log Message:
Update mips_fixup.c to version from -HEAD.
Move cpu_switchto to locore jumpvec and create a stub for it.


To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.31 -r1.78.36.1.2.32 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.167.38.24 -r1.167.38.25 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.64.26.1.2.14 -r1.64.26.1.2.15 \
src/sys/arch/mips/mips/locore_mips1.S
cvs rdiff -u -r1.26.36.1.2.54 -r1.26.36.1.2.55 \
src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/mips/mips_fixup.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.78.36.1.2.31 src/sys/arch/mips/include/locore.h:1.78.36.1.2.32
--- src/sys/arch/mips/include/locore.h:1.78.36.1.2.31	Fri Dec 23 08:09:08 2011
+++ src/sys/arch/mips/include/locore.h	Thu Feb  9 20:01:21 2012
@@ -111,6 +111,8 @@ struct mips_jump_fixup_info {
 void	fixup_splcalls(void);/* splstubs.c */
 bool	mips_fixup_exceptions(mips_fixup_callback_t);
 bool	mips_fixup_zero_relative(int32_t, uint32_t [2]);
+intptr_t
+	mips_fixup_addr(const uint32_t *);
 void	mips_fixup_stubs(uint32_t *, uint32_t *);
 
 /*
@@ -348,6 +350,7 @@ typedef struct  {
 	void	(*ljv_tlb_enter)(size_t, vaddr_t, uint32_t);
 	void	(*ljv_tlb_read_indexed)(size_t, struct tlbmask *);
 	void	(*ljv_tlb_write_indexed)(size_t, const struct tlbmask *);
+	lwp_t *	(*ljv_cpu_switchto)(lwp_t *, lwp_t *, bool);
 } mips_locore_jumpvec_t;
 
 typedef struct {

Index: src/sys/arch/mips/mips/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.167.38.24 src/sys/arch/mips/mips/locore.S:1.167.38.25
--- src/sys/arch/mips/mips/locore.S:1.167.38.24	Thu Jan 19 08:28:49 2012
+++ src/sys/arch/mips/mips/locore.S	Thu Feb  9 20:01:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.167.38.24 2012/01/19 08:28:49 matt Exp $	*/
+/*	locore.S,v 1.167.38.24 2012/01/19 08:28:49 matt Exp	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -172,17 +172,18 @@ _C_LABEL(kernel_text):
 _C_LABEL(verylocore):
 
 /*
- * struct lwp *cpu_switchto(struct lwp *cur, struct lwp *next)
+ * lwp_t *mips_cpu_switchto(lwp_t *cur, lwp_t *next, bool returning)
  * Switch to the specified next LWP
  * Arguments:
  *	a0	the current LWP
  *	a1	the LWP to switch to
+ *	a2	returning to a softint LWP
  * Returns:
  *	v0	the LWP we have switched from
  *
  * called at IPL_SCHED
  */
-NESTED(cpu_switchto, CALLFRAME_SIZ, ra)
+NESTED(mips_cpu_switchto, CALLFRAME_SIZ, ra)
 #ifdef PARANOIA
 	/*
 	 * Make sure we are at IPL_SCHED
@@ -299,7 +300,7 @@ NESTED(cpu_switchto, CALLFRAME_SIZ, ra)
 #else
 	JR_HB_RA
 #endif /* PARANOIA */
-END(cpu_switchto)
+END(mips_cpu_switchto)
 
 #ifdef __HAVE_FAST_SOFTINTS
 /*

Index: src/sys/arch/mips/mips/locore_mips1.S
diff -u src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.14 src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.15
--- src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.14	Fri Dec 23 23:12:34 2011
+++ src/sys/arch/mips/mips/locore_mips1.S	Thu Feb  9 20:01:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips1.S,v 1.64.26.1.2.14 2011/12/23 23:12:34 matt Exp $	*/
+/*	locore_mips1.S,v 1.64.26.1.2.14 2011/12/23 23:12:34 matt Exp	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1735,6 +1735,7 @@ _C_LABEL(MIPSX(locore_vec)):
 	PTR_WORD _C_LABEL(MIPSX(tlb_enter))
 	PTR_WORD _C_LABEL(MIPSX(tlb_read_indexed))
 	PTR_WORD _C_LABEL(MIPSX(tlb_write_indexed))
+	PTR_WORD _C_LABEL(mips_cpu_switchto)
 
 	.globl _C_LABEL(MIPSX(locoresw))
 _C_LABEL(MIPSX(locoresw)):

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.54 src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.55
--- src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.54	Thu Jan 19 08:28:49 2012
+++ src/sys/arch/mips/mips/mipsX_subr.S	Thu Feb  9 20:01:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.54 2012/01/19 08:28:49 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.55 2012/02/09 20:01:21 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -2912,6 +2912,7 @@ _C_LABEL(MIPSX(locore_vec)):
 	PTR_WORD _C_LABEL(MIPSX(tlb_enter))
 	PTR_WORD _C_LABEL(MIPSX(tlb_read_indexed))
 	PTR_WORD _C_LABEL(MIPSX(tlb_write_indexed))
+	PTR_WORD _C_LABEL(mips_cpu_switchto)
 
 	.globl _C_LABEL(MIPSX(locoresw))
 _C_LABEL(MIPSX(locoresw)):

Index: src/sys/arch/mips/mips/mips_fixup.c
diff -u src/sys/arch/mips/mips/mips_fixup.c:1.1.2.12 src/sys/arch/mips/mips/mips_fixup.c:1.1.2.13
--- src/sys/arch/mips/mips/mips_fixup.c:1.1.2.12	Fri Nov  4 07:47:40 2011
+++ src/sys/arch/mips/mips/mips_fixup.c	Thu Feb  9 20:01:21 2012
@@ -1,3 +1,5 @@
+/*	$NetBSD: 

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 00:02:55 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: locore_mips3.S

Log Message:
Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.93.38.15 -r1.93.38.16 src/sys/arch/mips/mips/locore_mips3.S

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/mips/mips/locore_mips3.S
diff -u src/sys/arch/mips/mips/locore_mips3.S:1.93.38.15 src/sys/arch/mips/mips/locore_mips3.S:1.93.38.16
--- src/sys/arch/mips/mips/locore_mips3.S:1.93.38.15	Thu Jan 19 08:28:49 2012
+++ src/sys/arch/mips/mips/locore_mips3.S	Fri Feb 10 00:02:55 2012
@@ -534,7 +534,7 @@ END(mipsNN_cp0_watchhi_write)
 #if (MIPS32R2 + MIPS64R2 + MIPS64R2_RMIXL)  0
 /*
  * void mipsNN_cp0_userlocal_write(void *);
- *	Set the value of the CP0 USERLOCAL (TLB_CONTEXT, select 2) register.
+ *	Set the value of the CP0 HWRENA register.
  */
 LEAF(mipsNN_cp0_hwrena_write)
 	j	ra



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 07:14:49 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_segtab.c

Log Message:
Don't double claim a kmem page.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.36 -r1.179.16.37 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/mips/pmap_segtab.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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.36 src/sys/arch/mips/mips/pmap.c:1.179.16.37
--- src/sys/arch/mips/mips/pmap.c:1.179.16.36	Thu Feb  9 03:14:45 2012
+++ src/sys/arch/mips/mips/pmap.c	Fri Feb 10 07:14:49 2012
@@ -2513,6 +2513,7 @@ pmap_pv_page_alloc(struct pool *pp, int 
 	if (pg == NULL)
 		return NULL;
 
+	uvm_km_pageclaim(pg);
 	return (void *)mips_pmap_map_poolpage(VM_PAGE_TO_PHYS(pg));
 }
 
@@ -2607,9 +2608,6 @@ mips_pmap_alloc_poolpage(int flags)
 	} else {
 		pg = uvm_pagealloc(NULL, 0, NULL, flags);
 	}
-	if (pg != NULL) {
-		uvm_km_pageclaim(pg);
-	}
 	return pg;
 }
 

Index: src/sys/arch/mips/mips/pmap_segtab.c
diff -u src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.12 src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.13
--- src/sys/arch/mips/mips/pmap_segtab.c:1.1.2.12	Thu Feb  9 03:14:45 2012
+++ src/sys/arch/mips/mips/pmap_segtab.c	Fri Feb 10 07:14:49 2012
@@ -149,7 +149,13 @@ uint32_t npage_segtab;
 static inline struct vm_page *
 pmap_pte_pagealloc(void)
 {
-	return mips_pmap_alloc_poolpage(UVM_PGA_ZERO|UVM_PGA_USERESERVE);
+	struct vm_page *pg;
+
+	pg = PMAP_ALLOC_POOLPAGE(UVM_PGA_ZERO|UVM_PGA_USERESERVE);
+	if (pg)
+		uvm_km_pageclaim(pg);
+
+	return pg;
 }
 
 static inline pt_entry_t * 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 07:19:44 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c

Log Message:
Teach pmap_extract about KSEGX.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.37 -r1.179.16.38 src/sys/arch/mips/mips/pmap.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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.37 src/sys/arch/mips/mips/pmap.c:1.179.16.38
--- src/sys/arch/mips/mips/pmap.c:1.179.16.37	Fri Feb 10 07:14:49 2012
+++ src/sys/arch/mips/mips/pmap.c	Fri Feb 10 07:19:44 2012
@@ -1838,6 +1838,12 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 			pa = MIPS_XKPHYS_TO_PHYS(va);
 			goto done;
 		}
+#elif defined(ENABLE_MIPS_KSEGX)
+		if (VM_KSEGX_ADDRESS = va
+		 va  VM_KSEGX_ADDRESS + VM_KSEGX_SIZE)
+			pa = mips_ksegx_start + va - VM_KSEGX_ADDRESS;
+			goto done;
+		}
 #endif
 #ifdef DIAGNOSTIC
 		if (MIPS_KSEG1_P(va))



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 20:01:21 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: locore.h
src/sys/arch/mips/mips [matt-nb5-mips64]: locore.S locore_mips1.S
mipsX_subr.S mips_fixup.c

Log Message:
Update mips_fixup.c to version from -HEAD.
Move cpu_switchto to locore jumpvec and create a stub for it.


To generate a diff of this commit:
cvs rdiff -u -r1.78.36.1.2.31 -r1.78.36.1.2.32 \
src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.167.38.24 -r1.167.38.25 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.64.26.1.2.14 -r1.64.26.1.2.15 \
src/sys/arch/mips/mips/locore_mips1.S
cvs rdiff -u -r1.26.36.1.2.54 -r1.26.36.1.2.55 \
src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/mips/mips_fixup.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 00:02:55 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: locore_mips3.S

Log Message:
Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.93.38.15 -r1.93.38.16 src/sys/arch/mips/mips/locore_mips3.S

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 07:14:49 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c pmap_segtab.c

Log Message:
Don't double claim a kmem page.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.36 -r1.179.16.37 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/mips/pmap_segtab.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 10 07:19:44 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: pmap.c

Log Message:
Teach pmap_extract about KSEGX.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.37 -r1.179.16.38 src/sys/arch/mips/mips/pmap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:10:06 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c

Log Message:
When printing a stack trace, use sym+0x# so you can cp easily into gdb.


To generate a diff of this commit:
cvs rdiff -u -r1.217.12.40 -r1.217.12.41 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.40 src/sys/arch/mips/mips/trap.c:1.217.12.41
--- src/sys/arch/mips/mips/trap.c:1.217.12.40	Thu Jan 19 08:28:50 2012
+++ src/sys/arch/mips/mips/trap.c	Thu Feb  9 03:10:05 2012
@@ -1083,7 +1083,7 @@ mips3_eret:
 done:
 	if (mask  (1  _R_RA))
 		ra = regs[_R_RA];
-	(*printfn)(%#PRIxVADDR: %s+%PRIxVADDR (%PRIxREGISTER,%PRIxREGISTER,%PRIxREGISTER,%PRIxREGISTER) ra %PRIxVADDR sz %d\n,
+	(*printfn)(%#PRIxVADDR: %s+%#PRIxVADDR (%PRIxREGISTER,%PRIxREGISTER,%PRIxREGISTER,%PRIxREGISTER) ra %PRIxVADDR sz %d\n,
 		sp, fn_name(subr), pc - subr,
 		regs[_R_A0], regs[_R_A1], regs[_R_A2], regs[_R_A3],
 		ra, stksize);



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:14:46 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: vmparam.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c pmap.c
pmap_segtab.c vm_machdep.c

Log Message:
Add mips_page_to_pggroup which return what pggroup a page belongs to.
Eradicate VM_FREELIST_MAX
When adding pages to the system, track what freelists get pages.


To generate a diff of this commit:
cvs rdiff -u -r1.41.28.25 -r1.41.28.26 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.205.4.1.2.1.2.62 -r1.205.4.1.2.1.2.63 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.35 -r1.179.16.36 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.121.6.1.2.24 -r1.121.6.1.2.25 \
src/sys/arch/mips/mips/vm_machdep.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/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.41.28.25 src/sys/arch/mips/include/vmparam.h:1.41.28.26
--- src/sys/arch/mips/include/vmparam.h:1.41.28.25	Tue Dec 27 16:09:36 2011
+++ src/sys/arch/mips/include/vmparam.h	Thu Feb  9 03:14:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.41.28.25 2011/12/27 16:09:36 matt Exp $	*/
+/*	vmparam.h,v 1.41.28.25 2011/12/27 16:09:36 matt Exp	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -208,9 +208,8 @@
 #define	VM_PHYSSEG_NOADD	/* can add RAM after vm_mem_init */
 
 #ifndef VM_NFREELIST
-#define	VM_NFREELIST		16	/* 16 distinct memory segments */
+#define	VM_NFREELIST		1	/* 16 distinct memory segments */
 #define VM_FREELIST_DEFAULT	0
-#define VM_FREELIST_MAX		1
 #endif
 
 #ifdef _KERNEL
@@ -287,4 +286,14 @@ do {\
 	(md)-pvh_attrs = 0;	\
 } while (/* CONSTCOND */ 0)
 
+#define	VM_NPGGROUP(colors)		(mips_nfreelist * (colors))
+#define	VM_PAGE_TO_PGGROUP(pg, ncolors)	(mips_page_to_pggroup((pg), (ncolors)))
+
+#ifdef _KERNEL
+extern u_int mips_nfreelist;
+extern uint32_t mips_freelist_mask;
+struct vm_page;
+extern size_t mips_page_to_pggroup(struct vm_page *, size_t); 
+#endif
+
 #endif /* ! _MIPS_VMPARAM_H_ */

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.62 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.63
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.62	Sat Jan 28 08:05:03 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Thu Feb  9 03:14:45 2012
@@ -2126,6 +2126,8 @@ mips_init_lwp0_uarea(void)
 }
 
 int mips_poolpage_vmfreelist = VM_FREELIST_DEFAULT;
+u_int mips_nfreelist;
+uint32_t mips_freelist_mask = 0;
 
 #define	HALFGIG		((paddr_t)512 * 1024 * 1024)
 #define	FOURGIG		((paddr_t)4 * 1024 * 1024 * 1024)
@@ -2144,6 +2146,7 @@ mips_page_physload(vaddr_t vkernstart, v
 #ifdef VM_FREELIST_FIRST4G
 	bool need4g = false;
 #endif
+	CTASSERT(VM_NFREELIST = 32);
 
 	/*
 	 * Do a first pass and see what ranges memory we have to deal with.
@@ -2152,7 +2155,9 @@ mips_page_physload(vaddr_t vkernstart, v
 #ifdef VM_FREELIST_FIRST4G
 		if (round_page(segs[i].start + segs[i].size)  FOURGIG) {
 			need4g = true;
+#ifdef _LP64
 			mips_poolpage_vmfreelist = VM_FREELIST_FIRST4G;
+#endif
 		}
 #endif
 #ifdef VM_FREELIST_FIRST512M
@@ -2279,11 +2284,21 @@ mips_page_physload(vaddr_t vkernstart, v
 			uvm_page_physload(first, last, first, last, freelist);
 
 			/*
+			 * Mark that we loaded pages of this freelist type.
+			 */
+			mips_freelist_mask |= (1  freelist);
+
+			/*
 			 * Start where we finished.
 			 */
 			segstart = segend;
 		}
 	}
+
+	/*
+	 * Now to get the number of freelists in use.
+	 */
+	mips_nfreelist = popcount32(mips_freelist_mask);
 }
 
 /* 

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.35 src/sys/arch/mips/mips/pmap.c:1.179.16.36
--- src/sys/arch/mips/mips/pmap.c:1.179.16.35	Fri Dec 23 22:31:30 2011
+++ src/sys/arch/mips/mips/pmap.c	Thu Feb  9 03:14:45 2012
@@ -2541,7 +2541,7 @@ pmap_pv_page_free(struct pool *pp, void 
 	struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 	KASSERT(pg != NULL);
 	pmap_clear_mdpage_attributes(VM_PAGE_TO_MD(pg), PG_MD_POOLPAGE);
-	uvm_pagefree(pg);
+	uvm_km_pagefree(pg);
 }
 
 pt_entry_t *
@@ -2594,17 +2594,23 @@ pmap_prefer(vaddr_t foff, vaddr_t *vap, 
 struct vm_page *
 mips_pmap_alloc_poolpage(int flags)
 {
+	struct vm_page *pg;
 	/*
 	 * On 32bit kernels, we must make sure that we only allocate pages that
 	 * can be mapped via KSEG0.  On 64bit kernels, try to allocated from
 	 * the first 4G.  If all memory is in KSEG0/4G, then we can just
 	 * use the default freelist otherwise we must use the pool page list.
 	 */
-	if (mips_poolpage_vmfreelist != VM_FREELIST_DEFAULT)
-		return uvm_pagealloc_strat(NULL, 0, NULL, flags,
+	if (mips_poolpage_vmfreelist != VM_FREELIST_DEFAULT) {
+		pg = uvm_pagealloc_strat(NULL, 0, NULL, flags,
 		

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:35:59 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: vm_machdep.c

Log Message:
Recognize KSEGX as FIRST512M (even though it isn't in the 512M it is
conceptually part of it since it's direct-mapped).


To generate a diff of this commit:
cvs rdiff -u -r1.121.6.1.2.25 -r1.121.6.1.2.26 \
src/sys/arch/mips/mips/vm_machdep.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/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.25 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.26
--- src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.25	Thu Feb  9 03:14:45 2012
+++ src/sys/arch/mips/mips/vm_machdep.c	Thu Feb  9 03:35:59 2012
@@ -85,6 +85,12 @@ mips_page_to_pggroup(struct vm_page *pg,
 	 (mips_freelist_mask  (1  VM_FREELIST_FIRST512M))) {
 		lcv = VM_FREELIST_FIRST512M;
 	} else
+#ifdef ENABLE_MIPS_KSEGX
+	if (mips_ksegx_start = pa  pa  mips_ksegx_start + VM_KSEGX_SIZE
+	 (mips_freelist_mask  (1  VM_FREELIST_FIRST512M))) {
+		lcv = VM_FREELIST_FIRST512M;
+	} else
+#endif
 #endif
 #ifdef VM_FREELIST_FIRST4G
 	if (VM_FREELIST_FIRST4G_P(pa)



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:10:06 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c

Log Message:
When printing a stack trace, use sym+0x# so you can cp easily into gdb.


To generate a diff of this commit:
cvs rdiff -u -r1.217.12.40 -r1.217.12.41 src/sys/arch/mips/mips/trap.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:14:46 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: vmparam.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c pmap.c
pmap_segtab.c vm_machdep.c

Log Message:
Add mips_page_to_pggroup which return what pggroup a page belongs to.
Eradicate VM_FREELIST_MAX
When adding pages to the system, track what freelists get pages.


To generate a diff of this commit:
cvs rdiff -u -r1.41.28.25 -r1.41.28.26 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.205.4.1.2.1.2.62 -r1.205.4.1.2.1.2.63 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.35 -r1.179.16.36 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.121.6.1.2.24 -r1.121.6.1.2.25 \
src/sys/arch/mips/mips/vm_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:35:59 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: vm_machdep.c

Log Message:
Recognize KSEGX as FIRST512M (even though it isn't in the 512M it is
conceptually part of it since it's direct-mapped).


To generate a diff of this commit:
cvs rdiff -u -r1.121.6.1.2.25 -r1.121.6.1.2.26 \
src/sys/arch/mips/mips/vm_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  2 23:35:35 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_pcix.c

Log Message:
We use avail_clusters_cnt now.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/rmi/rmixl_pcix.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/mips/rmi/rmixl_pcix.c
diff -u src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.12 src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.13
--- src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.12	Wed Jan  4 16:17:54 2012
+++ src/sys/arch/mips/rmi/rmixl_pcix.c	Thu Feb  2 23:35:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcix.c,v 1.1.2.12 2012/01/04 16:17:54 matt Exp $	*/
+/*	rmixl_pcix.c,v 1.1.2.12 2012/01/04 16:17:54 matt Exp	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_pcix.c,v 1.1.2.12 2012/01/04 16:17:54 matt Exp $);
+__KERNEL_RCSID(0, rmixl_pcix.c,v 1.1.2.12 2012/01/04 16:17:54 matt Exp);
 
 #include opt_pci.h
 #include pci.h
@@ -331,7 +331,7 @@ rmixl_pcix_attach(device_t parent, devic
 	 * HBAR[0,1] if a 64 bit BAR pair 
 	 * must cover all RAM
 	 */
-	extern u_quad_t mem_cluster_maxaddr;
+	extern u_quad_t avail_cluster_maxaddr;
 	uint64_t hbar_addr;
 	uint64_t hbar_size;
 	uint32_t hbar_size_lo, hbar_size_hi;
@@ -348,7 +348,7 @@ rmixl_pcix_attach(device_t parent, devic
 		hbar_addr |= (uint64_t)hbar_addr_hi  32;
 		hbar_size |= (uint64_t)hbar_size_hi  32;
 	}
-	if ((hbar_addr != 0) || (hbar_size  mem_cluster_maxaddr)) {
+	if ((hbar_addr != 0) || (hbar_size  avail_cluster_maxaddr)) {
 		int error;
 
 		aprint_error_dev(self, HostBAR0 addr %#x, size %#x\n,
@@ -359,7 +359,7 @@ rmixl_pcix_attach(device_t parent, devic
 		aprint_error_dev(self, WARNING: firmware PCI-X setup error: 
 			RAM %#PRIx64..%#PRIx64 not accessible by Host BAR, 
 			enabling DMA bounce buffers\n,
-			hbar_size, mem_cluster_maxaddr-1);
+			hbar_size, avail_cluster_maxaddr-1);
 
 		/*
 		 * force use of bouce buffers for inaccessible RAM addrs



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  2 23:35:35 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_pcix.c

Log Message:
We use avail_clusters_cnt now.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/arch/mips/rmi/rmixl_pcix.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  2 00:21:00 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_machdep.c

Log Message:
Fix XLP case where we weren't copying mem_clusters to avail_clusters.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_machdep.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/mips/rmi/rmixl_machdep.c
diff -u src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.3
--- src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.2	Fri Jan 27 21:23:31 2012
+++ src/sys/arch/mips/rmi/rmixl_machdep.c	Thu Feb  2 00:21:00 2012
@@ -1122,6 +1122,8 @@ rmixlp_physaddr_dram_init(struct extent 
 	}
 
 	mem_cluster_cnt = mp - mem_clusters;
+	avail_cluster_cnt = mem_cluster_cnt;
+	memcpy(avail_clusters, mem_clusters, sizeof(avail_clusters));
 	return memsize;
 }
 #endif /* MIPS64_XLP */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-02-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  2 00:21:00 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_machdep.c

Log Message:
Fix XLP case where we weren't copying mem_clusters to avail_clusters.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-01-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 08:05:03 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c

Log Message:
Fix mm_md_direct_mapped_phys


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.61 -r1.205.4.1.2.1.2.62 \
src/sys/arch/mips/mips/mips_machdep.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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.61 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.62
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.61	Sat Jan 28 00:56:34 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Sat Jan 28 08:05:03 2012
@@ -2439,21 +2439,20 @@ bool
 mm_md_direct_mapped_phys(paddr_t pa, vaddr_t *vap)
 {
 #ifdef _LP64
-	if (MIPS_XKSEG_P(pa)) {
-		*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
-		return true;
-	}
-#endif
+	*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
+	return true;
+#else
 #ifdef ENABLE_MIPS_KSEGX
 	if (mips_ksegx_start = pa  pa  mips_ksegx_start + VM_KSEGX_SIZE) {
 		*vap = VM_KSEGX_ADDRESS + pa - mips_ksegx_start;
 		return true;
 	}
 #endif
-	if (MIPS_KSEG0_P(pa)) {
+	if (pa = MIPS_PHYS_MASK) {
 		*vap = MIPS_PHYS_TO_KSEG0(pa);
 		return true;
 	}
 	return false;
+#endif
 }
 



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-01-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 08:05:03 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c

Log Message:
Fix mm_md_direct_mapped_phys


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.61 -r1.205.4.1.2.1.2.62 \
src/sys/arch/mips/mips/mips_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-01-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 27 21:23:31 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_machdep.c

Log Message:
Keep mem_clusters as the original amount of memory and add avail_cluster
as the edited version.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_machdep.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/mips/rmi/rmixl_machdep.c
diff -u src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_machdep.c:1.1.2.1	Wed Jan  4 16:17:54 2012
+++ src/sys/arch/mips/rmi/rmixl_machdep.c	Fri Jan 27 21:23:31 2012
@@ -252,8 +252,10 @@ int	physmem;		/* Total physical memory *
 int	netboot;		/* Are we netbooting? */
 
 
+phys_ram_seg_t avail_clusters[VM_PHYSSEG_MAX];
+u_int avail_cluster_cnt;
+u_quad_t avail_cluster_maxaddr;
 phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
-u_quad_t mem_cluster_maxaddr;
 u_int mem_cluster_cnt;
 
 static uint64_t mem_clusters_init(rmixlfw_mmap_t *, rmixlfw_mmap_t *);
@@ -654,28 +656,28 @@ rmixl_mach_init_common(struct rmixl_conf
 	 */
 
 	/* reserve 0..start..kernend pages */
-	mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt,
+	avail_cluster_cnt = ram_seg_resv(avail_clusters, avail_cluster_cnt,
 		0, round_page(MIPS_KSEG0_TO_PHYS(kernend)));
 
 	/* reserve reset exception vector page */
 	/* should never be in our clusters anyway... */
-	mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt,
+	avail_cluster_cnt = ram_seg_resv(avail_clusters, avail_cluster_cnt,
 		0x1FC0, 0x1FC0+NBPG);
 
 	/* Stop this abomination */
-	mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt,
+	avail_cluster_cnt = ram_seg_resv(avail_clusters, avail_cluster_cnt,
 		0x1800, 0x2000);
 
 #ifdef MULTIPROCESSOR
 	/* reserve the cpu_wakeup_info area */
-	mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt,
+	avail_cluster_cnt = ram_seg_resv(avail_clusters, avail_cluster_cnt,
 		(u_quad_t)trunc_page((vaddr_t)rcp-rc_cpu_wakeup_info),
 		(u_quad_t)round_page((vaddr_t)rcp-rc_cpu_wakeup_end));
 #endif
 
 #ifdef MEMLIMIT
 	/* reserve everything = MEMLIMIT */
-	mem_cluster_cnt = ram_seg_resv(mem_clusters, mem_cluster_cnt,
+	avail_cluster_cnt = ram_seg_resv(avail_clusters, avail_cluster_cnt,
 		(u_quad_t)MEMLIMIT, (u_quad_t)~0);
 #endif
 
@@ -684,10 +686,10 @@ rmixl_mach_init_common(struct rmixl_conf
 	 * Now we need to reserve an aligned block of memory for pre-init
 	 * allocations so we don't deplete KSEG0.
 	 */
-	for (u_int i=0; i  mem_cluster_cnt; i++) {
+	for (u_int i=0; i  avail_cluster_cnt; i++) {
 		u_quad_t finish = round_page(
-			mem_clusters[i].start + mem_clusters[i].size);
-		u_quad_t start = roundup2(mem_clusters[i].start, VM_KSEGX_SIZE);
+			avail_clusters[i].start + avail_clusters[i].size);
+		u_quad_t start = roundup2(avail_clusters[i].start, VM_KSEGX_SIZE);
 		if (start  MIPS_PHYS_MASK  start + VM_KSEGX_SIZE = finish) {
 			mips_ksegx_start = start;
 			mips_ksegx_pte.pt_entry = mips_paddr_to_tlbpfn(start)
@@ -705,20 +707,20 @@ rmixl_mach_init_common(struct rmixl_conf
 #endif
 
 	/* get maximum RAM address from the VM clusters */
-	mem_cluster_maxaddr = 0;
-	for (u_int i=0; i  mem_cluster_cnt; i++) {
+	avail_cluster_maxaddr = 0;
+	for (u_int i=0; i  avail_cluster_cnt; i++) {
 		u_quad_t tmp = round_page(
-			mem_clusters[i].start + mem_clusters[i].size);
-		if (tmp  mem_cluster_maxaddr)
-			mem_cluster_maxaddr = tmp;
+			avail_clusters[i].start + avail_clusters[i].size);
+		if (tmp  avail_cluster_maxaddr)
+			avail_cluster_maxaddr = tmp;
 	}
-	DPRINTF(mem_cluster_maxaddr %#PRIx64\n, mem_cluster_maxaddr);
+	DPRINTF(avail_cluster_maxaddr %#PRIx64\n, avail_cluster_maxaddr);
 
 	/*
-	 * Load mem_clusters[] into the VM system.
+	 * Load avail_clusters[] into the VM system.
 	 */
 	mips_page_physload(MIPS_KSEG0_START, (vaddr_t) kernend,
-	mem_clusters, mem_cluster_cnt, fl, fl_count);
+	avail_clusters, avail_cluster_cnt, fl, fl_count);
 
 	/*
 	 * Initialize error message buffer (at end of core).
@@ -1156,6 +1158,8 @@ rmixl_physaddr_dram_init(struct extent *
 	}
 
 	mem_cluster_cnt = mp - mem_clusters;
+	avail_cluster_cnt = mem_cluster_cnt;
+	memcpy(avail_clusters, mem_clusters, sizeof(avail_clusters));
 
 	return memsize;
 }
@@ -1278,12 +1282,16 @@ rmixlfw_init(int64_t infop)
 	mem_clusters[0].start = 0;
 	mem_clusters[0].size = MEMSIZE;
 	mem_cluster_cnt = 1;
+	memcpy(avail_clusters, mem_clusters, sizeof(avail_clusters[0]));
+	avail_cluster_cnt = cnt;
 	return MEMSIZE;
 #else
 	uint64_t memsize = 0;
 	for (size_t i = 0; i  mem_cluster_cnt; i++) {
 		memsize += mem_clusters[i].size;
+		avail_clusters[i] = mem_clusters[i];
 	}
+	avail_cluster_cnt = mem_cluster_cnt;
 	if (memsize)
 		return memsize;
 
@@ -1426,6 +1434,8 @@ mem_clusters_init(
 		cnt++;
 	}
 	

CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-01-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 00:56:35 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c

Log Message:
Add mm_md_direct_mapped_phys from current.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.40 -r1.90.16.41 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.205.4.1.2.1.2.60 -r1.205.4.1.2.1.2.61 \
src/sys/arch/mips/mips/mips_machdep.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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.40 src/sys/arch/mips/include/cpu.h:1.90.16.41
--- src/sys/arch/mips/include/cpu.h:1.90.16.40	Thu Jan 19 08:28:48 2012
+++ src/sys/arch/mips/include/cpu.h	Sat Jan 28 00:56:34 2012
@@ -636,6 +636,7 @@ void	fpusave_cpu(struct cpu_info *);
 void	dumpsys(void);
 int	savectx(struct pcb *);
 void	cpu_identify(device_t, const char *);
+bool	mm_md_direct_mapped_phys(paddr_t, vaddr_t *);
 
 /* locore*.S */
 int	badaddr(void *, size_t);

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.60 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.61
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.60	Thu Jan 19 08:28:50 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Sat Jan 28 00:56:34 2012
@@ -2434,3 +2434,26 @@ mips_watchpoint_init(void)
 	curcpu()-ci_cpuwatch_count = cpuwatch_discover();
 }
 #endif
+
+bool
+mm_md_direct_mapped_phys(paddr_t pa, vaddr_t *vap)
+{
+#ifdef _LP64
+	if (MIPS_XKSEG_P(pa)) {
+		*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
+		return true;
+	}
+#endif
+#ifdef ENABLE_MIPS_KSEGX
+	if (mips_ksegx_start = pa  pa  mips_ksegx_start + VM_KSEGX_SIZE) {
+		*vap = VM_KSEGX_ADDRESS + pa - mips_ksegx_start;
+		return true;
+	}
+#endif
+	if (MIPS_KSEG0_P(pa)) {
+		*vap = MIPS_PHYS_TO_KSEG0(pa);
+		return true;
+	}
+	return false;
+}
+



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-01-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 27 21:23:31 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_machdep.c

Log Message:
Keep mem_clusters as the original amount of memory and add avail_cluster
as the edited version.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-01-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 00:56:35 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c

Log Message:
Add mm_md_direct_mapped_phys from current.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.40 -r1.90.16.41 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.205.4.1.2.1.2.60 -r1.205.4.1.2.1.2.61 \
src/sys/arch/mips/mips/mips_machdep.c

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



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 08:03:22 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixlvar.h

Log Message:
Improved true/false for cpu_rmixl?


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/arch/mips/rmi/rmixlvar.h

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/mips/rmi/rmixlvar.h
diff -u src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.25 src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.26
--- src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.25	Wed Jan  4 16:17:54 2012
+++ src/sys/arch/mips/rmi/rmixlvar.h	Thu Jan 19 08:03:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlvar.h,v 1.1.2.25 2012/01/04 16:17:54 matt Exp $	*/
+/*	$NetBSD: rmixlvar.h,v 1.1.2.26 2012/01/19 08:03:22 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -67,7 +67,11 @@ static inline bool
 cpu_rmixlr(const struct pridtab *ct)
 {
 #ifdef MIPS64_XLR
+#if (MIPS64_XLS + MIPS64_XLP) == 0
+	return true;
+#else
 	return cpu_rmixl(ct)  cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLR;
+#endif
 #else
 	return false;
 #endif
@@ -77,7 +81,11 @@ static inline bool
 cpu_rmixls(const struct pridtab *ct)
 {
 #ifdef MIPS64_XLS
+#if (MIPS64_XLR + MIPS64_XLP) == 0
+	return true;
+#else
 	return cpu_rmixl(ct)  cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLS;
+#endif
 #else
 	return false;
 #endif
@@ -87,7 +95,11 @@ static inline bool
 cpu_rmixlp(const struct pridtab *ct)
 {
 #ifdef MIPS64_XLP
+#if (MIPS64_XLR + MIPS64_XLS) == 0
+	return true;
+#else
 	return cpu_rmixl(ct)  cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLP;
+#endif
 #else
 	return false;
 #endif



  1   2   3   4   5   6   7   8   9   10   >