CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2011-07-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Jul 16 00:14:57 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1641):
sys/arch/sparc64/dev/lom.c: revision 1.8
Limit reading from registers at most once every second with using
ratecheck(9).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.7 src/sys/arch/sparc64/dev/lom.c:1.1.2.8
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.7	Sun Mar 20 21:23:32 2011
+++ src/sys/arch/sparc64/dev/lom.c	Sat Jul 16 00:14:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.8 2011/07/16 00:14:57 riz Exp $	*/
 /*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.8 2011/07/16 00:14:57 riz Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -171,6 +171,12 @@
 
 	int32_t			sc_sysctl_num[LOM_MAX_ALARM];
 
+	struct timeval		sc_alarm_lastread;
+	uint8_t			sc_alarm_lastval;
+	struct timeval		sc_fan_lastread[LOM_MAX_FAN];
+	struct timeval		sc_psu_lastread[LOM_MAX_PSU];
+	struct timeval		sc_temp_lastread[LOM_MAX_TEMP];
+
 	uint8_t			sc_fan_cal[LOM_MAX_FAN];
 	uint8_t			sc_fan_low[LOM_MAX_FAN];
 
@@ -239,6 +245,7 @@
 static const char *nodedesc[LOM_MAX_ALARM] =
 { Fault LED status, Alarm1 status, Alarm2 status , Alarm3 status };
 #endif
+static const struct timeval refresh_interval = { 1, 0 };
 
 static int
 lom_match(device_t parent, cfdata_t match, void *aux)
@@ -1002,24 +1009,31 @@
 	/* Fault LED or Alarms */
 	KASSERT(i  sc-sc_num_alarm);
 
-	if (lom_read(sc, LOM_IDX_ALARM, val)) {
-		edata-state = ENVSYS_SINVALID;
-	} else {
-		if (i == 0) {
-			/* Fault LED */
-			if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
-edata-value_cur = 0;
-			else
-edata-value_cur = 1;
-		} else {
-			/* Alarms */
-			if ((val  (LOM_ALARM_1  (i - 1))) == 0)
-edata-value_cur = 0;
-			else
-edata-value_cur = 1;
+	/* Read new value at most once every second. */
+	if (ratecheck(sc-sc_alarm_lastread, refresh_interval)) {
+		if (lom_read(sc, LOM_IDX_ALARM, val)) {
+			edata-state = ENVSYS_SINVALID;
+			return;
 		}
-		edata-state = ENVSYS_SVALID;
+		sc-sc_alarm_lastval = val;
+	} else {
+		val = sc-sc_alarm_lastval;
+	}
+
+	if (i == 0) {
+		/* Fault LED */
+		if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
+			edata-value_cur = 0;
+		else
+			edata-value_cur = 1;
+	} else {
+		/* Alarms */
+		if ((val  (LOM_ALARM_1  (i - 1))) == 0)
+			edata-value_cur = 0;
+		else
+			edata-value_cur = 1;
 	}
+	edata-state = ENVSYS_SVALID;
 }
 
 static void
@@ -1030,6 +1044,10 @@
 	/* Fan speed */
 	KASSERT(i  sc-sc_num_fan);
 
+	/* Read new value at most once every second. */
+	if (!ratecheck(sc-sc_fan_lastread[i], refresh_interval))
+		return;
+
 	if (lom_read(sc, LOM_IDX_FAN1 + i, val)) {
 		edata-state = ENVSYS_SINVALID;
 	} else {
@@ -1049,6 +1067,10 @@
 	/* PSU status */
 	KASSERT(i  sc-sc_num_psu);
 
+	/* Read new value at most once every second. */
+	if (!ratecheck(sc-sc_psu_lastread[i], refresh_interval))
+		return;
+
 	if (lom_read(sc, LOM_IDX_PSU1 + i, val) ||
 	!ISSET(val, LOM_PSU_PRESENT)) {
 		edata-state = ENVSYS_SINVALID;
@@ -1076,6 +1098,10 @@
 	/* Temperature */
 	KASSERT(i  sc-sc_num_temp);
 
+	/* Read new value at most once every second. */
+	if (!ratecheck(sc-sc_temp_lastread[i], refresh_interval))
+		return;
+
 	if (lom_read(sc, LOM_IDX_TEMP1 + i, val)) {
 		edata-state = ENVSYS_SINVALID;
 	} else {



CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2011-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Mar 20 21:23:32 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1570):
sys/arch/sparc64/dev/lom.c: revision 1.7
lom_refresh():
Update only the sensor status specified by the edata as noted in
sysmon_envsys(9).
lom_sysctl_alarm():
Update alarm status before reading via sysctl to make it usable at
a boot time.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.6 src/sys/arch/sparc64/dev/lom.c:1.1.2.7
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.6	Sun Mar 28 16:48:36 2010
+++ src/sys/arch/sparc64/dev/lom.c	Sun Mar 20 21:23:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $	*/
 /*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -217,6 +217,10 @@
 
 static int	lom_init_desc(struct lom_softc *);
 static void	lom_refresh(struct sysmon_envsys *, envsys_data_t *);
+static void	lom_refresh_alarm(struct lom_softc *, envsys_data_t *, uint32_t);
+static void	lom_refresh_fan(struct lom_softc *, envsys_data_t *, uint32_t);
+static void	lom_refresh_psu(struct lom_softc *, envsys_data_t *, uint32_t);
+static void	lom_refresh_temp(struct lom_softc *, envsys_data_t *, uint32_t);
 static void	lom1_write_hostname(struct lom_softc *);
 static void	lom2_write_hostname(struct lom_softc *);
 
@@ -947,88 +951,136 @@
 lom_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
 {
 	struct lom_softc *sc = sme-sme_cookie;
+	uint32_t i;
+
+	/* Sensor number */
+	i = edata-sensor;
+
+	/* Sensor type */
+	switch (edata-units) {
+	case ENVSYS_INDICATOR:
+		if (i  sc-sc_num_alarm)
+			lom_refresh_alarm(sc, edata, i);
+		else
+			lom_refresh_psu(sc, edata,
+			i - sc-sc_num_alarm - sc-sc_num_fan);
+		break;
+	case ENVSYS_SFANRPM:
+		lom_refresh_fan(sc, edata, i - sc-sc_num_alarm);
+		break;
+	case ENVSYS_STEMP:
+		lom_refresh_temp(sc, edata,
+		i - sc-sc_num_alarm - sc-sc_num_fan - sc-sc_num_psu);
+		break;
+	default:
+		edata-state = ENVSYS_SINVALID;
+		break;
+	}
+
+	/*
+	 * If our hostname is set and differs from what's stored in
+	 * the LOM, write the new hostname back to the LOM.  Note that
+	 * we include the terminating NUL when writing the hostname
+	 * back to the LOM, otherwise the LOM will print any trailing
+	 * garbage.
+	 */
+	if (i == 0  hostnamelen  0 
+	strncmp(sc-sc_hostname, hostname, sizeof(hostname)) != 0) {
+		if (sc-sc_type  LOM_LOMLITE2)
+			lom1_write_hostname(sc);
+		else
+			lom2_write_hostname(sc);
+		strlcpy(sc-sc_hostname, hostname, sizeof(hostname));
+	}
+}
+
+static void
+lom_refresh_alarm(struct lom_softc *sc, envsys_data_t *edata, uint32_t i)
+{
 	uint8_t val;
-	int i;
+
+	/* Fault LED or Alarms */
+	KASSERT(i  sc-sc_num_alarm);
 
 	if (lom_read(sc, LOM_IDX_ALARM, val)) {
-		for (i = 0; i  sc-sc_num_alarm; i++)
-			sc-sc_alarm[i].state = ENVSYS_SINVALID;
+		edata-state = ENVSYS_SINVALID;
 	} else {
-		/* Fault LED */
-		if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
-			sc-sc_alarm[0].value_cur = 0;
-		else
-			sc-sc_alarm[0].value_cur = 1;
-		sc-sc_alarm[0].state = ENVSYS_SVALID;
-
-		/* Alarms */
-		for (i = 1; i  sc-sc_num_alarm; i++) {
+		if (i == 0) {
+			/* Fault LED */
+			if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
+edata-value_cur = 0;
+			else
+edata-value_cur = 1;
+		} else {
+			/* Alarms */
 			if ((val  (LOM_ALARM_1  (i - 1))) == 0)
-sc-sc_alarm[i].value_cur = 0;
+edata-value_cur = 0;
 			else
-sc-sc_alarm[i].value_cur = 1;
-			sc-sc_alarm[i].state = ENVSYS_SVALID;
+edata-value_cur = 1;
 		}
+		edata-state = ENVSYS_SVALID;
 	}
+}
 
-	for (i = 0; i  sc-sc_num_fan; i++) {
-		if (lom_read(sc, LOM_IDX_FAN1 + i, val)) {
-			sc-sc_fan[i].state = ENVSYS_SINVALID;
-			continue;
-		}
+static void
+lom_refresh_fan(struct lom_softc *sc, envsys_data_t *edata, uint32_t i)
+{
+	uint8_t val;
+
+	/* Fan speed */
+	KASSERT(i  sc-sc_num_fan);
 
-		sc-sc_fan[i].value_cur = (60 * sc-sc_fan_cal[i] * val) / 100;
+	if (lom_read(sc, LOM_IDX_FAN1 + i, val)) {
+		edata-state = ENVSYS_SINVALID;
+	} else {
+		edata-value_cur = (60 * sc-sc_fan_cal[i] * val) / 100;
 		if (val  sc-sc_fan_low[i])
-			sc-sc_fan[i].state = ENVSYS_SCRITICAL;
+			edata-state = ENVSYS_SCRITICAL;
 		else
-			sc-sc_fan[i].state = ENVSYS_SVALID;
+			edata-state = ENVSYS_SVALID;
 	}
+}

CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2011-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 16 21:21:21 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: psycho.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1555):
sys/arch/sparc64/dev/psycho.c: revision 1.102 via patch
Don't enable the powerfail interrupt on Netra X1 since it may hang.
Discussed on port-sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.4.1 src/sys/arch/sparc64/dev/psycho.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/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.91 src/sys/arch/sparc64/dev/psycho.c:1.91.4.1
--- src/sys/arch/sparc64/dev/psycho.c:1.91	Sat Oct 18 03:31:10 2008
+++ src/sys/arch/sparc64/dev/psycho.c	Wed Feb 16 21:21:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.91 2008/10/18 03:31:10 nakayama Exp $	*/
+/*	$NetBSD: psycho.c,v 1.91.4.1 2011/02/16 21:21:21 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: psycho.c,v 1.91 2008/10/18 03:31:10 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: psycho.c,v 1.91.4.1 2011/02/16 21:21:21 bouyer Exp $);
 
 #include opt_ddb.h
 
@@ -288,6 +288,7 @@
 	int psycho_br[2], n, i;
 	bus_space_handle_t pci_ctl;
 	char *model = prom_getpropstring(ma-ma_node, model);
+	extern char machine_model[];
 
 	aprint_normal(\n);
 
@@ -519,10 +520,15 @@
 		psycho_set_intr(sc, 15, psycho_bus_a,
 			sc-sc_regs-pciaerr_int_map, 
 			sc-sc_regs-pciaerr_clr_int);
-		psycho_set_intr(sc, 15, psycho_powerfail,
-			sc-sc_regs-power_int_map, 
-			sc-sc_regs-power_clr_int);
-		psycho_register_power_button(sc);
+		/*
+		 * Netra X1 may hang when the powerfail interrupt is enabled.
+		 */
+		if (strcmp(machine_model, SUNW,UltraAX-i2) != 0) {
+			psycho_set_intr(sc, 15, psycho_powerfail,
+sc-sc_regs-power_int_map,
+sc-sc_regs-power_clr_int);
+			psycho_register_power_button(sc);
+		}
 		if (sc-sc_mode != PSYCHO_MODE_SABRE) {
 			/* sabre doesn't have these interrupts */
 			psycho_set_intr(sc, 15, psycho_bus_b,



CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 28 16:48:36 UTC 2010

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1349):
sys/arch/sparc64/dev/lom.c: revision 1.6
Fix off-by-one in LOMlite hostname code.  From rev 1.21 of OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.5 src/sys/arch/sparc64/dev/lom.c:1.1.2.6
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.5	Sat Jan  9 01:30:13 2010
+++ src/sys/arch/sparc64/dev/lom.c	Sun Mar 28 16:48:36 2010
@@ -1,5 +1,5 @@
-/*	$NetBSD: lom.c,v 1.1.2.5 2010/01/09 01:30:13 snj Exp $	*/
-/*	$OpenBSD: lom.c,v 1.20 2009/12/12 13:01:00 kettenis Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $	*/
+/*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
  *
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.5 2010/01/09 01:30:13 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -1035,7 +1035,7 @@
 static void
 lom1_write_hostname(struct lom_softc *sc)
 {
-	char name[LOM1_IDX_HOSTNAME12 - LOM1_IDX_HOSTNAME1 + 1];
+	char name[(LOM1_IDX_HOSTNAME12 - LOM1_IDX_HOSTNAME1 + 1) + 1];
 	char *p;
 	int i;
 
@@ -1045,7 +1045,7 @@
 	 * strip off the domain name.
 	 */
 	strlcpy(name, hostname, sizeof(name));
-	if (hostnamelen  sizeof(name)) {
+	if (hostnamelen = sizeof(name)) {
 		p = strchr(name, '.');
 		if (p)
 			*p = '\0';



CVS commit: [netbsd-5] src/sys/arch/sparc64

2010-03-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Mar 17 03:10:40 UTC 2010

Modified Files:
src/sys/arch/sparc64/include [netbsd-5]: pmap.h
src/sys/arch/sparc64/sparc64 [netbsd-5]: cache.h ipifuncs.c locore.s
machdep.c pmap.c

Log Message:
Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
  properly handle flushes in all cpus as necessary


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.14.1 src/sys/arch/sparc64/include/pmap.h
cvs rdiff -u -r1.10 -r1.10.66.1 src/sys/arch/sparc64/sparc64/cache.h
cvs rdiff -u -r1.22 -r1.22.8.1 src/sys/arch/sparc64/sparc64/ipifuncs.c
cvs rdiff -u -r1.286.2.1 -r1.286.2.2 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.227.4.1 -r1.227.4.2 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.225.4.1 -r1.225.4.2 src/sys/arch/sparc64/sparc64/pmap.c

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

Modified files:

Index: src/sys/arch/sparc64/include/pmap.h
diff -u src/sys/arch/sparc64/include/pmap.h:1.40 src/sys/arch/sparc64/include/pmap.h:1.40.14.1
--- src/sys/arch/sparc64/include/pmap.h:1.40	Fri Mar 14 15:40:02 2008
+++ src/sys/arch/sparc64/include/pmap.h	Wed Mar 17 03:10:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.40 2008/03/14 15:40:02 nakayama Exp $	*/
+/*	$NetBSD: pmap.h,v 1.40.14.1 2010/03/17 03:10:39 snj Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -212,6 +212,9 @@
 void sp_tlb_flush_ctx(int);
 void sp_tlb_flush_all(void);
 
+void		pmap_copy_page_phys(paddr_t, paddr_t);
+void		pmap_zero_page_phys(paddr_t);
+
 #ifdef MULTIPROCESSOR
 void smp_tlb_flush_pte(vaddr_t, pmap_t);
 void smp_tlb_flush_ctx(pmap_t);

Index: src/sys/arch/sparc64/sparc64/cache.h
diff -u src/sys/arch/sparc64/sparc64/cache.h:1.10 src/sys/arch/sparc64/sparc64/cache.h:1.10.66.1
--- src/sys/arch/sparc64/sparc64/cache.h:1.10	Sat Oct 21 23:49:29 2006
+++ src/sys/arch/sparc64/sparc64/cache.h	Wed Mar 17 03:10:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.h,v 1.10 2006/10/21 23:49:29 mrg Exp $ */
+/*	$NetBSD: cache.h,v 1.10.66.1 2010/03/17 03:10:39 snj Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -75,11 +75,21 @@
 /* The following are for I$ and D$ flushes and are in locore.s */
 void 	dcache_flush_page(paddr_t);	/* flush page from D$ */
 void 	icache_flush_page(paddr_t);	/* flush page from I$ */
-void 	blast_dcache(void);		/* Clear entire D$ */
+void 	sp_blast_dcache(void);		/* Clear entire D$ */
 void 	blast_icache(void);		/* Clear entire I$ */
 
 /* The following flush a range from the D$ and I$ but not E$. */
 void	cache_flush_phys(paddr_t, psize_t, int);
 
+#ifdef MULTIPROCESSOR
+void smp_blast_dcache(sparc64_cpuset_t);
+void smp_dcache_flush_page_all(paddr_t pa);
+#define dcache_flush_page_all(pa)	smp_dcache_flush_page_all(pa)
+#define blast_dcache()  smp_blast_dcache(cpus_active)
+#else
+#define dcache_flush_page_all(pa)	dcache_flush_page(pa)
+#define blast_dcache()			sp_blast_dcache()
+#endif
+
 /* Smallest E$ line size. */
 extern	int	ecache_min_line_size;

Index: src/sys/arch/sparc64/sparc64/ipifuncs.c
diff -u src/sys/arch/sparc64/sparc64/ipifuncs.c:1.22 src/sys/arch/sparc64/sparc64/ipifuncs.c:1.22.8.1
--- src/sys/arch/sparc64/sparc64/ipifuncs.c:1.22	Sat May 31 08:00:34 2008
+++ src/sys/arch/sparc64/sparc64/ipifuncs.c	Wed Mar 17 03:10:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipifuncs.c,v 1.22 2008/05/31 08:00:34 nakayama Exp $ */
+/*	$NetBSD: ipifuncs.c,v 1.22.8.1 2010/03/17 03:10:39 snj Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.22 2008/05/31 08:00:34 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.22.8.1 2010/03/17 03:10:39 snj Exp $);
 
 #include opt_ddb.h
 
@@ -44,6 +44,8 @@
 #include machine/pmap.h
 #include machine/sparc64.h
 
+#include sparc64/sparc64/cache.h
+
 #if defined(DDB) || defined(KGDB)
 #ifdef DDB
 #include ddb/db_command.h
@@ -69,6 +71,8 @@
 void	sparc64_ipi_flush_pte(void *);
 void	sparc64_ipi_flush_ctx(void *);
 void	sparc64_ipi_flush_all(void *);
+void	sparc64_ipi_dcache_flush_page(void *);
+void	sparc64_ipi_blast_dcache(void *);
 
 /*
  * Process cpu stop-self event.
@@ -412,6 +416,34 @@
 	sparc64_broadcast_ipi(sparc64_ipi_flush_all, 0, 0);
 }
 
+/* XXX Spitfire specific for netbsd-5 branch */
+#define dcache_line_size	32
+#define dcache_size		(16 * 1024)
+
+/*
+ * Make sure this page is flushed from all CPUs.
+ */
+void
+smp_dcache_flush_page_all(paddr_t pa)
+{
+
+	sparc64_broadcast_ipi(sparc64_ipi_dcache_flush_page, pa,
+			  dcache_line_size);
+	dcache_flush_page(pa);
+}
+
+/*
+ * Flush the D$ on this set of CPUs.
+ */
+void
+smp_blast_dcache(sparc64_cpuset_t activecpus)
+{
+
+	sparc64_multicast_ipi(activecpus, sparc64_ipi_blast_dcache,
+			  dcache_size, dcache_line_size);
+	

CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2009-12-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec 18 06:03:51 UTC 2009

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1193):
sys/arch/sparc64/dev/lom.c: revision 1.4
Merge change of OpenBSD rev 1.20:
Remove debug printf and properly dequeue command instead when a read times out
on LOMLite2.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.3 src/sys/arch/sparc64/dev/lom.c:1.1.2.4
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.3	Sat Nov 28 15:55:14 2009
+++ src/sys/arch/sparc64/dev/lom.c	Fri Dec 18 06:03:51 2009
@@ -1,5 +1,5 @@
-/*	$NetBSD: lom.c,v 1.1.2.3 2009/11/28 15:55:14 bouyer Exp $	*/
-/*	$OpenBSD: lom.c,v 1.19 2009/11/10 22:26:48 kettenis Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.4 2009/12/18 06:03:51 snj Exp $	*/
+/*	$OpenBSD: lom.c,v 1.20 2009/12/12 13:01:00 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
  *
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.3 2009/11/28 15:55:14 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.4 2009/12/18 06:03:51 snj Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -643,7 +643,7 @@
 
 	error = tsleep(lc, PZERO, lom2rd, hz);
 	if (error)
-		aprint_error_dev(sc-sc_dev, lom2_read failed\n);
+		lom_dequeue_cmd(sc, lc);
 
 	*val = lc.lc_data;
 



CVS commit: [netbsd-5] src/sys/arch/sparc64

2009-10-19 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Oct 19 07:25:45 UTC 2009

Modified Files:
src/sys/arch/sparc64/include [netbsd-5]: userret.h
src/sys/arch/sparc64/sparc64 [netbsd-5]: trap.c

Log Message:
Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c:revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true.  While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.6.1 src/sys/arch/sparc64/include/userret.h
cvs rdiff -u -r1.155 -r1.155.4.1 src/sys/arch/sparc64/sparc64/trap.c

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

Modified files:

Index: src/sys/arch/sparc64/include/userret.h
diff -u src/sys/arch/sparc64/include/userret.h:1.8 src/sys/arch/sparc64/include/userret.h:1.8.6.1
--- src/sys/arch/sparc64/include/userret.h:1.8	Mon Jun 30 14:12:20 2008
+++ src/sys/arch/sparc64/include/userret.h	Mon Oct 19 07:25:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.8 2008/06/30 14:12:20 nakayama Exp $ */
+/*	$NetBSD: userret.h,v 1.8.6.1 2009/10/19 07:25:44 sborrill Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -63,14 +63,6 @@
 
 	mi_userret(l);
 
-	if (want_ast) {
-		want_ast = 0;
-		if (l-l_pflag  LP_OWEUPC) {
-			l-l_pflag = ~LP_OWEUPC;
-			ADDUPROF(l);
-		}
-	}
-
 	/*
 	 * If profiling, charge recent system time to the trapped pc.
 	 */

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.155 src/sys/arch/sparc64/sparc64/trap.c:1.155.4.1
--- src/sys/arch/sparc64/sparc64/trap.c:1.155	Wed Oct 15 06:51:19 2008
+++ src/sys/arch/sparc64/sparc64/trap.c	Mon Oct 19 07:25:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.155 2008/10/15 06:51:19 wrstuden Exp $ */
+/*	$NetBSD: trap.c,v 1.155.4.1 2009/10/19 07:25:44 sborrill Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.155 2008/10/15 06:51:19 wrstuden Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.155.4.1 2009/10/19 07:25:44 sborrill Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -618,12 +618,14 @@
 #endif
 
 	case T_AST:
-#if 1
-		if (want_resched)
+		if (l-l_pflag  LP_OWEUPC) {
+			l-l_pflag = ~LP_OWEUPC;
+			ADDUPROF(l);
+		}
+		while (want_resched)
 			preempt();
 		want_ast = 0;
-#endif
-		break;	/* the work is all in userret() */
+		break;
 
 	case T_ILLINST:
 	case T_INST_EXCEPT:



CVS commit: [netbsd-5] src/sys/arch/sparc64/include

2009-10-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Oct 18 13:34:49 UTC 2009

Modified Files:
src/sys/arch/sparc64/include [netbsd-5]: bus.h

Log Message:
Pull up following revision(s) (requested by macallan in ticket #967):
sys/arch/sparc64/include/bus.h: revision 1.59
again


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.10.1 src/sys/arch/sparc64/include/bus.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/sparc64/include/bus.h
diff -u src/sys/arch/sparc64/include/bus.h:1.58 src/sys/arch/sparc64/include/bus.h:1.58.10.1
--- src/sys/arch/sparc64/include/bus.h:1.58	Mon Apr 28 20:23:36 2008
+++ src/sys/arch/sparc64/include/bus.h	Sun Oct 18 13:34:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.58 2008/04/28 20:23:36 martin Exp $	*/
+/*	$NetBSD: bus.h,v 1.58.10.1 2009/10/18 13:34:49 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -307,7 +307,8 @@
 #define	BUS_SPACE_MAP_BUS2		0x0200
 #define	BUS_SPACE_MAP_BUS3		0x0400
 #define	BUS_SPACE_MAP_BUS4		0x0800
-
+/* sparc uses this, it's not supposed to do anything on sparc64 */
+#define BUS_SPACE_MAP_LARGE		0
 
 /* flags for bus_space_barrier() */
 #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */



CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2009-10-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Oct 18 13:45:50 UTC 2009

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: ffb.c

Log Message:
Pull up following revision(s) (requested by macallan in ticket #972):
sys/arch/sparc64/dev/ffb.c: revision 1.37
call vcons_replay_msgbuf() when appropriate


To generate a diff of this commit:
cvs rdiff -u -r1.35.4.1 -r1.35.4.2 src/sys/arch/sparc64/dev/ffb.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/sparc64/dev/ffb.c
diff -u src/sys/arch/sparc64/dev/ffb.c:1.35.4.1 src/sys/arch/sparc64/dev/ffb.c:1.35.4.2
--- src/sys/arch/sparc64/dev/ffb.c:1.35.4.1	Wed Feb 25 20:52:09 2009
+++ src/sys/arch/sparc64/dev/ffb.c	Sun Oct 18 13:45:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffb.c,v 1.35.4.1 2009/02/25 20:52:09 snj Exp $	*/
+/*	$NetBSD: ffb.c,v 1.35.4.2 2009/10/18 13:45:50 bouyer Exp $	*/
 /*	$OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffb.c,v 1.35.4.1 2009/02/25 20:52:09 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffb.c,v 1.35.4.2 2009/10/18 13:45:50 bouyer Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -239,11 +239,12 @@
 	sc-sc_fb.fb_device = sc-sc_dv;
 	fb_attach(sc-sc_fb, sc-sc_console);
 
+	ffb_clearscreen(sc);
+
 	if (sc-sc_console) {
 		wsdisplay_cnattach(ffb_stdscreen, ri, 0, 0, defattr);
+		vcons_replay_msgbuf(ffb_console_screen);
 	}
-
-	ffb_clearscreen(sc);
 	
 	waa.console = sc-sc_console;
 	waa.scrdata = ffb_screenlist;
@@ -433,7 +434,6 @@
 		break;
 #endif
 	}
-
 	return (-1);
 }
 



CVS commit: [netbsd-5] src/sys/arch/sparc64/dev

2009-10-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Oct 18 14:39:38 UTC 2009

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: ffb.c

Log Message:
back out ticket 972


To generate a diff of this commit:
cvs rdiff -u -r1.35.4.2 -r1.35.4.3 src/sys/arch/sparc64/dev/ffb.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/sparc64/dev/ffb.c
diff -u src/sys/arch/sparc64/dev/ffb.c:1.35.4.2 src/sys/arch/sparc64/dev/ffb.c:1.35.4.3
--- src/sys/arch/sparc64/dev/ffb.c:1.35.4.2	Sun Oct 18 13:45:50 2009
+++ src/sys/arch/sparc64/dev/ffb.c	Sun Oct 18 14:39:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffb.c,v 1.35.4.2 2009/10/18 13:45:50 bouyer Exp $	*/
+/*	$NetBSD: ffb.c,v 1.35.4.3 2009/10/18 14:39:37 bouyer Exp $	*/
 /*	$OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffb.c,v 1.35.4.2 2009/10/18 13:45:50 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffb.c,v 1.35.4.3 2009/10/18 14:39:37 bouyer Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -239,12 +239,11 @@
 	sc-sc_fb.fb_device = sc-sc_dv;
 	fb_attach(sc-sc_fb, sc-sc_console);
 
-	ffb_clearscreen(sc);
-
 	if (sc-sc_console) {
 		wsdisplay_cnattach(ffb_stdscreen, ri, 0, 0, defattr);
-		vcons_replay_msgbuf(ffb_console_screen);
 	}
+
+	ffb_clearscreen(sc);
 	
 	waa.console = sc-sc_console;
 	waa.scrdata = ffb_screenlist;
@@ -434,6 +433,7 @@
 		break;
 #endif
 	}
+
 	return (-1);
 }
 



CVS commit: [netbsd-5] src/sys/arch/sparc64/include

2009-10-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Oct 18 14:44:12 UTC 2009

Modified Files:
src/sys/arch/sparc64/include [netbsd-5]: bus.h

Log Message:
Back out ticket 967


To generate a diff of this commit:
cvs rdiff -u -r1.58.10.1 -r1.58.10.2 src/sys/arch/sparc64/include/bus.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/sparc64/include/bus.h
diff -u src/sys/arch/sparc64/include/bus.h:1.58.10.1 src/sys/arch/sparc64/include/bus.h:1.58.10.2
--- src/sys/arch/sparc64/include/bus.h:1.58.10.1	Sun Oct 18 13:34:49 2009
+++ src/sys/arch/sparc64/include/bus.h	Sun Oct 18 14:44:12 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.58.10.1 2009/10/18 13:34:49 bouyer Exp $	*/
+/*	$NetBSD: bus.h,v 1.58.10.2 2009/10/18 14:44:12 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -307,8 +307,7 @@
 #define	BUS_SPACE_MAP_BUS2		0x0200
 #define	BUS_SPACE_MAP_BUS3		0x0400
 #define	BUS_SPACE_MAP_BUS4		0x0800
-/* sparc uses this, it's not supposed to do anything on sparc64 */
-#define BUS_SPACE_MAP_LARGE		0
+
 
 /* flags for bus_space_barrier() */
 #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */