CVS commit: src/sys/conf

2012-12-31 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Jan  1 00:01:23 UTC 2013

Modified Files:
src/sys/conf: copyright

Log Message:
Happy 2013 everybody


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.10 src/sys/conf/copyright:1.11
--- src/sys/conf/copyright:1.10	Sun Jan  1 00:00:30 2012
+++ src/sys/conf/copyright	Tue Jan  1 00:01:23 2013
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009, 2010, 2011, 2012
+2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: src/etc/rc.d

2012-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 31 23:21:27 UTC 2012

Modified Files:
src/etc/rc.d: bootconf.sh

Log Message:
add a sync to make it less likely to boot with /etc pointing to nothing after
a crash.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/etc/rc.d/bootconf.sh

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

Modified files:

Index: src/etc/rc.d/bootconf.sh
diff -u src/etc/rc.d/bootconf.sh:1.14 src/etc/rc.d/bootconf.sh:1.15
--- src/etc/rc.d/bootconf.sh:1.14	Mon Nov  1 10:42:08 2010
+++ src/etc/rc.d/bootconf.sh	Mon Dec 31 18:21:27 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: bootconf.sh,v 1.14 2010/11/01 14:42:08 christos Exp $
+# $NetBSD: bootconf.sh,v 1.15 2012/12/31 23:21:27 christos Exp $
 #
 
 # PROVIDE: bootconf
@@ -74,6 +74,7 @@ bootconf_start()
 	*)
 		rm -f /etc/etc.current
 		ln -s etc.$conf /etc/etc.current
+		sync
 		;;
 	esac
 



CVS commit: src/sys/dev/i2c

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 21:45:36 UTC 2012

Modified Files:
src/sys/dev/i2c: tps65950.c

Log Message:
add TPS65950 RTC support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/tps65950.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/dev/i2c/tps65950.c
diff -u src/sys/dev/i2c/tps65950.c:1.2 src/sys/dev/i2c/tps65950.c:1.3
--- src/sys/dev/i2c/tps65950.c:1.2	Mon Dec 31 19:47:27 2012
+++ src/sys/dev/i2c/tps65950.c	Mon Dec 31 21:45:36 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: tps65950.c,v 1.2 2012/12/31 19:47:27 jmcneill Exp $ */
+/* $NetBSD: tps65950.c,v 1.3 2012/12/31 21:45:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2012 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tps65950.c,v 1.2 2012/12/31 19:47:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tps65950.c,v 1.3 2012/12/31 21:45:36 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: tps65950.c,v
 
 #include 
 
+#include 
 #include 
 
 /* Default watchdog period, in seconds */
@@ -77,6 +78,17 @@ __KERNEL_RCSID(0, "$NetBSD: tps65950.c,v
 /* ID4 */
 #define TPS65950_PM_RECEIVER_BASE	0x5b
 #define TPS65950_ID4_REG_WATCHDOG_CFG	(TPS65950_PM_RECEIVER_BASE + 3)
+#define TPS65950_RTC_BASE		0x1c
+#define TPS65950_ID4_REG_SECONDS_REG	(TPS65950_RTC_BASE + 0)
+#define TPS65950_ID4_REG_MINUTES_REG	(TPS65950_RTC_BASE + 1)
+#define TPS65950_ID4_REG_HOURS_REG	(TPS65950_RTC_BASE + 2)
+#define TPS65950_ID4_REG_DAYS_REG	(TPS65950_RTC_BASE + 3)
+#define TPS65950_ID4_REG_MONTHS_REG	(TPS65950_RTC_BASE + 4)
+#define TPS65950_ID4_REG_YEARS_REG	(TPS65950_RTC_BASE + 5)
+#define TPS65950_ID4_REG_WEEKS_REG	(TPS65950_RTC_BASE + 6)
+#define TPS65950_ID4_REG_RTC_CTRL_REG	(TPS65950_RTC_BASE + 13)
+#define TPS65950_ID4_REG_RTC_CTRL_REG_GET_TIME __BIT(6)
+#define TPS65950_ID4_REG_RTC_CTRL_REG_STOP_RTC __BIT(1)
 
 struct tps65950_softc {
 	device_t	sc_dev;
@@ -85,7 +97,7 @@ struct tps65950_softc {
 
 	struct sysctllog *sc_sysctllog;
 	struct sysmon_wdog sc_smw;
-	uint8_t		sc_watchdog_cfg;
+	struct todr_chip_handle sc_todr;
 };
 
 static int	tps65950_match(device_t, cfdata_t, void *);
@@ -95,8 +107,13 @@ static int	tps65950_read_1(struct tps659
 static int	tps65950_write_1(struct tps65950_softc *, uint8_t, uint8_t);
 
 static void	tps65950_sysctl_attach(struct tps65950_softc *);
-static void	tps65950_wdog_attach(struct tps65950_softc *);
 
+static void	tps65950_rtc_attach(struct tps65950_softc *);
+static int	tps65950_rtc_enable(struct tps65950_softc *, bool);
+static int	tps65950_rtc_gettime(todr_chip_handle_t, struct clock_ymdhms *);
+static int	tps65950_rtc_settime(todr_chip_handle_t, struct clock_ymdhms *);
+
+static void	tps65950_wdog_attach(struct tps65950_softc *);
 static int	tps65950_wdog_setmode(struct sysmon_wdog *);
 static int	tps65950_wdog_tickle(struct sysmon_wdog *);
 
@@ -154,7 +171,8 @@ tps65950_attach(device_t parent, device_
 		tps65950_sysctl_attach(sc);
 		break;
 	case TPS65950_ADDR_ID4:
-		aprint_normal(": WATCHDOG\n");
+		aprint_normal(": RTC, WATCHDOG\n");
+		tps65950_rtc_attach(sc);
 		tps65950_wdog_attach(sc);
 		break;
 	default:
@@ -281,6 +299,106 @@ tps65950_sysctl_attach(struct tps65950_s
 }
 
 static void
+tps65950_rtc_attach(struct tps65950_softc *sc)
+{
+	sc->sc_todr.todr_gettime_ymdhms = tps65950_rtc_gettime;
+	sc->sc_todr.todr_settime_ymdhms = tps65950_rtc_settime;
+	sc->sc_todr.cookie = sc;
+	todr_attach(&sc->sc_todr);
+
+	iic_acquire_bus(sc->sc_i2c, 0);
+	tps65950_rtc_enable(sc, true);
+	iic_release_bus(sc->sc_i2c, 0);
+}
+
+static int
+tps65950_rtc_enable(struct tps65950_softc *sc, bool enable)
+{
+	uint8_t rtc_ctrl;
+	int error;
+
+	error = tps65950_read_1(sc, TPS65950_ID4_REG_RTC_CTRL_REG, &rtc_ctrl);
+	if (error)
+		return error;
+
+	if (enable) {
+		rtc_ctrl |= TPS65950_ID4_REG_RTC_CTRL_REG_STOP_RTC;
+	} else {
+		rtc_ctrl &= ~TPS65950_ID4_REG_RTC_CTRL_REG_STOP_RTC;
+	}
+
+	return tps65950_write_1(sc, TPS65950_ID4_REG_RTC_CTRL_REG, rtc_ctrl);
+}
+
+#define RTC_READ(reg, var)		 \
+	do { \
+		tps65950_write_1(sc, TPS65950_ID4_REG_RTC_CTRL_REG,	 \
+		TPS65950_ID4_REG_RTC_CTRL_REG_GET_TIME);		 \
+		if ((error = tps65950_read_1(sc, (reg), &(var))) != 0) { \
+			iic_release_bus(sc->sc_i2c, 0);			 \
+			return error;	 \
+		}			 \
+	} while (0)
+
+#define RTC_WRITE(reg, val)		 \
+	do { \
+		if ((error = tps65950_write_1(sc, (reg), (val))) != 0) { \
+			iic_release_bus(sc->sc_i2c, 0);			 \
+			return error;	 \
+		}			 \
+	} while (0)
+
+static int
+tps65950_rtc_gettime(todr_chip_handle_t tch, struct clock_ymdhms *dt)
+{
+	struct tps65950_softc *sc = tch->cookie;
+	uint8_t seconds_reg, minutes_reg, hours_reg,
+		days_reg, months_reg, years_reg, weeks_reg;
+	int error = 0;
+
+	iic_acquire_bus(sc->sc_i2c, 0);
+	RTC_READ(TPS65950_ID4_REG_SECONDS_REG, seconds_reg);
+	RTC_RE

CVS commit: src/sys/arch/arm/arm32

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 21:34:32 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
reset todr clock on shutdown


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/arm/arm32/arm32_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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.87 src/sys/arch/arm/arm32/arm32_machdep.c:1.88
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.87	Mon Dec 10 08:19:10 2012
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Mon Dec 31 21:34:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.87 2012/12/10 08:19:10 matt Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.88 2012/12/31 21:34:31 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.87 2012/12/10 08:19:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.88 2012/12/31 21:34:31 jmcneill Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -177,7 +177,7 @@ halt(void)
 }
 
 
-/* Sync the discs and unmount the filesystems */
+/* Sync the discs, unmount the filesystems, and adjust the todr */
 
 void
 bootsync(void)
@@ -201,6 +201,8 @@ bootsync(void)
 	}
 
 	vfs_shutdown();
+
+	resettodr();
 }
 
 /*



CVS commit: src/sys/dev/i2c

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 19:47:28 UTC 2012

Modified Files:
src/sys/dev/i2c: files.i2c tps65950.c

Log Message:
add support for TPS65950 watchdog timer


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/tps65950.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/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.46 src/sys/dev/i2c/files.i2c:1.47
--- src/sys/dev/i2c/files.i2c:1.46	Mon Dec 31 13:26:42 2012
+++ src/sys/dev/i2c/files.i2c	Mon Dec 31 19:47:27 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.46 2012/12/31 13:26:42 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.47 2012/12/31 19:47:27 jmcneill Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -173,6 +173,6 @@ attach	ibmhawk at iic
 file	dev/i2c/ibmhawk.c		ibmhawk
 
 # TI TPS65950 OMAP Power Management and System Companion Device
-device	tps65950pm
+device	tps65950pm: sysmon_wdog
 attach	tps65950pm at iic
 file	dev/i2c/tps65950.c		tps65950pm

Index: src/sys/dev/i2c/tps65950.c
diff -u src/sys/dev/i2c/tps65950.c:1.1 src/sys/dev/i2c/tps65950.c:1.2
--- src/sys/dev/i2c/tps65950.c:1.1	Mon Dec 31 13:26:42 2012
+++ src/sys/dev/i2c/tps65950.c	Mon Dec 31 19:47:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: tps65950.c,v 1.1 2012/12/31 13:26:42 jmcneill Exp $ */
+/* $NetBSD: tps65950.c,v 1.2 2012/12/31 19:47:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2012 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tps65950.c,v 1.1 2012/12/31 13:26:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tps65950.c,v 1.2 2012/12/31 19:47:27 jmcneill Exp $");
 
 #include 
 #include 
@@ -40,9 +40,17 @@ __KERNEL_RCSID(0, "$NetBSD: tps65950.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+#include 
+
+/* Default watchdog period, in seconds */
+#ifndef TPS65950_WDOG_DEFAULT_PERIOD
+#define TPS65950_WDOG_DEFAULT_PERIOD	30
+#endif
+
 /* I2C Bus Addressing */
 #define	TPS65950_ADDR_ID1		0x48	/* GP */
 #define TPS65950_ADDR_ID2		0x49	/* GP */
@@ -50,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: tps65950.c,v
 #define TPS65950_ADDR_ID4		0x4b	/* GP */
 #define TPS65950_ADDR_ID5		0x12	/* SmartReflex */
 
+/* ID2 */
 #define TPS65950_ID2_IDCODE_7_0		0x85
 #define TPS65950_ID2_IDCODE_15_8	0x86
 #define TPS65950_ID2_IDCODE_23_16	0x87
@@ -57,20 +66,26 @@ __KERNEL_RCSID(0, "$NetBSD: tps65950.c,v
 #define TPS65950_ID2_UNLOCK_TEST_REG	0x97
 #define TPS65950_ID2_UNLOCK_TEST_REG_MAGIC 0x49
 
+/* ID3 */
 #define TPS65950_LED_BASE		0xee
-
 #define	TPS65950_ID3_REG_LED		(TPS65950_LED_BASE + 0)
 #define	TPS65950_ID3_REG_LED_LEDAON	__BIT(0)
 #define	TPS65950_ID3_REG_LED_LEDBON	__BIT(1)
 #define TPS65950_ID3_REG_LED_LEDAPWM	__BIT(4)
 #define TPS65950_ID3_REG_LED_LEDBPWM	__BIT(5)
 
+/* ID4 */
+#define TPS65950_PM_RECEIVER_BASE	0x5b
+#define TPS65950_ID4_REG_WATCHDOG_CFG	(TPS65950_PM_RECEIVER_BASE + 3)
+
 struct tps65950_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
 	i2c_addr_t	sc_addr;
 
 	struct sysctllog *sc_sysctllog;
+	struct sysmon_wdog sc_smw;
+	uint8_t		sc_watchdog_cfg;
 };
 
 static int	tps65950_match(device_t, cfdata_t, void *);
@@ -80,6 +95,10 @@ static int	tps65950_read_1(struct tps659
 static int	tps65950_write_1(struct tps65950_softc *, uint8_t, uint8_t);
 
 static void	tps65950_sysctl_attach(struct tps65950_softc *);
+static void	tps65950_wdog_attach(struct tps65950_softc *);
+
+static int	tps65950_wdog_setmode(struct sysmon_wdog *);
+static int	tps65950_wdog_tickle(struct sysmon_wdog *);
 
 CFATTACH_DECL_NEW(tps65950pm, sizeof(struct tps65950_softc),
 tps65950_match, tps65950_attach, NULL, NULL);
@@ -118,22 +137,28 @@ tps65950_attach(device_t parent, device_
 	switch (sc->sc_addr) {
 	case TPS65950_ADDR_ID2:
 		memset(buf, 0, sizeof(buf));
+		iic_acquire_bus(sc->sc_i2c, 0);
 		tps65950_write_1(sc, TPS65950_ID2_UNLOCK_TEST_REG,
 		TPS65950_ID2_UNLOCK_TEST_REG_MAGIC);
 		tps65950_read_1(sc, TPS65950_ID2_IDCODE_7_0, &buf[0]);
 		tps65950_read_1(sc, TPS65950_ID2_IDCODE_15_8, &buf[1]);
 		tps65950_read_1(sc, TPS65950_ID2_IDCODE_23_16, &buf[2]);
 		tps65950_read_1(sc, TPS65950_ID2_IDCODE_31_24, &buf[3]);
+		iic_release_bus(sc->sc_i2c, 0);
 		idcode = (buf[0] << 0) | (buf[1] << 8) |
 			 (buf[2] << 16) | (buf[3] << 24);
 		aprint_normal(": IDCODE %08X\n", idcode);
 		break;
 	case TPS65950_ADDR_ID3:
-		aprint_normal(": group %02x\n", sc->sc_addr);
+		aprint_normal(": LED\n");
 		tps65950_sysctl_attach(sc);
 		break;
+	case TPS65950_ADDR_ID4:
+		aprint_normal(": WATCHDOG\n");
+		tps65950_wdog_attach(sc);
+		break;
 	default:
-		aprint_normal(": group %02x\n", sc->sc_addr);
+		aprint_normal("\n");
 		break;
 	}
 }
@@ -164,7 +189,9 @@ tps65950_sysctl_leda(SYSCTLFN_ARGS)
 
 	node = *rnode;
 	sc = node.sysctl_data;
+	iic_acquire_bus(sc->sc_i2c, 0);
 	error = tps65950_read_1(sc, TPS65950_ID3_REG_LED, &val);
+	iic_releas

CVS commit: src/external/bsd/pcc/dist/pcc/arch/amd64

2012-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 31 18:47:42 UTC 2012

Modified Files:
src/external/bsd/pcc/dist/pcc/arch/amd64: local.c

Log Message:
avoid strict aliasing problems


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/pcc/dist/pcc/arch/amd64/local.c

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

Modified files:

Index: src/external/bsd/pcc/dist/pcc/arch/amd64/local.c
diff -u src/external/bsd/pcc/dist/pcc/arch/amd64/local.c:1.1.1.4 src/external/bsd/pcc/dist/pcc/arch/amd64/local.c:1.2
--- src/external/bsd/pcc/dist/pcc/arch/amd64/local.c:1.1.1.4	Mon Mar 26 10:26:17 2012
+++ src/external/bsd/pcc/dist/pcc/arch/amd64/local.c	Mon Dec 31 13:47:41 2012
@@ -1,5 +1,5 @@
 /*	Id: local.c,v 1.66 2012/03/23 17:03:09 ragge Exp 	*/	
-/*	$NetBSD: local.c,v 1.1.1.4 2012/03/26 14:26:17 plunky Exp $	*/
+/*	$NetBSD: local.c,v 1.2 2012/12/31 18:47:41 christos Exp $	*/
 /*
  * Copyright (c) 2008 Michael Shalayeff
  * Copyright (c) 2003 Anders Magnusson (ra...@ludd.luth.se).
@@ -540,10 +540,12 @@ myp2tree(NODE *p)
 
 #ifdef mach_amd64
 	{
-		/* Do not loose negative zeros */
-		long long *llp = (long long *)(&p->n_dcon);
-		short *ssp = (short *)&llp[1];
-		if (*llp == 0 && *ssp == 0)
+		/* Do not lose negative zeros */
+		long long ll[2];
+		short ss;
+		memcpy(ll, &p->n_dcon, sizeof(ll));
+		memcpy(&ss, &ll[1], sizeof(ss));
+		if (ll[0] == 0 && ss == 0)
 			return;
 	}
 #else



CVS commit: src/sys/arch/amd64

2012-12-31 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon Dec 31 16:20:18 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64: fpu.c netbsd32_machdep.c
src/sys/arch/amd64/include: fpu.h pcb.h

Log Message:
Move the two fields used to save some i387 state on the last fpu trap
  into their own sub-structure of the pcb (from 'struct savefpu').
They only (seem) to be used in some code that generates core dumps
  for 32bit processes (code that might be broken as well!).
'struct safefpu' is now identical to 'struct fxsave64'. One (or both)
  needs extending to support AVX - might need to be dynamically sized.
Removed all the __aligned(16) except for the one in struct pcb itself.
  Only the copy used for the fsave instruction need be aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/fpu.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/include/fpu.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amd64/include/pcb.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/amd64/amd64/fpu.c
diff -u src/sys/arch/amd64/amd64/fpu.c:1.39 src/sys/arch/amd64/amd64/fpu.c:1.40
--- src/sys/arch/amd64/amd64/fpu.c:1.39	Sun Jul  8 20:14:11 2012
+++ src/sys/arch/amd64/amd64/fpu.c	Mon Dec 31 16:20:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.39 2012/07/08 20:14:11 dsl Exp $	*/
+/*	$NetBSD: fpu.c,v 1.40 2012/12/31 16:20:17 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.39 2012/07/08 20:14:11 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.40 2012/12/31 16:20:17 dsl Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -194,6 +194,9 @@ fputrap(struct trapframe *frame)
 	 */
 	KASSERT(l == curlwp);
 	fxsave(sfp);
+	pcb->pcb_savefpu_i387.fp_ex_tw = sfp->fp_fxsave.fx_ftw;
+	pcb->pcb_savefpu_i387.fp_ex_sw = sfp->fp_fxsave.fx_fsw;
+
 	if (frame->tf_trapno == T_XMM) {
 		mxcsr = sfp->fp_fxsave.fx_mxcsr;
 		statbits = mxcsr;
@@ -209,8 +212,6 @@ fputrap(struct trapframe *frame)
 	}
 	KPREEMPT_ENABLE(l);
 
-	sfp->fp_ex_tw = sfp->fp_fxsave.fx_ftw;
-	sfp->fp_ex_sw = sfp->fp_fxsave.fx_fsw;
 	KSI_INIT_TRAP(&ksi);
 	ksi.ksi_signo = SIGFPE;
 	ksi.ksi_addr = (void *)frame->tf_rip;

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.79 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.80
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.79	Sun Jul 15 15:17:56 2012
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Mon Dec 31 16:20:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.79 2012/07/15 15:17:56 dsl Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.80 2012/12/31 16:20:17 dsl Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.79 2012/07/15 15:17:56 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.80 2012/12/31 16:20:17 dsl Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -568,7 +568,6 @@ int
 netbsd32_process_read_fpregs(struct lwp *l, struct fpreg32 *regs)
 {
 	struct pcb *pcb = lwp_getpcb(l);
-	struct savefpu *sf = &pcb->pcb_savefpu;
 	struct fpreg regs64;
 	struct save87 *s87 = (struct save87 *)regs;
 	int error, i;
@@ -598,13 +597,13 @@ netbsd32_process_read_fpregs(struct lwp 
 
 		s87->sv_ex_tw |=
 		(xmm_to_s87_tag((uint8_t *)®s64.fxstate.fx_st[i][0], i,
-		 sf->fp_ex_tw) << (i * 2));
+		 pcb->pcb_savefpu_i387.fp_ex_tw) << (i * 2));
 
 		memcpy(&s87->sv_ac[i].fp_bytes, ®s64.fxstate.fx_st[i][0],
 		sizeof(s87->sv_ac[i].fp_bytes));
 	}
 
-	s87->sv_ex_sw = sf->fp_ex_sw;
+	s87->sv_ex_sw = pcb->pcb_savefpu_i387.fp_ex_sw;
 
 	return (0);
 }

Index: src/sys/arch/amd64/include/fpu.h
diff -u src/sys/arch/amd64/include/fpu.h:1.6 src/sys/arch/amd64/include/fpu.h:1.7
--- src/sys/arch/amd64/include/fpu.h:1.6	Sat Dec 15 21:50:43 2012
+++ src/sys/arch/amd64/include/fpu.h	Mon Dec 31 16:20:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.6 2012/12/15 21:50:43 dsl Exp $	*/
+/*	$NetBSD: fpu.h,v 1.7 2012/12/31 16:20:17 dsl Exp $	*/
 
 #ifndef	_AMD64_FPU_H_
 #define	_AMD64_FPU_H_
@@ -7,7 +7,9 @@
  * NetBSD/amd64 only uses the extended save/restore format used
  * by fxsave/fsrestore, to always deal with the SSE registers,
  * which are part of the ABI to pass floating point values.
- * Must be stored in memory on a 16-byte boundary.
+ *
+ * The memory used for the 'fsave' instruction must be 16 byte aligned,
+ * but the definition here isn't aligned to avoid padding elsewhere.
  */
 
 struct fxsave64 {
@@ -30,10 +32,12 @@ __CTASSERT(sizeof (struct fxsave64) == 5
 
 struct savefpu {
 	struct fxsave64 fp_fxsave;	/* see above */
+};
+
+struct savefpu_i387 {
 	uint16_t fp_ex_sw;		/* saved status from last exception */
 	uint16_t fp_ex_tw;		/* saved t

CVS commit: src/doc

2012-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 31 16:05:40 UTC 2012

Modified Files:
src/doc: 3RDPARTY

Log Message:
new awk, ping update


To generate a diff of this commit:
cvs rdiff -u -r1.992 -r1.993 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.992 src/doc/3RDPARTY:1.993
--- src/doc/3RDPARTY:1.992	Wed Dec 19 04:46:16 2012
+++ src/doc/3RDPARTY	Mon Dec 31 11:05:39 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.992 2012/12/19 09:46:16 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.993 2012/12/31 16:05:39 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -742,8 +742,8 @@ Notes:
 Delete the otherOS directory before importing.
 
 Package:	nawk
-Version:	2010-05-23
-Current Vers:	2011-08-10
+Version:	2012-12-20
+Current Vers:	2012-12-20
 Maintainer:	Brian Kernighan 
 Archive Site:	http://www.cs.princeton.edu/~bwk/btl.mirror/
 Home Page:	http://www.cs.princeton.edu/~bwk/btl.mirror/
@@ -977,9 +977,9 @@ The authoritative version is in pkgsrc/p
 Package:	ping
 Version:	980911
 Current Vers:	980911
-Maintainer:	Vernon Schryver 
-Archive Site:	ftp://ftp.rhyolite.com/src/
-Home Page:	http://www.rhyolite.com/src/
+Maintainer:	Mike Muuss
+Archive Site:	
+Home Page:	http://ftp.arl.mil/mike/ping.html
 Mailing List:
 Responsible:	christos
 License:	BSD (3-clause)
@@ -987,7 +987,8 @@ Location:	sbin/ping
 Notes:
 We use err() and friends. We have changes for snprintf, extra
 formatting in man pages, disallowing flood pinging, alignment fixes,
-and more.
+and more. Vern's ping is gone. We are too different from everyone else
+now to do a new import.
 
 Package:	Postfix
 Version:	2.8.13



CVS commit: src/bin/sh

2012-12-31 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon Dec 31 14:10:15 UTC 2012

Modified Files:
src/bin/sh: builtins.def exec.c jobs.c

Log Message:
Add support for '%n' being a shorthand for 'fg %n'.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/sh/builtins.def
cvs rdiff -u -r1.43 -r1.44 src/bin/sh/exec.c
cvs rdiff -u -r1.70 -r1.71 src/bin/sh/jobs.c

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

Modified files:

Index: src/bin/sh/builtins.def
diff -u src/bin/sh/builtins.def:1.21 src/bin/sh/builtins.def:1.22
--- src/bin/sh/builtins.def:1.21	Tue Jul 13 15:05:59 2004
+++ src/bin/sh/builtins.def	Mon Dec 31 14:10:15 2012
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: builtins.def,v 1.21 2004/07/13 15:05:59 seb Exp $
+#	$NetBSD: builtins.def,v 1.22 2012/12/31 14:10:15 dsl Exp $
 #
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -60,6 +60,7 @@ falsecmd	-u false
 histcmd -h	-u fc
 inputrc		inputrc
 fgcmd -j	-u fg
+fgcmd_percent -j	-u %
 getoptscmd	-u getopts
 hashcmd		hash
 jobidcmd	jobid

Index: src/bin/sh/exec.c
diff -u src/bin/sh/exec.c:1.43 src/bin/sh/exec.c:1.44
--- src/bin/sh/exec.c:1.43	Tue Mar 20 18:42:29 2012
+++ src/bin/sh/exec.c	Mon Dec 31 14:10:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.43 2012/03/20 18:42:29 matt Exp $	*/
+/*	$NetBSD: exec.c,v 1.44 2012/12/31 14:10:15 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)exec.c	8.4 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: exec.c,v 1.43 2012/03/20 18:42:29 matt Exp $");
+__RCSID("$NetBSD: exec.c,v 1.44 2012/12/31 14:10:15 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -629,7 +629,8 @@ int
 	const struct builtincmd *bp;
 
 	for (bp = builtincmd ; bp->name ; bp++) {
-		if (*bp->name == *name && equal(bp->name, name))
+		if (*bp->name == *name
+		&& (*name == '%' || equal(bp->name, name)))
 			return bp->builtin;
 	}
 	return 0;

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.70 src/bin/sh/jobs.c:1.71
--- src/bin/sh/jobs.c:1.70	Thu Feb 23 18:23:33 2012
+++ src/bin/sh/jobs.c	Mon Dec 31 14:10:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.70 2012/02/23 18:23:33 joerg Exp $	*/
+/*	$NetBSD: jobs.c,v 1.71 2012/12/31 14:10:15 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.70 2012/02/23 18:23:33 joerg Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.71 2012/12/31 14:10:15 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -249,15 +249,14 @@ SHELLPROC {
 
 
 #if JOBS
-int
-fgcmd(int argc, char **argv)
+static int
+do_fgcmd(const char *arg_ptr)
 {
 	struct job *jp;
 	int i;
 	int status;
 
-	nextopt("");
-	jp = getjob(*argptr, 0);
+	jp = getjob(arg_ptr, 0);
 	if (jp->jobctl == 0)
 		error("job not created under job control");
 	out1fmt("%s", jp->ps[0].cmd);
@@ -281,6 +280,20 @@ fgcmd(int argc, char **argv)
 	return status;
 }
 
+int
+fgcmd(int argc, char **argv)
+{
+	nextopt("");
+	return do_fgcmd(*argptr);
+}
+
+int
+fgcmd_percent(int argc, char **argv)
+{
+	nextopt("");
+	return do_fgcmd(*argv);
+}
+
 static void
 set_curjob(struct job *jp, int mode)
 {



CVS commit: src/sys/arch/evbarm/conf

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 13:28:30 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARD

Log Message:
add tps65950 driver


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/evbarm/conf/BEAGLEBOARD

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/evbarm/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.37 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.38
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.37	Mon Dec 31 12:47:25 2012
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Mon Dec 31 13:28:30 2012
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.37 2012/12/31 12:47:25 jmcneill Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.38 2012/12/31 13:28:30 jmcneill Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -225,6 +225,12 @@ omapiic1	at obio0 addr 0x48072000 size 0
 omapiic2	at obio0 addr 0x4806 size 0x80
 iic*		at omapiic?
 
+# Power Managent and System Companion Device
+tps65950pm0	at iic0 addr 0x48
+tps65950pm1	at iic0 addr 0x49
+tps65950pm2	at iic0 addr 0x4a
+tps65950pm3	at iic0 addr 0x4b
+
 # On-board 16550 UARTs
 com0		at obio2 addr 0x4902 intr 74 mult 4	# UART3 (console)
 #options 	CONSADDR=0x4902, CONSPEED=38400



CVS commit: src/sys/dev/i2c

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 13:26:43 UTC 2012

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: tps65950.c

Log Message:
TI TPS65950 driver, right now about all it can do is control LEDs


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/tps65950.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/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.45 src/sys/dev/i2c/files.i2c:1.46
--- src/sys/dev/i2c/files.i2c:1.45	Fri Nov 18 22:18:08 2011
+++ src/sys/dev/i2c/files.i2c	Mon Dec 31 13:26:42 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.45 2011/11/18 22:18:08 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.46 2012/12/31 13:26:42 jmcneill Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -171,3 +171,8 @@ file	dev/i2c/g760a.c			g760a
 device	ibmhawk: sysmon_envsys
 attach	ibmhawk at iic
 file	dev/i2c/ibmhawk.c		ibmhawk
+
+# TI TPS65950 OMAP Power Management and System Companion Device
+device	tps65950pm
+attach	tps65950pm at iic
+file	dev/i2c/tps65950.c		tps65950pm

Added files:

Index: src/sys/dev/i2c/tps65950.c
diff -u /dev/null src/sys/dev/i2c/tps65950.c:1.1
--- /dev/null	Mon Dec 31 13:26:43 2012
+++ src/sys/dev/i2c/tps65950.c	Mon Dec 31 13:26:42 2012
@@ -0,0 +1,243 @@
+/* $NetBSD: tps65950.c,v 1.1 2012/12/31 13:26:42 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2012 Jared D. McNeill 
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * TI TPS65950 OMAP Power Management and System Companion Device
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: tps65950.c,v 1.1 2012/12/31 13:26:42 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* I2C Bus Addressing */
+#define	TPS65950_ADDR_ID1		0x48	/* GP */
+#define TPS65950_ADDR_ID2		0x49	/* GP */
+#define TPS65950_ADDR_ID3		0x4a	/* GP */
+#define TPS65950_ADDR_ID4		0x4b	/* GP */
+#define TPS65950_ADDR_ID5		0x12	/* SmartReflex */
+
+#define TPS65950_ID2_IDCODE_7_0		0x85
+#define TPS65950_ID2_IDCODE_15_8	0x86
+#define TPS65950_ID2_IDCODE_23_16	0x87
+#define TPS65950_ID2_IDCODE_31_24	0x88
+#define TPS65950_ID2_UNLOCK_TEST_REG	0x97
+#define TPS65950_ID2_UNLOCK_TEST_REG_MAGIC 0x49
+
+#define TPS65950_LED_BASE		0xee
+
+#define	TPS65950_ID3_REG_LED		(TPS65950_LED_BASE + 0)
+#define	TPS65950_ID3_REG_LED_LEDAON	__BIT(0)
+#define	TPS65950_ID3_REG_LED_LEDBON	__BIT(1)
+#define TPS65950_ID3_REG_LED_LEDAPWM	__BIT(4)
+#define TPS65950_ID3_REG_LED_LEDBPWM	__BIT(5)
+
+struct tps65950_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+
+	struct sysctllog *sc_sysctllog;
+};
+
+static int	tps65950_match(device_t, cfdata_t, void *);
+static void	tps65950_attach(device_t, device_t, void *);
+
+static int	tps65950_read_1(struct tps65950_softc *, uint8_t, uint8_t *);
+static int	tps65950_write_1(struct tps65950_softc *, uint8_t, uint8_t);
+
+static void	tps65950_sysctl_attach(struct tps65950_softc *);
+
+CFATTACH_DECL_NEW(tps65950pm, sizeof(struct tps65950_softc),
+tps65950_match, tps65950_attach, NULL, NULL);
+
+static int
+tps65950_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+
+	switch (ia->ia_addr) {
+	case TPS65950_ADDR_ID1:
+	case TPS65950_ADDR_ID2:
+	case TPS65950_ADDR_ID3:
+	case TPS65950_ADDR_ID4:
+	case TPS65950_ADDR_ID5:
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+static void
+tps65950_attach(device_t parent, device_t self, void *aux)
+{
+	struct tps65950_softc *sc = device_private(self);
+	st

CVS commit: src/sys/arch

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 13:20:16 UTC 2012

Modified Files:
src/sys/arch/arm/omap: omap3_sdhc.c
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
beagleboard supports 8-bit SD mode


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap3_sdhc.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbarm/beagle/beagle_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/arm/omap/omap3_sdhc.c
diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.9 src/sys/arch/arm/omap/omap3_sdhc.c:1.10
--- src/sys/arch/arm/omap/omap3_sdhc.c:1.9	Sat Dec 29 00:08:26 2012
+++ src/sys/arch/arm/omap/omap3_sdhc.c	Mon Dec 31 13:20:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap3_sdhc.c,v 1.9 2012/12/29 00:08:26 jmcneill Exp $	*/
+/*	$NetBSD: omap3_sdhc.c,v 1.10 2012/12/31 13:20:16 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.9 2012/12/29 00:08:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.10 2012/12/31 13:20:16 jmcneill Exp $");
 
 #include "opt_omap.h"
 
@@ -139,10 +139,13 @@ obiosdhc_attach(device_t parent, device_
 	prop_dictionary_t prop = device_properties(self);
 	uint32_t clkd, stat;
 	int error, timo, clksft, n;
+	bool support8bit = false;
 #ifdef TI_AM335X
 	size_t i;
 #endif
 
+	prop_dictionary_get_bool(prop, "8bit", &support8bit);
+
 	sc->sc.sc_dmat = oa->obio_dmat;
 	sc->sc.sc_dev = self;
 	//sc->sc.sc_flags |= SDHC_FLAG_USE_DMA;
@@ -150,6 +153,8 @@ obiosdhc_attach(device_t parent, device_
 	sc->sc.sc_flags |= SDHC_FLAG_NO_LED_ON;
 	sc->sc.sc_flags |= SDHC_FLAG_RSP136_CRC;
 	sc->sc.sc_flags |= SDHC_FLAG_SINGLE_ONLY;
+	if (support8bit)
+		sc->sc.sc_flags |= SDHC_FLAG_8BIT_MODE;
 #ifdef TI_AM335X
 	sc->sc.sc_flags |= SDHC_FLAG_WAIT_RESET;
 	sc->sc.sc_flags &= ~SDHC_FLAG_SINGLE_ONLY;

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.31 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.32
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.31	Thu Dec 13 05:58:14 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Dec 31 13:20:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.31 2012/12/13 05:58:14 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.32 2012/12/31 13:20:16 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.31 2012/12/13 05:58:14 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.32 2012/12/31 13:20:16 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -733,6 +733,7 @@ beagle_device_register(device_t self, vo
 	if (device_is_a(self, "sdhc")) {
 #if defined(OMAP_3530)
 		prop_dictionary_set_uint32(dict, "clkmask", 0);
+		prop_dictionary_set_bool(dict, "8bit", true);
 #endif
 		return;
 	}



CVS commit: src/sys/arch/evbarm/conf

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 12:47:25 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARD

Log Message:
add I2C support


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbarm/conf/BEAGLEBOARD

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/evbarm/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.36 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.37
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.36	Fri Dec 28 23:24:47 2012
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Mon Dec 31 12:47:25 2012
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.36 2012/12/28 23:24:47 jmcneill Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.37 2012/12/31 12:47:25 jmcneill Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -220,13 +220,10 @@ omapgpio4	at obio2 addr 0x49056000 size 
 gpio*		at omapgpio?
 
 # # I2C Controller
-# omapi2c0	at tipb? addr 0xfffb3800 intr 36 mult 4
-# iic*		at omapi2c?
-# # omap's own i2c address
-# options		OMAP_I2C_ADDRESS=0xe
-# # i2c bus clock low and high times in ns
-# options		I2C_LOW_TIME_nSEC=1500
-# options		I2C_HIGH_TIME_nSEC=1000
+omapiic0	at obio0 addr 0x4807 size 0x80
+omapiic1	at obio0 addr 0x48072000 size 0x80
+omapiic2	at obio0 addr 0x4806 size 0x80
+iic*		at omapiic?
 
 # On-board 16550 UARTs
 com0		at obio2 addr 0x4902 intr 74 mult 4	# UART3 (console)



CVS commit: src/sys/arch/arm/omap

2012-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 31 12:45:49 UTC 2012

Modified Files:
src/sys/arch/arm/omap: files.omap2
Added Files:
src/sys/arch/arm/omap: omap3_i2c.c omap3_i2creg.h

Log Message:
Add OMAP3530 I2C support


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/omap/files.omap2
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/omap3_i2c.c \
src/sys/arch/arm/omap/omap3_i2creg.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/arm/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.18 src/sys/arch/arm/omap/files.omap2:1.19
--- src/sys/arch/arm/omap/files.omap2:1.18	Wed Dec 12 00:33:45 2012
+++ src/sys/arch/arm/omap/files.omap2	Mon Dec 31 12:45:49 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.omap2,v 1.18 2012/12/12 00:33:45 matt Exp $
+#	$NetBSD: files.omap2,v 1.19 2012/12/31 12:45:49 jmcneill Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
@@ -48,6 +48,11 @@ device	omapgpio: gpiobus
 attach	omapgpio at obio with omap2gpio
 file	arch/arm/omap/omap2_gpio.c		(omap2 | omap3) & omapgpio
 
+# OMAP3 I2C controllers
+device	omapiic: i2cbus, i2cexec
+attach	omapiic at obio with omap3_i2c
+file	arch/arm/omap/omap3_i2c.c		omap3_i2c
+
 # OMAP dual-mode timer
 device	omapdmtimer
 file	arch/arm/omap/omap_dmtimer.c		omapdmtimer

Added files:

Index: src/sys/arch/arm/omap/omap3_i2c.c
diff -u /dev/null src/sys/arch/arm/omap/omap3_i2c.c:1.1
--- /dev/null	Mon Dec 31 12:45:50 2012
+++ src/sys/arch/arm/omap/omap3_i2c.c	Mon Dec 31 12:45:49 2012
@@ -0,0 +1,436 @@
+/* $NetBSD: omap3_i2c.c,v 1.1 2012/12/31 12:45:49 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2012 Jared D. McNeill 
+ * All rights reserved.
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 
+__KERNEL_RCSID(0, "$NetBSD: omap3_i2c.c,v 1.1 2012/12/31 12:45:49 jmcneill Exp $");
+
+#include "opt_omap.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#ifndef OMAP3_I2C_SLAVE_ADDR
+#define OMAP3_I2C_SLAVE_ADDR	0x01
+#endif
+
+struct omap3_i2c_softc {
+	device_t		sc_dev;
+	struct i2c_controller	sc_ic;
+	kmutex_t		sc_lock;
+	device_t		sc_i2cdev;
+
+	bus_space_tag_t		sc_iot;
+	bus_space_handle_t	sc_ioh;
+};
+
+#define I2C_READ_REG(sc, reg)		\
+	bus_space_read_2((sc)->sc_iot, (sc)->sc_ioh, (reg))
+#define I2C_READ_DATA(sc)		\
+	bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, OMAP3_I2C_DATA);
+#define I2C_WRITE_REG(sc, reg, val)	\
+	bus_space_write_2((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
+#define I2C_WRITE_DATA(sc, val)		\
+	bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, OMAP3_I2C_DATA, (val))
+
+static int	omap3_i2c_match(device_t, cfdata_t, void *);
+static void	omap3_i2c_attach(device_t, device_t, void *);
+static int	omap3_i2c_rescan(device_t, const char *, const int *);
+static void	omap3_i2c_childdet(device_t, device_t);
+
+static int	omap3_i2c_acquire_bus(void *, int);
+static void	omap3_i2c_release_bus(void *, int);
+static int	omap3_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *,
+			   size_t, void *, size_t, int);
+
+static int	omap3_i2c_reset(struct omap3_i2c_softc *);
+static int	omap3_i2c_read(struct omap3_i2c_softc *, i2c_addr_t,
+			   uint8_t *, size_t, int);
+static int	omap3_i2c_write(struct omap3_i2c_softc *, i2c_addr_t,
+const uint8_t *, size_t, int);
+static int	omap3_i2c_wait(struct omap3_i2c_softc *, uint16_t, uint16_t);
+static int	omap3_i2c_stat(struct omap3_i2c_softc *);
+static int	omap3_i2c_flush(struct omap3_i2c_softc *);
+
+CFATTACH_DECL2_NEW(omap3_i2c, sizeof(struct omap3_i2c_softc),
+omap3_i2c_match, omap3_i2c_attach, NULL, NULL,
+omap3_i2c_res

CVS commit: src/sys/dev/pci

2012-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Dec 31 11:11:18 UTC 2012

Modified Files:
src/sys/dev/pci: radeonfb.c

Log Message:
fix some typos & comments


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/radeonfb.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/dev/pci/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.71 src/sys/dev/pci/radeonfb.c:1.72
--- src/sys/dev/pci/radeonfb.c:1.71	Mon Dec 31 10:38:51 2012
+++ src/sys/dev/pci/radeonfb.c	Mon Dec 31 11:11:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.71 2012/12/31 10:38:51 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.72 2012/12/31 11:11:17 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.71 2012/12/31 10:38:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.72 2012/12/31 11:11:17 macallan Exp $");
 
 #include 
 #include 
@@ -975,7 +975,7 @@ radeonfb_attach(device_t parent, device_
 		radeonfb_set_backlight(dp, dp->rd_bl_level);
 	}
 
-	for (i = i; i < RADEON_NDISPLAYS; i++)
+	for (i = 0; i < RADEON_NDISPLAYS; i++)
 		radeonfb_init_palette(&sc->sc_displays[i]);
  
 	if (HAS_CRTC2(sc)) {
@@ -2551,6 +2551,7 @@ radeonfb_init_palette(struct radeonfb_di
 	/* initialize the palette for every CRTC used by this display */
 	for (cc = 0; cc < dp->rd_ncrtcs; cc++) {
 		crtc = dp->rd_crtcs[cc].rc_number;
+		DPRINTF(("%s: doing crtc %d %d\n", __func__, cc, crtc));
 
 		if (crtc)
 			SET32(sc, RADEON_DAC_CNTL2, RADEON_DAC2_PALETTE_ACC_CTL);
@@ -2559,11 +2560,9 @@ radeonfb_init_palette(struct radeonfb_di
 
 		PUT32(sc, RADEON_PALETTE_INDEX, 0);
 
-		if (dp->rd_bpp == 0)
-			dp->rd_bpp = RADEONFB_DEFAULT_DEPTH;
-
 		if (dp->rd_bpp == 8) {
-			/* ANSI palette */
+
+			/* R3G3B2 palette */
 			int j = 0;
 			uint32_t tmp, r, g, b;
 



CVS commit: src/sys/dev/pci

2012-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Dec 31 10:38:51 UTC 2012

Modified Files:
src/sys/dev/pci: radeonfb.c

Log Message:
R4xx support is untested at best, so don't pretend to support them.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/radeonfb.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/dev/pci/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.70 src/sys/dev/pci/radeonfb.c:1.71
--- src/sys/dev/pci/radeonfb.c:1.70	Mon Dec 31 10:31:19 2012
+++ src/sys/dev/pci/radeonfb.c	Mon Dec 31 10:38:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.70 2012/12/31 10:31:19 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.71 2012/12/31 10:38:51 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.70 2012/12/31 10:31:19 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.71 2012/12/31 10:38:51 macallan Exp $");
 
 #include 
 #include 
@@ -354,6 +354,7 @@ static struct {
 	{ PCI_PRODUCT_ATI_RADEON_RV370_5B64,	RADEON_RV380, 0 },
 	{ PCI_PRODUCT_ATI_RADEON_RV370_5B65,	RADEON_RV380, 0 },
 
+#if notyet
 	/* R420/R423 family */
 	{ PCI_PRODUCT_ATI_RADEON_R420_JH,	RADEON_R420, 0 },
 	{ PCI_PRODUCT_ATI_RADEON_R420_JI,	RADEON_R420, 0 },
@@ -372,7 +373,7 @@ static struct {
 	{ PCI_PRODUCT_ATI_RADEON_R423_UT,	RADEON_R420, 0 },
 	{ PCI_PRODUCT_ATI_RADEON_R423_5D57,	RADEON_R420, 0 },
 	{ PCI_PRODUCT_ATI_RADEON_R430_554F,	RADEON_R420, 0 },
-
+#endif
 	{ 0, 0, 0 }
 };
 



CVS commit: src/sys/dev/pci

2012-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Dec 31 10:31:19 UTC 2012

Modified Files:
src/sys/dev/pci: radeonfb.c

Log Message:
clean up some more confusion between (ws)displays and CRTCs.
Now palette initialization no longer stomps over the port table, which gives
us a fighting chance to intentionally enable the right outputs.
How on earth did this ever work?


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/radeonfb.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/dev/pci/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.69 src/sys/dev/pci/radeonfb.c:1.70
--- src/sys/dev/pci/radeonfb.c:1.69	Sun Dec 30 09:45:05 2012
+++ src/sys/dev/pci/radeonfb.c	Mon Dec 31 10:31:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.69 2012/12/30 09:45:05 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.70 2012/12/31 10:31:19 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.69 2012/12/30 09:45:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.70 2012/12/31 10:31:19 macallan Exp $");
 
 #include 
 #include 
@@ -131,7 +131,7 @@ static void radeonfb_modeswitch(struct r
 static void radeonfb_setcrtc(struct radeonfb_display *, int);
 static void radeonfb_init_misc(struct radeonfb_softc *);
 static void radeonfb_set_fbloc(struct radeonfb_softc *);
-static void radeonfb_init_palette(struct radeonfb_softc *, int);
+static void radeonfb_init_palette(struct radeonfb_display *);
 static void radeonfb_r300cg_workaround(struct radeonfb_softc *);
 
 static int radeonfb_isblank(struct radeonfb_display *);
@@ -645,9 +645,6 @@ radeonfb_attach(device_t parent, device_
 
 
 	radeonfb_init_misc(sc);
-	radeonfb_init_palette(sc, 0);
-	if (HAS_CRTC2(sc))
-		radeonfb_init_palette(sc, 1);
 
 	/* program the DAC wirings */
 	for (i = 0; i < (HAS_CRTC2(sc) ? 2 : 1); i++) {
@@ -668,7 +665,7 @@ radeonfb_attach(device_t parent, device_
 			i ? 0 : RADEON_CRT2_DISP1_SEL,
 			~RADEON_CRT2_DISP1_SEL);
 			/* we're using CRTC2 for the 2nd port */
-			if (sc->sc_ports[i].rp_number == 99) {
+			if (sc->sc_ports[i].rp_number == 1) {
 PATCH32(sc, RADEON_DISP_OUTPUT_CNTL,
 RADEON_DISP_DAC2_SOURCE_CRTC2,
 ~RADEON_DISP_DAC2_SOURCE_MASK);
@@ -676,9 +673,13 @@ radeonfb_attach(device_t parent, device_
 			
 			break;
 		}
+		DPRINTF(("%s: port %d tmds type %d\n", __func__, i,
+		sc->sc_ports[i].rp_tmds_type));
 		switch (sc->sc_ports[i].rp_tmds_type) {
 		case RADEON_TMDS_INT:
 			/* point FP0 at the CRTC this port uses */
+			DPRINTF(("%s: plugging internal TMDS into CRTC %d\n",
+			__func__, sc->sc_ports[i].rp_number));
 			if (IS_R300(sc)) {
 PATCH32(sc, RADEON_FP_GEN_CNTL,
 sc->sc_ports[i].rp_number ?
@@ -973,16 +974,13 @@ radeonfb_attach(device_t parent, device_
 		radeonfb_set_backlight(dp, dp->rd_bl_level);
 	}
 
-	/*
-	 * if we have console output via firmware like on sparc64 it may
-	 * interfere with DAC programming so program the palette again
-	 * here after we took over
-	 */
-	radeonfb_init_palette(sc, 0); 
+	for (i = i; i < RADEON_NDISPLAYS; i++)
+		radeonfb_init_palette(&sc->sc_displays[i]);
+ 
 	if (HAS_CRTC2(sc)) {
-		radeonfb_init_palette(sc, 1);
 		CLR32(sc, RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_DISP_DIS);
 	}
+
 	CLR32(sc, RADEON_CRTC_EXT_CNTL, RADEON_CRTC_DISPLAY_DIS);
 	SET32(sc, RADEON_FP_GEN_CNTL, RADEON_FP_FPON);
 	pmf_event_register(dev, PMFE_DISPLAY_BRIGHTNESS_UP,
@@ -1121,7 +1119,7 @@ radeonfb_ioctl(void *v, void *vs,
 				radeonfb_map(sc);
 radeonfb_engine_init(dp);
 glyphcache_wipe(&dp->rd_gc);
-radeonfb_init_palette(sc, dp == &sc->sc_displays[0] ? 0 : 1);
+radeonfb_init_palette(dp);
 radeonfb_modeswitch(dp);
 vcons_redraw_screen(dp->rd_vd.active);
 			} else {
@@ -1754,7 +1752,7 @@ nobios:
 			sc->sc_ports[1].rp_ddc_type = RADEON_DDC_VGA;
 			sc->sc_ports[1].rp_dac_type = RADEON_DAC_PRIMARY;
 			sc->sc_ports[1].rp_conn_type = RADEON_CONN_CRT;
-			sc->sc_ports[1].rp_tmds_type = RADEON_TMDS_EXT;
+			sc->sc_ports[1].rp_tmds_type = RADEON_TMDS_UNKNOWN;
 			sc->sc_ports[1].rp_number = 0;
 		}
 	}
@@ -2535,10 +2533,12 @@ radeonfb_init_misc(struct radeonfb_softc
  * This loads a linear color map for true color.
  */
 void
-radeonfb_init_palette(struct radeonfb_softc *sc, int crtc)
+radeonfb_init_palette(struct radeonfb_display *dp)
 {
-	int		i;
+	struct radeonfb_softc *sc = dp->rd_softc;
+	int		i, cc;
 	uint32_t	vclk;
+	int		crtc;
 
 #define	DAC_WIDTH ((1 << 10) - 1)
 #define	CLUT_WIDTH ((1 << 8) - 1)
@@ -2547,50 +2547,57 @@ radeonfb_init_palette(struct radeonfb_so
 	vclk = GETPLL(sc, RADEON_VCLK_ECP_CNTL);
 	PUTPLL(sc, RADEON_VCLK_ECP_CNTL, vclk & ~RADEON_PIXCLK_DAC_ALWAYS_ONb);
 
-	if (crtc)
-		SET32(sc, RADEON_DAC_CNTL2, RADEON_DAC2_PALETTE_ACC_CTL);
-	else
-		CLR32(sc, RADEON_DAC_CNTL2, RADEON_DAC2_PALETTE_ACC_C

CVS commit: src/sys/arch/arm/arm

2012-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec 31 08:57:27 UTC 2012

Modified Files:
src/sys/arch/arm/arm: db_trace.c

Log Message:
At each function level print a useful offset (as also shown in rlv)

OK from gimpy


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/arm/db_trace.c

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

Modified files:

Index: src/sys/arch/arm/arm/db_trace.c
diff -u src/sys/arch/arm/arm/db_trace.c:1.26 src/sys/arch/arm/arm/db_trace.c:1.27
--- src/sys/arch/arm/arm/db_trace.c:1.26	Mon Nov 12 18:00:34 2012
+++ src/sys/arch/arm/arm/db_trace.c	Mon Dec 31 08:57:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.26 2012/11/12 18:00:34 skrll Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.27 2012/12/31 08:57:27 skrll Exp $	*/
 
 /* 
  * Copyright (c) 2000, 2001 Ben Harris
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.26 2012/11/12 18:00:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.27 2012/12/31 08:57:27 skrll Exp $");
 
 #include 
 #include 
@@ -92,6 +92,7 @@ db_stack_trace_print(db_expr_t addr, boo
 	bool		kernel_only = true;
 	bool		trace_thread = false;
 	bool		lwpaddr = false;
+	db_addr_t	scp, pc;
 	int		scp_offset;
 
 	while ((c = *cp++) != 0) {
@@ -151,13 +152,28 @@ db_stack_trace_print(db_expr_t addr, boo
 	lastframe = NULL;
 	scp_offset = -(get_pc_str_offset() >> 2);
 
+	/*
+	 * In theory, the SCP isn't guaranteed to be in the function
+	 * that generated the stack frame.  We hope for the best.
+	 */
+#ifdef __PROG26
+	scp = frame[FR_SCP] & R15_PC;
+#else
+	scp = frame[FR_SCP];
+#endif
+	pc = scp;
+
 	while (count-- && frame != NULL) {
-		db_addr_t	scp;
 		uint32_t	savecode;
 		int		r;
 		uint32_t	*rp;
 		const char	*sep;
 
+#ifdef __PROG26
+		scp = frame[FR_SCP] & R15_PC;
+#else
+		scp = frame[FR_SCP];
+#endif
 		lastframe = frame;
 #ifndef _KERNEL
 		uint32_t frameb[4];
@@ -166,24 +182,14 @@ db_stack_trace_print(db_expr_t addr, boo
 		frame = frameb + 3;
 #endif
 
-		/*
-		 * In theory, the SCP isn't guaranteed to be in the function
-		 * that generated the stack frame.  We hope for the best.
-		 */
-#ifdef __PROG26
-		scp = frame[FR_SCP] & R15_PC;
-#else
-		scp = frame[FR_SCP];
-#endif
-
-		db_printsym(scp, DB_STGY_PROC, pr);
+		db_printsym(pc, DB_STGY_PROC, pr);
 		(*pr)("\n\t");
 #ifdef __PROG26
-		(*pr)("scp=0x%08x rlv=0x%08x (", scp, frame[FR_RLV] & R15_PC);
+		(*pr)("pc =0x%08x rlv=0x%08x (", pc, frame[FR_RLV] & R15_PC);
 		db_printsym(frame[FR_RLV] & R15_PC, DB_STGY_PROC, pr);
 		(*pr)(")\n");
 #else
-		(*pr)("scp=0x%08x rlv=0x%08x (", scp, frame[FR_RLV]);
+		(*pr)("pc =0x%08x rlv=0x%08x (", pc, frame[FR_RLV]);
 		db_printsym(frame[FR_RLV], DB_STGY_PROC, pr);
 		(*pr)(")\n");
 #endif
@@ -220,7 +226,12 @@ db_stack_trace_print(db_expr_t addr, boo
 		 */
 		if (frame[FR_RFP] == 0)
 			break; /* Top of stack */
-
+#ifdef __PROG26
+		pc = frame[FR_RLV] & R15_PC;
+#else
+		pc = frame[FR_RLV];
+#endif
+		
 		frame = (uint32_t *)(frame[FR_RFP]);
 
 		if (INKERNEL((int)frame)) {