CVS commit: src/sys/dev/usb

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 21 06:55:22 UTC 2020

Modified Files:
src/sys/dev/usb: if_kue.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/usb/if_kue.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/usb/if_kue.c
diff -u src/sys/dev/usb/if_kue.c:1.103 src/sys/dev/usb/if_kue.c:1.104
--- src/sys/dev/usb/if_kue.c:1.103	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/usb/if_kue.c	Sat Mar 21 06:55:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kue.c,v 1.103 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: if_kue.c,v 1.104 2020/03/21 06:55:22 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.103 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.104 2020/03/21 06:55:22 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -503,7 +503,7 @@ kue_attach(device_t parent, device_t sel
 		aprint_error_dev(self, "could not read Ethernet descriptor\n");
 		return;
 	}
-	memcpy(un->un_eaddr, sc->kue_desc.kue_macaddr, sizeof un->un_eaddr);
+	memcpy(un->un_eaddr, sc->kue_desc.kue_macaddr, sizeof(un->un_eaddr));
 
 	sc->kue_mcfilters = kmem_alloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN,
 	KM_SLEEP);



CVS commit: src/sys/dev/usb

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 21 06:54:56 UTC 2020

Modified Files:
src/sys/dev/usb: ugen.c

Log Message:
KNG


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/usb/ugen.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/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.150 src/sys/dev/usb/ugen.c:1.151
--- src/sys/dev/usb/ugen.c:1.150	Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/ugen.c	Sat Mar 21 06:54:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.150 2020/03/14 02:35:33 christos Exp $	*/
+/*	$NetBSD: ugen.c,v 1.151 2020/03/21 06:54:56 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.150 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.151 2020/03/21 06:54:56 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -231,7 +231,7 @@ ugen_attach(device_t parent, device_t se
 	struct usb_attach_arg *uaa = aux;
 	struct usbif_attach_arg uiaa;
 
-	memset(&uiaa, 0, sizeof uiaa);
+	memset(&uiaa, 0, sizeof(uiaa));
 	uiaa.uiaa_port = uaa->uaa_port;
 	uiaa.uiaa_vendor = uaa->uaa_vendor;
 	uiaa.uiaa_product = uaa->uaa_product;



CVS commit: src/sys/dev/usb

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 21 06:55:13 UTC 2020

Modified Files:
src/sys/dev/usb: if_umb.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/if_umb.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/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.17 src/sys/dev/usb/if_umb.c:1.18
--- src/sys/dev/usb/if_umb.c:1.17	Thu Mar 19 07:51:22 2020
+++ src/sys/dev/usb/if_umb.c	Sat Mar 21 06:55:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.17 2020/03/19 07:51:22 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.18 2020/03/21 06:55:13 skrll Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.17 2020/03/19 07:51:22 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.18 2020/03/21 06:55:13 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2760,7 +2760,7 @@ inet_ntop(int af, const void *src, char 
 Static const char *
 inet_ntop4(const u_char *src, char *dst, size_t size)
 {
-	char tmp[sizeof "255.255.255.255"];
+	char tmp[sizeof("255.255.255.255")];
 	int l;
 
 	l = snprintf(tmp, sizeof(tmp), "%u.%u.%u.%u",
@@ -2789,7 +2789,7 @@ inet_ntop6(const u_char *src, char *dst,
 	 * Keep this in mind if you think this function should have been coded
 	 * to use pointer overlays.  All the world's not a VAX.
 	 */
-	char tmp[sizeof "::::::255.255.255.255"];
+	char tmp[sizeof("::::::255.255.255.255")];
 	char *tp, *ep;
 	struct { int base, len; } best, cur;
 #define IN6ADDRSZ	16
@@ -2803,7 +2803,7 @@ inet_ntop6(const u_char *src, char *dst,
 	 *	Copy the input (bytewise) array into a wordwise array.
 	 *	Find the longest run of 0x00's in src[] for :: shorthanding.
 	 */
-	memset(words, '\0', sizeof words);
+	memset(words, '\0', sizeof(words));
 	for (i = 0; i < IN6ADDRSZ; i++)
 		words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
 	best.base = -1;



CVS commit: src/sys/dev/usb

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 21 06:54:43 UTC 2020

Modified Files:
src/sys/dev/usb: if_ure.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/if_ure.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/usb/if_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.38 src/sys/dev/usb/if_ure.c:1.39
--- src/sys/dev/usb/if_ure.c:1.38	Sun Mar 15 23:04:51 2020
+++ src/sys/dev/usb/if_ure.c	Sat Mar 21 06:54:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.38 2020/03/15 23:04:51 thorpej Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.39 2020/03/21 06:54:43 skrll Exp $	*/
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.38 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.39 2020/03/21 06:54:43 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -962,7 +962,7 @@ ure_attach(device_t parent, device_t sel
 		eaddr[4] = machi & 0xff;
 		eaddr[5] = (machi >> 8) & 0xff;
 	}
-	memcpy(un->un_eaddr, eaddr, sizeof un->un_eaddr);
+	memcpy(un->un_eaddr, eaddr, sizeof(un->un_eaddr));
 
 	struct ifnet *ifp = usbnet_ifp(un);
 



CVS commit: src/sys/dev/usb

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 21 06:54:33 UTC 2020

Modified Files:
src/sys/dev/usb: if_umbreg.h

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/usb/if_umbreg.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/usb/if_umbreg.h
diff -u src/sys/dev/usb/if_umbreg.h:1.1 src/sys/dev/usb/if_umbreg.h:1.2
--- src/sys/dev/usb/if_umbreg.h:1.1	Tue Jul 31 16:44:29 2018
+++ src/sys/dev/usb/if_umbreg.h	Sat Mar 21 06:54:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umbreg.h,v 1.1 2018/07/31 16:44:29 khorben Exp $ */
+/*	$NetBSD: if_umbreg.h,v 1.2 2020/03/21 06:54:32 skrll Exp $ */
 /*	$OpenBSD: if_umb.h,v 1.4 2017/04/18 13:27:55 gerhard Exp $ */
 
 /*
@@ -40,7 +40,7 @@ umb_val2descr(const struct umb_valdescr 
 			return vdp->descr;
 		vdp++;
 	}
-	snprintf(sval, sizeof (sval), "#%d", val);
+	snprintf(sval, sizeof(sval), "#%d", val);
 	return sval;
 }
 



CVS commit: src/sys/ufs/lfs

2020-03-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 21 06:11:05 UTC 2020

Modified Files:
src/sys/ufs/lfs: lfs.h lfs_accessors.h

Log Message:
Avoid misaligned access to lfs64 on-disk records in memory.

lfs64 directory entries are only 32-bit aligned in order to conserve
space in directory blocks, and we had a hack to stuff a 64-bit inode
in them.  This replaces the hack by __aligned(4) __packed, and goes
further:

1. It's not clear that all the other lfs64 data structures are 64-bit
   aligned on disk to begin with.  We can go through these later and
   upgrade them from

struct foo64 {
...
} __aligned(4) __packed;

union foo {
struct foo64 f64;
...
};

   to

struct foo64 {
...
};

union foo {
struct foo64 f64 __aligned(8);
...
} __aligned(4) __packed;

   if we really want to take advantage of 64-bit memory accesses.

   However, the __aligned(4) __packed must remain on the union
   because:

2. We access even the lfs32 data structures via a union that has
   lfs64 members, and it turns out that compilers will assume access
   through a union with 64-bit aligned members implies the whole
   union has 64-bit alignment, even if we're only accessing a 32-bit
   aligned member.


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.48 -r1.49 src/sys/ufs/lfs/lfs_accessors.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/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.206 src/sys/ufs/lfs/lfs.h:1.207
--- src/sys/ufs/lfs/lfs.h:1.206	Sat Mar 21 06:09:33 2020
+++ src/sys/ufs/lfs/lfs.h	Sat Mar 21 06:11:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.206 2020/03/21 06:09:33 riastradh Exp $	*/
+/*	$NetBSD: lfs.h,v 1.207 2020/03/21 06:11:05 riastradh Exp $	*/
 
 /*  from NetBSD: dinode.h,v 1.25 2016/01/22 23:06:10 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp  */
@@ -358,18 +358,19 @@ struct lfs_dirheader32 {
 __CTASSERT(sizeof(struct lfs_dirheader32) == 8);
 
 struct lfs_dirheader64 {
-	uint32_t dh_inoA;		/* inode number of entry */
-	uint32_t dh_inoB;		/* inode number of entry */
+	uint64_t dh_ino;		/* inode number of entry */
 	uint16_t dh_reclen;		/* length of this record */
 	uint8_t  dh_type; 		/* file type, see below */
 	uint8_t  dh_namlen;		/* length of string in d_name */
-};
+} __aligned(4) __packed;
 __CTASSERT(sizeof(struct lfs_dirheader64) == 12);
 
 union lfs_dirheader {
 	struct lfs_dirheader64 u_64;
 	struct lfs_dirheader32 u_32;
 };
+__CTASSERT(__alignof(union lfs_dirheader) == __alignof(struct lfs_dirheader64));
+__CTASSERT(__alignof(union lfs_dirheader) == __alignof(struct lfs_dirheader32));
 
 typedef union lfs_dirheader LFS_DIRHEADER;
 
@@ -481,6 +482,8 @@ union lfs_dinode {
 	struct lfs64_dinode u_64;
 	struct lfs32_dinode u_32;
 };
+__CTASSERT(__alignof(union lfs_dinode) == __alignof(struct lfs64_dinode));
+__CTASSERT(__alignof(union lfs_dinode) == __alignof(struct lfs32_dinode));
 
 /*
  * The di_db fields may be overlaid with other information for
@@ -563,7 +566,7 @@ struct finfo64 {
 	uint64_t fi_ino;		/* inode number */
 	uint32_t fi_lastlength;		/* length of last block in array */
 	uint32_t fi_pad;		/* unused */
-};
+} __aligned(4) __packed;
 __CTASSERT(sizeof(struct finfo64) == 24);
 
 typedef struct finfo32 FINFO32;
@@ -579,6 +582,8 @@ typedef union finfo {
 	struct finfo64 u_64;
 	struct finfo32 u_32;
 } FINFO;
+__CTASSERT(__alignof(union finfo) == __alignof(struct finfo64));
+__CTASSERT(__alignof(union finfo) == __alignof(struct finfo32));
 
 /*
  * inode info (part of the segment summary)
@@ -590,7 +595,7 @@ typedef union finfo {
 
 typedef struct iinfo64 {
 	uint64_t ii_block;		/* block number */
-} IINFO64;
+} __aligned(4) __packed IINFO64;
 __CTASSERT(sizeof(struct iinfo64) == 8);
 
 typedef struct iinfo32 {
@@ -602,6 +607,8 @@ typedef union iinfo {
 	struct iinfo64 u_64;
 	struct iinfo32 u_32;
 } IINFO;
+__CTASSERT(__alignof(union iinfo) == __alignof(struct iinfo64));
+__CTASSERT(__alignof(union iinfo) == __alignof(struct iinfo32));
 
 /*
  * Index file inode entries.
@@ -620,7 +627,7 @@ struct ifile64 {
 	uint64_t if_atime_sec;		/* Last access time, seconds */
 	int64_t	  if_daddr;		/* inode disk address */
 	uint64_t if_nextfree;		/* next-unallocated inode */
-};
+} __aligned(4) __packed;
 __CTASSERT(sizeof(struct ifile64) == 32);
 
 typedef struct ifile32 IFILE32;
@@ -655,6 +662,9 @@ typedef union ifile {
 	struct ifile32 u_32;
 	struct ifile_v1 u_v1;
 } IFILE;
+__CTASSERT(__alignof(union ifile) == __alignof(struct ifile64));
+__CTASSERT(__alignof(union ifile) == __alignof(struct ifile32));
+__CTASSERT(__alignof(union ifile) == __alignof(struct ifile_v1));
 
 /*
  * Cleaner information structure.  This resides in th

CVS commit: src/sys/ufs/lfs

2020-03-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 21 06:09:34 UTC 2020

Modified Files:
src/sys/ufs/lfs: lfs.h

Log Message:
CTASSERT lfs on-disk structure sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/ufs/lfs/lfs.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/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.205 src/sys/ufs/lfs/lfs.h:1.206
--- src/sys/ufs/lfs/lfs.h:1.205	Sun Feb 23 08:49:34 2020
+++ src/sys/ufs/lfs/lfs.h	Sat Mar 21 06:09:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.205 2020/02/23 08:49:34 riastradh Exp $	*/
+/*	$NetBSD: lfs.h,v 1.206 2020/03/21 06:09:33 riastradh Exp $	*/
 
 /*  from NetBSD: dinode.h,v 1.25 2016/01/22 23:06:10 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp  */
@@ -355,6 +355,7 @@ struct lfs_dirheader32 {
 	uint8_t  dh_type; 		/* file type, see below */
 	uint8_t  dh_namlen;		/* length of string in d_name */
 };
+__CTASSERT(sizeof(struct lfs_dirheader32) == 8);
 
 struct lfs_dirheader64 {
 	uint32_t dh_inoA;		/* inode number of entry */
@@ -363,6 +364,7 @@ struct lfs_dirheader64 {
 	uint8_t  dh_type; 		/* file type, see below */
 	uint8_t  dh_namlen;		/* length of string in d_name */
 };
+__CTASSERT(sizeof(struct lfs_dirheader64) == 12);
 
 union lfs_dirheader {
 	struct lfs_dirheader64 u_64;
@@ -381,6 +383,7 @@ struct lfs_dirtemplate32 {
 	struct lfs_dirheader32	dotdot_header;
 	char			dotdot_name[4];	/* ditto */
 };
+__CTASSERT(sizeof(struct lfs_dirtemplate32) == 2*(8 + 4));
 
 struct lfs_dirtemplate64 {
 	struct lfs_dirheader64	dot_header;
@@ -388,6 +391,7 @@ struct lfs_dirtemplate64 {
 	struct lfs_dirheader64	dotdot_header;
 	char			dotdot_name[4];	/* ditto */
 };
+__CTASSERT(sizeof(struct lfs_dirtemplate64) == 2*(12 + 4));
 
 union lfs_dirtemplate {
 	struct lfs_dirtemplate64 u_64;
@@ -408,6 +412,7 @@ struct lfs_odirtemplate {
 	uint16_t	dotdot_namlen;
 	char		dotdot_name[4];	/* ditto */
 };
+__CTASSERT(sizeof(struct lfs_odirtemplate) == 2*(8 + 4));
 #endif
 
 /*
@@ -441,6 +446,7 @@ struct lfs32_dinode {
 	uint32_t	di_gid;		/* 116: File group. */
 	uint64_t	di_modrev;	/* 120: i_modrev for NFSv4 */
 };
+__CTASSERT(sizeof(struct lfs32_dinode) == 128);
 
 struct lfs64_dinode {
 	uint16_t	di_mode;	/*   0: IFMT, permissions; see below. */
@@ -469,6 +475,7 @@ struct lfs64_dinode {
 	uint64_t	di_inumber;	/* 240: Inode number */
 	uint64_t	di_spare[1];	/* 248: Reserved; currently unused */
 };
+__CTASSERT(sizeof(struct lfs64_dinode) == 256);
 
 union lfs_dinode {
 	struct lfs64_dinode u_64;
@@ -529,6 +536,7 @@ struct segusage {
 	uint32_t su_flags;		/* 12: segment flags */
 	uint64_t su_lastmod;		/* 16: last modified timestamp */
 };
+__CTASSERT(sizeof(struct segusage) == 24);
 
 typedef struct segusage_v1 SEGUSE_V1;
 struct segusage_v1 {
@@ -538,6 +546,7 @@ struct segusage_v1 {
 	uint16_t su_ninos;		/* 10: number of inode blocks in seg */
 	uint32_t su_flags;		/* 12: segment flags  */
 };
+__CTASSERT(sizeof(struct segusage_v1) == 16);
 
 /*
  * On-disk file information.  One per file with data blocks in the segment.
@@ -555,6 +564,7 @@ struct finfo64 {
 	uint32_t fi_lastlength;		/* length of last block in array */
 	uint32_t fi_pad;		/* unused */
 };
+__CTASSERT(sizeof(struct finfo64) == 24);
 
 typedef struct finfo32 FINFO32;
 struct finfo32 {
@@ -563,6 +573,7 @@ struct finfo32 {
 	uint32_t fi_ino;		/* inode number */
 	uint32_t fi_lastlength;		/* length of last block in array */
 };
+__CTASSERT(sizeof(struct finfo32) == 16);
 
 typedef union finfo {
 	struct finfo64 u_64;
@@ -580,10 +591,12 @@ typedef union finfo {
 typedef struct iinfo64 {
 	uint64_t ii_block;		/* block number */
 } IINFO64;
+__CTASSERT(sizeof(struct iinfo64) == 8);
 
 typedef struct iinfo32 {
 	uint32_t ii_block;		/* block number */
 } IINFO32;
+__CTASSERT(sizeof(struct iinfo32) == 4);
 
 typedef union iinfo {
 	struct iinfo64 u_64;
@@ -608,6 +621,7 @@ struct ifile64 {
 	int64_t	  if_daddr;		/* inode disk address */
 	uint64_t if_nextfree;		/* next-unallocated inode */
 };
+__CTASSERT(sizeof(struct ifile64) == 32);
 
 typedef struct ifile32 IFILE32;
 struct ifile32 {
@@ -617,6 +631,7 @@ struct ifile32 {
 	uint32_t if_atime_sec;		/* Last access time, seconds */
 	uint32_t if_atime_nsec;		/* and nanoseconds */
 };
+__CTASSERT(sizeof(struct ifile32) == 20);
 
 typedef struct ifile_v1 IFILE_V1;
 struct ifile_v1 {
@@ -628,6 +643,7 @@ struct ifile_v1 {
 	struct timespec if_atime;	/* Last access time */
 #endif
 };
+__CTASSERT(sizeof(struct ifile_v1) == 12);
 
 /*
  * Note: struct ifile_v1 is often handled by accessing the first three
@@ -657,6 +673,7 @@ typedef struct _cleanerinfo32 {
 	uint32_t free_tail;		/* 20: tail of the inode free list */
 	uint32_t flags;			/* 24: status word from the kernel */
 } CLEANERINFO32;
+__CTASSERT(sizeof(struct _cleanerinfo32) == 28);
 
 typedef struct _cleanerinfo64 {
 	uint32_t clean

CVS commit: src/sys/dev/raidframe

2020-03-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 21 06:02:13 UTC 2020

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Restore historic $Hdr: ...$ text.

This was presumably eaten by git cvsexportcommit, which is curious
because I thought I had gotten out of the habit of passing -k to it.


To generate a diff of this commit:
cvs rdiff -u -r1.380 -r1.381 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.380 src/sys/dev/raidframe/rf_netbsdkintf.c:1.381
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.380	Sun Mar  1 03:21:54 2020
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Mar 21 06:02:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.380 2020/03/01 03:21:54 riastradh Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.381 2020/03/21 06:02:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * from: Utah $Hdr$
+ * from: Utah $Hdr: cd.c 1.6 90/11/28$
  *
  *  @(#)cd.c8.2 (Berkeley) 11/16/93
  */
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.380 2020/03/01 03:21:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.381 2020/03/21 06:02:13 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"



CVS commit: src/tests/dev/sysmon

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 21 04:50:22 UTC 2020

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
These test cases should now succeed, after fixing rump kernel to handle
modules that establish their sysctls via SYSCTL_SETUP()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/dev/sysmon/t_swsensor.sh

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

Modified files:

Index: src/tests/dev/sysmon/t_swsensor.sh
diff -u src/tests/dev/sysmon/t_swsensor.sh:1.10 src/tests/dev/sysmon/t_swsensor.sh:1.11
--- src/tests/dev/sysmon/t_swsensor.sh:1.10	Thu Mar 19 20:10:49 2020
+++ src/tests/dev/sysmon/t_swsensor.sh	Sat Mar 21 04:50:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.10 2020/03/19 20:10:49 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.11 2020/03/21 04:50:21 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -145,7 +145,6 @@ common_body() {
 	# Step 3 - verify that changes in sensor value are seen
 	rump.sysctl -w hw.swsensor.cur_value=$(( $2 + 1 ))
 	if [ $( get_sensor_key cur-value ) -ne $(( $2 + 1 )) ] ; then
-		atf_expect_fail "PR kern/55088"
 		atf_fail "3: Value not updated"
 	fi
 



CVS commit: src

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 21 04:48:38 UTC 2020

Modified Files:
src/lib/librumpuser: rumpuser_dl.c
src/sys/rump: ldscript.rump

Log Message:
Teach rump how to process __link_set_sysctl_funcs so it can handle
modules the same as a real kernel.

Partly addresses PR kern/55088 - __link_set_evcnts not yet handled
(that will happen later)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/librumpuser/rumpuser_dl.c
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/ldscript.rump

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

Modified files:

Index: src/lib/librumpuser/rumpuser_dl.c
diff -u src/lib/librumpuser/rumpuser_dl.c:1.31 src/lib/librumpuser/rumpuser_dl.c:1.32
--- src/lib/librumpuser/rumpuser_dl.c:1.31	Thu Dec 26 04:53:11 2019
+++ src/lib/librumpuser/rumpuser_dl.c	Sat Mar 21 04:48:37 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpuser_dl.c,v 1.31 2019/12/26 04:53:11 msaitoh Exp $	*/
+/*  $NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -40,11 +40,16 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_dl.c,v 1.31 2019/12/26 04:53:11 msaitoh Exp $");
+__RCSID("$NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $");
 #endif /* !lint */
 
 #include 
 #include 
+
+#ifdef NOTYET
+#include 
+#endif
+
 #include 
 
 #include 
@@ -353,6 +358,14 @@ process_object(void *handle,
 	const struct modinfo *const *mi_start, *const *mi_end;
 	struct rump_component *const *rc, *const *rc_end;
 
+	struct sysctllog;
+	typedef void sysctl_setup_func(struct sysctllog **);
+	sysctl_setup_func *const *sfp, *const *sfp_end;
+
+#ifdef NOTYET	/* We don't yet handle link_set_evcnts */
+	struct evcnt *const *evp, *const *evp_end;
+#endif
+
 	mi_start = dlsym(handle, "__start_link_set_modules");
 	mi_end = dlsym(handle, "__stop_link_set_modules");
 	if (mi_start && mi_end)
@@ -365,6 +378,26 @@ process_object(void *handle,
 			docompload(*rc);
 		assert(rc == rc_end);
 	}
+
+	/* handle link_set_sysctl_funcs */
+	sfp = dlsym(handle, "__start_link_set_sysctl_funcs");
+	sfp_end = dlsym(handle, "__stop_link_set_sysctl_funcs");
+	if (sfp && sfp_end) {
+		for (; sfp < sfp_end; sfp++)
+			(**sfp)(NULL);
+		assert(sfp == sfp_end);
+	}
+
+#ifdef NOTYET
+	/* handle link_set_evcnts */
+	evp = dlsym(handle, "__start_link_set_evcnts");
+	evp_end = dlsym(handle, "__stop_link_set_evcnts");
+	if (evp && evp_end) {
+		for (; evp < evp_end; evp++)
+			evcnt_attach_static(*evp);
+		assert(evp == evp_end);
+	}
+#endif
 }
 
 /*

Index: src/sys/rump/ldscript.rump
diff -u src/sys/rump/ldscript.rump:1.3 src/sys/rump/ldscript.rump:1.4
--- src/sys/rump/ldscript.rump:1.3	Wed Apr 23 17:05:18 2014
+++ src/sys/rump/ldscript.rump	Sat Mar 21 04:48:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldscript.rump,v 1.3 2014/04/23 17:05:18 pooka Exp $	*/
+/*	$NetBSD: ldscript.rump,v 1.4 2020/03/21 04:48:38 pgoyette Exp $	*/
 
 /*
  * From binutils 2.19 onwards (in NetBSD) binutils ld PROVIDEs
@@ -24,5 +24,19 @@ SECTIONS
 		*(link_set_rump_components);
 		__stop_link_set_rump_components = .;
 	}
+
+	link_set_sysctl_funcs :
+	{
+		__start_link_set_sysctl_funcs = .;
+		*(link_set_sysctl_funcs);
+		__stop_link_set_sysctl_funcs = .;
+	}
+
+	link_set_rump_components :
+	{
+		__start_link_set_evcnts = .;
+		*(link_set_evcnts);
+		__stop_link_set_evcnts = .;
+	}
 }
 INSERT AFTER .data;



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

2020-03-20 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Mar 21 04:35:20 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
more on toward dual descriptor design


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sociox/if_ave.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.4 src/sys/arch/arm/sociox/if_ave.c:1.5
--- src/sys/arch/arm/sociox/if_ave.c:1.4	Sat Mar 21 01:17:51 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Sat Mar 21 04:35:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.4 2020/03/21 01:17:51 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.5 2020/03/21 04:35:20 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.4 2020/03/21 01:17:51 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.5 2020/03/21 04:35:20 nisimura Exp $");
 
 #include 
 #include 
@@ -125,16 +125,13 @@ __KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1
 #define AVEAFRING	0x0f00		/* entry ring number selector */
 #define AVEAFEN		0x0ffc		/* entry enable bit vector */
 
-#ifdef _LP64
 #define AVETDB		0x1000		/* 64bit Tx descriptor storage base */
 #define AVERDB		0x1c00		/* 64bit Rx descriptor storage base */
-#else
-#define AVETDB		0x1000		/* 32bit Tx descriptor storage base */
-#define AVERDB		0x1800		/* 32bit Rx descriptor storage base */
-#endif
+#define AVE32TDB	0x1000		/* 32bit Tx descriptor storage base */
+#define AVE32RDB	0x1800		/* 32bit Rx descriptor storage base */
 
 /*
- * descriptor size is 12 bytes when _LP64, 8 bytes otherwise.
+ * descriptor size is 12 bytes when 64bit paddr design, 8 bytes otherwise.
  * 3KB/24KB split or 64bit paddr Tx/Rx descriptor storage.
  * 2KB/16KB split or 32bit paddr Tx/Rx descriptor storage.
  */
@@ -146,6 +143,9 @@ struct rdes {
 	uint32_t r0, r1, r2;
 };
 
+struct tdes32 { uint32_t t0, t1; };
+struct rdes32 { uint32_t r0, r1; };
+
 #define T0_OWN		(1U<<31)	/* desc is ready to Tx */
 #define T0_IOC		(1U<<29)	/* post interrupt on Tx completes */
 #define T0_NOCSUM	(1U<<28)	/* inhibit checksum operation */
@@ -177,7 +177,6 @@ struct rdes {
 #define AVE_NRXDESC_MASK	(AVE_NRXDESC - 1)
 #define AVE_NEXTRX(x)		(((x) + 1) & AVE_NRXDESC_MASK)
 
-#ifdef _LP64
 #define AVE_INIT_RXDESC(sc, x)		\
 do {	\
 	struct ave_rxsoft *__rxs = &(sc)->sc_rxsoft[(x)];		\
@@ -189,18 +188,17 @@ do {	\
 	__rxd->r1 = htole32(BUS_ADDR_LO32(__paddr));			\
 	__rxd->r0 = R0_OWN | R0_FL_MASK;\
 } while (/*CONSTCOND*/0)
-#else
-#define AVE_INIT_RXDESC(sc, x)		\
+
+#define AVE32_INIT_RXDESC(sc, x)	\
 do {	\
 	struct ave_rxsoft *__rxs = &(sc)->sc_rxsoft[(x)];		\
-	struct rdes *__rxd = &(sc)->sc_rxdescs[(x)];			\
+	struct rdes32 *__rxd = &(sc)->sc_rxd32[(x)];			\
 	struct mbuf *__m = __rxs->rxs_mbuf;\
 	bus_addr_t __paddr =__rxs->rxs_dmamap->dm_segs[0].ds_addr;	\
 	__m->m_data = __m->m_ext.ext_buf;\
 	__rxd->r1 = htole32(__paddr);	\
 	__rxd->r0 = R0_OWN | R0_FL_MASK;\
 } while (/*CONSTCOND*/0)
-#endif
 
 struct ave_txsoft {
 	struct mbuf *txs_mbuf;		/* head of our mbuf chain */
@@ -236,6 +234,8 @@ struct ave_softc {
 
 	struct tdes *sc_txdescs;	/* PTR to tdes [NTXDESC] array */
 	struct rdes *sc_rxdescs;	/* PTR to rdes [NRXDESC] array */
+	struct tdes32 *sc_txd32;
+	struct rdes32 *sc_rxd32;
 
 	struct ave_txsoft sc_txsoft[AVE_TXQUEUELEN];
 	struct ave_rxsoft sc_rxsoft[AVE_NRXDESC];
@@ -515,6 +515,8 @@ ave_init(struct ifnet *ifp)
 	/* set ptr to Tx/Rx descriptor store */
 	sc->sc_txdescs = (void *)((uintptr_t)sc->sc_sh + AVETDB);
 	sc->sc_rxdescs = (void *)((uintptr_t)sc->sc_sh + AVERDB);
+	sc->sc_txd32 =   (void *)((uintptr_t)sc->sc_sh + AVE32TDB);
+	sc->sc_rxd32 =   (void *)((uintptr_t)sc->sc_sh + AVE32RDB);
 
 	/* build sane and loaded Tx/Rx descriptors */
 	memset(sc->sc_txdescs, 0, sizeof(struct tdes)*AVE_NTXDESC);
@@ -969,12 +971,8 @@ ave_start(struct ifnet *ifp)
 			 * yet.	 That could cause a race condition.
 			 * We'll do it below.
 			 */
-#ifdef _LP64
 			tdes->t2 = htole32(BUS_ADDR_HI32(paddr));
 			tdes->t1 = htole32(BUS_ADDR_LO32(paddr));
-#else
-			tdes->t1 = htole32(paddr);
-#endif
 			tdes->t0 = tdes0 | sc->sc_t0csum
 			 | (dmamap->dm_segs[seg].ds_len & T0_TBS_MASK);
 			tdes0 = T0_OWN; /* 2nd and other segments */



CVS commit: src/sys/kern

2020-03-20 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Mar 21 02:32:37 UTC 2020

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

Log Message:
callout_destroy(): change output from a couple of assertions so it's clear
what they are checking for (callout being destroyed while pending/running).


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_timeout.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_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.58 src/sys/kern/kern_timeout.c:1.59
--- src/sys/kern/kern_timeout.c:1.58	Thu Jan 23 20:44:15 2020
+++ src/sys/kern/kern_timeout.c	Sat Mar 21 02:32:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_timeout.c,v 1.58 2020/01/23 20:44:15 ad Exp $	*/
+/*	$NetBSD: kern_timeout.c,v 1.59 2020/03/21 02:32:37 ad Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.58 2020/01/23 20:44:15 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.59 2020/03/21 02:32:37 ad Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -315,9 +315,11 @@ callout_destroy(callout_t *cs)
 	 * running, the current thread should have stopped it.
 	 */
 	KASSERTMSG((c->c_flags & CALLOUT_PENDING) == 0,
-	"callout %p: c_func (%p) c_flags (%#x) destroyed from %p",
+	"pending callout %p: c_func (%p) c_flags (%#x) destroyed from %p",
+	c, c->c_func, c->c_flags, __builtin_return_address(0));
+	KASSERTMSG(c->c_cpu->cc_lwp == curlwp || c->c_cpu->cc_active != c,
+	"running callout %p: c_func (%p) c_flags (%#x) destroyed from %p",
 	c, c->c_func, c->c_flags, __builtin_return_address(0));
-	KASSERT(c->c_cpu->cc_lwp == curlwp || c->c_cpu->cc_active != c);
 	c->c_magic = 0;
 }
 



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

2020-03-20 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Mar 21 01:17:51 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
- add missing RXC_EN bit to resume receiving.
- an inch forward to absorb incompatible descriptor designs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sociox/if_ave.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.3 src/sys/arch/arm/sociox/if_ave.c:1.4
--- src/sys/arch/arm/sociox/if_ave.c:1.3	Fri Mar 20 12:29:09 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Sat Mar 21 01:17:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.3 2020/03/20 12:29:09 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.4 2020/03/21 01:17:51 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.3 2020/03/20 12:29:09 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.4 2020/03/21 01:17:51 nisimura Exp $");
 
 #include 
 #include 
@@ -139,17 +139,11 @@ __KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1
  * 2KB/16KB split or 32bit paddr Tx/Rx descriptor storage.
  */
 struct tdes {
-	uint32_t t0, t1;
-#ifdef _LP64
-	uint32_t t2;
-#endif
+	uint32_t t0, t1, t2;
 };
 
 struct rdes {
-	uint32_t r0, r1;
-#ifdef _LP64
-	uint32_t r2;
-#endif
+	uint32_t r0, r1, r2;
 };
 
 #define T0_OWN		(1U<<31)	/* desc is ready to Tx */
@@ -235,6 +229,7 @@ struct ave_softc {
 	int sc_phy_id;			/* PHY address */
 	uint32_t sc_phymode;		/* 1<<27: MII/RMII, 0: RGMII */
 	uint32_t sc_rxc;		/* software copy of AVERXC */
+	int sc_model;			/* 64 paddr model or otherwise 32 */
 
 	bus_dmamap_t sc_cddmamap;	/* control data DMA map */
 #define sc_cddma	sc_cddmamap->dm_segs[0].ds_addr
@@ -286,20 +281,21 @@ static int add_rxbuf(struct ave_softc *,
 #define CSR_WRITE(sc, off, val) \
 	bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (off), (val))
 
+static const struct of_compat_data compat_data[] = {
+	{ "socionext,unifier-ld20-ave4", 64 },
+	{ "socionext,unifier-pro4-ave4", 32 },
+	{ "socionext,unifier-pxs2-ave4", 32 },
+	{ "socionext,unifier-ld11-ave4", 32 },
+	{ "socionext,unifier-pxs3-ave4", 32 },
+	{ NULL }
+};
+
 static int
 ave_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
-	static const char * compatible[] = {
-		"socionext,unifier-ld20-ave4",
-		"socionext,unifier-pro4-ave4",
-		"socionext,unifier-pxs2-ave4",
-		"socionext,unifier-ld11-ave4",
-		"socionext,unifier-pxs3-ave4",
-		NULL
-	};
 	struct fdt_attach_args * const faa = aux;
 
-	return of_match_compatible(faa->faa_phandle, compatible);
+	return of_match_compat_data(faa->faa_phandle, compat_data);
 }
 
 static void
@@ -346,11 +342,13 @@ ave_fdt_attach(device_t parent, device_t
 
 	hwimp = CSR_READ(sc, AVEID);
 	hwver = CSR_READ(sc, AVEHWVER);
+	sc->sc_model = of_search_compatible(phandle, compat_data)->data;
 
 	aprint_naive("\n");
 	aprint_normal(": Gigabit Ethernet Controller\n");
-	aprint_normal_dev(self, "UniPhier %c%c%c%c AVE GbE (%d.%d)\n",
+	aprint_normal_dev(self, "UniPhier %c%c%c%c AVE %d GbE (%d.%d)\n",
 	hwimp >> 24, hwimp >> 16, hwimp >> 8, hwimp,
+	sc->sc_model,
 	hwver >> 8, hwver & 0xff);
 	aprint_normal_dev(self, "interrupt on %s\n", intrstr);
 
@@ -613,7 +611,7 @@ ave_ifmedia_upd(struct ifnet *ifp)
 	}
 	sc->sc_rxc = rxcr;
 	CSR_WRITE(sc, AVETXC, txcr);
-	CSR_WRITE(sc, AVERXC, rxcr);
+	CSR_WRITE(sc, AVERXC, rxcr | RXC_EN);
 	return 0;
 }
 



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2020-03-20 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Sat Mar 21 01:07:21 UTC 2020

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c

Log Message:
cleanly fail initialization on empty keyring


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.102 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.103
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.102	Tue Nov 13 14:52:30 2018
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Sat Mar 21 01:07:21 2020
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.102 2018/11/13 14:52:30 mlelstv Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.103 2020/03/21 01:07:21 jhigh Exp $");
 #endif
 
 #include 
@@ -429,7 +429,7 @@ get_first_ring(pgp_keyring_t *ring, char
 	int	 i;
 	int	 n;
 
-	if (ring == NULL) {
+	if (ring == NULL || ring->keyc == 0) {
 		return 0;
 	}
 	(void) memset(id, 0x0, len);



CVS commit: src/sys/kern

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 20 23:09:02 UTC 2020

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

Log Message:
Improve error message - at least indicate which value comes from the
module vs which was requested/wanted by the caller.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/kern/kern_module.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_module.c
diff -u src/sys/kern/kern_module.c:1.147 src/sys/kern/kern_module.c:1.148
--- src/sys/kern/kern_module.c:1.147	Sat Feb 22 19:51:57 2020
+++ src/sys/kern/kern_module.c	Fri Mar 20 23:09:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.147 2020/02/22 19:51:57 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.148 2020/03/20 23:09:01 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.147 2020/02/22 19:51:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.148 2020/03/20 23:09:01 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -136,8 +136,8 @@ static void	module_callback_unload(struc
 static void
 module_incompat(const modinfo_t *mi, int modclass)
 {
-	module_error("incompatible module class for `%s' (%d != %d)",
-	mi->mi_name, modclass, mi->mi_class);
+	module_error("incompatible module class %d for `%s' (wanted %d)",
+	mi->mi_class, mi->mi_name, modclass);
 }
 
 struct module *



CVS commit: src/doc

2020-03-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Mar 20 23:01:24 UTC 2020

Modified Files:
src/doc: 3RDPARTY

Log Message:
openssl-1.1.1e out.


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

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1700 src/doc/3RDPARTY:1.1701
--- src/doc/3RDPARTY:1.1700	Fri Mar 20 03:21:14 2020
+++ src/doc/3RDPARTY	Fri Mar 20 23:01:24 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1700 2020/03/20 03:21:14 sevan Exp $
+#	$NetBSD: 3RDPARTY,v 1.1701 2020/03/20 23:01:24 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1088,7 +1088,7 @@ markus is very cooperative about it):
 
 Package:	OpenSSL
 Version:	1.0.2o/1.1.1d
-Current Vers:	1.0.2t/1.1.1d
+Current Vers:	1.0.2t/1.1.1e
 Maintainer:	The OpenSSL Project
 Archive Site:	ftp://ftp.openssl.org/source/
 Home Page:	http://www.openssl.org/



CVS commit: src/sys/arch/arm

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 19:48:04 UTC 2020

Modified Files:
src/sys/arch/arm/arm: armv6_start.S
src/sys/arch/arm/arm32: genassym.cf

Log Message:
Really use armv7 noncache memory attribute for early kernel mapping and
not SO


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/arm/armv6_start.S
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/arm/arm32/genassym.cf

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

Modified files:

Index: src/sys/arch/arm/arm/armv6_start.S
diff -u src/sys/arch/arm/arm/armv6_start.S:1.15 src/sys/arch/arm/arm/armv6_start.S:1.16
--- src/sys/arch/arm/arm/armv6_start.S:1.15	Sat Feb 15 08:16:10 2020
+++ src/sys/arch/arm/arm/armv6_start.S	Fri Mar 20 19:48:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv6_start.S,v 1.15 2020/02/15 08:16:10 skrll Exp $	*/
+/*	$NetBSD: armv6_start.S,v 1.16 2020/03/20 19:48:03 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2017, 2018 The NetBSD Foundation, Inc.
@@ -257,8 +257,8 @@ arm_build_translation_table:
 	ldr	r0, =(L1_S_SIZE - 1)
 	bic	R_PA, R_PA, r0
 
-	// attribute to map kernel - run without L1_S_CACHEABLE
-	ldr R_ATTR, =(L1_S_PROTO | L1_S_AP_KRW)
+	// attribute to map kernel
+	ldr R_ATTR, =(L1_S_PROTO | L1_S_AP_KRW | L1_S_NOCACHE)
 	bl	arm_boot_l1pt_init
 
 	/*
@@ -287,8 +287,8 @@ arm_build_translation_table:
 	adr	R_PA, generic_start	// PA of kernel
 	bic	R_PA, r2		// ...rounded down to L1_S boundary
 
-	// attribute to map kernel - run without L1_S_CACHEABLE
-	ldr R_ATTR, =(L1_S_PROTO | L1_S_AP_KRW)
+	// attribute to map kernel
+	ldr R_ATTR, =(L1_S_PROTO | L1_S_AP_KRW | L1_S_NOCACHE)
 	bl	arm_boot_l1pt_entry
 
 #if defined(FDTBASE)

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.88 src/sys/arch/arm/arm32/genassym.cf:1.89
--- src/sys/arch/arm/arm32/genassym.cf:1.88	Tue Feb 18 10:33:38 2020
+++ src/sys/arch/arm/arm32/genassym.cf	Fri Mar 20 19:48:03 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.88 2020/02/18 10:33:38 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.89 2020/03/20 19:48:03 skrll Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -109,6 +109,7 @@ define	L1_S_FRAME		L1_S_FRAME
 define	L1_S_SHIFT		L1_S_SHIFT
 define	L1_S_SIZE		L1_S_SIZE
 define	L1_S_CACHEABLE		L1_S_C|L1_S_B|L1_S_V6_S
+define	L1_S_NOCACHE		L1_S_XS_TEX(1)
 define	L1_S_B			L1_S_B
 define	L1_S_C			L1_S_C
 define	L1_S_V6_S		L1_S_V6_S



CVS commit: src/sys/uvm

2020-03-20 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Mar 20 19:08:54 UTC 2020

Modified Files:
src/sys/uvm: uvm_amap.c uvm_amap.h uvm_anon.c uvm_anon.h uvm_fault.c
uvm_loan.c uvm_map.c

Log Message:
Go back to freeing struct vm_anon one by one.  There may have been an
advantage circa ~2008 but there isn't now.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/uvm/uvm_amap.c
cvs rdiff -u -r1.40 -r1.41 src/sys/uvm/uvm_amap.h
cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/uvm_anon.h
cvs rdiff -u -r1.220 -r1.221 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.98 -r1.99 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.374 -r1.375 src/sys/uvm/uvm_map.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/uvm/uvm_amap.c
diff -u src/sys/uvm/uvm_amap.c:1.118 src/sys/uvm/uvm_amap.c:1.119
--- src/sys/uvm/uvm_amap.c:1.118	Sat Mar 14 20:23:51 2020
+++ src/sys/uvm/uvm_amap.c	Fri Mar 20 19:08:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_amap.c,v 1.118 2020/03/14 20:23:51 ad Exp $	*/
+/*	$NetBSD: uvm_amap.c,v 1.119 2020/03/20 19:08:54 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.118 2020/03/14 20:23:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.119 2020/03/20 19:08:54 ad Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -358,7 +358,7 @@ amap_extend(struct vm_map_entry *entry, 
 	int *newppref, *oldppref;
 #endif
 	int i, *newsl, *newbck, *oldsl, *oldbck;
-	struct vm_anon **newover, **oldover, *tofree;
+	struct vm_anon **newover, **oldover;
 	const km_flag_t kmflags =
 	(flags & AMAP_EXTEND_NOWAIT) ? KM_NOSLEEP : KM_SLEEP;
 
@@ -386,7 +386,6 @@ amap_extend(struct vm_map_entry *entry, 
 		slotadj = slotadd - slotoff;
 		slotarea = amap->am_maxslot - slotmapped;
 	}
-	tofree = NULL;
 
 	/*
 	 * case 1: we already have enough slots in the map and thus
@@ -399,10 +398,10 @@ amap_extend(struct vm_map_entry *entry, 
 #ifdef UVM_AMAP_PPREF
 			if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
 amap_pp_adjref(amap, slotoff + slotmapped,
-slotadd, 1, &tofree);
+slotadd, 1);
 			}
 #endif
-			uvm_anon_freelst(amap, tofree);
+			amap_unlock(amap);
 			UVMHIST_LOG(maphist,
 			"<- done (case 1f), amap = %#jx, sltneed=%jd",
 			(uintptr_t)amap, slotneed, 0, 0);
@@ -414,11 +413,10 @@ amap_extend(struct vm_map_entry *entry, 
 			entry->aref.ar_pageoff = slotoff;
 #ifdef UVM_AMAP_PPREF
 			if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
-amap_pp_adjref(amap, slotoff, slotadd, 1,
-&tofree);
+amap_pp_adjref(amap, slotoff, slotadd, 1);
 			}
 #endif
-			uvm_anon_freelst(amap, tofree);
+			amap_unlock(amap);
 			UVMHIST_LOG(maphist,
 			"<- done (case 1b), amap = %#jx, sltneed=%jd",
 			(uintptr_t)amap, slotneed, 0, 0);
@@ -439,14 +437,13 @@ amap_extend(struct vm_map_entry *entry, 
 	amap_pp_adjref(amap,
 	slotoff + slotmapped,
 	(amap->am_nslot -
-	(slotoff + slotmapped)), 1,
-	&tofree);
+	(slotoff + slotmapped)), 1);
 pp_setreflen(amap->am_ppref, amap->am_nslot, 1,
 slotneed - amap->am_nslot);
 			}
 #endif
 			amap->am_nslot = slotneed;
-			uvm_anon_freelst(amap, tofree);
+			amap_unlock(amap);
 
 			/*
 			 * no need to zero am_anon since that was done at
@@ -620,8 +617,7 @@ amap_extend(struct vm_map_entry *entry, 
 		if ((flags & AMAP_EXTEND_FORWARDS) &&
 		(slotoff + slotmapped) < amap->am_nslot)
 			amap_pp_adjref(amap, slotoff + slotmapped,
-			(amap->am_nslot - (slotoff + slotmapped)), 1,
-			&tofree);
+			(amap->am_nslot - (slotoff + slotmapped)), 1);
 		if (flags & AMAP_EXTEND_FORWARDS)
 			pp_setreflen(newppref, amap->am_nslot, 1,
 			slotneed - amap->am_nslot);
@@ -646,8 +642,7 @@ amap_extend(struct vm_map_entry *entry, 
 	}
 	oldnslots = amap->am_maxslot;
 	amap->am_maxslot = slotalloc;
-
-	uvm_anon_freelst(amap, tofree);
+	amap_unlock(amap);
 
 	kmem_free(oldsl, oldnslots * sizeof(*oldsl));
 	kmem_free(oldbck, oldnslots * sizeof(*oldbck));
@@ -727,7 +722,6 @@ amap_share_protect(struct vm_map_entry *
 void
 amap_wipeout(struct vm_amap *amap)
 {
-	struct vm_anon *tofree = NULL;
 	u_int lcv;
 
 	UVMHIST_FUNC("amap_wipeout"); UVMHIST_CALLED(maphist);
@@ -757,14 +751,13 @@ amap_wipeout(struct vm_amap *amap)
 		(uintptr_t)anon, anon->an_ref, 0, 0);
 
 		/*
-		 * Drop the reference.  Defer freeing.
+		 * Drop the reference.
 		 */
 
-		if (--anon->an_ref == 0) {
-			anon->an_link = tofree;
-			tofree = anon;
+		if (__predict_true(--anon->an_ref == 0)) {
+			uvm_anfree(anon);
 		}
-		if ((lcv & 31) == 31) {
+		if (__predict_false((lcv & 31) == 31)) {
 			preempt_point();
 		}
 	}
@@ -774,7 +767,7 @@ amap_wipeout(struct vm_amap *amap)
 	 */
 
 	amap->am_nused = 0;
-	uvm_anon_freelst(amap, tofree);
+	amap_unlo

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

2020-03-20 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Mar 20 19:06:14 UTC 2020

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

Log Message:
- pmap_extract(): This needs to take the pmap's lock, to allow for
  concurrent removal of pages (a new requirement).

- pmap_remove_pv(): Keep hold time of pp_lock as short as possible.

- pmap_get_ptp(): Don't re-init struct pmap_page for PD PTPs.  Would
  have no ill effects but is wrong regardless.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/arch/x86/x86/pmap.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/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.378 src/sys/arch/x86/x86/pmap.c:1.379
--- src/sys/arch/x86/x86/pmap.c:1.378	Thu Mar 19 18:58:14 2020
+++ src/sys/arch/x86/x86/pmap.c	Fri Mar 20 19:06:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.378 2020/03/19 18:58:14 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.379 2020/03/20 19:06:14 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.378 2020/03/19 18:58:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.379 2020/03/20 19:06:14 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -2163,20 +2163,22 @@ pmap_remove_pv(struct pmap *pmap, struct
 
 	pmap_check_pv(pmap, ptp, pp, va, true);
 
-	mutex_spin_enter(&pp->pp_lock);
-	pp->pp_attrs |= oattrs;
 	if (pve == NULL) {
+		mutex_spin_enter(&pp->pp_lock);
 		KASSERT(pp->pp_pte.pte_ptp == ptp);
 		KASSERT(pp->pp_pte.pte_va == va);
+		pp->pp_attrs |= oattrs;
 		pp->pp_pte.pte_ptp = NULL;
 		pp->pp_pte.pte_va = 0;
 		mutex_spin_exit(&pp->pp_lock);
 	} else {
+		mutex_spin_enter(&pp->pp_lock);
 		KASSERT(pp->pp_pte.pte_ptp != ptp ||
 		pp->pp_pte.pte_va != va);
 		KASSERT(pve->pve_pte.pte_ptp == ptp);
 		KASSERT(pve->pve_pte.pte_va == va);
 		KASSERT(pve->pve_pp == pp);
+		pp->pp_attrs |= oattrs;
 		LIST_REMOVE(pve, pve_list);
 		mutex_spin_exit(&pp->pp_lock);
 
@@ -2347,7 +2349,7 @@ pmap_get_ptp(struct pmap *pmap, struct p
 		if (pt->pg[i] == NULL) {
 			pmap_unget_ptp(pmap, pt);
 			return ENOMEM;
-		} else {
+		} else if (pt->alloced[i]) {
 			pt->pg[i]->uanon = (struct vm_anon *)(vaddr_t)~0L;
 			rb_tree_init(&VM_PAGE_TO_PP(pt->pg[i])->pp_rb,
 			&pmap_rbtree_ops);
@@ -3427,10 +3429,8 @@ pmap_extract(struct pmap *pmap, vaddr_t 
 	pd_entry_t pde;
 	pd_entry_t * const *pdes;
 	struct pmap *pmap2;
-	struct cpu_info *ci;
 	paddr_t pa;
-	lwp_t *l;
-	bool hard, rv;
+	bool rv;
 	int lvl;
 
 	if (__predict_false(pmap->pm_extract != NULL)) {
@@ -3448,29 +3448,11 @@ pmap_extract(struct pmap *pmap, vaddr_t 
 
 	rv = false;
 	pa = 0;
-	l = curlwp;
 
-	ci = l->l_cpu;
-	if (pmap == pmap_kernel() ||
-	__predict_true(!ci->ci_want_pmapload && ci->ci_pmap == pmap)) {
-		/*
-		 * no need to lock, because it's pmap_kernel() or our
-		 * own pmap and is active.  if a user pmap, the caller
-		 * will hold the vm_map write/read locked and so prevent
-		 * entries from disappearing while we are here.  ptps
-		 * can disappear via pmap_remove() and pmap_protect(),
-		 * but they are called with the vm_map write locked.
-		 */
-		hard = false;
-		ptes = PTE_BASE;
-		pdes = normal_pdes;
-		kpreempt_disable();
-	} else {
-		/* we lose, do it the hard way. */
-		hard = true;
+	if (pmap != pmap_kernel()) {
 		mutex_enter(&pmap->pm_lock);
-		pmap_map_ptes(pmap, &pmap2, &ptes, &pdes);
 	}
+	pmap_map_ptes(pmap, &pmap2, &ptes, &pdes);
 	if (pmap_pdes_valid(va, pdes, &pde, &lvl)) {
 		if (lvl == 2) {
 			pa = (pde & PTE_LGFRAME) | (va & (NBPD_L2 - 1));
@@ -3484,15 +3466,14 @@ pmap_extract(struct pmap *pmap, vaddr_t 
 			}
 		}
 	}
-	if (__predict_false(hard)) {
-		pmap_unmap_ptes(pmap, pmap2);
+	pmap_unmap_ptes(pmap, pmap2);
+	if (pmap != pmap_kernel()) {
 		mutex_exit(&pmap->pm_lock);
-	} else {
-		kpreempt_enable();
 	}
 	if (pap != NULL) {
 		*pap = pa;
 	}
+
 	return rv;
 }
 



CVS commit: src/sys/dev

2020-03-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Mar 20 19:03:13 UTC 2020

Modified Files:
src/sys/dev: cgd.c

Log Message:
cgd: switch from malloc(9) to kmem(9)

XXX might be worthwhile to use pool_cache(9) in the write path


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.123 src/sys/dev/cgd.c:1.124
--- src/sys/dev/cgd.c:1.123	Wed Mar 11 13:48:45 2020
+++ src/sys/dev/cgd.c	Fri Mar 20 19:03:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.123 2020/03/11 13:48:45 mlelstv Exp $ */
+/* $NetBSD: cgd.c,v 1.124 2020/03/20 19:03:13 tnn Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.123 2020/03/11 13:48:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.124 2020/03/20 19:03:13 tnn Exp $");
 
 #include 
 #include 
@@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.12
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -636,11 +635,11 @@ cgd_getdata(struct cgd_softc *sc, unsign
 	if (data)
 		return data;
 
-	return malloc(size, M_DEVBUF, M_NOWAIT);
+	return kmem_intr_alloc(size, KM_NOSLEEP);
 }
 
 static void
-cgd_putdata(struct cgd_softc *sc, void *data)
+cgd_putdata(struct cgd_softc *sc, void *data, unsigned long size)
 {
 
 	if (data == sc->sc_data) {
@@ -648,7 +647,7 @@ cgd_putdata(struct cgd_softc *sc, void *
 		sc->sc_data_used = false;
 		mutex_exit(&sc->sc_lock);
 	} else
-		free(data, M_DEVBUF);
+		kmem_intr_free(data, size);
 }
 
 static int
@@ -804,7 +803,7 @@ cgd_iodone2(struct cgd_softc *sc, struct
 
 	/* If we allocated memory, free it now... */
 	if (nbp->b_data != obp->b_data)
-		cgd_putdata(sc, nbp->b_data);
+		cgd_putdata(sc, nbp->b_data, nbp->b_bcount);
 
 	putiobuf(nbp);
 
@@ -857,7 +856,7 @@ cgd_dumpblocks(device_t dev, void *va, d
 	error = bdev_dump(sc->sc_tdev, blkno, buf, nbytes);
 
 	/* Release the buffer.  */
-	cgd_putdata(sc, buf);
+	cgd_putdata(sc, buf, nbytes);
 
 	/* Return any error from the underlying disk device.  */
 	return error;
@@ -1129,7 +1128,7 @@ cgd_ioctl_set(struct cgd_softc *sc, void
 
 	bufq_alloc(&dksc->sc_bufq, "fcfs", 0);
 
-	sc->sc_data = malloc(MAXPHYS, M_DEVBUF, M_WAITOK);
+	sc->sc_data = kmem_alloc(MAXPHYS, KM_SLEEP);
 	sc->sc_data_used = false;
 
 	/* Attach the disk. */
@@ -1168,7 +1167,7 @@ cgd_ioctl_clr(struct cgd_softc *sc, stru
 	(void)vn_close(sc->sc_tvn, FREAD|FWRITE, l->l_cred);
 	sc->sc_cfuncs->cf_destroy(sc->sc_cdata.cf_priv);
 	kmem_free(sc->sc_tpath, sc->sc_tpathlen);
-	free(sc->sc_data, M_DEVBUF);
+	kmem_free(sc->sc_data, MAXPHYS);
 	sc->sc_data_used = false;
 	dk_detach(dksc);
 	disk_detach(&dksc->sc_dkdev);
@@ -1486,7 +1485,7 @@ selftest(void)
 
 		sc.sc_cdata.cf_blocksize /= 8;
 
-		buf = malloc(txtlen, M_DEVBUF, M_WAITOK);
+		buf = kmem_alloc(txtlen, KM_SLEEP);
 		memcpy(buf, selftests[i].ptxt, txtlen);
 
 		cgd_cipher(&sc, buf, buf, txtlen, selftests[i].blkno,
@@ -1499,7 +1498,7 @@ selftest(void)
 		if (memcmp(buf, selftests[i].ptxt, txtlen) != 0)
 			panic("decryption is broken");
 
-		free(buf, M_DEVBUF);
+		kmem_free(buf, txtlen);
 		sc.sc_cfuncs->cf_destroy(sc.sc_cdata.cf_priv);
 	}
 



CVS commit: src/sys/uvm

2020-03-20 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Mar 20 18:50:09 UTC 2020

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
uvm_fault_upper_lookup(): don't call pmap_extract() and pmap_update() more
often than needed.


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.219 src/sys/uvm/uvm_fault.c:1.220
--- src/sys/uvm/uvm_fault.c:1.219	Tue Mar 17 18:31:39 2020
+++ src/sys/uvm/uvm_fault.c	Fri Mar 20 18:50:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.219 2020/03/17 18:31:39 ad Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.220 2020/03/20 18:50:09 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.219 2020/03/17 18:31:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.220 2020/03/20 18:50:09 ad Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1166,6 +1166,7 @@ uvm_fault_upper_lookup(
 	int lcv;
 	vaddr_t currva;
 	bool shadowed __unused;
+	bool entered;
 	UVMHIST_FUNC("uvm_fault_upper_lookup"); UVMHIST_CALLED(maphist);
 
 	/* locked: maps(read), amap(if there) */
@@ -1179,18 +1180,9 @@ uvm_fault_upper_lookup(
 
 	currva = flt->startva;
 	shadowed = false;
+	entered = false;
 	for (lcv = 0; lcv < flt->npages; lcv++, currva += PAGE_SIZE) {
 		/*
-		 * don't play with VAs that are already mapped
-		 * (except for center)
-		 */
-		if (lcv != flt->centeridx &&
-		pmap_extract(ufi->orig_map->pmap, currva, NULL)) {
-			pages[lcv] = PGO_DONTCARE;
-			continue;
-		}
-
-		/*
 		 * unmapped or center page.   check if any anon at this level.
 		 */
 		if (amap == NULL || anons[lcv] == NULL) {
@@ -1213,12 +1205,21 @@ uvm_fault_upper_lookup(
 
 		KASSERT(anon->an_lock == amap->am_lock);
 
-		/* Ignore loaned and busy pages. */
-		if (pg && pg->loan_count == 0 && (pg->flags & PG_BUSY) == 0) {
+		/*
+		 * ignore loaned and busy pages.
+		 * don't play with VAs that are already mapped.
+		 */
+
+		if (pg && pg->loan_count == 0 && (pg->flags & PG_BUSY) == 0 &&
+		!pmap_extract(ufi->orig_map->pmap, currva, NULL)) {
 			uvm_fault_upper_neighbor(ufi, flt, currva,
 			pg, anon->an_ref > 1);
+			entered = true;
 		}
 	}
+	if (entered) {
+		pmap_update(ufi->orig_map->pmap);
+	}
 
 	/* locked: maps(read), amap(if there) */
 	KASSERT(amap == NULL || rw_write_held(amap->am_lock));
@@ -1276,8 +1277,6 @@ uvm_fault_upper_neighbor(
 	readonly ? (flt->enter_prot & ~VM_PROT_WRITE) :
 	flt->enter_prot,
 	PMAP_CANFAIL | (flt->wire_mapping ? PMAP_WIRED : 0));
-
-	pmap_update(ufi->orig_map->pmap);
 }
 
 /*



CVS commit: src/sys/dev/ic

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 17:20:30 UTC 2020

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

Log Message:
Disable thrctrl or now and note why


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/dwc_mmc.c

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

Modified files:

Index: src/sys/dev/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.25 src/sys/dev/ic/dwc_mmc.c:1.26
--- src/sys/dev/ic/dwc_mmc.c:1.25	Fri Mar 20 17:07:17 2020
+++ src/sys/dev/ic/dwc_mmc.c	Fri Mar 20 17:20:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.25 2020/03/20 17:07:17 skrll Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.26 2020/03/20 17:20:30 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.25 2020/03/20 17:07:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.26 2020/03/20 17:20:30 skrll Exp $");
 
 #include 
 #include 
@@ -662,11 +662,21 @@ dwc_mmc_exec_command(sdmmc_chipset_handl
 		MMC_WRITE(sc, DWC_MMC_BLKSZ, cmd->c_blklen);
 		MMC_WRITE(sc, DWC_MMC_BYTECNT,
 		nblks > 1 ? nblks * cmd->c_blklen : cmd->c_datalen);
+
+#if 0
+		/*
+		 * The following doesn't work on the 250a verid IP in Odroid-XU4.
+		*
+		 * thrctl should only be used for UHS/HS200 and faster timings on
+		 * >=240a
+		 */
+
 		if (ISSET(cmd->c_flags, SCF_CMD_READ)) {
 			MMC_WRITE(sc, DWC_MMC_CARDTHRCTL,
 			__SHIFTIN(cmd->c_blklen, DWC_MMC_CARDTHRCTL_RDTHR) |
 			DWC_MMC_CARDTHRCTL_RDTHREN);
 		}
+#endif
 	}
 
 	MMC_WRITE(sc, DWC_MMC_IMASK, imask | sc->sc_intr_card);



CVS commit: src/sys/dev/pci

2020-03-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar 20 17:19:25 UTC 2020

Modified Files:
src/sys/dev/pci: if_wpi.c if_wpivar.h

Log Message:
Apply the same change as for if_iwi.c r1.114 here.

This driver sleeps during wpi_media_change(), and thus requires an adaptive
mutex for the media lock.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/if_wpi.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_wpivar.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_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.88 src/sys/dev/pci/if_wpi.c:1.89
--- src/sys/dev/pci/if_wpi.c:1.88	Thu Jan 30 06:10:26 2020
+++ src/sys/dev/pci/if_wpi.c	Fri Mar 20 17:19:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wpi.c,v 1.88 2020/01/30 06:10:26 thorpej Exp $	*/
+/*	$NetBSD: if_wpi.c,v 1.89 2020/03/20 17:19:25 sevan Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.88 2020/01/30 06:10:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.89 2020/03/20 17:19:25 sevan Exp $");
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -387,7 +387,11 @@ wpi_attach(device_t parent __unused, dev
 	/* override state transition machine */
 	sc->sc_newstate = ic->ic_newstate;
 	ic->ic_newstate = wpi_newstate;
-	ieee80211_media_init(ic, wpi_media_change, ieee80211_media_status);
+
+	/* XXX media locking needs revisiting */
+	mutex_init(&sc->sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET);
+	ieee80211_media_init_with_lock(ic,
+	wpi_media_change, ieee80211_media_status, &sc->sc_media_mtx);
 
 	sc->amrr.amrr_min_success_threshold =  1;
 	sc->amrr.amrr_max_success_threshold = 15;

Index: src/sys/dev/pci/if_wpivar.h
diff -u src/sys/dev/pci/if_wpivar.h:1.22 src/sys/dev/pci/if_wpivar.h:1.23
--- src/sys/dev/pci/if_wpivar.h:1.22	Mon Aug 20 04:50:56 2018
+++ src/sys/dev/pci/if_wpivar.h	Fri Mar 20 17:19:25 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_wpivar.h,v 1.22 2018/08/20 04:50:56 riastradh Exp $*/
+/*  $NetBSD: if_wpivar.h,v 1.23 2020/03/20 17:19:25 sevan Exp $*/
 
 /*-
  * Copyright (c) 2006
@@ -172,6 +172,8 @@ struct wpi_softc {
 
 	struct bpf_if *		sc_drvbpf;
 
+	kmutex_t 		sc_media_mtx;	/* XXX */
+
 	union {
 		struct wpi_rx_radiotap_header th;
 		uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];



CVS commit: src/sys/dev/ic

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 17:07:17 UTC 2020

Modified Files:
src/sys/dev/ic: dwc_mmc.c dwc_mmc_var.h

Log Message:
Remember / use sc_verid


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/dwc_mmc.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/dwc_mmc_var.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/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.24 src/sys/dev/ic/dwc_mmc.c:1.25
--- src/sys/dev/ic/dwc_mmc.c:1.24	Fri Mar 20 06:18:45 2020
+++ src/sys/dev/ic/dwc_mmc.c	Fri Mar 20 17:07:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.24 2020/03/20 06:18:45 skrll Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.25 2020/03/20 17:07:17 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.24 2020/03/20 06:18:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.25 2020/03/20 17:07:17 skrll Exp $");
 
 #include 
 #include 
@@ -807,11 +807,11 @@ dwc_mmc_init(struct dwc_mmc_softc *sc)
 {
 	uint32_t val;
 
-	if (sc->sc_fifo_reg == 0) {
-		val = MMC_READ(sc, DWC_MMC_VERID);
-		const u_int id = __SHIFTOUT(val, DWC_MMC_VERID_ID);
+	val = MMC_READ(sc, DWC_MMC_VERID);
+	sc->sc_verid = __SHIFTOUT(val, DWC_MMC_VERID_ID);
 
-		if (id < DWC_MMC_VERID_240A)
+	if (sc->sc_fifo_reg == 0) {
+		if (sc->sc_verid < DWC_MMC_VERID_240A)
 			sc->sc_fifo_reg = 0x100;
 		else
 			sc->sc_fifo_reg = 0x200;

Index: src/sys/dev/ic/dwc_mmc_var.h
diff -u src/sys/dev/ic/dwc_mmc_var.h:1.13 src/sys/dev/ic/dwc_mmc_var.h:1.14
--- src/sys/dev/ic/dwc_mmc_var.h:1.13	Thu Jan 23 23:53:55 2020
+++ src/sys/dev/ic/dwc_mmc_var.h	Fri Mar 20 17:07:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_var.h,v 1.13 2020/01/23 23:53:55 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_var.h,v 1.14 2020/03/20 17:07:17 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -45,6 +45,7 @@ struct dwc_mmc_softc {
 	u_int sc_clock_freq;
 	u_int sc_bus_width;
 	bool sc_card_inited;
+	u_int sc_verid;
 
 	void *sc_ih;
 	kmutex_t sc_lock;



CVS commit: src/sys/dev/ic

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 17:02:16 UTC 2020

Modified Files:
src/sys/dev/ic: dwc_mmc_reg.h

Log Message:
Add DWC_MMC_VERID_280A


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/dwc_mmc_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/ic/dwc_mmc_reg.h
diff -u src/sys/dev/ic/dwc_mmc_reg.h:1.9 src/sys/dev/ic/dwc_mmc_reg.h:1.10
--- src/sys/dev/ic/dwc_mmc_reg.h:1.9	Wed Jan 22 23:19:12 2020
+++ src/sys/dev/ic/dwc_mmc_reg.h	Fri Mar 20 17:02:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_reg.h,v 1.9 2020/01/22 23:19:12 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_reg.h,v 1.10 2020/03/20 17:02:16 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -153,6 +153,7 @@
 
 #define DWC_MMC_VERID_ID		__BITS(15,0)
 #define DWC_MMC_VERID_240A		0x240a
+#define DWC_MMC_VERID_280A		0x280a
 
 #define DWC_MMC_IDST_HOST_ABT		__BIT(10)
 #define DWC_MMC_IDST_ABNORMAL_INT_SUM	__BIT(9)



CVS commit: src/sys/dev/pci

2020-03-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar 20 16:35:41 UTC 2020

Modified Files:
src/sys/dev/pci: if_iwn.c if_iwnvar.h

Log Message:
Apply the same change as for if_iwi.c r1.114 here, as part of kern/55090.

This driver sleeps during iwn_media_change(), and thus requires an adaptive
mutex for the media lock.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_iwnvar.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_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.93 src/sys/dev/pci/if_iwn.c:1.94
--- src/sys/dev/pci/if_iwn.c:1.93	Thu Jan 30 06:03:34 2020
+++ src/sys/dev/pci/if_iwn.c	Fri Mar 20 16:35:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.93 2020/01/30 06:03:34 thorpej Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.94 2020/03/20 16:35:41 sevan Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.93 2020/01/30 06:03:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.94 2020/03/20 16:35:41 sevan Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -614,7 +614,11 @@ iwn_attach(device_t parent __unused, dev
 	/* Override 802.11 state transition machine. */
 	sc->sc_newstate = ic->ic_newstate;
 	ic->ic_newstate = iwn_newstate;
-	ieee80211_media_init(ic, iwn_media_change, ieee80211_media_status);
+
+	/* XXX media locking needs revisiting */
+	mutex_init(&sc->sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET);
+	ieee80211_media_init_with_lock(ic,
+	iwn_media_change, ieee80211_media_status, &sc->sc_media_mtx);
 
 	sc->amrr.amrr_min_success_threshold =  1;
 	sc->amrr.amrr_max_success_threshold = 15;

Index: src/sys/dev/pci/if_iwnvar.h
diff -u src/sys/dev/pci/if_iwnvar.h:1.21 src/sys/dev/pci/if_iwnvar.h:1.22
--- src/sys/dev/pci/if_iwnvar.h:1.21	Sat Oct  5 23:27:20 2019
+++ src/sys/dev/pci/if_iwnvar.h	Fri Mar 20 16:35:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwnvar.h,v 1.21 2019/10/05 23:27:20 mrg Exp $	*/
+/*	$NetBSD: if_iwnvar.h,v 1.22 2020/03/20 16:35:41 sevan Exp $	*/
 /*	$OpenBSD: if_iwnvar.h,v 1.28 2014/09/09 18:55:08 sthen Exp $	*/
 
 /*-
@@ -324,6 +324,8 @@ struct iwn_softc {
 
 	struct bpf_if *		sc_drvbpf;
 
+	kmutex_t 		sc_media_mtx;	/* XXX */
+
 	union {
 		struct iwn_rx_radiotap_header th;
 		uint8_t	pad[IEEE80211_RADIOTAP_HDRLEN];



CVS commit: src/sys/dev/pci

2020-03-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 20 13:33:23 UTC 2020

Modified Files:
src/sys/dev/pci: if_iwi.c if_iwivar.h

Log Message:
This driver sleeps during iwi_media_change(), and thus requires an
adaptive mutex for the media lock.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_iwi.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_iwivar.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_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.113 src/sys/dev/pci/if_iwi.c:1.114
--- src/sys/dev/pci/if_iwi.c:1.113	Thu Jan 30 06:03:34 2020
+++ src/sys/dev/pci/if_iwi.c	Fri Mar 20 13:33:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.113 2020/01/30 06:03:34 thorpej Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.114 2020/03/20 13:33:23 thorpej Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.113 2020/01/30 06:03:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.114 2020/03/20 13:33:23 thorpej Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -375,7 +375,11 @@ iwi_attach(device_t parent, device_t sel
 	/* override state transition machine */
 	sc->sc_newstate = ic->ic_newstate;
 	ic->ic_newstate = iwi_newstate;
-	ieee80211_media_init(ic, iwi_media_change, iwi_media_status);
+
+	/* XXX media locking needs revisiting */
+	mutex_init(&sc->sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET);
+	ieee80211_media_init_with_lock(ic,
+	iwi_media_change, iwi_media_status, &sc->sc_media_mtx);
 
 	/*
 	 * Allocate rings.

Index: src/sys/dev/pci/if_iwivar.h
diff -u src/sys/dev/pci/if_iwivar.h:1.19 src/sys/dev/pci/if_iwivar.h:1.20
--- src/sys/dev/pci/if_iwivar.h:1.19	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/pci/if_iwivar.h	Fri Mar 20 13:33:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwivar.h,v 1.19 2017/02/02 10:05:35 nonaka Exp $ */
+/*	$NetBSD: if_iwivar.h,v 1.20 2020/03/20 13:33:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005
@@ -148,6 +148,8 @@ struct iwi_softc {
 	bus_size_t		sc_sz;
 	void			*sc_soft_ih;
 
+	kmutex_t		sc_media_mtx;	/* XXX */
+
 	struct sysctllog	*sc_sysctllog;
 
 	int			antenna;



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

2020-03-20 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Fri Mar 20 12:29:09 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
use correct product name. still unfinished


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sociox/if_ave.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.2 src/sys/arch/arm/sociox/if_ave.c:1.3
--- src/sys/arch/arm/sociox/if_ave.c:1.2	Fri Mar 20 09:41:24 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Fri Mar 20 12:29:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.2 2020/03/20 09:41:24 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.3 2020/03/20 12:29:09 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.2 2020/03/20 09:41:24 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.3 2020/03/20 12:29:09 nisimura Exp $");
 
 #include 
 #include 
@@ -321,19 +321,22 @@ ave_fdt_attach(device_t parent, device_t
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	int i, error = 0;
 
-	if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
-		aprint_error(": couldn't get registers\n");
-		return;
-	}
-	error = bus_space_map(bst, addr, size, 0, &bsh);
-	if (error) {
-		aprint_error(": couldn't map registers: %d\n", error);
+	if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0
+	|| bus_space_map(faa->faa_bst, addr, size, 0, &bsh) != 0) {
+		aprint_error(": unable to map device\n");
 		return;
 	}
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error(": failed to decode interrupt\n");
 		return;
 	}
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET, 0,
+	ave_intr, sc);
+	if (sc->sc_ih == NULL) {
+		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
+		intrstr);
+		goto fail;
+	}
 
 	sc->sc_dev = self;
 	sc->sc_st = bst;
@@ -341,25 +344,20 @@ ave_fdt_attach(device_t parent, device_t
 	sc->sc_mapsize = size;
 	sc->sc_dmat = faa->faa_dmat;
 
-	aprint_naive("\n");
-	aprint_normal(": Gigabit Ethernet Controller\n");
-
 	hwimp = CSR_READ(sc, AVEID);
 	hwver = CSR_READ(sc, AVEHWVER);
-	aprint_normal_dev(self, "Unifier %c%c%c%c GbE (%d.%d)\n",
+
+	aprint_naive("\n");
+	aprint_normal(": Gigabit Ethernet Controller\n");
+	aprint_normal_dev(self, "UniPhier %c%c%c%c AVE GbE (%d.%d)\n",
 	hwimp >> 24, hwimp >> 16, hwimp >> 8, hwimp,
 	hwver >> 8, hwver & 0xff);
-
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET,
-		FDT_INTR_FLAGS, ave_intr, sc);
-	if (sc->sc_ih == NULL)
-		goto fail;
 	aprint_normal_dev(self, "interrupt on %s\n", intrstr);
 
 	phy_mode = fdtbus_get_string(phandle, "phy-mode");
 	if (phy_mode == NULL) {
 		aprint_error(": missing 'phy-mode' property\n");
-		return;
+		phy_mode = "rgmii";
 	}
 	if (strcmp(phy_mode, "rgmii") == 0)
 		sc->sc_phymode = 0;		/* RGMII */



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

2020-03-20 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Fri Mar 20 09:41:24 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: if_ave.c

Log Message:
remove #ifdef _LP64 as jmcneil@ suggested


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sociox/if_ave.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/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.1 src/sys/arch/arm/sociox/if_ave.c:1.2
--- src/sys/arch/arm/sociox/if_ave.c:1.1	Fri Mar 20 00:27:58 2020
+++ src/sys/arch/arm/sociox/if_ave.c	Fri Mar 20 09:41:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.1 2020/03/20 00:27:58 nisimura Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.2 2020/03/20 09:41:24 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.1 2020/03/20 00:27:58 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.2 2020/03/20 09:41:24 nisimura Exp $");
 
 #include 
 #include 
@@ -290,14 +290,11 @@ static int
 ave_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
 	static const char * compatible[] = {
-#ifdef _LP64
 		"socionext,unifier-ld20-ave4",
-#else
 		"socionext,unifier-pro4-ave4",
 		"socionext,unifier-pxs2-ave4",
 		"socionext,unifier-ld11-ave4",
 		"socionext,unifier-pxs3-ave4",
-#endif
 		NULL
 	};
 	struct fdt_attach_args * const faa = aux;



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-03-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 20 08:26:01 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_znode.c

Log Message:
With zfs_netbsd_reclaim() no longer doing an unconditional
zil commit dmu_buf_get_user() may return a NULL handle when
the znode already disappeared.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.30 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.31
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.30	Sun Feb 23 15:46:38 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c	Fri Mar 20 08:26:01 2020
@@ -1315,7 +1315,11 @@ zfs_zget_cleaner(zfsvfs_t *zfsvfs, uint6
 		return (SET_ERROR(EINVAL));
 	}
 	hdl = dmu_buf_get_user(db);
-	ASSERT3P(hdl, !=, NULL);
+	if (hdl == NULL) {
+		sa_buf_rele(db, NULL);
+		ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
+		return (SET_ERROR(EINVAL));
+	}
 	zp = sa_get_userdata(hdl);
 	ASSERT3U(zp->z_id, ==, obj_num);
 	sa_buf_rele(db, NULL);



CVS commit: src/share/man/man9

2020-03-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Mar 20 08:02:55 UTC 2020

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

Log Message:
Fix some typos, remove unnecessary Pp


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/share/man/man9/usbnet.9

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

Modified files:

Index: src/share/man/man9/usbnet.9
diff -u src/share/man/man9/usbnet.9:1.10 src/share/man/man9/usbnet.9:1.11
--- src/share/man/man9/usbnet.9:1.10	Fri Mar 20 01:15:05 2020
+++ src/share/man/man9/usbnet.9	Fri Mar 20 08:02:55 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: usbnet.9,v 1.10 2020/03/20 01:15:05 thorpej Exp $
+.\"	$NetBSD: usbnet.9,v 1.11 2020/03/20 08:02:55 wiz Exp $
 .\"
 .\" Copyright (c) 2019 Matthew R. Green
 .\" All rights reserved.
@@ -279,9 +279,8 @@ Returns true if device is dying (has bee
 pending detach.)
 .El
 .Pp
-Refrence counting functions for
+Reference counting functions for
 .Fa struct usbnet :
-.Pp
 .Bl -tag -width 4n
 .It Fn usbnet_busy un
 Increases the reference count on the driver instance, preventing
@@ -289,7 +288,7 @@ detach from occurring while the driver i
 device.
 Must be called with the core lock held.
 .It Fn usbnet_unbusy un
-Decreses the reference count on the driver instance.
+Decreases the reference count on the driver instance.
 Once the final reference has been dropped, if a detach event
 is pending, it is allowed to proceed.
 Must be called with the core lock held.



CVS commit: src/sys/dev/ic

2020-03-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 20 07:44:10 UTC 2020

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

Log Message:
 Print DDR3's row and column correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/spdmem.c

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.31 src/sys/dev/ic/spdmem.c:1.32
--- src/sys/dev/ic/spdmem.c:1.31	Sun Apr  7 01:39:12 2019
+++ src/sys/dev/ic/spdmem.c	Fri Mar 20 07:44:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.31 2019/04/07 01:39:12 pgoyette Exp $ */
+/* $NetBSD: spdmem.c,v 1.32 2020/03/20 07:44:10 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.31 2019/04/07 01:39:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.32 2020/03/20 07:44:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -797,7 +797,7 @@ decode_ddr3(const struct sysctlnode *nod
 	aprint_verbose_dev(self,
 	"%d rows, %d cols, %d log. banks, %d phys. banks, "
 	"%d.%03dns cycle time\n",
-	s->sm_ddr3.ddr3_rows + 9, s->sm_ddr3.ddr3_cols + 12,
+	s->sm_ddr3.ddr3_rows + 12, s->sm_ddr3.ddr3_cols + 9,
 	1 << (s->sm_ddr3.ddr3_logbanks + 3),
 	s->sm_ddr3.ddr3_physbanks + 1,
 	cycle_time/1000, cycle_time % 1000);