CVS commit: src/sys/dev/scsipi

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 03:17:01 UTC 2018

Modified Files:
src/sys/dev/scsipi: scsipiconf.h

Log Message:
Avoid undefined behavior in scsipiconf.h in _4ltol() and _4btol()

Do not shift (through integer promotion) a signed value in an operation
than can change the bit of signedness.

sys/dev/scsipi/scsipiconf.h:808:17, left shift of 255 by 24 places cannot be 
represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/scsipi/scsipiconf.h

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

Modified files:

Index: src/sys/dev/scsipi/scsipiconf.h
diff -u src/sys/dev/scsipi/scsipiconf.h:1.126 src/sys/dev/scsipi/scsipiconf.h:1.127
--- src/sys/dev/scsipi/scsipiconf.h:1.126	Tue Nov 29 03:23:00 2016
+++ src/sys/dev/scsipi/scsipiconf.h	Wed Jul  4 03:17:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipiconf.h,v 1.126 2016/11/29 03:23:00 mlelstv Exp $	*/
+/*	$NetBSD: scsipiconf.h,v 1.127 2018/07/04 03:17:01 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -805,10 +805,10 @@ _4btol(const u_int8_t *bytes)
 {
 	u_int32_t rv;
 
-	rv = (bytes[0] << 24) |
-	 (bytes[1] << 16) |
-	 (bytes[2] << 8) |
-	 bytes[3];
+	rv = ((u_int32_t)bytes[0] << 24) |
+	 ((u_int32_t)bytes[1] << 16) |
+	 ((u_int32_t)bytes[2] << 8) |
+	 (u_int32_t)bytes[3];
 	return (rv);
 }
 
@@ -894,10 +894,10 @@ _4ltol(const u_int8_t *bytes)
 {
 	u_int32_t rv;
 
-	rv = bytes[0] |
-	 (bytes[1] << 8) |
-	 (bytes[2] << 16) |
-	 (bytes[3] << 24);
+	rv = (u_int32_t)bytes[0] |
+	 ((u_int32_t)bytes[1] << 8) |
+	 ((u_int32_t)bytes[2] << 16) |
+	 ((u_int32_t)bytes[3] << 24);
 	return (rv);
 }
 



CVS commit: src/sys/dev/pci

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 03:00:46 UTC 2018

Modified Files:
src/sys/dev/pci: pciide_piix_reg.h

Log Message:
Avoid undefined behavior in pciiide macros

Cast the 'bytes' argument in PIIX_IDETIM_SET() and PIIX_IDETIM_CLEAR()
to unsigned int. This prevents UB because of shifting the bits and changing
the bit of signedness.

sys/dev/pci/piixide.c:714:11, left shift of 65535 by 16 places cannot be 
represented in type 'int'
sys/dev/pci/piixide.c:720:11, left shift of 32768 by 16 places cannot be 
represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/pciide_piix_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/dev/pci/pciide_piix_reg.h
diff -u src/sys/dev/pci/pciide_piix_reg.h:1.14 src/sys/dev/pci/pciide_piix_reg.h:1.15
--- src/sys/dev/pci/pciide_piix_reg.h:1.14	Mon Oct 19 18:41:16 2009
+++ src/sys/dev/pci/pciide_piix_reg.h	Wed Jul  4 03:00:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_piix_reg.h,v 1.14 2009/10/19 18:41:16 bouyer Exp $	*/
+/*	$NetBSD: pciide_piix_reg.h,v 1.15 2018/07/04 03:00:46 kamil Exp $	*/
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -49,9 +49,9 @@
 #define PIIX_IDETIM 0x40
 #define PIIX_IDETIM_READ(x, channel) (((x) >> (16 * (channel))) & 0x)
 #define PIIX_IDETIM_SET(x, bytes, channel) \
-	((x) | ((bytes) << (16 * (channel
+	((x) | ((unsigned int)(bytes) << (16 * (channel
 #define PIIX_IDETIM_CLEAR(x, bytes, channel) \
-	((x) & ~((bytes) << (16 * (channel
+	((x) & ~((unsigned int)(bytes) << (16 * (channel
 
 #define PIIX_IDETIM_IDE		0x8000 /* PIIX decode IDE registers */
 #define PIIX_IDETIM_SITRE	0x4000 /* slaves IDE timing registers



CVS commit: src/sys/kern

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 02:19:02 UTC 2018

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
Avoid undefined behavior in pr_item_notouch_put()

Do not left shift a signed integer changing its signedness bit.

sys/kern/subr_pool.c:251:30, left shift of 1 by 31 places cannot be represented 
in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/subr_pool.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/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.222 src/sys/kern/subr_pool.c:1.223
--- src/sys/kern/subr_pool.c:1.222	Wed Jul  4 01:42:37 2018
+++ src/sys/kern/subr_pool.c	Wed Jul  4 02:19:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.222 2018/07/04 01:42:37 kamil Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.223 2018/07/04 02:19:02 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.222 2018/07/04 01:42:37 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.223 2018/07/04 02:19:02 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -248,7 +248,7 @@ pr_item_notouch_put(const struct pool *p
 {
 	unsigned int idx = pr_item_notouch_index(pp, ph, obj);
 	pool_item_bitmap_t *bitmap = ph->ph_bitmap + (idx / BITMAP_SIZE);
-	pool_item_bitmap_t mask = 1 << (idx & BITMAP_MASK);
+	pool_item_bitmap_t mask = 1U << (idx & BITMAP_MASK);
 
 	KASSERT((*bitmap & mask) == 0);
 	*bitmap |= mask;



CVS commit: src/sys/ufs/ffs

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 02:02:15 UTC 2018

Modified Files:
src/sys/ufs/ffs: ffs_subr.c

Log Message:
Avoid Undefined Behavior in ffs_clusteracct()

Change the type of 'bit' variable from int to unsigned int and use unsigned
values consistently.

sys/ufs/ffs/ffs_subr.c:336:10, shift exponent -1 is negative

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/ffs/ffs_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/ufs/ffs/ffs_subr.c
diff -u src/sys/ufs/ffs/ffs_subr.c:1.49 src/sys/ufs/ffs/ffs_subr.c:1.50
--- src/sys/ufs/ffs/ffs_subr.c:1.49	Sat May  7 11:59:08 2016
+++ src/sys/ufs/ffs/ffs_subr.c	Wed Jul  4 02:02:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_subr.c,v 1.49 2016/05/07 11:59:08 maxv Exp $	*/
+/*	$NetBSD: ffs_subr.c,v 1.50 2018/07/04 02:02:15 kamil Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_subr.c,v 1.49 2016/05/07 11:59:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_subr.c,v 1.50 2018/07/04 02:02:15 kamil Exp $");
 
 #include 
 
@@ -287,7 +287,8 @@ ffs_clusteracct(struct fs *fs, struct cg
 	int32_t *sump;
 	int32_t *lp;
 	u_char *freemapp, *mapp;
-	int i, start, end, forw, back, map, bit;
+	int i, start, end, forw, back, map;
+	unsigned int bit;
 	const int needswap = UFS_FSNEEDSWAP(fs);
 
 	/* KASSERT(mutex_owned(>um_lock)); */
@@ -312,7 +313,7 @@ ffs_clusteracct(struct fs *fs, struct cg
 		end = ufs_rw32(cgp->cg_nclusterblks, needswap);
 	mapp = [start / NBBY];
 	map = *mapp++;
-	bit = 1 << (start % NBBY);
+	bit = 1U << (start % NBBY);
 	for (i = start; i < end; i++) {
 		if ((map & bit) == 0)
 			break;
@@ -333,7 +334,7 @@ ffs_clusteracct(struct fs *fs, struct cg
 		end = -1;
 	mapp = [start / NBBY];
 	map = *mapp--;
-	bit = 1 << (start % NBBY);
+	bit = 1U << (start % NBBY);
 	for (i = start; i > end; i--) {
 		if ((map & bit) == 0)
 			break;
@@ -341,7 +342,7 @@ ffs_clusteracct(struct fs *fs, struct cg
 			bit >>= 1;
 		} else {
 			map = *mapp--;
-			bit = 1 << (NBBY - 1);
+			bit = 1U << (NBBY - 1);
 		}
 	}
 	back = start - i;



CVS commit: src/sys/kern

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 01:42:37 UTC 2018

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
Avoid Undefined Behavior in pr_item_notouch_get()

Change the type of left shifted integer from signed to unsigned.

sys/kern/subr_pool.c:274:13, left shift of 1 by 31 places cannot be represented 
in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/kern/subr_pool.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/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.221 src/sys/kern/subr_pool.c:1.222
--- src/sys/kern/subr_pool.c:1.221	Fri Jan 12 18:54:37 2018
+++ src/sys/kern/subr_pool.c	Wed Jul  4 01:42:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.221 2018/01/12 18:54:37 para Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.222 2018/07/04 01:42:37 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.221 2018/01/12 18:54:37 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.222 2018/07/04 01:42:37 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -271,7 +271,7 @@ pr_item_notouch_get(const struct pool *p
 
 			bit--;
 			idx = (i * BITMAP_SIZE) + bit;
-			mask = 1 << bit;
+			mask = 1U << bit;
 			KASSERT((bitmap[i] & mask) != 0);
 			bitmap[i] &= ~mask;
 			break;



CVS commit: src/sys/sys

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 01:17:32 UTC 2018

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

Log Message:
Avoid undefined operation in signed integer shift in MAP_ALIGNED()

Cast the shifted byte to unsigned int.

sys/uvm/uvm_mmap.c:914:19, left shift of 255 by 24 places cannot be represented 
in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/sys/mman.h

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

Modified files:

Index: src/sys/sys/mman.h
diff -u src/sys/sys/mman.h:1.53 src/sys/sys/mman.h:1.54
--- src/sys/sys/mman.h:1.53	Wed Jan 24 09:04:45 2018
+++ src/sys/sys/mman.h	Wed Jul  4 01:17:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mman.h,v 1.53 2018/01/24 09:04:45 skrll Exp $	*/
+/*	$NetBSD: mman.h,v 1.54 2018/07/04 01:17:32 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -106,7 +106,7 @@ typedef	__off_t		off_t;		/* file offset 
  * Alignment (expressed in log2).  Must be >= log2(PAGE_SIZE) and
  * < # bits in a pointer (32 or 64).
  */
-#define	MAP_ALIGNED(n)		((n) << MAP_ALIGNMENT_SHIFT)
+#define	MAP_ALIGNED(n)		((unsigned int)(n) << MAP_ALIGNMENT_SHIFT)
 #define	MAP_ALIGNMENT_SHIFT	24
 #define	MAP_ALIGNMENT_MASK	MAP_ALIGNED(0xff)
 #define	MAP_ALIGNMENT_64KB	MAP_ALIGNED(16)	/* 2^16 */



CVS commit: src/sys/netinet6

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jul  4 00:35:34 UTC 2018

Modified Files:
src/sys/netinet6: in6.c

Log Message:
Paper over Undefined Behavior in in6_control1()

Replace calculation of maxexpire (TIME_MAX) with a construct that triggers
UB with a one that uses implementation defined semantics.

No functional change intended.

An attempt to appease KUBSAn.

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/netinet6/in6.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.268 src/sys/netinet6/in6.c:1.269
--- src/sys/netinet6/in6.c:1.268	Tue May 29 09:10:39 2018
+++ src/sys/netinet6/in6.c	Wed Jul  4 00:35:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.268 2018/05/29 09:10:39 prlw1 Exp $	*/
+/*	$NetBSD: in6.c,v 1.269 2018/07/04 00:35:33 kamil Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.268 2018/05/29 09:10:39 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.269 2018/07/04 00:35:33 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -632,7 +632,7 @@ in6_control1(struct socket *so, u_long c
 			 * signed.
 			 */
 			maxexpire = ((time_t)~0) &
-			~((time_t)1 << ((sizeof(maxexpire) * NBBY) - 1));
+			(time_t)~(1ULL << ((sizeof(maxexpire) * NBBY) - 1));
 			if (ia->ia6_lifetime.ia6t_vltime <
 			maxexpire - ia->ia6_updatetime) {
 retlt->ia6t_expire = ia->ia6_updatetime +
@@ -653,7 +653,7 @@ in6_control1(struct socket *so, u_long c
 			 * signed.
 			 */
 			maxexpire = ((time_t)~0) &
-			~((time_t)1 << ((sizeof(maxexpire) * NBBY) - 1));
+			(time_t)~(1ULL << ((sizeof(maxexpire) * NBBY) - 1));
 			if (ia->ia6_lifetime.ia6t_pltime <
 			maxexpire - ia->ia6_updatetime) {
 retlt->ia6t_preferred = ia->ia6_updatetime +



CVS commit: src/sys/kern

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jul  3 23:14:57 UTC 2018

Modified Files:
src/sys/kern: kern_descrip.c

Log Message:
Avoid unportable signed integer left shift in fd_unused()

Detected with Kernel Undefined Behavior Sanitizer.

There were at least a single place reported, for consistency fix all the
left bit shift operations.
sys/kern/kern_descrip.c:345:2, left shift of 1 by 31 places cannot be 
represented in type 'int'
sys/kern/kern_descrip.c:346:28, left shift of 1 by 31 places cannot be 
represented in type 'int'

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/kern/kern_descrip.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/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.234 src/sys/kern/kern_descrip.c:1.235
--- src/sys/kern/kern_descrip.c:1.234	Tue Jul  3 23:11:06 2018
+++ src/sys/kern/kern_descrip.c	Tue Jul  3 23:14:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.234 2018/07/03 23:11:06 kamil Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.235 2018/07/03 23:14:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.234 2018/07/03 23:11:06 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.235 2018/07/03 23:14:57 kamil Exp $");
 
 #include 
 #include 
@@ -338,12 +338,12 @@ fd_unused(filedesc_t *fdp, unsigned fd)
 
 	if (fdp->fd_lomap[off] == ~0) {
 		KASSERT((fdp->fd_himap[off >> NDENTRYSHIFT] &
-		(1 << (off & NDENTRYMASK))) != 0);
+		(1U << (off & NDENTRYMASK))) != 0);
 		fdp->fd_himap[off >> NDENTRYSHIFT] &=
-		~(1 << (off & NDENTRYMASK));
+		~(1U << (off & NDENTRYMASK));
 	}
-	KASSERT((fdp->fd_lomap[off] & (1 << (fd & NDENTRYMASK))) != 0);
-	fdp->fd_lomap[off] &= ~(1 << (fd & NDENTRYMASK));
+	KASSERT((fdp->fd_lomap[off] & (1U << (fd & NDENTRYMASK))) != 0);
+	fdp->fd_lomap[off] &= ~(1U << (fd & NDENTRYMASK));
 	ff->ff_allocated = false;
 
 	KASSERT(fd <= fdp->fd_lastfile);



CVS commit: src/sys/kern

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jul  3 23:11:06 UTC 2018

Modified Files:
src/sys/kern: kern_descrip.c

Log Message:
Avoid unportable signed integer left shift in fd_copy()

Detected with Kernel Undefined Behavior Sanitizer.

There were at least a single place reported, for consistency fix all the
left bit shift operations.
sys/kern/kern_descrip.c:1492:3, left shift of 1 by 31 places cannot be 
represented in type 'int'
sys/kern/kern_descrip.c:1493:28, left shift of 1 by 31 places cannot be 
represented in type 'int'

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/kern_descrip.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/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.233 src/sys/kern/kern_descrip.c:1.234
--- src/sys/kern/kern_descrip.c:1.233	Tue Jul  3 22:49:51 2018
+++ src/sys/kern/kern_descrip.c	Tue Jul  3 23:11:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.233 2018/07/03 22:49:51 kamil Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.234 2018/07/03 23:11:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.233 2018/07/03 22:49:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.234 2018/07/03 23:11:06 kamil Exp $");
 
 #include 
 #include 
@@ -1489,13 +1489,13 @@ fd_copy(void)
 
 		/* Fix up bitmaps. */
 		j = i >> NDENTRYSHIFT;
-		KASSERT((newfdp->fd_lomap[j] & (1 << (i & NDENTRYMASK))) == 0);
-		newfdp->fd_lomap[j] |= 1 << (i & NDENTRYMASK);
+		KASSERT((newfdp->fd_lomap[j] & (1U << (i & NDENTRYMASK))) == 0);
+		newfdp->fd_lomap[j] |= 1U << (i & NDENTRYMASK);
 		if (__predict_false(newfdp->fd_lomap[j] == ~0)) {
 			KASSERT((newfdp->fd_himap[j >> NDENTRYSHIFT] &
-			(1 << (j & NDENTRYMASK))) == 0);
+			(1U << (j & NDENTRYMASK))) == 0);
 			newfdp->fd_himap[j >> NDENTRYSHIFT] |=
-			1 << (j & NDENTRYMASK);
+			1U << (j & NDENTRYMASK);
 		}
 		newlast = i;
 	}



CVS commit: src/sys/kern

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jul  3 22:49:51 UTC 2018

Modified Files:
src/sys/kern: kern_descrip.c

Log Message:
Avoid unportable signed integer left shift in fd_isused()

Detected with Kernel Undefined Behavior Sanitizer.

sys/kern/kern_descrip.c:188:34, left shift of 1 by 31 places cannot be 
represented in type 'int'

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/kern/kern_descrip.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/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.232 src/sys/kern/kern_descrip.c:1.233
--- src/sys/kern/kern_descrip.c:1.232	Tue Jul  3 12:17:54 2018
+++ src/sys/kern/kern_descrip.c	Tue Jul  3 22:49:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.232 2018/07/03 12:17:54 kamil Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.233 2018/07/03 22:49:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.232 2018/07/03 12:17:54 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.233 2018/07/03 22:49:51 kamil Exp $");
 
 #include 
 #include 
@@ -185,7 +185,7 @@ fd_isused(filedesc_t *fdp, unsigned fd)
 
 	KASSERT(fd < fdp->fd_dt->dt_nfiles);
 
-	return (fdp->fd_lomap[off] & (1 << (fd & NDENTRYMASK))) != 0;
+	return (fdp->fd_lomap[off] & (1U << (fd & NDENTRYMASK))) != 0;
 }
 
 /*



CVS commit: src/sys/sys

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jul  3 22:38:34 UTC 2018

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

Log Message:
Try to appease KUBSan in sys/sys/wait.h in W_EXITCODE()

Cast return value that is stored as int to unsigned int in order to
appease the << 8 operation. In case of a ret=-1, this cast is papering
things over or replacing UB with an implementation specific behavior.

There is a reverse operation with the same papering things over:
WEXITSTATUS(x)  ((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)

No functional change intended.

Detected with Kernel Undefined Behavior Sanitizer.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/sys/wait.h

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

Modified files:

Index: src/sys/sys/wait.h
diff -u src/sys/sys/wait.h:1.35 src/sys/sys/wait.h:1.36
--- src/sys/sys/wait.h:1.35	Thu Nov 10 18:35:17 2016
+++ src/sys/sys/wait.h	Tue Jul  3 22:38:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wait.h,v 1.35 2016/11/10 18:35:17 christos Exp $	*/
+/*	$NetBSD: wait.h,v 1.36 2018/07/03 22:38:33 kamil Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993, 1994
@@ -69,7 +69,7 @@
 #define	WCOREFLAG	0200
 #define WCOREDUMP(x)	(_W_INT(x) & WCOREFLAG)
 
-#define	W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
+#define	W_EXITCODE(ret, sig)	((unsigned int)(ret) << 8 | (sig))
 #define	W_STOPCODE(sig)		((sig) << 8 | _WSTOPPED)
 #define	W_CONTCODE()		(_WCONTINUED)
 #endif



CVS commit: src/external/mit/xorg/tools/mkfontscale

2018-07-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul  3 21:12:10 UTC 2018

Modified Files:
src/external/mit/xorg/tools/mkfontscale: Makefile

Log Message:
Use the fonts from our installed directory not the system when we are a tool!
Martin found it.
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/mit/xorg/tools/mkfontscale/Makefile

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

Modified files:

Index: src/external/mit/xorg/tools/mkfontscale/Makefile
diff -u src/external/mit/xorg/tools/mkfontscale/Makefile:1.12 src/external/mit/xorg/tools/mkfontscale/Makefile:1.13
--- src/external/mit/xorg/tools/mkfontscale/Makefile:1.12	Wed May  9 04:13:23 2018
+++ src/external/mit/xorg/tools/mkfontscale/Makefile	Tue Jul  3 17:12:10 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2018/05/09 08:13:23 mrg Exp $
+#	$NetBSD: Makefile,v 1.13 2018/07/03 21:12:10 christos Exp $
 
 .include 
 
@@ -81,7 +81,7 @@ LDADD=	-lz
 
 HOST_CPPFLAGS=	-DFONTENC_NO_LIBFONT -DXFREE86_FT2 -DFONTENC_NO_LIBFONT \
 		-DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
-		-DFONT_ENCODINGS_DIRECTORY=\"${X11FONTDIR}/encodings/encodings.dir\" \
+		-DFONT_ENCODINGS_DIRECTORY=\"${DESTDIR}${X11FONTDIR}/encodings/encodings.dir\" \
 		-DPACKAGE_STRING=\"NetBSD\ tools\ version\"
 HOST_CPPFLAGS+=	-DFT_CONFIG_OPTION_DISABLE_BZIP2
 



CVS commit: src/sys/dev/pci

2018-07-03 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul  3 19:56:02 UTC 2018

Modified Files:
src/sys/dev/pci: if_msk.c if_mskvar.h

Log Message:
fix detach code and do it on shutdown


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/if_mskvar.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.69 src/sys/dev/pci/if_msk.c:1.70
--- src/sys/dev/pci/if_msk.c:1.69	Tue Jul  3 18:07:36 2018
+++ src/sys/dev/pci/if_msk.c	Tue Jul  3 19:56:01 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.69 2018/07/03 18:07:36 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.70 2018/07/03 19:56:01 jdolecek Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.69 2018/07/03 18:07:36 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.70 2018/07/03 19:56:01 jdolecek Exp $");
 
 #include 
 #include 
@@ -539,22 +539,23 @@ msk_alloc_jumbo_mem(struct sk_if_softc *
 {
 	struct sk_softc		*sc = sc_if->sk_softc;
 	char *ptr, *kva;
-	bus_dma_segment_t	seg;
-	int		i, rseg, state, error;
+	int		i, state, error;
 	struct sk_jpool_entry   *entry;
 
 	state = error = 0;
 
 	/* Grab a big chunk o' storage. */
 	if (bus_dmamem_alloc(sc->sc_dmatag, MSK_JMEM, PAGE_SIZE, 0,
-			 , 1, , BUS_DMA_NOWAIT)) {
+	 _if->sk_cdata.sk_jumbo_seg, 1, _if->sk_cdata.sk_jumbo_nseg,
+	 BUS_DMA_NOWAIT)) {
 		aprint_error(": can't alloc rx buffers");
 		return (ENOBUFS);
 	}
 
 	state = 1;
-	if (bus_dmamem_map(sc->sc_dmatag, , rseg, MSK_JMEM, (void **),
-			   BUS_DMA_NOWAIT)) {
+	if (bus_dmamem_map(sc->sc_dmatag, _if->sk_cdata.sk_jumbo_seg,
+	sc_if->sk_cdata.sk_jumbo_nseg, MSK_JMEM, (void **),
+	BUS_DMA_NOWAIT)) {
 		aprint_error(": can't map dma buffers (%d bytes)", MSK_JMEM);
 		error = ENOBUFS;
 		goto out;
@@ -616,7 +617,9 @@ out:
 		case 2:
 			bus_dmamem_unmap(sc->sc_dmatag, kva, MSK_JMEM);
 		case 1:
-			bus_dmamem_free(sc->sc_dmatag, , rseg);
+			bus_dmamem_free(sc->sc_dmatag,
+			_if->sk_cdata.sk_jumbo_seg,
+			sc_if->sk_cdata.sk_jumbo_nseg);
 			break;
 		default:
 			break;
@@ -626,6 +629,18 @@ out:
 	return error;
 }
 
+static void
+msk_free_jumbo_mem(struct sk_if_softc *sc_if)
+{
+	struct sk_softc		*sc = sc_if->sk_softc;
+
+	bus_dmamap_unload(sc->sc_dmatag, sc_if->sk_cdata.sk_rx_jumbo_map);
+	bus_dmamap_destroy(sc->sc_dmatag, sc_if->sk_cdata.sk_rx_jumbo_map);
+	bus_dmamem_unmap(sc->sc_dmatag, sc_if->sk_cdata.sk_jumbo_buf, MSK_JMEM);
+	bus_dmamem_free(sc->sc_dmatag, _if->sk_cdata.sk_jumbo_seg,
+	sc_if->sk_cdata.sk_jumbo_nseg);
+}
+
 /*
  * Allocate a jumbo buffer.
  */
@@ -1220,7 +1235,7 @@ fail:
 int
 msk_detach(device_t self, int flags)
 {
-	struct sk_if_softc *sc_if = (struct sk_if_softc *)self;
+	struct sk_if_softc *sc_if = device_private(self);
 	struct sk_softc *sc = sc_if->sk_softc;
 	struct ifnet *ifp = _if->sk_ethercom.ec_if;
 
@@ -1247,6 +1262,8 @@ msk_detach(device_t self, int flags)
 	ether_ifdetach(ifp);
 	if_detach(ifp);
 
+	msk_free_jumbo_mem(sc_if);
+
 	bus_dmamem_unmap(sc->sc_dmatag, sc_if->sk_rdata,
 	sizeof(struct msk_ring_data));
 	bus_dmamem_free(sc->sc_dmatag,
@@ -1670,7 +1687,7 @@ fail_1:
 int
 mskc_detach(device_t self, int flags)
 {
-	struct sk_softc *sc = (struct sk_softc *)self;
+	struct sk_softc *sc = device_private(self);
 	int rv;
 
 	if (sc->sk_intrhand)
@@ -2518,11 +2535,11 @@ msk_stop(struct ifnet *ifp, int disable)
 #endif
 }
 
-CFATTACH_DECL_NEW(mskc, sizeof(struct sk_softc), mskc_probe, mskc_attach,
-	mskc_detach, NULL);
+CFATTACH_DECL3_NEW(mskc, sizeof(struct sk_softc), mskc_probe, mskc_attach,
+	mskc_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
 
-CFATTACH_DECL_NEW(msk, sizeof(struct sk_if_softc), msk_probe, msk_attach,
-	msk_detach, NULL);
+CFATTACH_DECL3_NEW(msk, sizeof(struct sk_if_softc), msk_probe, msk_attach,
+	msk_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
 
 #ifdef MSK_DEBUG
 void

Index: src/sys/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.16 src/sys/dev/pci/if_mskvar.h:1.17
--- src/sys/dev/pci/if_mskvar.h:1.16	Tue Jul  3 18:07:36 2018
+++ src/sys/dev/pci/if_mskvar.h	Tue Jul  3 19:56:01 2018
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.16 2018/07/03 18:07:36 jdolecek Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.17 2018/07/03 19:56:01 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -123,6 +123,8 @@ struct msk_chain_data {
 	/* Stick the jumbo mem management stuff here too. */
 	void *			sk_jslots[MSK_JSLOTS];
 	void			*sk_jumbo_buf;
+	bus_dma_segment_t	sk_jumbo_seg;
+	int			sk_jumbo_nseg;
 };
 
 struct msk_ring_data {



CVS commit: src/sys/kern

2018-07-03 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul  3 18:09:28 UTC 2018

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
add DIAGNOSTIC check for rnd_attach_source() being called twice for same
rnd source; it's driver error, and it breaks rnd source list pointers


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/kern/kern_rndq.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/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.89 src/sys/kern/kern_rndq.c:1.90
--- src/sys/kern/kern_rndq.c:1.89	Sat May 21 15:27:15 2016
+++ src/sys/kern/kern_rndq.c	Tue Jul  3 18:09:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.89 2016/05/21 15:27:15 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.90 2018/07/03 18:09:28 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.89 2016/05/21 15:27:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.90 2018/07/03 18:09:28 jdolecek Exp $");
 
 #include 
 #include 
@@ -747,6 +747,18 @@ rnd_attach_source(krndsource_t *rs, cons
 	rs->state = rnd_sample_allocate(rs);
 
 	mutex_spin_enter(_global.lock);
+
+#ifdef DIAGNOSTIC
+	krndsource_t *s;
+	LIST_FOREACH(s, _global.sources, list) {
+		if (s == rs) {
+			panic("%s: source '%s' already attached",
+			__func__, name);
+			/* NOTREACHED */
+		}
+	}
+#endif
+
 	LIST_INSERT_HEAD(_global.sources, rs, list);
 
 #ifdef RND_VERBOSE



CVS commit: src/sys/dev/pci

2018-07-03 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul  3 18:07:36 UTC 2018

Modified Files:
src/sys/dev/pci: if_msk.c if_mskvar.h if_sk.c if_skvar.h

Log Message:
attach the rnd source only once even with dual-port adapters


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_mskvar.h
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pci/if_sk.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_skvar.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.68 src/sys/dev/pci/if_msk.c:1.69
--- src/sys/dev/pci/if_msk.c:1.68	Mon Jul  2 06:03:13 2018
+++ src/sys/dev/pci/if_msk.c	Tue Jul  3 18:07:36 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.68 2018/07/02 06:03:13 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.69 2018/07/03 18:07:36 jdolecek Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.68 2018/07/02 06:03:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.69 2018/07/03 18:07:36 jdolecek Exp $");
 
 #include 
 #include 
@@ -1199,8 +1199,10 @@ msk_attach(device_t parent, device_t sel
 	else
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	rnd_attach_source(>rnd_source, device_xname(sc->sk_dev),
-		RND_TYPE_NET, RND_FLAG_DEFAULT);
+	if (sc->rnd_attached++ == 0) {
+		rnd_attach_source(>rnd_source, device_xname(sc->sk_dev),
+			RND_TYPE_NET, RND_FLAG_DEFAULT);
+	}
 
 	DPRINTFN(2, ("msk_attach: end\n"));
 	return;
@@ -1227,7 +1229,8 @@ msk_detach(device_t self, int flags)
 
 	msk_stop(ifp, 0);
 
-	rnd_detach_source(>rnd_source);
+	if (--sc->rnd_attached == 0)
+		rnd_detach_source(>rnd_source);
 
 	callout_halt(_if->sk_tick_ch, NULL);
 	callout_destroy(_if->sk_tick_ch);
@@ -2148,6 +2151,7 @@ msk_intr(void *xsc)
 	if (ifp1 != NULL && !IFQ_IS_EMPTY(>if_snd))
 		if_schedule_deferred_start(ifp1);
 
+	KASSERT(sc->rnd_attached > 0);
 	rnd_add_uint32(>rnd_source, status);
 
 	if (sc->sk_int_mod_pending)

Index: src/sys/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.15 src/sys/dev/pci/if_mskvar.h:1.16
--- src/sys/dev/pci/if_mskvar.h:1.15	Mon Jul  2 06:03:13 2018
+++ src/sys/dev/pci/if_mskvar.h	Tue Jul  3 18:07:36 2018
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.15 2018/07/02 06:03:13 jdolecek Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.16 2018/07/03 18:07:36 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -209,7 +209,8 @@ struct sk_softc {
 	int			sk_status_nseg;
 	int			sk_status_idx;
 	int			sk_status_own_idx;
-	krndsource_t rnd_source;
+	u_int8_t		rnd_attached;
+	krndsource_t		rnd_source;
 };
 
 /* Softc for each logical interface */

Index: src/sys/dev/pci/if_sk.c
diff -u src/sys/dev/pci/if_sk.c:1.87 src/sys/dev/pci/if_sk.c:1.88
--- src/sys/dev/pci/if_sk.c:1.87	Tue Jun 26 06:48:01 2018
+++ src/sys/dev/pci/if_sk.c	Tue Jul  3 18:07:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sk.c,v 1.87 2018/06/26 06:48:01 msaitoh Exp $	*/
+/*	$NetBSD: if_sk.c,v 1.88 2018/07/03 18:07:36 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.87 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.88 2018/07/03 18:07:36 jdolecek Exp $");
 
 #include 
 #include 
@@ -1462,8 +1462,10 @@ sk_attach(device_t parent, device_t self
 
 	ether_ifattach(ifp, sc_if->sk_enaddr);
 
-rnd_attach_source(>rnd_source, device_xname(sc->sk_dev),
-RND_TYPE_NET, RND_FLAG_DEFAULT);
+	if (sc->rnd_attached++ == 0) {
+	rnd_attach_source(>rnd_source, device_xname(sc->sk_dev),
+		RND_TYPE_NET, RND_FLAG_DEFAULT);
+	}
 
 	if (pmf_device_register(self, NULL, sk_resume))
 		pmf_class_network_register(self, ifp);
@@ -2400,6 +2402,7 @@ sk_intr(void *xsc)
 	if (ifp1 != NULL)
 		if_schedule_deferred_start(ifp1);
 
+	KASSERT(sc->rnd_attached > 0);
 	rnd_add_uint32(>rnd_source, status);
 
 	if (sc->sk_int_mod_pending)

Index: src/sys/dev/pci/if_skvar.h
diff -u src/sys/dev/pci/if_skvar.h:1.18 src/sys/dev/pci/if_skvar.h:1.19
--- src/sys/dev/pci/if_skvar.h:1.18	Mon Apr 13 16:33:25 2015
+++ src/sys/dev/pci/if_skvar.h	Tue Jul  3 18:07:36 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_skvar.h,v 1.18 2015/04/13 16:33:25 riastradh Exp $ */
+/* $NetBSD: if_skvar.h,v 1.19 2018/07/03 18:07:36 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -200,7 +200,8 @@ struct sk_softc {
 	int			sk_int_mod_pending;
 	bus_dma_tag_t		sc_dmatag;
 	struct sk_if_softc	*sk_if[2];
-	krndsource_t rnd_source;
+	u_int8_t		rnd_attached;
+	krndsource_t		rnd_source;
 };
 
 /* Softc for each logical interface */



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:30:13 UTC 2018

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

Log Message:
Dump clock tree with aprint_debug instead of printf


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos5422_clock.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/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.9 src/sys/arch/arm/samsung/exynos5422_clock.c:1.10
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.9	Tue Jul  3 16:06:41 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Jul  3 16:30:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.10 2018/07/03 16:30:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.10 2018/07/03 16:30:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -648,9 +648,9 @@ exynos5422_clock_find_by_id(u_int clock_
 static void
 exynos5422_clock_print_header(void)
 {
-	printf("  %-10s %2s %-10s %-5s %10s\n",
+	aprint_debug("  %-10s %2s %-10s %-5s %10s\n",
 	"clock", "", "parent", "type", "rate");
-	printf("  %-10s %2s %-10s %-5s %10s\n",
+	aprint_debug("  %-10s %2s %-10s %-5s %10s\n",
 	"=", "", "==", "", "");
 }
 
@@ -683,7 +683,7 @@ exynos5422_clock_print(struct exynos5422
 	clk_parent = exynos5422_clock_get_parent(sc, >base);
 	eclk_parent = (struct exynos_clk *)clk_parent;
 
-	printf("  %-10s %2s %-10s %-5s %10d Hz\n",
+	aprint_debug("  %-10s %2s %-10s %-5s %10d Hz\n",
 	eclk->base.name,
 	eclk_parent ? "<-" : "",
 	eclk_parent ? eclk_parent->base.name : "",



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:22:48 UTC 2018

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

Log Message:
Fix value of PHY_CLK_RST_FSEL_24M, USB2 on XHCI works now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_usbdrdphy.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_usbdrdphy.c
diff -u src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.1 src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.2
--- src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.1	Tue Jul  3 16:09:04 2018
+++ src/sys/arch/arm/samsung/exynos_usbdrdphy.c	Tue Jul  3 16:22:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_usbdrdphy.c,v 1.1 2018/07/03 16:09:04 jmcneill Exp $ */
+/* $NetBSD: exynos_usbdrdphy.c,v 1.2 2018/07/03 16:22:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.1 2018/07/03 16:09:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.2 2018/07/03 16:22:48 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_usbdr
 #define	 PHY_CLK_RST_MPLL_MULT		__BITS(17,11)
 #define	  PHY_CLK_RST_MPLL_MULT_24M	0x68
 #define	 PHY_CLK_RST_FSEL		__BITS(10,5)
-#define	  PHY_CLK_RST_FSEL_24M		0x2a
+#define	  PHY_CLK_RST_FSEL_24M		0x5
 #define	 PHY_CLK_RST_RETENABLEN		__BIT(4)
 #define	 PHY_CLK_RST_REFCLKSEL		__BITS(3,2)
 #define	  PHY_CLK_RST_REFCLKSEL_EXT	3



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:09:40 UTC 2018

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

Log Message:
Enable Exynos USB support


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/conf/EXYNOS

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/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.27 src/sys/arch/evbarm/conf/EXYNOS:1.28
--- src/sys/arch/evbarm/conf/EXYNOS:1.27	Mon Jul  2 12:53:51 2018
+++ src/sys/arch/evbarm/conf/EXYNOS	Tue Jul  3 16:09:40 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.27 2018/07/02 12:53:51 jmcneill Exp $
+#	$NetBSD: EXYNOS,v 1.28 2018/07/03 16:09:40 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -48,6 +48,9 @@ fclock*		at fdt? pass 4
 fregulator*	at fdt? pass 4
 gpiokeys*	at fdt?
 
+# System Controller
+syscon*		at fdt? pass 1		# Generic System Controller
+
 # Timer
 mct*		at fdt? pass 2		# Exynos Multi Core Timer (MCT)
 gtmr*		at fdt? pass 2
@@ -86,12 +89,12 @@ ld3		at sdmmc3
 ld*		at sdmmc?
 
 # USB
-exyousbphy*	at fdt?
-exyousb*	at fdt?
-ohci*		at fdt?			# OUSB
-ehci*		at fdt?			# EUSB
-usb*		at ohci?
-usb*		at ehci?
+exusbphy*	at fdt? pass 9		# Samsung Exynos USB2 PHY
+exusbdrdphy*	at fdt? pass 9		# Samsung Exynos USB3 DRD PHY
+ohci*		at fdt?			# OHCI
+ehci*		at fdt?			# EHCI
+xhci*		at fdt?			# XHCI
+usb*		at usbus?
 
 include "dev/usb/usbdevices.config"
 midi*		at midibus?



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:09:04 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_ehci.c exynos_ohci.c exynos_usbphy.c
files.exynos
Added Files:
src/sys/arch/arm/samsung: exynos_usbdrdphy.c
Removed Files:
src/sys/arch/arm/samsung: exynos_usb3.c

Log Message:
Add support for Samsung Exynos USB.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_ehci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_ohci.c
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/samsung/exynos_usb3.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_usbdrdphy.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_usbphy.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/files.exynos

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_ehci.c
diff -u src/sys/arch/arm/samsung/exynos_ehci.c:1.3 src/sys/arch/arm/samsung/exynos_ehci.c:1.4
--- src/sys/arch/arm/samsung/exynos_ehci.c:1.3	Mon Apr  9 16:21:09 2018
+++ src/sys/arch/arm/samsung/exynos_ehci.c	Tue Jul  3 16:09:04 2018
@@ -1,12 +1,9 @@
-/*	$NetBSD: exynos_ehci.c,v 1.3 2018/04/09 16:21:09 jakllsch Exp $	*/
+/* $NetBSD: exynos_ehci.c,v 1.4 2018/07/03 16:09:04 jmcneill Exp $ */
 
 /*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2015-2018 Jared McNeill 
  * All rights reserved.
  *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Reinoud Zandijk.
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -16,107 +13,132 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
-#include "locators.h"
-#include "ohci.h"
-#include "ehci.h"
-
 #include 
-
-__KERNEL_RCSID(1, "$NetBSD: exynos_ehci.c,v 1.3 2018/04/09 16:21:09 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_ehci.c,v 1.4 2018/07/03 16:09:04 jmcneill Exp $");
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
-
 #include 
 #include 
 
-#include 
-#include 
-
 #include 
 
 static int	exynos_ehci_match(device_t, cfdata_t, void *);
 static void	exynos_ehci_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(exynos_ehci, sizeof(struct ehci_softc),
-exynos_ehci_match, exynos_ehci_attach, NULL, NULL);
-
+CFATTACH_DECL2_NEW(exynos_ehci, sizeof(struct ehci_softc),
+	exynos_ehci_match, exynos_ehci_attach, NULL,
+	ehci_activate, NULL, ehci_childdet);
 
 static int
 exynos_ehci_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = { "samsung,exynos5-ehci",
-	NULL };
+	const char * const compatible[] = {
+		"samsung,exynos4210-ehci",
+		NULL
+	};
 	struct fdt_attach_args * const faa = aux;
+
 	return of_match_compatible(faa->faa_phandle, compatible);
 }
 
-
 static void
 exynos_ehci_attach(device_t parent, device_t self, void *aux)
 {
-	struct ehci_softc *sc = device_private(self);
+	struct ehci_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
+	const int phandle = 

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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:06:41 UTC 2018

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

Log Message:
Add more USB3 clocks


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos5422_clock.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/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.8 src/sys/arch/arm/samsung/exynos5422_clock.c:1.9
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.8	Tue Jul  3 09:39:32 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Jul  3 16:06:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $");
 
 #include 
 #include 
@@ -378,6 +378,7 @@ static const struct clk_funcs exynos5422
 #define EXYNOS5422_SRC_TOP12		0x10288
 
 #define EXYNOS5422_DIV_TOP0		0x10500
+#define EXYNOS5422_DIV_FSYS0		0x10548
 #define EXYNOS5422_DIV_FSYS1		0x1054c
 #define EXYNOS5422_DIV_PERIC0		0x10558
 
@@ -461,6 +462,10 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUX("mout_aclk200_fsys2", EXYNOS5422_SRC_TOP0, __BITS(13,12),
 	mout_group1_p),
 
+	CLK_MUX("mout_usbd301", EXYNOS5422_SRC_FSYS, __BITS(6,4),
+	mout_group2_p),
+	CLK_MUX("mout_usbd300", EXYNOS5422_SRC_FSYS, __BITS(22,20),
+	mout_group2_p),
 	CLK_MUX("mout_mmc0", EXYNOS5422_SRC_FSYS, __BITS(10,8),
 	mout_group2_p),
 	CLK_MUX("mout_mmc1", EXYNOS5422_SRC_FSYS, __BITS(14,12),
@@ -479,6 +484,10 @@ static struct exynos_clk exynos5422_cloc
 	CLK_DIV("dout_aclk200_fsys", "mout_aclk200_fsys", EXYNOS5422_DIV_TOP0, __BITS(30,28)),
 	CLK_DIV("dout_aclk200_fsys2", "mout_aclk200_fsys2", EXYNOS5422_DIV_TOP0, __BITS(14,12)),
 
+	CLK_DIV("dout_usbphy301", "mout_usbd301", EXYNOS5422_DIV_FSYS0, __BITS(15,12)),
+	CLK_DIV("dout_usbphy300", "mout_usbd300", EXYNOS5422_DIV_FSYS0, __BITS(19,16)),
+	CLK_DIV("dout_usbd301", "mout_usbd301", EXYNOS5422_DIV_FSYS0, __BITS(23,20)),
+	CLK_DIV("dout_usbd300", "mout_usbd300", EXYNOS5422_DIV_FSYS0, __BITS(27,24)),
 	CLK_DIV("dout_mmc0", "mout_mmc0", EXYNOS5422_DIV_FSYS1, __BITS(9,0)),
 	CLK_DIV("dout_mmc1", "mout_mmc1", EXYNOS5422_DIV_FSYS1, __BITS(19,10)),
 	CLK_DIV("dout_mmc2", "mout_mmc2", EXYNOS5422_DIV_FSYS1, __BITS(29,20)),
@@ -502,6 +511,14 @@ static struct exynos_clk exynos5422_cloc
 	__BIT(1), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_mmc2", "dout_mmc2", EXYNOS5422_GATE_TOP_SCLK_FSYS,
 	__BIT(2), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbphy301", "dout_usbphy301", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(7), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbphy300", "dout_usbphy300", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(8), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbd300", "dout_usbd300", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(9), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbd301", "dout_usbd301", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(10), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_uart0", "dout_uart0", EXYNOS5422_GATE_TOP_SCLK_PERIC,
 	__BIT(0), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_uart1", "dout_uart1", EXYNOS5422_GATE_TOP_SCLK_PERIC,



CVS commit: src/sys/dev/fdt

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:05:31 UTC 2018

Modified Files:
src/sys/dev/fdt: dwc3_fdt.c

Log Message:
Add support for Samsung Exynos USB3 DRD.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/dwc3_fdt.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/fdt/dwc3_fdt.c
diff -u src/sys/dev/fdt/dwc3_fdt.c:1.4 src/sys/dev/fdt/dwc3_fdt.c:1.5
--- src/sys/dev/fdt/dwc3_fdt.c:1.4	Tue Jul  3 08:52:36 2018
+++ src/sys/dev/fdt/dwc3_fdt.c	Tue Jul  3 16:05:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc3_fdt.c,v 1.4 2018/07/03 08:52:36 jmcneill Exp $ */
+/* $NetBSD: dwc3_fdt.c,v 1.5 2018/07/03 16:05:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.4 2018/07/03 08:52:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.5 2018/07/03 16:05:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,6 +52,9 @@ __KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v
 #define	  GCTL_PRTCAP_OTG		3
 #define	 GCTL_CORESOFTRESET		__BIT(11)
 
+#define	DWC3_SNPSID			0xc120
+#define	 DWC3_SNPSID_REV		__BITS(15,0)
+
 #define	DWC3_GUSB2PHYCFG(n)		(0xc200 + ((n) * 4))
 #define	 GUSB2PHYCFG_PHYSOFTRST		__BIT(31)
 #define	 GUSB2PHYCFG_U2_FREECLK_EXISTS	__BIT(30)
@@ -62,6 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v
 
 #define	DWC3_GUSB3PIPECTL(n)		(0xc2c0 + ((n) * 4))
 #define	 GUSB3PIPECTL_PHYSOFTRST	__BIT(31)
+#define	 GUSB3PIPECTL_UX_EXIT_PX	__BIT(27)
+#define	 GUSB3PIPECTL_SUSPHY		__BIT(17)
 
 #define	DWC3_DCFG			0xc700
 #define	 DCFG_SPEED			__BITS(2,0)
@@ -140,6 +145,12 @@ dwc3_fdt_enable_phy(struct xhci_softc *s
 		val &= ~GUSB2PHYCFG_SUSPHY;
 	WR4(sc, DWC3_GUSB2PHYCFG(0), val);
 
+	val = RD4(sc, DWC3_GUSB3PIPECTL(0));
+	val &= ~GUSB3PIPECTL_UX_EXIT_PX;
+	if (of_hasprop(phandle, "snps,dis_u3_susphy_quirk"))
+		val &= ~GUSB3PIPECTL_SUSPHY;
+	WR4(sc, DWC3_GUSB3PIPECTL(0), val);
+
 	max_speed = fdtbus_get_string(phandle, "maximum-speed");
 	if (max_speed == NULL)
 		max_speed = "super-speed";
@@ -176,6 +187,7 @@ dwc3_fdt_match(device_t parent, cfdata_t
 	const char * const compatible[] = {
 		"allwinner,sun50i-h6-dwc3",
 		"rockchip,rk3328-dwc3",
+		"samsung,exynos5250-dwusb3",
 		NULL
 	};
 	struct fdt_attach_args * const faa = aux;
@@ -242,13 +254,18 @@ dwc3_fdt_attach(device_t parent, device_
 	}
 
 	aprint_naive("\n");
-	aprint_normal(": DesignWare USB3 XHCI\n");
-
-	/* Enable phy */
+	aprint_normal(": DesignWare USB3 XHCI");
+	const uint32_t snpsid = RD4(sc, DWC3_SNPSID);
+	const u_int rev = __SHIFTOUT(snpsid, DWC3_SNPSID_REV);
+	aprint_normal(" (rev. %d.%03x)\n", rev >> 12, rev & 0xfff);
+
+	/* Enable PHY devices */
+	phy = fdtbus_phy_get(dwc3_phandle, "usb2-phy");
+	if (phy && fdtbus_phy_enable(phy, true) != 0)
+		aprint_error_dev(self, "couldn't enable usb2-phy\n");
 	phy = fdtbus_phy_get(dwc3_phandle, "usb3-phy");
-	if (!phy || fdtbus_phy_enable(phy, true) != 0) {
+	if (phy && fdtbus_phy_enable(phy, true) != 0)
 		aprint_error_dev(self, "couldn't enable usb3-phy\n");
-	}
 
 	dwc3_fdt_soft_reset(sc);
 	dwc3_fdt_enable_phy(sc, phandle);



CVS commit: src/sys/kern

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jul  3 12:17:54 UTC 2018

Modified Files:
src/sys/kern: kern_descrip.c

Log Message:
Avoid unportable signed integer left shift in fd_used()

Detected with Kernel Undefined Behavior Sanitizer.

There were at least a single place reported, for consistency fix all the
left bit shift operations.
sys/kern/kern_descrip.c:302:26, left shift of 1 by 31 places cannot be 
represented in type 'int'

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/sys/kern/kern_descrip.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/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.231 src/sys/kern/kern_descrip.c:1.232
--- src/sys/kern/kern_descrip.c:1.231	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/kern_descrip.c	Tue Jul  3 12:17:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.231 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.232 2018/07/03 12:17:54 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.231 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.232 2018/07/03 12:17:54 kamil Exp $");
 
 #include 
 #include 
@@ -293,17 +293,17 @@ fd_used(filedesc_t *fdp, unsigned fd)
 	ff = fdp->fd_dt->dt_ff[fd];
 
 	KASSERT(mutex_owned(>fd_lock));
-	KASSERT((fdp->fd_lomap[off] & (1 << (fd & NDENTRYMASK))) == 0);
+	KASSERT((fdp->fd_lomap[off] & (1U << (fd & NDENTRYMASK))) == 0);
 	KASSERT(ff != NULL);
 	KASSERT(ff->ff_file == NULL);
 	KASSERT(!ff->ff_allocated);
 
 	ff->ff_allocated = true;
-	fdp->fd_lomap[off] |= 1 << (fd & NDENTRYMASK);
+	fdp->fd_lomap[off] |= 1U << (fd & NDENTRYMASK);
 	if (__predict_false(fdp->fd_lomap[off] == ~0)) {
 		KASSERT((fdp->fd_himap[off >> NDENTRYSHIFT] &
-		(1 << (off & NDENTRYMASK))) == 0);
-		fdp->fd_himap[off >> NDENTRYSHIFT] |= 1 << (off & NDENTRYMASK);
+		(1U << (off & NDENTRYMASK))) == 0);
+		fdp->fd_himap[off >> NDENTRYSHIFT] |= 1U << (off & NDENTRYMASK);
 	}
 
 	if ((int)fd > fdp->fd_lastfile) {



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 12:12:03 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Make IRQ sharing work again


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/fdt/gic_fdt.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/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.10 src/sys/arch/arm/fdt/gic_fdt.c:1.11
--- src/sys/arch/arm/fdt/gic_fdt.c:1.10	Wed Jun 20 05:50:09 2018
+++ src/sys/arch/arm/fdt/gic_fdt.c	Tue Jul  3 12:12:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.10 2018/06/20 05:50:09 hkenken Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.11 2018/07/03 12:12:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.10 2018/06/20 05:50:09 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.11 2018/07/03 12:12:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -75,6 +75,7 @@ struct gic_fdt_irqhandler {
 struct gic_fdt_irq {
 	struct gic_fdt_softc	*intr_sc;
 	void			*intr_ih;
+	void			*intr_arg;
 	int			intr_refcnt;
 	int			intr_ipl;
 	int			intr_level;
@@ -188,6 +189,7 @@ gic_fdt_establish(device_t dev, u_int *s
 		firq = kmem_alloc(sizeof(*firq), KM_SLEEP);
 		firq->intr_sc = sc;
 		firq->intr_refcnt = 0;
+		firq->intr_arg = arg;
 		firq->intr_ipl = ipl;
 		firq->intr_level = level;
 		firq->intr_mpsafe = mpsafe;
@@ -206,7 +208,7 @@ gic_fdt_establish(device_t dev, u_int *s
 		}
 		sc->sc_irq[irq] = firq;
 	} else {
-		if (arg) {
+		if (firq->intr_arg == NULL && arg != NULL) {
 			device_printf(dev, "cannot share irq with NULL arg\n");
 			return NULL;
 		}



CVS commit: src/sys/arch/x86/x86

2018-07-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jul  3 11:45:54 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Avoid unportable signed integer left shift in intr_calculatemasks()

Detected with Kernel Undefined Behavior Sanitizer.

There were at least two places reported, for consistency fix all the
left shift bit shift.

src/sys/arch/x86/x86/intr.c:339:22, left shift of 1 by 31 places cannot be 
represented in type 'int'
src/sys/arch/x86/x86/intr.c:347:15, left shift of 1 by 31 places cannot be 
represented in type 'int'

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/x86/x86/intr.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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.126 src/sys/arch/x86/x86/intr.c:1.127
--- src/sys/arch/x86/x86/intr.c:1.126	Sun Jun 24 13:35:33 2018
+++ src/sys/arch/x86/x86/intr.c	Tue Jul  3 11:45:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.126 2018/06/24 13:35:33 jdolecek Exp $	*/
+/*	$NetBSD: intr.c,v 1.127 2018/07/03 11:45:54 kamil Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.126 2018/06/24 13:35:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.127 2018/07/03 11:45:54 kamil Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -334,18 +334,18 @@ intr_calculatemasks(struct cpu_info *ci)
 			continue;
 		}
 		for (q = ci->ci_isources[irq]->is_handlers; q; q = q->ih_next)
-			levels |= 1 << q->ih_level;
+			levels |= 1U << q->ih_level;
 		intrlevel[irq] = levels;
 		if (levels)
-			unusedirqs &= ~(1 << irq);
+			unusedirqs &= ~(1U << irq);
 	}
 
 	/* Then figure out which IRQs use each level. */
 	for (level = 0; level < NIPL; level++) {
 		int irqs = 0;
 		for (irq = 0; irq < MAX_INTR_SOURCES; irq++)
-			if (intrlevel[irq] & (1 << level))
-irqs |= 1 << irq;
+			if (intrlevel[irq] & (1U << level))
+irqs |= 1U << irq;
 		ci->ci_imask[level] = irqs | unusedirqs;
 	}
 



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 09:39:32 UTC 2018

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

Log Message:
Add USB clocks and missing MMC biu clocks


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos5422_clock.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/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.7 src/sys/arch/arm/samsung/exynos5422_clock.c:1.8
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.7	Mon Jul  2 20:24:55 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Jul  3 09:39:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -374,14 +374,17 @@ static const struct clk_funcs exynos5422
 #define EXYNOS5422_SRC_PERIC1		0x10254
 #define EXYNOS5422_SRC_ISP		0x10270
 #define EXYNOS5422_SRC_TOP10		0x10280
-#define EXYNOS5422_SRC_TOP11		0x10280
-#define EXYNOS5422_SRC_TOP12		0x10280
+#define EXYNOS5422_SRC_TOP11		0x10284
+#define EXYNOS5422_SRC_TOP12		0x10288
 
+#define EXYNOS5422_DIV_TOP0		0x10500
 #define EXYNOS5422_DIV_FSYS1		0x1054c
 #define EXYNOS5422_DIV_PERIC0		0x10558
 
+#define	EXYNOS5422_GATE_BUS_FSYS0	0x10740
 #define EXYNOS5422_GATE_TOP_SCLK_FSYS	0x10840
 #define EXYNOS5422_GATE_TOP_SCLK_PERIC	0x10850
+#define	EXYNOS5422_GATE_IP_FSYS		0x10944
 
 static const char *mout_cpll_p[] = { "fin_pll", "fout_cpll" };
 static const char *mout_dpll_p[] = { "fin_pll", "fout_dpll" };
@@ -390,9 +393,19 @@ static const char *mout_spll_p[] = { "fi
 static const char *mout_ipll_p[] = { "fin_pll", "fout_ipll" };
 static const char *mout_epll_p[] = { "fin_pll", "fout_epll" };
 static const char *mout_rpll_p[] = { "fin_pll", "fout_rpll" };
+static const char *mout_group1_p[] =
+	{ "sclk_cpll", "sclk_dpll", "sclk_mpp" };
 static const char *mout_group2_p[] =
 	{ "fin_pll", "sclk_cpll", "sclk_dpll", "sclk_mpll",
 	  "sclk_spll", "sclk_ipll", "sclk_epll", "sclk_rpll" };
+static const char *mout_user_aclk200_fsys_p[] =
+	{ "fin_pll", "mout_sw_aclk200_fsys" };
+static const char *mout_user_aclk200_fsys2_p[] =
+	{ "fin_pll", "mout_sw_aclk200_fsys2" };
+static const char *mout_sw_aclk200_fsys_p[] =
+	{ "dout_aclk200_fsys", "sclk_spll" };
+static const char *mout_sw_aclk200_fsys2_p[] =
+	{ "dout_aclk200_fsys2", "sclk_spll" };
 
 static struct exynos_clk exynos5422_clocks[] = {
 	CLK_FIXED("fin_pll", EXYNOS_F_IN_FREQ),
@@ -435,6 +448,19 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUXF("sclk_rpll", "mout_rpll", EXYNOS5422_SRC_TOP6, __BIT(16),
 	CLK_SET_RATE_PARENT, mout_rpll_p),
 
+	CLK_MUX("mout_sw_aclk200_fsys", EXYNOS5422_SRC_TOP10, __BIT(24),
+	mout_sw_aclk200_fsys_p),
+	CLK_MUX("mout_sw_aclk200_fsys2", EXYNOS5422_SRC_TOP10, __BIT(12),
+	mout_sw_aclk200_fsys2_p),
+	CLK_MUX("mout_user_aclk200_fsys", EXYNOS5422_SRC_TOP3, __BIT(28),
+	mout_user_aclk200_fsys_p),
+	CLK_MUX("mout_user_aclk200_fsys2", EXYNOS5422_SRC_TOP3, __BIT(12),
+	mout_user_aclk200_fsys2_p),
+	CLK_MUX("mout_aclk200_fsys", EXYNOS5422_SRC_TOP0, __BITS(25,24),
+	mout_group1_p),
+	CLK_MUX("mout_aclk200_fsys2", EXYNOS5422_SRC_TOP0, __BITS(13,12),
+	mout_group1_p),
+
 	CLK_MUX("mout_mmc0", EXYNOS5422_SRC_FSYS, __BITS(10,8),
 	mout_group2_p),
 	CLK_MUX("mout_mmc1", EXYNOS5422_SRC_FSYS, __BITS(14,12),
@@ -450,6 +476,9 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUX("mout_uart3", EXYNOS5422_SRC_PERIC0, __BITS(18,16),
 	mout_group2_p),
 
+	CLK_DIV("dout_aclk200_fsys", "mout_aclk200_fsys", EXYNOS5422_DIV_TOP0, __BITS(30,28)),
+	CLK_DIV("dout_aclk200_fsys2", "mout_aclk200_fsys2", EXYNOS5422_DIV_TOP0, __BITS(14,12)),
+
 	CLK_DIV("dout_mmc0", "mout_mmc0", EXYNOS5422_DIV_FSYS1, __BITS(9,0)),
 	CLK_DIV("dout_mmc1", "mout_mmc1", EXYNOS5422_DIV_FSYS1, __BITS(19,10)),
 	CLK_DIV("dout_mmc2", "mout_mmc2", EXYNOS5422_DIV_FSYS1, __BITS(29,20)),
@@ -462,6 +491,11 @@ static struct exynos_clk exynos5422_cloc
 	CLK_DIV("dout_uart3", "mout_uart3", EXYNOS5422_DIV_PERIC0,
 	__BITS(23,20)),
 
+	CLK_GATE("aclk200_fsys", "mout_user_aclk200_fsys", EXYNOS5422_GATE_BUS_FSYS0,
+	__BIT(9), CLK_SET_RATE_PARENT),
+	CLK_GATE("aclk200_fsys2", "mout_user_aclk200_fsys2", EXYNOS5422_GATE_BUS_FSYS0,
+	__BIT(10), CLK_SET_RATE_PARENT),
+
 	CLK_GATE("sclk_mmc0", "dout_mmc0", EXYNOS5422_GATE_TOP_SCLK_FSYS,
 	__BIT(0), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_mmc1", "dout_mmc1", EXYNOS5422_GATE_TOP_SCLK_FSYS,
@@ -476,6 +510,19 @@ static struct exynos_clk 

CVS commit: src/sys/dev/fdt

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 08:52:36 UTC 2018

Modified Files:
src/sys/dev/fdt: dwc3_fdt.c

Log Message:
Fix name of snps,dis_u2_susphy_quirk property


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/dwc3_fdt.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/fdt/dwc3_fdt.c
diff -u src/sys/dev/fdt/dwc3_fdt.c:1.3 src/sys/dev/fdt/dwc3_fdt.c:1.4
--- src/sys/dev/fdt/dwc3_fdt.c:1.3	Fri Jun 29 17:48:24 2018
+++ src/sys/dev/fdt/dwc3_fdt.c	Tue Jul  3 08:52:36 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc3_fdt.c,v 1.3 2018/06/29 17:48:24 msaitoh Exp $ */
+/* $NetBSD: dwc3_fdt.c,v 1.4 2018/07/03 08:52:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.3 2018/06/29 17:48:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.4 2018/07/03 08:52:36 jmcneill Exp $");
 
 #include 
 #include 
@@ -136,7 +136,7 @@ dwc3_fdt_enable_phy(struct xhci_softc *s
 		val &= ~GUSB2PHYCFG_ENBLSLPM;
 	if (of_hasprop(phandle, "snps,dis-u2-freeclk-exists-quirk"))
 		val &= ~GUSB2PHYCFG_U2_FREECLK_EXISTS;
-	if (of_hasprop(phandle, "snps,dis-u2-susphy-quirk"))
+	if (of_hasprop(phandle, "snps,dis_u2_susphy_quirk"))
 		val &= ~GUSB2PHYCFG_SUSPHY;
 	WR4(sc, DWC3_GUSB2PHYCFG(0), val);
 



CVS commit: [netbsd-8] src/doc

2018-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  3 07:13:41 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Note NetBSD.org fixes in release docs


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.219 -r1.1.2.220 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.219 src/doc/CHANGES-8.0:1.1.2.220
--- src/doc/CHANGES-8.0:1.1.2.219	Mon Jun 25 13:01:26 2018
+++ src/doc/CHANGES-8.0	Tue Jul  3 07:13:41 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.219 2018/06/25 13:01:26 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.220 2018/07/03 07:13:41 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -14118,3 +14118,9 @@ distrib/common/Makefile.bootcd
 doc/CHANGES-8.0
 
 	Tag moved for additional RC2 pullups (#892, #904)
+
+distrib/notes/amd64/prep			(manually edited)
+distrib/notes/evbarm/install			(manually edited)
+distrib/notes/i386/prep(manually edited)
+
+	Fix NetBSD.org capitalization in some URLs.



CVS commit: [netbsd-8] src/distrib/notes

2018-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul  3 07:11:48 UTC 2018

Modified Files:
src/distrib/notes/amd64 [netbsd-8]: prep
src/distrib/notes/evbarm [netbsd-8]: install
src/distrib/notes/i386 [netbsd-8]: prep

Log Message:
NetBSD.org capitalization police


To generate a diff of this commit:
cvs rdiff -u -r1.2.40.1 -r1.2.40.2 src/distrib/notes/amd64/prep
cvs rdiff -u -r1.9 -r1.9.54.1 src/distrib/notes/evbarm/install
cvs rdiff -u -r1.14.40.1 -r1.14.40.2 src/distrib/notes/i386/prep

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

Modified files:

Index: src/distrib/notes/amd64/prep
diff -u src/distrib/notes/amd64/prep:1.2.40.1 src/distrib/notes/amd64/prep:1.2.40.2
--- src/distrib/notes/amd64/prep:1.2.40.1	Sun Jun 24 09:11:28 2018
+++ src/distrib/notes/amd64/prep	Tue Jul  3 07:11:48 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: prep,v 1.2.40.1 2018/06/24 09:11:28 martin Exp $
+.\"$NetBSD: prep,v 1.2.40.2 2018/07/03 07:11:48 martin Exp $
 .
 .Pp
 It is strongly recommended that as part of the installation procedure, you
@@ -24,9 +24,9 @@ A semi-manual mode of installation is su
 This shortcoming will be addressesed in the upcoming next release.
 .Pp
 Please refer to 
-.Lk https://wiki.netbsd.org/Installation_on_UEFI_systems/
+.Lk https://wiki.NetBSD.org/Installation_on_UEFI_systems/
 when installing on
 .Sy UEFI
 systems. See this
-.Lk https://wiki.netbsd.org/users/spz/moderndisk/
+.Lk https://wiki.NetBSD.org/users/spz/moderndisk/
 for expert / manual installation suggestions on modern disk systems.

Index: src/distrib/notes/evbarm/install
diff -u src/distrib/notes/evbarm/install:1.9 src/distrib/notes/evbarm/install:1.9.54.1
--- src/distrib/notes/evbarm/install:1.9	Sat Sep  6 21:46:14 2008
+++ src/distrib/notes/evbarm/install	Tue Jul  3 07:11:48 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.9 2008/09/06 21:46:14 tsutsui Exp $
+.\"	$NetBSD: install,v 1.9.54.1 2018/07/03 07:11:48 martin Exp $
 .\"
 .\" Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -29,7 +29,7 @@ The following steps describe how to set 
 the TS-7200.  The TS-7200 can use the interactive
 installation program
 .Ic sysinst 
-to perform an internet installation from ftp.netbsd.org on the CompactFlash.  
+to perform an internet installation from ftp.NetBSD.org on the CompactFlash.  
 .Pp
 .(enum
 Place the netbsd-TS7200_INSTALL.bin kernel into the TFTP server's download

Index: src/distrib/notes/i386/prep
diff -u src/distrib/notes/i386/prep:1.14.40.1 src/distrib/notes/i386/prep:1.14.40.2
--- src/distrib/notes/i386/prep:1.14.40.1	Sun Jun 24 09:11:28 2018
+++ src/distrib/notes/i386/prep	Tue Jul  3 07:11:48 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: prep,v 1.14.40.1 2018/06/24 09:11:28 martin Exp $
+.\"	$NetBSD: prep,v 1.14.40.2 2018/07/03 07:11:48 martin Exp $
 .
 First and foremost, before beginning the installation process,
 .Em make sure you have a reliable backup
@@ -135,10 +135,10 @@ A semi-manual mode of installation is su
 This shortcoming will be addressesed in the upcoming next release.
 .Pp
 Please refer to 
-.Lk https://wiki.netbsd.org/Installation_on_UEFI_systems/
+.Lk https://wiki.NetBSD.org/Installation_on_UEFI_systems/
 when installing on
 .Sy UEFI
 systems. See this
-.Lk https://wiki.netbsd.org/users/spz/moderndisk/
+.Lk https://wiki.NetBSD.org/users/spz/moderndisk/
 for expert / manual installation suggestions on modern disk systems.