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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec 29 03:16:07 UTC 2014

Modified Files:
src/sys/arch/evbarm/rockchip: rockchip_machdep.c

Log Message:
MAX_BOOT_STRING is not large enough for noisy Rockchip U-Boot; bump bootargs to 
1024 bytes


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/rockchip/rockchip_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/evbarm/rockchip/rockchip_machdep.c
diff -u src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.10 src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.11
--- src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.10	Sun Dec 28 21:34:33 2014
+++ src/sys/arch/evbarm/rockchip/rockchip_machdep.c	Mon Dec 29 03:16:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rockchip_machdep.c,v 1.10 2014/12/28 21:34:33 jmcneill Exp $ */
+/*	$NetBSD: rockchip_machdep.c,v 1.11 2014/12/29 03:16:07 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.10 2014/12/28 21:34:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.11 2014/12/29 03:16:07 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -206,8 +206,17 @@ __KERNEL_RCSID(0, "$NetBSD: rockchip_mac
 
 #include 
 
+/*
+ * ATAG cmdline length can be up to UINT32_MAX - 4, but Rockchip RK3188
+ * U-Boot limits this to 64KB. This is excessive for NetBSD, so only look at
+ * the first KB.
+ */
+#ifndef ROCKCHIP_MAX_BOOT_STRING
+#define ROCKCHIP_MAX_BOOT_STRING 1024
+#endif
+
 BootConfig bootconfig;		/* Boot config storage */
-static char bootargs[MAX_BOOT_STRING];
+static char bootargs[ROCKCHIP_MAX_BOOT_STRING];
 char *boot_args = NULL;
 char *boot_file = NULL;
 #if 0
@@ -725,6 +734,7 @@ rockchip_device_register(device_t self, 
 	if (device_is_a(self, "a9tmr") || device_is_a(self, "a9wdt")) {
 prop_dictionary_set_uint32(dict, "frequency",
 		rockchip_a9periph_get_rate());
+
 		return;
 	}
 



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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 28 21:34:33 UTC 2014

Modified Files:
src/sys/arch/evbarm/rockchip: rockchip_machdep.c rockchip_start.S

Log Message:
Copy cmdline from U-Boot to bootargs.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/rockchip/rockchip_machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/rockchip/rockchip_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/evbarm/rockchip/rockchip_machdep.c
diff -u src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.9 src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.10
--- src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.9	Sun Dec 28 16:03:51 2014
+++ src/sys/arch/evbarm/rockchip/rockchip_machdep.c	Sun Dec 28 21:34:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rockchip_machdep.c,v 1.9 2014/12/28 16:03:51 jmcneill Exp $ */
+/*	$NetBSD: rockchip_machdep.c,v 1.10 2014/12/28 21:34:33 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.9 2014/12/28 16:03:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.10 2014/12/28 21:34:33 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -395,6 +395,49 @@ rockchip_get_memsize(void)
 	return memsize;
 }
 
+#define ATAG_NONE	0x
+#define ATAG_CORE	0x54410001
+#define ATAG_CMDLINE	0x54410009
+
+static void
+rockchip_parse_atag(u_int atag_base)
+{
+	uint32_t *p = (uint32_t *)atag_base;
+	int count;
+
+	/* List must start with ATAG_CORE */
+	if (p[0] != 5 || p[1] != ATAG_CORE) {
+		return;
+	}
+
+	for (count = 0; count < 100; count++) {
+		uint32_t size = p[0];
+		uint32_t tag = p[1];
+
+#ifdef VERBOSE_INIT_ARM
+		printf("ATAG: #%d - tag %#x size %d\n",
+		count, tag, size);
+#endif
+
+		if (tag == ATAG_NONE)
+			break;
+
+		switch (tag) {
+		case ATAG_CMDLINE:
+			strlcpy(bootargs, (char *)&p[2], sizeof(bootargs));
+#ifdef VERBOSE_INIT_ARM
+			printf("ATAG_CMDLINE: \"%s\"\n", bootargs);
+#endif
+			break;
+		}
+
+		p += size;
+
+		if (++count == 100)
+			break;
+	}
+}
+
 /*
  * u_int initarm(...)
  *
@@ -525,12 +568,13 @@ initarm(void *arg)
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap,
 	mapallmem_p);
 
-#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
-	/* "bootargs" env variable is passed as 4th argument to kernel */
-	if (uboot_args[3] - 0x8000 < ram_size) {
-		strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs));
+	if (mapallmem_p) {
+		/* "bootargs" atag start is passed as 3rd argument to kernel */
+		if (uboot_args[2] - 0x6000 < ram_size) {
+			rockchip_parse_atag(uboot_args[2] + KERNEL_BASE_VOFFSET);
+		}
 	}
-#endif
+
 	boot_args = bootargs;
 	parse_mi_bootargs(boot_args);
 

Index: src/sys/arch/evbarm/rockchip/rockchip_start.S
diff -u src/sys/arch/evbarm/rockchip/rockchip_start.S:1.2 src/sys/arch/evbarm/rockchip/rockchip_start.S:1.3
--- src/sys/arch/evbarm/rockchip/rockchip_start.S:1.2	Sun Dec 28 16:03:51 2014
+++ src/sys/arch/evbarm/rockchip/rockchip_start.S	Sun Dec 28 21:34:33 2014
@@ -43,7 +43,7 @@
 
 #include 
 
-RCSID("$NetBSD: rockchip_start.S,v 1.2 2014/12/28 16:03:51 jmcneill Exp $")
+RCSID("$NetBSD: rockchip_start.S,v 1.3 2014/12/28 21:34:33 jmcneill Exp $")
 
 #if defined(VERBOSE_INIT_ARM)
 #define	XPUTC(n)	mov r0, n; bl xputc
@@ -87,7 +87,7 @@ _C_LABEL(rockchip_start):
 
 	/* Move into supervisor mode and disable IRQs/FIQs. */
 	cpsid	if, #PSR_SVC32_MODE
-#if 0
+
 	/*
 	 * Save any arguments passed to us.
 	 */
@@ -104,7 +104,7 @@ _C_LABEL(rockchip_start):
 #endif
 
 	stmia	r4, {r0-r3}		// Save the arguments
-#endif
+
 	/*
 	 * Turn on the SMP bit
 	 */



CVS commit: [netbsd-6-0] src/doc

2014-12-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Dec 28 17:07:43 UTC 2014

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
Ticket 1223.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/CHANGES-6.0.7

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.20 src/doc/CHANGES-6.0.7:1.1.2.21
--- src/doc/CHANGES-6.0.7:1.1.2.20	Thu Dec 25 02:56:18 2014
+++ src/doc/CHANGES-6.0.7	Sun Dec 28 17:07:43 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.20 2014/12/25 02:56:18 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.21 2014/12/28 17:07:43 he Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -1955,3 +1955,8 @@ external/bsd/ntp/scripts/mkver			patch
 	Update ntp to 4.2.8.
 	[christos, ticket #1221]
 
+etc/rc.d/ntpd   1.15
+
+	The new ntpd wants to translate ntp into a port number after chroot,
+	so give it its own small copy of /etc/services in the chroot.
+	[mlelstv, ticket 1223]



CVS commit: [netbsd-6-0] src/etc/rc.d

2014-12-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Dec 28 17:07:26 UTC 2014

Modified Files:
src/etc/rc.d [netbsd-6-0]: ntpd

Log Message:
The new ntpd wants to translate ntp into a port number after chroot,
so give it its own small copy of /etc/services in the chroot.
[mlelstv, ticket 1223]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.58.1 src/etc/rc.d/ntpd

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/ntpd
diff -u src/etc/rc.d/ntpd:1.13 src/etc/rc.d/ntpd:1.13.58.1
--- src/etc/rc.d/ntpd:1.13	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/ntpd	Sun Dec 28 17:07:26 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ntpd,v 1.13 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: ntpd,v 1.13.58.1 2014/12/28 17:07:26 he Exp $
 #
 
 # PROVIDE: ntpd
@@ -49,6 +49,21 @@ ntpd_precmd()
 	fi
 	ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
 
+	if [ ! -d "${ntpd_chrootdir}/etc" ]; then
+		mkdir "${ntpd_chrootdir}/etc"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/etc/services" ]; then
+		getent services ntp/udp ntp/tcp \
+			> "${ntpd_chrootdir}/etc/services"
+	fi
+	if [ ! -d "${ntpd_chrootdir}/var/db" ]; then
+		mkdir -p "${ntpd_chrootdir}/var/db"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/var/db/services.cdb" ]; then
+		services_mkdb -o "${ntpd_chrootdir}/var/db/services.cdb" \
+			"${ntpd_chrootdir}/etc/services"
+	fi
+
 	#	Change run_rc_commands()'s internal copy of $ntpd_flags
 	#
 	rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"



CVS commit: [netbsd-6-1] src/doc

2014-12-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Dec 28 17:06:36 UTC 2014

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
Ticket 1223.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/doc/CHANGES-6.1.6

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.21 src/doc/CHANGES-6.1.6:1.1.2.22
--- src/doc/CHANGES-6.1.6:1.1.2.21	Fri Dec 26 05:36:15 2014
+++ src/doc/CHANGES-6.1.6	Sun Dec 28 17:06:36 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.21 2014/12/26 05:36:15 msaitoh Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.22 2014/12/28 17:06:36 he Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -3549,3 +3549,9 @@ lib/Makefile			1.204 via patch
 
 	Update bind to 9.9.6-P1. CVE-2014-8500.
 	[spz, ticket 1217]
+
+etc/rc.d/ntpd			1.15
+
+	The new ntpd wants to translate ntp into a port number after chroot,
+	so give it its own small copy of /etc/services in the chroot.
+	[mlelstv, ticket 1223]



CVS commit: [netbsd-6-1] src/etc/rc.d

2014-12-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Dec 28 17:06:14 UTC 2014

Modified Files:
src/etc/rc.d [netbsd-6-1]: ntpd

Log Message:
The new ntpd wants to translate ntp into a port number after chroot,
so give it its own small copy of /etc/services in the chroot.
[mlelstv, ticket 1223]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.62.1 src/etc/rc.d/ntpd

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/ntpd
diff -u src/etc/rc.d/ntpd:1.13 src/etc/rc.d/ntpd:1.13.62.1
--- src/etc/rc.d/ntpd:1.13	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/ntpd	Sun Dec 28 17:06:14 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ntpd,v 1.13 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: ntpd,v 1.13.62.1 2014/12/28 17:06:14 he Exp $
 #
 
 # PROVIDE: ntpd
@@ -49,6 +49,21 @@ ntpd_precmd()
 	fi
 	ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
 
+	if [ ! -d "${ntpd_chrootdir}/etc" ]; then
+		mkdir "${ntpd_chrootdir}/etc"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/etc/services" ]; then
+		getent services ntp/udp ntp/tcp \
+			> "${ntpd_chrootdir}/etc/services"
+	fi
+	if [ ! -d "${ntpd_chrootdir}/var/db" ]; then
+		mkdir -p "${ntpd_chrootdir}/var/db"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/var/db/services.cdb" ]; then
+		services_mkdb -o "${ntpd_chrootdir}/var/db/services.cdb" \
+			"${ntpd_chrootdir}/etc/services"
+	fi
+
 	#	Change run_rc_commands()'s internal copy of $ntpd_flags
 	#
 	rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"



CVS commit: [netbsd-6] src/doc

2014-12-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Dec 28 17:03:53 UTC 2014

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket 1223.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.178 -r1.1.2.179 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.178 src/doc/CHANGES-6.2:1.1.2.179
--- src/doc/CHANGES-6.2:1.1.2.178	Fri Dec 26 07:31:42 2014
+++ src/doc/CHANGES-6.2	Sun Dec 28 17:03:52 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.178 2014/12/26 07:31:42 msaitoh Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.179 2014/12/28 17:03:52 he Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -8861,3 +8861,9 @@ external/mit/xorg/server/xorg-server/Mak
 	Fix conversion of SDK_REQUIRED_MODULES which was reported by John
 	D. Baker in PR#49500.
 	[mrg, ticket 1222]
+
+etc/rc.d/ntpd			1.15
+
+	The new ntpd wants to translate ntp into a port number after chroot,
+	so give it its own small copy of /etc/services in the chroot.
+	[mlelstv, ticket 1223]



CVS commit: [netbsd-6] src/etc/rc.d

2014-12-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Dec 28 17:03:16 UTC 2014

Modified Files:
src/etc/rc.d [netbsd-6]: ntpd

Log Message:
The new ntpd wants to translate ntp into a port number after chroot,
so give it its own small copy of /etc/services in the chroot.
[mlelstv, ticket 1223]


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.52.1 src/etc/rc.d/ntpd

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/ntpd
diff -u src/etc/rc.d/ntpd:1.13 src/etc/rc.d/ntpd:1.13.52.1
--- src/etc/rc.d/ntpd:1.13	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/ntpd	Sun Dec 28 17:03:16 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ntpd,v 1.13 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: ntpd,v 1.13.52.1 2014/12/28 17:03:16 he Exp $
 #
 
 # PROVIDE: ntpd
@@ -49,6 +49,21 @@ ntpd_precmd()
 	fi
 	ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
 
+	if [ ! -d "${ntpd_chrootdir}/etc" ]; then
+		mkdir "${ntpd_chrootdir}/etc"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/etc/services" ]; then
+		getent services ntp/udp ntp/tcp \
+			> "${ntpd_chrootdir}/etc/services"
+	fi
+	if [ ! -d "${ntpd_chrootdir}/var/db" ]; then
+		mkdir -p "${ntpd_chrootdir}/var/db"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/var/db/services.cdb" ]; then
+		services_mkdb -o "${ntpd_chrootdir}/var/db/services.cdb" \
+			"${ntpd_chrootdir}/etc/services"
+	fi
+
 	#	Change run_rc_commands()'s internal copy of $ntpd_flags
 	#
 	rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"



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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 28 16:29:21 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: mk.rockchip

Log Message:
add -mfpu=neon to CPPFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/mk.rockchip

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/mk.rockchip
diff -u src/sys/arch/evbarm/conf/mk.rockchip:1.1 src/sys/arch/evbarm/conf/mk.rockchip:1.2
--- src/sys/arch/evbarm/conf/mk.rockchip:1.1	Fri Dec 26 16:53:33 2014
+++ src/sys/arch/evbarm/conf/mk.rockchip	Sun Dec 28 16:29:21 2014
@@ -1,5 +1,5 @@
-#	$NetBSD: mk.rockchip,v 1.1 2014/12/26 16:53:33 jmcneill Exp $
-CPPFLAGS+=		-mcpu=cortex-a9
+#	$NetBSD: mk.rockchip,v 1.2 2014/12/28 16:29:21 jmcneill Exp $
+CPPFLAGS+=		-mcpu=cortex-a9 -mfpu=neon
 
 SYSTEM_FIRST_OBJ=	rockchip_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/rockchip/rockchip_start.S



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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 28 16:27:15 UTC 2014

Modified Files:
src/sys/arch/arm/rockchip: rockchip_dwcmmc.c

Log Message:
remove redundant irq print


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rockchip_dwcmmc.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/rockchip/rockchip_dwcmmc.c
diff -u src/sys/arch/arm/rockchip/rockchip_dwcmmc.c:1.2 src/sys/arch/arm/rockchip/rockchip_dwcmmc.c:1.3
--- src/sys/arch/arm/rockchip/rockchip_dwcmmc.c:1.2	Sat Dec 27 19:18:35 2014
+++ src/sys/arch/arm/rockchip/rockchip_dwcmmc.c	Sun Dec 28 16:27:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: rockchip_dwcmmc.c,v 1.2 2014/12/27 19:18:35 jmcneill Exp $ */
+/* $NetBSD: rockchip_dwcmmc.c,v 1.3 2014/12/28 16:27:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rockchip_dwcmmc.c,v 1.2 2014/12/27 19:18:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_dwcmmc.c,v 1.3 2014/12/28 16:27:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -86,7 +86,6 @@ rk_dwcmmc_attach(device_t parent, device
 		obio->obio_intr);
 		return;
 	}
-	aprint_normal_dev(self, "interrupting on irq %d\n", obio->obio_intr);
 
 	config_interrupts(self, rk_dwcmmc_attach_i);
 }



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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 28 16:04:05 UTC 2014

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

Log Message:
enable MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/ROCKCHIP

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/ROCKCHIP
diff -u src/sys/arch/evbarm/conf/ROCKCHIP:1.3 src/sys/arch/evbarm/conf/ROCKCHIP:1.4
--- src/sys/arch/evbarm/conf/ROCKCHIP:1.3	Sat Dec 27 20:28:09 2014
+++ src/sys/arch/evbarm/conf/ROCKCHIP	Sun Dec 28 16:04:05 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: ROCKCHIP,v 1.3 2014/12/27 20:28:09 jmcneill Exp $
+#	$NetBSD: ROCKCHIP,v 1.4 2014/12/28 16:04:05 jmcneill Exp $
 #
 #	Rockchip RK3066/RK3188 based SBC (Single Board Computer)
 #
@@ -156,7 +156,7 @@ mainbus0	at root
 
 # The boot cpu
 cpu*		at mainbus?
-#options 	MULTIPROCESSOR
+options 	MULTIPROCESSOR
 
 # A9 core devices
 armperiph0	at mainbus?



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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 28 16:03:51 UTC 2014

Modified Files:
src/sys/arch/evbarm/rockchip: rockchip_machdep.c rockchip_start.S

Log Message:
add MULTIPROCESSOR support


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/rockchip/rockchip_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/rockchip/rockchip_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/evbarm/rockchip/rockchip_machdep.c
diff -u src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.8 src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.9
--- src/sys/arch/evbarm/rockchip/rockchip_machdep.c:1.8	Sun Dec 28 01:51:37 2014
+++ src/sys/arch/evbarm/rockchip/rockchip_machdep.c	Sun Dec 28 16:03:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rockchip_machdep.c,v 1.8 2014/12/28 01:51:37 jmcneill Exp $ */
+/*	$NetBSD: rockchip_machdep.c,v 1.9 2014/12/28 16:03:51 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.8 2014/12/28 01:51:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.9 2014/12/28 16:03:51 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -147,6 +147,7 @@ __KERNEL_RCSID(0, "$NetBSD: rockchip_mac
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -420,6 +421,13 @@ initarm(void *arg)
 	pmap_devmap_register(devmap);
 	rockchip_bootstrap();
 
+#ifdef MULTIPROCESSOR
+	uint32_t scu_cfg = bus_space_read_4(&rockchip_bs_tag,
+	rockchip_core0_bsh, ROCKCHIP_SCU_OFFSET + SCU_CFG);
+	arm_cpu_max = (scu_cfg & SCU_CFG_CPUMAX) + 1;
+	membar_producer();
+#endif
+
 	/* Heads up ... Setup the CPU / MMU / TLB functions. */
 	if (set_cpufuncs())
 		panic("cpu not recognized!");

Index: src/sys/arch/evbarm/rockchip/rockchip_start.S
diff -u src/sys/arch/evbarm/rockchip/rockchip_start.S:1.1 src/sys/arch/evbarm/rockchip/rockchip_start.S:1.2
--- src/sys/arch/evbarm/rockchip/rockchip_start.S:1.1	Fri Dec 26 16:53:33 2014
+++ src/sys/arch/evbarm/rockchip/rockchip_start.S	Sun Dec 28 16:03:51 2014
@@ -41,7 +41,9 @@
 #include 
 #include   
 
-RCSID("$NetBSD: rockchip_start.S,v 1.1 2014/12/26 16:53:33 jmcneill Exp $")
+#include 
+
+RCSID("$NetBSD: rockchip_start.S,v 1.2 2014/12/28 16:03:51 jmcneill Exp $")
 
 #if defined(VERBOSE_INIT_ARM)
 #define	XPUTC(n)	mov r0, n; bl xputc
@@ -150,7 +152,7 @@ _C_LABEL(rockchip_start):
 	XPUTC2(#60)
 	// Make sure the cache is flushed out to RAM for the other CPUs
 	bl	_C_LABEL(armv7_dcache_wbinv_all)
-	bl	a20_mpinit
+	bl	rockchip_mpinit
 	XPUTC2(#62)
 #endif /* MULTIPROCESSOR */
 	XPUTC2(#13)
@@ -169,84 +171,110 @@ _C_LABEL(rockchip_start):
 
 #include 
 
+#define PMU_PWRDN_REG	0x0008
+#define PMU_PWRDN_SCU	__BIT(4)
+
 #if defined(MULTIPROCESSOR)
 #ifndef KERNEL_BASES_EQUAL
 	.pushsection .text,"ax",%progbits
 #endif
-a20_mpinit:
-	mov	r4, lr			// because we call gtmr_bootdelay
-	movw	r5, #:lower16:(ROCKCHIP_CORE_PBASE+ROCKCHIP_CPUCFG_OFFSET)
-	movt	r5, #:upper16:(ROCKCHIP_CORE_PBASE+ROCKCHIP_CPUCFG_OFFSET)
+rockchip_mptramp:
+	ldr	pc, 1f
+.global cortex_mpstart_vec
+cortex_mpstart_vec:
+1:	.space	4
+
+rockchip_mpinit:
+	mov	r4, lr
+	/* r5: SCU, r6: PMU, r7: SRAM */
+	movw	r5, #:lower16:(ROCKCHIP_CORE0_BASE+ROCKCHIP_SCU_OFFSET)
+	movt	r5, #:upper16:(ROCKCHIP_CORE0_BASE+ROCKCHIP_SCU_OFFSET)
+	movw	r6, #:lower16:(ROCKCHIP_CORE1_BASE+ROCKCHIP_PMU_OFFSET)
+	movt	r6, #:upper16:(ROCKCHIP_CORE1_BASE+ROCKCHIP_PMU_OFFSET)
+	movw	r7, #:lower16:(ROCKCHIP_CORE0_BASE+ROCKCHIP_SRAM_OFFSET)
+	movt	r7, #:upper16:(ROCKCHIP_CORE0_BASE+ROCKCHIP_SRAM_OFFSET)
 
 	/* Set where the other CPU(s) are going to execute */
+	XPUTC2(#118)
 	movw	r1, #:lower16:cortex_mpstart
 	movt	r1, #:upper16:cortex_mpstart
-	str	r1, [r5, #ROCKCHIP_CPUCFG_PRIVATE_REG]
-	dsb
-
-	/* Assert CPU core reset */
-	mov	r1, #0
-	str	r1, [r5, #ROCKCHIP_CPUCFG_CPU1_RST_CTRL_REG]
+	ldr	r0, =cortex_mpstart_vec
+	str	r1, [r0]
+	ldr	r0, =rockchip_mptramp
+	mov	r2, #0
+1:	ldr	r1, [r0, r2]
+	str	r1, [r7, r2]
+	add	r2, r2, #4
+	cmp	r2, #32
+	blt	1b
 	dsb
 
-	/* Ensure CPU1 reset also invalidates its L1 caches */
-	ldr	r1, [r5, #ROCKCHIP_CPUCFG_GENCTRL_REG] 
-	bic	r1, r1, #(1 << 1)
-	str	r1, [r5, #ROCKCHIP_CPUCFG_GENCTRL_REG]
+	/* Invalid SCU cache tags */
+	XPUTC2(#45)
+	movw	r1, #0x
+	movt	r1, #0
+	str	r1, [r5, #SCU_INV_ALL_REG]
+
+	/* Get CPU count */
+	ldr	r1, [r5, #SCU_CFG]
+	and	r2, r1, #SCU_CFG_CPUMAX
+	add	r2, r2, #1
+
+	/* Convert to CPU1..N mask */
+	mov	r7, #0
+	lsl	r7, r2, #1
+	sub	r7, r7, #1
+	and	r7, r7, #~1
+
+	/* Power down secondary CPUs */
+	XPUTC2(#46)
+	ldr	r1, [r6, #PMU_PWRDN_REG]
+	orr	r1, r1, r7
+	str	r1, [r6, #PMU_PWRDN_REG]
 	dsb
 
-	/* Hold DBGPWRDUP signal low */
-	ldr	r1, [r5, #ROCKCHIP_CPUCFG_DBGCTRL1_REG] 
-	bic	r1, r1, #(1 << 1)
-	str	r1, [r5, #ROCKCHIP_CPUCFG_DBGCTRL1_REG]
+	/* P

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

2014-12-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Dec 28 16:03:09 UTC 2014

Modified Files:
src/sys/arch/arm/rockchip: rockchip_reg.h

Log Message:
add SRAM, SCU, PMU offsets


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rockchip_reg.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/rockchip/rockchip_reg.h
diff -u src/sys/arch/arm/rockchip/rockchip_reg.h:1.3 src/sys/arch/arm/rockchip/rockchip_reg.h:1.4
--- src/sys/arch/arm/rockchip/rockchip_reg.h:1.3	Sun Dec 28 01:50:39 2014
+++ src/sys/arch/arm/rockchip/rockchip_reg.h	Sun Dec 28 16:03:09 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: rockchip_reg.h,v 1.3 2014/12/28 01:50:39 jmcneill Exp $ */
+/* $NetBSD: rockchip_reg.h,v 1.4 2014/12/28 16:03:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -43,6 +43,10 @@
 #define ROCKCHIP_CORE0_SIZE 0x0030
 
 /* CORE0 */
+#define ROCKCHIP_SRAM_OFFSET	0x0008
+#define ROCKCHIP_SRAM_SIZE	0x8000
+#define ROCKCHIP_SCU_OFFSET	0x0013C000
+#define ROCKCHIP_SCU_SIZE	0x100
 #define ROCKCHIP_OTG_OFFSET	0x0018
 #define ROCKCHIP_OTG_SIZE	0x4
 #define ROCKCHIP_USB_OFFSET	0x001C
@@ -69,6 +73,8 @@
 /* CORE1 */
 #define ROCKCHIP_CRU_OFFSET	0x
 #define ROCKCHIP_CRU_SIZE	0x4000
+#define ROCKCHIP_PMU_OFFSET	0x4000
+#define ROCKCHIP_PMU_SIZE	0x4000
 #define ROCKCHIP_GRF_OFFSET	0x8000
 #define ROCKCHIP_GRF_SIZE	0x2000
 #define ROCKCHIP_UART2_OFFSET	0x00064000



CVS commit: src/sys/fs/ntfs

2014-12-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 28 14:42:56 UTC 2014

Modified Files:
src/sys/fs/ntfs: ntfs_subr.c

Log Message:
Make this more readable (KNF).


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/fs/ntfs/ntfs_subr.c

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

Modified files:

Index: src/sys/fs/ntfs/ntfs_subr.c
diff -u src/sys/fs/ntfs/ntfs_subr.c:1.54 src/sys/fs/ntfs/ntfs_subr.c:1.55
--- src/sys/fs/ntfs/ntfs_subr.c:1.54	Thu Nov 13 16:51:53 2014
+++ src/sys/fs/ntfs/ntfs_subr.c	Sun Dec 28 14:42:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_subr.c,v 1.54 2014/11/13 16:51:53 hannken Exp $	*/
+/*	$NetBSD: ntfs_subr.c,v 1.55 2014/12/28 14:42:56 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko (sem...@freebsd.org)
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.54 2014/11/13 16:51:53 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.55 2014/12/28 14:42:56 maxv Exp $");
 
 #include 
 #include 
@@ -95,17 +95,12 @@ static signed int ntfs_toupper_usecount;
   (aalp->al_type == type) && (aalp->al_namelen == namelen) &&		\
   !ntfs_uastrcmp(ntmp, aalp->al_name,aalp->al_namelen,name,namelen) )
 
-/*
- *
- */
 int
-ntfs_ntvattrrele(struct ntvattr * vap)
+ntfs_ntvattrrele(struct ntvattr *vap)
 {
 	dprintf(("%s: ino: %llu, type: 0x%x\n", __func__,
 	(unsigned long long)vap->va_ip->i_number, vap->va_type));
-
 	ntfs_ntrele(vap->va_ip);
-
 	return (0);
 }
 
@@ -113,12 +108,14 @@ ntfs_ntvattrrele(struct ntvattr * vap)
  * find the attribute in the ntnode
  */
 static int
-ntfs_findvattr(struct ntfsmount *ntmp, struct ntnode *ip, struct ntvattr **lvapp, struct ntvattr **vapp, u_int32_t type, const char *name, size_t namelen, cn_t vcn)
+ntfs_findvattr(struct ntfsmount *ntmp, struct ntnode *ip, struct ntvattr **lvapp,
+struct ntvattr **vapp, u_int32_t type, const char *name, size_t namelen,
+cn_t vcn)
 {
 	int error;
 	struct ntvattr *vap;
 
-	if((ip->i_flag & IN_LOADED) == 0) {
+	if ((ip->i_flag & IN_LOADED) == 0) {
 		dprintf(("%s: node not loaded, ino: %llu\n", __func__,
 		(unsigned long long)ip->i_number));
 		error = ntfs_loadntnode(ntmp,ip);
@@ -133,8 +130,8 @@ ntfs_findvattr(struct ntfsmount *ntmp, s
 	*vapp = NULL;
 	for (vap = ip->i_valist.lh_first; vap; vap = vap->va_list.le_next) {
 		ddprintf(("%s: type: 0x%x, vcn: %qu - %qu\n", __func__,
-			  vap->va_type, (long long) vap->va_vcnstart,
-			  (long long) vap->va_vcnend));
+		vap->va_type, (long long) vap->va_vcnstart,
+		(long long) vap->va_vcnend));
 		if ((vap->va_type == type) &&
 		(vap->va_vcnstart <= vcn) && (vap->va_vcnend >= vcn) &&
 		(vap->va_namelen == namelen) &&
@@ -158,22 +155,17 @@ ntfs_findvattr(struct ntfsmount *ntmp, s
  * ntnode should be locked
  */
 int
-ntfs_ntvattrget(
-		struct ntfsmount * ntmp,
-		struct ntnode * ip,
-		u_int32_t type,
-		const char *name,
-		cn_t vcn,
-		struct ntvattr ** vapp)
+ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type,
+const char *name, cn_t vcn, struct ntvattr **vapp)
 {
 	struct ntvattr *lvap = NULL;
 	struct attr_attrlist *aalp;
 	struct attr_attrlist *nextaalp;
-	struct vnode   *newvp;
-	struct ntnode  *newip;
-	void *alpool;
-	size_t		namelen, len;
-	int error;
+	struct vnode *newvp;
+	struct ntnode *newip;
+	void *alpool;
+	size_t namelen, len;
+	int error;
 
 	*vapp = NULL;
 
@@ -211,7 +203,7 @@ ntfs_ntvattrget(
 	aalp = (struct attr_attrlist *) alpool;
 	nextaalp = NULL;
 
-	for(; len > 0; aalp = nextaalp) {
+	for (; len > 0; aalp = nextaalp) {
 		KASSERT(aalp != NULL);
 		dprintf(("%s: attrlist: ino: %d, attr: 0x%x, vcn: %qu\n",
 		__func__, aalp->al_inumber, aalp->al_type,
@@ -236,7 +228,7 @@ ntfs_ntvattrget(
 NTFS_A_DATA, "", LK_EXCLUSIVE, &newvp);
 		if (error) {
 			printf("%s: CAN'T VGET INO: %d\n", __func__,
-			   aalp->al_inumber);
+			aalp->al_inumber);
 			goto out;
 		}
 		newip = VTONT(newvp);
@@ -266,13 +258,11 @@ out:
  * ntnode should be locked
  */
 int
-ntfs_loadntnode(
-	  struct ntfsmount * ntmp,
-	  struct ntnode * ip)
-{
-	struct filerec  *mfrp;
-	int		error,off;
-	struct attr*ap;
+ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip)
+{
+	struct filerec *mfrp;
+	int error, off;
+	struct attr *ap;
 	struct ntvattr *nvap;
 
 	dprintf(("%s: loading ino: %llu\n", __func__,
@@ -281,9 +271,9 @@ ntfs_loadntnode(
 	mfrp = malloc(ntfs_bntob(ntmp->ntm_bpmftrec), M_TEMP, M_WAITOK);
 
 	if (ip->i_number < NTFS_SYSNODESNUM) {
-		struct buf *bp;
-		daddr_t bn;
-		off_t   boff;
+		struct buf *bp;
+		daddr_t bn;
+		off_t boff;
 
 		dprintf(("%s: read system node\n", __func__));
 
@@ -297,7 +287,7 @@ ntfs_loadntnode(
 		off = ntfs_btocnoff(boff);
 
 		error = bread(ntmp->ntm_devvp, bn, ntfs_cntob(1),
-			  NOCRED, 0, &bp);
+		NOCRED, 0, &bp);
 		if (error) {
 			printf("%s: BR

CVS commit: src/sys/arch/powerpc/booke

2014-12-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sun Dec 28 14:13:56 UTC 2014

Modified Files:
src/sys/arch/powerpc/booke: e500_tlb.c

Log Message:
include "opt_ppcparam.h" for VERBOSE_INITPPC.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/booke/e500_tlb.c

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

Modified files:

Index: src/sys/arch/powerpc/booke/e500_tlb.c
diff -u src/sys/arch/powerpc/booke/e500_tlb.c:1.14 src/sys/arch/powerpc/booke/e500_tlb.c:1.15
--- src/sys/arch/powerpc/booke/e500_tlb.c:1.14	Fri Dec 26 11:13:05 2014
+++ src/sys/arch/powerpc/booke/e500_tlb.c	Sun Dec 28 14:13:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500_tlb.c,v 1.14 2014/12/26 11:13:05 nonaka Exp $	*/
+/*	$NetBSD: e500_tlb.c,v 1.15 2014/12/28 14:13:56 nonaka Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,11 +34,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_ppcparam.h"
+
 #define	__PMAP_PRIVATE
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.14 2014/12/26 11:13:05 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.15 2014/12/28 14:13:56 nonaka Exp $");
 
 #include 
 
@@ -841,6 +843,7 @@ e500_tlbmemmap(paddr_t memstart, psize_t
 
 	return nextslot;
 }
+
 static const struct tlb_md_ops e500_tlb_ops = {
 	.md_tlb_get_asid = e500_tlb_get_asid,
 	.md_tlb_set_asid = e500_tlb_set_asid,



CVS commit: src/sys/fs/ntfs

2014-12-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 28 13:11:52 UTC 2014

Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c

Log Message:
Prevent another division by zero in ntfs_loadntnode() by ensuring
spc != 0.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/fs/ntfs/ntfs_vfsops.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/fs/ntfs/ntfs_vfsops.c
diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.99 src/sys/fs/ntfs/ntfs_vfsops.c:1.100
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.99	Sun Dec 28 12:57:44 2014
+++ src/sys/fs/ntfs/ntfs_vfsops.c	Sun Dec 28 13:11:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $	*/
+/*	$NetBSD: ntfs_vfsops.c,v 1.100 2014/12/28 13:11:52 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.100 2014/12/28 13:11:52 maxv Exp $");
 
 #include 
 #include 
@@ -335,6 +335,11 @@ ntfs_mountfs(struct vnode *devvp, struct
 		dprintf(("ntfs_mountfs: invalid bytes per sector\n"));
 		goto out;
 	}
+	if (ntmp->ntm_spc == 0) {
+		error = EINVAL;
+		dprintf(("ntfs_mountfs: invalid sectors per cluster\n"));
+		goto out;
+	}
 
 	{
 		int8_t cpr = ntmp->ntm_mftrecsz;



CVS commit: src/sys/fs/ntfs

2014-12-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 28 12:57:44 UTC 2014

Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c

Log Message:
Ensure bps != 0 to prevent a division by zero. Zero byte per sector makes
no sense.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/fs/ntfs/ntfs_vfsops.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/fs/ntfs/ntfs_vfsops.c
diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.98 src/sys/fs/ntfs/ntfs_vfsops.c:1.99
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.98	Sun Dec 28 12:13:22 2014
+++ src/sys/fs/ntfs/ntfs_vfsops.c	Sun Dec 28 12:57:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_vfsops.c,v 1.98 2014/12/28 12:13:22 maxv Exp $	*/
+/*	$NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.98 2014/12/28 12:13:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $");
 
 #include 
 #include 
@@ -324,11 +324,17 @@ ntfs_mountfs(struct vnode *devvp, struct
 	brelse(bp, 0);
 	bp = NULL;
 
+	/* Sanity checks. XXX: More checks are probably needed. */
 	if (strncmp(ntmp->ntm_bootfile.bf_sysid, NTFS_BBID, NTFS_BBIDLEN)) {
 		error = EINVAL;
 		dprintf(("ntfs_mountfs: invalid boot block\n"));
 		goto out;
 	}
+	if (ntmp->ntm_bps == 0) {
+		error = EINVAL;
+		dprintf(("ntfs_mountfs: invalid bytes per sector\n"));
+		goto out;
+	}
 
 	{
 		int8_t cpr = ntmp->ntm_mftrecsz;



CVS commit: src/sys/fs/ntfs

2014-12-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 28 12:19:21 UTC 2014

Modified Files:
src/sys/fs/ntfs: ntfs.h

Log Message:
Two typos:
 - reserver4 -> reserved4 (in struct bootfile)
 - "inducates" -> "indicates" (comment)


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/fs/ntfs/ntfs.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/fs/ntfs/ntfs.h
diff -u src/sys/fs/ntfs/ntfs.h:1.20 src/sys/fs/ntfs/ntfs.h:1.21
--- src/sys/fs/ntfs/ntfs.h:1.20	Thu Nov 13 16:51:53 2014
+++ src/sys/fs/ntfs/ntfs.h	Sun Dec 28 12:19:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs.h,v 1.20 2014/11/13 16:51:53 hannken Exp $	*/
+/*	$NetBSD: ntfs.h,v 1.21 2014/12/28 12:19:21 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -232,12 +232,12 @@ struct bootfile {
 	u_int8_treserved3[2];
 	u_int16_t   bf_spt;		/* sectors per track */
 	u_int16_t   bf_heads;	/* number of heads */
-	u_int8_treserver4[12];
+	u_int8_treserved4[12];
 	u_int64_t   bf_spv;		/* sectors per volume */
 	cn_tbf_mftcn;	/* $MFT cluster number */
 	cn_tbf_mftmirrcn;	/* $MFTMirr cn */
 	u_int8_tbf_mftrecsz;	/* MFT record size (clust) */
-	/* 0xF6 inducates 1/4 */
+	/* 0xF6 indicates 1/4 */
 	u_int32_t   bf_ibsz;	/* index buffer size */
 	u_int32_t   bf_volsn;	/* volume ser. num. */
 };



CVS commit: src/sys/fs/ntfs

2014-12-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 28 12:13:22 UTC 2014

Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c

Log Message:
Make this more readable (KNF).


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/fs/ntfs/ntfs_vfsops.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/fs/ntfs/ntfs_vfsops.c
diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.97 src/sys/fs/ntfs/ntfs_vfsops.c:1.98
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.97	Thu Nov 13 16:51:53 2014
+++ src/sys/fs/ntfs/ntfs_vfsops.c	Sun Dec 28 12:13:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_vfsops.c,v 1.97 2014/11/13 16:51:53 hannken Exp $	*/
+/*	$NetBSD: ntfs_vfsops.c,v 1.98 2014/12/28 12:13:22 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.97 2014/11/13 16:51:53 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.98 2014/12/28 12:13:22 maxv Exp $");
 
 #include 
 #include 
@@ -79,12 +79,12 @@ static int	ntfs_mountfs(struct vnode *, 
   struct ntfs_args *, struct lwp *);
 static int	ntfs_vptofh(struct vnode *, struct fid *, size_t *);
 
-static void ntfs_init(void);
-static void ntfs_reinit(void);
-static void ntfs_done(void);
-static int  ntfs_fhtovp(struct mount *, struct fid *,
+static void	ntfs_init(void);
+static void	ntfs_reinit(void);
+static void	ntfs_done(void);
+static int	ntfs_fhtovp(struct mount *, struct fid *,
 struct vnode **);
-static int  ntfs_mountroot(void);
+static int	ntfs_mountroot(void);
 
 static const struct genfs_ops ntfs_genfsops = {
 	.gop_write = genfs_compat_gop_write,
@@ -160,11 +160,7 @@ ntfs_done(void)
 }
 
 static int
-ntfs_mount (
-	struct mount *mp,
-	const char *path,
-	void *data,
-	size_t *data_len)
+ntfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
 {
 	struct lwp *l = curlwp;
 	int		err = 0, flags;
@@ -209,10 +205,8 @@ ntfs_mount (
 	 */
 	err = namei_simple_user(args->fspec,
 NSM_FOLLOW_NOEMULROOT, &devvp);
-	if (err) {
-		/* can't get devvp!*/
+	if (err)
 		return (err);
-	}
 
 	if (devvp->v_type != VBLK) {
 		err = ENOTBLK;
@@ -325,9 +319,9 @@ ntfs_mountfs(struct vnode *devvp, struct
 	error = bread(devvp, BBLOCK, BBSIZE, NOCRED, 0, &bp);
 	if (error)
 		goto out;
-	ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK|M_ZERO);
-	memcpy( &ntmp->ntm_bootfile,  bp->b_data, sizeof(struct bootfile) );
-	brelse( bp , 0 );
+	ntmp = malloc(sizeof(*ntmp), M_NTFSMNT, M_WAITOK|M_ZERO);
+	memcpy(&ntmp->ntm_bootfile, bp->b_data, sizeof(struct bootfile));
+	brelse(bp, 0);
 	bp = NULL;
 
 	if (strncmp(ntmp->ntm_bootfile.bf_sysid, NTFS_BBID, NTFS_BBIDLEN)) {
@@ -338,7 +332,7 @@ ntfs_mountfs(struct vnode *devvp, struct
 
 	{
 		int8_t cpr = ntmp->ntm_mftrecsz;
-		if( cpr > 0 )
+		if (cpr > 0)
 			ntmp->ntm_bpmftrec = ntmp->ntm_spc * cpr;
 		else
 			ntmp->ntm_bpmftrec = (1 << (-cpr)) / ntmp->ntm_bps;
@@ -374,9 +368,9 @@ ntfs_mountfs(struct vnode *devvp, struct
 	 */
 	{
 		int pi[3] = { NTFS_MFTINO, NTFS_ROOTINO, NTFS_BITMAPINO };
-		for (i=0; i<3; i++) {
+		for (i = 0; i < 3; i++) {
 			error = VFS_VGET(mp, pi[i], &(ntmp->ntm_sysvn[pi[i]]));
-			if(error)
+			if (error)
 goto out1;
 			ntmp->ntm_sysvn[pi[i]]->v_vflag |= VV_SYSTEM;
 			vref(ntmp->ntm_sysvn[pi[i]]);
@@ -393,7 +387,7 @@ ntfs_mountfs(struct vnode *devvp, struct
 	 * Scan $BitMap and count free clusters
 	 */
 	error = ntfs_calccfree(ntmp, &ntmp->ntm_cfree);
-	if(error)
+	if (error)
 		goto out1;
 
 	/*
@@ -406,11 +400,11 @@ ntfs_mountfs(struct vnode *devvp, struct
 
 		/* Open $AttrDef */
 		error = VFS_VGET(mp, NTFS_ATTRDEFINO, &vp );
-		if(error)
+		if (error)
 			goto out1;
 
 		/* Count valid entries */
-		for(num=0;;num++) {
+		for (num = 0; ; num++) {
 			error = ntfs_readattr(ntmp, VTONT(vp),
 	NTFS_A_DATA, NULL,
 	num * sizeof(ad), sizeof(ad),
@@ -429,7 +423,7 @@ ntfs_mountfs(struct vnode *devvp, struct
 		ntmp->ntm_adnum = num;
 
 		/* Read them and translate */
-		for(i=0;intm_sysvn[i]) vrele(ntmp->ntm_sysvn[i]);
+	for (i = 0; i < NTFS_SYSNODESNUM; i++)
+		if (ntmp->ntm_sysvn[i])
+			vrele(ntmp->ntm_sysvn[i]);
 
-	if (vflush(mp,NULLVP,0)) {
+	if (vflush(mp, NULLVP, 0)) {
 		dprintf(("ntfs_mountfs: vflush failed\n"));
 	}
 out:
@@ -479,17 +474,13 @@ out:
 }
 
 static int
-ntfs_start (
-	struct mount *mp,
-	int flags)
+ntfs_start(struct mount *mp, int flags)
 {
 	return (0);
 }
 
 static int
-ntfs_unmount(
-	struct mount *mp,
-	int mntflags)
+ntfs_unmount(struct mount *mp, int mntflags)
 {
 	struct lwp *l = curlwp;
 	struct ntfsmount *ntmp;
@@ -499,27 +490,29 @@ ntfs_unmount(
 	ntmp = VFSTONTFS(mp);
 
 	flags = 0;
-	if(mntflags & MNT_FORCE)
+	if (mntflags & MNT_FORCE)
 		flags |= FORCECLOSE;
 
 	dprintf(("ntfs_unmount: vflushing...\n"));
-	error = vflush(mp,NULLVP,flags | SKIPSYSTEM);
+	error = vflush(mp, NULLVP, flags | SKIPSYSTEM);
 	if (error)

CVS commit: src/usr.sbin/sysinst

2014-12-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 28 12:05:27 UTC 2014

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
We can not rely on the existence of the "gpt" binary on install media -
make installation work without it (and without strange errors) again.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/disks.c

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

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.5 src/usr.sbin/sysinst/disks.c:1.6
--- src/usr.sbin/sysinst/disks.c:1.5	Tue Aug 19 13:26:27 2014
+++ src/usr.sbin/sysinst/disks.c	Sun Dec 28 12:05:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.5 2014/08/19 13:26:27 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.6 2014/12/28 12:05:27 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -106,8 +106,9 @@ static int foundsysvbfs(struct data *, s
 #endif
 static int fsck_preen(const char *, int, const char *);
 static void fixsb(const char *, const char *, char);
-static int is_gpt(const char *);
+static bool is_gpt(const char *);
 static int incoregpt(pm_devs_t *, partinfo *);
+static bool have_gpt_binary(void);
 
 #ifndef DISK_NAMES
 #define DISK_NAMES "wd", "sd", "ld", "raid"
@@ -576,12 +577,26 @@ find_disks(const char *doingwhat)
 	return numdisks;
 }
 
+static bool
+have_gpt_binary(void)
+{
+	static bool did_test = false;
+	static bool have_gpt;
+
+	if (!did_test) {
+		have_gpt = binary_available("gpt");
+		did_test = true;
+	}
+
+	return have_gpt;
+}
+
 void
 label_read(void)
 {
 	/* Get existing/default label */
 	memset(&pm->oldlabel, 0, sizeof pm->oldlabel);
-	if (! pm->gpt)
+	if (!have_gpt_binary() || !pm->gpt)
 		incorelabel(pm->diskdev, pm->oldlabel);
 	else
 		incoregpt(pm, pm->oldlabel);
@@ -1456,9 +1471,12 @@ incoregpt(pm_devs_t *pm_cur, partinfo *l
 	return 0;
 }
 
-static int
+static bool
 is_gpt(const char *dev)
 {
-	return ! run_program(RUN_SILENT | RUN_ERROR_OK,
+	if (!have_gpt_binary())
+		return false;
+
+	return !run_program(RUN_SILENT | RUN_ERROR_OK,
 		"sh -c 'gpt show %s |grep -e Pri\\ GPT\\ table'", dev);
 }



CVS commit: src

2014-12-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 28 11:51:11 UTC 2014

Added Files:
src/usr.sbin/sysinst/arch/evbarm64: Makefile md.c md.h
Removed Files:
src/distrib/utils/sysinst/arch/evbarm64: Makefile md.c md.h

Log Message:
Move bogusly merged files over to new location.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/distrib/utils/sysinst/arch/evbarm64/Makefile \
src/distrib/utils/sysinst/arch/evbarm64/md.c \
src/distrib/utils/sysinst/arch/evbarm64/md.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/sysinst/arch/evbarm64/Makefile \
src/usr.sbin/sysinst/arch/evbarm64/md.c \
src/usr.sbin/sysinst/arch/evbarm64/md.h

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

Added files:

Index: src/usr.sbin/sysinst/arch/evbarm64/Makefile
diff -u /dev/null src/usr.sbin/sysinst/arch/evbarm64/Makefile:1.1
--- /dev/null	Sun Dec 28 11:51:11 2014
+++ src/usr.sbin/sysinst/arch/evbarm64/Makefile	Sun Dec 28 11:51:11 2014
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1 2014/12/28 11:51:11 martin Exp $
+#
+# Makefile for evbarm64
+#
+
+#MENUS_MD= menus.md.${SYSINSTLANG} menus.mbr
+#MSG_MD= msg.md.${SYSINSTLANG} msg.mbr.${SYSINSTLANG}
+#MD_OPTIONS=	AOUT2ELF
+
+.include "../../Makefile.inc"
Index: src/usr.sbin/sysinst/arch/evbarm64/md.c
diff -u /dev/null src/usr.sbin/sysinst/arch/evbarm64/md.c:1.1
--- /dev/null	Sun Dec 28 11:51:11 2014
+++ src/usr.sbin/sysinst/arch/evbarm64/md.c	Sun Dec 28 11:51:11 2014
@@ -0,0 +1,323 @@
+/*	$NetBSD: md.c,v 1.1 2014/12/28 11:51:11 martin Exp $ */
+
+/*
+ * Copyright 1997 Piermont Information Systems Inc.
+ * All rights reserved.
+ *
+ * Based on code written by Philip A. Nelson for Piermont Information
+ * Systems Inc.
+ *
+ * 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.
+ * 3. The name of Piermont Information Systems Inc. may not be used to endorse
+ *or promote products derived from this software without specific prior
+ *written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
+ */
+
+/* md.c -- shark machine specific routines */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "defs.h"
+#include "md.h"
+#include "msg_defs.h"
+#include "menu_defs.h"
+
+int boardtype = 0, rpi_bootpart = PART_A;
+
+void
+md_prelim_menu(void)
+{
+	/* get the boardtype from the user */
+	process_menu(MENU_prelim, NULL);
+}
+
+void
+md_init(void)
+{
+}
+
+void
+md_init_set_status(int flags)
+{
+	if (boardtype == BOARD_TYPE_RPI)
+		set_kernel_set(SET_KERNEL_RPI);
+}
+
+int
+md_get_info(void)
+{
+	struct disklabel disklabel;
+	int fd;
+	char dev_name[100];
+
+	if (boardtype == BOARD_TYPE_RPI)
+		return set_bios_geom_with_mbr_guess();
+
+	if (no_mbr)
+		return 1;
+
+	if (read_mbr(diskdev, &mbr) < 0)
+		memset(&mbr.mbr, 0, sizeof(mbr.mbr)-2);
+
+	if (edit_mbr(&mbr) == 0)
+		return 0;
+
+	if (strncmp(diskdev, "wd", 2) == 0)
+		disktype = "ST506";
+	else
+		disktype = "SCSI";
+
+	snprintf(dev_name, 100, "/dev/r%sc", diskdev);
+
+	fd = open(dev_name, O_RDONLY, 0);
+	if (fd < 0) {
+		endwin();
+		fprintf(stderr, "Can't open %s\n", dev_name);
+		exit(1);
+	}
+	if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
+		endwin();
+		fprintf(stderr, "Can't read disklabel on %s.\n", dev_name);
+		close(fd);
+		exit(1);
+	}
+	close(fd);
+
+	dlcyl = disklabel.d_ncylinders;
+	dlhead = disklabel.d_ntracks;
+	dlsec = disklabel.d_nsectors;
+	sectorsize = disklabel.d_secsize;
+	dlcylsize = disklabel.d_secpercyl;
+
+	/*
+	 * Compute whole disk size. Take max of (dlcyl*dlhead*dlsec)
+	 * and secperunit,  just in case the disk is already labelled.
+	 * (If our new label's RAW_PART size ends up smaller than the
+	 * in-core RAW_PART size  value, updating t

CVS commit: src/lib/libm/arch/arm

2014-12-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 28 10:15:29 UTC 2014

Modified Files:
src/lib/libm/arch/arm: fenv.c

Log Message:
Add missing return in __SOFTFP__ variant, pointed out by htodd.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/arch/arm/fenv.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/libm/arch/arm/fenv.c
diff -u src/lib/libm/arch/arm/fenv.c:1.4 src/lib/libm/arch/arm/fenv.c:1.5
--- src/lib/libm/arch/arm/fenv.c:1.4	Sat Dec 27 17:54:24 2014
+++ src/lib/libm/arch/arm/fenv.c	Sun Dec 28 10:15:29 2014
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.4 2014/12/27 17:54:24 martin Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.5 2014/12/28 10:15:29 martin Exp $");
 
 #include 
 #include 
@@ -162,6 +162,7 @@ feenableexcept(int excepts)
 #ifdef __SOFTFP__
 	int old = fpgetsticky();
 	fpsetsticky(old | excepts);
+	return old;
 #else
 	int fpscr = armreg_fpscr_read();
 	armreg_fpscr_write(fpscr | __SHIFTIN((excepts), VFP_FPSCR_CSUM));