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

2014-08-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug 28 06:36:48 UTC 2014

Modified Files:
src/sys/arch/evbarm/cubie: cubie_machdep.c cubie_start.S

Log Message:
pull in opt_arm_debug.h for VERBOSE_INIT_ARM


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/cubie/cubie_machdep.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/cubie/cubie_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/cubie/cubie_machdep.c
diff -u src/sys/arch/evbarm/cubie/cubie_machdep.c:1.19 src/sys/arch/evbarm/cubie/cubie_machdep.c:1.20
--- src/sys/arch/evbarm/cubie/cubie_machdep.c:1.19	Thu May 15 17:05:15 2014
+++ src/sys/arch/evbarm/cubie/cubie_machdep.c	Thu Aug 28 06:36:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cubie_machdep.c,v 1.19 2014/05/15 17:05:15 matt Exp $ */
+/*	$NetBSD: cubie_machdep.c,v 1.20 2014/08/28 06:36:48 skrll Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cubie_machdep.c,v 1.19 2014/05/15 17:05:15 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cubie_machdep.c,v 1.20 2014/08/28 06:36:48 skrll Exp $);
 
 #include opt_machdep.h
 #include opt_ddb.h
@@ -134,6 +134,7 @@ __KERNEL_RCSID(0, $NetBSD: cubie_machde
 #include opt_md.h
 #include opt_com.h
 #include opt_allwinner.h
+#include opt_arm_debug.h
 
 #include com.h
 #include ukbd.h

Index: src/sys/arch/evbarm/cubie/cubie_start.S
diff -u src/sys/arch/evbarm/cubie/cubie_start.S:1.9 src/sys/arch/evbarm/cubie/cubie_start.S:1.10
--- src/sys/arch/evbarm/cubie/cubie_start.S:1.9	Fri Apr 18 06:53:13 2014
+++ src/sys/arch/evbarm/cubie/cubie_start.S	Thu Aug 28 06:36:48 2014
@@ -32,6 +32,7 @@
 #include opt_cpuoptions.h
 #include opt_cputypes.h
 #include opt_multiprocessor.h
+#include opt_arm_debug.h
 
 #include arm/asm.h
 #include arm/armreg.h
@@ -40,7 +41,7 @@
 #include arm/allwinner/awin_reg.h
 #include evbarm/cubie/platform.h  
 
-RCSID($NetBSD: cubie_start.S,v 1.9 2014/04/18 06:53:13 matt Exp $)
+RCSID($NetBSD: cubie_start.S,v 1.10 2014/08/28 06:36:48 skrll Exp $)
 
 #if defined(VERBOSE_INIT_ARM)
 #define	XPUTC(n)	mov r0, n; bl xputc



CVS commit: src/sys/fs/puffs

2014-08-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Aug 28 08:29:50 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_msgif.c puffs_node.c puffs_sys.h puffs_vfsops.c
puffs_vnops.c

Log Message:
Change puffs from hashlist to vcache.
- field pa_nhashbuckets of struct puffs_kargs becomes a no-op.
  and should be removed on the next protocol version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.31 -r1.32 src/sys/fs/puffs/puffs_node.c
cvs rdiff -u -r1.85 -r1.86 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.113 -r1.114 src/sys/fs/puffs/puffs_vfsops.c
cvs rdiff -u -r1.183 -r1.184 src/sys/fs/puffs/puffs_vnops.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/puffs/puffs_msgif.c
diff -u src/sys/fs/puffs/puffs_msgif.c:1.94 src/sys/fs/puffs/puffs_msgif.c:1.95
--- src/sys/fs/puffs/puffs_msgif.c:1.94	Thu Oct 17 21:03:27 2013
+++ src/sys/fs/puffs/puffs_msgif.c	Thu Aug 28 08:29:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.c,v 1.94 2013/10/17 21:03:27 christos Exp $	*/
+/*	$NetBSD: puffs_msgif.c,v 1.95 2014/08/28 08:29:50 hannken Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: puffs_msgif.c,v 1.94 2013/10/17 21:03:27 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: puffs_msgif.c,v 1.95 2014/08/28 08:29:50 hannken Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -856,7 +856,7 @@ puffsop_expire(struct puffs_mount *pmp, 
 	 * vrele should cause it to be reclaimed.
 	 * Otherwise, we have nothing to do.
 	 */
-	if (puffs_cookie2vnode(pmp, cookie, 0, 0, vp) == 0) {
+	if (puffs_cookie2vnode(pmp, cookie, vp) == 0) {
 		VPTOPP(vp)-pn_stat = ~PNODE_SOPEXP;
 		vrele(vp); 
 	}
@@ -889,7 +889,7 @@ puffsop_flush(struct puffs_mount *pmp, s
 	 * reason we need to eventually bump locking to userspace, as we
 	 * will need to lock the node if we wish to do flushes.
 	 */
-	rv = puffs_cookie2vnode(pmp, pf-pf_cookie, 0, 0, vp);
+	rv = puffs_cookie2vnode(pmp, pf-pf_cookie, vp);
 	if (rv) {
 		if (rv == PUFFS_NOSUCHCOOKIE)
 			rv = ENOENT;

Index: src/sys/fs/puffs/puffs_node.c
diff -u src/sys/fs/puffs/puffs_node.c:1.31 src/sys/fs/puffs/puffs_node.c:1.32
--- src/sys/fs/puffs/puffs_node.c:1.31	Thu Jan 23 10:13:56 2014
+++ src/sys/fs/puffs/puffs_node.c	Thu Aug 28 08:29:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_node.c,v 1.31 2014/01/23 10:13:56 hannken Exp $	*/
+/*	$NetBSD: puffs_node.c,v 1.32 2014/08/28 08:29:50 hannken Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: puffs_node.c,v 1.31 2014/01/23 10:13:56 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: puffs_node.c,v 1.32 2014/08/28 08:29:50 hannken Exp $);
 
 #include sys/param.h
 #include sys/hash.h
@@ -48,148 +48,96 @@ __KERNEL_RCSID(0, $NetBSD: puffs_node.c
 #include miscfs/genfs/genfs_node.h
 #include miscfs/specfs/specdev.h
 
-static const struct genfs_ops puffs_genfsops = {
-	.gop_size = puffs_gop_size,
-	.gop_write = genfs_gop_write,
-	.gop_markupdate = puffs_gop_markupdate,
-#if 0
-	.gop_alloc, should ask userspace
-#endif
-};
-
-static __inline struct puffs_node_hashlist
-	*puffs_cookie2hashlist(struct puffs_mount *, puffs_cookie_t);
-static struct puffs_node *puffs_cookie2pnode(struct puffs_mount *,
-	 puffs_cookie_t);
-
 struct pool puffs_pnpool;
 struct pool puffs_vapool;
 
 /*
  * Grab a vnode, intialize all the puffs-dependent stuff.
  */
-int
-puffs_getvnode(struct mount *mp, puffs_cookie_t ck, enum vtype type,
-	voff_t vsize, dev_t rdev, struct vnode **vpp)
+static int
+puffs_getvnode1(struct mount *mp, puffs_cookie_t ck, enum vtype type,
+	voff_t vsize, dev_t rdev, bool may_exist, struct vnode **vpp)
 {
 	struct puffs_mount *pmp;
-	struct puffs_newcookie *pnc;
 	struct vnode *vp;
 	struct puffs_node *pnode;
-	struct puffs_node_hashlist *plist;
 	int error;
 
 	pmp = MPTOPUFFSMP(mp);
 
-	error = EPROTO;
 	if (type = VNON || type = VBAD) {
 		puffs_senderr(pmp, PUFFS_ERR_MAKENODE, EINVAL,
 		bad node type, ck);
-		goto bad;
+		return EPROTO;
 	}
 	if (vsize == VSIZENOTSET) {
 		puffs_senderr(pmp, PUFFS_ERR_MAKENODE, EINVAL,
 		VSIZENOTSET is not a valid size, ck);
-		goto bad;
+		return EPROTO;
 	}
 
-	error = getnewvnode(VT_PUFFS, mp, puffs_vnodeop_p, NULL, vp);
-	if (error) {
-		goto bad;
+	for (;;) {
+		error = vcache_get(mp, ck, sizeof(ck), vp);
+		if (error)
+			return error;
+		mutex_enter(vp-v_interlock);
+		pnode = VPTOPP(vp);
+		if (pnode != NULL)
+			break;
+		mutex_exit(vp-v_interlock);
+		vrele(vp);
 	}
-	vp-v_type = type;
+	mutex_enter(pnode-pn_mtx);
+	mutex_exit(vp-v_interlock);
 
 	/*
-	 * Creation should not fail after this point.  Or if it does,
-	 * care must be taken so that VOP_INACTIVE() isn't called.
+	 * 

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

2014-08-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Aug 28 11:38:15 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos4_loc.c

Log Message:
Move the mct's interrupt from a shared SPI interrupt to a private PPI
interrupt so all possible cpus get them.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos4_loc.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/samsung/exynos4_loc.c
diff -u src/sys/arch/arm/samsung/exynos4_loc.c:1.9 src/sys/arch/arm/samsung/exynos4_loc.c:1.10
--- src/sys/arch/arm/samsung/exynos4_loc.c:1.9	Wed Jun 11 14:54:32 2014
+++ src/sys/arch/arm/samsung/exynos4_loc.c	Thu Aug 28 11:38:14 2014
@@ -139,6 +139,10 @@
 #define IRQ_EINT_1			IRQ_SPI(17)
 #define IRQ_EINT_0			IRQ_SPI(16)
 
+/* rest of PPI's marked reserved */
+#define IRQ_MCT_L			IRQ_PPI(12)
+#define IRQ_MCT_G			IRQ_PPI(10)
+
 #define IRQ_CPU_NIRQOUT_3		EXYNOS_COMBINERIRQ(19, 6)
 #define IRQ_PARITYFAILSCU_3		EXYNOS_COMBINERIRQ(19, 5)
 #define IRQ_PARITYFAIL3			EXYNOS_COMBINERIRQ(19, 4)
@@ -266,7 +270,7 @@
 static const struct exyo_locators exynos4_locators[] = {
 	{ exyogpio, 0, 0, NOPORT, NOINTR, 0 },
 	{ exyoiic, 0, 0, NOPORT, NOINTR, 0 },
-	{ mct, OFFANDSIZE(,MCT), NOPORT, IRQ_G0_IRQ, 0 },
+	{ mct, OFFANDSIZE(,MCT), NOPORT, IRQ_MCT_G, 0 },
 	{ exyowdt, OFFANDSIZE(,WDT), NOPORT, IRQ_WDT, 0 },
 	{ sscom, OFFANDSIZE(,UART0), 0, IRQ_UART0, 0 },
 	{ sscom, OFFANDSIZE(,UART1), 1, IRQ_UART1, 0 },



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

2014-08-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Aug 28 11:48:22 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos4_reg.h

Log Message:
Add CMU PLL offsets


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos4_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/samsung/exynos4_reg.h
diff -u src/sys/arch/arm/samsung/exynos4_reg.h:1.8 src/sys/arch/arm/samsung/exynos4_reg.h:1.9
--- src/sys/arch/arm/samsung/exynos4_reg.h:1.8	Thu Aug 14 15:39:31 2014
+++ src/sys/arch/arm/samsung/exynos4_reg.h	Thu Aug 28 11:48:22 2014
@@ -115,8 +115,12 @@
 
 #define EXYNOS4_SYSREG_OFFSET			0x0001
 #define EXYNOS4_PMU_OFFSET			0x0002	/* Power Management Unit */
-#define EXYNOS4_CMU_TOP_PART_OFFSET		0x0003	/* XXX unknown XXX */
-#define EXYNOS4_CMU_CORE_ISP_PART_OFFSET	0x0004	/* XXX unknown XXX */
+#define EXYNOS4_CMU_TOP_PART_OFFSET		0x0003	/* Clock(s) management unit */
+#define   EXYNOS4_CMU_EPPL			0x0003C010
+#define   EXYNOS4_CMU_VPPL			0x0003C020
+#define EXYNOS4_CMU_CORE_ISP_PART_OFFSET	0x0004	/* Clock(s) management unit */
+#define   EXYNOS4_CMU_MPLL			0x00040008
+#define   EXYNOS4_CMU_APLL			0x00044000
 #define EXYNOS4_MCT_OFFSET			0x0005	/* Multi Core Timer */
 #define EXYNOS4_WDT_OFFSET			0x0006	/* Watch Dog Timer */
 #define EXYNOS4_RTC_OFFSET			0x0007	/* Real Time Clock */



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

2014-08-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Aug 28 11:51:02 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_reg.h

Log Message:
Add PLL registers and PLL conversion macros


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_reg.h
diff -u src/sys/arch/arm/samsung/exynos_reg.h:1.7 src/sys/arch/arm/samsung/exynos_reg.h:1.8
--- src/sys/arch/arm/samsung/exynos_reg.h:1.7	Sun Aug  3 19:14:24 2014
+++ src/sys/arch/arm/samsung/exynos_reg.h	Thu Aug 28 11:51:02 2014
@@ -112,6 +112,25 @@
 #define EXYNOS_USB_FREQ			EXYNOS_F_IN_FREQ/* 24 Mhz */
 
 
+/* PLLs */
+#define PLL_LOCK_OFFSET			0x000
+#define PLL_CON0_OFFSET			0x100
+#define PLL_CON1_OFFSET			0x104
+
+#define PLL_CON0_ENABLE			__BIT(31)
+#define PLL_CON0_LOCKED			__BIT(29)	/* has the PLL locked on */
+#define PLL_CON0_M			__BITS(16,25)	/* PLL M divide value */
+#define PLL_CON0_P			__BITS( 8,13)	/* PLL P divide value */
+#define PLL_CON0_S			__BITS( 0, 2)	/* PLL S divide value */
+
+#define PLL_PMS2FREQ(F, M, P, S) (((M)*(F))/((P)*(1(S
+#define PLL_FREQ(f, v) PLL_PMS2FREQ( \
+	(f),\
+	__SHIFTOUT((v), PLL_CON0_M),\
+	__SHIFTOUT((v), PLL_CON0_P),\
+	__SHIFTOUT((v), PLL_CON0_S))
+
+
 /* Watchdog register definitions */
 #define EXYNOS_WDT_WTCON		0x
 #define  WTCON_PRESCALER		__BITS(15,8)



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

2014-08-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Aug 28 12:00:59 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: mct.c

Log Message:
Substract just one each time instead of the periods missed. This will create a
more even representation of missed interrupts.

Also fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/mct.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/samsung/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.3 src/sys/arch/arm/samsung/mct.c:1.4
--- src/sys/arch/arm/samsung/mct.c:1.3	Fri Aug  8 14:43:14 2014
+++ src/sys/arch/arm/samsung/mct.c	Thu Aug 28 12:00:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mct.c,v 1.3 2014/08/08 14:43:14 reinoud Exp $	*/
+/*	$NetBSD: mct.c,v 1.4 2014/08/28 12:00:58 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: mct.c,v 1.3 2014/08/08 14:43:14 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: mct.c,v 1.4 2014/08/28 12:00:58 reinoud Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -239,7 +239,7 @@ clockhandler(void *arg)
 	/* ack the interrupt */
 	mct_write_global(sc, MCT_G_INT_CSTAT, G_INT_CSTAT_CLEAR);
 
-	/* check if we periods clock interrupts */
+	/* check if we missed clock interrupts */
 	if (periods  1)
 		sc-sc_ev_missing_ticks.ev_count += periods - 1;
 
@@ -247,7 +247,8 @@ clockhandler(void *arg)
 	hardclock(cf);
 
 	if (sc-sc_has_blink_led) {
-		sc-sc_led_timer = sc-sc_led_timer - periods - 1;
+		/* we could substract `periods' here */
+		sc-sc_led_timer = sc-sc_led_timer - 1;
 		if (sc-sc_led_timer = 0) {
 			sc-sc_led_state = !sc-sc_led_state;
 			exynos_gpio_pindata_write(sc-sc_gpio_led,



CVS commit: src/usr.bin/ldd/elf64

2014-08-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Aug 28 12:23:29 UTC 2014

Modified Files:
src/usr.bin/ldd/elf64: Makefile

Log Message:
Fix ldd on LP64 platforms by splitting the symbol versioning stuff for
elf64 as well.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/ldd/elf64/Makefile

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

Modified files:

Index: src/usr.bin/ldd/elf64/Makefile
diff -u src/usr.bin/ldd/elf64/Makefile:1.7 src/usr.bin/ldd/elf64/Makefile:1.8
--- src/usr.bin/ldd/elf64/Makefile:1.7	Sun Mar  2 03:55:19 2014
+++ src/usr.bin/ldd/elf64/Makefile	Thu Aug 28 12:23:29 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2014/03/02 03:55:19 matt Exp $
+#	$NetBSD: Makefile,v 1.8 2014/08/28 12:23:29 joerg Exp $
 
 .include bsd.own.mk
 
@@ -25,6 +25,8 @@ RTLD_FUNCS	= \
 	_rtld_map_object \
 	_rtld_obj_free \
 	_rtld_obj_new \
+	_rtld_object_add_name \
+	_rtld_object_match_name \
 	_rtld_add_paths \
 	_rtld_process_hints \
 	_rtld_sysctl \



CVS commit: src/sys/external/bsd/drm2/include/linux

2014-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug 28 13:45:59 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/include/linux: io-mapping.h

Log Message:
Make Linux io_mapping actually work.

Can't use bus_space_map/bus_space_unmap in interrupt context, where
Linux uses this io_mapping abstraction.  Instead, do uvm_km_alloc up
front and then use bus_space_mmap/pmap_kenter_pa to map it.

XXX Should bus_space_reserve the region (but that's x86-only for now).
XXX Should use direct map if possible.
XXX Should set an MTRR WC too in case of direct map or no PAT.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/io-mapping.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/external/bsd/drm2/include/linux/io-mapping.h
diff -u src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.2 src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.3
--- src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.2	Tue Mar 18 18:20:43 2014
+++ src/sys/external/bsd/drm2/include/linux/io-mapping.h	Thu Aug 28 13:45:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: io-mapping.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $	*/
+/*	$NetBSD: io-mapping.h,v 1.3 2014/08/28 13:45:59 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,40 +32,58 @@
 #ifndef _LINUX_IO_MAPPING_H_
 #define _LINUX_IO_MAPPING_H_
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/kmem.h
 #include sys/systm.h
 
+#include uvm/uvm_extern.h
+
 struct io_mapping {
 	bus_space_tag_t		diom_bst;
 	bus_addr_t		diom_addr;
 	bus_size_t		diom_size;
-	int			diom_flags;
-	bus_space_handle_t	diom_bsh;
-	void			*diom_vaddr;
+	vaddr_t			diom_va;
+	bool			diom_mapped;
 };
 
 static inline struct io_mapping *
 bus_space_io_mapping_create_wc(bus_space_tag_t bst, bus_addr_t addr,
 bus_size_t size)
 {
-	struct io_mapping *const mapping = kmem_alloc(sizeof(*mapping),
-	KM_SLEEP);
+	struct io_mapping *mapping;
+	bus_size_t offset;
+
+	KASSERT(PAGE_SIZE = size);
+	KASSERT(0 == (size  (PAGE_SIZE - 1)));
+	KASSERT(__type_fit(off_t, size));
+
+	/*
+	 * XXX For x86: Reserve the region (bus_space_reserve) and set
+	 * an MTRR to make it write-combining.  Doesn't matter if we
+	 * have PAT and we use pmap_kenter_pa, but matters if we don't
+	 * have PAT or if we later make this use direct map.
+	 */
+
+	/* Make sure the region is mappable.  */
+	for (offset = 0; offset  size; offset += PAGE_SIZE) {
+		if (bus_space_mmap(bst, addr, offset, PROT_READ|PROT_WRITE,
+			BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE)
+		== (paddr_t)-1)
+			return NULL;
+	}
+
+	/* Create a mapping record.  */
+	mapping = kmem_alloc(sizeof(*mapping), KM_SLEEP);
 	mapping-diom_bst = bst;
 	mapping-diom_addr = addr;
 	mapping-diom_size = size;
-	mapping-diom_flags = 0;
-	mapping-diom_flags |= BUS_SPACE_MAP_LINEAR;
-	mapping-diom_flags |= BUS_SPACE_MAP_PREFETCHABLE;
-	mapping-diom_vaddr = NULL;
-
-	bus_space_handle_t bsh;
-	if (bus_space_map(mapping-diom_bst, addr, PAGE_SIZE,
-		mapping-diom_flags, bsh)) {
-		kmem_free(mapping, sizeof(*mapping));
-		return NULL;
-	}
-	bus_space_unmap(mapping-diom_bst, bsh, PAGE_SIZE);
+	mapping-diom_mapped = false;
+
+	/* Allocate kva for one page.  */
+	mapping-diom_va = uvm_km_alloc(kernel_map, PAGE_SIZE, PAGE_SIZE,
+	UVM_KMF_VAONLY | UVM_KMF_WAITVA);
+	KASSERT(mapping-diom_va != 0);
 
 	return mapping;
 }
@@ -74,44 +92,61 @@ static inline void
 io_mapping_free(struct io_mapping *mapping)
 {
 
-	KASSERT(mapping-diom_vaddr == NULL);
+	KASSERT(!mapping-diom_mapped);
+
+	uvm_km_free(kernel_map, mapping-diom_va, PAGE_SIZE, UVM_KMF_VAONLY);
 	kmem_free(mapping, sizeof(*mapping));
 }
 
 static inline void *
 io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
 {
+	paddr_t cookie;
 
-	KASSERT(mapping-diom_vaddr == NULL);
-	KASSERT(ISSET(mapping-diom_flags, BUS_SPACE_MAP_LINEAR));
-	if (bus_space_map(mapping-diom_bst, (mapping-diom_addr + offset),
-		PAGE_SIZE, mapping-diom_flags, mapping-diom_bsh))
-		panic(Unable to make I/O mapping!); /* XXX */
-	mapping-diom_vaddr = bus_space_vaddr(mapping-diom_bst,
-	mapping-diom_bsh);
+	KASSERT(0 == (offset  (PAGE_SIZE - 1)));
+	KASSERT(PAGE_SIZE = mapping-diom_size);
+	KASSERT(offset = (mapping-diom_size - PAGE_SIZE));
+	KASSERT(__type_fit(off_t, offset));
+	KASSERT(!mapping-diom_mapped);
+
+	cookie = bus_space_mmap(mapping-diom_bst, mapping-diom_addr, offset,
+	PROT_READ|PROT_WRITE,
+	BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE);
+	KASSERT(cookie != (paddr_t)-1);
+
+	pmap_kenter_pa(mapping-diom_va, pmap_phys_address(cookie),
+	PROT_READ|PROT_WRITE, pmap_mmap_flags(cookie));
+	pmap_update(pmap_kernel());
 
-	return mapping-diom_vaddr;
+	mapping-diom_mapped = true;
+	return (void *)mapping-diom_va;
 }
 
 static inline void
-io_mapping_unmap(struct io_mapping *mapping, void *vaddr __unused)

CVS commit: src/usr.bin/make

2014-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 28 14:39:13 UTC 2014

Modified Files:
src/usr.bin/make: parse.c

Log Message:
don't leave trailing backlashes on commands, just like gmake does. What does
POSIX have to say?


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/usr.bin/make/parse.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.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.200 src/usr.bin/make/parse.c:1.201
--- src/usr.bin/make/parse.c:1.200	Sat Aug 23 11:05:40 2014
+++ src/usr.bin/make/parse.c	Thu Aug 28 10:39:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.200 2014/08/23 15:05:40 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.201 2014/08/28 14:39:13 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = $NetBSD: parse.c,v 1.200 2014/08/23 15:05:40 christos Exp $;
+static char rcsid[] = $NetBSD: parse.c,v 1.201 2014/08/28 14:39:13 christos Exp $;
 #else
 #include sys/cdefs.h
 #ifndef lint
 #if 0
 static char sccsid[] = @(#)parse.c	8.3 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: parse.c,v 1.200 2014/08/23 15:05:40 christos Exp $);
+__RCSID($NetBSD: parse.c,v 1.201 2014/08/28 14:39:13 christos Exp $);
 #endif
 #endif /* not lint */
 #endif
@@ -2876,7 +2876,10 @@ ParseGetLine(int flags, int *length)
 		ptr++;
 	ch = ' ';
 	} else {
-	*tp++ = '\\';
+	// Don't add a trailign backslash at theend of a command
+	// This is what gmake does, but what does POSIX have to say?
+	if (ptr[0] != '\n'  ptr[0] != '\0')
+		*tp++ = '\\';
 	if (ptr[0] == '\t')
 		ptr++;
 	}



CVS commit: src/sys/dev/pci

2014-08-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Aug 28 16:22:59 UTC 2014

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

Log Message:
 Add Internal SERDES mode support newer than or equal to 82575.
Currently, it supports fiber device only. If you use 1000BaseT SFP module,
it won't work. We have to write code to read SFP ROM and set SGMII mode
if the module is copper.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.292 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.291 src/sys/dev/pci/if_wm.c:1.292
--- src/sys/dev/pci/if_wm.c:1.291	Tue Aug 26 14:44:00 2014
+++ src/sys/dev/pci/if_wm.c	Thu Aug 28 16:22:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.291 2014/08/26 14:44:00 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.292 2014/08/28 16:22:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -73,7 +73,7 @@
  * TODO (in order of importance):
  *
  *	- Check XXX'ed comments
- *	- Internal SERDES mode newer than or equal to 82575.
+ *	- Read SFP ROM and set media type correctly on 82575 and newer devices
  *	- EEE (Energy Efficiency Ethernet)
  *	- MSI/MSI-X
  *	- Virtual Function
@@ -82,7 +82,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.291 2014/08/26 14:44:00 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.292 2014/08/28 16:22:59 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -273,10 +273,10 @@ struct wm_softc {
 	int sc_bus_speed;		/* PCI/PCIX bus speed */
 	int sc_pcixe_capoff;		/* PCI[Xe] capability reg offset */
 
-	const struct wm_product *sc_wmp; /* Pointer to the wm_product entry */
 	wm_chip_type sc_type;		/* MAC type */
 	int sc_rev;			/* MAC revision */
 	wm_phy_type sc_phytype;		/* PHY type */
+	uint32_t sc_mediatype;		/* Media type (Copper, Fiber, SERDES)*/
 	int sc_funcid;			/* unit number of the chip (0 to 3) */
 	int sc_flags;			/* flags; see below */
 	int sc_if_flags;		/* last if_flags */
@@ -585,7 +585,7 @@ static int	wm_intr(void *);
 
 /*
  * Media related.
- * GMII, SGMII, TBI (and SERDES)
+ * GMII, SGMII, TBI, SERDES and SFP.
  */
 /* GMII related */
 static void	wm_gmii_reset(struct wm_softc *);
@@ -622,6 +622,8 @@ static void	wm_tbi_mediastatus(struct if
 static int	wm_tbi_mediachange(struct ifnet *);
 static void	wm_tbi_set_linkled(struct wm_softc *);
 static void	wm_tbi_check_link(struct wm_softc *);
+/* SFP related */
+static uint32_t	wm_get_sfp_media_type(struct wm_softc *);
 
 /*
  * NVM related.
@@ -718,10 +720,12 @@ static const struct wm_product {
 	pci_product_id_t	wmp_product;
 	const char		*wmp_name;
 	wm_chip_type		wmp_type;
-	int			wmp_flags;
+	uint32_t		wmp_flags;
+#define	WMP_F_UNKNOWN		0x00
 #define	WMP_F_FIBER		0x01
 #define	WMP_F_COPPER		0x02
-#define	WMP_F_SERDES		0x04
+#define	WMP_F_SERDES		0x03 /* Internal SERDES */
+#define WMP_MEDIATYPE(x)	((x)  0x03)
 } wm_products[] = {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82542,
 	  Intel i82542 1000BASE-X Ethernet,
@@ -1036,15 +1040,9 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82575EB_COPPER,
 	  82575EB dual-1000baseT Ethernet,
 	  WM_T_82575,		WMP_F_COPPER },
-#if 0
-	/*
-	 * not sure if WMP_F_FIBER or WMP_F_SERDES - we do not have it - so
-	 * disabled for now ...
-	 */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82575EB_FIBER_SERDES,
 	  82575EB dual-1000baseX Ethernet (SERDES),
 	  WM_T_82575,		WMP_F_SERDES },
-#endif
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82575GB_QUAD_COPPER,
 	  82575GB quad-1000baseT Ethernet,
 	  WM_T_82575,		WMP_F_COPPER },
@@ -1112,11 +1110,11 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I350_SERDES,
 	  I350 Gigabit Backplane Connection,
 	  WM_T_I350,		WMP_F_SERDES },
-#if 0
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I350_SGMII,
 	  I350 Gigabit Connection,
 	  WM_T_I350,		WMP_F_COPPER },
-#endif
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_C2000_SGMII,
 	  I354 Gigabit Connection,
 	  WM_T_I354,		WMP_F_COPPER },
@@ -1136,11 +1134,11 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_SERDES,
 	  I210 Gigabit Ethernet (SERDES),
 	  WM_T_I210,		WMP_F_SERDES },
-#if 0
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_SGMII,
 	  I210 Gigabit Ethernet (SGMII),
-	  WM_T_I210,		WMP_F_SERDES },
-#endif
+	  WM_T_I210,		WMP_F_COPPER },
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I211_COPPER,
 	  I211 Ethernet (COPPER),
 	  WM_T_I211,		WMP_F_COPPER },
@@ -1278,6 +1276,7 @@ wm_attach(device_t parent, device_t self
 	pcireg_t preg, memtype;
 	uint16_t eeprom_data, apme_mask;
 	bool force_clear_smbi;
+	uint32_t link_mode;
 	uint32_t reg;
 	char intrbuf[PCI_INTRSTR_LEN];
 
@@ -1285,11 +1284,14 @@ wm_attach(device_t parent, device_t self
 	callout_init(sc-sc_tick_ch, CALLOUT_FLAGS);
 	sc-sc_stopping = false;
 
-	sc-sc_wmp = wmp = 

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

2014-08-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Aug 28 17:59:46 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos4_reg.h exynos5_reg.h

Log Message:
Add comments to Exynos4 PLL registers and add Exynos5 PLL registers


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos4_reg.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos5_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/samsung/exynos4_reg.h
diff -u src/sys/arch/arm/samsung/exynos4_reg.h:1.9 src/sys/arch/arm/samsung/exynos4_reg.h:1.10
--- src/sys/arch/arm/samsung/exynos4_reg.h:1.9	Thu Aug 28 11:48:22 2014
+++ src/sys/arch/arm/samsung/exynos4_reg.h	Thu Aug 28 17:59:46 2014
@@ -116,11 +116,11 @@
 #define EXYNOS4_SYSREG_OFFSET			0x0001
 #define EXYNOS4_PMU_OFFSET			0x0002	/* Power Management Unit */
 #define EXYNOS4_CMU_TOP_PART_OFFSET		0x0003	/* Clock(s) management unit */
-#define   EXYNOS4_CMU_EPPL			0x0003C010
-#define   EXYNOS4_CMU_VPPL			0x0003C020
+#define   EXYNOS4_CMU_EPPL			0x0003C010	/* Audio and ext. interf. clock */
+#define   EXYNOS4_CMU_VPPL			0x0003C020	/* Video core (dither?) clock */
 #define EXYNOS4_CMU_CORE_ISP_PART_OFFSET	0x0004	/* Clock(s) management unit */
-#define   EXYNOS4_CMU_MPLL			0x00040008
-#define   EXYNOS4_CMU_APLL			0x00044000
+#define   EXYNOS4_CMU_MPLL			0x00040008	/* MEM cntr. clock */
+#define   EXYNOS4_CMU_APLL			0x00044000	/* ARM core clock */
 #define EXYNOS4_MCT_OFFSET			0x0005	/* Multi Core Timer */
 #define EXYNOS4_WDT_OFFSET			0x0006	/* Watch Dog Timer */
 #define EXYNOS4_RTC_OFFSET			0x0007	/* Real Time Clock */

Index: src/sys/arch/arm/samsung/exynos5_reg.h
diff -u src/sys/arch/arm/samsung/exynos5_reg.h:1.12 src/sys/arch/arm/samsung/exynos5_reg.h:1.13
--- src/sys/arch/arm/samsung/exynos5_reg.h:1.12	Thu Aug 21 14:06:39 2014
+++ src/sys/arch/arm/samsung/exynos5_reg.h	Thu Aug 28 17:59:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos5_reg.h,v 1.12 2014/08/21 14:06:39 reinoud Exp $	*/
+/*	$NetBSD: exynos5_reg.h,v 1.13 2014/08/28 17:59:46 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -56,8 +56,15 @@
 #define EXYNOS5_SDRAM_PBASE			0x4000
 
 #define EXYNOS5_CMU_COREPART_OFFSET		0x0001
+#define   EXYNOS5_CMU_APLL			0x0001	/* ARM core clock */
+#define   EXYNOS5_CMU_MPLL			0x00014000	/* MEM cntr. clock */
 #define EXYNOS5_CMU_TOPPART_OFFSET		0x0002
+#define   EXYNOS5_CMU_CPLL			0x00020020	/* Video hardware codec clock */
+#define   EXYNOS5_CMU_EPLL			0x00020030	/* Audio and ext. interf. clock */
+#define   EXYNOS5_CMU_VPLL			0x00020040	/* Dither PLL (EMI reduction) clock */
+#define   EXYNOS5_CMU_GPLL			0x00020050	/* Graphic 3D proc. clock */
 #define EXYNOS5_CMU_MEMPART_OFFSET		0x0003
+#define   EXYNOS5_CMU_BPLL			0x00030010
 #define EXYNOS5_ALIVE_OFFSET			0x0004
 #define EXYNOS5_SYSREG_OFFSET			0x0005
 #define EXYNOS5_TMU_OFFSET			0x0006



CVS commit: src/sys/arch

2014-08-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Aug 28 18:02:37 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_io.c exynos_soc.c exynos_var.h
src/sys/arch/evbarm/odroid: odroid_machdep.c

Log Message:
Implement CPU speed control for Exynos4 and Exynos5 CPUs using APLL frequency
adjustment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_io.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_var.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbarm/odroid/odroid_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/samsung/exynos_io.c
diff -u src/sys/arch/arm/samsung/exynos_io.c:1.6 src/sys/arch/arm/samsung/exynos_io.c:1.7
--- src/sys/arch/arm/samsung/exynos_io.c:1.6	Wed May 14 09:03:09 2014
+++ src/sys/arch/arm/samsung/exynos_io.c	Thu Aug 28 18:02:36 2014
@@ -34,7 +34,7 @@
 #include opt_exynos.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exynos_io.c,v 1.6 2014/05/14 09:03:09 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: exynos_io.c,v 1.7 2014/08/28 18:02:36 reinoud Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -139,6 +139,10 @@ exyo_attach(device_t parent, device_t se
 	aprint_naive(: Exynos %x\n, product_id);
 	aprint_normal(: Exynos %x\n, product_id);
 
+	/* add sysctl nodes */
+	exynos_sysctl_cpufreq_init();
+
+	/* add all children */
 #if defined(EXYNOS4)
 	if (IS_EXYNOS4_P()) {
 		l = exynos4_locinfo.locators;

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.15 src/sys/arch/arm/samsung/exynos_soc.c:1.16
--- src/sys/arch/arm/samsung/exynos_soc.c:1.15	Tue Aug 26 11:55:54 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Thu Aug 28 18:02:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.15 2014/08/26 11:55:54 reinoud Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.16 2014/08/28 18:02:36 reinoud Exp $	*/
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.15 2014/08/26 11:55:54 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.16 2014/08/28 18:02:36 reinoud Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -69,6 +69,63 @@ uint32_t  exynos_soc_id = 0;
 uint32_t  exynos_pop_id = 0;
 
 
+/* cpu frequencies */
+struct cpu_freq {
+	uint64_t freq;
+	int	 P;
+	int	 M;
+	int	 S; 
+};
+
+
+#ifdef EXYNOS4
+const struct cpu_freq cpu_freq_settings_exynos4[] = {
+	{ 200, 3, 100, 2},
+	{ 300, 4, 200, 2},
+	{ 400, 3, 100, 1},
+	{ 500, 3, 125, 1},
+	{ 600, 4, 200, 1},
+	{ 700, 3, 175, 1},
+	{ 800, 3, 100, 0},
+	{ 900, 4, 150, 0},
+	{1000, 3, 125, 0},
+	{1100, 6, 275, 0},
+	{1200, 4, 200, 0},
+	{1300, 6, 325, 0},
+	{1400, 3, 175, 0},
+	{1600, 3, 200, 0},
+};
+#endif
+
+
+#ifdef EXYNOS5
+const struct cpu_freq cpu_freq_settings_exynos5[] = {
+	{ 200,  3, 100, 2},
+	{ 333,  4, 222, 2},
+	{ 400,  3, 100, 1},
+	{ 533, 12, 533, 1},
+	{ 600,  4, 200, 1},
+	{ 667,  7, 389, 1},
+	{ 800,  3, 100, 0},
+	{1000,  3, 125, 0},
+	{1066, 12, 533, 0},
+	{1200,  3, 150, 0},
+	{1400,  3, 175, 0},
+	{1600,  3, 200, 0},
+};
+#endif
+
+static struct cpu_freq const *cpu_freq_settings = NULL;
+static int ncpu_freq_settings = 0;
+
+static int cpu_freq_target = 0;
+#define NFRQS 15
+static char sysctl_cpu_freqs_txt[NFRQS*5];
+
+static int sysctl_cpufreq_target(SYSCTLFN_ARGS);
+static int sysctl_cpufreq_current(SYSCTLFN_ARGS);
+
+
 /*
  * the early serial console
  */
@@ -208,6 +265,204 @@ exynos_l2cc_init(void)
 
 
 void
+exynos_sysctl_cpufreq_init(void)
+{
+	const struct sysctlnode *node, *cpunode, *freqnode;
+	char *cpos;
+	int i, val;
+	int error;
+
+	memset(sysctl_cpu_freqs_txt, (int) ' ', sizeof(sysctl_cpu_freqs_txt));
+	cpos = sysctl_cpu_freqs_txt;
+	for (i = 0; i  ncpu_freq_settings; i++) {
+		val = cpu_freq_settings[i].freq;
+		snprintf(cpos, 6, %d , val);
+		cpos += (val  1000) ? 4 : 5;
+	}
+	*cpos = 0;
+
+	error = sysctl_createv(NULL, 0, NULL, node,
+	CTLFLAG_PERMANENT, CTLTYPE_NODE, machdep, NULL,
+	NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
+	if (error)
+		printf(couldn't create `machdep' node\n);
+
+	error = sysctl_createv(NULL, 0, node, cpunode,
+	0, CTLTYPE_NODE, cpu, NULL,
+	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		printf(couldn't create `cpu' node\n);
+
+	error = sysctl_createv(NULL, 0, cpunode, freqnode,
+	0, CTLTYPE_NODE, frequency, NULL,
+	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		printf(couldn't create `frequency' node\n);
+
+	error = sysctl_createv(NULL, 0, freqnode, node,
+	CTLFLAG_READWRITE, CTLTYPE_INT, target, NULL,
+	sysctl_cpufreq_target, 0, cpu_freq_target, 0,
+	CTL_CREATE, CTL_EOL);
+	if (error)
+		printf(couldn't create `target' node\n);
+
+	error = sysctl_createv(NULL, 0, 

CVS commit: src/sys/dev/dkwedge

2014-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug 28 19:37:46 UTC 2014

Modified Files:
src/sys/dev/dkwedge: dk.c

Log Message:
Make dk(4) discard from partition start, not from disk start.

Otherwise, anything mounted with `-o discard' will pretty quickly
munch itself up and barf up an unrecoverably corrupted file system!

XXX pullup to netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.72 src/sys/dev/dkwedge/dk.c:1.73
--- src/sys/dev/dkwedge/dk.c:1.72	Fri Jul 25 08:23:56 2014
+++ src/sys/dev/dkwedge/dk.c	Thu Aug 28 19:37:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.72 2014/07/25 08:23:56 dholland Exp $	*/
+/*	$NetBSD: dk.c,v 1.73 2014/08/28 19:37:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.72 2014/07/25 08:23:56 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.73 2014/08/28 19:37:46 riastradh Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_dkwedge.h
@@ -1350,6 +1350,8 @@ static int
 dkdiscard(dev_t dev, off_t pos, off_t len)
 {
 	struct dkwedge_softc *sc = dkwedge_lookup(dev);
+	unsigned shift;
+	off_t offset, maxlen;
 
 	if (sc == NULL)
 		return (ENODEV);
@@ -1358,6 +1360,21 @@ dkdiscard(dev_t dev, off_t pos, off_t le
 	if (sc-sc_parent-dk_rawvp == NULL)
 		return (ENXIO);
 
+	shift = (sc-sc_parent-dk_blkshift + DEV_BSHIFT);
+	KASSERT(__type_fit(off_t, sc-sc_size));
+	KASSERT(__type_fit(off_t, sc-sc_offset));
+	KASSERT(0 = sc-sc_offset);
+	KASSERT(sc-sc_size = (__type_max(off_t)  shift));
+	KASSERT(sc-sc_offset = ((__type_max(off_t)  shift) - sc-sc_size));
+	offset = ((off_t)sc-sc_offset  shift);
+	maxlen = ((off_t)sc-sc_size  shift);
+
+	if (len  maxlen)
+		return (EINVAL);
+	if (pos  (maxlen - len))
+		return (EINVAL);
+
+	pos += offset;
 	return VOP_FDISCARD(sc-sc_parent-dk_rawvp, pos, len);
 }
 



CVS commit: src/usr.bin/make

2014-08-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Aug 28 19:55:00 UTC 2014

Modified Files:
src/usr.bin/make: make.1

Log Message:
Enter/leave flag is -w not -dw


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/usr.bin/make/make.1

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

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.233 src/usr.bin/make/make.1:1.234
--- src/usr.bin/make/make.1:1.233	Sat Aug 23 15:05:40 2014
+++ src/usr.bin/make/make.1	Thu Aug 28 19:55:00 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: make.1,v 1.233 2014/08/23 15:05:40 christos Exp $
+.\	$NetBSD: make.1,v 1.234 2014/08/28 19:55:00 sjg Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\
-.Dd August 23, 2014
+.Dd August 28, 2014
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -209,8 +209,6 @@ Force the
 option to print raw values of variables.
 .It Ar v
 Print debugging information about variable assignment.
-.It Ar w
-Print entering and leaving directory messages, pre and post processing.
 .It Ar x
 Run shell commands with
 .Fl x
@@ -352,6 +350,8 @@ contains a
 then the value will be expanded before printing.
 .It Fl W
 Treat any warnings during makefile parsing as errors.
+.It Fl w
+Print entering and leaving directory messages, pre and post processing.
 .It Fl X
 Don't export variables passed on the command line to the environment
 individually.



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

2014-08-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Aug 28 20:29:05 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_soc.c mct.c

Log Message:
tyop police


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/mct.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/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.16 src/sys/arch/arm/samsung/exynos_soc.c:1.17
--- src/sys/arch/arm/samsung/exynos_soc.c:1.16	Thu Aug 28 18:02:36 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Thu Aug 28 20:29:05 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.16 2014/08/28 18:02:36 reinoud Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.17 2014/08/28 20:29:05 snj Exp $	*/
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.16 2014/08/28 18:02:36 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: exynos_soc.c,v 1.17 2014/08/28 20:29:05 snj Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -195,7 +195,7 @@ exynos_cpu_boot(int cpu)
 
 
 /*
- * The latency values used below are `magic' and probably chosen empiricaly.
+ * The latency values used below are `magic' and probably chosen empirically.
  * For the 4210 variant the data latency is lower, a 0x110. This is currently
  * not enforced.
  *
@@ -523,7 +523,7 @@ exynos_device_register(device_t self, vo
 		/*
 		 * XXX KLUDGE ALERT XXX
 		 * The iot mainbus supplies is completely wrong since it scales
-		 * addresses by 2.  The simpliest remedy is to replace with our
+		 * addresses by 2.  The simplest remedy is to replace with our
 		 * bus space used for the armcore regisers (which armperiph uses).
 		 */
 		struct mainbus_attach_args * const mb = aux;

Index: src/sys/arch/arm/samsung/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.4 src/sys/arch/arm/samsung/mct.c:1.5
--- src/sys/arch/arm/samsung/mct.c:1.4	Thu Aug 28 12:00:58 2014
+++ src/sys/arch/arm/samsung/mct.c	Thu Aug 28 20:29:05 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mct.c,v 1.4 2014/08/28 12:00:58 reinoud Exp $	*/
+/*	$NetBSD: mct.c,v 1.5 2014/08/28 20:29:05 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: mct.c,v 1.4 2014/08/28 12:00:58 reinoud Exp $);
+__KERNEL_RCSID(1, $NetBSD: mct.c,v 1.5 2014/08/28 20:29:05 snj Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -247,7 +247,7 @@ clockhandler(void *arg)
 	hardclock(cf);
 
 	if (sc-sc_has_blink_led) {
-		/* we could substract `periods' here */
+		/* we could subtract `periods' here */
 		sc-sc_led_timer = sc-sc_led_timer - 1;
 		if (sc-sc_led_timer = 0) {
 			sc-sc_led_state = !sc-sc_led_state;



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2014-08-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug 28 20:40:57 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: atombios_dp.c

Log Message:
hack around an evergreen attach crash for now: provide a hard coded
name for the i2c.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/atombios_dp.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/external/bsd/drm2/dist/drm/radeon/atombios_dp.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/atombios_dp.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/atombios_dp.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/atombios_dp.c:1.2	Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/atombios_dp.c	Thu Aug 28 20:40:57 2014
@@ -212,6 +212,10 @@ void radeon_dp_aux_init(struct radeon_co
 	radeon_connector-ddc_bus-rec.hpd = radeon_connector-hpd.hpd;
 	radeon_connector-ddc_bus-aux.dev = radeon_connector-base.kdev;
 	radeon_connector-ddc_bus-aux.transfer = radeon_dp_aux_transfer;
+#ifdef __NetBSD__
+	/* XXX dervied from sysfs/i2c on linux. */
+	radeon_connector-ddc_bus-aux.name = radeon_dp_aux;
+#endif
 	ret = drm_dp_aux_register_i2c_bus(radeon_connector-ddc_bus-aux);
 	if (!ret)
 		radeon_connector-ddc_bus-has_aux = true;



CVS commit: src/lib/libperfuse

2014-08-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Aug 29 04:58:40 UTC 2014

Modified Files:
src/lib/libperfuse: ops.c

Log Message:
We used to remove the trailing zeros in FUSE readlink replies, but
it seems it does not always happen. Just remove them if present.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/lib/libperfuse/ops.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.69 src/lib/libperfuse/ops.c:1.70
--- src/lib/libperfuse/ops.c:1.69	Tue Aug 19 15:29:14 2014
+++ src/lib/libperfuse/ops.c	Fri Aug 29 04:58:40 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.69 2014/08/19 15:29:14 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.70 2014/08/29 04:58:40 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -2633,12 +2633,16 @@ perfuse_node_readlink(struct puffs_userm
 	if (len == 0)
 		DERRX(EX_PROTOCOL, path len = %zd too short, len);
 		
+	(void)memcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len);
+
 	/*
 	 * FUSE filesystems return a NUL terminated string, we 
-	 * do not want to trailing \0
+	 * do not want the trailing \0
 	 */
-	*linklen = len - 1;
-	(void)memcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len);
+	while (len  0  linkname[len - 1] == '\0')
+		len--;
+
+	*linklen = len;
 
 	ps-ps_destroy_msg(pm);
 	error = 0;