CVS commit: src/sys/compat

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 04:10:39 UTC 2018

Modified Files:
src/sys/compat/common: kern_cpu_60.c
src/sys/compat/sys: cpuio.h

Log Message:
include compat/sys/cpuio.h and multiple include protection.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/kern_cpu_60.c
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/sys/cpuio.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/compat/common/kern_cpu_60.c
diff -u src/sys/compat/common/kern_cpu_60.c:1.2 src/sys/compat/common/kern_cpu_60.c:1.3
--- src/sys/compat/common/kern_cpu_60.c:1.2	Sat Mar 17 20:51:45 2018
+++ src/sys/compat/common/kern_cpu_60.c	Sun Mar 18 00:10:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu_60.c,v 1.2 2018/03/18 00:51:45 christos Exp $	*/
+/*	$NetBSD: kern_cpu_60.c,v 1.3 2018/03/18 04:10:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.2 2018/03/18 00:51:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.3 2018/03/18 04:10:39 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_cpu_ucode.h"
@@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.
 #include 
 #include 
 
+#include 
+
 static int
 compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
 {

Index: src/sys/compat/sys/cpuio.h
diff -u src/sys/compat/sys/cpuio.h:1.7 src/sys/compat/sys/cpuio.h:1.8
--- src/sys/compat/sys/cpuio.h:1.7	Sat Mar 17 20:51:45 2018
+++ src/sys/compat/sys/cpuio.h	Sun Mar 18 00:10:39 2018
@@ -1,4 +1,7 @@
-/* $NetBSD: cpuio.h,v 1.7 2018/03/18 00:51:45 christos Exp $ */
+/* $NetBSD: cpuio.h,v 1.8 2018/03/18 04:10:39 christos Exp $ */
+
+#ifndef _SYS_COMPAT_CPUIO_H_
+#define _SYS_COMPAT_CPUIO_H_
 
 #include 
 
@@ -14,3 +17,5 @@ extern int (*compat_cpuctl_ioctl)(struct
 
 void kern_cpu_60_init(void);
 void kern_cpu_60_fini(void);
+
+#endif /* _SYS_COMPAT_CPUIO_H_ */



CVS commit: src/sys/kern

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 02:16:21 UTC 2018

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

Log Message:
Turn KASSERTS that check alignment which are user triggerable into errors.
>From alnsn


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.94 src/sys/kern/exec_elf.c:1.95
--- src/sys/kern/exec_elf.c:1.94	Fri Mar 16 20:30:50 2018
+++ src/sys/kern/exec_elf.c	Sat Mar 17 22:16:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.94 2018/03/17 00:30:50 christos Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.95 2018/03/18 02:16:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005, 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.94 2018/03/17 00:30:50 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.95 2018/03/18 02:16:21 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -101,7 +101,7 @@ extern struct emul emul_netbsd;
 static int
 elf_load_interp(struct lwp *, struct exec_package *, char *,
 struct exec_vmcmd_set *, u_long *, Elf_Addr *);
-static void
+static int
 elf_load_psection(struct exec_vmcmd_set *, struct vnode *, const Elf_Phdr *,
 Elf_Addr *, u_long *, int);
 
@@ -123,7 +123,7 @@ static void	elf_free_emul_arg(void *);
 #define	ELF_ROUND(a, b)		(((a) + (b) - 1) & ~((b) - 1))
 #define	ELF_TRUNC(a, b)		((a) & ~((b) - 1))
 
-static void
+static int
 elf_placedynexec(struct exec_package *epp, Elf_Ehdr *eh, Elf_Phdr *ph)
 {
 	Elf_Addr align, offset;
@@ -136,12 +136,17 @@ elf_placedynexec(struct exec_package *ep
 	offset = (Elf_Addr)pax_aslr_exec_offset(epp, align);
 	if (offset < epp->ep_vm_minaddr)
 		offset = roundup(epp->ep_vm_minaddr, align);
-	KASSERT((offset & (align - 1)) == 0);
+	if ((offset & (align - 1)) != 0) {
+		DPRINTF("bad offset=%#jx align=%#jx",
+		(uintmax_t)offset, (uintmax_t)align);
+		return EINVAL;
+	}
 
 	for (i = 0; i < eh->e_phnum; i++)
 		ph[i].p_vaddr += offset;
 	epp->ep_entryoffset = offset;
 	eh->e_entry += offset;
+	return 0;
 }
 
 /*
@@ -305,7 +310,7 @@ elf_check_header(Elf_Ehdr *eh)
  *
  * Load a psection at the appropriate address
  */
-static void
+static int
 elf_load_psection(struct exec_vmcmd_set *vcset, struct vnode *vp,
 const Elf_Phdr *ph, Elf_Addr *addr, u_long *size, int flags)
 {
@@ -324,7 +329,12 @@ elf_load_psection(struct exec_vmcmd_set 
 		 * Make sure we are virtually aligned as we are supposed to be.
 		 */
 		diff = ph->p_vaddr - ELF_TRUNC(ph->p_vaddr, ph->p_align);
-		KASSERT(*addr - diff == ELF_TRUNC(*addr, ph->p_align));
+		if (*addr - diff != ELF_TRUNC(*addr, ph->p_align)) {
+			DPRINTF("bad alignment %#jx != %#jx\n",
+			(uintptr_t)(*addr - diff),
+			(uintptr_t)ELF_TRUNC(*addr, ph->p_align));
+			return EINVAL;
+		}
 		/*
 		 * But make sure to not map any pages before the start of the
 		 * psection by limiting the difference to within a page.
@@ -383,6 +393,7 @@ elf_load_psection(struct exec_vmcmd_set 
 		0, vmprot, flags & VMCMD_RELATIVE);
 		*size = msize;
 	}
+	return 0;
 }
 
 /*
@@ -580,8 +591,9 @@ elf_load_interp(struct lwp *l, struct ex
 flags = VMCMD_RELATIVE;
 			}
 			last_ph = [i];
-			elf_load_psection(vcset, vp, [i], ,
-			, flags);
+			if ((error = elf_load_psection(vcset, vp, [i], ,
+			, flags)) != 0)
+goto bad;
 			/*
 			 * If entry is within this psection then this
 			 * must contain the .text section.  *entryoff is
@@ -719,8 +731,8 @@ exec_elf_makecmds(struct lwp *l, struct 
 		pos = (Elf_Addr)startp;
 	}
 
-	if (is_dyn)
-		elf_placedynexec(epp, eh, ph);
+	if (is_dyn && (error = elf_placedynexec(epp, eh, ph)) != 0)
+		goto bad;
 
 	/*
 	 * Load all the necessary sections
@@ -731,8 +743,10 @@ exec_elf_makecmds(struct lwp *l, struct 
 
 		switch (ph[i].p_type) {
 		case PT_LOAD:
-			elf_load_psection(>ep_vmcmds, epp->ep_vp,
-			[i], , , VMCMD_FIXED);
+			if ((error = elf_load_psection(>ep_vmcmds,
+			epp->ep_vp, [i], , , VMCMD_FIXED))
+			!= 0)
+goto bad;
 
 			/*
 			 * Consider this as text segment, if it is executable.



CVS commit: [pgoyette-compat] src

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 18 02:05:21 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/compat/common [pgoyette-compat]: Makefile compat_60_mod.c
compat_mod.c compat_mod.h files.common kern_time_60.c
src/sys/modules [pgoyette-compat]: Makefile
src/sys/modules/compat_60 [pgoyette-compat]: Makefile

Log Message:
Move closer to a complete compat_60 module.  All that remains is some
tty stuff and some ccd ioctl()s.


To generate a diff of this commit:
cvs rdiff -u -r1.114.2.3 -r1.114.2.4 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/compat/common/Makefile
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/compat/common/compat_60_mod.c
cvs rdiff -u -r1.24.14.14 -r1.24.14.15 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.3 -r1.1.42.4 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/compat/common/files.common
cvs rdiff -u -r1.1 -r1.1.38.1 src/sys/compat/common/kern_time_60.c
cvs rdiff -u -r1.202.2.7 -r1.202.2.8 src/sys/modules/Makefile
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/modules/compat_60/Makefile

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

Modified files:

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.3 src/distrib/sets/lists/modules/mi:1.114.2.4
--- src/distrib/sets/lists/modules/mi:1.114.2.3	Thu Mar 15 05:10:05 2018
+++ src/distrib/sets/lists/modules/mi	Sun Mar 18 02:05:21 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.3 2018/03/15 05:10:05 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.4 2018/03/18 02:05:21 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/compatbase-kernel-modules	kmod
 ./@MODULEDIR@/compat/compat.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/compat_60base-kernel-modules	kmod
+./@MODULEDIR@/compat_60/compat_60.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_70base-kernel-modules	kmod
 ./@MODULEDIR@/compat_70/compat_70.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_ossaudio			base-kernel-modules	kmod

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.63 src/sys/compat/common/Makefile:1.63.2.1
--- src/sys/compat/common/Makefile:1.63	Wed Dec 20 04:46:19 2017
+++ src/sys/compat/common/Makefile	Sun Mar 18 02:05:21 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.63 2017/12/20 04:46:19 maya Exp $
+#	$NetBSD: Makefile,v 1.63.2.1 2018/03/18 02:05:21 pgoyette Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -33,5 +33,9 @@ lib${LIB}.po:: ${POBJS:O}
 	@rm -f lib${LIB}.po
 	@${LD} -r -o lib${LIB}.po ${LDFLAGS} `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
 
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+=	-DCPU_UCODE
+.endif
+
 showsources: ${SRCS}
 	@echo ${.ALLSRC}

Index: src/sys/compat/common/compat_60_mod.c
diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.5 src/sys/compat/common/compat_60_mod.c:1.1.2.6
--- src/sys/compat/common/compat_60_mod.c:1.1.2.5	Sat Mar 17 06:49:57 2018
+++ src/sys/compat/common/compat_60_mod.c	Sun Mar 18 02:05:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_60_mod.c,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $	*/
+/*	$NetBSD: compat_60_mod.c,v 1.1.2.6 2018/03/18 02:05:21 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.6 2018/03/18 02:05:21 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -51,44 +51,47 @@ __KERNEL_RCSID(0, "$NetBSD: compat_60_mo
 #include 
 #include 
 
-static const struct syscall_package compat_60_syscalls[] = {
-	{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },
-	{ 0, 0, NULL }
-};
-
-#ifdef _MODULE
-
 #define REQUIRED_60 "compat_70"		/* XXX No compat_80 yet */
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
-static const struct syscall_package compat__60_syscalls[] = {
-{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },  
-NULL, 0, NULL }
-};
-#endif	/* _MODULE */
-
 int
-compat_60_init(void)
+compat_60_init()
 {
 	int error = 0;
 
-	error = syscall_establish(NULL, compat_60_syscalls);
+	error = kern_time_60_init();
 	if (error != 0)
 		return error;
-	return 0;
+
+#ifdef CPU_UCODE
+	error = kern_cpu_60_init();
+	if (error != 0) {
+		kern_time_60_fini();
+		return 0;
+	}
+#endif
+
+	return error;
 }
 
 int
-compat_60_fini(void)
+compat_60_fini()
 {
 	int error = 0;
 
-	error = syscall_disestablish(NULL, compat_60_syscalls);
+#ifdef CPU_UCODE
+	error = kern_cpu_60_fini();
+	if (error != 0)
+		return error;
+#endif
+
+	error = kern_time_60_fini();
+	if (error != 0)
+		

CVS commit: [pgoyette-compat] src/sys

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 18 01:17:29 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: kern_cpu_60.c
src/sys/compat/sys [pgoyette-compat]: cpuio.h
src/sys/kern [pgoyette-compat]: kern_cpu.c
src/sys/modules/compat [pgoyette-compat]: Makefile

Log Message:
Import from -current the MD glue code for compat cpu_ucode


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/compat/common/kern_cpu_60.c
cvs rdiff -u -r1.5.16.2 -r1.5.16.3 src/sys/compat/sys/cpuio.h
cvs rdiff -u -r1.71.16.7 -r1.71.16.8 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.14.14.3 -r1.14.14.4 src/sys/modules/compat/Makefile

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

Modified files:

Index: src/sys/compat/common/kern_cpu_60.c
diff -u src/sys/compat/common/kern_cpu_60.c:1.1.2.2 src/sys/compat/common/kern_cpu_60.c:1.1.2.3
--- src/sys/compat/common/kern_cpu_60.c:1.1.2.2	Sat Mar 17 21:37:52 2018
+++ src/sys/compat/common/kern_cpu_60.c	Sun Mar 18 01:17:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu_60.c,v 1.1.2.2 2018/03/17 21:37:52 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu_60.c,v 1.1.2.3 2018/03/18 01:17:29 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,21 +30,31 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.2 2018/03/17 21:37:52 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.3 2018/03/18 01:17:29 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
+#endif
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-#include 
+#include 
 
 static int
-compat6_cpuctl_ioctl(u_long cmd, void *data)
+compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
 {
+#if defined(CPU_UCODE) && defined(COMPAT_60)
+	int error;
+#endif
+
 	switch (cmd) {
 #if defined(CPU_UCODE) && defined(COMPAT_60)
 	case OIOC_CPU_UCODE_GET_VERSION:
@@ -62,14 +72,18 @@ compat6_cpuctl_ioctl(u_long cmd, void *d
  	}
 }
 
-void
+int
 kern_cpu_60_init(void)
 {
+
 	compat_cpuctl_ioctl = compat6_cpuctl_ioctl;
+	return 0;
 }
 
-void
+int
 kern_cpu_60_fini(void)
 {
+
 	compat_cpuctl_ioctl = (void *)enosys;
+	return 0;
 }

Index: src/sys/compat/sys/cpuio.h
diff -u src/sys/compat/sys/cpuio.h:1.5.16.2 src/sys/compat/sys/cpuio.h:1.5.16.3
--- src/sys/compat/sys/cpuio.h:1.5.16.2	Sat Mar 17 23:54:33 2018
+++ src/sys/compat/sys/cpuio.h	Sun Mar 18 01:17:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.5.16.2 2018/03/17 23:54:33 pgoyette Exp $ */
+/* $NetBSD: cpuio.h,v 1.5.16.3 2018/03/18 01:17:29 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@ struct compat6_cpu_ucode {
 	char fwname[PATH_MAX];
 };
 
-extern int (*compat_cpuctl_ioctl)(u_long, void *);
+extern int (*compat_cpuctl_ioctl)(struct lwp *, u_long, void *);
 
 #define OIOC_CPU_UCODE_GET_VERSION  _IOR('c', 4, struct compat6_cpu_ucode)
 #define OIOC_CPU_UCODE_APPLY_IOW('c', 5, struct compat6_cpu_ucode)

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.7 src/sys/kern/kern_cpu.c:1.71.16.8
--- src/sys/kern/kern_cpu.c:1.71.16.7	Sat Mar 17 21:37:53 2018
+++ src/sys/kern/kern_cpu.c	Sun Mar 18 01:17:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.7 2018/03/17 21:37:53 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.8 2018/03/18 01:17:29 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.7 2018/03/17 21:37:53 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.8 2018/03/18 01:17:29 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 
@@ -127,7 +127,7 @@ struct cpu_info **cpu_infos		__read_most
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;
 
-int (*compat_cpuctl_ioctl)(u_long, void *) = (void *)enosys;
+int (*compat_cpuctl_ioctl)(struct lwp *, u_long, void *) = (void *)enosys;
 
 static char cpu_model[128];
 
@@ -296,7 +296,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 #endif
 
 	default:
-		error = (*compat_cpuctl_ioctl)(cmd, data);
+		error = (*compat_cpuctl_ioctl)(l, cmd, data);
 		break;
 	}
 	mutex_exit(_lock);

Index: src/sys/modules/compat/Makefile
diff -u src/sys/modules/compat/Makefile:1.14.14.3 src/sys/modules/compat/Makefile:1.14.14.4
--- src/sys/modules/compat/Makefile:1.14.14.3	Sat Mar 17 06:49:57 2018
+++ src/sys/modules/compat/Makefile	Sun Mar 18 01:17:29 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14.14.3 2018/03/17 06:49:57 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.14.14.4 2018/03/18 01:17:29 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -25,6 +25,15 @@ CPPFLAGS+=	-DCOMPAT_30 -DCOMPAT_40 -DCOM
 CPPFLAGS+=	-DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
 CPPFLAGS+=	-DCOMPAT_43
 
+.if ${MACHINE_ARCH} 

CVS commit: src/sys

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 00:51:46 UTC 2018

Modified Files:
src/sys/compat/common: kern_cpu_60.c
src/sys/compat/sys: cpuio.h
src/sys/kern: kern_cpu.c
src/sys/modules/compat: Makefile

Log Message:
finish MD glue for compat ucode module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/kern_cpu_60.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/cpuio.h
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.14 -r1.15 src/sys/modules/compat/Makefile

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

Modified files:

Index: src/sys/compat/common/kern_cpu_60.c
diff -u src/sys/compat/common/kern_cpu_60.c:1.1 src/sys/compat/common/kern_cpu_60.c:1.2
--- src/sys/compat/common/kern_cpu_60.c:1.1	Sat Mar 17 15:00:23 2018
+++ src/sys/compat/common/kern_cpu_60.c	Sat Mar 17 20:51:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu_60.c,v 1.1 2018/03/17 19:00:23 christos Exp $	*/
+/*	$NetBSD: kern_cpu_60.c,v 1.2 2018/03/18 00:51:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1 2018/03/17 19:00:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.2 2018/03/18 00:51:45 christos Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_cpu_ucode.h"
+#include "opt_compat_netbsd.h"
+#endif
 
 #include 
 #include 
@@ -40,11 +45,12 @@ __KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.
 #include 
 #include 
 
-#include 
-
 static int
-compat6_cpuctl_ioctl(u_long cmd, void *data)
+compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
 {
+#if defined(CPU_UCODE) && defined(COMPAT_60)
+	int error;
+#endif
 	switch (cmd) {
 #if defined(CPU_UCODE) && defined(COMPAT_60)
 	case OIOC_CPU_UCODE_GET_VERSION:

Index: src/sys/compat/sys/cpuio.h
diff -u src/sys/compat/sys/cpuio.h:1.6 src/sys/compat/sys/cpuio.h:1.7
--- src/sys/compat/sys/cpuio.h:1.6	Sat Mar 17 15:00:23 2018
+++ src/sys/compat/sys/cpuio.h	Sat Mar 17 20:51:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.6 2018/03/17 19:00:23 christos Exp $ */
+/* $NetBSD: cpuio.h,v 1.7 2018/03/18 00:51:45 christos Exp $ */
 
 #include 
 
@@ -7,7 +7,7 @@ struct compat6_cpu_ucode {
 	char fwname[PATH_MAX];
 };
 
-extern int (*compat_cpuctl_ioctl)(u_long, void *);
+extern int (*compat_cpuctl_ioctl)(struct lwp *, u_long, void *);
 
 #define OIOC_CPU_UCODE_GET_VERSION  _IOR('c', 4, struct compat6_cpu_ucode)
 #define OIOC_CPU_UCODE_APPLY_IOW('c', 5, struct compat6_cpu_ucode)

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.72 src/sys/kern/kern_cpu.c:1.73
--- src/sys/kern/kern_cpu.c:1.72	Sat Mar 17 15:03:25 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 20:51:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.72 2018/03/17 19:03:25 christos Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.73 2018/03/18 00:51:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.72 2018/03/17 19:03:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.73 2018/03/18 00:51:46 christos Exp $");
 
 #include "opt_cpu_ucode.h"
 
@@ -127,7 +127,7 @@ struct cpu_info **cpu_infos		__read_most
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;
 
-int (*compat_cpuctl_ioctl)(u_long, void *) = (void *)enosys;
+int (*compat_cpuctl_ioctl)(struct lwp *, u_long, void *) = (void *)enosys;
 
 static char cpu_model[128];
 
@@ -296,7 +296,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 #endif
 
 	default:
-		error = (*compat_cpuctl_ioctl)(cmd, data);
+		error = (*compat_cpuctl_ioctl)(l, cmd, data);
 		break;
 	}
 	mutex_exit(_lock);

Index: src/sys/modules/compat/Makefile
diff -u src/sys/modules/compat/Makefile:1.14 src/sys/modules/compat/Makefile:1.15
--- src/sys/modules/compat/Makefile:1.14	Thu Nov  3 00:26:58 2016
+++ src/sys/modules/compat/Makefile	Sat Mar 17 20:51:46 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14 2016/11/03 04:26:58 riastradh Exp $
+#	$NetBSD: Makefile,v 1.15 2018/03/18 00:51:46 christos Exp $
 
 .include "../Makefile.inc"
 
@@ -24,6 +24,13 @@ CPPFLAGS+=	-DCOMPAT_20
 CPPFLAGS+=	-DCOMPAT_30 -DCOMPAT_40 -DCOMPAT_50
 CPPFLAGS+=	-DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
 CPPFLAGS+=	-DCOMPAT_43
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+CPPFLAGS+=	-DCPU_UCODE
+# pick up more for bsd.klinks.mk as needed.
+MACHINE_EXTRA=	x86
+.else
+MACHINE_EXTRA=	none
+.endif
 
 .include "../../compat/common/Makefile.sysio"
 
@@ -32,17 +39,15 @@ SRCS+=	compat_mod.c
 .PATH:	${S}/arch/${MACHINE}/${MACHINE}
 .PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
 .PATH:	${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}
+.PATH:	${S}	${S}/arch/${MACHINE_EXTRA}/${MACHINE_EXTRA}
 
-.if (exists(${S}/arch/${MACHINE}/${MACHINE}/compat_13_machdep.c)) || \

CVS commit: [pgoyette-compat] src/sys/arch

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Mar 18 00:35:26 UTC 2018

Modified Files:
src/sys/arch/x86/conf [pgoyette-compat]: files.x86
src/sys/arch/x86/x86 [pgoyette-compat]: cpu_ucode.c
src/sys/arch/xen/conf [pgoyette-compat]: files.xen
Added Files:
src/sys/arch/x86/x86 [pgoyette-compat]: compat_60_cpu_ucode.c

Log Message:
Import more christos@ changes from -current


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/x86/x86/compat_60_cpu_ucode.c
cvs rdiff -u -r1.5.16.3 -r1.5.16.4 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.165.2.1 -r1.165.2.2 src/sys/arch/xen/conf/files.xen

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/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.97 src/sys/arch/x86/conf/files.x86:1.97.2.1
--- src/sys/arch/x86/conf/files.x86:1.97	Thu Mar  1 06:36:12 2018
+++ src/sys/arch/x86/conf/files.x86	Sun Mar 18 00:35:26 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.97 2018/03/01 06:36:12 mrg Exp $
+#	$NetBSD: files.x86,v 1.97.2.1 2018/03/18 00:35:26 pgoyette Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -111,6 +111,7 @@ file 	uvm/pmap/pmap_pvt.c		machdep
 file	arch/x86/x86/cpu_ucode.c	cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_intel.c	cpu_ucode needs-flag
+filearch/x86/x86/compat_60_cpu_ucode.c	compat_60 & cpu_ucode
 
 define	lapic
 file	arch/x86/x86/lapic.c		lapic needs-flag

Index: src/sys/arch/x86/x86/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.3 src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.4
--- src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.3	Sat Mar 17 21:37:52 2018
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sun Mar 18 00:35:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.5.16.3 2018/03/17 21:37:52 pgoyette Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.5.16.4 2018/03/18 00:35:26 pgoyette Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,13 +29,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.3 2018/03/17 21:37:52 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.4 2018/03/18 00:35:26 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_xen.h"
-
 #include "opt_cpu_ucode.h"
-#include "opt_compat_netbsd.h"
 #endif
 
 #include 
@@ -157,36 +155,3 @@ cpu_ucode_apply(const struct cpu_ucode *
 	return error;
 }
 #endif
-
-#ifdef COMPAT_60
-int
-compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
-{
-	struct cpu_ucode_version ndata;
-
-	switch (cpu_vendor) {
-	case CPUVENDOR_AMD:
-		ndata.loader_version = CPU_UCODE_LOADER_AMD;
-		return cpu_ucode_amd_get_version(, >version,
-		sizeof(data->version));
-	default:
-		return EOPNOTSUPP;
-	}
-}
-
-int
-compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data6)
-{
-
-	if (cpu_vendor != CPUVENDOR_AMD)
-		return EOPNOTSUPP;
-
-	struct cpu_ucode data;
-
-	data.loader_version = CPU_UCODE_LOADER_AMD;
-	data.cpu_nr = CPU_UCODE_ALL_CPUS;
-	strcpy(data.fwname, data6->fwname);
-
-	return cpu_ucode_apply();
-}
-#endif /* COMPAT60 */

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.165.2.1 src/sys/arch/xen/conf/files.xen:1.165.2.2
--- src/sys/arch/xen/conf/files.xen:1.165.2.1	Sat Mar 17 21:37:52 2018
+++ src/sys/arch/xen/conf/files.xen	Sun Mar 18 00:35:26 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.165.2.1 2018/03/17 21:37:52 pgoyette Exp $
+#	$NetBSD: files.xen,v 1.165.2.2 2018/03/18 00:35:26 pgoyette Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -96,6 +96,8 @@ file	arch/xen/x86/xenfunc.c
 file	arch/x86/x86/cpu_ucode.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_intel.c	dom0ops & cpu_ucode needs-flag
+file	arch/x86/x86/compat_60_cpu_ucode.c  compat_60 & dom0ops & cpu_ucode
+
 
 file	arch/xen/xen/xen_machdep.c
 file	arch/xen/xen/xen_debug.c

Added files:

Index: src/sys/arch/x86/x86/compat_60_cpu_ucode.c
diff -u /dev/null src/sys/arch/x86/x86/compat_60_cpu_ucode.c:1.1.2.2
--- /dev/null	Sun Mar 18 00:35:26 2018
+++ src/sys/arch/x86/x86/compat_60_cpu_ucode.c	Sun Mar 18 00:35:26 2018
@@ -0,0 +1,81 @@
+/* $NetBSD: compat_60_cpu_ucode.c,v 1.1.2.2 2018/03/18 00:35:26 pgoyette Exp $ */
+/*
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source 

CVS commit: src/sys/arch

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 18 00:17:18 UTC 2018

Modified Files:
src/sys/arch/x86/conf: files.x86
src/sys/arch/x86/x86: cpu_ucode.c
src/sys/arch/xen/conf: files.xen
Added Files:
src/sys/arch/x86/x86: compat_60_cpu_ucode.c

Log Message:
Separate the compat code in its own file to facilitate module building.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/compat_60_cpu_ucode.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.167 -r1.168 src/sys/arch/xen/conf/files.xen

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/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.97 src/sys/arch/x86/conf/files.x86:1.98
--- src/sys/arch/x86/conf/files.x86:1.97	Thu Mar  1 01:36:12 2018
+++ src/sys/arch/x86/conf/files.x86	Sat Mar 17 20:17:17 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.97 2018/03/01 06:36:12 mrg Exp $
+#	$NetBSD: files.x86,v 1.98 2018/03/18 00:17:17 christos Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -111,6 +111,7 @@ file 	uvm/pmap/pmap_pvt.c		machdep
 file	arch/x86/x86/cpu_ucode.c	cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_intel.c	cpu_ucode needs-flag
+filearch/x86/x86/compat_60_cpu_ucode.c	compat_60 & cpu_ucode
 
 define	lapic
 file	arch/x86/x86/lapic.c		lapic needs-flag

Index: src/sys/arch/x86/x86/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.7 src/sys/arch/x86/x86/cpu_ucode.c:1.8
--- src/sys/arch/x86/x86/cpu_ucode.c:1.7	Sat Mar 17 16:02:32 2018
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sat Mar 17 20:17:18 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.7 2018/03/17 20:02:32 christos Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.8 2018/03/18 00:17:18 christos Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,13 +29,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.7 2018/03/17 20:02:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.8 2018/03/18 00:17:18 christos Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_xen.h"
 
-#include "opt_compat_netbsd.h"
-
 #include 
 #include 
 #include 
@@ -155,36 +153,3 @@ cpu_ucode_apply(const struct cpu_ucode *
 	return error;
 }
 #endif
-
-#ifdef COMPAT_60
-int
-compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
-{
-	struct cpu_ucode_version ndata;
-
-	switch (cpu_vendor) {
-	case CPUVENDOR_AMD:
-		ndata.loader_version = CPU_UCODE_LOADER_AMD;
-		return cpu_ucode_amd_get_version(, >version,
-		sizeof(data->version));
-	default:
-		return EOPNOTSUPP;
-	}
-}
-
-int
-compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data6)
-{
-
-	if (cpu_vendor != CPUVENDOR_AMD)
-		return EOPNOTSUPP;
-
-	struct cpu_ucode data;
-
-	data.loader_version = CPU_UCODE_LOADER_AMD;
-	data.cpu_nr = CPU_UCODE_ALL_CPUS;
-	strcpy(data.fwname, data6->fwname);
-
-	return cpu_ucode_apply();
-}
-#endif /* COMPAT60 */

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.167 src/sys/arch/xen/conf/files.xen:1.168
--- src/sys/arch/xen/conf/files.xen:1.167	Sat Mar 17 16:03:01 2018
+++ src/sys/arch/xen/conf/files.xen	Sat Mar 17 20:17:18 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.167 2018/03/17 20:03:01 christos Exp $
+#	$NetBSD: files.xen,v 1.168 2018/03/18 00:17:18 christos Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -95,6 +95,8 @@ file	arch/xen/x86/xenfunc.c
 file	arch/x86/x86/cpu_ucode.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_intel.c	dom0ops & cpu_ucode needs-flag
+file	arch/x86/x86/compat_60_cpu_ucode.c  compat_60 & dom0ops & cpu_ucode
+
 
 file	arch/xen/xen/xen_machdep.c
 file	arch/xen/xen/xen_debug.c

Added files:

Index: src/sys/arch/x86/x86/compat_60_cpu_ucode.c
diff -u /dev/null src/sys/arch/x86/x86/compat_60_cpu_ucode.c:1.1
--- /dev/null	Sat Mar 17 20:17:18 2018
+++ src/sys/arch/x86/x86/compat_60_cpu_ucode.c	Sat Mar 17 20:17:18 2018
@@ -0,0 +1,81 @@
+/* $NetBSD: compat_60_cpu_ucode.c,v 1.1 2018/03/18 00:17:18 christos Exp $ */
+/*
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 

CVS commit: [pgoyette-compat] src/sys/compat/sys

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 23:54:33 UTC 2018

Modified Files:
src/sys/compat/sys [pgoyette-compat]: cpuio.h

Log Message:
Add copyright, protect against double-inclusion


To generate a diff of this commit:
cvs rdiff -u -r1.5.16.1 -r1.5.16.2 src/sys/compat/sys/cpuio.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/compat/sys/cpuio.h
diff -u src/sys/compat/sys/cpuio.h:1.5.16.1 src/sys/compat/sys/cpuio.h:1.5.16.2
--- src/sys/compat/sys/cpuio.h:1.5.16.1	Sat Mar 17 21:37:52 2018
+++ src/sys/compat/sys/cpuio.h	Sat Mar 17 23:54:33 2018
@@ -1,4 +1,36 @@
-/* $NetBSD: cpuio.h,v 1.5.16.1 2018/03/17 21:37:52 pgoyette Exp $ */
+/* $NetBSD: cpuio.h,v 1.5.16.2 2018/03/17 23:54:33 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * 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.
+ */
+
+#ifndef _COMPAT_SYS_CPUIO_H
+#define _COMPAT_SYS_CPUIO_H
 
 #include 
 
@@ -12,5 +44,4 @@ extern int (*compat_cpuctl_ioctl)(u_long
 #define OIOC_CPU_UCODE_GET_VERSION  _IOR('c', 4, struct compat6_cpu_ucode)
 #define OIOC_CPU_UCODE_APPLY_IOW('c', 5, struct compat6_cpu_ucode)
 
-void kern_cpu_60_init(void);
-void kern_cpu_60_fini(void);
+#endif /* _COMPAT_SYS_CPUIO_H */



CVS commit: src/usr.sbin/sysinst/arch/sgimips

2018-03-17 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar 17 22:27:04 UTC 2018

Modified Files:
src/usr.sbin/sysinst/arch/sgimips: md.c

Log Message:
Official builds now append a timestamp to the kernel config name, so we
can no longer rely on matching an exact name like "(INSTALL32_IP3x)".

Strip the trailing ) from the version strings checked so sysinst will
install the correct bootloader and kernel again.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/sgimips/md.c

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

Modified files:

Index: src/usr.sbin/sysinst/arch/sgimips/md.c
diff -u src/usr.sbin/sysinst/arch/sgimips/md.c:1.3 src/usr.sbin/sysinst/arch/sgimips/md.c:1.4
--- src/usr.sbin/sysinst/arch/sgimips/md.c:1.3	Fri Jan  2 19:43:13 2015
+++ src/usr.sbin/sysinst/arch/sgimips/md.c	Sat Mar 17 22:27:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $	*/
+/*	$NetBSD: md.c,v 1.4 2018/03/17 22:27:04 jmcneill Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -68,11 +68,11 @@ md_init_set_status(int flags)
  * enable the installation of the corresponding GENERIC kernel.
  */
 uname();
-if (strstr(instsys.version, "(INSTALL32_IP3x)"))
+if (strstr(instsys.version, "(INSTALL32_IP3x"))
 set_kernel_set(SET_KERNEL_2);
-else if (strstr(instsys.version, "(INSTALL32_IP2x)"))
+else if (strstr(instsys.version, "(INSTALL32_IP2x"))
 set_kernel_set(SET_KERNEL_1);
-	else if (strstr(instsys.version, "(GENERIC32_IP12)"))
+	else if (strstr(instsys.version, "(GENERIC32_IP12"))
 		set_kernel_set(SET_KERNEL_3);
 }
 
@@ -156,12 +156,12 @@ md_pre_disklabel(void)
 int
 md_post_disklabel(void)
 {
-if (strstr(instsys.version, "(INSTALL32_IP3x)"))
+if (strstr(instsys.version, "(INSTALL32_IP3x"))
 		return run_program(RUN_DISPLAY,
 		"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
 		pm->diskdev);
 
-	if (strstr(instsys.version, "(INSTALL32_IP2x)")) {
+	if (strstr(instsys.version, "(INSTALL32_IP2x")) {
 		run_program(RUN_DISPLAY,
 		  "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
 		  pm->diskdev);
@@ -198,7 +198,7 @@ md_cleanup_install(void)
 	enable_rc_conf();
 #endif
 
-	if (strstr(instsys.version, "(GENERIC32_IP12)"))
+	if (strstr(instsys.version, "(GENERIC32_IP12"))
 		run_program(0, "/usr/mdec/sgivol -f -w netbsd %s %s",
 			target_expand("/netbsd.ecoff"), pm->diskdev);
 }



CVS commit: [pgoyette-compat] src/sys

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 21:37:53 UTC 2018

Modified Files:
src/sys/arch/x86/include [pgoyette-compat]: cpu_ucode.h
src/sys/arch/x86/x86 [pgoyette-compat]: cpu_ucode.c cpu_ucode_amd.c
cpu_ucode_intel.c
src/sys/arch/xen/conf [pgoyette-compat]: files.xen
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_mod.c
src/sys/compat/sys [pgoyette-compat]: cpuio.h
src/sys/kern [pgoyette-compat]: kern_cpu.c
Added Files:
src/sys/compat/common [pgoyette-compat]: kern_cpu_60.c
Removed Files:
src/sys/arch/xen/xen [pgoyette-compat]: xen_ucode.c

Log Message:
Import christos's changes for the compat_60 cpu_ucode stuff


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.36.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.5.16.2 -r1.5.16.3 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.7 -r1.7.28.1 src/sys/arch/x86/x86/cpu_ucode_amd.c
cvs rdiff -u -r1.12 -r1.12.8.1 src/sys/arch/x86/x86/cpu_ucode_intel.c
cvs rdiff -u -r1.165 -r1.165.2.1 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.5 -r0 src/sys/arch/xen/xen/xen_ucode.c
cvs rdiff -u -r1.7.18.3 -r1.7.18.4 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.24.14.13 -r1.24.14.14 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/compat/common/kern_cpu_60.c
cvs rdiff -u -r1.5 -r1.5.16.1 src/sys/compat/sys/cpuio.h
cvs rdiff -u -r1.71.16.6 -r1.71.16.7 src/sys/kern/kern_cpu.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/include/cpu_ucode.h
diff -u src/sys/arch/x86/include/cpu_ucode.h:1.3 src/sys/arch/x86/include/cpu_ucode.h:1.3.36.1
--- src/sys/arch/x86/include/cpu_ucode.h:1.3	Wed Oct 17 20:19:55 2012
+++ src/sys/arch/x86/include/cpu_ucode.h	Sat Mar 17 21:37:52 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.h,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
+/* $NetBSD: cpu_ucode.h,v 1.3.36.1 2018/03/17 21:37:52 pgoyette Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,14 +47,11 @@ struct cpu_ucode_version_intel1 {
 #include 
 #include 
 
-int cpu_ucode_amd_get_version(struct cpu_ucode_version *);
-#ifdef COMPAT_60
-int compat6_cpu_ucode_amd_get_version(struct compat6_cpu_ucode *);
-#endif
+int cpu_ucode_amd_get_version(struct cpu_ucode_version *, void *, size_t);
 int cpu_ucode_amd_firmware_open(firmware_handle_t *, const char *);
 int cpu_ucode_amd_apply(struct cpu_ucode_softc *, int);
 
-int cpu_ucode_intel_get_version(struct cpu_ucode_version *);
+int cpu_ucode_intel_get_version(struct cpu_ucode_version *, void *, size_t);
 int cpu_ucode_intel_firmware_open(firmware_handle_t *, const char *);
 int cpu_ucode_intel_apply(struct cpu_ucode_softc *, int);
 #endif /* _KERNEL */

Index: src/sys/arch/x86/x86/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.2 src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.3
--- src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.2	Sat Mar 17 06:49:56 2018
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sat Mar 17 21:37:52 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.5.16.2 2018/03/17 06:49:56 pgoyette Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.5.16.3 2018/03/17 21:37:52 pgoyette Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,9 +29,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.2 2018/03/17 06:49:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.3 2018/03/17 21:37:52 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
+#include "opt_xen.h"
+
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
 #endif
@@ -47,39 +49,40 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,
 
 #include 
 
+#ifdef XEN
+#include 
+#include 
+#endif
+
 static struct cpu_ucode_softc ucode_softc;
 
 int
 cpu_ucode_get_version(struct cpu_ucode_version *data)
 {
+	union {
+		struct cpu_ucode_version_amd a;
+		struct cpu_ucode_version_intel1 i;
+	} v;
+	size_t l;
+	int error;
+
+	if (!data->data)
+		return 0;
 
 	switch (cpu_vendor) {
 	case CPUVENDOR_AMD:
-		return cpu_ucode_amd_get_version(data);
+		error = cpu_ucode_amd_get_version(data, , l = sizeof(v.a));
 	case CPUVENDOR_INTEL:
-		return cpu_ucode_intel_get_version(data);
+		error = cpu_ucode_intel_get_version(data, , l = sizeof(v.i));
 	default:
 		return EOPNOTSUPP;
 	}
 
-	return 0;
-}
-
-#ifdef COMPAT_60
-int
-compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
-{
-
-	switch (cpu_vendor) {
-	case CPUVENDOR_AMD:
-		return compat6_cpu_ucode_amd_get_version(data);
-	default:
-		return EOPNOTSUPP;
-	}
+	if (error)
+		return error;
 
-	return 0;
+	return copyout(, data->data, l);
 }
-#endif /* COMPAT60 */
 
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -94,6 +97,7 @@ cpu_ucode_md_open(firmware_handle_t *fwh
 	}
 }
 
+#ifndef XEN
 int
 cpu_ucode_apply(const struct cpu_ucode *data)
 {

CVS commit: src/sys/arch/xen

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 20:03:01 UTC 2018

Modified Files:
src/sys/arch/xen/conf: files.xen
Removed Files:
src/sys/arch/xen/xen: xen_ucode.c

Log Message:
dedup microcode handling.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.6 -r0 src/sys/arch/xen/xen/xen_ucode.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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.166 src/sys/arch/xen/conf/files.xen:1.167
--- src/sys/arch/xen/conf/files.xen:1.166	Fri Mar 16 08:48:54 2018
+++ src/sys/arch/xen/conf/files.xen	Sat Mar 17 16:03:01 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.166 2018/03/16 12:48:54 maxv Exp $
+#	$NetBSD: files.xen,v 1.167 2018/03/17 20:03:01 christos Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -92,7 +92,7 @@ file	arch/xen/x86/xen_pmap.c
 file	arch/xen/x86/xen_intr.c
 file	arch/xen/x86/xenfunc.c
 
-file	arch/xen/xen/xen_ucode.c	dom0ops & cpu_ucode needs-flag
+file	arch/x86/x86/cpu_ucode.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_amd.c	dom0ops & cpu_ucode needs-flag
 file	arch/x86/x86/cpu_ucode_intel.c	dom0ops & cpu_ucode needs-flag
 



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

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 20:02:32 UTC 2018

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

Log Message:
dedup and handle XEN here.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/x86/cpu_ucode.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/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.6 src/sys/arch/x86/x86/cpu_ucode.c:1.7
--- src/sys/arch/x86/x86/cpu_ucode.c:1.6	Sat Mar 17 11:56:32 2018
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sat Mar 17 16:02:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.6 2018/03/17 15:56:32 christos Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.7 2018/03/17 20:02:32 christos Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,9 +29,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.6 2018/03/17 15:56:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.7 2018/03/17 20:02:32 christos Exp $");
 
 #include "opt_cpu_ucode.h"
+#include "opt_xen.h"
+
 #include "opt_compat_netbsd.h"
 
 #include 
@@ -45,6 +47,11 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,
 
 #include 
 
+#ifdef XEN
+#include 
+#include 
+#endif
+
 static struct cpu_ucode_softc ucode_softc;
 
 int
@@ -88,6 +95,7 @@ cpu_ucode_md_open(firmware_handle_t *fwh
 	}
 }
 
+#ifndef XEN
 int
 cpu_ucode_apply(const struct cpu_ucode *data)
 {
@@ -108,7 +116,7 @@ cpu_ucode_apply(const struct cpu_ucode *
 		error = cpu_ucode_intel_apply(sc, data->cpu_nr);
 		break;
 	default:
-		return EOPNOTSUPP;
+		error = EOPNOTSUPP;
 	}
 
 	if (sc->sc_blob != NULL)
@@ -117,6 +125,36 @@ cpu_ucode_apply(const struct cpu_ucode *
 	sc->sc_blobsize = 0;
 	return error;
 }
+#else
+int
+cpu_ucode_apply(const struct cpu_ucode *data)
+{
+	struct cpu_ucode_softc *sc = _softc;
+	struct xen_platform_op op;
+	int error;
+
+	/* Xen updates all??? */
+	if (data->cpu_nr != CPU_UCODE_ALL_CPUS)
+		return EOPNOTSUPP;
+
+	sc->loader_version = data->loader_version;
+	error = cpu_ucode_load(sc, data->fwname);
+	if (error)
+		return error;
+
+	op.cmd = XENPF_microcode_update;
+	set_xen_guest_handle(op.u.microcode.data, sc->sc_blob);
+	op.u.microcode.length = sc->sc_blobsize;
+
+	error = -HYPERVISOR_platform_op();
+
+	if (sc->sc_blob)
+		firmware_free(sc->sc_blob, sc->sc_blobsize);
+	sc->sc_blob = NULL;
+	sc->sc_blobsize = 0;
+	return error;
+}
+#endif
 
 #ifdef COMPAT_60
 int
@@ -135,25 +173,18 @@ compat6_cpu_ucode_get_version(struct com
 }
 
 int
-compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
+compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data6)
 {
-	struct cpu_ucode_softc *sc = _softc;
-	int error;
 
 	if (cpu_vendor != CPUVENDOR_AMD)
 		return EOPNOTSUPP;
 
-	sc->loader_version = CPU_UCODE_LOADER_AMD;
-	error = cpu_ucode_load(sc, data->fwname);
-	if (error)
-		return error;
+	struct cpu_ucode data;
 
-	error = cpu_ucode_amd_apply(sc, CPU_UCODE_ALL_CPUS);
+	data.loader_version = CPU_UCODE_LOADER_AMD;
+	data.cpu_nr = CPU_UCODE_ALL_CPUS;
+	strcpy(data.fwname, data6->fwname);
 
-	if (sc->sc_blob != NULL)
-		firmware_free(sc->sc_blob, sc->sc_blobsize);
-	sc->sc_blob = NULL;
-	sc->sc_blobsize = 0;
-	return error;
+	return cpu_ucode_apply();
 }
 #endif /* COMPAT60 */



CVS commit: src/sys/dev/usb

2018-03-17 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 17 19:37:49 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.738 -r1.739 src/sys/dev/usb/usbdevs_data.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/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.737 src/sys/dev/usb/usbdevs.h:1.738
--- src/sys/dev/usb/usbdevs.h:1.737	Fri Dec 22 14:06:40 2017
+++ src/sys/dev/usb/usbdevs.h	Sat Mar 17 19:37:49 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.737 2017/12/22 14:06:40 jakllsch Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.738 2018/03/17 19:37:49 jdolecek Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.745 2017/12/22 14:03:39 jakllsch Exp
+ *	NetBSD: usbdevs,v 1.746 2018/03/17 19:37:11 jdolecek Exp
  */
 
 /*
@@ -3102,6 +3102,9 @@
 #define	USB_PRODUCT_SMSC_2513HUB	0x2513		/* USB 2.0 3-Port Hub */
 #define	USB_PRODUCT_SMSC_2514HUB	0x2514		/* USB 2.0 4-Port Hub */
 #define	USB_PRODUCT_SMSC_LAN7500	0x7500		/* LAN7500 USB 2.0 gigabit ethernet device */
+#define	USB_PRODUCT_SMSC_LAN7800	0x7800		/* LAN7800 USB 3.1 gigabit ethernet device */
+#define	USB_PRODUCT_SMSC_LAN7801	0x7801		/* LAN7801 USB 3.1 gigabit ethernet device */
+#define	USB_PRODUCT_SMSC_LAN7850	0x7850		/* LAN7850 USB 2.0 gigabit ethernet device */
 #define	USB_PRODUCT_SMSC_SMSC9500	0x9500		/* SMSC9500 Ethernet device */
 #define	USB_PRODUCT_SMSC_SMSC9505	0x9505		/* SMSC9505 Ethernet device */
 #define	USB_PRODUCT_SMSC_SMSC9512	0x9512		/* SMSC9512 USB Hub & Ethernet device */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.738 src/sys/dev/usb/usbdevs_data.h:1.739
--- src/sys/dev/usb/usbdevs_data.h:1.738	Fri Dec 22 14:06:40 2017
+++ src/sys/dev/usb/usbdevs_data.h	Sat Mar 17 19:37:49 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.738 2017/12/22 14:06:40 jakllsch Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.739 2018/03/17 19:37:49 jdolecek Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.745 2017/12/22 14:03:39 jakllsch Exp
+ *	NetBSD: usbdevs,v 1.746 2018/03/17 19:37:11 jdolecek Exp
  */
 
 /*
@@ -4245,102 +4245,108 @@ static const uint16_t usb_products[] = {
 	4757, 5232, 17982, 5728, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_LAN7500, 
 	17989, 4757, 5232, 6568, 5040, 10220, 0,
+	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_LAN7800, 
+	17997, 4757, 18005, 6568, 5040, 10220, 0,
+	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_LAN7801, 
+	18009, 4757, 18005, 6568, 5040, 10220, 0,
+	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_LAN7850, 
+	18017, 4757, 5232, 6568, 5040, 10220, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500, 
-	17997, 4787, 10220, 0,
+	18025, 4787, 10220, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9505, 
-	18006, 4787, 10220, 0,
+	18034, 4787, 10220, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9512, 
-	18015, 4757, 5728, 3020, 4787, 10220, 0,
+	18043, 4757, 5728, 3020, 4787, 10220, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9514, 
-	18024, 4757, 5728, 3020, 4787, 10220, 0,
+	18052, 4757, 5728, 3020, 4787, 10220, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_LAN9530, 
-	18033, 4787, 7767, 0,
+	18061, 4787, 7767, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_LAN9730, 
-	18041, 4787, 7767, 0,
+	18069, 4787, 7767, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500_SAL10, 
-	17997, 4787, 10220, 18049, 0,
+	18025, 4787, 10220, 18077, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9505_SAL10, 
-	18006, 4787, 10220, 18049, 0,
+	18034, 4787, 10220, 18077, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500A_SAL10, 
-	18057, 4787, 10220, 18049, 0,
+	18085, 4787, 10220, 18077, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9505A_SAL10, 
-	18067, 4787, 10220, 18049, 0,
+	18095, 4787, 10220, 18077, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9512_14_SAL10, 
-	18077, 5728, 3020, 4787, 7767, 18049, 0,
+	18105, 5728, 3020, 4787, 7767, 18077, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500A_HAL, 
-	18057, 4787, 7767, 18089, 0,
+	18085, 4787, 7767, 18117, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9505A_HAL, 
-	18067, 4787, 7767, 18089, 0,
+	18095, 4787, 7767, 18117, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500_ALT, 
-	17997, 4787, 7767, 0,
+	18025, 4787, 7767, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500A_ALT, 
-	18057, 4787, 7767, 0,
+	18085, 4787, 7767, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9512_14_ALT, 
-	18015, 5728, 3020, 4787, 7767, 0,
+	18043, 5728, 3020, 4787, 7767, 0,
 	USB_VENDOR_SMSC, USB_PRODUCT_SMSC_SMSC9500A, 
-	18057, 4787, 

CVS commit: src/sys/dev/usb

2018-03-17 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 17 19:37:11 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
add LAN78xx family (Raspberry Pi 3B+) entries - PR kern/53105


To generate a diff of this commit:
cvs rdiff -u -r1.745 -r1.746 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.745 src/sys/dev/usb/usbdevs:1.746
--- src/sys/dev/usb/usbdevs:1.745	Fri Dec 22 14:03:39 2017
+++ src/sys/dev/usb/usbdevs	Sat Mar 17 19:37:11 2018
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.745 2017/12/22 14:03:39 jakllsch Exp $
+$NetBSD: usbdevs,v 1.746 2018/03/17 19:37:11 jdolecek Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -3095,6 +3095,9 @@ product SMSC 2512HUB		0x2512	USB 2.0 2-P
 product SMSC 2513HUB		0x2513	USB 2.0 3-Port Hub
 product SMSC 2514HUB		0x2514	USB 2.0 4-Port Hub
 product SMSC LAN7500		0x7500	LAN7500 USB 2.0 gigabit ethernet device
+product SMSC LAN7800		0x7800	LAN7800 USB 3.1 gigabit ethernet device
+product SMSC LAN7801		0x7801	LAN7801 USB 3.1 gigabit ethernet device
+product SMSC LAN7850		0x7850	LAN7850 USB 2.0 gigabit ethernet device
 product SMSC SMSC9500		0x9500	SMSC9500 Ethernet device
 product SMSC SMSC9505		0x9505	SMSC9505 Ethernet device
 product SMSC SMSC9512		0x9512	SMSC9512 USB Hub & Ethernet device



CVS commit: src/sys/kern

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 19:03:25 UTC 2018

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

Log Message:
move the compat code in compat.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/kern/kern_cpu.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_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71 src/sys/kern/kern_cpu.c:1.72
--- src/sys/kern/kern_cpu.c:1.71	Sat Aug 29 08:24:00 2015
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 15:03:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71 2015/08/29 12:24:00 maxv Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.72 2018/03/17 19:03:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,10 +56,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71 2015/08/29 12:24:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.72 2018/03/17 19:03:25 christos Exp $");
 
 #include "opt_cpu_ucode.h"
-#include "opt_compat_netbsd.h"
 
 #include 
 #include 
@@ -128,6 +127,7 @@ struct cpu_info **cpu_infos		__read_most
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;
 
+int (*compat_cpuctl_ioctl)(u_long, void *) = (void *)enosys;
 
 static char cpu_model[128];
 
@@ -285,12 +285,6 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 		error = cpu_ucode_get_version((struct cpu_ucode_version *)data);
 		break;
 
-#ifdef COMPAT_60
-	case OIOC_CPU_UCODE_GET_VERSION:
-		error = compat6_cpu_ucode_get_version((struct compat6_cpu_ucode *)data);
-		break;
-#endif
-
 	case IOC_CPU_UCODE_APPLY:
 		error = kauth_authorize_machdep(l->l_cred,
 		KAUTH_MACHDEP_CPU_UCODE_APPLY,
@@ -299,21 +293,10 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 			break;
 		error = cpu_ucode_apply((const struct cpu_ucode *)data);
 		break;
-
-#ifdef COMPAT_60
-	case OIOC_CPU_UCODE_APPLY:
-		error = kauth_authorize_machdep(l->l_cred,
-		KAUTH_MACHDEP_CPU_UCODE_APPLY,
-		NULL, NULL, NULL, NULL);
-		if (error != 0)
-			break;
-		error = compat6_cpu_ucode_apply((const struct compat6_cpu_ucode *)data);
-		break;
-#endif
 #endif
 
 	default:
-		error = ENOTTY;
+		error = (*compat_cpuctl_ioctl)(cmd, data);
 		break;
 	}
 	mutex_exit(_lock);



CVS commit: src/sys/compat

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 19:00:23 UTC 2018

Modified Files:
src/sys/compat/common: Makefile.sysio compat_mod.c
src/sys/compat/sys: cpuio.h
Added Files:
src/sys/compat/common: kern_cpu_60.c

Log Message:
redo the cpu ucode compat code.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.25 -r1.26 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r0 -r1.1 src/sys/compat/common/kern_cpu_60.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/cpuio.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/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.8 src/sys/compat/common/Makefile.sysio:1.9
--- src/sys/compat/common/Makefile.sysio:1.8	Wed Mar 14 23:13:51 2018
+++ src/sys/compat/common/Makefile.sysio	Sat Mar 17 15:00:23 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.8 2018/03/15 03:13:51 christos Exp $
+#	$NetBSD: Makefile.sysio,v 1.9 2018/03/17 19:00:23 christos Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -35,7 +35,7 @@ SRCS+=	kern_50.c kern_time_50.c kern_sel
 	vfs_syscalls_50.c  uipc_syscalls_50.c uvm_50.c
 
 # Compatibility code for NetBSD 6.0
-SRCS+=	kern_sa_60.c tty_60.c kern_time_60.c
+SRCS+=	kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c
 
 # Compatibility code for NetBSD 7.0
 SRCS+=	rtsock_70.c uipc_usrreq_70.c

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.25 src/sys/compat/common/compat_mod.c:1.26
--- src/sys/compat/common/compat_mod.c:1.25	Wed Mar 14 23:13:51 2018
+++ src/sys/compat/common/compat_mod.c	Sat Mar 17 15:00:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.25 2018/03/15 03:13:51 christos Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.26 2018/03/17 19:00:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.25 2018/03/15 03:13:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.26 2018/03/17 19:00:23 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
 #include 
 #include 
 #include 
+#include 
 
 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
 static struct sysctllog *compat_clog = NULL;
@@ -258,6 +259,9 @@ compat_modcmd(modcmd_t cmd, void *arg)
 #ifdef COMPAT_50
 		uvm_50_init();
 #endif
+#ifdef COMPAT_60
+		kern_cpu_60_init();
+#endif
 		return 0;
 
 	case MODULE_CMD_FINI:
@@ -321,6 +325,9 @@ compat_modcmd(modcmd_t cmd, void *arg)
 #ifdef COMPAT_50
 		uvm_50_fini();
 #endif
+#ifdef COMPAT_60
+		kern_cpu_60_fini();
+#endif
 		return 0;
 
 	default:

Index: src/sys/compat/sys/cpuio.h
diff -u src/sys/compat/sys/cpuio.h:1.5 src/sys/compat/sys/cpuio.h:1.6
--- src/sys/compat/sys/cpuio.h:1.5	Sun Sep  6 02:00:59 2015
+++ src/sys/compat/sys/cpuio.h	Sat Mar 17 15:00:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.5 2015/09/06 06:00:59 dholland Exp $ */
+/* $NetBSD: cpuio.h,v 1.6 2018/03/17 19:00:23 christos Exp $ */
 
 #include 
 
@@ -7,5 +7,10 @@ struct compat6_cpu_ucode {
 	char fwname[PATH_MAX];
 };
 
+extern int (*compat_cpuctl_ioctl)(u_long, void *);
+
 #define OIOC_CPU_UCODE_GET_VERSION  _IOR('c', 4, struct compat6_cpu_ucode)
 #define OIOC_CPU_UCODE_APPLY_IOW('c', 5, struct compat6_cpu_ucode)
+
+void kern_cpu_60_init(void);
+void kern_cpu_60_fini(void);

Added files:

Index: src/sys/compat/common/kern_cpu_60.c
diff -u /dev/null src/sys/compat/common/kern_cpu_60.c:1.1
--- /dev/null	Sat Mar 17 15:00:23 2018
+++ src/sys/compat/common/kern_cpu_60.c	Sat Mar 17 15:00:23 2018
@@ -0,0 +1,75 @@
+/*	$NetBSD: kern_cpu_60.c,v 1.1 2018/03/17 19:00:23 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * 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, 

CVS commit: src/sys/arch/arm

2018-03-17 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Mar 17 18:34:09 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c files.bcm2835
src/sys/arch/arm/imx: files.imx51 files.imx6 files.imx7 imx51_axi.c
imx51_ipuv3.c imx51_usb.c imx51var.h imx6_axi.c imx6_usb.c
imx6var.h imx7_axi.c imx7_usb.c imx7var.h
src/sys/arch/arm/nvidia: files.tegra tegra_platform.c
src/sys/arch/arm/samsung: exynos_platform.c files.exynos
src/sys/arch/arm/sunxi: files.sunxi sunxi_platform.c
src/sys/arch/arm/ti: files.ti ti_platform.c
src/sys/arch/arm/vexpress: files.vexpress vexpress_platform.c
Added Files:
src/sys/arch/arm/arm: arm_generic_dma.c
Removed Files:
src/sys/arch/arm/arm32: armv7_generic_dma.c

Log Message:
move from sys/arch/arm/arm32/armv7_generic_dma.c to 
sys/arch/arm/arm/arm_generic_dma.c,
and change variable name from armv7_generic_dma_tag to arm_generic_dma_tag

no functional change. (preliminary changes for merging aarch64)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/arm/arm_generic_dma.c
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/arm32/armv7_generic_dma.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm283x_platform.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/broadcom/files.bcm2835
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/files.imx7 \
src/sys/arch/arm/imx/imx51var.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx51_axi.c \
src/sys/arch/arm/imx/imx51_ipuv3.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx51_usb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_axi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx6_usb.c \
src/sys/arch/arm/imx/imx7_axi.c src/sys/arch/arm/imx/imx7_usb.c \
src/sys/arch/arm/imx/imx7var.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx6var.h
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/arm/nvidia/files.tegra
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra_platform.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/samsung/files.exynos
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/sunxi/sunxi_platform.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/files.ti \
src/sys/arch/arm/ti/ti_platform.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/vexpress/files.vexpress
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/vexpress/vexpress_platform.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/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.2 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.3
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.2	Wed Dec 20 14:35:12 2017
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c	Sat Mar 17 18:34:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm283x_platform.c,v 1.2 2017/12/20 14:35:12 skrll Exp $	*/
+/*	$NetBSD: bcm283x_platform.c,v 1.3 2018/03/17 18:34:09 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.2 2017/12/20 14:35:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.3 2018/03/17 18:34:09 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -118,7 +118,7 @@ static int rpi_ioctl(void *, void *, u_l
 
 extern struct bus_space armv7_generic_bs_tag;
 extern struct bus_space armv7_generic_a4x_bs_tag;
-extern struct arm32_bus_dma_tag armv7_generic_dma_tag;
+extern struct arm32_bus_dma_tag arm_generic_dma_tag;
 
 /* Prototypes for all the bus_space structure functions */
 bs_protos(bcm2835);

Index: src/sys/arch/arm/broadcom/files.bcm2835
diff -u src/sys/arch/arm/broadcom/files.bcm2835:1.29 src/sys/arch/arm/broadcom/files.bcm2835:1.30
--- src/sys/arch/arm/broadcom/files.bcm2835:1.29	Sun Dec 10 21:38:26 2017
+++ src/sys/arch/arm/broadcom/files.bcm2835	Sat Mar 17 18:34:09 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.bcm2835,v 1.29 2017/12/10 21:38:26 skrll Exp $
+#	$NetBSD: files.bcm2835,v 1.30 2018/03/17 18:34:09 ryo Exp $
 #
 # Configuration info for Broadcom BCM2835 ARM Peripherals
 #
@@ -10,7 +10,7 @@ file	arch/arm/arm32/arm32_kvminit.c
 file	arch/arm/arm32/arm32_reboot.c
 file	arch/arm/arm32/irq_dispatch.S
 file	arch/arm/arm32/armv7_generic_space.c
-file	arch/arm/arm32/armv7_generic_dma.c
+file	arch/arm/arm/arm_generic_dma.c
 file	arch/arm/arm/bus_space_a4x.S
 
 file	arch/arm/broadcom/bcm2835_dma.c

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.17 src/sys/arch/arm/imx/files.imx51:1.18
--- src/sys/arch/arm/imx/files.imx51:1.17	Fri Sep  8 05:29:12 2017
+++ src/sys/arch/arm/imx/files.imx51	Sat Mar 17 18:34:09 2018
@@ 

CVS commit: src/sys/arch/xen/xen

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 18:22:23 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xen_ucode.c

Log Message:
sync with x86; the version code could be merged.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/xen/xen_ucode.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/xen/xen/xen_ucode.c
diff -u src/sys/arch/xen/xen/xen_ucode.c:1.5 src/sys/arch/xen/xen/xen_ucode.c:1.6
--- src/sys/arch/xen/xen/xen_ucode.c:1.5	Wed Jan  7 02:05:48 2015
+++ src/sys/arch/xen/xen/xen_ucode.c	Sat Mar 17 14:22:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $ */
+/* $NetBSD: xen_ucode.c,v 1.6 2018/03/17 18:22:23 christos Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ucode.c,v 1.6 2018/03/17 18:22:23 christos Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -50,34 +50,30 @@ static struct cpu_ucode_softc ucode_soft
 int
 cpu_ucode_get_version(struct cpu_ucode_version *data)
 {
+	union {
+		struct cpu_ucode_version_amd a;
+		struct cpu_ucode_version_intel1 i;
+	} v;
+	size_t l;
+	int error;
+
+	if (!data->data)
+		return 0;
 
 	switch (cpu_vendor) {
 	case CPUVENDOR_AMD:
-		return cpu_ucode_amd_get_version(data);
+		error = cpu_ucode_amd_get_version(data, , l = sizeof(v.a));
 	case CPUVENDOR_INTEL:
-		return cpu_ucode_intel_get_version(data);
+		error = cpu_ucode_intel_get_version(data, , l = sizeof(v.i));
 	default:
 		return EOPNOTSUPP;
 	}
 
-	return 0;
-}
-
-#ifdef COMPAT_60
-int
-compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
-{
-
-	switch (cpu_vendor) {
-	case CPUVENDOR_AMD:
-		return compat6_cpu_ucode_amd_get_version(data);
-	default:
-		return EOPNOTSUPP;
-	}
+	if (error)
+		return error;
 
-	return 0;
+	return copyout(, data->data, l);
 }
-#endif /* COMPAT_60 */
 
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -123,6 +119,21 @@ cpu_ucode_apply(const struct cpu_ucode *
 
 #ifdef COMPAT_60
 int
+compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
+{
+	struct cpu_ucode_version ndata;
+
+	switch (cpu_vendor) {
+	case CPUVENDOR_AMD:
+		ndata.loader_version = CPU_UCODE_LOADER_AMD;
+		return cpu_ucode_amd_get_version(, >version,
+		sizeof(data->version));
+	default:
+		return EOPNOTSUPP;
+	}
+}
+
+int
 compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
 {
 	struct cpu_ucode_softc *sc = _softc;



CVS commit: src/sys/arch/amd64/amd64

2018-03-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Mar 17 17:12:39 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: machdep.c

Log Message:
Add missing opt_svs.h.


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/sys/arch/amd64/amd64/machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.301 src/sys/arch/amd64/amd64/machdep.c:1.302
--- src/sys/arch/amd64/amd64/machdep.c:1.301	Thu Feb 22 13:27:17 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Sat Mar 17 17:12:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.301 2018/02/22 13:27:17 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.302 2018/03/17 17:12:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.301 2018/02/22 13:27:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.302 2018/03/17 17:12:39 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -122,6 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include "opt_mtrr.h"
 #include "opt_realmem.h"
 #include "opt_xen.h"
+#include "opt_svs.h"
 #include "opt_kaslr.h"
 #ifndef XEN
 #include "opt_physmem.h"



CVS commit: src/sys/arch/x86

2018-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 15:56:32 UTC 2018

Modified Files:
src/sys/arch/x86/include: cpu_ucode.h
src/sys/arch/x86/x86: cpu_ucode.c cpu_ucode_amd.c cpu_ucode_intel.c

Log Message:
tuck in all the compat microcode code in one place.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/cpu_ucode_amd.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/x86/cpu_ucode_intel.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/include/cpu_ucode.h
diff -u src/sys/arch/x86/include/cpu_ucode.h:1.3 src/sys/arch/x86/include/cpu_ucode.h:1.4
--- src/sys/arch/x86/include/cpu_ucode.h:1.3	Wed Oct 17 16:19:55 2012
+++ src/sys/arch/x86/include/cpu_ucode.h	Sat Mar 17 11:56:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.h,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
+/* $NetBSD: cpu_ucode.h,v 1.4 2018/03/17 15:56:32 christos Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,14 +47,11 @@ struct cpu_ucode_version_intel1 {
 #include 
 #include 
 
-int cpu_ucode_amd_get_version(struct cpu_ucode_version *);
-#ifdef COMPAT_60
-int compat6_cpu_ucode_amd_get_version(struct compat6_cpu_ucode *);
-#endif
+int cpu_ucode_amd_get_version(struct cpu_ucode_version *, void *, size_t);
 int cpu_ucode_amd_firmware_open(firmware_handle_t *, const char *);
 int cpu_ucode_amd_apply(struct cpu_ucode_softc *, int);
 
-int cpu_ucode_intel_get_version(struct cpu_ucode_version *);
+int cpu_ucode_intel_get_version(struct cpu_ucode_version *, void *, size_t);
 int cpu_ucode_intel_firmware_open(firmware_handle_t *, const char *);
 int cpu_ucode_intel_apply(struct cpu_ucode_softc *, int);
 #endif /* _KERNEL */

Index: src/sys/arch/x86/x86/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.5 src/sys/arch/x86/x86/cpu_ucode.c:1.6
--- src/sys/arch/x86/x86/cpu_ucode.c:1.5	Wed Jan  7 02:05:48 2015
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sat Mar 17 11:56:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.6 2018/03/17 15:56:32 christos Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.6 2018/03/17 15:56:32 christos Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -50,34 +50,30 @@ static struct cpu_ucode_softc ucode_soft
 int
 cpu_ucode_get_version(struct cpu_ucode_version *data)
 {
+	union {
+		struct cpu_ucode_version_amd a;
+		struct cpu_ucode_version_intel1 i;
+	} v;
+	size_t l;
+	int error;
+
+	if (!data->data)
+		return 0;
 
 	switch (cpu_vendor) {
 	case CPUVENDOR_AMD:
-		return cpu_ucode_amd_get_version(data);
+		error = cpu_ucode_amd_get_version(data, , l = sizeof(v.a));
 	case CPUVENDOR_INTEL:
-		return cpu_ucode_intel_get_version(data);
+		error = cpu_ucode_intel_get_version(data, , l = sizeof(v.i));
 	default:
 		return EOPNOTSUPP;
 	}
 
-	return 0;
-}
-
-#ifdef COMPAT_60
-int
-compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
-{
-
-	switch (cpu_vendor) {
-	case CPUVENDOR_AMD:
-		return compat6_cpu_ucode_amd_get_version(data);
-	default:
-		return EOPNOTSUPP;
-	}
+	if (error)
+		return error;
 
-	return 0;
+	return copyout(, data->data, l);
 }
-#endif /* COMPAT60 */
 
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
@@ -124,6 +120,21 @@ cpu_ucode_apply(const struct cpu_ucode *
 
 #ifdef COMPAT_60
 int
+compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *data)
+{
+	struct cpu_ucode_version ndata;
+
+	switch (cpu_vendor) {
+	case CPUVENDOR_AMD:
+		ndata.loader_version = CPU_UCODE_LOADER_AMD;
+		return cpu_ucode_amd_get_version(, >version,
+		sizeof(data->version));
+	default:
+		return EOPNOTSUPP;
+	}
+}
+
+int
 compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *data)
 {
 	struct cpu_ucode_softc *sc = _softc;

Index: src/sys/arch/x86/x86/cpu_ucode_amd.c
diff -u src/sys/arch/x86/x86/cpu_ucode_amd.c:1.7 src/sys/arch/x86/x86/cpu_ucode_amd.c:1.8
--- src/sys/arch/x86/x86/cpu_ucode_amd.c:1.7	Fri Nov 15 03:47:55 2013
+++ src/sys/arch/x86/x86/cpu_ucode_amd.c	Sat Mar 17 11:56:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_amd.c,v 1.7 2013/11/15 08:47:55 msaitoh Exp $ */
+/* $NetBSD: cpu_ucode_amd.c,v 1.8 2018/03/17 15:56:32 christos Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,11 +29,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.7 2013/11/15 08:47:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_amd.c,v 1.8 2018/03/17 15:56:32 christos Exp $");
 
 #include "opt_xen.h"
 

CVS commit: src/sys/arch/sgimips/dev

2018-03-17 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar 17 13:14:27 UTC 2018

Modified Files:
src/sys/arch/sgimips/dev: crmfb.c

Log Message:
Add support for overriding the video mode by setting an ARCS environment
variable.

If the "crmfb_mode" environment variable is set, treat it as a mode
string in the form WIDTHxHEIGHT[@REFRESH] and generate monitor timings
using the VESA GTF formula. If set, this overrides the EDID preferred
mode.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sgimips/dev/crmfb.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/sgimips/dev/crmfb.c
diff -u src/sys/arch/sgimips/dev/crmfb.c:1.44 src/sys/arch/sgimips/dev/crmfb.c:1.45
--- src/sys/arch/sgimips/dev/crmfb.c:1.44	Fri May 19 19:25:53 2017
+++ src/sys/arch/sgimips/dev/crmfb.c	Sat Mar 17 13:14:27 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.44 2017/05/19 19:25:53 macallan Exp $ */
+/* $NetBSD: crmfb.c,v 1.45 2018/03/17 13:14:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.44 2017/05/19 19:25:53 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.45 2018/03/17 13:14:27 jmcneill Exp $");
 
 #include 
 #include 
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -232,6 +233,7 @@ static void crmfb_setup_ddc(struct crmfb
 /* mode setting stuff */
 static uint32_t calc_pll(int);	/* frequency in kHz */
 static int crmfb_set_mode(struct crmfb_softc *, const struct videomode *);
+static int crmfb_parse_mode(const char *, struct videomode *);
 
 CFATTACH_DECL_NEW(crmfb, sizeof(struct crmfb_softc),
 crmfb_match, crmfb_attach, NULL, NULL);
@@ -254,6 +256,8 @@ crmfb_attach(device_t parent, device_t s
 	unsigned long v;
 	long defattr;
 	const char *consdev;
+	const char *modestr;
+	struct videomode mode, *pmode;
 	int rv, i;
 
 	sc = device_private(self);
@@ -305,11 +309,16 @@ crmfb_attach(device_t parent, device_t s
 	sc->sc_console_depth = 8;
 
 	crmfb_setup_ddc(sc);
-	if ((sc->sc_edid_info.edid_preferred_mode != NULL)) {
-		if (crmfb_set_mode(sc, sc->sc_edid_info.edid_preferred_mode))
-			aprint_normal_dev(sc->sc_dev, "using %dx%d\n",
-			sc->sc_width, sc->sc_height);
-	}
+	pmode = sc->sc_edid_info.edid_preferred_mode;
+
+	modestr = arcbios_GetEnvironmentVariable("crmfb_mode");
+	if (crmfb_parse_mode(modestr, ) == 0)
+		pmode = 
+
+	if (pmode != NULL && crmfb_set_mode(sc, pmode))
+		aprint_normal_dev(sc->sc_dev, "using %dx%d\n",
+		sc->sc_width, sc->sc_height);
+
 	/*
 	 * first determine how many tiles we need
 	 * in 32bit each tile is 128x128 pixels
@@ -1859,3 +1868,34 @@ crmfb_set_mode(struct crmfb_softc *sc, c
 
 	return TRUE;
 }
+
+/*
+ * Parse a mode string in the form WIDTHxHEIGHT[@REFRESH] and return
+ * monitor timings generated using the VESA GTF formula.
+ */
+static int
+crmfb_parse_mode(const char *modestr, struct videomode *mode)
+{
+	char *x, *at;
+	int width, height, refresh;
+
+	if (modestr == NULL)
+		return EINVAL;
+
+	x = strchr(modestr, 'x');
+	at = strchr(modestr, '@');
+
+	if (x == NULL || (at != NULL && at < x))
+		return EINVAL;
+
+	width = strtoul(modestr, NULL, 10);
+	height = strtoul(x + 1, NULL, 10);
+	refresh = at ? strtoul(at + 1, NULL, 10) : 60;
+
+	if (width == 0 || height == 0 || refresh == 0)
+		return EINVAL;
+
+	vesagtf_mode(width, height, refresh, mode);
+
+	return 0;
+}



CVS commit: [netbsd-8] src/doc

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 11:32:15 UTC 2018

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

Log Message:
Ticket #636 - #638


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.145 -r1.1.2.146 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.145 src/doc/CHANGES-8.0:1.1.2.146
--- src/doc/CHANGES-8.0:1.1.2.145	Fri Mar 16 13:19:38 2018
+++ src/doc/CHANGES-8.0	Sat Mar 17 11:32:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.145 2018/03/16 13:19:38 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.146 2018/03/17 11:32:15 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -10371,3 +10371,24 @@ sys/arch/x86/x86/pmap.c			1.276 (patch)
 	Backport __HAVE_PCPU_AREA.
 	[maxv, #635]
 
+sys/dev/ic/nvme.c1.33
+sys/dev/ic/nvmevar.h1.14
+
+	Fix accounting for available CCBs.
+	[jdolecek, ticket #636]
+
+sys/arch/amd64/amd64/process_machdep.c	1.33,1.34,1.35 (patch)
+sys/arch/amd64/include/types.h		1.55 (patch)
+sys/arch/x86/x86/vm_machdep.c		1.33 (patch)
+sys/arch/kern/kern_exec.c		1.456
+
+	- Reduce the number of places where segment register faults can
+	  occur.
+	- Remove __HAVE_CPU_UAREA_ROUTINES.
+	[maxv, ticket #637]
+
+sys/net/if_tun.c1.143
+
+	Add packet filtering to tun(4) interfaces.
+	[tih, ticket #638]
+



CVS commit: [netbsd-8] src/sys/net

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 11:26:44 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_tun.c

Log Message:
Pull up following revision(s) (requested by tih in ticket #638):
sys/net/if_tun.c: revision 1.143

Add packet filtering to tun(4) interfaces.

Calls to pfil_run_hooks() were missing in if_tun.c.  This meant that
filtering configuration could be added to e.g. /etc/npf.conf, but
would be ignored, because the filter never saw the packets.  This
change adds the required calls.

While here, correct the return value from tun_output(): it's been
returning 0 regardless of any error condition present, but will now
correctly propagate such information upward.

Thanks to maxv for guidance!
OK: christos, martin


To generate a diff of this commit:
cvs rdiff -u -r1.139.2.2 -r1.139.2.3 src/sys/net/if_tun.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/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.139.2.2 src/sys/net/if_tun.c:1.139.2.3
--- src/sys/net/if_tun.c:1.139.2.2	Tue Jan  2 10:20:33 2018
+++ src/sys/net/if_tun.c	Sat Mar 17 11:26:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.139.2.2 2018/01/02 10:20:33 snj Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.139.2.3 2018/03/17 11:26:44 martin Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139.2.2 2018/01/02 10:20:33 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.139.2.3 2018/03/17 11:26:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -555,6 +555,11 @@ tun_output(struct ifnet *ifp, struct mbu
 
 	bpf_mtap_af(ifp, dst->sa_family, m0);
 
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT)) != 0)
+		goto out;
+	if (m0 == NULL)
+		goto out;
+
 	switch(dst->sa_family) {
 #ifdef INET6
 	case AF_INET6:
@@ -624,10 +629,10 @@ tun_output(struct ifnet *ifp, struct mbu
 
 	mutex_exit(>tun_lock);
 out:
-	if (error && m0) {
+	if (error && m0)
 		m_freem(m0);
-	}
-	return 0;
+
+	return error;
 }
 
 static void
@@ -941,6 +946,11 @@ tunwrite(dev_t dev, struct uio *uio, int
 
 	bpf_mtap_af(ifp, dst.sa_family, top);
 
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN)) != 0)
+		goto out0;
+	if (top == NULL)
+		goto out0;
+
 	mutex_enter(>tun_lock);
 	if ((tp->tun_flags & TUN_INITED) == 0) {
 		/* Interface was destroyed */



CVS commit: [netbsd-8] src/sys/arch

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 11:23:18 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: process_machdep.c
src/sys/arch/amd64/include [netbsd-8]: cpu.h types.h
src/sys/arch/x86/x86 [netbsd-8]: vm_machdep.c

Log Message:
Pull up the following revisions, requested by maxv in ticket #637:

sys/arch/amd64/amd64/process_machdep.c  1.33,1.34,1.35 (patch)
sys/arch/amd64/include/types.h  1.55 (patch)
sys/arch/x86/x86/vm_machdep.c   1.33 (patch)

- Reduce the number of places where segment register faults can
  occur.
- Remove __HAVE_CPU_UAREA_ROUTINES.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/arch/amd64/amd64/process_machdep.c
cvs rdiff -u -r1.60 -r1.60.40.1 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.52.6.1 -r1.52.6.2 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.28.6.1 -r1.28.6.2 src/sys/arch/x86/x86/vm_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/process_machdep.c
diff -u src/sys/arch/amd64/amd64/process_machdep.c:1.32 src/sys/arch/amd64/amd64/process_machdep.c:1.32.6.1
--- src/sys/arch/amd64/amd64/process_machdep.c:1.32	Thu Feb 23 03:34:22 2017
+++ src/sys/arch/amd64/amd64/process_machdep.c	Sat Mar 17 11:23:18 2018
@@ -1,6 +1,6 @@
-/*	$NetBSD: process_machdep.c,v 1.32 2017/02/23 03:34:22 kamil Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.32.6.1 2018/03/17 11:23:18 martin Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -71,13 +71,13 @@
  *
  * process_set_pc(proc)
  *	Set the process's program counter.
- *
  */
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.32 2017/02/23 03:34:22 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.32.6.1 2018/03/17 11:23:18 martin Exp $");
 
+#include "opt_xen.h"
 #include 
 #include 
 #include 
@@ -93,33 +93,39 @@ __KERNEL_RCSID(0, "$NetBSD: process_mach
 #include 
 
 static inline struct trapframe *process_frame(struct lwp *);
-#if 0
-static inline int verr_gdt(struct pmap *, int sel);
-static inline int verr_ldt(struct pmap *, int sel);
-#endif
 
 static inline struct trapframe *
 process_frame(struct lwp *l)
 {
 
-	return (l->l_md.md_regs);
+	return l->l_md.md_regs;
 }
 
 int
 process_read_regs(struct lwp *l, struct reg *regs)
 {
 	struct trapframe *tf = process_frame(l);
+	struct proc *p = l->l_proc;
+
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
 
 #define copy_to_reg(reg, REG, idx) regs->regs[_REG_##REG] = tf->tf_##reg;
 	_FRAME_GREG(copy_to_reg)
 #undef copy_to_reg
 
-	return (0);
+	return 0;
 }
 
 int
 process_read_fpregs(struct lwp *l, struct fpreg *regs, size_t *sz)
 {
+	struct proc *p = l->l_proc;
+
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
 
 	process_read_fpregs_xmm(l, >fxstate);
 
@@ -129,6 +135,11 @@ process_read_fpregs(struct lwp *l, struc
 int
 process_read_dbregs(struct lwp *l, struct dbreg *regs, size_t *sz)
 {
+	struct proc *p = l->l_proc;
+
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
 
 	x86_dbregs_read(l, regs);
 
@@ -139,8 +150,14 @@ int
 process_write_regs(struct lwp *l, const struct reg *regp)
 {
 	struct trapframe *tf = process_frame(l);
+	struct proc *p = l->l_proc;
 	int error;
 	const long *regs = regp->regs;
+	int err, trapno;
+
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
 
 	/*
 	 * Check for security violations.
@@ -151,16 +168,33 @@ process_write_regs(struct lwp *l, const 
 	if (error != 0)
 		return error;
 
+	err = tf->tf_err;
+	trapno = tf->tf_trapno;
+
 #define copy_to_frame(reg, REG, idx) tf->tf_##reg = regs[_REG_##REG];
 	_FRAME_GREG(copy_to_frame)
 #undef copy_to_frame
 
-	return (0);
+	tf->tf_err = err;
+	tf->tf_trapno = trapno;
+
+#ifdef XEN
+	/* see comment in cpu_setmcontext */
+	tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL);
+	tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
+#endif
+
+	return 0;
 }
 
 int
 process_write_fpregs(struct lwp *l, const struct fpreg *regs, size_t sz)
 {
+	struct proc *p = l->l_proc;
+
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
 
 	process_write_fpregs_xmm(l, >fxstate);
 	return 0;
@@ -169,8 +203,13 @@ process_write_fpregs(struct lwp *l, cons
 int
 process_write_dbregs(struct lwp *l, const struct dbreg *regs, size_t sz)
 {
+	struct proc *p = l->l_proc;
 	int error;
 
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
+
 	/*
 	 * Check for security violations.
 	 */
@@ -193,17 +232,22 @@ process_sstep(struct lwp *l, int sstep)
 	else
 		tf->tf_rflags &= ~PSL_T;
 	
-	return (0);
+	return 0;
 }
 
 int
 process_set_pc(struct lwp *l, void *addr)
 {
 	struct trapframe *tf = process_frame(l);
+	struct proc *p = l->l_proc;
 
-	if ((uint64_t)addr > VM_MAXUSER_ADDRESS)
+	if (p->p_flag & PK_32) {
+		return EINVAL;
+	}
+
+	if ((uint64_t)addr >= VM_MAXUSER_ADDRESS)
 		return EINVAL;
 	tf->tf_rip = (uint64_t)addr;
 
-	return (0);
+	

CVS commit: [netbsd-8] src/sys/kern

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 11:19:27 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: kern_exec.c

Log Message:
Pull up the following revision, requested by maxv as part of ticket #637:

sys/kern/kern_exec.c1.456

Fix off-by-one, we don't want the entry point to equal the maximum
address.


To generate a diff of this commit:
cvs rdiff -u -r1.442.4.2 -r1.442.4.3 src/sys/kern/kern_exec.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_exec.c
diff -u src/sys/kern/kern_exec.c:1.442.4.2 src/sys/kern/kern_exec.c:1.442.4.3
--- src/sys/kern/kern_exec.c:1.442.4.2	Mon Sep 11 05:13:45 2017
+++ src/sys/kern/kern_exec.c	Sat Mar 17 11:19:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.442.4.2 2017/09/11 05:13:45 snj Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.442.4.3 2018/03/17 11:19:27 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.442.4.2 2017/09/11 05:13:45 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.442.4.3 2018/03/17 11:19:27 martin Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -420,10 +420,10 @@ check_exec(struct lwp *l, struct exec_pa
 
 		if (!newerror) {
 			/* Seems ok: check that entry point is not too high */
-			if (epp->ep_entry > epp->ep_vm_maxaddr) {
+			if (epp->ep_entry >= epp->ep_vm_maxaddr) {
 #ifdef DIAGNOSTIC
 printf("%s: rejecting %p due to "
-"too high entry address (> %p)\n",
+"too high entry address (>= %p)\n",
 	 __func__, (void *)epp->ep_entry,
 	 (void *)epp->ep_vm_maxaddr);
 #endif



CVS commit: src/sbin/nvmectl

2018-03-17 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 17 11:07:26 UTC 2018

Modified Files:
src/sbin/nvmectl: devlist.c identify.c logpage.c nvmectl.c nvmectl.h
perftest.c power.c reset.c wdc.c

Log Message:
use setprogname()/getprogname(), do not hardcode the prognam name in fixed
strings


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/nvmectl/devlist.c \
src/sbin/nvmectl/identify.c src/sbin/nvmectl/perftest.c \
src/sbin/nvmectl/power.c
cvs rdiff -u -r1.4 -r1.5 src/sbin/nvmectl/logpage.c \
src/sbin/nvmectl/nvmectl.c src/sbin/nvmectl/nvmectl.h
cvs rdiff -u -r1.1 -r1.2 src/sbin/nvmectl/reset.c src/sbin/nvmectl/wdc.c

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

Modified files:

Index: src/sbin/nvmectl/devlist.c
diff -u src/sbin/nvmectl/devlist.c:1.2 src/sbin/nvmectl/devlist.c:1.3
--- src/sbin/nvmectl/devlist.c:1.2	Sat Jun  4 20:59:49 2016
+++ src/sbin/nvmectl/devlist.c	Sat Mar 17 11:07:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: devlist.c,v 1.2 2016/06/04 20:59:49 joerg Exp $	*/
+/*	$NetBSD: devlist.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (C) 2012-2013 Intel Corporation
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: devlist.c,v 1.2 2016/06/04 20:59:49 joerg Exp $");
+__RCSID("$NetBSD: devlist.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $");
 #if 0
 __FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 260381 2014-01-06 23:48:47Z jimharris $");
 #endif
@@ -52,7 +52,7 @@ __dead static void
 devlist_usage(void)
 {
 	fprintf(stderr, "usage:\n");
-	fprintf(stderr, DEVLIST_USAGE);
+	fprintf(stderr, "\t%s " DEVLIST_USAGE, getprogname());
 	exit(1);
 }
 
Index: src/sbin/nvmectl/identify.c
diff -u src/sbin/nvmectl/identify.c:1.2 src/sbin/nvmectl/identify.c:1.3
--- src/sbin/nvmectl/identify.c:1.2	Sat Jun  4 20:59:49 2016
+++ src/sbin/nvmectl/identify.c	Sat Mar 17 11:07:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identify.c,v 1.2 2016/06/04 20:59:49 joerg Exp $	*/
+/*	$NetBSD: identify.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (C) 2012-2013 Intel Corporation
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: identify.c,v 1.2 2016/06/04 20:59:49 joerg Exp $");
+__RCSID("$NetBSD: identify.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $");
 #if 0
 __FBSDID("$FreeBSD: head/sbin/nvmecontrol/identify.c 253476 2013-07-19 21:40:57Z jimharris $");
 #endif
@@ -170,7 +170,7 @@ __dead static void
 identify_usage(void)
 {
 	fprintf(stderr, "usage:\n");
-	fprintf(stderr, IDENTIFY_USAGE);
+	fprintf(stderr, "\t%s " IDENTIFY_USAGE, getprogname());
 	exit(1);
 }
 
Index: src/sbin/nvmectl/perftest.c
diff -u src/sbin/nvmectl/perftest.c:1.2 src/sbin/nvmectl/perftest.c:1.3
--- src/sbin/nvmectl/perftest.c:1.2	Thu Jul 14 10:02:43 2016
+++ src/sbin/nvmectl/perftest.c	Sat Mar 17 11:07:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: perftest.c,v 1.2 2016/07/14 10:02:43 nonaka Exp $	*/
+/*	$NetBSD: perftest.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (C) 2012-2013 Intel Corporation
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: perftest.c,v 1.2 2016/07/14 10:02:43 nonaka Exp $");
+__RCSID("$NetBSD: perftest.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $");
 #if 0
 __FBSDID("$FreeBSD: head/sbin/nvmecontrol/perftest.c 257531 2013-11-01 22:05:29Z jimharris $");
 #endif
@@ -78,7 +78,7 @@ static void
 perftest_usage(void)
 {
 	fprintf(stderr, "usage:\n");
-	fprintf(stderr, PERFTEST_USAGE);
+	fprintf(stderr, "\t%s" PERFTEST_USAGE, getprogname());
 	exit(1);
 }
 
Index: src/sbin/nvmectl/power.c
diff -u src/sbin/nvmectl/power.c:1.2 src/sbin/nvmectl/power.c:1.3
--- src/sbin/nvmectl/power.c:1.2	Sat Jun  4 20:59:49 2016
+++ src/sbin/nvmectl/power.c	Sat Mar 17 11:07:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: power.c,v 1.2 2016/06/04 20:59:49 joerg Exp $	*/
+/*	$NetBSD: power.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2016 Netflix, Inc
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: power.c,v 1.2 2016/06/04 20:59:49 joerg Exp $");
+__RCSID("$NetBSD: power.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $");
 #if 0
 __FBSDID("$FreeBSD: head/sbin/nvmecontrol/power.c 296672 2016-03-11 17:25:18Z dim $");
 #endif
@@ -52,7 +52,7 @@ __dead static void
 power_usage(void)
 {
 	fprintf(stderr, "usage:\n");
-	fprintf(stderr, POWER_USAGE);
+	fprintf(stderr, "\t%s " POWER_USAGE, getprogname());
 	exit(1);
 }
 

Index: src/sbin/nvmectl/logpage.c
diff -u src/sbin/nvmectl/logpage.c:1.4 src/sbin/nvmectl/logpage.c:1.5
--- src/sbin/nvmectl/logpage.c:1.4	Sat Apr 29 00:06:40 2017
+++ src/sbin/nvmectl/logpage.c	Sat Mar 17 11:07:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: logpage.c,v 1.4 2017/04/29 00:06:40 nonaka Exp $	*/
+/*	$NetBSD: logpage.c,v 1.5 2018/03/17 11:07:26 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2013 EMC Corp.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: logpage.c,v 1.4 2017/04/29 00:06:40 nonaka Exp 

CVS commit: src/external/bsd/mdocml/include

2018-03-17 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sat Mar 17 11:06:48 UTC 2018

Modified Files:
src/external/bsd/mdocml/include: config.h

Log Message:
Disable wchar_t support since our C library does not treat wchar_t
as UCS-4 in the case of non-UTF-8 locales.

This feature was controlled by USE_WCHAR and disabled on NetBSD 7.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/mdocml/include/config.h

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

Modified files:

Index: src/external/bsd/mdocml/include/config.h
diff -u src/external/bsd/mdocml/include/config.h:1.3 src/external/bsd/mdocml/include/config.h:1.4
--- src/external/bsd/mdocml/include/config.h:1.3	Sat Mar 18 15:24:17 2017
+++ src/external/bsd/mdocml/include/config.h	Sat Mar 17 11:06:48 2018
@@ -41,7 +41,7 @@
 #define HAVE_STRTONUM 0
 #define HAVE_SYS_ENDIAN 1
 #define HAVE_VASPRINTF 1
-#define HAVE_WCHAR 1
+#define HAVE_WCHAR 0
 #define HAVE_OHASH 0
 
 #define BINM_APROPOS "apropos"



CVS commit: src/sys/net/npf

2018-03-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Mar 17 10:42:24 UTC 2018

Modified Files:
src/sys/net/npf: npf_sendpkt.c

Log Message:
Set the scopes before calling icmp6_error(). This fixes a bug similar to
the one I fixed in rev1.17: since the scopes were not set the packet was
never actually sent.

Tested with wireshark, now the ICMPv6 reply is correctly sent, as
expected.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/net/npf/npf_sendpkt.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/net/npf/npf_sendpkt.c
diff -u src/sys/net/npf/npf_sendpkt.c:1.17 src/sys/net/npf/npf_sendpkt.c:1.18
--- src/sys/net/npf/npf_sendpkt.c:1.17	Wed Mar 14 09:32:04 2018
+++ src/sys/net/npf/npf_sendpkt.c	Sat Mar 17 10:42:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_sendpkt.c,v 1.17 2018/03/14 09:32:04 maxv Exp $	*/
+/*	$NetBSD: npf_sendpkt.c,v 1.18 2018/03/17 10:42:23 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2010-2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_sendpkt.c,v 1.17 2018/03/14 09:32:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_sendpkt.c,v 1.18 2018/03/17 10:42:23 maxv Exp $");
 
 #include 
 #include 
@@ -213,6 +213,18 @@ npf_return_icmp(const npf_cache_t *npc)
 		icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT, 0, 0);
 		return 0;
 	} else if (npf_iscached(npc, NPC_IP6)) {
+		/* Handle IPv6 scopes */
+		const struct ifnet *rcvif = npc->npc_nbuf->nb_ifp;
+		struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+		if (in6_clearscope(>ip6_src) ||
+		in6_clearscope(>ip6_dst)) {
+			return EINVAL;
+		}
+		if (in6_setscope(>ip6_src, rcvif, NULL) ||
+		in6_setscope(>ip6_dst, rcvif, NULL)) {
+			return EINVAL;
+		}
+
 		icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN, 0);
 		return 0;
 	}



CVS commit: src/sys/net/npf

2018-03-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Mar 17 10:21:09 UTC 2018

Modified Files:
src/sys/net/npf: npf_inet.c

Log Message:
Fix the IPv6 payload computation in npf_tcpsaw. It was incorrect, and this
caused the "return-rst" rules to send back an RST with the wrong ACK when
the received SYN had an IPv6 option.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/npf/npf_inet.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/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.41 src/sys/net/npf/npf_inet.c:1.42
--- src/sys/net/npf/npf_inet.c:1.41	Tue Mar 13 16:23:40 2018
+++ src/sys/net/npf/npf_inet.c	Sat Mar 17 10:21:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.41 2018/03/13 16:23:40 maxv Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.42 2018/03/17 10:21:09 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.41 2018/03/13 16:23:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.42 2018/03/17 10:21:09 maxv Exp $");
 
 #include 
 #include 
@@ -215,7 +215,8 @@ npf_tcpsaw(const npf_cache_t *npc, tcp_s
 		return ntohs(ip->ip_len) - npc->npc_hlen - thlen;
 	} else if (npf_iscached(npc, NPC_IP6)) {
 		const struct ip6_hdr *ip6 = npc->npc_ip.v6;
-		return ntohs(ip6->ip6_plen) - thlen;
+		return ntohs(ip6->ip6_plen) -
+		(npc->npc_hlen - sizeof(*ip6)) - thlen;
 	}
 	return 0;
 }



CVS commit: src/sys/dev/ic

2018-03-17 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 17 09:45:44 UTC 2018

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

Log Message:
also remove now duplicate nvme_ccb_put() call from nvme_get_number_of_queues()


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.36 src/sys/dev/ic/nvme.c:1.37
--- src/sys/dev/ic/nvme.c:1.36	Sat Mar 17 09:36:32 2018
+++ src/sys/dev/ic/nvme.c	Sat Mar 17 09:45:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.36 2018/03/17 09:36:32 jdolecek Exp $	*/
+/*	$NetBSD: nvme.c,v 1.37 2018/03/17 09:45:44 jdolecek Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.36 2018/03/17 09:36:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.37 2018/03/17 09:45:44 jdolecek Exp $");
 
 #include 
 #include 
@@ -1465,8 +1465,6 @@ nvme_get_number_of_queues(struct nvme_so
 
 	rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_pt_fill, NVME_TIMO_QOP);
 
-	nvme_ccb_put(sc->sc_admin_q, ccb);
-
 	if (rv != 0) {
 		*nqap = 0;
 		return EIO;



CVS commit: src/sys/dev/ic

2018-03-17 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 17 09:36:32 UTC 2018

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

Log Message:
fix passthrough command usage also in nvme_get_number_of_queues(), fixes
memory corruption and possible panic on boot

PR kern/53059


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.35 src/sys/dev/ic/nvme.c:1.36
--- src/sys/dev/ic/nvme.c:1.35	Sat Mar 17 00:28:03 2018
+++ src/sys/dev/ic/nvme.c	Sat Mar 17 09:36:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.35 2018/03/17 00:28:03 jdolecek Exp $	*/
+/*	$NetBSD: nvme.c,v 1.36 2018/03/17 09:36:32 jdolecek Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.35 2018/03/17 00:28:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.36 2018/03/17 09:36:32 jdolecek Exp $");
 
 #include 
 #include 
@@ -1443,6 +1443,7 @@ nvme_fill_identify(struct nvme_queue *q,
 static int
 nvme_get_number_of_queues(struct nvme_softc *sc, u_int *nqap)
 {
+	struct nvme_pt_state state;
 	struct nvme_pt_command pt;
 	struct nvme_ccb *ccb;
 	uint16_t ncqa, nsqa;
@@ -1455,8 +1456,12 @@ nvme_get_number_of_queues(struct nvme_so
 	pt.cmd.opcode = NVM_ADMIN_GET_FEATURES;
 	pt.cmd.cdw10 = NVM_FEATURE_NUMBER_OF_QUEUES;
 
+	memset(, 0, sizeof(state));
+	state.pt = 
+	state.finished = false;
+
 	ccb->ccb_done = nvme_pt_done;
-	ccb->ccb_cookie = 
+	ccb->ccb_cookie = 
 
 	rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_pt_fill, NVME_TIMO_QOP);
 



CVS commit: [netbsd-8] src/sys/dev/ic

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 08:11:18 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c nvmevar.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #636):
sys/dev/ic/nvme.c: revision 1.33
sys/dev/ic/nvmevar.h: revision 1.14
stop using q_nccbs_avail for deciding whether there are available ccbs;
no need to maintain a counter _and_ q_ccb_list
this fixes deadlock when all ccbs happen to be taken before completion
interrupt - nvme_q_complete() increased q_nccbs_avail only after
processing all the completed commands, by then there was nothing
left to actually kick the disk queue again into action
this also fixes ccb leak on command errors e.g. with bus_dmamem_alloc()
or bus_dmamel_load() - q_nccbs_avail was never decreased on the error path
fixes PR kern/52769 by Martin Husemann, thanks to Paul Goyette
for testing


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/dev/ic/nvmevar.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30 src/sys/dev/ic/nvme.c:1.30.2.1
--- src/sys/dev/ic/nvme.c:1.30	Thu Jun  1 02:45:10 2017
+++ src/sys/dev/ic/nvme.c	Sat Mar 17 08:11:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30 2017/06/01 02:45:10 chs Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.1 2018/03/17 08:11:18 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.1 2018/03/17 08:11:18 martin Exp $");
 
 #include 
 #include 
@@ -1144,12 +1144,6 @@ nvme_q_complete(struct nvme_softc *sc, s
 
 	mutex_exit(>q_cq_mtx);
 
-	if (rv) {
-		mutex_enter(>q_ccb_mtx);
-		q->q_nccbs_avail += rv;
-		mutex_exit(>q_ccb_mtx);
-	}
-
 	return rv;
 }
 
@@ -1362,7 +1356,6 @@ nvme_ccbs_alloc(struct nvme_queue *q, ui
 	q->q_ccbs = kmem_alloc(sizeof(*ccb) * nccbs, KM_SLEEP);
 
 	q->q_nccbs = nccbs;
-	q->q_nccbs_avail = nccbs;
 	q->q_ccb_prpls = nvme_dmamem_alloc(sc,
 	sizeof(*prpl) * sc->sc_max_sgl * nccbs);
 
@@ -1402,11 +1395,8 @@ nvme_ccb_get(struct nvme_queue *q)
 	struct nvme_ccb *ccb = NULL;
 
 	mutex_enter(>q_ccb_mtx);
-	if (q->q_nccbs_avail > 0) {
-		ccb = SIMPLEQ_FIRST(>q_ccb_list);
-		KASSERT(ccb != NULL);
-		q->q_nccbs_avail--;
-
+	ccb = SIMPLEQ_FIRST(>q_ccb_list);
+	if (ccb != NULL) {
 		SIMPLEQ_REMOVE_HEAD(>q_ccb_list, ccb_entry);
 #ifdef DEBUG
 		ccb->ccb_cookie = NULL;

Index: src/sys/dev/ic/nvmevar.h
diff -u src/sys/dev/ic/nvmevar.h:1.13 src/sys/dev/ic/nvmevar.h:1.13.6.1
--- src/sys/dev/ic/nvmevar.h:1.13	Wed Apr  5 20:15:49 2017
+++ src/sys/dev/ic/nvmevar.h	Sat Mar 17 08:11:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmevar.h,v 1.13 2017/04/05 20:15:49 jdolecek Exp $	*/
+/*	$NetBSD: nvmevar.h,v 1.13.6.1 2018/03/17 08:11:18 martin Exp $	*/
 /*	$OpenBSD: nvmevar.h,v 1.8 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -88,7 +88,6 @@ struct nvme_queue {
 
 	kmutex_t		q_ccb_mtx;
 	uint16_t		q_nccbs;	/* total number of ccbs */
-	uint16_t		q_nccbs_avail;	/* available ccbs */
 	struct nvme_ccb		*q_ccbs;
 	SIMPLEQ_HEAD(, nvme_ccb) q_ccb_list;
 	struct nvme_dmamem	*q_ccb_prpls;



CVS commit: src/doc

2018-03-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Mar 17 07:31:36 UTC 2018

Modified Files:
src/doc: 3RDPARTY

Log Message:
binutils-2.30 out


To generate a diff of this commit:
cvs rdiff -u -r1.1504 -r1.1505 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.1504 src/doc/3RDPARTY:1.1505
--- src/doc/3RDPARTY:1.1504	Sun Feb 25 23:53:57 2018
+++ src/doc/3RDPARTY	Sat Mar 17 07:31:36 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1504 2018/02/25 23:53:57 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1505 2018/03/17 07:31:36 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -186,7 +186,7 @@ Todo[5]: Reconcile the doc directory.
 
 Package:	binutils
 Version:	2.27
-Current Vers:	2.29.1
+Current Vers:	2.30
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/binutils/
 Home Page:	http://www.gnu.org/software/binutils/



CVS commit: [pgoyette-compat] src/sys

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 06:50:56 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: init_sysent.c syscalls.c
syscalls_autoload.c systrace_args.c
src/sys/rump/include/rump [pgoyette-compat]: rump_syscalls.h
src/sys/rump/librump/rumpkern [pgoyette-compat]: rump_syscalls.c
src/sys/sys [pgoyette-compat]: cpu.h syscall.h syscallargs.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.319.2.3 -r1.319.2.4 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.310.2.3 -r1.310.2.4 src/sys/kern/syscalls.c
cvs rdiff -u -r1.27.2.3 -r1.27.2.4 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.29.2.3 -r1.29.2.4 src/sys/kern/systrace_args.c
cvs rdiff -u -r1.108.2.3 -r1.108.2.4 \
src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.137.2.3 -r1.137.2.4 \
src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.42.2.2 -r1.42.2.3 src/sys/sys/cpu.h
cvs rdiff -u -r1.304.2.3 -r1.304.2.4 src/sys/sys/syscall.h
cvs rdiff -u -r1.288.2.3 -r1.288.2.4 src/sys/sys/syscallargs.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/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.319.2.3 src/sys/kern/init_sysent.c:1.319.2.4
--- src/sys/kern/init_sysent.c:1.319.2.3	Fri Mar 16 00:38:17 2018
+++ src/sys/kern/init_sysent.c	Sat Mar 17 06:50:55 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: init_sysent.c,v 1.319.2.3 2018/03/16 00:38:17 pgoyette Exp $ */
+/* $NetBSD: init_sysent.c,v 1.319.2.4 2018/03/17 06:50:55 pgoyette Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.3 2018/03/16 00:35:40 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.4 2018/03/17 06:49:57 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.319.2.3 2018/03/16 00:38:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.319.2.4 2018/03/17 06:50:55 pgoyette Exp $");
 
 #include "opt_modular.h"
 #include "opt_ntp.h"

Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.310.2.3 src/sys/kern/syscalls.c:1.310.2.4
--- src/sys/kern/syscalls.c:1.310.2.3	Fri Mar 16 00:38:17 2018
+++ src/sys/kern/syscalls.c	Sat Mar 17 06:50:55 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls.c,v 1.310.2.3 2018/03/16 00:38:17 pgoyette Exp $ */
+/* $NetBSD: syscalls.c,v 1.310.2.4 2018/03/17 06:50:55 pgoyette Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.3 2018/03/16 00:35:40 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.4 2018/03/17 06:49:57 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.3 2018/03/16 00:38:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.4 2018/03/17 06:50:55 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_modular.h"

Index: src/sys/kern/syscalls_autoload.c
diff -u src/sys/kern/syscalls_autoload.c:1.27.2.3 src/sys/kern/syscalls_autoload.c:1.27.2.4
--- src/sys/kern/syscalls_autoload.c:1.27.2.3	Fri Mar 16 00:38:17 2018
+++ src/sys/kern/syscalls_autoload.c	Sat Mar 17 06:50:55 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls_autoload.c,v 1.27.2.3 2018/03/16 00:38:17 pgoyette Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.27.2.4 2018/03/17 06:50:55 pgoyette Exp $ */
 
 /*
  * System call autoload table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.3 2018/03/16 00:35:40 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.4 2018/03/17 06:49:57 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.27.2.3 2018/03/16 00:38:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.27.2.4 2018/03/17 06:50:55 pgoyette Exp $");
 
 #include 
 static struct sc_autoload netbsd_syscalls_autoload[] = {
@@ -172,7 +172,7 @@ static struct sc_autoload netbsd_syscall
 	{ SYS___lfs_segwait50, "lfs" },
 	{ SYS___mq_timedsend50, "mqueue" },
 	{ SYS___mq_timedreceive50, "mqueue" },
-	{ SYS_compat_60__lwp_park, "compat_60" },
+	{ SYS_compat_60__lwp_park, "compat" },
 	{ SYS___aio_suspend50, "aio" },
 	{ SYS_semctl50, "sysv_ipc" },
 	{ SYS___shmctl50, "sysv_ipc" },

Index: src/sys/kern/systrace_args.c
diff -u src/sys/kern/systrace_args.c:1.29.2.3 src/sys/kern/systrace_args.c:1.29.2.4
--- src/sys/kern/systrace_args.c:1.29.2.3	Fri Mar 16 01:16:29 2018
+++ src/sys/kern/systrace_args.c	Sat Mar 17 06:50:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: systrace_args.c,v 1.29.2.3 2018/03/16 01:16:29 pgoyette Exp $ */
+/* $NetBSD: systrace_args.c,v 1.29.2.4 2018/03/17 06:50:55 pgoyette Exp $ */
 
 /*
  * System call argument to DTrace register array converstion.

Index: src/sys/rump/include/rump/rump_syscalls.h
diff 

CVS commit: [pgoyette-compat] src/sys

2018-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 06:49:57 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [pgoyette-compat]: cpu_ucode.c
src/sys/compat/common [pgoyette-compat]: compat_60_mod.c
src/sys/kern [pgoyette-compat]: kern_cpu.c syscalls.master
src/sys/modules/compat [pgoyette-compat]: Makefile
src/sys/modules/compat_60 [pgoyette-compat]: Makefile

Log Message:
Back out changes on the branch related to kernel microcode compat.

Christos didn't like the way it was done, so waiting for a better
approach/implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.5.16.1 -r1.5.16.2 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/compat/common/compat_60_mod.c
cvs rdiff -u -r1.71.16.5 -r1.71.16.6 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.291.2.3 -r1.291.2.4 src/sys/kern/syscalls.master
cvs rdiff -u -r1.14.14.2 -r1.14.14.3 src/sys/modules/compat/Makefile
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/modules/compat_60/Makefile

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/cpu_ucode.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.1 src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.2
--- src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.1	Sat Mar 17 00:41:33 2018
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sat Mar 17 06:49:56 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.5.16.1 2018/03/17 00:41:33 pgoyette Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.5.16.2 2018/03/17 06:49:56 pgoyette Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.1 2018/03/17 00:41:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.2 2018/03/17 06:49:56 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_cpu_ucode.h"
@@ -49,8 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,
 
 static struct cpu_ucode_softc ucode_softc;
 
-#ifndef _MODULE
-
 int
 cpu_ucode_get_version(struct cpu_ucode_version *data)
 {
@@ -66,7 +64,6 @@ cpu_ucode_get_version(struct cpu_ucode_v
 
 	return 0;
 }
-#endif /* ! _MODULE */
 
 #ifdef COMPAT_60
 int
@@ -84,7 +81,6 @@ compat6_cpu_ucode_get_version(struct com
 }
 #endif /* COMPAT60 */
 
-#ifndef _MODULE
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
 {
@@ -127,7 +123,6 @@ cpu_ucode_apply(const struct cpu_ucode *
 	sc->sc_blobsize = 0;
 	return error;
 }
-#endif /* ! _MODULE */
 
 #ifdef COMPAT_60
 int

Index: src/sys/compat/common/compat_60_mod.c
diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.4 src/sys/compat/common/compat_60_mod.c:1.1.2.5
--- src/sys/compat/common/compat_60_mod.c:1.1.2.4	Sat Mar 17 00:48:19 2018
+++ src/sys/compat/common/compat_60_mod.c	Sat Mar 17 06:49:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $	*/
+/*	$NetBSD: compat_60_mod.c,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -61,11 +61,6 @@ static const struct syscall_package comp
 #define REQUIRED_60 "compat_70"		/* XXX No compat_80 yet */
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
-#ifdef CPU_UCODE
-int (*orig_compat_6_cpu_get_version)(struct compat6_cpu_ucode *);
-int (*orig_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *);
-#endif
-
 static const struct syscall_package compat__60_syscalls[] = {
 { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },  
 NULL, 0, NULL }
@@ -75,29 +70,19 @@ static const struct syscall_package comp
 int
 compat_60_init(void)
 {
-	int error;
+	int error = 0;
 
 	error = syscall_establish(NULL, compat_60_syscalls);
 	if (error != 0)
 		return error;
-#ifdef CPU_UCODE
-	orig_compat_6_cpu_get_version = vec_compat6_cpu_ucode_get_version;
-	*vec_compat6_cpu_ucode_get_version = compat6_cpu_ucode_get_version;
-	orig_compat6_cpu_ucode_apply = vec_compat6_cpu_ucode_apply;
-	*vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply;
-#endif
 	return 0;
 }
 
 int
 compat_60_fini(void)
 {
-	int error;
+	int error = 0;
 
-#ifdef CPU_UCODE
-	*vec_compat6_cpu_ucode_get_version = orig_compat_6_cpu_get_version;
-	*vec_compat6_cpu_ucode_apply = orig_compat6_cpu_ucode_apply;
-#endif
 	error = syscall_disestablish(NULL, compat_60_syscalls);
 
 	return error;
@@ -107,7 +92,6 @@ compat_60_fini(void)
 static int
 compat_60_modcmd(modcmd_t cmd, void *arg)
 {
-	int error;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.5 src/sys/kern/kern_cpu.c:1.71.16.6
---