CVS commit: src/sys/dev/i2c

2012-07-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul 29 07:04:10 UTC 2012

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

Log Message:
Use const nodes. Let sysctl_createv initialize sysctl_data.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/g760a.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/g760a.c
diff -u src/sys/dev/i2c/g760a.c:1.3 src/sys/dev/i2c/g760a.c:1.4
--- src/sys/dev/i2c/g760a.c:1.3	Sat Jul 28 23:03:47 2012
+++ src/sys/dev/i2c/g760a.c	Sun Jul 29 07:04:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: g760a.c,v 1.3 2012/07/28 23:03:47 matt Exp $	*/
+/*	$NetBSD: g760a.c,v 1.4 2012/07/29 07:04:09 mlelstv Exp $	*/
 
 /*-
  * Copyright (C) 2008 A.Leo.
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: g760a.c,v 1.3 2012/07/28 23:03:47 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: g760a.c,v 1.4 2012/07/29 07:04:09 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -218,11 +218,11 @@ g760a_setup(struct g760a_softc* sc)
 {
 	int error;
 	int ret;
-	struct sysctlnode* me = NULL, * node = NULL;
+	const struct sysctlnode *me, *node;
 
 	sc-sc_sme = sysmon_envsys_create();
 
-	ret = sysctl_createv(NULL, 0, NULL, (void *)me,
+	ret = sysctl_createv(NULL, 0, NULL, me,
 			CTLFLAG_READWRITE,
 			CTLTYPE_NODE, device_xname(sc-sc_dev), NULL,
 			NULL, 0, NULL, 0,
@@ -236,13 +236,11 @@ g760a_setup(struct g760a_softc* sc)
 	if (sysmon_envsys_sensor_attach(sc-sc_sme, sc-sc_sensor))
 		goto out;
 
-	ret = sysctl_createv(NULL, 0, NULL, (void *)node,
+	ret = sysctl_createv(NULL, 0, NULL, node,
 			CTLFLAG_READWRITE,
 			CTLTYPE_INT, rpm, sc-sc_sensor.desc,
-			sysctl_g760a_rpm, 0x42, NULL, 0,
+			sysctl_g760a_rpm, 0x42, (void*)sc, 0,
 			CTL_MACHDEP, me-sysctl_num, CTL_CREATE, CTL_EOL);
-	if (node != NULL)
-		node-sysctl_data = sc;
 
 	sc-sc_sme-sme_name = device_xname(sc-sc_dev);
 	sc-sc_sme-sme_cookie = sc;



CVS commit: src/sys/ufs/ufs

2012-07-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul 29 08:32:27 UTC 2012

Modified Files:
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Restore accidentally lost initialization of quotatypes[].
Fixes (null) in the kernel message triggered when you go over quota, and
maybe other things. Reported by Matthew Mondor.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/ufs/ufs/ufs_quota.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/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.109 src/sys/ufs/ufs/ufs_quota.c:1.110
--- src/sys/ufs/ufs/ufs_quota.c:1.109	Sat Feb 18 06:13:23 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jul 29 08:32:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.109 2012/02/18 06:13:23 matt Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.110 2012/07/29 08:32:27 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.109 2012/02/18 06:13:23 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.110 2012/07/29 08:32:27 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, $NetBSD: ufs_quota.c,
 
 #include sys/quotactl.h
 #include ufs/ufs/quota.h
+#include ufs/ufs/quota1.h /* for INITQFNAMES; should be moved to quota.h */
 #include ufs/ufs/inode.h
 #include ufs/ufs/ufsmount.h
 #include ufs/ufs/ufs_extern.h
@@ -59,7 +60,7 @@ __KERNEL_RCSID(0, $NetBSD: ufs_quota.c,
 
 kmutex_t dqlock;
 kcondvar_t dqcv;
-const char *quotatypes[MAXQUOTAS];
+const char *quotatypes[MAXQUOTAS] = INITQFNAMES;
 
 /*
  * Code pertaining to management of the in-core dquot data structures.



CVS commit: src/sys/sys

2012-07-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul 29 10:07:10 UTC 2012

Modified Files:
src/sys/sys: conf.h

Log Message:
use standard macro for bdev_size declaration


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/sys/conf.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/sys/conf.h
diff -u src/sys/sys/conf.h:1.141 src/sys/sys/conf.h:1.142
--- src/sys/sys/conf.h:1.141	Mon Dec 12 19:03:12 2011
+++ src/sys/sys/conf.h	Sun Jul 29 10:07:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.141 2011/12/12 19:03:12 mrg Exp $	*/
+/*	$NetBSD: conf.h,v 1.142 2012/07/29 10:07:10 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -152,6 +152,7 @@ dev_type_close(bdev_close);
 dev_type_strategy(bdev_strategy);
 dev_type_ioctl(bdev_ioctl);
 dev_type_dump(bdev_dump);
+dev_type_size(bdev_size);
 
 dev_type_open(cdev_open);
 dev_type_close(cdev_close);
@@ -166,7 +167,6 @@ dev_type_kqfilter(cdev_kqfilter);
 
 int	cdev_type(dev_t);
 int	bdev_type(dev_t);
-int	bdev_size(dev_t);
 
 /* symbolic sleep message strings */
 extern	const char devopn[], devio[], devwait[], devin[], devout[];



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 29 13:17:53 UTC 2012

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386: x86cpuid.S

Log Message:
Fix init call to OPENSSL_cpuid_setup.
XXX why are using a globally visible routine in a constructor?


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.6 src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.7
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.6	Sat Jul 28 18:06:08 2012
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S	Sun Jul 29 13:17:53 2012
@@ -329,4 +329,6 @@ OPENSSL_ia32_rdrand:
 .size	OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
 .comm	OPENSSL_ia32cap_P,8,4
 .section	.init
-	call	OPENSSL_cpuid_setup@PLT
+	PIC_PROLOGUE
+	call	PIC_PLT(OPENSSL_cpuid_setup)
+	PIC_EPILOGUE



CVS commit: src/lib/libc/gen

2012-07-29 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Jul 29 14:44:14 UTC 2012

Modified Files:
src/lib/libc/gen: arc4random.c

Log Message:
Make this compile with the compiler I'm using.
Move variable defs to top of function.
Don't use const static mib[] - run time initialisation won't matter,
and not using static data may actually help in a .so.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gen/arc4random.c

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

Modified files:

Index: src/lib/libc/gen/arc4random.c
diff -u src/lib/libc/gen/arc4random.c:1.13 src/lib/libc/gen/arc4random.c:1.14
--- src/lib/libc/gen/arc4random.c:1.13	Mon Mar  5 19:40:08 2012
+++ src/lib/libc/gen/arc4random.c	Sun Jul 29 14:44:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.13 2012/03/05 19:40:08 christos Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.14 2012/07/29 14:44:13 dsl Exp $	*/
 /*	$OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $	*/
 
 /*
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: arc4random.c,v 1.13 2012/03/05 19:40:08 christos Exp $);
+__RCSID($NetBSD: arc4random.c,v 1.14 2012/07/29 14:44:13 dsl Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -65,7 +65,8 @@ static inline uint32_t arc4_getword(stru
 static inline void
 arc4_init(struct arc4_stream *as)
 {
-	for (int n = 0; n  RSIZE; n++)
+	int n;
+	for (n = 0; n  RSIZE; n++)
 		as-s[n] = n;
 	as-i = 0;
 	as-j = 0;
@@ -78,9 +79,10 @@ static inline void
 arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
 {
 	uint8_t si;
+	int n;
 
 	as-i--;
-	for (int n = 0; n  RSIZE; n++) {
+	for (n = 0; n  RSIZE; n++) {
 		as-i = (as-i + 1);
 		si = as-s[as-i];
 		as-j = (as-j + si + dat[n % datlen]);
@@ -94,8 +96,9 @@ static void
 arc4_stir(struct arc4_stream *as)
 {
 	int rdat[32];
-	static const int mib[] = { CTL_KERN, KERN_URND };
+	int mib[] = { CTL_KERN, KERN_URND };
 	size_t len;
+	size_t i, j;
 
 	/*
 	 * This code once opened and read /dev/urandom on each
@@ -106,7 +109,7 @@ arc4_stir(struct arc4_stream *as)
 	 * for us but much friendlier to other entropy consumers.
 	 */
 
-	for (size_t i = 0; i  __arraycount(rdat); i++) {
+	for (i = 0; i  __arraycount(rdat); i++) {
 		len = sizeof(rdat[i]);
 		if (sysctl(mib, 2, rdat[i], len, NULL, 0) == -1)
 			abort();
@@ -119,7 +122,7 @@ arc4_stir(struct arc4_stream *as)
 	 * paper Weaknesses in the Key Scheduling Algorithm of RC4
 	 * by Fluher, Mantin, and Shamir.  (N = 256 in our case.)
 	 */
-	for (size_t j = 0; j  RSIZE * 4; j++)
+	for (j = 0; j  RSIZE * 4; j++)
 		arc4_getbyte(as);
 }
 



CVS commit: src/sys/dev/ic

2012-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 29 18:20:14 UTC 2012

Modified Files:
src/sys/dev/ic: wdc.c

Log Message:
PR/46599: Onno van der Linden: Don't call bus space commands with 0 len.
Causes the sil 3112 controller to lock up.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/dev/ic/wdc.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/ic/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.272 src/sys/dev/ic/wdc.c:1.273
--- src/sys/dev/ic/wdc.c:1.272	Thu Jul 26 16:49:48 2012
+++ src/sys/dev/ic/wdc.c	Sun Jul 29 14:20:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.272 2012/07/26 20:49:48 jakllsch Exp $ */
+/*	$NetBSD: wdc.c,v 1.273 2012/07/29 18:20:13 christos Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wdc.c,v 1.272 2012/07/26 20:49:48 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: wdc.c,v 1.273 2012/07/29 18:20:13 christos Exp $);
 
 #include opt_ata.h
 #include opt_wdc.h
@@ -1879,28 +1879,35 @@ wdc_datain_pio(struct ata_channel *chp, 
 #endif
 
 	if (flags  DRIVE_NOSTREAM) {
-		if (flags  DRIVE_CAP32) {
+		if ((flags  DRIVE_CAP32)  len  3) {
 			bus_space_read_multi_4(wdr-data32iot,
 			wdr-data32ioh, 0, bf, len  2);
 			bf = (char *)bf + (len  ~3);
 			len = 3;
 		}
-		if (len) {
+		if (len  1) {
 			bus_space_read_multi_2(wdr-cmd_iot,
 			wdr-cmd_iohs[wd_data], 0, bf, len  1);
+			bf = (char *)bf + (len  ~1);
+			len = 1;
 		}
 	} else {
-		if (flags  DRIVE_CAP32) {
+		if ((flags  DRIVE_CAP32)  len  3) {
 			bus_space_read_multi_stream_4(wdr-data32iot,
 			wdr-data32ioh, 0, bf, len  2);
 			bf = (char *)bf + (len  ~3);
 			len = 3;
 		}
-		if (len) {
+		if (len  1) {
 			bus_space_read_multi_stream_2(wdr-cmd_iot,
 			wdr-cmd_iohs[wd_data], 0, bf, len  1);
+			bf = (char *)bf + (len  ~1);
+			len = 1;
 		}
 	}
+	if (len)
+		*((uint8_t *)bf) = bus_space_read_1(wdr-cmd_iot,
+			wdr-cmd_iohs[wd_data], 0);
 	return;
 
 #ifndef __NO_STRICT_ALIGNMENT



CVS commit: src/share/man/man9

2012-07-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 29 18:51:48 UTC 2012

Modified Files:
src/share/man/man9: cpu_rootconf.9

Log Message:
Serial comma, whitespace fixes, sort SEE ALSO.
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/cpu_rootconf.9

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

Modified files:

Index: src/share/man/man9/cpu_rootconf.9
diff -u src/share/man/man9/cpu_rootconf.9:1.7 src/share/man/man9/cpu_rootconf.9:1.8
--- src/share/man/man9/cpu_rootconf.9:1.7	Sun Jul 29 18:05:48 2012
+++ src/share/man/man9/cpu_rootconf.9	Sun Jul 29 18:51:48 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: cpu_rootconf.9,v 1.7 2012/07/29 18:05:48 mlelstv Exp $
+.\ $NetBSD: cpu_rootconf.9,v 1.8 2012/07/29 18:51:48 wiz Exp $
 .\
 .\ Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 13, 2010
+.Dd July 29, 2012
 .Dt CPU_ROOTCONF 9
 .Os
 .Sh NAME
@@ -52,14 +52,14 @@ determine the root file system device an
 file system state.
 .Fn cpu_rootconf
 provides the global variables
-.Fa booted_device,
+.Fa booted_device ,
 .Fa booted_partition ,
-.Fa booted_startblk
+.Fa booted_startblk ,
 and
 .Fa booted_nblks
 and invokes the machine-independent function
 .Fa rootconf
-which 
+which
 .Fa rootconf
 then calls the function
 .Fa setroot
@@ -77,6 +77,6 @@ Otherwise the
 .Fa booted_partition
 is used.
 .Sh SEE ALSO
+.Xr dk 4 ,
 .Xr boot 8 ,
-.Xr boothowto 9 ,
-.Xr dk 4
+.Xr boothowto 9



CVS commit: src/sys/dev/pci

2012-07-29 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Jul 29 20:31:53 UTC 2012

Modified Files:
src/sys/dev/pci: tdvfb.c tdvfbvar.h

Log Message:
Add wsdisplay ioctls and support for mmap'ing of linear frame buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/tdvfb.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/tdvfbvar.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/dev/pci/tdvfb.c
diff -u src/sys/dev/pci/tdvfb.c:1.3 src/sys/dev/pci/tdvfb.c:1.4
--- src/sys/dev/pci/tdvfb.c:1.3	Fri Jul 20 21:31:28 2012
+++ src/sys/dev/pci/tdvfb.c	Sun Jul 29 20:31:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tdvfb.c,v 1.3 2012/07/20 21:31:28 rkujawa Exp $	*/
+/*	$NetBSD: tdvfb.c,v 1.4 2012/07/29 20:31:53 rkujawa Exp $	*/
 
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.   
@@ -38,10 +38,18 @@
  *
  * This driver currently only support boards with ICS GENDAC (which seems to
  * be most popular, however at least two different DACs were used with CVG).
+ *
+ * TODO (in no particular order):
+ * - Finally fix 16-bit depth handling on big-endian machines.
+ * - Expose card to userspace through /dev/3dfx compatible device file
+ *   (for Glide).
+ * - Allow mmap'ing of registers through wscons access op.
+ * - Complete wscons emul ops acceleration support.
+ * - Add support for others DACs (need hardware).
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tdvfb.c,v 1.3 2012/07/20 21:31:28 rkujawa Exp $);
+__KERNEL_RCSID(0, $NetBSD: tdvfb.c,v 1.4 2012/07/29 20:31:53 rkujawa Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -58,6 +66,7 @@ __KERNEL_RCSID(0, $NetBSD: tdvfb.c,v 1.
 #include dev/pci/tdvfbvar.h
 
 #include dev/videomode/videomode.h
+#include dev/pci/wsdisplay_pci.h
 
 #include opt_wsemul.h
 #include opt_tdvfb.h
@@ -93,6 +102,9 @@ static void	tdvfb_gendac_set_cvg_timing(
 static void	tdvfb_gendac_set_vid_timing(struct tdvfb_softc *sc, 
 		struct tdvfb_dac_timing *timing);
 
+static paddr_t	tdvfb_mmap(void *v, void *vs, off_t offset, int prot);
+static int	tdvfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
+		struct lwp *l);
 static void	tdvfb_init_screen(void *cookie, struct vcons_screen *scr, 
 		int existing, long *defattr);
 static void	tdvfb_init_palette(struct tdvfb_softc *sc);
@@ -109,6 +121,17 @@ static void	tdvfb_copyrows(void *cookie,
 CFATTACH_DECL_NEW(tdvfb, sizeof(struct tdvfb_softc),
 tdvfb_match, tdvfb_attach, NULL, NULL);
 
+struct wsdisplay_accessops tdvfb_accessops = {
+	tdvfb_ioctl,
+	tdvfb_mmap,
+	NULL,	/* alloc_screen */
+	NULL,	/* free_screen */
+	NULL,	/* show_screen */
+	NULL, 	/* load_font */
+	NULL,	/* pollc */
+	NULL	/* scroll */
+};
+
 static int
 tdvfb_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -172,7 +195,7 @@ tdvfb_attach(device_t parent, device_t s
 	}
 
 	aprint_normal_dev(sc-sc_dev, registers at 0x%08x, fb at 0x%08x\n, 
-	sc-sc_cvg_pa, sc-sc_cvg_pa + TDV_OFF_FB);
+	(uint32_t) sc-sc_cvg_pa, (uint32_t) sc-sc_cvg_pa + TDV_OFF_FB);
 
 	/* Do the low level setup. */
 	if (!tdvfb_init(sc)) {
@@ -186,13 +209,23 @@ tdvfb_attach(device_t parent, device_t s
 	 */
 	sc-sc_memsize = tdvfb_mem_size(sc);
 
+	aprint_normal_dev(sc-sc_dev, %d MB framebuffer memory present\n, 
+	sc-sc_memsize / 1024 / 1024);
+
 	/* Select video mode, 800x600 32bpp 60Hz by default... */
 	sc-sc_width = 800;
 	sc-sc_height = 600;
+#if BYTE_ORDER == BIG_ENDIAN
 	sc-sc_bpp = 32;	/* XXX: 16 would allow blitter use. */
+#else
+	sc-sc_bpp = 16;
+#endif 
 	sc-sc_linebytes = 1024 * (sc-sc_bpp / 8);
 	sc-sc_videomode = pick_mode_by_ref(sc-sc_width, sc-sc_height, 60);
 
+	aprint_normal_dev(sc-sc_dev, setting %dx%d %d bpp resolution\n,
+	sc-sc_width, sc-sc_height, sc-sc_bpp);
+
 	tdvfb_videomode_set(sc);
 
 	sc-sc_defaultscreen_descr = (struct wsscreen_descr){
@@ -208,7 +241,7 @@ tdvfb_attach(device_t parent, device_t s
 	sc-sc_mode = WSDISPLAYIO_MODE_EMUL;
 	
 	vcons_init(sc-vd, sc, sc-sc_defaultscreen_descr,
-	sc-sc_accessops);
+	tdvfb_accessops);
 	sc-vd.init_screen = tdvfb_init_screen;
 
 	ri = sc-sc_console_screen.scr_ri;
@@ -238,7 +271,7 @@ tdvfb_attach(device_t parent, device_t s
 
 	ws_aa.console = console;
 	ws_aa.scrdata = sc-sc_screenlist;
-	ws_aa.accessops = sc-sc_accessops;
+	ws_aa.accessops = tdvfb_accessops;
 	ws_aa.accesscookie = sc-vd;
 	
 	config_found(sc-sc_dev, ws_aa, wsemuldisplaydevprint);
@@ -889,3 +922,77 @@ tdvfb_eraserows(void *cookie, int row, i
 	}
 }
 
+static int
+tdvfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
+{
+	struct vcons_data *vd;
+	struct tdvfb_softc *sc;
+	struct wsdisplay_fbinfo *wsfbi;
+	struct vcons_screen *ms;
+
+	vd = v;
+	sc = vd-cookie;
+	ms = vd-active;
+
+	switch (cmd) {
+	case WSDISPLAYIO_GTYPE:
+		*(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
+		return 0;
+
+	case PCI_IOC_CFGREAD:
+	case PCI_IOC_CFGWRITE:
+		return 

CVS commit: src

2012-07-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul 29 20:36:07 UTC 2012

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile

Log Message:
add rootconf(9) as a link to cpu_rootconf(9)


To generate a diff of this commit:
cvs rdiff -u -r1.1770 -r1.1771 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.366 -r1.367 src/share/man/man9/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1770 src/distrib/sets/lists/comp/mi:1.1771
--- src/distrib/sets/lists/comp/mi:1.1770	Thu Jul 26 20:05:39 2012
+++ src/distrib/sets/lists/comp/mi	Sun Jul 29 20:36:05 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1770 2012/07/26 20:05:39 christos Exp $
+#	$NetBSD: mi,v 1.1771 2012/07/29 20:36:05 mlelstv Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -16882,6 +16882,7 @@
 ./usr/share/man/html9/rnd_attach_source.html	comp-sys-htmlman	html
 ./usr/share/man/html9/rnd_detach_source.html	comp-sys-htmlman	html
 ./usr/share/man/html9/rnd_extract_data.html	comp-sys-htmlman	html
+./usr/share/man/html9/rootconf.html		comp-sys-htmlman	html
 ./usr/share/man/html9/round_page.html		comp-sys-htmlman	html
 ./usr/share/man/html9/rounddown.html		comp-sys-htmlman	html
 ./usr/share/man/html9/roundup.html		comp-sys-htmlman	html
@@ -23307,6 +23308,7 @@
 ./usr/share/man/man9/rnd_attach_source.9	comp-sys-man		.man
 ./usr/share/man/man9/rnd_detach_source.9	comp-sys-man		.man
 ./usr/share/man/man9/rnd_extract_data.9		comp-sys-man		.man
+./usr/share/man/man9/rootconf.9			comp-sys-man		.man
 ./usr/share/man/man9/round_page.9		comp-sys-man		.man
 ./usr/share/man/man9/rounddown.9		comp-sys-man		.man
 ./usr/share/man/man9/roundup.9			comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.366 src/share/man/man9/Makefile:1.367
--- src/share/man/man9/Makefile:1.366	Mon Jul  2 21:10:31 2012
+++ src/share/man/man9/Makefile	Sun Jul 29 20:36:05 2012
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.366 2012/07/02 21:10:31 jym Exp $
+#   $NetBSD: Makefile,v 1.367 2012/07/29 20:36:05 mlelstv Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -251,7 +251,8 @@ MLINKS+=copy.9 copyin.9 copy.9 copyout.9
 MLINKS+=cpu_dumpconf.9 cpu_dump.9 cpu_dumpconf.9 cpu_dumpsize.9 \
 	cpu_dumpconf.9 dumpsys.9
 MLINKS+=cpu_lwp_fork.9 child_return.9 cpu_lwp_fork.9 proc_trampoline.9
-MLINKS+=cpu_rootconf.9 setroot.9
+MLINKS+=cpu_rootconf.9 setroot.9 \
+cpu_rootconf.9 rootconf.9
 MLINKS+=cpufreq.9 cpufreq_register.9 \
 	cpufreq.9 cpufreq_deregister.9 \
 	cpufreq.9 cpufreq_suspend.9 \



CVS commit: src/sys/dev/ata

2012-07-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jul 29 21:10:50 UTC 2012

Modified Files:
src/sys/dev/ata: ata.c atavar.h

Log Message:
Remove ata_channel-ata_drives, it's redundant with the pointer in
ata_drive_datas.  Originally part of a commit by bouyer@.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/ata/atavar.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/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.122 src/sys/dev/ata/ata.c:1.123
--- src/sys/dev/ata/ata.c:1.122	Thu Jul 26 20:49:47 2012
+++ src/sys/dev/ata/ata.c	Sun Jul 29 21:10:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.122 2012/07/26 20:49:47 jakllsch Exp $	*/
+/*	$NetBSD: ata.c,v 1.123 2012/07/29 21:10:50 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ata.c,v 1.122 2012/07/26 20:49:47 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ata.c,v 1.123 2012/07/29 21:10:50 jakllsch Exp $);
 
 #include opt_ata.h
 
@@ -307,9 +307,10 @@ atabusconfig_thread(void *arg)
 		adev.adev_channel = chp-ch_channel;
 		adev.adev_openings = 1;
 		adev.adev_drv_data = chp-ch_drive[i];
-		chp-ata_drives[i] = config_found_ia(atabus_sc-sc_dev,
+		KASSERT(chp-ch_drive[i].drv_softc == NULL);
+		chp-ch_drive[i].drv_softc = config_found_ia(atabus_sc-sc_dev,
 		ata_hl, adev, ataprint);
-		if (chp-ata_drives[i] != NULL)
+		if (chp-ch_drive[i].drv_softc != NULL)
 			ata_probe_caps(chp-ch_drive[i]);
 		else {
 			s = splbio();
@@ -325,10 +326,15 @@ atabusconfig_thread(void *arg)
 		ata_print_modes(chp);
 	}
 #if NATARAID  0
-	if (atac-atac_cap  ATAC_CAP_RAID)
-		for (i = 0; i  chp-ch_ndrive; i++)
-			if (chp-ata_drives[i] != NULL)
-ata_raid_check_component(chp-ata_drives[i]);
+	if (atac-atac_cap  ATAC_CAP_RAID) {
+		for (i = 0; i  chp-ch_ndrive; i++) {
+			if ((chp-ch_drive[i].drv_softc != NULL) 
+			(chp-ch_drive[i].drive_flags  DRIVE_ATA)) {
+ata_raid_check_component(
+chp-ch_drive[i].drv_softc);
+			}
+		}
+	}
 #endif /* NATARAID  0 */
 
 	/*
@@ -528,16 +534,15 @@ atabus_detach(device_t self, int flags)
 	for (i = 0; i  chp-ch_ndrive; i++) {
 		if (chp-ch_drive[i].drive_flags  DRIVE_ATAPI)
 			continue;
-		if ((dev = chp-ata_drives[i]) != NULL) {
+		if ((dev = chp-ch_drive[i].drv_softc) != NULL) {
 			ATADEBUG_PRINT((%s.%d: %s: detaching %s\n, __func__,
 			__LINE__, device_xname(self), device_xname(dev)),
 			DEBUG_DETACH);
-			KASSERT(chp-ch_drive[i].drv_softc ==
-			chp-ata_drives[i]);
 			error = config_detach(dev, flags);
 			if (error)
 goto out;
-			KASSERT(chp-ata_drives[i] == NULL);
+			KASSERT(chp-ch_drive[i].drv_softc == NULL);
+			KASSERT((chp-ch_drive[i].drive_flags  DRIVE) == 0);
 		}
 	}
 
@@ -574,10 +579,7 @@ atabus_childdetached(device_t self, devi
 	for (i = 0; i  chp-ch_ndrive; i++) {
 		if (chp-ch_drive[i].drive_flags  DRIVE_ATAPI)
 			continue;
-		if (child == chp-ata_drives[i]) {
-			KASSERT(chp-ata_drives[i] ==
-			chp-ch_drive[i].drv_softc);
-			chp-ata_drives[i] = NULL;
+		if (child == chp-ch_drive[i].drv_softc) {
 			chp-ch_drive[i].drv_softc = NULL;
 			chp-ch_drive[i].drive_flags = 0;
 			found = true;
@@ -1580,7 +1582,7 @@ atabus_rescan(device_t self, const char 
 	}
 
 	for (i = 0; i  ATA_MAXDRIVES; i++) {
-		if (chp-ata_drives[i] != NULL) {
+		if (chp-ch_drive[i].drv_softc != NULL) {
 			return EBUSY;
 		}
 	}

Index: src/sys/dev/ata/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.88 src/sys/dev/ata/atavar.h:1.89
--- src/sys/dev/ata/atavar.h:1.88	Thu Jul 26 20:49:47 2012
+++ src/sys/dev/ata/atavar.h	Sun Jul 29 21:10:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: atavar.h,v 1.88 2012/07/26 20:49:47 jakllsch Exp $	*/
+/*	$NetBSD: atavar.h,v 1.89 2012/07/29 21:10:50 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -356,9 +356,6 @@ struct ata_channel {
 	device_t atapibus;
 	struct scsipi_channel ch_atapi_channel;
 
-	/* ATA children */
-	device_t ata_drives[ATA_MAXDRIVES];
-
 	/*
 	 * Channel queues.  May be the same for all channels, if hw
 	 * channels are not independent.



CVS commit: src/sys/arch/evbppc/mpc85xx

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 29 21:36:27 UTC 2012

Modified Files:
src/sys/arch/evbppc/mpc85xx: mpc85xx_start.S

Log Message:
Make sure r8 isn't used.
Document args passed by uboot


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.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/evbppc/mpc85xx/mpc85xx_start.S
diff -u src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.5 src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.6
--- src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S:1.5	Sat Jun 18 06:37:38 2011
+++ src/sys/arch/evbppc/mpc85xx/mpc85xx_start.S	Sun Jul 29 21:36:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpc85xx_start.S,v 1.5 2011/06/18 06:37:38 matt Exp $	*/
+/*	$NetBSD: mpc85xx_start.S,v 1.6 2012/07/29 21:36:27 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #include sys/cdefs.h
 #include powerpc/asm.h
 
-RCSID($NetBSD: mpc85xx_start.S,v 1.5 2011/06/18 06:37:38 matt Exp $)
+RCSID($NetBSD: mpc85xx_start.S,v 1.6 2012/07/29 21:36:27 matt Exp $)
 
 #include opt_altivec.h
 #include opt_ddb.h
@@ -78,10 +78,10 @@ __start:
 /*
  * Startup entry.  Note, this must be the first thing in the text segment!
  */
-	mr	%r8,%r6
-	mr	%r7,%r5
-	mr	%r6,%r4
-	mr	%r5,%r3
+	mr	%r8,%r6		/* cmdline (char *) */
+	mr	%r7,%r5		/* consdev (char *) */
+	mr	%r6,%r4		/* os_hdr * */
+	mr	%r5,%r3		/* board info * */
 #ifdef DEBUG
 	/*
 	 * Set all the registers we don't care about to a known junk value.
@@ -231,11 +231,11 @@ __start:
 	/*
 	 * Force all dirty lines in the kernel area to memory.
 	 */
-	lis	%r8,kernel_text@ha
-	addi	%r8,%r8,kernel_text@l
-4:	dcbst	%r0,%r8
-	addi	%r8,%r8,32
-	cmplw	%r8,%r4
+	lis	%r9,kernel_text@ha
+	addi	%r9,%r9,kernel_text@l
+4:	dcbst	%r0,%r9
+	addi	%r9,%r9,32
+	cmplw	%r9,%r4
 	blt	%cr0,4b
 	mbar	1
 	msync



CVS commit: src/sys/arch

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 29 21:39:43 UTC 2012

Modified Files:
src/sys/arch/evbppc/mpc85xx: autoconf.c machdep.c
src/sys/arch/powerpc/include/booke: cpuvar.h

Log Message:
Add command line processing from uboot
bootm $loadaddr [opts] [device]
where opts is -[advqs] and device is the boot device.
cpu_rootconf will now wait a bit for devices to appear until the boot device
appears.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbppc/mpc85xx/autoconf.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbppc/mpc85xx/machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/booke/cpuvar.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/evbppc/mpc85xx/autoconf.c
diff -u src/sys/arch/evbppc/mpc85xx/autoconf.c:1.6 src/sys/arch/evbppc/mpc85xx/autoconf.c:1.7
--- src/sys/arch/evbppc/mpc85xx/autoconf.c:1.6	Sun Jul 29 18:05:42 2012
+++ src/sys/arch/evbppc/mpc85xx/autoconf.c	Sun Jul 29 21:39:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.6 2012/07/29 18:05:42 mlelstv Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.7 2012/07/29 21:39:43 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.6 2012/07/29 18:05:42 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.7 2012/07/29 21:39:43 matt Exp $);
 
 #define __INTR_PRIVATE
 
@@ -43,11 +43,12 @@ __KERNEL_RCSID(0, $NetBSD: autoconf.c,v
 
 #include sys/param.h
 #include sys/conf.h
+#include sys/cpu.h
 #include sys/device.h
 #include sys/intr.h
+#include sys/kernel.h
+#include sys/proc.h
 #include sys/systm.h
-#include sys/bus.h
-#include sys/cpu.h
 
 #include powerpc/booke/cpuvar.h
 
@@ -67,6 +68,8 @@ cpu_configure(void)
 	spl0();
 }
 
+static volatile int rootconf_timo = 1;
+
 /*
  * Setup root device.
  * Configure swap area.
@@ -74,6 +77,23 @@ cpu_configure(void)
 void
 cpu_rootconf(void)
 {
+	/*
+	 * We wait up to 10 seconds for a bootable device to be found.
+	 */
+	while (rootconf_timo--  0) {
+		if (booted_device != NULL) {
+			aprint_normal_dev(booted_device, boot device\n);
+			break;
+		}
+
+		if (root_string[0] != '\0'
+		 (booted_device = device_find_by_xname(root_string)) != NULL) {
+			aprint_normal_dev(booted_device, boot device\n);
+			break;
+		}
+
+		kpause(autoconf, true, 1, NULL);
+	}
 
 	rootconf();
 }
@@ -83,6 +103,16 @@ device_register(device_t dev, void *aux)
 {
 	if (cpu_md_ops.md_device_register != NULL)
 		(*cpu_md_ops.md_device_register)(dev, aux);
+
+	if (booted_device == NULL) {
+		if (root_string[0] != '\0'
+		 !strcmp(device_xname(dev), root_string)) {
+			aprint_normal_dev(dev, boot device\n);
+			booted_device = dev;
+		} else {
+			rootconf_timo = 5 * hz;
+		}
+	}
 }
 
 static bool mainbus_found;

Index: src/sys/arch/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.28 src/sys/arch/evbppc/mpc85xx/machdep.c:1.29
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.28	Sun Jul 22 23:46:10 2012
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Sun Jul 29 21:39:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.28 2012/07/22 23:46:10 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.29 2012/07/29 21:39:43 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -59,7 +59,7 @@ __KERNEL_RCSID(0, $NetSBD$);
 #include sys/bitops.h
 #include sys/bus.h
 #include sys/extent.h
-#include sys/malloc.h
+#include sys/reboot.h
 #include sys/module.h
 
 #include uvm/uvm_extern.h
@@ -114,12 +114,14 @@ struct uboot_bdinfo {
 /*4e*/	uint16_t bd_pad;
 };
 
+char root_string[16];
+
 /*
  * booke kernels need to set module_machine to this for modules to work.
  */
 char module_machine_booke[] = powerpc-booke;
 
-void	initppc(vaddr_t, vaddr_t, void *, void *, void *, void *);
+void	initppc(vaddr_t, vaddr_t, void *, void *, char *, char *);
 
 #define	MEMREGIONS	4
 phys_ram_seg_t physmemr[MEMREGIONS];		/* All memory */
@@ -1045,9 +1047,45 @@ calltozero(void)
 	panic(call to 0 from %p, __builtin_return_address(0));
 }
 
+static void
+parse_cmdline(char *cp)
+{
+	int ourhowto = 0;
+	char c;
+	bool opt = false;
+	for (; (c = *cp) != '\0'; cp++) {
+		if (c == '-') {	
+			opt = true;
+			continue;
+		}
+		if (c == ' ') {
+			opt = false;
+			continue;
+		}
+		if (opt) {
+			switch (c) {
+			case 'a': ourhowto |= RB_ASKNAME; break;
+			case 'd': ourhowto |= AB_DEBUG; break;
+			case 'q': ourhowto |= AB_QUIET; break;
+			case 's': ourhowto |= RB_SINGLE; break;
+			case 'v': ourhowto |= AB_VERBOSE; break;
+			}
+			continue;
+		}
+		strlcpy(root_string, cp, sizeof(root_string));
+		break;
+	}
+	if (ourhowto) {
+		boothowto |= ourhowto;
+		printf( boothowto=%#x(%#x), boothowto, ourhowto);
+	}
+	if (root_string[0])
+		printf( root=%s, root_string);
+}
+
 void
 initppc(vaddr_t startkernel, vaddr_t 

CVS commit: src/sys/dev/pci

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 29 23:14:13 UTC 2012

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

Log Message:
Add FORCE_DMA quirk for 5U822 (already in lace for 5C822).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/sdhc_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/dev/pci/sdhc_pci.c
diff -u src/sys/dev/pci/sdhc_pci.c:1.8 src/sys/dev/pci/sdhc_pci.c:1.9
--- src/sys/dev/pci/sdhc_pci.c:1.8	Thu Jul 12 17:37:24 2012
+++ src/sys/dev/pci/sdhc_pci.c	Sun Jul 29 23:14:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_pci.c,v 1.8 2012/07/12 17:37:24 jakllsch Exp $	*/
+/*	$NetBSD: sdhc_pci.c,v 1.9 2012/07/29 23:14:13 matt Exp $	*/
 /*	$OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sdhc_pci.c,v 1.8 2012/07/12 17:37:24 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: sdhc_pci.c,v 1.9 2012/07/29 23:14:13 matt Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_sdmmc.h
@@ -128,6 +128,15 @@ static const struct sdhc_pci_quirk {
 		~0,
 		SDHC_PCI_QUIRK_FORCE_DMA
 	},
+
+	{
+		PCI_VENDOR_RICOH,
+		PCI_PRODUCT_RICOH_Rx5U822,
+		0x,
+		0x,
+		~0,
+		SDHC_PCI_QUIRK_FORCE_DMA
+	},
 };
 
 static void sdhc_pci_quirk_ti_hack(struct pci_attach_args *);



CVS commit: src/sbin/gpt

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 30 00:53:59 UTC 2012

Modified Files:
src/sbin/gpt: gpt.c

Log Message:
Fix a few straggling BE/LE problems.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/gpt/gpt.c

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

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.16 src/sbin/gpt/gpt.c:1.17
--- src/sbin/gpt/gpt.c:1.16	Wed Jul 25 01:07:49 2012
+++ src/sbin/gpt/gpt.c	Mon Jul 30 00:53:59 2012
@@ -31,7 +31,7 @@
 __FBSDID($FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $);
 #endif
 #ifdef __RCSID
-__RCSID($NetBSD: gpt.c,v 1.16 2012/07/25 01:07:49 matt Exp $);
+__RCSID($NetBSD: gpt.c,v 1.17 2012/07/30 00:53:59 matt Exp $);
 #endif
 
 #include sys/param.h
@@ -196,7 +196,7 @@ utf8_to_utf16(const uint8_t *s8, uint16_
 			/* Initial characters. */
 			if (utfbytes != 0) {
 /* Incomplete encoding. */
-s16[s16idx++] = 0xfffd;
+s16[s16idx++] = htole16(0xfffd);
 if (s16idx == s16len) {
 	s16[--s16idx] = 0;
 	return;
@@ -225,7 +225,7 @@ utf8_to_utf16(const uint8_t *s8, uint16_
 		}
 		if (utfbytes == 0) {
 			if (utfchar = 0x1  s16idx + 2 = s16len)
-utfchar = htole16(0xfffd);
+utfchar = 0xfffd;
 			if (utfchar = 0x1) {
 s16[s16idx++] =
 htole16(0xd800 | ((utfchar10)-0x40));



CVS commit: src/sys/dev/sdmmc

2012-07-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 30 00:56:01 UTC 2012

Modified Files:
src/sys/dev/sdmmc: sdhc.c

Log Message:
Make PIO on normal SDHC devices work correctly on big-endian machines.
Add locking around interrupt manipulation (it should now be MP safe).


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sdmmc/sdhc.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/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.28 src/sys/dev/sdmmc/sdhc.c:1.29
--- src/sys/dev/sdmmc/sdhc.c:1.28	Sat Jul 28 23:02:57 2012
+++ src/sys/dev/sdmmc/sdhc.c	Mon Jul 30 00:56:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.28 2012/07/28 23:02:57 matt Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.29 2012/07/30 00:56:01 matt Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sdhc.c,v 1.28 2012/07/28 23:02:57 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: sdhc.c,v 1.29 2012/07/30 00:56:01 matt Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_sdmmc.h
@@ -336,7 +336,7 @@ sdhc_host_found(struct sdhc_softc *sc, b
 	 * capabilities. (2.2.15)
 	 */
 	HWRITE1(hp, SDHC_TIMEOUT_CTL, SDHC_TIMEOUT_MAX);
-#if 0
+#if 1
 	if (ISSET(hp-sc-sc_flags, SDHC_FLAG_ENHANCED))
 		HWRITE4(hp, SDHC_NINTR_STATUS, SDHC_CMD_TIMEOUT_ERROR  16);
 #endif
@@ -552,12 +552,13 @@ sdhc_host_reset1(sdmmc_chipset_handle_t 
 
 	/* Set data timeout counter value to max for now. */
 	HWRITE1(hp, SDHC_TIMEOUT_CTL, SDHC_TIMEOUT_MAX);
-#if 0
+#if 1
 	if (ISSET(hp-sc-sc_flags, SDHC_FLAG_ENHANCED))
 		HWRITE4(hp, SDHC_NINTR_STATUS, SDHC_CMD_TIMEOUT_ERROR  16);
 #endif
 
 	/* Enable interrupts. */
+	mutex_enter(hp-intr_mtx);
 	sdhcimask = SDHC_CARD_REMOVAL | SDHC_CARD_INSERTION |
 	SDHC_BUFFER_READ_READY | SDHC_BUFFER_WRITE_READY |
 	SDHC_DMA_INTERRUPT | SDHC_BLOCK_GAP_EVENT |
@@ -576,6 +577,7 @@ sdhc_host_reset1(sdmmc_chipset_handle_t 
 		HWRITE2(hp, SDHC_NINTR_SIGNAL_EN, sdhcimask);
 		HWRITE2(hp, SDHC_EINTR_SIGNAL_EN, SDHC_EINTR_SIGNAL_MASK);
 	}
+	mutex_exit(hp-intr_mtx);
 
 out:
 	return error;
@@ -936,7 +938,7 @@ sdhc_card_enable_intr(sdmmc_chipset_hand
 	struct sdhc_host *hp = (struct sdhc_host *)sch;
 
 	if (!ISSET(hp-sc-sc_flags, SDHC_FLAG_ENHANCED)) {
-		mutex_enter(hp-host_mtx);
+		mutex_enter(hp-intr_mtx);
 		if (enable) {
 			HSET2(hp, SDHC_NINTR_STATUS_EN, SDHC_CARD_INTERRUPT);
 			HSET2(hp, SDHC_NINTR_SIGNAL_EN, SDHC_CARD_INTERRUPT);
@@ -944,7 +946,7 @@ sdhc_card_enable_intr(sdmmc_chipset_hand
 			HCLR2(hp, SDHC_NINTR_SIGNAL_EN, SDHC_CARD_INTERRUPT);
 			HCLR2(hp, SDHC_NINTR_STATUS_EN, SDHC_CARD_INTERRUPT);
 		}
-		mutex_exit(hp-host_mtx);
+		mutex_exit(hp-intr_mtx);
 	}
 }
 
@@ -954,9 +956,9 @@ sdhc_card_intr_ack(sdmmc_chipset_handle_
 	struct sdhc_host *hp = (struct sdhc_host *)sch;
 
 	if (!ISSET(hp-sc-sc_flags, SDHC_FLAG_ENHANCED)) {
-		mutex_enter(hp-host_mtx);
+		mutex_enter(hp-intr_mtx);
 		HSET2(hp, SDHC_NINTR_STATUS_EN, SDHC_CARD_INTERRUPT);
-		mutex_exit(hp-host_mtx);
+		mutex_exit(hp-intr_mtx);
 	}
 }
 
@@ -984,6 +986,7 @@ sdhc_exec_command(sdmmc_chipset_handle_t
 
 	if (cmd-c_data  ISSET(hp-sc-sc_flags, SDHC_FLAG_ENHANCED)) {
 		const uint16_t ready = SDHC_BUFFER_READ_READY | SDHC_BUFFER_WRITE_READY;
+		mutex_enter(hp-intr_mtx);
 		if (ISSET(hp-flags, SHF_USE_DMA)) {
 			HCLR2(hp, SDHC_NINTR_SIGNAL_EN, ready);
 			HCLR2(hp, SDHC_NINTR_STATUS_EN, ready);
@@ -991,6 +994,7 @@ sdhc_exec_command(sdmmc_chipset_handle_t
 			HSET2(hp, SDHC_NINTR_SIGNAL_EN, ready);
 			HSET2(hp, SDHC_NINTR_STATUS_EN, ready);
 		}  
+		mutex_exit(hp-intr_mtx);
 	}
 
 	/*
@@ -1284,11 +1288,13 @@ sdhc_transfer_data_pio(struct sdhc_host 
 
 	while (datalen  0) {
 		if (!ISSET(HREAD4(hp, SDHC_PRESENT_STATE), imask)) {
+			mutex_enter(hp-intr_mtx);
 			if (ISSET(hp-sc-sc_flags, SDHC_FLAG_32BIT_ACCESS)) {
 HSET4(hp, SDHC_NINTR_SIGNAL_EN, imask);
 			} else {
 HSET2(hp, SDHC_NINTR_SIGNAL_EN, imask);
 			}
+			mutex_exit(hp-intr_mtx);
 			if (!sdhc_wait_intr(hp, imask, SDHC_BUFFER_TIMEOUT)) {
 error = ETIMEDOUT;
 break;
@@ -1321,12 +1327,12 @@ sdhc_read_data_pio(struct sdhc_host *hp,
 
 	if (((__uintptr_t)data  3) == 0) {
 		while (datalen  3) {
-			*(uint32_t *)data = HREAD4(hp, SDHC_DATA);
+			*(uint32_t *)data = le32toh(HREAD4(hp, SDHC_DATA));
 			data += 4;
 			datalen -= 4;
 		}
 		if (datalen  1) {
-			*(uint16_t *)data = HREAD2(hp, SDHC_DATA);
+			*(uint16_t *)data = le16toh(HREAD2(hp, SDHC_DATA));
 			data += 2;
 			datalen -= 2;
 		}
@@ -1337,7 +1343,7 @@ sdhc_read_data_pio(struct sdhc_host *hp,
 		}
 	} else if (((__uintptr_t)data  1) == 0) {
 		while (datalen  1) {
-			*(uint16_t *)data = HREAD2(hp, SDHC_DATA);
+			*(uint16_t *)data = le16toh(HREAD2(hp, SDHC_DATA));
 			data += 2;
 			datalen -= 2;
 		}
@@ -1361,12 +1367,12 @@ sdhc_write_data_pio(struct sdhc_host *hp
 
 	if (((__uintptr_t)data  3) == 0) {
 		while