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/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/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/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/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/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/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/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/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/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/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/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/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



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:05:24 UTC 2012

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

Log Message:
Change struct rmixl_cpu_softc to cpu_softc and remove casts.
Fix IPIs.
More FMN cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_cpuvar.h
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_fmn.c
cvs rdiff -u -r1.1.2.34 -r1.1.2.35 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_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.23 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.24
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.23	Wed Jan  4 16:17:53 2012
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Thu Jan 19 08:05:24 2012
@@ -71,7 +71,7 @@ __KERNEL_RCSID(0, rmixl_cpu.c,v 1.1.2.2
 
 static int	cpu_rmixl_match(device_t, cfdata_t, void *);
 static void	cpu_rmixl_attach(device_t, device_t, void *);
-static void	cpu_rmixl_attach_primary(struct rmixl_cpu_softc * const);
+static void	cpu_rmixl_attach_primary(struct cpu_softc * const);
 #ifdef NOTYET
 static int	cpu_fmn_intr(void *, rmixl_fmn_rxmsg_t *);
 #endif
@@ -92,7 +92,7 @@ struct cpu_info *
 		rmixl_cpuinfo_print(u_int);
 #endif	/* DEBUG */
 
-CFATTACH_DECL_NEW(cpu_rmixl, sizeof(struct rmixl_cpu_softc),
+CFATTACH_DECL_NEW(cpu_rmixl, sizeof(struct cpu_softc),
 	cpu_rmixl_match, cpu_rmixl_attach, NULL, NULL); 
 
 #ifdef MULTIPROCESSOR
@@ -177,7 +177,7 @@ cpu_rmixl_match(device_t parent, cfdata_
 static void
 cpu_rmixl_attach(device_t parent, device_t self, void *aux)
 {
-	struct rmixl_cpu_softc * const sc = device_private(self);
+	struct cpu_softc * const sc = device_private(self);
 	struct cpu_info *ci = NULL;
 	static bool once = false;
 	extern void rmixl_spl_init_cpu(void);
@@ -252,7 +252,7 @@ cpu_rmixl_attach(device_t parent, device
  * attach the primary processor
  */
 static void
-cpu_rmixl_attach_primary(struct rmixl_cpu_softc * const sc)
+cpu_rmixl_attach_primary(struct cpu_softc * const sc)
 {
 	struct cpu_info *ci = sc-sc_ci;
 	uint32_t ebase;
@@ -286,8 +286,8 @@ cpu_rmixl_attach_primary(struct rmixl_cp
 void
 cpu_rmixl_run(struct cpu_info *ci)
 {
-	struct rmixl_cpu_softc * const sc = (void *)ci-ci_softc;
-	rmixl_fmn_init_thead();
+	struct cpu_softc * const sc = ci-ci_softc;
+	rmixl_fmn_init_thread();
 	cpucore_rmixl_run(device_parent(sc-sc_dev));
 }
 
@@ -299,7 +299,7 @@ cpu_rmixl_run(struct cpu_info *ci)
 void
 cpu_rmixl_hatch(struct cpu_info *ci)
 {
-	struct rmixl_cpu_softc * const sc = (void *)ci-ci_softc;
+	struct cpu_softc * const sc = ci-ci_softc;
 	extern void rmixl_spl_init_cpu(void);
 
 	rmixl_spl_init_cpu();	/* spl initialization for this CPU */
@@ -395,7 +395,6 @@ cpu_setup_trampoline_callback(struct cpu
 }
 #endif	/* MULTIPROCESSOR */
 
-
 #ifdef DEBUG
 void
 rmixl_cpu_data_print(struct cpu_data *dp)

Index: src/sys/arch/mips/rmi/rmixl_cpuvar.h
diff -u src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.4 src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.5
--- src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.4	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_cpuvar.h	Thu Jan 19 08:05:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpuvar.h,v 1.1.2.4 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: 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.
@@ -31,17 +31,24 @@
 #ifndef _ARCH_MIPS_RMI_RMIXL_CPUVAR_H_
 #define _ARCH_MIPS_RMI_RMIXL_CPUVAR_H_
 
+#include mips/rmi/rmixl_fmnvar.h
+
 struct rmixl_cpu_trampoline_args {
 	uint64_t	ta_sp;
 	uint64_t	ta_lwp;
 	uint64_t	ta_cpuinfo;
 };
 
-struct rmixl_cpu_softc {
+struct cpu_softc {
 	device_t sc_dev;
 	struct cpu_info *sc_ci;
+
+	void *sc_fmn_si;		/* fast messaging network softint */
+
 	struct evcnt sc_vec_evcnts[64];
 	struct evcnt sc_irt_evcnts[160];
+	struct evcnt sc_fmn_stid_evcnts[RMIXL_FMN_NSTID];
+	struct evcnt sc_fmn_cpu_evcnts[8];
 };
 
 #endif	/* _ARCH_MIPS_RMI_RMIXL_CPUVAR_H_ */

Index: src/sys/arch/mips/rmi/rmixl_fmn.c
diff -u src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.9 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.10
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.9	Wed Jan  4 16:17:53 2012
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Thu Jan 19 08:05:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_fmn.c,v 1.1.2.9 2012/01/04 16:17:53 matt Exp $	*/
+/*	$NetBSD: rmixl_fmn.c,v 1.1.2.10 2012/01/19 08:05:24 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,8 +35,8 @@
 #include sys/param.h
 #include sys/systm.h
 #include sys/cpu.h
-#include sys/percpu.h
 #include sys/atomic.h
+#include sys/intr.h
 
 #include dev/pci/pcidevs.h
 
@@ -212,9 +212,10 @@ typedef struct fmn_intrhand {
 typedef 

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:06:54 UTC 2012

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

Log Message:
Fix IPI_CTRL_MAKE for RMIXLP
Correct PCITAGs for CDE/SRIO/RXE.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/rmi/rmixlreg.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/rmixlreg.h
diff -u src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.19 src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.20
--- src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.19	Wed Jan  4 16:17:54 2012
+++ src/sys/arch/mips/rmi/rmixlreg.h	Thu Jan 19 08:06:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlreg.h,v 1.1.2.19 2012/01/04 16:17:54 matt Exp $	*/
+/*	$NetBSD: rmixlreg.h,v 1.1.2.20 2012/01/19 08:06:54 matt Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -1230,9 +1230,9 @@
 #define	RMIXLP_DMA_PCITAG		_RMIXL_PCITAG(0,5,0)
 #define	RMIXLP_SAE_PCITAG		_RMIXL_PCITAG(0,5,1)
 #define	RMIXLP_PKE_PCITAG		_RMIXL_PCITAG(0,5,2)
-#define	RMIXLP_CDE_PCITAG		_RMIXL_PCITAG(0,5,3)	// 8xx/4xx
-#define	RMIXLP_SRIO_PCITAG		_RMIXL_PCITAG(0,5,3)	// 3xx
-#define	RMIXLP_RXE_PCITAG		_RMIXL_PCITAG(0,5,4)
+#define	RMIXLP_CDE_PCITAG		_RMIXL_PCITAG(0,5,3)
+#define	RMIXLP_SRIO_PCITAG		_RMIXL_PCITAG(0,5,4)
+#define	RMIXLP_RXE_PCITAG		_RMIXL_PCITAG(0,5,5)
 
 #define	RMIXLP_UART1_PCITAG		_RMIXL_PCITAG(0,6,0)
 #define	RMIXLP_UART2_PCITAG		_RMIXL_PCITAG(0,6,1)
@@ -1249,8 +1249,11 @@
 /*
  * PCI PCIe control (contains the IRT info)
  */
+#define	PCI_RMIXLP_OQCOUNT		_RMIXL_OFFSET(0x30)
+#define	PCI_RMIXLP_POE_FLOWS		_RMIXL_OFFSET(0x30)
 #define	PCI_RMIXLP_ONCHIP		_RMIXL_OFFSET(0x31)
 #define	PCI_RMIXLP_OFFCHIP		_RMIXL_OFFSET(0x32)
+#define	PCI_RMIXLP_CONTEXTS		_RMIXL_OFFSET(0x35)
 #define	PCI_RMIXLP_STATID		_RMIXL_OFFSET(0x3c)
 #define	PCI_RMIXLP_IRTINFO		_RMIXL_OFFSET(0x3d)
 
@@ -1494,7 +1497,7 @@
 #define	RMIXLP_PIC_IPI_CTRL_DT		__BITS(15,0)	/* Dest Thread Enbs */
 #define	RMIXLP_PIC_IPI_CTRL_MAKE(nmi, tmask, tag)		\
 	(__SHIFTIN((nmi), RMIXLP_PIC_IPI_CTRL_NMI)		\
-	 | __SHIFTIN((tag), RMIXL_PIC_IPI_CTRL_RIV)		\
+	 | __SHIFTIN((tag), RMIXLP_PIC_IPI_CTRL_RIV)		\
 	 | __SHIFTIN((tmask), RMIXLP_PIC_IPI_CTRL_DT))
 
 /*



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 09:59:08 UTC 2012

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

Log Message:
Add more function prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 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.6 src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.7
--- src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.6	Wed Jan  4 16:17:53 2012
+++ src/sys/arch/mips/rmi/rmixl_fmnvar.h	Thu Jan 19 09:59:08 2012
@@ -1,4 +1,4 @@
-/*	$Id: rmixl_fmnvar.h,v 1.1.2.6 2012/01/04 16:17:53 matt Exp $	*/
+/*	$Id: rmixl_fmnvar.h,v 1.1.2.7 2012/01/19 09:59:08 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,6 +31,7 @@
 #ifndef _ARCH_MIPS_RMIXL_RMIXL_FMNVAR_H_
 #define _ARCH_MIPS_RMIXL_RMIXL_FMNVAR_H_
 
+#include sys/cpu.h
 #include mips/cpuregs.h
 
 #define RMIXL_FMN_CODE_PSB_WAKEUP	200	/* firmware MSGRNG_CODE_BOOT_WAKEUP */
@@ -346,11 +347,17 @@ rmixl_cp2_restore(uint32_t ocu)
 
 typedef int (*rmixl_fmn_intr_handler_t)(void *, rmixl_fmn_rxmsg_t *);
 
+void	rmixl_fmn_cpu_attach(struct cpu_info *ci);
 void	rmixl_fmn_init(void);
 void	rmixl_fmn_init_thread(void);
 void *	rmixl_fmn_intr_establish(size_t, rmixl_fmn_intr_handler_t, void *);
 void	rmixl_fmn_intr_disestablish(void *);
 void	rmixl_fmn_intr_poll(u_int, rmixl_fmn_rxmsg_t *);
+
+size_t	rmixl_fmn_qid_to_stid(size_t);
+const char *
+	rmixl_fmn_stid_name(size_t);
+
 /*
  * true == succes, false = failure
  */



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 10:24:52 UTC 2012

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

Log Message:
Fix config ifattr.


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.2 -r1.3.8.3 src/sys/arch/mips/rmi/rmixl_iobus.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_usbi.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_iobus.c
diff -u src/sys/arch/mips/rmi/rmixl_iobus.c:1.3.8.2 src/sys/arch/mips/rmi/rmixl_iobus.c:1.3.8.3
--- src/sys/arch/mips/rmi/rmixl_iobus.c:1.3.8.2	Tue Dec 27 19:58:19 2011
+++ src/sys/arch/mips/rmi/rmixl_iobus.c	Thu Jan 19 10:24:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_iobus.c,v 1.3.8.2 2011/12/27 19:58:19 matt Exp $	*/
+/*	$NetBSD: rmixl_iobus.c,v 1.3.8.3 2012/01/19 10:24:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_iobus.c,v 1.3.8.2 2011/12/27 19:58:19 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_iobus.c,v 1.3.8.3 2012/01/19 10:24:52 matt Exp $);
 
 #include locators.h
 
@@ -161,7 +161,7 @@ rmixl_iobus_obio_attach(device_t parent,
 	rmixl_iobus_csconfig_init(sc);
 
 	/* attach any children */
-	config_search_ia(rmixl_iobus_search, self, rmixl_iobus, NULL);
+	config_search_ia(rmixl_iobus_search, self, xliobus, NULL);
 }
 
 static void

Index: src/sys/arch/mips/rmi/rmixl_usbi.c
diff -u src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.10 src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.11
--- src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.10	Sat Dec 31 08:20:43 2011
+++ src/sys/arch/mips/rmi/rmixl_usbi.c	Thu Jan 19 10:24:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_usbi.c,v 1.1.2.10 2011/12/31 08:20:43 matt Exp $	*/
+/*	rmixl_usbi.c,v 1.1.2.10 2011/12/31 08:20:43 matt Exp	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_usbi.c,v 1.1.2.10 2011/12/31 08:20:43 matt Exp $);
+__KERNEL_RCSID(0, rmixl_usbi.c,v 1.1.2.10 2011/12/31 08:20:43 matt Exp);
 
 #include locators.h
 
@@ -163,7 +163,7 @@ rmixl_usbi_attach(device_t parent, devic
 	aprint_normal(\n);
 
 	/* attach any children */
-	config_search_ia(rmixl_usbi_search, self, rmixl_usbi, NULL);
+	config_search_ia(rmixl_usbi_search, self, xlusbi, NULL);
 }
 
 static int



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 10:29:34 UTC 2012

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

Log Message:
Unbreak things so that XLS/XLR boot again. :)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_fmn.c
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 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_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.24 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.25
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.24	Thu Jan 19 08:05:24 2012
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Thu Jan 19 10:29:34 2012
@@ -245,7 +245,9 @@ cpu_rmixl_attach(device_t parent, device
 
 	aprint_normal(\n);
 
-cpu_attach_common(self, ci);
+	rmixl_fmn_cpu_attach(ci);
+
+	cpu_attach_common(self, ci);
 }
 
 /*

Index: src/sys/arch/mips/rmi/rmixl_fmn.c
diff -u src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.10 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.11
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.10	Thu Jan 19 08:05:24 2012
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Thu Jan 19 10:29:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_fmn.c,v 1.1.2.10 2012/01/19 08:05:24 matt Exp $	*/
+/*	rmixl_fmn.c,v 1.1.2.10 2012/01/19 08:05:24 matt Exp	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -638,7 +638,7 @@ fmn_init_noncore_xlrxls(fmn_info_t *fmn)
 static void
 fmn_init_thread_xlrxls(fmn_info_t *fmn)
 {
-	const fmn_station_info_t *si = fmn-fmn_stinfo;
+	const fmn_station_info_t *si = fmn-fmn_stinfo + 1;
 	uint32_t sts1;
 	uint32_t cfg;
 
@@ -780,7 +780,9 @@ rmixl_fmn_cpu_attach(struct cpu_info *ci
 	struct cpu_softc * const sc = ci-ci_softc;
 
 	KASSERT(sc-sc_fmn_si == NULL);
-	sc-sc_fmn_si = softint_establish(SOFTINT_NET, fmn_softint, sc);
+	sc-sc_fmn_si = softint_establish(SOFTINT_NET|SOFTINT_MPSAFE,
+	fmn_softint, sc);
+	KASSERT(sc-sc_fmn_si != NULL);
 
 	KASSERT(sc-sc_dev != NULL);
 
@@ -937,6 +939,7 @@ fmn_intr(void *arg)
 	const bool is_xlp_p = cpu_rmixlp(mips_options.mips_cpu);
 	struct cpu_softc * const sc = curcpu()-ci_softc;
 
+	KASSERT(sc-sc_fmn_si != NULL);
 	softint_schedule(sc-sc_fmn_si);
 	if (!is_xlp_p) {
 		/*

Index: src/sys/arch/mips/rmi/rmixl_fmnvar.h
diff -u src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.7 src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.8
--- src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.1.2.7	Thu Jan 19 09:59:08 2012
+++ src/sys/arch/mips/rmi/rmixl_fmnvar.h	Thu Jan 19 10:29:34 2012
@@ -1,4 +1,4 @@
-/*	$Id: rmixl_fmnvar.h,v 1.1.2.7 2012/01/19 09:59:08 matt Exp $	*/
+/*	rmixl_fmnvar.h,v 1.1.2.7 2012/01/19 09:59:08 matt Exp	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -230,7 +230,6 @@ rmixl_cp2_enable(void)
 	uint32_t rv;
 	uint32_t sr;
 
-	KASSERT(curcpu()-ci_cpl == IPL_HIGH);
 	__asm volatile(
 		.set push			\n\t
 		.set noreorder		\n\t
@@ -253,7 +252,6 @@ rmixl_cp2_restore(uint32_t ocu)
 {
 	uint32_t cu2;
 
-	KASSERT(curcpu()-ci_cpl == IPL_HIGH);
 	__asm volatile(
 		.set push			\n\t
 		.set noreorder		\n\t



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 17:29:23 UTC 2012

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

Log Message:
Enable interrupts (even though they are not yet used).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_i2c_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_i2c_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_i2c_pci.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2c_pci.c:1.1.2.3
--- src/sys/arch/mips/rmi/rmixl_i2c_pci.c:1.1.2.2	Tue Dec 27 19:57:18 2011
+++ src/sys/arch/mips/rmi/rmixl_i2c_pci.c	Thu Jan 19 17:29:23 2012
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_i2c_pci.c,v 1.1.2.2 2011/12/27 19:57:18 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_i2c_pci.c,v 1.1.2.3 2012/01/19 17:29:23 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -54,17 +54,16 @@ int xli2c_debug = 0;
 #define	DPRINTF(x)
 #endif
 
-static int xli2c_pci_match(device_t, cfdata_t, void *);
-static void xli2c_pci_attach(device_t, device_t, void *);
+static int	xli2c_pci_match(device_t, cfdata_t, void *);
+static void	xli2c_pci_attach(device_t, device_t, void *);
 
-static int  xli2c_acquire_bus(void *, int);
-static void xli2c_release_bus(void *, int);
-static int  xli2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
-		void *, size_t, int);
-#if 0
-static int  xli2c_intr(void *);
-#endif
-static int  xli2c_wait_for_command(struct xli2c_softc *, uint8_t);
+static int	xli2c_acquire_bus(void *, int);
+static void	xli2c_release_bus(void *, int);
+static int	xli2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
+		void *, size_t, int);
+
+static int	xli2c_intr(void *);
+static int	xli2c_wait_for_command(struct xli2c_softc *, uint8_t);
 
 static inline uint8_t
 xli2c_read_status(struct xli2c_softc *sc)
@@ -159,7 +158,6 @@ xli2c_pci_attach(device_t parent, device
 	/* MMM MAGIC */
 	xli2c_write_prescale(sc, rmixl_i2c_calc_prescale(1, 10));
 
-#if 0
 	pci_intr_handle_t pcih;
 
 	pci_intr_map(pa, pcih);
@@ -170,7 +168,6 @@ xli2c_pci_attach(device_t parent, device
 		const char * const intrstr = pci_intr_string(pa-pa_pc, pcih);
 		aprint_normal_dev(self, interrupting at %s\n, intrstr);
 	}
-#endif
 
 	memset(iba, 0, sizeof(iba));
 	iba.iba_tag = sc-sc_i2c;
@@ -201,7 +198,6 @@ xli2c_release_bus(void *v, int flags)
 	mutex_exit(sc-sc_buslock);
 }
 
-#if 0
 static int
 xli2c_intr(void *v)
 {
@@ -211,7 +207,6 @@ xli2c_intr(void *v)
 
 	return 0;
 }
-#endif
 
 /* send a command and busy wait for the byte data transfer to complete */
 static int



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 17:32:48 UTC 2012

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

Log Message:
KX needs to be enabled for n32


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/rmi/rmixl_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/rmi/rmixl_subr.S
diff -u src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.11 src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.12
--- src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.11	Tue Dec  6 17:44:46 2011
+++ src/sys/arch/mips/rmi/rmixl_subr.S	Thu Jan 19 17:32:48 2012
@@ -132,7 +132,7 @@ END(rmixlfw_wakeup_cpu)
  * rmixl_cpu_trampoline - entry point for subordinate (non-#0) CPU wakeup
  */
 NESTED(rmixl_cpu_trampoline, CALLFRAME_SIZ, ra)
-#ifdef _LP64
+#ifndef __mips_o32
 	/*
 	 * reconstruct trampoline args addr:
 	 * sign-extend 32 bit KSEG0 address in a0



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 17:34:18 UTC 2012

Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_cde_pci.c
rmixl_fmn_pci.c rmixl_pke_pci.c rmixl_rxe_pci.c rmixl_srio_pci.c

Log Message:
PCI attachments (mostly stubs) for most XLP devices.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_cde_pci.c \
src/sys/arch/mips/rmi/rmixl_fmn_pci.c \
src/sys/arch/mips/rmi/rmixl_pke_pci.c \
src/sys/arch/mips/rmi/rmixl_rxe_pci.c \
src/sys/arch/mips/rmi/rmixl_srio_pci.c

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

Added files:

Index: src/sys/arch/mips/rmi/rmixl_cde_pci.c
diff -u /dev/null src/sys/arch/mips/rmi/rmixl_cde_pci.c:1.1.2.1
--- /dev/null	Thu Jan 19 17:34:18 2012
+++ src/sys/arch/mips/rmi/rmixl_cde_pci.c	Thu Jan 19 17:34:18 2012
@@ -0,0 +1,133 @@
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__KERNEL_RCSID(1, $NetBSD: rmixl_cde_pci.c,v 1.1.2.1 2012/01/19 17:34:18 matt Exp $);
+
+#include sys/param.h
+#include sys/device.h
+#include sys/bus.h
+
+#include locators.h
+
+#include dev/pci/pcireg.h
+#include dev/pci/pcivar.h
+#include dev/pci/pcidevs.h
+
+#include mips/rmi/rmixlreg.h
+#include mips/rmi/rmixlvar.h
+
+#include locators.h
+
+#ifdef DEBUG
+int xlcde_debug = 0;
+#define	DPRINTF(x, ...)	do { if (xlcde_debug) printf(x, ## __VA_ARGS__); } while (0)
+#else
+#define	DPRINTF(x)
+#endif
+
+static	int xlcde_pci_match(device_t, cfdata_t, void *);
+static	void xlcde_pci_attach(device_t, device_t, void *);
+static	int xlcde_intr(void *);
+
+struct	xlcde_softc {
+	device_t sc_dev;
+	pci_chipset_tag_t sc_pc;
+	pcitag_t sc_tag;
+	bus_space_tag_t sc_bst;
+	bus_space_handle_t sc_bsh;
+};
+
+CFATTACH_DECL_NEW(xlcde_pci, sizeof(struct xlcde_softc),
+xlcde_pci_match, xlcde_pci_attach, NULL, NULL);
+
+static int
+xlcde_pci_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct pci_attach_args * const pa = aux;
+
+	if (pa-pa_id == PCI_ID_CODE(PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_CDE))
+		return 1;
+
+return 0;
+}
+
+static void
+xlcde_pci_attach(device_t parent, device_t self, void *aux)
+{
+	struct rmixl_config * const rcp = rmixl_configuration;
+	struct pci_attach_args * const pa = aux;
+	struct xlcde_softc * const sc = device_private(self);
+
+	sc-sc_dev = self;
+	sc-sc_bst = rcp-rc_pci_ecfg_eb_memt;
+	sc-sc_pc = pa-pa_pc;
+	sc-sc_tag = pa-pa_tag;
+
+	/*
+	 * Why isn't this accessible via a BAR?
+	 */
+	if (bus_space_subregion(sc-sc_bst, rcp-rc_pci_ecfg_eb_memh,
+		pa-pa_tag, 0, sc-sc_bsh)) {
+		aprint_error(: can't map registers\n);
+		return;
+	}
+
+	aprint_naive(: XLP CDE Controller\n);
+	aprint_normal(: XLP Compression/Decompression Engine\n);
+
+	const pcireg_t statinfo = pci_conf_read(sc-sc_pc, sc-sc_tag,
+	PCI_RMIXLP_STATID);
+
+	const size_t stid_start = PCI_RMIXLP_STATID_BASE(statinfo);
+	const size_t stid_count = PCI_RMIXLP_STATID_COUNT(statinfo);
+	if (stid_count) {
+		aprint_normal_dev(sc-sc_dev, %zu station%s starting at %zu\n,
+		stid_count, (stid_count == 1 ?  : s), stid_start);
+	}
+
+	pci_intr_handle_t pcih;
+	pci_intr_map(pa, pcih);
+
+	if (pci_intr_establish(pa-pa_pc, pcih, IPL_VM, xlcde_intr, sc) == NULL) {
+		aprint_error_dev(self, failed to establish interrupt\n);
+	} else {
+		const char * const intrstr = pci_intr_string(pa-pa_pc, pcih);
+		aprint_normal_dev(self, interrupting at 

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 18:26:15 UTC 2012

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

Log Message:
Fix CFATTACH_DECL_NEW so kernels build again.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_nae.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_nae.c
diff -u src/sys/arch/mips/rmi/rmixl_nae.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_nae.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_nae.c:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_nae.c	Thu Jan 19 18:26:15 2012
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_nae.c,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_nae.c,v 1.1.2.2 2012/01/19 18:26:15 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -39,7 +39,11 @@ __KERNEL_RCSID(1, $NetBSD: rmixl_nae.c,
 static int nae_match(device_t, cfdata_t, void *);
 static void nae_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(nae, 0,
+struct nae_gmac_softc {
+	device_t sc_dev;
+};
+
+CFATTACH_DECL_NEW(nae_gmac, sizeof(struct nae_gmac_softc),
 nae_match, nae_attach, 0, 0);
 
 static int



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.



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:05:24 UTC 2012

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

Log Message:
Change struct rmixl_cpu_softc to cpu_softc and remove casts.
Fix IPIs.
More FMN cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_cpuvar.h
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_fmn.c
cvs rdiff -u -r1.1.2.34 -r1.1.2.35 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/rmi

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

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

Log Message:
Fix IPI_CTRL_MAKE for RMIXLP
Correct PCITAGs for CDE/SRIO/RXE.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/rmi/rmixlreg.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-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 09:59:08 UTC 2012

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

Log Message:
Add more function prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 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/rmi

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 10:24:52 UTC 2012

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

Log Message:
Fix config ifattr.


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.2 -r1.3.8.3 src/sys/arch/mips/rmi/rmixl_iobus.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_usbi.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 10:29:34 UTC 2012

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

Log Message:
Unbreak things so that XLS/XLR boot again. :)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_fmn.c
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 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/rmi

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 17:28:51 UTC 2012

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

Log Message:
Fix percpu usage.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 17:29:23 UTC 2012

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

Log Message:
Enable interrupts (even though they are not yet used).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_i2c_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

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 17:32:48 UTC 2012

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

Log Message:
KX needs to be enabled for n32


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/rmi/rmixl_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/rmi

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 17:34:18 UTC 2012

Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_cde_pci.c
rmixl_fmn_pci.c rmixl_pke_pci.c rmixl_rxe_pci.c rmixl_srio_pci.c

Log Message:
PCI attachments (mostly stubs) for most XLP devices.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_cde_pci.c \
src/sys/arch/mips/rmi/rmixl_fmn_pci.c \
src/sys/arch/mips/rmi/rmixl_pke_pci.c \
src/sys/arch/mips/rmi/rmixl_rxe_pci.c \
src/sys/arch/mips/rmi/rmixl_srio_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

2012-01-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 17:35:58 UTC 2012

Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_poe_pci.c rmixl_poereg.h
rmixl_sae_pci.c

Log Message:
PCI attachments (mostly stubs) for some XLP devices.
POE = Packet Ordering Engine
SAE = Security Acceleration Engine


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_poe_pci.c \
src/sys/arch/mips/rmi/rmixl_poereg.h \
src/sys/arch/mips/rmi/rmixl_sae_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

2012-01-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 07:58:58 UTC 2012

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

Log Message:
Add missing arg.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/rmi/rmixl_cpucore.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_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.13 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.14
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.13	Wed Jan  4 16:17:53 2012
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Thu Jan 19 07:58:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.13 2012/01/04 16:17:53 matt Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.14 2012/01/19 07:58:58 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.1.2.13 2012/01/04 16:17:53 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.1.2.14 2012/01/19 07:58:58 matt Exp $);
 
 #include opt_multiprocessor.h
 
@@ -233,7 +233,7 @@ cpucore_rmixl_hatch(device_t self)
 	if (sc-sc_hatched == false) {
 		/* PCRs for core#0 are set up in mach_init() */
 		if (sc-sc_core != 0)
-			rmixl_pcr_init_core();
+			rmixl_pcr_init_core(cpu_rmixlp(mips_options.mips_cpu));
 		sc-sc_hatched = true;
 	}
 }



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

2012-01-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jan 19 07:58:58 UTC 2012

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

Log Message:
Add missing arg.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/rmi/rmixl_cpucore.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-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jan  9 22:03:13 UTC 2012

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

Log Message:
Use a map of bar0 sizes instead of a switch statement.
Return the proper IRT entry for the 2nd i2c controller.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 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.

Modified files:

Index: src/sys/arch/mips/rmi/rmixlp_pcie.c
diff -u src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.7 src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.8
--- src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.7	Wed Jan  4 16:17:54 2012
+++ src/sys/arch/mips/rmi/rmixlp_pcie.c	Mon Jan  9 22:03:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.7 2012/01/04 16:17:54 matt Exp $	*/
+/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.8 2012/01/09 22:03:13 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.7 2012/01/04 16:17:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.8 2012/01/09 22:03:13 matt Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -132,6 +132,8 @@ static struct rmixlp_pcie_softc {
 		[RMIXLP_PCITAG_IDX(RMIXLP_NAE_PCITAG)] = 4-0x2,
 		[RMIXLP_PCITAG_IDX(RMIXLP_POE_PCITAG)] = 4-0x2000,
 		[RMIXLP_PCITAG_IDX(RMIXLP_AHCI_PCITAG)] = 4-0x400,
+		[RMIXLP_PCITAG_IDX(RMIXLP_FMN_PCITAG)] = 4-0x4000,
+		[RMIXLP_PCITAG_IDX(RMIXLP_SRIO_PCITAG)] = 4-0x2,
 	},
 };
 
@@ -962,49 +964,22 @@ rmixlp_pcie_conf_read(void *v, pcitag_t 
 	 offset == 0x60)
 		offset = 0x100;
 
+	/*
+	 * I2C incorrectly reports the wrong IRT for the 2nd I2C controller
+	 * so correct it here.
+	 */
+	if (tag == RMIXLP_I2C2_PCITAG  offset == PCI_RMIXLP_IRTINFO)
+		return 0x00010088;
+
 	if (_RMIXL_PCITAG_BUS(tag) == 0  (_RMIXL_PCITAG_DEV(tag)  7)  0) {
-		if (tag == sc-sc_mapprobe) {
-			if (offset == PCI_MAPREG_START + 4) {
-aprint_debug_dev(sc-sc_dev,
-tag %#lx reg %#x: %#x\n,
-tag, offset, 0x);
-return 0x;
-			}
-#if 0
-			return sc-sc_bus0_bar0_sizes[RMIXLP_PCITAG_IDX(tag)];
-#else
-			switch (_RMIXL_PCITAG_DEV(tag)) {
-			case _RMIXL_PCITAG_DEV(RMIXLP_EHCI0_PCITAG):
-rv = 4-0x400;
-break;
-			case _RMIXL_PCITAG_DEV(RMIXLP_NAE_PCITAG):
-switch (_RMIXL_PCITAG_FUNC(tag)) {
-case _RMIXL_PCITAG_FUNC(RMIXLP_NAE_PCITAG):
-	rv = 4-0x2;
-	break;
-case _RMIXL_PCITAG_FUNC(RMIXLP_POE_PCITAG):
-	rv = 4-0x2000;
-	break;
-case _RMIXL_PCITAG_FUNC(RMIXLP_AHCI_PCITAG):
-	rv = 4-0x400;
-	break;
-default:
-	rv = 0x;
-	break;
-}
-break;
-			case _RMIXL_PCITAG_DEV(RMIXLP_FMN_PCITAG):
-rv = 4-0x4000;
-break;
-			default:
-rv = 0x;
-break;
-			}
+		if (tag == sc-sc_mapprobe  (offset  -8) == PCI_BAR0) {
+			rv = (offset == PCI_BAR0)
+			? sc-sc_bus0_bar0_sizes[RMIXLP_PCITAG_IDX(tag)]
+			: 0x;
 			aprint_debug_dev(sc-sc_dev,
 			conf_read: tag %#lx reg %#x: %#x\n,
 			tag, offset, rv);
 			return rv;
-#endif
 		}
 	}
 



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

2012-01-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jan  9 22:03:13 UTC 2012

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

Log Message:
Use a map of bar0 sizes instead of a switch statement.
Return the proper IRT entry for the 2nd i2c controller.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 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

2011-12-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 08:20:43 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_com.c rmixl_gpio_pci.c
rmixl_intr.c rmixl_intr.h rmixl_obio.c rmixl_pcie.c rmixl_pcix.c
rmixl_usbi.c rmixlp_pcie.c

Log Message:
Switch to using IST_foo instead of private enums.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixl_com.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_intr.h \
src/sys/arch/mips/rmi/rmixl_pcix.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixl_obio.c
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/rmi/rmixl_pcie.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_usbi.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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.

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_com.c
diff -u src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.16 src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.17
--- src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.16	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_com.c	Sat Dec 31 08:20:43 2011
@@ -1,4 +1,4 @@
-/* $Id: rmixl_com.c,v 1.1.2.16 2011/12/24 01:57:54 matt Exp $ */
+/* $Id: rmixl_com.c,v 1.1.2.17 2011/12/31 08:20:43 matt Exp $ */
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_com.c,v 1.1.2.16 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_com.c,v 1.1.2.17 2011/12/31 08:20:43 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -214,9 +214,8 @@ rmixl_com_attach(device_t parent, device
 
 	com_attach_subr(sc);
 
-	rmixl_intr_establish(obio-obio_intr,
-		IPL_VM, RMIXL_TRIG_LEVEL, RMIXL_POLR_HIGH,
-		comintr, sc, true);
+	rmixl_intr_establish(obio-obio_intr, IPL_VM, IST_LEVEL_HIGH,
+	comintr, sc, true);
 
 }
 

Index: src/sys/arch/mips/rmi/rmixl_gpio_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.3 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.4
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.3	Sat Dec 31 04:30:52 2011
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Sat Dec 31 08:20:43 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.3 2011/12/31 04:30:52 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.4 2011/12/31 08:20:43 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -303,8 +303,7 @@ xlgpio_pci_attach(device_t parent, devic
 	for (size_t ipl = IPL_VM; ipl = IPL_HIGH ; ipl++) {
 		const size_t irt = ipl - IPL_VM;
 		if (rmixl_intr_establish(irtstart + irt, ipl,
-		RMIXL_TRIG_LEVEL, RMIXL_POLR_HIGH,
-		xlgpio_intrs[irt], sc, true) == NULL)
+		IST_LEVEL_HIGH, xlgpio_intrs[irt], sc, true) == NULL)
 			panic(%s: failed to establish interrupt %zu,
 			__func__, irtstart + irt);
 	}

Index: src/sys/arch/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.32 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.33
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.32	Sat Dec 31 07:53:12 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Sat Dec 31 08:20:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.32 2011/12/31 07:53:12 matt Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.33 2011/12/31 08:20:43 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.32 2011/12/31 07:53:12 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.33 2011/12/31 08:20:43 matt Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -726,8 +726,7 @@ static int rmixl_pic_init_done;
 static uint32_t rmixl_irt_thread_mask(__cpuset_t);
 static void rmixl_irt_init(size_t);
 static void rmixl_irt_disestablish(size_t);
-static void rmixl_irt_establish(size_t, size_t,
-		rmixl_intr_trigger_t, rmixl_intr_polarity_t);
+static void rmixl_irt_establish(size_t, size_t, int);
 static size_t rmixl_intr_get_vec(int);
 
 #ifdef MULTIPROCESSOR
@@ -1082,8 +1081,7 @@ rmixl_irt_disestablish(size_t irt)
  * - construct an IRT Entry for irt and write to PIC
  */
 static void
-rmixl_irt_establish(size_t irt, size_t vec, rmixl_intr_trigger_t trigger,
-	rmixl_intr_polarity_t polarity)
+rmixl_irt_establish(size_t irt, size_t vec, int ist)
 {
 	const bool is_xlp_p = cpu_rmixlp(mips_options.mips_cpu);
 
@@ -1093,22 +1091,14 @@ rmixl_irt_establish(size_t irt, size_t v
 		panic(%s: bad irt %zu\n, __func__, irt);
 
 	/*
-	 * All XLP interrupt are level.
+	 * All XLP interrupt are level (high).
 	 */
-	if (trigger != RMIXL_TRIG_LEVEL
-	 (is_xlp_p || trigger != 

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

2011-12-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 08:20:43 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_com.c rmixl_gpio_pci.c
rmixl_intr.c rmixl_intr.h rmixl_obio.c rmixl_pcie.c rmixl_pcix.c
rmixl_usbi.c rmixlp_pcie.c

Log Message:
Switch to using IST_foo instead of private enums.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixl_com.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_intr.h \
src/sys/arch/mips/rmi/rmixl_pcix.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixl_obio.c
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/rmi/rmixl_pcie.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_usbi.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 03:33:13 UTC 2011

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

Log Message:
Fix xlgpio_pin_ctl inversion problem.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 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.1 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.1	Fri Dec 30 06:48:55 2011
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Sat Dec 31 03:33:13 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.1 2011/12/30 06:48:55 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.2 2011/12/31 03:33:13 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -100,7 +100,7 @@ struct xlgpio_intrpin {
 #define	PINGROUP	(PINMASK+1)
 #define	PIN_GROUP(pin)	((pin) / PINGROUP)
 #define	PIN_SELECT(pin)	((pin)  PINMASK)
-#define	PIN_MASK(pin)	(1  ((pin)  PINMASK))
+#define	PIN_MASK(pin)	(1  PIN_SELECT(pin))
 
 struct xlgpio_softc {
 	device_t sc_dev;
@@ -493,7 +493,7 @@ xlgpio_pin_write(void *arg, int pin, int
 {
 	struct xlgpio_softc * const sc = arg;
 	struct xlgpio_group * const gg = sc-sc_groups[PIN_GROUP(pin)];
-	const uint32_t mask = 1  (pin  PINMASK);
+	const uint32_t mask = PIN_MASK(pin);
 
 	mutex_enter(sc-sc_pin_lock);
 
@@ -515,23 +515,25 @@ static void
 xlgpio_pin_ctl(void *arg, int pin, int flags)
 {
 	struct xlgpio_softc * const sc = arg;
-	const bus_size_t r_padoe = RMIXLP_GPIO_PADOE(pin / PINGROUP);
-	const uint32_t mask = 1  (pin  PINMASK);
+	struct xlgpio_group * const gg = sc-sc_groups[PIN_GROUP(pin)];
+	const uint32_t mask = PIN_MASK(pin);
 
 	mutex_enter(sc-sc_pin_lock);
 
 	KASSERT(pin  sc-sc_pincnt);
 
-	const uint32_t old = xlgpio_read_4(sc, r_padoe);
-	uint32_t new;
+	uint32_t new_padoe;
 
 	switch (flags  (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) {
-	case GPIO_PIN_INPUT:	new = old | mask; break;
-	case GPIO_PIN_OUTPUT:	new = old  ~mask; break;
-	default:		new = old;
+	case GPIO_PIN_OUTPUT:	new_padoe = gg-gg_padoe | mask; break;
+	case GPIO_PIN_INPUT:	new_padoe = gg-gg_padoe  ~mask; break;
+	default:		new_padoe = gg-gg_padoe;
+	}
+
+	if (gg-gg_padoe != new_padoe) {
+		gg-gg_padoe = new_padoe;
+		xlgpio_write_4(sc, gg-gg_r_padoe, gg-gg_padoe);
 	}
-	if (old != new)
-		xlgpio_write_4(sc, r_padoe, new);
 
 	mutex_exit(sc-sc_pin_lock);
 }



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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:30:53 UTC 2011

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

Log Message:
Deal with the movement of some GPIO registers on the XPL3xx.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixlreg.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_gpio_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.3
--- src/sys/arch/mips/rmi/rmixl_gpio_pci.c:1.1.2.2	Sat Dec 31 03:33:13 2011
+++ src/sys/arch/mips/rmi/rmixl_gpio_pci.c	Sat Dec 31 04:30:52 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.2 2011/12/31 03:33:13 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_gpio_pci.c,v 1.1.2.3 2011/12/31 04:30:52 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -151,9 +151,9 @@ static struct xlgpio_softc xlgpio_sc = {
 [2] = RMIXLP_GPIO_INTEN(2, 0),
 [3] = RMIXLP_GPIO_INTEN(3, 0),
 			},
-			.gg_r_intpol = RMIXLP_GPIO_INTPOL(0),
-			.gg_r_inttype = RMIXLP_GPIO_INTTYPE(0),
-			.gg_r_intstat = RMIXLP_GPIO_INTSTAT(0),
+			.gg_r_intpol = RMIXLP_GPIO_8XX_INTPOL(0),
+			.gg_r_inttype = RMIXLP_GPIO_8XX_INTTYPE(0),
+			.gg_r_intstat = RMIXLP_GPIO_8XX_INTSTAT(0),
 		},
 		[1] = {
 			.gg_pins = xlgpio_sc.sc_pins + PINGROUP,
@@ -166,9 +166,9 @@ static struct xlgpio_softc xlgpio_sc = {
 [2] = RMIXLP_GPIO_INTEN(2, 1),
 [3] = RMIXLP_GPIO_INTEN(3, 1),
 			},
-			.gg_r_intpol = RMIXLP_GPIO_INTPOL(1),
-			.gg_r_inttype = RMIXLP_GPIO_INTTYPE(1),
-			.gg_r_intstat = RMIXLP_GPIO_INTSTAT(1),
+			.gg_r_intpol = RMIXLP_GPIO_8XX_INTPOL(1),
+			.gg_r_inttype = RMIXLP_GPIO_8XX_INTTYPE(1),
+			.gg_r_intstat = RMIXLP_GPIO_8XX_INTSTAT(1),
 		},
 	},
 	.sc_gpio_chipset = {
@@ -266,10 +266,18 @@ xlgpio_pci_attach(device_t parent, devic
 		KASSERT(gg-gg_inttype == 0);
 
 		/*
+		 * These are at different offsets on the 3xx than the 8xx/4xx.
+		 */
+		if (rmixl_xlp_variant = RMIXLP_3XX) {
+			gg-gg_r_intpol = RMIXLP_GPIO_3XX_INTPOL(group);
+			gg-gg_r_inttype = RMIXLP_GPIO_3XX_INTTYPE(group);
+			gg-gg_r_intstat = RMIXLP_GPIO_3XX_INTSTAT(group);
+		}
+
+		/*
 		 * Disable all interrupts for group.
 		 * Get shadow copy of registers.
 		 */
-
 		gg-gg_padoe = xlgpio_read_4(sc, gg-gg_r_padoe);
 		gg-gg_paddrv = xlgpio_read_4(sc, gg-gg_r_paddrv);
 		xlgpio_write_4(sc, gg-gg_r_intpol, gg-gg_intpol);
@@ -283,6 +291,7 @@ xlgpio_pci_attach(device_t parent, devic
 
 	/*
 	 * GPIO has 4 interrupts which map 1:1 on IPL_VM to IPL_HIGH
+	 * (12 on 3xx but we only use 4).
 	 */
 	const pcireg_t irtinfo = xlgpio_read_4(sc, PCI_RMIXLP_IRTINFO);
 
@@ -291,8 +300,9 @@ xlgpio_pci_attach(device_t parent, devic
 
 	KASSERT(irtcount = IPL_HIGH - IPL_VM + 1);
 
-	for (size_t irt = 0; irt  irtcount; irt++) {
-		if (rmixl_intr_establish(irtstart + irt, IPL_VM + irt,
+	for (size_t ipl = IPL_VM; ipl = IPL_HIGH ; ipl++) {
+		const size_t irt = ipl - IPL_VM;
+		if (rmixl_intr_establish(irtstart + irt, ipl,
 		RMIXL_TRIG_LEVEL, RMIXL_POLR_HIGH,
 		xlgpio_intrs[irt], sc, true) == NULL)
 			panic(%s: failed to establish interrupt %zu,
@@ -469,7 +479,7 @@ gpio_intr_disestablish(void *v)
 
 	*inten_p = ~mask;
 	xlgpio_write_4(sc, gg-gg_r_inten[gip-gip_ipl - IPL_VM], *inten_p);
-	xlgpio_write_4(sc, RMIXLP_GPIO_INTSTAT(group), mask); /* ACK it */
+	xlgpio_write_4(sc, gg-gg_r_intstat, mask);	/* ACK it */
 
 	gip-gip_ipl = IPL_NONE;
 	gip-gip_ist = IST_NONE;

Index: src/sys/arch/mips/rmi/rmixlreg.h
diff -u src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.16 src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.17
--- src/sys/arch/mips/rmi/rmixlreg.h:1.1.2.16	Fri Dec 30 06:48:56 2011
+++ src/sys/arch/mips/rmi/rmixlreg.h	Sat Dec 31 04:30:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlreg.h,v 1.1.2.16 2011/12/30 06:48:56 matt Exp $	*/
+/*	$NetBSD: rmixlreg.h,v 1.1.2.17 2011/12/31 04:30:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -912,23 +912,12 @@
 #define RMIXLP_GPIO_INTEN(n,g) _RMIXL_OFFSET(0x46+2*(n)+(g)) // Interrupt 0 Enable Register 0
 #define RMIXLP_GPIO_INTEN0(n) _RMIXL_OFFSET(0x46+2*(n)) // Interrupt 0 Enable Register 0
 #define RMIXLP_GPIO_INTEN1(n) _RMIXL_OFFSET(0x47+2*(n)) // Interrupt 0 Enable Register 0
-#define RMIXLP_GPIO_INTEN00 _RMIXL_OFFSET(0x46) // Interrupt 0 Enable Register 0
-#define RMIXLP_GPIO_INTEN01 _RMIXL_OFFSET(0x47) // Interrupt 0 Enable Register 1
-#define RMIXLP_GPIO_INTEN10 _RMIXL_OFFSET(0x48) // Interrupt 1 Enable Register 0
-#define RMIXLP_GPIO_INTEN11 _RMIXL_OFFSET(0x49) // Interrupt 1 Enable Register 1
-#define RMIXLP_GPIO_INTEN20 _RMIXL_OFFSET(0x4A) // Interrupt 2 Enable Register 0
-#define RMIXLP_GPIO_INTEN21 _RMIXL_OFFSET(0x4B) // Interrupt 2 Enable Register 1

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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:54:28 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_i2creg.h rmixl_naereg.h
rmixlp_pcie.c rmixlreg.h

Log Message:
Consolidate and complete PCITAGs.
Print/Set BARs for AHCI and SRIO.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2creg.h \
src/sys/arch/mips/rmi/rmixl_naereg.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixlp_pcie.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixlreg.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_i2creg.h
diff -u src/sys/arch/mips/rmi/rmixl_i2creg.h:1.1.2.1 src/sys/arch/mips/rmi/rmixl_i2creg.h:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_i2creg.h:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_i2creg.h	Sat Dec 31 04:54:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_i2creg.h,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixl_i2creg.h,v 1.1.2.2 2011/12/31 04:54:28 matt Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,8 +38,8 @@
  * XLP I2C Controller defintions
  */
 
-#define	RMIXLP_I2C0_PCITAG		_RMIXL_PCITAG(0,6,2)
-#define	RMIXLP_I2C1_PCITAG		_RMIXL_PCITAG(0,6,3)
+#define	RMIXLP_I2C1_PCITAG		_RMIXL_PCITAG(0,6,2)
+#define	RMIXLP_I2C2_PCITAG		_RMIXL_PCITAG(0,6,3)
 #define	RMIXLP_I2C_CFG_OFFSET		_RMIXL_OFFSET(0x40)
 #define	RMIXLP_I2C_IOSIZE		_RMIXL_OFFSET(0x40)
 
Index: src/sys/arch/mips/rmi/rmixl_naereg.h
diff -u src/sys/arch/mips/rmi/rmixl_naereg.h:1.1.2.1 src/sys/arch/mips/rmi/rmixl_naereg.h:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_naereg.h:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_naereg.h	Sat Dec 31 04:54:28 2011
@@ -31,17 +31,38 @@
 #define _MIPS_RMI_RMIXL_NAEREG_H
 
 /*
- * RX P2P Descriptor
+ * RX P2P Descriptor (slightly different betewen XLS/XLR and XLP).
  */
-#define	RMIXL_NEA_RXD_CONTEXT			__BITS(63,54)
+#define	RMIXLS_NEA_RXD_EOP			__BIT(63)
+#define	RMIXLS_NEA_RXD_STATUS			__BITS(62,56)
+#define	RMIXLS_NEA_RXD_CLASSID			__BITS(55,54)
+#define	RMIXLP_NEA_RXD_CONTEXT			__BITS(59,54)
 #define	RMIXL_NEA_RXD_LENGTH			__BITS(53,40)
-#define	RMIXL_NEA_RXD_ADDRESS			__BITS(39,6)
-#define	RMIXL_NEA_RXD_UP			__BIT(5)
-#define	RMIXL_NEA_RXD_ERR			__BIT(4)
-#define	RMIXL_NEA_RXD_IC			__BIT(3)
-#define	RMIXL_NEA_RXD_TC			__BIT(2)
-#define	RMIXL_NEA_RXD_PP			__BIT(1)
-#define	RMIXL_NEA_RXD_P2P			__BIT(0)
+/*
+ * L2 cacheline aligned address
+ */
+#define	RMIXL_NEA_RXD_ADDRESS			__BITS(39,5)
+#define	RMIXLP_NEA_RXD_UP			__BIT(5)
+#define	RMIXLP_NEA_RXD_ERR			__BIT(4)
+#define	RMIXLS_NEA_RXD_UP			__BIT(4)
+#define	RMIXLS_NEA_RXD_PORTID			__BIT(3,0)
+#define	RMIXLP_NEA_RXD_IC			__BIT(3) // IP CSUM valid
+#define	RMIXLP_NEA_RXD_TC			__BIT(2) // TCP CSUM valid
+#define	RMIXLP_NEA_RXD_PP			__BIT(1) // Prepad present
+#define	RMIXLP_NEA_RXD_P2P			__BIT(0)
+
+/*
+ * RXD Status field for XLS/XLR.
+ */
+#define	RMIXLS_RXD_STATUS_ERROR			__BIT(6)
+#define	RMIXLS_RXD_STATUS_OK_BROADCAST		__BIT(5)
+#define	RMIXLS_RXD_STATUS_OK_MULTICAST		__BIT(4)
+#define	RMIXLS_RXD_STATUS_OK_UNICAST		__BIT(3)
+#define	RMIXLS_RXD_STATUS_ERROR_CODE		__BIT(2)
+#define	RMIXLS_RXD_STATUS_ERROR_CRC		__BIT(1)
+#define	RMIXLS_RXD_STATUS_OK_MACADDR		__BITS(2,1)
+#define	RMIXLS_RXD_STATUS_ERROR_LENGTH		__BIT(0)
+#define	RMIXLS_RXD_STATUS_OK_VLAN		__BIT(0)
 
 #define	RMIXL_NEA_TXD_TYPE			__BITS(63,62)
 #define	RMIXL_NEA_TXD_RDEX			__BIT(61)
@@ -88,13 +109,19 @@
 #define	RMIXL_NEA_MSCD2_CRC_INS_OFFS		__BITS(15,0)
 
 #define	RMIXL_NEA_TXFBD_TYPE			__BITS(63,62)
-#define	RMIXL_NEA_TXFBD_RDX			__BIT(61)
-#define	RMIXL_NEA_TXFBD__RSRVD0			__BITS(60,58)
-#define	RMIXL_NEA_TXFBD_TS_VALID		__BIT(57)
-#define	RMIXL_NEA_TXFBD_TX_DONE			__BIT(56)
-#define	RMIXL_NEA_TXFBD_MAX_COLL_LATE_ABORT	__BIT(55)
-#define	RMIXL_NEA_TXFBD_UNDERRUN		__BIT(54)
-#define	RMIXL_NEA_TXFBD__RSRVD1			__BITS(53,50)
+#define	RMIXLP_NEA_TXFBD_RDX			__BIT(61)
+#define	RMIXLP_NEA_TXFBD__RSRVD0		__BITS(60,58)
+#define	RMIXLS_NEA_TXFBD_COLLISION		__BIT(61)
+#define	RMIXLS_NEA_TXFBD_BUS_ERROR		__BIT(60)
+#define	RMIXLS_NEA_TXFBD_UNDERRUN		__BIT(59)
+#define	RMIXLS_NEA_TXFBD_ABORT			__BIT(58)
+#define	RMIXLP_NEA_TXFBD_TS_VALID		__BIT(57)
+#define	RMIXLP_NEA_TXFBD_TX_DONE		__BIT(56)
+#define	RMIXLP_NEA_TXFBD_MAX_COLL_LATE_ABORT	__BIT(55)
+#define	RMIXLP_NEA_TXFBD_UNDERRUN		__BIT(54)
+#define	RMIXLS_NEA_TXFBD_PORT_ID		__BITS(57,54)
+#define	RMIXLP_NEA_TXFBD__RSRVD1		__BITS(53,50)
+#define	RMIXLS_NEA_TXFBD_LENGTH			__BITS(53,40) // always 0
 #define	RMIXL_NEA_TXFBD_CONTEXT			__BITS(49,40)
 #define	RMIXL_NEA_TXFBD_ADDRESS			__BITS(39,0)
 
@@ -102,6 +129,16 @@
 #define	RMIXL_NEA_RXFID_ADDRESS			__BITS(39,6)
 #define	RMIXL_NEA_RXFID__RSRVD1			__BITS(5,0)
 
+#define	RMIXL_NAE_GMAC0_BASE(n)			(0x + 0x2000*(n))
+#define	RMIXL_NAE_GMAC1_BASE(n)			(0x0200 + 

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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 07:53:13 UTC 2011

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

Log Message:
XLP8xx and XLP3xx have different IRT layouts.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 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_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.31 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.32
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.31	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Sat Dec 31 07:53:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.31 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.32 2011/12/31 07:53:12 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.31 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.32 2011/12/31 07:53:12 matt Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -111,9 +111,9 @@ int iointr_debug = IOINTR_DEBUG;
 
 /* XXX this will need to deal with node */
 #define RMIXLP_PICREG_READ(off) \
-	rmixlp_read_8(RMIXL_PIC_PCITAG, (off))
+	rmixlp_read_8(RMIXLP_PIC_PCITAG, (off))
 #define	RMIXLP_PICREG_WRITE(off, val) \
-	rmixlp_write_8(RMIXL_PIC_PCITAG, (off), (val));
+	rmixlp_write_8(RMIXLP_PIC_PCITAG, (off), (val));
 
 /*
  * do not clear these when acking EIRR
@@ -128,6 +128,7 @@ int iointr_debug = IOINTR_DEBUG;
  * use the right display string table for the CPU that's running.
  */
 
+#ifdef MIPS64_XLR
 /*
  * rmixl_irtnames_xlrxxx
  * - use for XLRxxx
@@ -156,7 +157,7 @@ static const char * const rmixl_irtnames
 	pic int 20 (gmac3),		/* 20 */
 	pic int 21 (xgs0),		/* 21 */
 	pic int 22 (xgs1),		/* 22 */
-	pic int 23 (irq23),		/* 23 */
+	pic int 23 (?),		/* 23 */
 	pic int 24 (hyper_fatal),	/* 24 */
 	pic int 25 (bridge_aerr),	/* 25 */
 	pic int 26 (bridge_berr),	/* 26 */
@@ -166,7 +167,9 @@ static const char * const rmixl_irtnames
 	pic int 30 (gpio_fatal),	/* 30 */
 	pic int 31 (reserved),	/* 31 */
 };
+#endif /* MIPS64_XLR */
 
+#ifdef MIPS64_XLS
 /*
  * rmixl_irtnames_xls2xx
  * - use for XLS2xx
@@ -187,20 +190,20 @@ static const char * const rmixl_irtnames
 	pic int 12 (i2c1),		/* 12 */
 	pic int 13 (pcmcia),		/* 13 */
 	pic int 14 (gpio_a),		/* 14 */
-	pic int 15 (irq15),		/* 15 */
+	pic int 15 (?),		/* 15 */
 	pic int 16 (bridge_tb),	/* 16 */
 	pic int 17 (gmac0),		/* 17 */
 	pic int 18 (gmac1),		/* 18 */
 	pic int 19 (gmac2),		/* 19 */
 	pic int 20 (gmac3),		/* 20 */
-	pic int 21 (irq21),		/* 21 */
-	pic int 22 (irq22),		/* 22 */
+	pic int 21 (?),		/* 21 */
+	pic int 22 (?),		/* 22 */
 	pic int 23 (pcie_link2),	/* 23 */
 	pic int 24 (pcie_link3),	/* 24 */
 	pic int 25 (bridge_err),	/* 25 */
 	pic int 26 (pcie_link0),	/* 26 */
 	pic int 27 (pcie_link1),	/* 27 */
-	pic int 28 (irq28),		/* 28 */
+	pic int 28 (?),		/* 28 */
 	pic int 29 (pcie_err),	/* 29 */
 	pic int 30 (gpio_b),		/* 30 */
 	pic int 31 (usb),		/* 31 */
@@ -226,20 +229,20 @@ static const char * const rmixl_irtnames
 	pic int 12 (i2c1),		/* 12 */
 	pic int 13 (pcmcia),		/* 13 */
 	pic int 14 (gpio_a),		/* 14 */
-	pic int 15 (irq15),		/* 15 */
+	pic int 15 (?),		/* 15 */
 	pic int 16 (bridge_tb),	/* 16 */
 	pic int 17 (gmac0),		/* 17 */
 	pic int 18 (gmac1),		/* 18 */
 	pic int 19 (gmac2),		/* 19 */
 	pic int 20 (gmac3),		/* 20 */
-	pic int 21 (irq21),		/* 21 */
-	pic int 22 (irq22),		/* 22 */
-	pic int 23 (irq23),		/* 23 */
-	pic int 24 (irq24),		/* 24 */
+	pic int 21 (?),		/* 21 */
+	pic int 22 (?),		/* 22 */
+	pic int 23 (?),		/* 23 */
+	pic int 24 (?),		/* 24 */
 	pic int 25 (bridge_err),	/* 25 */
 	pic int 26 (pcie_link0),	/* 26 */
 	pic int 27 (pcie_link1),	/* 27 */
-	pic int 28 (irq28),		/* 28 */
+	pic int 28 (?),		/* 28 */
 	pic int 29 (pcie_err),	/* 29 */
 	pic int 30 (gpio_b),		/* 30 */
 	pic int 31 (usb),		/* 31 */
@@ -265,16 +268,16 @@ static const char * const rmixl_irtnames
 	pic int 12 (i2c1),		/* 12 */
 	pic int 13 (pcmcia),		/* 13 */
 	pic int 14 (gpio_a),		/* 14 */
-	pic int 15 (irq15),		/* 15 */
+	pic int 15 (?),		/* 15 */
 	pic int 16 (bridge_tb),	/* 16 */
 	pic int 17 (gmac0),		/* 17 */
 	pic int 18 (gmac1),		/* 18 */
 	pic int 19 (gmac2),		/* 19 */
 	pic int 20 (gmac3),		/* 20 */
-	pic int 21 (irq21),		/* 21 */
-	pic int 22 (irq22),		/* 22 */
-	pic int 23 (irq23),		/* 23 */
-	pic int 24 (irq24),		/* 24 */
+	pic int 21 (?),		/* 21 */
+	pic int 22 (?),		/* 22 */
+	pic int 23 (?),		/* 23 */
+	pic int 24 (?),		/* 24 */
 	pic int 25 (bridge_err),	/* 25 */
 	pic int 26 (pcie_link0),	/* 26 */
 	pic int 27 (pcie_link1),	/* 27 */
@@ -283,12 +286,14 @@ static const char * const rmixl_irtnames
 	pic int 30 (gpio_b),		/* 30 */
 	pic int 31 (usb),		/* 31 */
 };
+#endif /* 

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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 03:33:13 UTC 2011

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

Log Message:
Fix xlgpio_pin_ctl inversion problem.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:30:53 UTC 2011

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

Log Message:
Deal with the movement of some GPIO registers on the XPL3xx.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixlreg.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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 04:54:28 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_i2creg.h rmixl_naereg.h
rmixlp_pcie.c rmixlreg.h

Log Message:
Consolidate and complete PCITAGs.
Print/Set BARs for AHCI and SRIO.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2creg.h \
src/sys/arch/mips/rmi/rmixl_naereg.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixlp_pcie.c
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixlreg.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

2011-12-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Dec 31 07:53:13 UTC 2011

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

Log Message:
XLP8xx and XLP3xx have different IRT layouts.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 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/rmi

2011-12-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec 30 06:42:29 UTC 2011

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

Log Message:
Cleanup USB byte swap support.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 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.

Modified files:

Index: src/sys/arch/mips/rmi/rmixlp_pcie.c
diff -u src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.3 src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.4
--- src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.3	Wed Dec 28 05:35:06 2011
+++ src/sys/arch/mips/rmi/rmixlp_pcie.c	Fri Dec 30 06:42:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.3 2011/12/28 05:35:06 matt Exp $	*/
+/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.4 2011/12/30 06:42:29 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.3 2011/12/28 05:35:06 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.4 2011/12/30 06:42:29 matt Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -108,6 +108,7 @@ static struct rmixlp_pcie_softc {
 	bus_dma_tag_t			sc_dmat64;
 	rmixlp_pcie_lnkcfg_t		sc_lnkcfg;
 	uint8_tsc_lnkmode;
+	boolsc_usb_bswapped;
 	kmutex_t			sc_mutex;
 } rmixlp_pcie_softc = {
 	.sc_pc = rmixl_configuration.rc_pci_chipset,
@@ -296,6 +297,15 @@ rmixlp_pcie_attach(device_t parent, devi
 	/*
 	 * Make sure the USB devices aren't still in reset.
 	 */
+	/*
+	 * Disable byte swapping.
+	 */
+#ifdef BYTESWAP_USB
+	pci_conf_write(sc-sc_pc, RMIXLP_EHCI0_PCITAG,
+	RMIXLP_USB_BYTE_SWAP_DIS, 1);
+#endif
+	sc-sc_usb_bswapped = (pci_conf_read(sc-sc_pc, RMIXLP_EHCI0_PCITAG,
+	RMIXLP_USB_BYTE_SWAP_DIS) != 0);
 	rmixlp_pcie_usb_init_hook(sc-sc_pc, RMIXLP_EHCI0_PCITAG);
 	rmixlp_pcie_usb_init_hook(sc-sc_pc, RMIXLP_OHCI0_PCITAG);
 	rmixlp_pcie_usb_init_hook(sc-sc_pc, RMIXLP_OHCI1_PCITAG);
@@ -513,6 +523,38 @@ rmixlp_pcie_link_bar_update(struct rmixl
 	}
 }
 
+static void
+rmixlp_pcie_print_bus0_bar0(struct rmixlp_pcie_softc *sc, pcitag_t tag)
+{
+	const size_t bar = PCI_BAR0;
+	pcireg_t ml = rmixlp_pcie_conf_read(sc, tag, PCI_BAR0);
+
+	switch (PCI_MAPREG_TYPE(ml)|PCI_MAPREG_MEM_TYPE(ml)) {
+	case PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT: {
+		bus_addr_t addr = PCI_MAPREG_MEM_ADDR(ml);
+		if (addr) {
+			aprint_normal_dev(sc-sc_dev,
+			tag %#lx bar[0]: mem32=%#PRIxBUSADDR\n,
+			tag, addr);
+		}
+		break;
+	}
+	case PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_64BIT: {
+		pcireg_t mu = rmixlp_pcie_conf_read(sc, tag, bar + 4);
+		bus_addr_t addr =
+		PCI_MAPREG_MEM64_ADDR(ml|((uint64_t)mu  32));
+		if (addr) {
+			aprint_normal_dev(sc-sc_dev,
+			tag %#lx bar[0]: mem64=%#PRIxBUSADDR\n,
+			tag, addr);
+		}
+		break;
+	}
+	default:
+		return;
+	}
+}
+
 static bus_addr_t
 rmixlp_pcie_set_bus0_bar0(struct rmixlp_pcie_softc *sc, pcitag_t tag,
 	bus_addr_t pbase)
@@ -531,8 +573,10 @@ rmixlp_pcie_set_bus0_bar0(struct rmixlp_
 		pbase = (pbase + bar_size - 1)  -bar_size;
 		KASSERT((uint32_t)pbase == pbase);
 		rmixlp_pcie_conf_write(sc, tag, bar, pbase);
-		printf(%s: tag %#lx bar[0]: mem32=%#PRIxBUSADDR size=%#PRIxBUSSIZE\n,
-		__func__, tag, pbase, bar_size);
+		aprint_normal_dev(sc-sc_dev,
+		tag %#lx bar[0]: mem32=%#PRIxBUSADDR
+		 size=%#PRIxBUSSIZE\n,
+		tag, pbase, bar_size);
 		pbase += bar_size;
 		break;
 	}
@@ -550,8 +594,10 @@ rmixlp_pcie_set_bus0_bar0(struct rmixlp_
 		(pbase  0)  0x);
 		rmixlp_pcie_conf_write(sc, tag, bar + 4,
 		(pbase  32)  0x);
-		printf(%s: tag %#lx bar[0]: mem64=%#PRIxBUSADDR size=%#PRIxBUSSIZE\n,
-		__func__, tag, pbase, bar_size);
+		aprint_normal_dev(sc-sc_dev,
+		tag %#lx bar[0]: mem64=%#PRIxBUSADDR
+		 size=%#PRIxBUSSIZE\n,
+		tag, pbase, bar_size);
 		pbase += bar_size;
 
 		break;
@@ -600,16 +646,26 @@ rmixlp_pcie_configure_bus(struct rmixlp_
 #endif
 
 	if (0) {
-	bus_addr_t pbase = rcp-rc_pci_mem.r_pbase;
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_EHCI0_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_OHCI0_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_OHCI1_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_EHCI1_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_OHCI2_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_OHCI3_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_NAE_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_POE_PCITAG, pbase);
-	pbase = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_FMN_PCITAG, pbase);
+		bus_addr_t mem = rcp-rc_pci_mem.r_pbase;
+		mem = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_EHCI0_PCITAG, mem);
+		mem = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_OHCI0_PCITAG, mem);
+		mem = rmixlp_pcie_set_bus0_bar0(sc, RMIXLP_OHCI1_PCITAG, mem);
+		mem = rmixlp_pcie_set_bus0_bar0(sc, 

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

2011-12-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec 30 06:45:00 UTC 2011

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

Log Message:
Add a field to track available GPIO pins.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 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.23 src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.24
--- src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.23	Wed Dec 28 05:36:11 2011
+++ src/sys/arch/mips/rmi/rmixlvar.h	Fri Dec 30 06:45:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlvar.h,v 1.1.2.23 2011/12/28 05:36:11 matt Exp $	*/
+/*	$NetBSD: rmixlvar.h,v 1.1.2.24 2011/12/30 06:45:00 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -154,6 +154,7 @@ struct rmixl_config {
 	struct extent *		rc_pci_io_ex;
 	struct extent *		rc_srio_mem_ex;
 	int			rc_mallocsafe;
+	uint64_t		rc_gpio_available;
 	rmixlfw_info_t 		rc_psb_info;
 	rmixlfw_psb_type_t	rc_psb_type;
 	volatile struct rmixlfw_cpu_wakeup_info *



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

2011-12-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec 30 06:48:56 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_intr.h rmixl_nand_pci.c
rmixl_sdio.c rmixl_spi_pci.c rmixlreg.h
Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c

Log Message:
Add GPIO support for XLP.
Let NAND, MMC/SD, and SPI remove their pins from the GPIO available pin mask.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_intr.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_nand_pci.c \
src/sys/arch/mips/rmi/rmixl_sdio.c src/sys/arch/mips/rmi/rmixl_spi_pci.c
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/arch/mips/rmi/rmixlreg.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_intr.h
diff -u src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.9 src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.10
--- src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.9	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.h	Fri Dec 30 06:48:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.h,v 1.1.2.9 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixl_intr.h,v 1.1.2.10 2011/12/30 06:48:55 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -107,4 +107,8 @@ void	rmixl_intr_init_clk(void);
 void	rmixl_intr_init_ipi(void);
 #endif
 
+void *	gpio_intr_establish(size_t /* pin */, int /* ipl */, int /* ist */,
+	int (*)(void *), void *, bool);
+
+void	gpio_intr_disestablish(void *);
 #endif	/* _MIPS_RMI_RMIXL_INTR_H_ */

Index: src/sys/arch/mips/rmi/rmixl_nand_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_nand_pci.c:1.1.2.1 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.1	Tue Dec 27 19:58:19 2011
+++ src/sys/arch/mips/rmi/rmixl_nand_pci.c	Fri Dec 30 06:48:56 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_nand_pci.c,v 1.1.2.1 2011/12/27 19:58:19 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_nand_pci.c,v 1.1.2.2 2011/12/30 06:48:56 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -58,6 +58,18 @@ struct	xlnand_softc {
 	bus_space_handle_t sc_bsh;
 };
 
+static inline uint32_t
+xlnand_read_4(struct xlnand_softc *sc, bus_size_t off)
+{
+	return bus_space_read_4(sc-sc_bst, sc-sc_bsh, off);
+}
+
+static inline void
+xlnand_write_4(struct xlnand_softc *sc, bus_size_t off, uint32_t v)
+{
+	bus_space_write_4(sc-sc_bst, sc-sc_bsh, off, v);
+}
+
 CFATTACH_DECL_NEW(xlnand_pci, sizeof(struct xlnand_softc),
 xlnand_pci_match, xlnand_pci_attach, NULL, NULL);
 
@@ -87,10 +99,22 @@ xlnand_pci_attach(device_t parent, devic
 	 * Why isn't this accessible via a BAR?
 	 */
 	if (bus_space_subregion(sc-sc_bst, rcp-rc_pci_ecfg_eb_memh,
-		pa-pa_tag | 0x100, 0, sc-sc_bsh)) {
+		pa-pa_tag, 0, sc-sc_bsh)) {
 		aprint_error(: can't map registers\n);
 		return;
 	}
 
 	aprint_normal(: XLP NAND Controller\n);
+
+	/*
+	 * If a NAND is using non-0 RDY/BSY signals, we need to take control
+	 * of those from GPIO.
+	 */
+	uint32_t r = xlnand_read_4(sc, RMIXLP_NAND_RDYBSY_SEL);
+	for (r = 3; r != 0; r = 3) {
+		u_int rdybsy = r  7;
+		if (rdybsy != 0) {
+			rcp-rc_gpio_available = ~__BIT(33 + rdybsy);
+		}
+	}
 }
Index: src/sys/arch/mips/rmi/rmixl_sdio.c
diff -u src/sys/arch/mips/rmi/rmixl_sdio.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_sdio.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_sdio.c:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_sdio.c	Fri Dec 30 06:48:56 2011
@@ -29,7 +29,7 @@
 
 #include sys/param.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_sdio.c,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_sdio.c,v 1.1.2.2 2011/12/30 06:48:56 matt Exp $);
 
 #include sys/device.h
 #include sys/bus.h
@@ -91,8 +91,10 @@ xlsdio_attach(device_t parent, device_t 
 	pci_conf_write(pa-pa_pc, pa-pa_tag, RMIXLP_MMC_SYSCTRL, r);
 	DELAY(1000);
 	r |= RMIXLP_MMC_SYSCTRL_CA;	/* Cache Allocate */
+#if 0
 	r |= RMIXLP_MMC_SYSCTRL_EN0;	/* Enable Slot 0 */
 	r |= RMIXLP_MMC_SYSCTRL_EN1;	/* Enable Slot 1 */
+#endif
 	r = ~RMIXLP_MMC_SYSCTRL_CLK_DIS; /* Don't Disable Clock */
 	pci_conf_write(pa-pa_pc, pa-pa_tag, RMIXLP_MMC_SYSCTRL, r);
 
@@ -113,7 +115,15 @@ xlsdio_attach(device_t parent, device_t 
 		pci_conf_write(pa-pa_pc, pa-pa_tag,
 		offset + SDHC_NINTR_STATUS, 0x);
 
-		config_found(self, xaa, xlsdio_print);
+		if (r  RMIXLP_MMC_SYSCTRL_EN(slot)) {
+			/*
+			 * For any SDHC port we are using, we must remove
+			 * the pins used by it from those that GPIO will
+			 * offer to userland.
+			 */
+			rcp-rc_gpio_available = ~RMIXLP_MMC_GPIO_PINS(slot);
+			config_found(self, xaa, xlsdio_print);
+		}
 	}
 }
 
Index: src/sys/arch/mips/rmi/rmixl_spi_pci.c
diff -u 

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

2011-12-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec 30 06:42:29 UTC 2011

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

Log Message:
Cleanup USB byte swap support.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 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

2011-12-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec 30 06:45:00 UTC 2011

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

Log Message:
Add a field to track available GPIO pins.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 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

2011-12-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Dec 30 06:48:56 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_intr.h rmixl_nand_pci.c
rmixl_sdio.c rmixl_spi_pci.c rmixlreg.h
Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_gpio_pci.c

Log Message:
Add GPIO support for XLP.
Let NAND, MMC/SD, and SPI remove their pins from the GPIO available pin mask.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_gpio_pci.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_intr.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_nand_pci.c \
src/sys/arch/mips/rmi/rmixl_sdio.c src/sys/arch/mips/rmi/rmixl_spi_pci.c
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/arch/mips/rmi/rmixlreg.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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 27 16:07:34 UTC 2011

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

Log Message:
Fix _LP64 compile issue.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/arch/mips/rmi/rmixl_pcie.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_pcie.c
diff -u src/sys/arch/mips/rmi/rmixl_pcie.c:1.1.2.18 src/sys/arch/mips/rmi/rmixl_pcie.c:1.1.2.19
--- src/sys/arch/mips/rmi/rmixl_pcie.c:1.1.2.18	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_pcie.c	Tue Dec 27 16:07:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcie.c,v 1.1.2.18 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixl_pcie.c,v 1.1.2.19 2011/12/27 16:07:34 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_pcie.c,v 1.1.2.18 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_pcie.c,v 1.1.2.19 2011/12/27 16:07:34 matt Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -388,7 +388,7 @@ rmixl_pcie_attach(device_t parent, devic
 		__func__, rcp-rc_pci_ecfg.r_pbase,
 		rcp-rc_pci_ecfg.r_size / 2);
 
-	sc-sc_pci_ecfg_memh = rcp-rc_pci_ecfg_memh;
+	sc-sc_pci_ecfg_memh = rcp-rc_pci_ecfg_el_memh;
 #else
 	printf(%s: skipping mapping of pci ECFG LE registers 
 	(base=%#PRIxBUSADDR size=%#PRIxBUSSIZE)\n,



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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 27 16:22:01 UTC 2011

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

Log Message:
Make it compile if PCI_NETBSD_CONFIGURE is not present.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 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.

Modified files:

Index: src/sys/arch/mips/rmi/rmixlp_pcie.c
diff -u src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.1 src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixlp_pcie.c	Tue Dec 27 16:22:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $	*/
+/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.2 2011/12/27 16:22:01 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.2 2011/12/27 16:22:01 matt Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -331,6 +331,7 @@ rmixlp_pcie_attach(device_t parent, devi
 #endif
 }
 
+#ifdef PCI_NETBSD_CONFIGURE
 void
 rmixlp_pcie_bar_alloc(struct rmixl_region *rp,
 	u_long size_mb, u_long align_mb)
@@ -355,6 +356,7 @@ rmixlp_pcie_bar_alloc(struct rmixl_regio
 	rp-r_pbase = pbase;
 	rp-r_size = (uint64_t)size_mb  20;
 }
+#endif /* PCI_NETBSD_CONFIGURE */
 
 /*
  * rmixlp_pcie_lnkcfg_get - lookup the lnkcfg for this XLP



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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 27 19:57:19 UTC 2011

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

Log Message:
Add commented out intr establishment.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2c_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_i2c_pci.c
diff -u src/sys/arch/mips/rmi/rmixl_i2c_pci.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_i2c_pci.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_i2c_pci.c:1.1.2.1	Sat Dec 24 01:57:54 2011
+++ src/sys/arch/mips/rmi/rmixl_i2c_pci.c	Tue Dec 27 19:57:18 2011
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: rmixl_i2c_pci.c,v 1.1.2.1 2011/12/24 01:57:54 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: rmixl_i2c_pci.c,v 1.1.2.2 2011/12/27 19:57:18 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -61,6 +61,9 @@ static int  xli2c_acquire_bus(void *, in
 static void xli2c_release_bus(void *, int);
 static int  xli2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
 		void *, size_t, int);
+#if 0
+static int  xli2c_intr(void *);
+#endif
 static int  xli2c_wait_for_command(struct xli2c_softc *, uint8_t);
 
 static inline uint8_t
@@ -156,6 +159,19 @@ xli2c_pci_attach(device_t parent, device
 	/* MMM MAGIC */
 	xli2c_write_prescale(sc, rmixl_i2c_calc_prescale(1, 10));
 
+#if 0
+	pci_intr_handle_t pcih;
+
+	pci_intr_map(pa, pcih);
+
+	if (pci_intr_establish(pa-pa_pc, pcih, IPL_VM, xli2c_intr, sc) == NULL) {
+		aprint_error_dev(self, failed to establish interrupt\n);
+	} else {
+		const char * const intrstr = pci_intr_string(pa-pa_pc, pcih);
+		aprint_normal_dev(self, interrupting at %s\n, intrstr);
+	}
+#endif
+
 	memset(iba, 0, sizeof(iba));
 	iba.iba_tag = sc-sc_i2c;
 	config_found_ia(self, i2cbus, iba, iicbus_print);
@@ -186,7 +202,7 @@ xli2c_release_bus(void *v, int flags)
 }
 
 #if 0
-int
+static int
 xli2c_intr(void *v)
 {
 	struct xli2c_softc * const sc = v;



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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 28 05:35:06 UTC 2011

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

Log Message:
Cleanup aprint*


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 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.

Modified files:

Index: src/sys/arch/mips/rmi/rmixlp_pcie.c
diff -u src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.2 src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.3
--- src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.2	Tue Dec 27 16:22:01 2011
+++ src/sys/arch/mips/rmi/rmixlp_pcie.c	Wed Dec 28 05:35:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.2 2011/12/27 16:22:01 matt Exp $	*/
+/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.3 2011/12/28 05:35:06 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.2 2011/12/27 16:22:01 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.3 2011/12/28 05:35:06 matt Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -118,7 +118,8 @@ static struct rmixlp_pcie_softc {
 
 static int	rmixlp_pcie_match(device_t, cfdata_t, void *);
 static void	rmixlp_pcie_attach(device_t, device_t, void *);
-static void	rmixlp_pcie_bar_alloc(struct rmixl_region *, u_long, u_long);
+static void	rmixlp_pcie_bar_alloc(struct rmixlp_pcie_softc *,
+		struct rmixl_region *, u_long, u_long);
 static void	rmixlp_pcie_attach_hook(device_t, device_t,
 		struct pcibus_attach_args *);
 
@@ -219,7 +220,7 @@ rmixlp_pcie_attach(device_t parent, devi
 	 */
 	rmixlp_pcie_lnkcfg_get(sc);
 
-	aprint_normal_dev(sc-sc_dev, using link variant %d (system is %d)\n,
+	aprint_debug_dev(sc-sc_dev, using link variant %d (system is %d)\n,
 	sc-sc_lnkcfg.lnk_variant, rmixl_xlp_variant);
 	for (size_t port = 0; port  sc-sc_lnkcfg.lnk_ports; port++) {
 		if (sc-sc_lnkcfg.lnk_lanes[port] == 0)
@@ -252,7 +253,7 @@ rmixlp_pcie_attach(device_t parent, devi
 			}
 		}
 		if (0)
-			rmixlp_pcie_bar_alloc(rcp-rc_pci_mem, 256, 1);
+			rmixlp_pcie_bar_alloc(sc, rcp-rc_pci_mem, 256, 1);
 		rcp-rc_pci_mem.r_pbase = rmixlp_read_4(RMIXLP_EHCI0_PCITAG,
 		PCI_BAR0)  -8;
 		rcp-rc_pci_mem.r_size = 256  20;
@@ -280,7 +281,7 @@ rmixlp_pcie_attach(device_t parent, devi
 rp-r_size = 0;
 			}
 		}
-		// rmixlp_pcie_bar_alloc(rcp-rc_pci_io, 4, 1);
+		// rmixlp_pcie_bar_alloc(sc, rcp-rc_pci_io, 4, 1);
 #endif
 		rmixl_pci_bus_io_init(rcp-rc_pci_iot, rcp);
 	}
@@ -333,7 +334,7 @@ rmixlp_pcie_attach(device_t parent, devi
 
 #ifdef PCI_NETBSD_CONFIGURE
 void
-rmixlp_pcie_bar_alloc(struct rmixl_region *rp,
+rmixlp_pcie_bar_alloc(struct rmixlp_pcie_softc *sc, struct rmixl_region *rp,
 	u_long size_mb, u_long align_mb)
 {
 	struct rmixl_config * const rcp = rmixl_configuration;
@@ -350,7 +351,8 @@ rmixlp_pcie_bar_alloc(struct rmixl_regio
 	const uint64_t pbase = (uint64_t)region_start  20;
 	const uint64_t limit = pbase + ((uint64_t)(size_mb - 1)  20);
 
-	printf(%s: pbase=%#PRIx64 limit=%#PRIx64 size=%luMB\n,
+	aprint_debug_dev(sc-sc_dev,
+	%s: pbase=%#PRIx64 limit=%#PRIx64 size=%luMB\n,
 	__func__, pbase, limit, size_mb);
 
 	rp-r_pbase = pbase;
@@ -424,94 +426,6 @@ rmixlp_pcie_intcfg(struct rmixlp_pcie_so
 }
 #endif
 
-#if 0
-static void
-rmixlp_pcie_errata(struct rmixlp_pcie_softc *sc)
-{
-	const mips_prid_t cpu_id = mips_options.mips_cpu_id;
-	u_int rev;
-	u_int lanes;
-	bool e391 = false;
-
-	/*
-	 * 3.9.1 PCIe Link-0 Registers Reset to Incorrect Values
-	 * check if it allies to this CPU implementation and revision
-	 */
-	rev = MIPS_PRID_REV(cpu_id);
-	switch (MIPS_PRID_IMPL(cpu_id)) {
-	case MIPS_XLS104:
-	case MIPS_XLS108:
-		break;
-	case MIPS_XLS204:
-	case MIPS_XLS208:
-		/* stepping A0 is affected */
-		if (rev == 0)
-			e391 = true;
-		break;
-	case MIPS_XLS404LITE:
-	case MIPS_XLS408LITE:
-		break;
-	case MIPS_XLS404:
-	case MIPS_XLS408:
-	case MIPS_XLS416:
-		/* steppings A0 and A1 are affected */
-		if ((rev == 0) || (rev == 1))
-			e391 = true;
-		break;
-	case MIPS_XLS608: 
-	case MIPS_XLS616:
-		break;
-	default:
-		panic(unknown RMI PRID IMPL);
-}
-
-	/*
-	 * for XLS we only need to check entry #0
-	 * this may need to change for later XL family chips
-	 */
-	lanes = sc-sc_pcie_lnktab.cfg[0].lanes;
-
-	if ((e391 != false)  ((lanes == 2) || (lanes == 4))) {
-		/*
-		 * attempt work around for errata 3.9.1
-		 * PCIe Link-0 Registers Reset to Incorrect Values
-		 * the registers are write-once: if the firmware already wrote,
-		 * then our writes are ignored;  hope they did it right.
-		 */
-		uint32_t queuectrl;
-		uint32_t bufdepth;
-#ifdef DIAGNOSTIC
-		uint32_t r;
-#endif
-
-		aprint_normal(%s: attempt work around for errata 3.9.1,
-			device_xname(sc-sc_dev));
-		if (lanes == 4) {
-			queuectrl = 0x00018074;
-			bufdepth  = 0x001901D1;
-		} else {
-			queuectrl = 0x00018036;
-			

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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 27 16:22:01 UTC 2011

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

Log Message:
Make it compile if PCI_NETBSD_CONFIGURE is not present.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 27 16:07:34 UTC 2011

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

Log Message:
Fix _LP64 compile issue.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/arch/mips/rmi/rmixl_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

2011-12-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 27 19:57:19 UTC 2011

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

Log Message:
Add commented out intr establishment.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_i2c_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

2011-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec  6 17:44:46 UTC 2011

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

Log Message:
Use MIPS_COP_0_OSSCRATCH instead $22


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_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/rmi/rmixl_subr.S
diff -u src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.10 src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.11
--- src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.10	Sat Dec  3 01:56:56 2011
+++ src/sys/arch/mips/rmi/rmixl_subr.S	Tue Dec  6 17:44:46 2011
@@ -169,11 +169,11 @@ NESTED(rmixl_cpu_trampoline, CALLFRAME_S
 	 * jump to common mips cpu_trampoline
 	 */
 	REG_L		a1, 2*SZREG(s0)		/* XXX ta_cpuinfo */
-	dmtc0		a1, $22, 0		/* MIPS_COP_0_OSSCRATCH */
+	dmtc0		a1, MIPS_COP_0_OSSCRATCH, 0
 	PTR_L		v1, CPU_INFO_TLB_INFO(a1)
 	PTR_L		v1, TI_HWLOCK(v1)
 	PTR_ADDU	v1, MTX_LOCK
-	dmtc0		v1, $22, 2
+	dmtc0		v1, MIPS_COP_0_OSSCRATCH, 2
 	j		cpu_trampoline
 	 nop
 



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

2011-12-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec  6 17:44:46 UTC 2011

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

Log Message:
Use MIPS_COP_0_OSSCRATCH instead $22


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/arch/mips/rmi/rmixl_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/rmi

2011-05-10 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Wed May 11 00:37:20 UTC 2011

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

Log Message:
simplify rmixl_com_initmap() a bit


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/arch/mips/rmi/rmixl_com.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_com.c
diff -u src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.14 src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.15
--- src/sys/arch/mips/rmi/rmixl_com.c:1.1.2.14	Fri May 21 23:33:52 2010
+++ src/sys/arch/mips/rmi/rmixl_com.c	Wed May 11 00:37:20 2011
@@ -1,4 +1,4 @@
-/* $Id: rmixl_com.c,v 1.1.2.14 2010/05/21 23:33:52 cliff Exp $ */
+/* $Id: rmixl_com.c,v 1.1.2.15 2011/05/11 00:37:20 cliff Exp $ */
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_com.c,v 1.1.2.14 2010/05/21 23:33:52 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_com.c,v 1.1.2.15 2011/05/11 00:37:20 cliff Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -300,14 +300,10 @@
 void
 rmixl_com_initmap(struct com_regs *regsp)
 {
-	int i;
-	int sz;
-
 	/*
 	 * map the 4 byte register stride
 	 */
-	sz = sizeof(regsp-cr_map) / sizeof(regsp-cr_map[0]);
-	for (i = 0; i  sz; i++)
+	for (int i = 0; i  __arraycount(regsp-cr_map); i++)
 		regsp-cr_map[i] = com_std_map[i] * 4;
 }
 



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

2011-05-10 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Wed May 11 00:37:20 UTC 2011

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

Log Message:
simplify rmixl_com_initmap() a bit


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/arch/mips/rmi/rmixl_com.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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Wed Apr 13 21:10:11 UTC 2011

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

Log Message:
initialize mutex in attach


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 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.7 src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.8
--- src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.7	Mon Sep 20 19:42:31 2010
+++ src/sys/arch/mips/rmi/rmixl_pcix.c	Wed Apr 13 21:10:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcix.c,v 1.1.2.7 2010/09/20 19:42:31 cliff Exp $	*/
+/*	$NetBSD: rmixl_pcix.c,v 1.1.2.8 2011/04/13 21:10:11 cliff 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.7 2010/09/20 19:42:31 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_pcix.c,v 1.1.2.8 2011/04/13 21:10:11 cliff Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -316,6 +316,8 @@
 
 	aprint_normal(: RMI XLR PCI-X Interface\n);
 
+	mutex_init(sc-sc_mutex, MUTEX_DEFAULT, IPL_HIGH);
+
 	rmixl_pcix_intcfg(sc);
 
 	rmixl_pcix_errata(sc);



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Wed Apr 13 21:10:11 UTC 2011

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

Log Message:
initialize mutex in attach


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 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

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 19:50:23 UTC 2011

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

Log Message:
- remove sc_ih_clk, sc_ih_fmn, sc_ih_ipi from struct rmixl_cpu_softc;
they were unused just taking up space
- rmixl_intr_init_clk() and rmixl_intr_init_ipi() are now type void


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_cpuvar.h
cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_intr.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_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.18 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.19
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.18	Tue Feb  8 06:03:01 2011
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Tue Feb  8 19:50:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.1.2.18 2011/02/08 06:03:01 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.1.2.19 2011/02/08 19:50:22 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.18 2011/02/08 06:03:01 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.19 2011/02/08 19:50:22 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -258,9 +258,9 @@
 
 	rmixl_fmn_init();
 
-	sc-sc_ih_clk = rmixl_intr_init_clk();
+	rmixl_intr_init_clk();
 #ifdef MULTIPROCESSOR
-	sc-sc_ih_ipi = rmixl_intr_init_ipi();
+	rmixl_intr_init_ipi();
 #endif
 
 #ifdef NOTYET
@@ -269,7 +269,6 @@
 	if (ih == NULL)
 		panic(%s: rmixl_fmn_intr_establish failed,
 			__func__);
-	sc-sc_ih_fmn = ih;
 #endif
 
 }

Index: src/sys/arch/mips/rmi/rmixl_cpuvar.h
diff -u src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.2 src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.3
--- src/sys/arch/mips/rmi/rmixl_cpuvar.h:1.1.2.2	Tue Apr 13 18:15:16 2010
+++ src/sys/arch/mips/rmi/rmixl_cpuvar.h	Tue Feb  8 19:50:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpuvar.h,v 1.1.2.2 2010/04/13 18:15:16 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpuvar.h,v 1.1.2.3 2011/02/08 19:50:22 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,9 +40,6 @@
 struct rmixl_cpu_softc {
 	device_t sc_dev;
 	struct cpu_info *sc_ci;
-	void *sc_ih_clk;
-	void *sc_ih_fmn;
-	void *sc_ih_ipi;
 	struct evcnt sc_vec_evcnts[64];
 };
 

Index: src/sys/arch/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.26 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.27
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.26	Tue Feb  8 06:04:20 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Tue Feb  8 19:50:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.26 2011/02/08 06:04:20 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.27 2011/02/08 19:50:22 cliff 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.26 2011/02/08 06:04:20 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.27 2011/02/08 19:50:22 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -446,7 +446,7 @@
  * even though cpu_intr() handles the interrupt
  * note the 'mpsafe' arg here is a placeholder only
  */
-void *
+void
 rmixl_intr_init_clk(void)
 {
 	int vec = ffs(MIPS_INT_MASK_5  8) - 1;
@@ -459,14 +459,13 @@
 
 	mutex_exit(rmixl_intr_lock);
 	
-	return ih;
 }
 
 #ifdef MULTIPROCESSOR
 /*
  * establish IPI interrupt and send function
  */
-void *
+void
 rmixl_intr_init_ipi(void)
 {
 	u_int ipi, vec;
@@ -487,7 +486,6 @@
 
 	mutex_exit(rmixl_intr_lock);
 
-	return ih;
 }
 #endif 	/* MULTIPROCESSOR */
 

Index: src/sys/arch/mips/rmi/rmixl_intr.h
diff -u src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.6 src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.7
--- src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.6	Sat Feb  5 06:31:06 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.h	Tue Feb  8 19:50:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.h,v 1.1.2.6 2011/02/05 06:31:06 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.h,v 1.1.2.7 2011/02/08 19:50:22 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -102,9 +102,9 @@
 extern void  rmixl_vec_disestablish(void *);
 extern const char *rmixl_intr_string(int);
 extern void rmixl_intr_init_cpu(struct cpu_info *);
-extern void *rmixl_intr_init_clk(void);
+extern void rmixl_intr_init_clk(void);
 #ifdef MULTIPROCESSOR
-extern void *rmixl_intr_init_ipi(void);
+extern void rmixl_intr_init_ipi(void);
 #endif
 
 #endif	/* _MIPS_RMI_RMIXL_INTR_H_ */



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

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 21:27:15 UTC 2011

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

Log Message:
- use mutex_obj_alloc() instead of declaring locks statically


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.27 -r1.1.2.28 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_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.27 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.28
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.27	Tue Feb  8 19:50:22 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Tue Feb  8 21:27:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.27 2011/02/08 19:50:22 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.28 2011/02/08 21:27:15 cliff 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.27 2011/02/08 19:50:22 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.28 2011/02/08 21:27:15 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -95,7 +95,6 @@
 #include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
 
-// #define IOINTR_DEBUG	1
 #ifdef IOINTR_DEBUG
 int iointr_debug = IOINTR_DEBUG;
 # define DPRINTF(x)	do { if (iointr_debug) printf x ; } while(0)
@@ -351,13 +350,14 @@
 
 /*
  * mask of CPUs attached
- * once they are attached, this var is read-only so mp safe
+ * while CPUs are attaching, we cast to volatile;
+ * once they are attached, it's read-only so mp safe
  */
 static uint32_t cpu_present_mask;
 
-kmutex_t rmixl_ipi_lock;	/* covers RMIXL_PIC_IPIBASE */
-kmutex_t rmixl_intr_lock;	/* covers rest of PIC, and rmixl_intrhand[] */
-rmixl_intrhand_t rmixl_intrhand[NINTRVECS];
+static kmutex_t *rmixl_ipi_lock;  /* covers RMIXL_PIC_IPIBASE */
+static kmutex_t *rmixl_intr_lock; /* covers rest of PIC, and rmixl_intrhand[] */
+static rmixl_intrhand_t rmixl_intrhand[NINTRVECS];
 
 #ifdef DIAGNOSTIC
 static int rmixl_pic_init_done;
@@ -411,10 +411,10 @@
 			__func__, rmixl_pic_init_done);
 #endif
 
-	mutex_init(rmixl_ipi_lock, MUTEX_DEFAULT, IPL_HIGH);
-	mutex_init(rmixl_intr_lock, MUTEX_DEFAULT, IPL_HIGH);
+	rmixl_ipi_lock  = mutex_obj_alloc(MUTEX_DEFAULT, IPL_HIGH);
+	rmixl_intr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_HIGH);
 
-	mutex_enter(rmixl_intr_lock);
+	mutex_enter(rmixl_intr_lock);
 
 	/*
 	 * initialize (zero) all IRT Entries in the PIC
@@ -436,7 +436,7 @@
 #ifdef DIAGNOSTIC
 	rmixl_pic_init_done = 1;
 #endif
-	mutex_exit(rmixl_intr_lock);
+	mutex_exit(rmixl_intr_lock);
 
 }
 
@@ -451,13 +451,13 @@
 {
 	int vec = ffs(MIPS_INT_MASK_5  8) - 1;
 
-	mutex_enter(rmixl_intr_lock);
+	mutex_enter(rmixl_intr_lock);
 
 	void *ih = rmixl_vec_establish(vec, 0, IPL_SCHED, NULL, NULL, false);
 	if (ih == NULL)
 		panic(%s: establish vec %d failed, __func__, vec);
 
-	mutex_exit(rmixl_intr_lock);
+	mutex_exit(rmixl_intr_lock);
 	
 }
 
@@ -471,7 +471,7 @@
 	u_int ipi, vec;
 	void *ih;
 
-	mutex_enter(rmixl_intr_lock);
+	mutex_enter(rmixl_intr_lock);
 
 	for (ipi=0; ipi  NIPIS; ipi++) {
 		vec = RMIXL_INTRVEC_IPI + ipi;
@@ -484,7 +484,7 @@
 
 	mips_locoresw.lsw_send_ipi = rmixl_send_ipi;
 
-	mutex_exit(rmixl_intr_lock);
+	mutex_exit(rmixl_intr_lock);
 
 }
 #endif 	/* MULTIPROCESSOR */
@@ -646,7 +646,7 @@
 static void
 rmixl_irt_disestablish(int irt)
 {
-	KASSERT(mutex_owned(rmixl_intr_lock));
+	KASSERT(mutex_owned(rmixl_intr_lock));
 	DPRINTF((%s: irt %d, irtc1 %#x\n, __func__, irt, 0));
 	rmixl_irt_init(irt);
 }
@@ -662,7 +662,7 @@
 	uint32_t irtc1;
 	uint32_t irtc0;
 
-	KASSERT(mutex_owned(rmixl_intr_lock));
+	KASSERT(mutex_owned(rmixl_intr_lock));
 
 	if (irt = NIRTS)
 		panic(%s: bad irt %d\n, __func__, irt);
@@ -724,7 +724,7 @@
 	uint64_t eimr_bit;
 	int s;
 
-	KASSERT(mutex_owned(rmixl_intr_lock));
+	KASSERT(mutex_owned(rmixl_intr_lock));
 
 	DPRINTF((%s: vec %d, cpumask %#x, ipl %d, func %p, arg %p\n
 			__func__, vec, cpumask, ipl, func, arg));
@@ -804,7 +804,7 @@
 
 	DPRINTF((%s: irt %d, vec %d, ipl %d\n, __func__, irt, vec, ipl));
 
-	mutex_enter(rmixl_intr_lock);
+	mutex_enter(rmixl_intr_lock);
 
 	/*
 	 * establish vector
@@ -816,7 +816,7 @@
 	 */
 	rmixl_irt_establish(irt, vec, cpumask, trigger, polarity);
 
-	mutex_exit(rmixl_intr_lock);
+	mutex_exit(rmixl_intr_lock);
 
 	return ih;
 }
@@ -827,7 +827,7 @@
 	rmixl_intrhand_t *ih = cookie;
 	uint64_t eimr_bit;
 
-	KASSERT(mutex_owned(rmixl_intr_lock));
+	KASSERT(mutex_owned(rmixl_intr_lock));
 	KASSERT(ih-ih_vec  NINTRVECS);
 	KASSERT(ih == rmixl_intrhand[ih-ih_vec]);
 
@@ -851,7 +851,7 @@
 	KASSERT(vec  NINTRVECS);
 	KASSERT(ih == rmixl_intrhand[vec]);
 
-	mutex_enter(rmixl_intr_lock);
+	mutex_enter(rmixl_intr_lock);
 
 	/*
 	 * disable/invalidate the IRT Entry if needed
@@ -864,7 +864,7 @@
 	 */
 	rmixl_vec_disestablish(cookie);
 
-	

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

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 22:37:36 UTC 2011

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

Log Message:
- in rmixl_intr_init_clk, use MIPS_INT_MASK_SHIFT instead of 8
when calculating vector number for clock.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.28 -r1.1.2.29 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_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.28 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.29
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.28	Tue Feb  8 21:27:15 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Tue Feb  8 22:37:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.28 2011/02/08 21:27:15 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.29 2011/02/08 22:37:36 cliff 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.28 2011/02/08 21:27:15 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.29 2011/02/08 22:37:36 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -449,7 +449,7 @@
 void
 rmixl_intr_init_clk(void)
 {
-	int vec = ffs(MIPS_INT_MASK_5  8) - 1;
+	int vec = ffs(MIPS_INT_MASK_5  MIPS_INT_MASK_SHIFT) - 1;
 
 	mutex_enter(rmixl_intr_lock);
 



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

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 23:01:28 UTC 2011

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

Log Message:
- make compile without MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_cpucore.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_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.19 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.20
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.19	Tue Feb  8 19:50:22 2011
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Tue Feb  8 23:01:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.1.2.19 2011/02/08 19:50:22 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.1.2.20 2011/02/08 23:01:28 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.19 2011/02/08 19:50:22 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.20 2011/02/08 23:01:28 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -168,7 +168,6 @@
 cpu_rmixl_attach(device_t parent, device_t self, void *aux)
 {
 	struct rmixl_cpu_softc * const sc = device_private(self);
-	struct cpucore_attach_args *ca = aux;
 	struct cpu_info *ci = NULL;
 	static bool once = false;
 	extern void rmixl_spl_init_cpu(void);
@@ -190,6 +189,7 @@
 		struct cpucore_softc * const ccsc = device_private(parent);
 		rmixlfw_psb_type_t psb_type = rmixl_configuration.rc_psb_type;
 		cpuid_t cpuid;
+		struct cpucore_attach_args *ca = aux;
 
 		KASSERT(ca-ca_core  8);
 		KASSERT(ca-ca_thread  4);

Index: src/sys/arch/mips/rmi/rmixl_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.9 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.10
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.9	Tue Feb  8 06:03:36 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Tue Feb  8 23:01:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.9 2011/02/08 06:03:36 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.10 2011/02/08 23:01:28 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.1.2.9 2011/02/08 06:03:36 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.1.2.10 2011/02/08 23:01:28 cliff Exp $);
 
 #include opt_multiprocessor.h
 
@@ -91,9 +91,10 @@
 
 	sc-sc_dev = self;
 	sc-sc_core = na-na_core;
-	sc-sc_hatched = false;
 
 #ifdef MULTIPROCESSOR
+	sc-sc_hatched = false;
+
 	/*
 	 * Create the TLB structure needed - one per core and core0 uses the
 	 * default one for the system.



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

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 19:50:23 UTC 2011

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

Log Message:
- remove sc_ih_clk, sc_ih_fmn, sc_ih_ipi from struct rmixl_cpu_softc;
they were unused just taking up space
- rmixl_intr_init_clk() and rmixl_intr_init_ipi() are now type void


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_cpuvar.h
cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/arch/mips/rmi/rmixl_intr.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_intr.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

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 21:27:15 UTC 2011

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

Log Message:
- use mutex_obj_alloc() instead of declaring locks statically


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.27 -r1.1.2.28 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/rmi

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 22:37:36 UTC 2011

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

Log Message:
- in rmixl_intr_init_clk, use MIPS_INT_MASK_SHIFT instead of 8
when calculating vector number for clock.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.28 -r1.1.2.29 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/rmi

2011-02-08 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 23:01:28 UTC 2011

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

Log Message:
- make compile without MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/sys/arch/mips/rmi/rmixl_cpu.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/arch/mips/rmi/rmixl_cpucore.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

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:03:01 UTC 2011

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

Log Message:
- renamed cpu_rmixl_attach_once() to cpu_rmixl_attach_primary() (more clear)
- cpu_rmixl_attach_primary() obtains ci_cpuid from COP0 EBASE reg
instead of assuming always cpuid==0
- in cpu_rmixl_attach(), first call of the function determines we are attaching
primary cpu, instead of asuming core0 thread0 is always the primary cpu
- cpu_fmn_intr() uses CPU_IS_PRIMARY() instead of asuming cpu_number()==0
always indicates the primary cpu
- debug function rmixl_cpuinfo_print() argument is now a cpu index, not cpuid


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixl_cpu.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_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.17 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.18
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.17	Sat Feb  5 06:10:29 2011
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Tue Feb  8 06:03:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.1.2.17 2011/02/05 06:10:29 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.1.2.18 2011/02/08 06:03:01 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.17 2011/02/05 06:10:29 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.18 2011/02/08 06:03:01 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -70,7 +70,7 @@
 
 static int	cpu_rmixl_match(device_t, cfdata_t, void *);
 static void	cpu_rmixl_attach(device_t, device_t, void *);
-static void	cpu_rmixl_attach_once(struct rmixl_cpu_softc * const);
+static void	cpu_rmixl_attach_primary(struct rmixl_cpu_softc * const);
 #ifdef NOTYET
 static int	cpu_fmn_intr(void *, rmixl_fmn_rxmsg_t *);
 #endif
@@ -87,7 +87,7 @@
 #ifdef DEBUG
 void		rmixl_cpu_data_print(struct cpu_data *);
 struct cpu_info *
-		rmixl_cpuinfo_print(cpuid_t);
+		rmixl_cpuinfo_print(u_int);
 #endif	/* DEBUG */
 
 CFATTACH_DECL_NEW(cpu_rmixl, sizeof(struct rmixl_cpu_softc),
@@ -170,16 +170,19 @@
 	struct rmixl_cpu_softc * const sc = device_private(self);
 	struct cpucore_attach_args *ca = aux;
 	struct cpu_info *ci = NULL;
+	static bool once = false;
 	extern void rmixl_spl_init_cpu(void);
-
-	if (ca-ca_thread == 0  ca-ca_core == 0) {
+	
+	if (once == false) {
+		/* first attach is the primary cpu */
+		once = true;
 		ci = curcpu();
 		sc-sc_dev = self;
 		sc-sc_ci = ci;
 		ci-ci_softc = (void *)sc;
 
 		rmixl_spl_init_cpu();	/* spl initialization for CPU#0 */
-		cpu_rmixl_attach_once(sc);
+		cpu_rmixl_attach_primary(sc);
 
 #ifdef MULTIPROCESSOR
 		mips_locoresw.lsw_cpu_init = cpu_rmixl_hatch;
@@ -232,15 +235,22 @@
 cpu_attach_common(self, ci);
 }
 
+/*
+ * attach the primary processor
+ */
 static void
-cpu_rmixl_attach_once(struct rmixl_cpu_softc * const sc)
+cpu_rmixl_attach_primary(struct rmixl_cpu_softc * const sc)
 {
-	static bool once = false;
+	struct cpu_info *ci = sc-sc_ci;
+	uint32_t ebase;
+
+	KASSERT(CPU_IS_PRIMARY(ci));
 
-	KASSERT(once != true);
-	if (once == true)
-		return;
-	once = true;
+	/*
+	 * obtain and set cpuid of the primary processor
+	 */
+	asm volatile(dmfc0 %0, $15, 1; : =r(ebase));
+	ci-ci_cpuid = ebase  __BITS(9,0);
 
 #if defined(DDB)  defined(MIPS_DDB_WATCH)
 	cpu_rmixl_db_watch_init();
@@ -268,8 +278,8 @@
 static int
 cpu_fmn_intr(void *arg, rmixl_fmn_rxmsg_t *rxmsg)
 {
-	if (cpu_number() == 0) {
-		printf(%s: cpu %ld: rxsid=%#x, code=%d, size=%d\n,
+	if (CPU_IS_PRIMARY(curcpu())) {
+		printf(%s: cpu%ld: rxsid=%#x, code=%d, size=%d\n,
 			__func__, cpu_number(),
 			rxmsg-rxsid, rxmsg-code, rxmsg-size);
 		for (int i=0; i  rxmsg-size; i++)
@@ -426,9 +436,9 @@
 }
 
 struct cpu_info *
-rmixl_cpuinfo_print(cpuid_t cpuid)
+rmixl_cpuinfo_print(u_int cpuindex)
 {
-	struct cpu_info * const ci = cpu_lookup(cpuid);
+	struct cpu_info * const ci = cpu_lookup(cpuindex);
 
 	if (ci != NULL) {
 		rmixl_cpu_data_print(ci-ci_data);



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

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:03:56 UTC 2011

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

Log Message:
- eliminate assumptions that cpuid 0 is primary
- distinguish between cpuid and cpu index.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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.5 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.6
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.5	Sat Feb  5 06:11:16 2011
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Tue Feb  8 06:03:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_fmn.c,v 1.1.2.5 2011/02/05 06:11:16 cliff Exp $	*/
+/*	$NetBSD: rmixl_fmn.c,v 1.1.2.6 2011/02/08 06:03:56 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,6 +32,7 @@
 
 #include sys/cdefs.h
 #include sys/param.h
+#include sys/systm.h
 #include sys/cpu.h
 #include mips/cpuregs.h
 #include mips/rmi/rmixlreg.h
@@ -404,8 +405,9 @@
 	fmn_t *fmnp;
 	static bool once=false;
 
-	KASSERT(cpu_number() == 0);
-	fmnp = fmn_lookup(cpu_number());
+	KASSERTMSG((CPU_IS_PRIMARY(curcpu())), (ci=%p, index=%d\n,
+		curcpu(), cpu_index(curcpu(;
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 
 	if (once == true)
 		panic(%s: call only once!, __func__);
@@ -480,10 +482,10 @@
 	fmn_t *fmnp;
 	kmutex_t *lk;
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 	KASSERT(fmnp != NULL);
-	KASSERT(fmnp-fmn_core == RMIXL_CPU_CORE(cpu_number()));
-	KASSERT(fmnp-fmn_thread == RMIXL_CPU_THREAD(cpu_number()));
+	KASSERT(fmnp-fmn_core == RMIXL_CPU_CORE(curcpu()-ci_cpuid));
+	KASSERT(fmnp-fmn_thread == RMIXL_CPU_THREAD(curcpu()-ci_cpuid));
 
 	lk = mutex_obj_alloc(MUTEX_DEFAULT, RMIXL_FMN_INTR_IPL);
 	if (lk == NULL)
@@ -633,7 +635,7 @@
 {
 	fmn_t *fmnp;
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 	mutex_enter(fmnp-fmn_lock);
 
 	for (int i=0; i  fmnp-fmn_nstid; i++)
@@ -665,7 +667,7 @@
 	fmn_t *fmnp;
 	fmn_intrhand_t *ih;
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 
 	mutex_enter(fmnp-fmn_lock);
 
@@ -692,7 +694,7 @@
 	fmn_t *fmnp;
 	fmn_intrhand_t *ih = cookie;
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 	mutex_enter(fmnp-fmn_lock);
 
 	if (ih-ih_func != NULL) {
@@ -786,7 +788,7 @@
 	KASSERT(code = 0xff);
 	KASSERT(dest_id = 0xff);
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 	mutex_enter(fmnp-fmn_lock);
 cp0_status = rmixl_cp2_enable();
 
@@ -821,13 +823,13 @@
 			goto send;
 		DELAY(10);		/* XXX ??? */
 	}
-	DIAG_PRF((%s: cpu=%ld, msg %p, dst_id=%d, sts=%#x: can't send\n,
+	DIAG_PRF((%s: cpu%d, msg %p, dst_id=%d, sts=%#x: can't send\n,
 		__func__, cpu_number(), msg, dest_id, msg_status));
 	rv = -1;
 	goto out;
  send:
 	desc = RMIXL_MSGSND_DESC(size, code, dest_id);
-	DPRINTF((%s: cpu %ld, desc %#x\n, __func__, cpu_number(), desc));
+	DPRINTF((%s: cpu%d, desc %#x\n, __func__, cpu_number(), desc));
 	for (int try=16; try--; ) {
 		rmixl_msgsnd(desc);
 		RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
@@ -853,7 +855,7 @@
 			RMIXL_MTC2(RMIXL_COP_2_MSG_STS, 1, msg_status1);
 		}
 		DIAG_PRF((%s: src=%ld, dst=%d, sts=%#x, %#x: send error, try %d\n,
-			__func__, cpu_number(), dest_id, msg_status, msg_status1, try));
+			__func__, curcpu()-ci_cpuid, dest_id, msg_status, msg_status1, try));
 		DELAY(10);
 	}
 	rv = -1;
@@ -876,7 +878,7 @@
 	fmn_t *fmnp;
 	int rv;
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 	mutex_enter(fmnp-fmn_lock);
 	rv = rmixl_fmn_msg_recv_subr(bucket, rxmsg);
 	mutex_exit(fmnp-fmn_lock);
@@ -897,7 +899,7 @@
 	uint32_t msg_status;
 	int rv;
 
-	fmnp = fmn_lookup(cpu_number());
+	fmnp = fmn_lookup(curcpu()-ci_cpuid);
 	KASSERT(mutex_owned(fmnp-fmn_lock) != 0);
 
 	for (int try=16; try--; ) {
@@ -905,14 +907,14 @@
 		if ((msg_status  (RMIXL_MSG_STS0_LPF)) == 0)
 			goto recv;
 	}
-	DIAG_PRF((%s: cpu=%ld, bucket=%d, sts=%#x: Load Pending Fail\n,
+	DIAG_PRF((%s: cpu%d, bucket=%d, sts=%#x: Load Pending Fail\n,
 		__func__, cpu_number(), bucket, msg_status));
 	rv = -1;
 	goto out;
  recv:
 	rmixl_msgld(bucket);
 	RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
-	DPRINTF((%s: cpu=%ld, bucket=%d, sts=%#x\n,
+	DPRINTF((%s: cpu%d, bucket=%d, sts=%#x\n,
 		__func__, cpu_number(), bucket, msg_status));
 	rv = msg_status  (RMIXL_MSG_STS0_LEF|RMIXL_MSG_STS0_LPF);
 	if (rv == 0) {
@@ -1146,7 +1148,7 @@
 	FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+3, 0, cc[3][0]);
 	FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+3, 4, cc[3][4]);
 
-	printf(%s: cpu %ld\n, __func__, cpu_number());
+	printf(%s: cpu%d\n, __func__, cpu_number());
 	for (int i=0; i  4; i++) {
 		for (int j=0; j  8; j++)
 			printf( %#x,, cc[i][j]);


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

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:04:20 UTC 2011

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

Log Message:
- distinguish between cpuid and cpu index.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 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_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.25 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.26
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.25	Sat Feb  5 06:11:47 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Tue Feb  8 06:04:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.25 2011/02/05 06:11:47 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.26 2011/02/08 06:04:20 cliff 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.25 2011/02/05 06:11:47 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.26 2011/02/08 06:04:20 cliff Exp $);
 
 #include opt_multiprocessor.h
 #include opt_ddb.h
@@ -508,8 +508,8 @@
 			device_xname(sc-sc_dev),
 			rmixl_intr_string(vec));
 
-	KASSERT(ci-ci_cpuid  (sizeof(cpu_present_mask) * 8));
-	atomic_or_32((volatile uint32_t *)cpu_present_mask, 1  ci-ci_cpuid);
+	KASSERT(cpu_index(ci)  (sizeof(cpu_present_mask) * 8));
+	atomic_or_32((volatile uint32_t *)cpu_present_mask, 1  cpu_index(ci));
 }
 
 /*
@@ -955,9 +955,9 @@
 static int
 rmixl_send_ipi(struct cpu_info *ci, int tag)
 {
-	const cpuid_t cpu = ci-ci_cpuid;
-	uint32_t core = (uint32_t)(cpu  2);
-	uint32_t thread = (uint32_t)(cpu  __BITS(1,0));
+	const cpuid_t cpuid = ci-ci_cpuid;
+	uint32_t core = (uint32_t)(cpuid  2);
+	uint32_t thread = (uint32_t)(cpuid  __BITS(1,0));
 	uint64_t req = 1  tag;
 	uint32_t r;
 	extern volatile mips_cpuset_t cpus_running;



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

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:03:01 UTC 2011

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

Log Message:
- renamed cpu_rmixl_attach_once() to cpu_rmixl_attach_primary() (more clear)
- cpu_rmixl_attach_primary() obtains ci_cpuid from COP0 EBASE reg
instead of assuming always cpuid==0
- in cpu_rmixl_attach(), first call of the function determines we are attaching
primary cpu, instead of asuming core0 thread0 is always the primary cpu
- cpu_fmn_intr() uses CPU_IS_PRIMARY() instead of asuming cpu_number()==0
always indicates the primary cpu
- debug function rmixl_cpuinfo_print() argument is now a cpu index, not cpuid


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/arch/mips/rmi/rmixl_cpu.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

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:03:36 UTC 2011

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

Log Message:
- cpucore_rmixl_attach() now examines 'userapp_cpu_map' bitmask obtained
from the firmware, and avoids attaching threads that are not enabled there.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixl_cpucore.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

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:03:56 UTC 2011

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

Log Message:
- eliminate assumptions that cpuid 0 is primary
- distinguish between cpuid and cpu index.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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/rmi

2011-02-07 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Tue Feb  8 06:04:20 UTC 2011

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

Log Message:
- distinguish between cpuid and cpu index.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 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/rmi

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:10:29 UTC 2011

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

Log Message:
- include opt_multiprocessor.h for MULTIPROCESSOR dependency
- add suport for MIPS COP0 watchpoint in ddb
- add ci_pmap_asid_cur print in rmixl_cpuinfo_print().
- note rmixl_cpuinfo_print() (or something like it) should eventually get moved
into a md support fn of a (hypothetical) ddb 'show cpu' command.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixl_cpu.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_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.16 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.17
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.16	Fri Jan  7 00:17:22 2011
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Sat Feb  5 06:10:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.1.2.16 2011/01/07 00:17:22 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.1.2.17 2011/02/05 06:10:29 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,10 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.16 2011/01/07 00:17:22 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.17 2011/02/05 06:10:29 cliff Exp $);
+
+#include opt_multiprocessor.h
+#include opt_ddb.h
 
 #include sys/param.h
 #include sys/device.h
@@ -60,6 +63,9 @@
 #include mips/rmi/rmixl_cpuvar.h
 #include mips/rmi/rmixl_intr.h
 #include mips/rmi/rmixl_fmnvar.h
+#ifdef DDB
+#include mips/db_machdep.h
+#endif
 
 
 static int	cpu_rmixl_match(device_t, cfdata_t, void *);
@@ -91,6 +97,20 @@
 static struct rmixl_cpu_trampoline_args rmixl_cpu_trampoline_args;
 #endif
 
+#if defined(DDB)  defined(MIPS_DDB_WATCH)
+/*
+ * cpu_rmixl_db_watch_init - initialize COP0 watchpoint stuff
+ *
+ * clear IEU_DEFEATURE[DBE] to ensure T_WATCH on watchpoint exception
+ * set COP0 watchhi and watchlo
+ */
+static void
+cpu_rmixl_db_watch_init(void)
+{
+	db_mach_watch_set_all();
+}
+#endif	/* DDB  MIPS_DDB_WATCH */
+
 /*
  * cpu_xls616_erratum
  *
@@ -222,6 +242,10 @@
 		return;
 	once = true;
 
+#if defined(DDB)  defined(MIPS_DDB_WATCH)
+	cpu_rmixl_db_watch_init();
+#endif
+
 	rmixl_fmn_init();
 
 	sc-sc_ih_clk = rmixl_intr_init_clk();
@@ -280,6 +304,10 @@
 #endif
 
 	cpucore_rmixl_hatch(device_parent(sc-sc_dev));
+
+#if defined(DDB)  defined(MIPS_DDB_WATCH)
+	cpu_rmixl_db_watch_init();
+#endif
 }
 
 static int
@@ -422,6 +450,7 @@
 		for (int i=0; i  SOFTINT_COUNT; i++)
 			printf(ci_softlwps[%d] %p\n, i, ci-ci_softlwps[i]);
 		printf(ci_tlb_slot %d\n, ci-ci_tlb_slot);
+		printf(ci_pmap_asid_cur %d\n, ci-ci_pmap_asid_cur);
 		printf(ci_tlb_info %p\n, ci-ci_tlb_info);
 		printf(ci_pmap_seg0tab %p\n, ci-ci_pmap_seg0tab);
 #ifdef _LP64
@@ -441,5 +470,4 @@
 
 	return ci;
 }
-
 #endif	/* DEBUG */



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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:11:16 UTC 2011

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

Log Message:
- obtain rmixl_intr_lock before rmixl_vec_establish(),
he expects that lock is held


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 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.4 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.5
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.4	Tue Apr 13 18:15:16 2010
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Sat Feb  5 06:11:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_fmn.c,v 1.1.2.4 2010/04/13 18:15:16 cliff Exp $	*/
+/*	$NetBSD: rmixl_fmn.c,v 1.1.2.5 2011/02/05 06:11:16 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -644,10 +644,15 @@
 	/*
 	 * establish dispatcher for FMN interrupt
 	 */
-	void *ih = rmixl_vec_establish(RMIXL_INTRVEC_FMN, -1, RMIXL_FMN_INTR_IPL,
+	extern kmutex_t rmixl_intr_lock;
+	void *ih;
+
+	mutex_enter(rmixl_intr_lock);
+	ih = rmixl_vec_establish(RMIXL_INTRVEC_FMN, -1, RMIXL_FMN_INTR_IPL,
 		rmixl_fmn_intr_dispatch, fmnp, fmn);
 	if (ih == NULL)
 		panic(%s: rmixl_vec_establish failed, __func__);
+	mutex_exit(rmixl_intr_lock);
 	fmnp-fmn_ih = ih;
 #endif
 



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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:11:48 UTC 2011

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

Log Message:
- include opt_multiprocessor.h for MULTIPROCESSOR dependency
- use seperate vectors for various IPI tags, instead of all piling on one.
this theoretically allows different functions to interrupt at different
priorities.  the fmn vector number got rippled up in the process.
- add rmixl_ipi_lock to serialize access to RMIXL_PIC_IPIBASE
- add rmixl_intr_lock to serialize access to rest of PIC and rmixl_intrhand[]
- include mips/cpuset.h and use CPUSET_* macros for cpus_running etc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 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_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.24 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.25
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.24	Mon Sep 20 19:41:05 2010
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Sat Feb  5 06:11:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.24 2010/09/20 19:41:05 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.25 2011/02/05 06:11:47 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,8 +64,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.24 2010/09/20 19:41:05 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_intr.c,v 1.1.2.25 2011/02/05 06:11:47 cliff Exp $);
 
+#include opt_multiprocessor.h
 #include opt_ddb.h
 #define	__INTR_PRIVATE
 
@@ -76,6 +77,7 @@
 #include sys/device.h
 #include sys/kernel.h
 #include sys/atomic.h
+#include sys/mutex.h
 #include sys/cpu.h
 
 #include machine/bus.h
@@ -290,14 +292,14 @@
 	vec 6,		/*  6 */
 	vec 7,		/*  7 */
 	vec 8 (ipi),		/*  8 */
-	vec 9 (fmn),		/*  9 */
-	vec 10,		/* 10 */
-	vec 11,		/* 11 */
-	vec 12,		/* 12 */
-	vec 13,		/* 13 */
-	vec 14,		/* 14 */
-	vec 15,		/* 15 */
-	vec 16,		/* 16 */
+	vec 9 (ipi),		/*  9 */
+	vec 10 (ipi),		/* 10 */
+	vec 11 (ipi),		/* 11 */
+	vec 12 (ipi),		/* 12 */
+	vec 13 (ipi),		/* 13 */
+	vec 14 (ipi),		/* 14 */
+	vec 15 (ipi),		/* 15 */
+	vec 16 (fmn),		/* 16 */
 	vec 17,		/* 17 */
 	vec 18,		/* 18 */
 	vec 19,		/* 19 */
@@ -353,6 +355,8 @@
  */
 static uint32_t cpu_present_mask;
 
+kmutex_t rmixl_ipi_lock;	/* covers RMIXL_PIC_IPIBASE */
+kmutex_t rmixl_intr_lock;	/* covers rest of PIC, and rmixl_intrhand[] */
 rmixl_intrhand_t rmixl_intrhand[NINTRVECS];
 
 #ifdef DIAGNOSTIC
@@ -407,6 +411,11 @@
 			__func__, rmixl_pic_init_done);
 #endif
 
+	mutex_init(rmixl_ipi_lock, MUTEX_DEFAULT, IPL_HIGH);
+	mutex_init(rmixl_intr_lock, MUTEX_DEFAULT, IPL_HIGH);
+
+	mutex_enter(rmixl_intr_lock);
+
 	/*
 	 * initialize (zero) all IRT Entries in the PIC
 	 */
@@ -427,6 +436,7 @@
 #ifdef DIAGNOSTIC
 	rmixl_pic_init_done = 1;
 #endif
+	mutex_exit(rmixl_intr_lock);
 
 }
 
@@ -440,9 +450,14 @@
 rmixl_intr_init_clk(void)
 {
 	int vec = ffs(MIPS_INT_MASK_5  8) - 1;
+
+	mutex_enter(rmixl_intr_lock);
+
 	void *ih = rmixl_vec_establish(vec, 0, IPL_SCHED, NULL, NULL, false);
 	if (ih == NULL)
 		panic(%s: establish vec %d failed, __func__, vec);
+
+	mutex_exit(rmixl_intr_lock);
 	
 	return ih;
 }
@@ -454,14 +469,24 @@
 void *
 rmixl_intr_init_ipi(void)
 {
-	void *ih = rmixl_vec_establish(RMIXL_INTRVEC_IPI, -1, IPL_SCHED,
-		rmixl_ipi_intr, NULL, false);
-	if (ih == NULL)
-		panic(%s: establish vec %d failed,
-			__func__, RMIXL_INTRVEC_IPI);
+	u_int ipi, vec;
+	void *ih;
+
+	mutex_enter(rmixl_intr_lock);
+
+	for (ipi=0; ipi  NIPIS; ipi++) {
+		vec = RMIXL_INTRVEC_IPI + ipi;
+		ih = rmixl_vec_establish(vec, -1, IPL_SCHED,
+			rmixl_ipi_intr, (void *)(uintptr_t)ipi, true);
+		if (ih == NULL)
+			panic(%s: establish ipi %d at vec %d failed,
+__func__, ipi, vec);
+	}
 
 	mips_locoresw.lsw_send_ipi = rmixl_send_ipi;
 
+	mutex_exit(rmixl_intr_lock);
+
 	return ih;
 }
 #endif 	/* MULTIPROCESSOR */
@@ -484,7 +509,7 @@
 			rmixl_intr_string(vec));
 
 	KASSERT(ci-ci_cpuid  (sizeof(cpu_present_mask) * 8));
-	cpu_present_mask |= 1  ci-ci_cpuid;
+	atomic_or_32((volatile uint32_t *)cpu_present_mask, 1  ci-ci_cpuid);
 }
 
 /*
@@ -623,6 +648,7 @@
 static void
 rmixl_irt_disestablish(int irt)
 {
+	KASSERT(mutex_owned(rmixl_intr_lock));
 	DPRINTF((%s: irt %d, irtc1 %#x\n, __func__, irt, 0));
 	rmixl_irt_init(irt);
 }
@@ -638,6 +664,8 @@
 	uint32_t irtc1;
 	uint32_t irtc0;
 
+	KASSERT(mutex_owned(rmixl_intr_lock));
+
 	if (irt = NIRTS)
 		panic(%s: bad irt %d\n, __func__, irt);
 
@@ -698,6 +726,8 @@
 	uint64_t eimr_bit;
 	int s;
 
+	KASSERT(mutex_owned(rmixl_intr_lock));
+
 	DPRINTF((%s: vec %d, cpumask %#x, ipl %d, func %p, arg %p\n
 			__func__, vec, cpumask, ipl, func, arg));
 #ifdef DIAGNOSTIC
@@ -756,7 +786,6 @@
 {
 	rmixl_intrhand_t *ih;
 	int vec;
-	int s;
 
 #ifdef DIAGNOSTIC
 	if (rmixl_pic_init_done == 0)
@@ -777,7 +806,7 @@
 

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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:12:42 UTC 2011

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

Log Message:
- include opt_multiprocessor.h for MULTIPROCESSOR dependency
- move RMIXL_INTRVEC_FMN to RMIXL_INTRVEC_IPI + NIPIS
since each IPI tag now has own vector


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_intr.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_intr.h
diff -u src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.4 src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.5
--- src/sys/arch/mips/rmi/rmixl_intr.h:1.1.2.4	Fri May 21 23:35:42 2010
+++ src/sys/arch/mips/rmi/rmixl_intr.h	Sat Feb  5 06:12:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.h,v 1.1.2.4 2010/05/21 23:35:42 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.h,v 1.1.2.5 2011/02/05 06:12:42 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,6 +31,8 @@
 #ifndef _MIPS_RMI_RMIXL_INTR_H_
 #define _MIPS_RMI_RMIXL_INTR_H_
 
+#include opt_multiprocessor.h
+
 /*
  * A 'vector' is bit number in EIRR/EIMR
  * - non-IRT-based interrupts use vectors 0..31
@@ -54,7 +56,7 @@
  * vectors (8 = vec  31) are for other non-IRT based interrupts
  */
 #define RMIXL_INTRVEC_IPI	8
-#define RMIXL_INTRVEC_FMN	9
+#define RMIXL_INTRVEC_FMN	(RMIXL_INTRVEC_IPI + NIPIS)
 
 typedef enum {
 	RMIXL_TRIG_NONE=0,



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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:13:17 UTC 2011

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

Log Message:
- if obio_intr is OBIOCF_INTR_DEFAULT, don't establish an interrupt


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/rmi/rmixl_usbi.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_usbi.c
diff -u src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.5 src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.6
--- src/sys/arch/mips/rmi/rmixl_usbi.c:1.1.2.5	Mon Apr 12 22:42:07 2010
+++ src/sys/arch/mips/rmi/rmixl_usbi.c	Sat Feb  5 06:13:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_usbi.c,v 1.1.2.5 2010/04/12 22:42:07 cliff Exp $	*/
+/*	$NetBSD: rmixl_usbi.c,v 1.1.2.6 2011/02/05 06:13:16 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_usbi.c,v 1.1.2.5 2010/04/12 22:42:07 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_usbi.c,v 1.1.2.6 2011/02/05 06:13:16 cliff Exp $);
 
 #include locators.h
 
@@ -173,11 +173,14 @@
 	RMIXL_USBI_GEN_WRITE(RMIXL_USB_INTERRUPT_ENABLE, 0);
 
 	/* establish interrupt */
-	ih = rmixl_intr_establish(obio-obio_intr, obio-obio_tmsk,
-		IPL_USB, RMIXL_TRIG_LEVEL, RMIXL_POLR_HIGH,
-		rmixl_usbi_intr, sc, false);
-	if (ih == NULL)
-		panic(%s: couldn't establish interrupt, device_xname(self));
+	if (obio-obio_intr != OBIOCF_INTR_DEFAULT) {
+		ih = rmixl_intr_establish(obio-obio_intr, obio-obio_tmsk,
+			IPL_USB, RMIXL_TRIG_LEVEL, RMIXL_POLR_HIGH,
+			rmixl_usbi_intr, sc, false);
+		if (ih == NULL)
+			panic(%s: couldn't establish interrupt,
+device_xname(self));
+	}
 
 	aprint_normal(\n);
 



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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:10:29 UTC 2011

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

Log Message:
- include opt_multiprocessor.h for MULTIPROCESSOR dependency
- add suport for MIPS COP0 watchpoint in ddb
- add ci_pmap_asid_cur print in rmixl_cpuinfo_print().
- note rmixl_cpuinfo_print() (or something like it) should eventually get moved
into a md support fn of a (hypothetical) ddb 'show cpu' command.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/sys/arch/mips/rmi/rmixl_cpu.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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:11:16 UTC 2011

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

Log Message:
- obtain rmixl_intr_lock before rmixl_vec_establish(),
he expects that lock is held


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 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/rmi

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:11:48 UTC 2011

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

Log Message:
- include opt_multiprocessor.h for MULTIPROCESSOR dependency
- use seperate vectors for various IPI tags, instead of all piling on one.
this theoretically allows different functions to interrupt at different
priorities.  the fmn vector number got rippled up in the process.
- add rmixl_ipi_lock to serialize access to RMIXL_PIC_IPIBASE
- add rmixl_intr_lock to serialize access to rest of PIC and rmixl_intrhand[]
- include mips/cpuset.h and use CPUSET_* macros for cpus_running etc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 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/rmi

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:12:42 UTC 2011

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

Log Message:
- include opt_multiprocessor.h for MULTIPROCESSOR dependency
- move RMIXL_INTRVEC_FMN to RMIXL_INTRVEC_IPI + NIPIS
since each IPI tag now has own vector


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_intr.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

2011-02-04 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Sat Feb  5 06:13:17 UTC 2011

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

Log Message:
- if obio_intr is OBIOCF_INTR_DEFAULT, don't establish an interrupt


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/rmi/rmixl_usbi.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

2011-01-06 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Jan  7 00:16:20 UTC 2011

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

Log Message:
- add prottotype for rmixl_pcr_init_core()


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 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.18 src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.19
--- src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.18	Sat Apr 17 07:33:33 2010
+++ src/sys/arch/mips/rmi/rmixlvar.h	Fri Jan  7 00:16:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlvar.h,v 1.1.2.18 2010/04/17 07:33:33 cliff Exp $	*/
+/*	$NetBSD: rmixlvar.h,v 1.1.2.19 2011/01/07 00:16:20 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -46,6 +46,8 @@
 
 #include dev/pci/pcivar.h
 
+extern void rmixl_pcr_init_core(void);
+
 static inline bool
 cpu_rmixl(const struct pridtab *ct)
 {



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

2011-01-06 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Jan  7 00:16:59 UTC 2011

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

Log Message:
- add cpucore_rmixl_hatch() for per-core initialization


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_cpucore.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_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.6 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.7
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.6	Sun Mar 21 21:24:19 2010
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Fri Jan  7 00:16:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.6 2010/03/21 21:24:19 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.7 2011/01/07 00:16:59 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.1.2.6 2010/03/21 21:24:19 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.1.2.7 2011/01/07 00:16:59 cliff Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -50,6 +50,7 @@
 #include mips/rmi/rmixlvar.h
 #include mips/rmi/rmixl_cpunodevar.h
 #include mips/rmi/rmixl_cpucorevar.h
+#include mips/rmi/rmixl_fmnvar.h
 
 static int	cpucore_rmixl_match(device_t, cfdata_t, void *);
 static void	cpucore_rmixl_attach(device_t, device_t, void *);
@@ -87,6 +88,7 @@
 
 	sc-sc_dev = self;
 	sc-sc_core = na-na_core;
+	sc-sc_hatched = false;
 
 #ifdef MULTIPROCESSOR
 	/*
@@ -148,3 +150,24 @@
 
 	return (UNCONF);
 }
+
+#ifdef MULTIPROCESSOR
+/*
+ * cpucore_rmixl_hatch
+ *	called from cpu_rmixl_hatch for each cpu
+ *	the first call for each cpucore causes init of per-core features
+ */
+void
+cpucore_rmixl_hatch(device_t self)
+{
+	struct cpucore_softc * const sc = device_private(self);
+
+	if (sc-sc_hatched == false) {
+		/* PCRs for core#0 are set up in mach_init() */
+		if (sc-sc_core != 0)
+			rmixl_pcr_init_core();
+		rmixl_fmn_init_core();
+		sc-sc_hatched = true;
+	}
+}
+#endif	/* MULTIPROCESSOR */



  1   2   3   >