CVS commit: src/sys

2016-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  3 04:26:58 UTC 2016

Modified Files:
src/sys/compat/common: Makefile
src/sys/modules/compat: Makefile
src/sys/modules/sysv_ipc: Makefile
Added Files:
src/sys/compat/common: Makefile.sysio Makefile.sysv

Log Message:
Reorganize SRCS lists for libcompat, compat.kmod, sysv_ipc.kmod.

- Share lists between the libcompat and module makefiles.
- Include some omitted entries in compat.kmod:
  . if_43.c
  . kern_sa_60.c
  . kern_time_30.c
  . rndpseudo_50.c
  . rtsock_14.c
  . rtsock_50.c
  . rtsock_70.c
  . uipc_syscalls_40.c
  . uipc_syscalls_50.c
- Exclude a (harmless) spurious entry in sysv_ipc.kmod on LP64 systems:
  . kern_ipc_10.c

Should fix broken ifconfig on modular current kernels.

ok pgoyette


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/compat/common/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/compat/common/Makefile.sysio \
src/sys/compat/common/Makefile.sysv
cvs rdiff -u -r1.13 -r1.14 src/sys/modules/compat/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/sysv_ipc/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/Makefile
diff -u src/sys/compat/common/Makefile:1.57 src/sys/compat/common/Makefile:1.58
--- src/sys/compat/common/Makefile:1.57	Wed Sep 21 10:50:23 2016
+++ src/sys/compat/common/Makefile	Thu Nov  3 04:26:58 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.57 2016/09/21 10:50:23 roy Exp $
+#	$NetBSD: Makefile,v 1.58 2016/11/03 04:26:58 riastradh Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -11,50 +11,8 @@ CPPFLAGS=	${COMPATCPPFLAGS} ${SKIP_AUTOD
 # Common compatibility code, used by all emulations
 SRCS=	compat_exec.c compat_util.c
 
-# Compatibility code for 4.3BSD
-SRCS+=	kern_exit_43.c kern_info_43.c kern_resource_43.c kern_sig_43.c \
-	tty_43.c uipc_syscalls_43.c vfs_syscalls_43.c vm_43.c if_43.c
-
-# Compatibility code for NetBSD 0.9
-SRCS+=	kern_info_09.c
-
-# Compatibility code for NetBSD 1.2
-SRCS+=	kern_xxx_12.c vfs_syscalls_12.c vm_12.c
-
-# Compatibility code for NetBSD 1.3
-SRCS+=	kern_sig_13.c
-
-# Compatibility code for NetBSD 1.6
-SRCS+=	kern_sig_16.c
-
-# Compatibility code for NetBSD 1.4
-SRCS+=	sysv_msg_14.c sysv_shm_14.c sysv_sem_14.c rtsock_14.c
-
-# Compatibility code for NetBSD 2.0
-SRCS+=	vfs_syscalls_20.c
-
-# Compatibility code for NetBSD 3.0
-SRCS+=	kern_time_30.c vfs_syscalls_30.c uipc_syscalls_30.c
-
-# Compatibility code for NetBSD 4.0
-SRCS+=	vfs_syscalls_40.c uipc_syscalls_40.c
-
-# Compatibility code for NetBSD 5.0
-SRCS+=	kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
-	sysv_ipc_50.c sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c \
-	vfs_syscalls_50.c  uipc_syscalls_50.c
-
-# Compatibility code for NetBSD 6.0
-SRCS+=	kern_sa_60.c tty_60.c kern_time_60.c
-
-# Compatibility code for NetBSD 7.0
-SRCS+=	rtsock_70.c uipc_usrreq_70.c
-
-# really, all machines where sizeof(int) != sizeof(long) (LP64)
-.if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "sparc64" \
-  && ${MACHINE_ARCH} != "x86_64")
-SRCS+=	kern_ipc_10.c
-.endif
+.include "Makefile.sysio"
+.include "Makefile.sysv"
 
 # only needed during build
 libinstall::

Index: src/sys/modules/compat/Makefile
diff -u src/sys/modules/compat/Makefile:1.13 src/sys/modules/compat/Makefile:1.14
--- src/sys/modules/compat/Makefile:1.13	Wed Apr  6 19:45:45 2016
+++ src/sys/modules/compat/Makefile	Thu Nov  3 04:26:58 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2016/04/06 19:45:45 roy Exp $
+#	$NetBSD: Makefile,v 1.14 2016/11/03 04:26:58 riastradh Exp $
 
 .include "../Makefile.inc"
 
@@ -25,16 +25,9 @@ CPPFLAGS+=	-DCOMPAT_30 -DCOMPAT_40 -DCOM
 CPPFLAGS+=	-DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
 CPPFLAGS+=	-DCOMPAT_43
 
-SRCS=	kern_exit_43.c kern_info_09.c
-SRCS+=	kern_info_43.c kern_resource_43.c kern_select_50.c
-SRCS+=	kern_sig_13.c kern_sig_43.c kern_xxx_12.c
-SRCS+=	tty_43.c uipc_syscalls_30.c
-SRCS+=	uipc_syscalls_43.c vfs_syscalls_12.c kern_sig_16.c
-SRCS+=	vfs_syscalls_20.c vfs_syscalls_30.c vfs_syscalls_40.c
-SRCS+=	vfs_syscalls_43.c vm_12.c vm_43.c compat_mod.c
-SRCS+=	kern_time_50.c kern_50.c vfs_syscalls_50.c
-SRCS+=	tty_60.c kern_time_60.c
-SRCS+=	uipc_usrreq_70.c
+.include "../../compat/common/Makefile.sysio"
+
+SRCS+=	compat_mod.c
 
 .PATH:	${S}/arch/${MACHINE}/${MACHINE}
 .PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}

Index: src/sys/modules/sysv_ipc/Makefile
diff -u src/sys/modules/sysv_ipc/Makefile:1.2 src/sys/modules/sysv_ipc/Makefile:1.3
--- src/sys/modules/sysv_ipc/Makefile:1.2	Thu Dec  3 02:51:01 2015
+++ src/sys/modules/sysv_ipc/Makefile	Thu Nov  3 04:26:58 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2015/12/03 02:51:01 pgoyette Exp $
+# $NetBSD: Makefile,v 1.3 2016/11/03 04:26:58 riastradh Exp $
 
 .include "../Makefile.inc"
 
@@ -17,11 +17,6 @@ CPPFLAGS+=	-DCOMPAT_13
 CPPFLAGS+=	-DCOMPAT_14
 CPPFLAGS+=	-DCOMPAT_50
 
-SRCS+=	

CVS commit: src/sys/kern

2016-11-02 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 03:57:05 UTC 2016

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

Log Message:
Remove ptrace_do{,fp}regs - they are a duplicate of process_* routines
which are still in sys_ptrace_common.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/sys_ptrace.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/sys_ptrace.c
diff -u src/sys/kern/sys_ptrace.c:1.1 src/sys/kern/sys_ptrace.c:1.2
--- src/sys/kern/sys_ptrace.c:1.1	Wed Nov  2 00:11:59 2016
+++ src/sys/kern/sys_ptrace.c	Thu Nov  3 03:57:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace.c,v 1.1 2016/11/02 00:11:59 pgoyette Exp $	*/
+/*	$NetBSD: sys_ptrace.c,v 1.2 2016/11/03 03:57:05 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.1 2016/11/02 00:11:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.2 2016/11/03 03:57:05 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -151,8 +151,6 @@ __KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c
 
 static int ptrace_copyinpiod(struct ptrace_io_desc *, const void *);
 static void ptrace_copyoutpiod(const struct ptrace_io_desc *, void *);
-static int ptrace_doregs(struct lwp *, struct lwp *, struct uio *);
-static int ptrace_dofpregs(struct lwp *, struct lwp *, struct uio *);
 
 static int
 ptrace_copyinpiod(struct ptrace_io_desc *piod, const void *addr)
@@ -166,88 +164,11 @@ ptrace_copyoutpiod(const struct ptrace_i
 	(void) copyout(piod, addr, sizeof(*piod));
 }
 
-int
-ptrace_doregs(struct lwp *curl /*tracer*/,
-struct lwp *l /*traced*/,
-struct uio *uio)
-{
-#if defined(PT_GETREGS) || defined(PT_SETREGS)
-	int error;
-	struct reg r;
-	char *kv;
-	int kl;
-
-	if (uio->uio_offset < 0 || uio->uio_offset > (off_t)sizeof(r))
-		return EINVAL;
-
-	kl = sizeof(r);
-	kv = (char *)
-
-	kv += uio->uio_offset;
-	kl -= uio->uio_offset;
-	if ((size_t)kl > uio->uio_resid)
-		kl = uio->uio_resid;
-
-	error = process_read_regs(l, );
-	if (error == 0)
-		error = uiomove(kv, kl, uio);
-	if (error == 0 && uio->uio_rw == UIO_WRITE) {
-		if (l->l_stat != LSSTOP)
-			error = EBUSY;
-		else
-			error = process_write_regs(l, );
-	}
-
-	uio->uio_offset = 0;
-	return error;
-#else
-	return EINVAL;
-#endif
-}
-
-int
-ptrace_dofpregs(struct lwp *curl /*tracer*/,
-struct lwp *l /*traced*/,
-struct uio *uio)
-{
-#if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
-	int error;
-	struct fpreg r;
-	char *kv;
-	size_t kl;
-
-	if (uio->uio_offset < 0 || uio->uio_offset > (off_t)sizeof(r))
-		return EINVAL;
-
-	kl = sizeof(r);
-	kv = (char *)
-
-	kv += uio->uio_offset;
-	kl -= uio->uio_offset;
-	if (kl > uio->uio_resid)
-		kl = uio->uio_resid;
-
-	error = process_read_fpregs(l, , );
-	if (error == 0)
-		error = uiomove(kv, kl, uio);
-	if (error == 0 && uio->uio_rw == UIO_WRITE) {
-		if (l->l_stat != LSSTOP)
-			error = EBUSY;
-		else
-			error = process_write_fpregs(l, , kl);
-	}
-	uio->uio_offset = 0;
-	return error;
-#else
-	return EINVAL;
-#endif
-}
-
 static struct ptrace_methods native_ptm = {
 	.ptm_copyinpiod = ptrace_copyinpiod,
 	.ptm_copyoutpiod = ptrace_copyoutpiod,
-	.ptm_doregs = ptrace_doregs,
-	.ptm_dofpregs = ptrace_dofpregs,
+	.ptm_doregs = process_doregs,
+	.ptm_dofpregs = process_dofpregs,
 };
 
 static const struct syscall_package ptrace_syscalls[] = {



CVS commit: src/sys/miscfs/procfs

2016-11-02 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov  3 03:53:32 UTC 2016

Modified Files:
src/sys/miscfs/procfs: procfs_vfsops.c

Log Message:
Module procfs needs ptrace_common for process_do{,fp}regs


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/miscfs/procfs/procfs_vfsops.c

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

Modified files:

Index: src/sys/miscfs/procfs/procfs_vfsops.c
diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.94 src/sys/miscfs/procfs/procfs_vfsops.c:1.95
--- src/sys/miscfs/procfs/procfs_vfsops.c:1.94	Mon Nov 10 18:46:34 2014
+++ src/sys/miscfs/procfs/procfs_vfsops.c	Thu Nov  3 03:53:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_vfsops.c,v 1.94 2014/11/10 18:46:34 maxv Exp $	*/
+/*	$NetBSD: procfs_vfsops.c,v 1.95 2016/11/03 03:53:32 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.94 2014/11/10 18:46:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.95 2016/11/03 03:53:32 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -105,7 +105,7 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_vfsop
 
 #include 			/* for PAGE_SIZE */
 
-MODULE(MODULE_CLASS_VFS, procfs, NULL);
+MODULE(MODULE_CLASS_VFS, procfs, "ptrace_common");
 
 VFS_PROTOS(procfs);
 



CVS commit: src/sys/compat/common

2016-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  3 03:37:06 UTC 2016

Modified Files:
src/sys/compat/common: kern_time_30.c rtsock_14.c

Log Message:
Sprinkle #ifdef _KERNEL_OPT.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/kern_time_30.c \
src/sys/compat/common/rtsock_14.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/compat/common/kern_time_30.c
diff -u src/sys/compat/common/kern_time_30.c:1.4 src/sys/compat/common/kern_time_30.c:1.5
--- src/sys/compat/common/kern_time_30.c:1.4	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/kern_time_30.c	Thu Nov  3 03:37:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_30.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: kern_time_30.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,9 +36,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_ntp.h"
+#endif
 
 #include 
 #include 
Index: src/sys/compat/common/rtsock_14.c
diff -u src/sys/compat/common/rtsock_14.c:1.4 src/sys/compat/common/rtsock_14.c:1.5
--- src/sys/compat/common/rtsock_14.c:1.4	Sun Jul 17 20:54:50 2011
+++ src/sys/compat/common/rtsock_14.c	Thu Nov  3 03:37:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_14.c,v 1.4 2011/07/17 20:54:50 joerg Exp $	*/
+/*	$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,9 +61,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.4 2011/07/17 20:54:50 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_inet.h"
+#endif
 
 #include 
 #include 



CVS commit: src/external/gpl3/binutils/dist/bfd

2016-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  3 01:22:59 UTC 2016

Modified Files:
src/external/gpl3/binutils/dist/bfd: elf32-ppc.c elf64-ppc.c

Log Message:
More detailed error messages for text relocations on ppc code. Tested by joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/binutils/dist/bfd/elf32-ppc.c \
src/external/gpl3/binutils/dist/bfd/elf64-ppc.c

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

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/elf32-ppc.c
diff -u src/external/gpl3/binutils/dist/bfd/elf32-ppc.c:1.9 src/external/gpl3/binutils/dist/bfd/elf32-ppc.c:1.10
--- src/external/gpl3/binutils/dist/bfd/elf32-ppc.c:1.9	Wed Oct 26 14:42:52 2016
+++ src/external/gpl3/binutils/dist/bfd/elf32-ppc.c	Wed Nov  2 21:22:59 2016
@@ -5557,7 +5557,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
 /* Return true if we have dynamic relocs that apply to read-only sections.  */
 
 static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h)
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf, bfd_boolean warn)
 {
   struct elf_dyn_relocs *p;
 
@@ -5568,7 +5568,16 @@ readonly_dynrelocs (struct elf_link_hash
   if (s != NULL
 	  && ((s->flags & (SEC_READONLY | SEC_ALLOC))
 	  == (SEC_READONLY | SEC_ALLOC)))
-	return TRUE;
+	{
+	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+	  if (warn && ((info->warn_shared_textrel && bfd_link_pic (info))
+	  || info->error_textrel))
+	info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"),
+p->sec->owner, h->root.root.string,
+p->sec);
+	  return TRUE;
+	}
 }
   return FALSE;
 }
@@ -5642,7 +5651,7 @@ ppc_elf_adjust_dynamic_symbol (struct bf
 	  && h->type != STT_GNU_IFUNC
 	  && !htab->is_vxworks
 	  && !ppc_elf_hash_entry (h)->has_sda_refs
-	  && !readonly_dynrelocs (h))
+	  && !readonly_dynrelocs (h, info, FALSE))
 	{
 	  h->pointer_equality_needed = 0;
 	  h->non_got_ref = 0;
@@ -5662,7 +5671,7 @@ ppc_elf_adjust_dynamic_symbol (struct bf
 		   && h->type != STT_GNU_IFUNC
 		   && !htab->is_vxworks
 		   && !ppc_elf_hash_entry (h)->has_sda_refs
-		   && !readonly_dynrelocs (h))
+		   && !readonly_dynrelocs (h, info, FALSE))
 	h->non_got_ref = 0;
 	}
   h->protected_def = 0;
@@ -5739,7 +5748,7 @@ ppc_elf_adjust_dynamic_symbol (struct bf
   && !ppc_elf_hash_entry (h)->has_sda_refs
   && !htab->is_vxworks
   && !h->def_regular
-  && !readonly_dynrelocs (h))
+  && !readonly_dynrelocs (h, info, FALSE))
 {
   h->non_got_ref = 0;
   return TRUE;
@@ -6249,7 +6258,7 @@ maybe_set_textrel (struct elf_link_hash_
   if (h->root.type == bfd_link_hash_indirect)
 return TRUE;
 
-  if (readonly_dynrelocs (h))
+  if (readonly_dynrelocs (h, info, TRUE))
 {
   ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
 
Index: src/external/gpl3/binutils/dist/bfd/elf64-ppc.c
diff -u src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.9 src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.10
--- src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.9	Wed Oct 26 14:42:52 2016
+++ src/external/gpl3/binutils/dist/bfd/elf64-ppc.c	Wed Nov  2 21:22:59 2016
@@ -7105,7 +7105,7 @@ ppc64_elf_func_desc_adjust (bfd *obfd AT
 /* Return true if we have dynamic relocs that apply to read-only sections.  */
 
 static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h)
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf, bfd_boolean warn)
 {
   struct ppc_link_hash_entry *eh;
   struct elf_dyn_relocs *p;
@@ -7116,7 +7116,16 @@ readonly_dynrelocs (struct elf_link_hash
   asection *s = p->sec->output_section;
 
   if (s != NULL && (s->flags & SEC_READONLY) != 0)
-	return TRUE;
+	{
+	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+	  if (warn && ((info->warn_shared_textrel && bfd_link_pic (info))
+	  || info->error_textrel))
+	info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"),
+p->sec->owner, h->root.root.string,
+p->sec);
+	  return TRUE;
+	}
 }
   return FALSE;
 }
@@ -7168,7 +7177,7 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 	 be used instead.  */
 	  if (h->pointer_equality_needed
 	  && h->type != STT_GNU_IFUNC
-	  && !readonly_dynrelocs (h))
+	  && !readonly_dynrelocs (h, info, FALSE))
 	{
 	  h->pointer_equality_needed = 0;
 	  h->non_got_ref = 0;
@@ -7186,7 +7195,7 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 	  else if (!h->ref_regular_nonweak
 		   && h->non_got_ref
 		   && h->type != STT_GNU_IFUNC
-		   && !readonly_dynrelocs (h))
+		   && !readonly_dynrelocs (h, info, FALSE))
 	h->non_got_ref = 0;
 
 	  /* If making a plt entry, then we don't need copy relocs.  */
@@ -7235,7 +7244,7 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 

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

2016-11-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  3 00:10:49 UTC 2016

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

Log Message:
Avoid zero-size uao.

Apparently some GEM/TTM objects can be zero-size, as discovered by
Stefan Hertenberger:
https://mail-index.netbsd.org/current-users/2016/08/02/msg029891.html


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/drm_gem.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.5 src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.5	Mon Aug 18 01:21:03 2014
+++ src/sys/external/bsd/drm2/dist/drm/drm_gem.c	Thu Nov  3 00:10:49 2016
@@ -154,7 +154,11 @@ int drm_gem_object_init(struct drm_devic
 	drm_gem_private_object_init(dev, obj, size);
 
 #ifdef __NetBSD__
-	obj->gemo_shm_uao = uao_create(size, 0);
+	/*
+	 * A uao may not have size 0, but a gem object may.  Allocate a
+	 * spurious page so we needn't teach uao how to have size 0.
+	 */
+	obj->gemo_shm_uao = uao_create(MAX(size, PAGE_SIZE), 0);
 	/*
 	 * XXX This is gross.  We ought to do it the other way around:
 	 * set the uao to have the main uvm object's lock.  However,



CVS commit: src/tests/kernel

2016-11-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Nov  2 22:18:04 UTC 2016

Modified Files:
src/tests/kernel: t_ptrace.c

Log Message:
Add new test-case "traceme2" in t_ptrace

This test is a clone of traceme2 with ptrace(2) calling PT_CONTINUE
with signal to be passed to the child: SIGINT. traceme1 sends no signals.

Sponsored by .


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_ptrace.c

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

Modified files:

Index: src/tests/kernel/t_ptrace.c
diff -u src/tests/kernel/t_ptrace.c:1.1 src/tests/kernel/t_ptrace.c:1.2
--- src/tests/kernel/t_ptrace.c:1.1	Wed Nov  2 12:51:22 2016
+++ src/tests/kernel/t_ptrace.c	Wed Nov  2 22:18:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace.c,v 1.1 2016/11/02 12:51:22 kamil Exp $	*/
+/*	$NetBSD: t_ptrace.c,v 1.2 2016/11/02 22:18:04 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace.c,v 1.1 2016/11/02 12:51:22 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.2 2016/11/02 22:18:04 kamil Exp $");
 
 #include 
 #include 
@@ -144,9 +144,140 @@ ATF_TC_BODY(traceme1, tc)
 
 }
 
+ATF_TC(traceme2);
+ATF_TC_HEAD(traceme2, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify SIGSTOP followed by _exit(2) in a child");
+}
+
+static int traceme2_catched = 0;
+
+static void
+traceme2_sighandler(int sig)
+{
+	if (sig != SIGINT)
+		errx(EXIT_FAILURE, "sighandler: Unexpected signal received: "
+		"%s, expected SIGINT", sys_signame[sig]);
+
+	++traceme2_catched;
+}
+
+ATF_TC_BODY(traceme2, tc)
+{
+	int status;
+	const int exitval = 5;
+	const int sigval = SIGSTOP, sigsent = SIGINT;
+	pid_t child, wpid;
+	struct sigaction sa;
+
+	printf("1: Before forking process PID=%d\n", getpid());
+	ATF_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		/* printf(3) messages from a child aren't intercepted by ATF */
+		/* "2: Child process PID=%d\n", getpid() */
+
+		/* "2: Before calling ptrace(PT_TRACE_ME, ...)\n" */
+		if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1) {
+			/* XXX: Is it safe to use ATF functions in a child? */
+			err(EXIT_FAILURE, "2: ptrace(2) call failed with "
+			"status %s", sys_errlist[errno]);
+		}
+
+		/* "2: Setup sigaction(2) in the child" */
+		sa.sa_handler = traceme2_sighandler;
+		sa.sa_flags = SA_SIGINFO;
+		sigemptyset(_mask);
+
+		if (sigaction(sigsent, , NULL) == -1)
+			err(EXIT_FAILURE, "2: sigaction(2) call failed with "
+			"status %s", sys_errlist[errno]);
+
+		/* "2: Before raising SIGSTOP\n" */
+		raise(sigval);
+
+		if (traceme2_catched != 1)
+			errx(EXIT_FAILURE, "2: signal handler not called? "
+			"traceme2_catched (equal to %d) != 1",
+			traceme2_catched);
+
+		/* "2: Before calling _exit(%d)\n", exitval */
+		_exit(exitval);
+	} else {
+		printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),
+		child);
+
+		printf("1: Before calling waitpid() for the child\n");
+		wpid = waitpid(child, , 0);
+
+		printf("1: Validating child's PID (expected %d, got %d)\n",
+		child, wpid);
+		ATF_REQUIRE(child == wpid);
+
+		printf("1: Ensuring that the child has not been exited\n");
+		ATF_REQUIRE(!WIFEXITED(status));
+
+		printf("1: Ensuring that the child has not been continued\n");
+		ATF_REQUIRE(!WIFCONTINUED(status));
+
+		printf("1: Ensuring that the child has not been terminated "
+		"with a signal\n");
+		ATF_REQUIRE(!WIFSIGNALED(status));
+
+		printf("1: Ensuring that the child has been stopped\n");
+		ATF_REQUIRE(WIFSTOPPED(status));
+
+		printf("1: Verifying that he child has been stopped with the"
+		" %s signal (received %s)\n", sys_signame[sigval],
+		sys_signame[WSTOPSIG(status)]);
+		ATF_REQUIRE(WSTOPSIG(status) == sigval);
+
+		printf("1: Before resuming the child process where it left "
+		"off and with signal %s to be sent\n",
+		sys_signame[sigsent]);
+		ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent)
+		!= -1);
+
+		printf("1: Before calling waitpid() for the child\n");
+		wpid = waitpid(child, , 0);
+
+		printf("1: Validating that child's PID is still there\n");
+		ATF_REQUIRE(wpid == child);
+
+		printf("1: Ensuring that the child has been exited\n");
+		ATF_REQUIRE(WIFEXITED(status));
+
+		printf("1: Ensuring that the child has not been continued\n");
+		ATF_REQUIRE(!WIFCONTINUED(status));
+
+		printf("1: Ensuring that the child has not been terminated "
+		"with a signal\n");
+		ATF_REQUIRE(!WIFSIGNALED(status));
+
+		printf("1: Ensuring that the child has not been stopped\n");
+		ATF_REQUIRE(!WIFSTOPPED(status));
+
+		printf("1: Verifying that he child has exited with the "
+		"%d status (received %d)\n", exitval, WEXITSTATUS(status));
+		ATF_REQUIRE(WEXITSTATUS(status) == exitval);
+
+		printf("1: Before calling waitpid() for the exited child\n");
+		wpid = waitpid(child, , 0);
+
+		printf("1: Validating that child's PID no 

CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/common

2016-11-02 Thread Joerg Sonnenberger
Module Name:xsrc
Committed By:   joerg
Date:   Wed Nov  2 20:56:40 UTC 2016

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/common: xf86Configure.c

Log Message:
Add explicit cast before writing to newly allocated memory.

XXX Beside the strange allocation size, this could be XNFstrdup.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Configure.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Configure.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Configure.c:1.9 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Configure.c:1.10
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Configure.c:1.9	Thu Aug 18 18:52:02 2016
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Configure.c	Wed Nov  2 20:56:40 2016
@@ -144,7 +144,7 @@ xf86AddBusDeviceToConfigure(const char *
 #if defined(__arm32__) || defined(__arm__)
 case BUS_ISA:
 	DevToConfig[i].GDev.busID = xnfalloc(6);
-	strcpy(DevToConfig[i].GDev.busID, "ISA");
+	strcpy((char *)DevToConfig[i].GDev.busID, "ISA");
 	break;
 #endif
 default:



CVS commit: src/doc

2016-11-02 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Wed Nov  2 17:19:53 UTC 2016

Modified Files:
src/doc: CHANGES

Log Message:
Note tcu(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2204 -r1.2205 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2204 src/doc/CHANGES:1.2205
--- src/doc/CHANGES:1.2204	Wed Nov  2 00:40:27 2016
+++ src/doc/CHANGES	Wed Nov  2 17:19:53 2016
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2204 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2205 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -354,6 +354,8 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	ext2fs: Actually fill file type for readdir(4) and friends.
 		[jdolecek 20160615]
 	zoneinfo: Import tzdata2016f. [kre 20160807]
+	tcu(4): Add support for flxd TC-USB TURBOchannel USB and GPIO option.
+		[flxd 20160811]
 	ext2fs: Add read-only ext4 extended attribute support.
 		[jdolecek 20160612]
 	dhcpcd(8): Import dhcpcd-6.11.3. [roy 20160815]



CVS commit: xsrc/external/mit/xf86-video-chips/dist/src

2016-11-02 Thread Joerg Sonnenberger
Module Name:xsrc
Committed By:   joerg
Date:   Wed Nov  2 15:56:01 UTC 2016

Modified Files:
xsrc/external/mit/xf86-video-chips/dist/src: ct_driver.c

Log Message:
Fix bit checking loop. Use consistent parenthesis.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 \
xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c
diff -u xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.23 xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.24
--- xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c:1.23	Sat Aug 27 15:41:45 2016
+++ xsrc/external/mit/xf86-video-chips/dist/src/ct_driver.c	Wed Nov  2 15:56:01 2016
@@ -7272,8 +7272,8 @@ chipsTestDACComp(ScrnInfoPtr pScrn, unsi
 hwp->writeDacData(hwp, a);/* set pattern */
 hwp->writeDacData(hwp, b);
 hwp->writeDacData(hwp, c);
-while (!(hwp->readST01(hwp)) & 0x01){};   /* wait for hsync to end  */
-while ((hwp->readST01(hwp)) & 0x01){};/* wait for hsync to end  */
+while (!(hwp->readST01(hwp) & 0x01)){};   /* wait for hsync to end  */
+while (hwp->readST01(hwp) & 0x01){};  /* wait for hsync to end  */
 type = hwp->readST00(hwp);/* read comparator*/
 return (type & 0x10);
 }



CVS commit: src/external/bsd/openldap/dist/clients/tools

2016-11-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Nov  2 13:15:54 UTC 2016

Modified Files:
src/external/bsd/openldap/dist/clients/tools: common.c

Log Message:
Logical negation binds stronger than bitwise and, which doesn't seem to
be intended here.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/bsd/openldap/dist/clients/tools/common.c

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

Modified files:

Index: src/external/bsd/openldap/dist/clients/tools/common.c
diff -u src/external/bsd/openldap/dist/clients/tools/common.c:1.4 src/external/bsd/openldap/dist/clients/tools/common.c:1.5
--- src/external/bsd/openldap/dist/clients/tools/common.c:1.4	Wed May 28 10:12:43 2014
+++ src/external/bsd/openldap/dist/clients/tools/common.c	Wed Nov  2 13:15:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.c,v 1.4 2014/05/28 10:12:43 tron Exp $	*/
+/*	$NetBSD: common.c,v 1.5 2016/11/02 13:15:53 joerg Exp $	*/
 
 /* common.c - common routines for the ldap client tools */
 /* $OpenLDAP$ */
@@ -2330,7 +2330,7 @@ void tool_print_ctrls(
 		/* known controls */
 		for ( j = 0; tool_ctrl_response[j].oid != NULL; j++ ) {
 			if ( strcmp( tool_ctrl_response[j].oid, ctrls[i]->ldctl_oid ) == 0 ) {
-if ( !tool_ctrl_response[j].mask & tool_type ) {
+if ( !(tool_ctrl_response[j].mask & tool_type) ) {
 	/* this control should not appear
 	 * with this tool; warning? */
 }



CVS commit: src

2016-11-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Nov  2 12:51:22 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_ptrace.c

Log Message:
Add new test t_ptrace with traceme1

This test is a placeholder for further checks of the native ptrace(2)
function calls.

XXX: Is it safe to call ATF functions from a child? FreeBSD seems to
 construct dedicated asserts for them.

XXX: printf(3) calls from a child are not intercepted by atf-run(1)

Sponsored by .


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.690 -r1.691 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.39 -r1.40 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_ptrace.c

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.169 src/distrib/sets/lists/debug/mi:1.170
--- src/distrib/sets/lists/debug/mi:1.169	Tue Nov  1 19:21:17 2016
+++ src/distrib/sets/lists/debug/mi	Wed Nov  2 12:51:22 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.169 2016/11/01 19:21:17 christos Exp $
+# $NetBSD: mi,v 1.170 2016/11/02 12:51:22 kamil Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1690,6 +1690,7 @@
 ./usr/libdata/debug/usr/tests/kernel/t_poll3w.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_pollts.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_posix_fadvise.debug		tests-obsolete		obsolete,compattestfile
+./usr/libdata/debug/usr/tests/kernel/t_ptrace.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_pty.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_rnd.debug			tests-kernel-tests	debug,atf,rump
 ./usr/libdata/debug/usr/tests/kernel/t_sigaction.debug			tests-obsolete		obsolete,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.690 src/distrib/sets/lists/tests/mi:1.691
--- src/distrib/sets/lists/tests/mi:1.690	Mon Oct 31 10:38:25 2016
+++ src/distrib/sets/lists/tests/mi	Wed Nov  2 12:51:22 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.690 2016/10/31 10:38:25 ozaki-r Exp $
+# $NetBSD: mi,v 1.691 2016/11/02 12:51:22 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2125,6 +2125,7 @@
 ./usr/tests/kernel/t_posix_fadvise		tests-obsolete		obsolete
 ./usr/tests/kernel/t_posix_fallocate		tests-obsolete		obsolete
 ./usr/tests/kernel/t_ps_strings			tests-kernel-tests	compattestfile,atf
+./usr/tests/kernel/t_ptrace			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_pty			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_rnd			tests-kernel-tests	atf,rump
 ./usr/tests/kernel/t_sigaction			tests-obsolete		obsolete

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.39 src/tests/kernel/Makefile:1.40
--- src/tests/kernel/Makefile:1.39	Mon Feb 15 14:59:38 2016
+++ src/tests/kernel/Makefile	Wed Nov  2 12:51:22 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.39 2016/02/15 14:59:38 christos Exp $
+# $NetBSD: Makefile,v 1.40 2016/11/02 12:51:22 kamil Exp $
 
 NOMAN=		# defined
 
@@ -9,6 +9,7 @@ TESTSDIR=	${TESTSBASE}/kernel
 TESTS_SUBDIRS=	kqueue
 TESTS_C=	t_lock
 TESTS_C+=	t_lockf
+TESTS_C+=	t_ptrace
 TESTS_C+=	t_pty
 TESTS_C+=	t_mqueue
 TESTS_C+=	t_sysv

Added files:

Index: src/tests/kernel/t_ptrace.c
diff -u /dev/null src/tests/kernel/t_ptrace.c:1.1
--- /dev/null	Wed Nov  2 12:51:22 2016
+++ src/tests/kernel/t_ptrace.c	Wed Nov  2 12:51:22 2016
@@ -0,0 +1,152 @@
+/*	$NetBSD: t_ptrace.c,v 1.1 2016/11/02 12:51:22 kamil Exp $	*/
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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/usr.sbin/intrctl

2016-11-02 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Nov  2 11:03:33 UTC 2016

Modified Files:
src/usr.sbin/intrctl: intrctl.c

Log Message:
fix column alignment of "intrctl list [-c]"


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/intrctl/intrctl.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/intrctl/intrctl.c
diff -u src/usr.sbin/intrctl/intrctl.c:1.6 src/usr.sbin/intrctl/intrctl.c:1.7
--- src/usr.sbin/intrctl/intrctl.c:1.6	Sat Oct 15 22:23:50 2016
+++ src/usr.sbin/intrctl/intrctl.c	Wed Nov  2 11:03:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: intrctl.c,v 1.6 2016/10/15 22:23:50 jdolecek Exp $	*/
+/*	$NetBSD: intrctl.c,v 1.7 2016/11/02 11:03:33 ryo Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: intrctl.c,v 1.6 2016/10/15 22:23:50 jdolecek Exp $");
+__RCSID("$NetBSD: intrctl.c,v 1.7 2016/11/02 11:03:33 ryo Exp $");
 
 #include 
 #include 
@@ -164,10 +164,10 @@ intrctl_list(int argc, char **argv)
 	}
 
 	/* header */
-	printf("%-*s", (int)intridlen, "interrupt id");
+	printf("%-*s ", (int)intridlen, "interrupt id");
 	if (compact) {
-		printf(" %20s ", "total");
-		printf(" %5s ", "aff");
+		printf("%20s ", "total");
+		printf("%5s ", "aff");
 	} else {
 		for (i = 0; i < ncpus; i++) {
 			snprintf(buf, sizeof(buf), "CPU%u", i);



CVS commit: src/sys/dev/pci

2016-11-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  2 10:14:04 UTC 2016

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

Log Message:
- Fix workaround which did dummy read BM_WUC register. This code was changed to
  drop BM_WUC_HOST_WU_BIT of BM_PROT_GEN_CFG register in FreeBSD r228386. The
  code was added rev. 1.149, but the location was not the best.
  Now I219 doesn't hang quickly after "ifconfig up".
- wm_gmii_hv_{read/write}reg*(): USE PHY address 1 for some special registers.
- Add check code for an 82578 workaround. Not completed yet(check only).
- wm_release_hw_control(): Remove extra line. No any effect.


To generate a diff of this commit:
cvs rdiff -u -r1.436 -r1.437 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.436 src/sys/dev/pci/if_wm.c:1.437
--- src/sys/dev/pci/if_wm.c:1.436	Mon Oct 31 02:44:54 2016
+++ src/sys/dev/pci/if_wm.c	Wed Nov  2 10:14:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.436 2016/10/31 02:44:54 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.437 2016/11/02 10:14:04 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.436 2016/10/31 02:44:54 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.437 2016/11/02 10:14:04 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4003,17 +4003,8 @@ wm_reset(struct wm_softc *sc)
 		break;
 	}
 
-	if (phy_reset != 0) {
+	if (phy_reset != 0)
 		wm_get_cfg_done(sc);
-		delay(10 * 1000);
-		if (sc->sc_type >= WM_T_PCH) {
-			reg = wm_gmii_hv_readreg(sc->sc_dev, 2,
-			BM_PORT_GEN_CFG);
-			reg &= ~BM_WUC_HOST_WU_BIT;
-			wm_gmii_hv_writereg(sc->sc_dev, 2,
-			BM_PORT_GEN_CFG, reg);
-		}
-	}
 
 	/* reload EEPROM */
 	switch (sc->sc_type) {
@@ -4129,9 +4120,15 @@ wm_reset(struct wm_softc *sc)
 	if ((sc->sc_type >= WM_T_I350) && (sc->sc_type <= WM_T_I211))
 		wm_set_eee_i350(sc);
 
-	/* dummy read from WUC */
-	if (sc->sc_type == WM_T_PCH)
-		reg = wm_gmii_hv_readreg(sc->sc_dev, 1, BM_WUC);
+	/* Clear the host wakeup bit after lcd reset */
+	if (sc->sc_type >= WM_T_PCH) {
+		reg = wm_gmii_hv_readreg(sc->sc_dev, 2,
+		BM_PORT_GEN_CFG);
+		reg &= ~BM_WUC_HOST_WU_BIT;
+		wm_gmii_hv_writereg(sc->sc_dev, 2,
+		BM_PORT_GEN_CFG, reg);
+	}
+
 	/*
 	 * For PCH, this write will make sure that any noise will be detected
 	 * as a CRC error and be dropped rather than show up as a bad packet
@@ -8090,12 +8087,13 @@ wm_gmii_reset(struct wm_softc *sc)
 		if (sc->sc_type == WM_T_PCH2)
 			wm_lv_phy_workaround_ich8lan(sc);
 
-		if ((sc->sc_type == WM_T_PCH) || (sc->sc_type == WM_T_PCH2)) {
-			/*
-			 * dummy read to clear the phy wakeup bit after lcd
-			 * reset
-			 */
-			reg = wm_gmii_hv_readreg(sc->sc_dev, 1, BM_WUC);
+		/* Clear the host wakeup bit after lcd reset */
+		if (sc->sc_type >= WM_T_PCH) {
+			reg = wm_gmii_hv_readreg(sc->sc_dev, 2,
+			BM_PORT_GEN_CFG);
+			reg &= ~BM_WUC_HOST_WU_BIT;
+			wm_gmii_hv_writereg(sc->sc_dev, 2,
+			BM_PORT_GEN_CFG, reg);
 		}
 
 		/*
@@ -8378,6 +8376,9 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 			sc->sc_phytype = WMPHY_IGP_3;
 
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_AUTO);
+
+		printf("XXX OUI = %08x, model = %04x, rev = %04x\n",
+		child->mii_mpd_oui, child->mii_mpd_model, child->mii_mpd_rev);
 	}
 }
 
@@ -8912,16 +8913,12 @@ wm_gmii_hv_readreg(device_t self, int ph
 static int
 wm_gmii_hv_readreg_locked(device_t self, int phy, int reg)
 {
-	struct wm_softc *sc = device_private(self);
 	uint16_t page = BM_PHY_REG_PAGE(reg);
 	uint16_t regnum = BM_PHY_REG_NUM(reg);
 	uint16_t val;
 	int rv;
 
-	/* XXX Workaround failure in MDIO access while cable is disconnected */
-	if (sc->sc_phytype == WMPHY_82577) {
-		/* XXX must write */
-	}
+	phy = (page >= HV_INTC_FC_PAGE_START) ? 1 : phy;
 
 	/* Page 800 works differently than the rest so it has its own func */
 	if (page == BM_WUC_PAGE) {
@@ -8975,10 +8972,11 @@ wm_gmii_hv_writereg(device_t self, int p
 static void
 wm_gmii_hv_writereg_locked(device_t self, int phy, int reg, int val)
 {
+	struct wm_softc *sc = device_private(self);
 	uint16_t page = BM_PHY_REG_PAGE(reg);
 	uint16_t regnum = BM_PHY_REG_NUM(reg);
 
-	/* XXX Workaround failure in MDIO access while cable is disconnected */
+	phy = (page >= HV_INTC_FC_PAGE_START) ? 1 : phy;
 
 	/* Page 800 works differently than the rest so it has its own func */
 	if (page == BM_WUC_PAGE) {
@@ -8998,14 +8996,27 @@ wm_gmii_hv_writereg_locked(device_t self
 		return;
 	}
 
-	/*
-	 * XXX Workaround MDIO accesses being disabled after entering IEEE
-	 * Power Down (whenever bit 11 of the PHY control register is set)
-	 */
+	{
+		/*
+		 * XXX Workaround MDIO accesses being disabled after entering
+		 * IEEE Power Down (whenever bit 11 of the PHY control
+		 * register is 

CVS commit: src/sys/dev/mii

2016-11-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  2 10:11:33 UTC 2016

Modified Files:
src/sys/dev/mii: atphy.c

Log Message:
Set mii_mpd_{oui,model,rev}.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/mii/atphy.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/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.17 src/sys/dev/mii/atphy.c:1.18
--- src/sys/dev/mii/atphy.c:1.17	Tue Sep  8 10:16:53 2015
+++ src/sys/dev/mii/atphy.c	Wed Nov  2 10:11:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.17 2015/09/08 10:16:53 msaitoh Exp $ */
+/*	$NetBSD: atphy.c,v 1.18 2016/11/02 10:11:32 msaitoh Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.17 2015/09/08 10:16:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.18 2016/11/02 10:11:32 msaitoh Exp $");
 
 #include 
 #include 
@@ -146,6 +146,9 @@ atphy_attach(device_t parent, device_t s
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = MII_REV(ma->mii_id2);
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  2 08:41:01 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ucom.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.28 -r1.108.2.29 src/sys/dev/usb/ucom.c

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

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.108.2.28 src/sys/dev/usb/ucom.c:1.108.2.29
--- src/sys/dev/usb/ucom.c:1.108.2.28	Wed Nov  2 08:31:25 2016
+++ src/sys/dev/usb/ucom.c	Wed Nov  2 08:41:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.108.2.28 2016/11/02 08:31:25 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.108.2.29 2016/11/02 08:41:00 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.28 2016/11/02 08:31:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.29 2016/11/02 08:41:00 skrll Exp $");
 
 #include 
 #include 
@@ -587,7 +587,7 @@ ucomopen(dev_t dev, int flag, int mode, 
 
 		if (sc->sc_methods->ucom_open != NULL) {
 			error = sc->sc_methods->ucom_open(sc->sc_parent,
-			  sc->sc_portno);
+			sc->sc_portno);
 			if (error) {
 ucom_cleanup(sc);
 sc->sc_opening = 0;
@@ -1153,7 +1153,7 @@ ucomparam(struct tty *tp, struct termios
 
 	if (sc->sc_methods->ucom_param != NULL) {
 		error = sc->sc_methods->ucom_param(sc->sc_parent, sc->sc_portno,
-			t);
+		t);
 		if (error)
 			return error;
 	}
@@ -1253,7 +1253,7 @@ ucomstart(struct tty *tp)
 
 	if (sc->sc_methods->ucom_write != NULL)
 		sc->sc_methods->ucom_write(sc->sc_parent, sc->sc_portno,
-	   ub->ub_data, data, );
+		ub->ub_data, data, );
 	else
 		memcpy(ub->ub_data, data, cnt);
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  2 08:31:25 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ucom.c

Log Message:
Reduce the scope of a variable and style.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.27 -r1.108.2.28 src/sys/dev/usb/ucom.c

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

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.108.2.27 src/sys/dev/usb/ucom.c:1.108.2.28
--- src/sys/dev/usb/ucom.c:1.108.2.27	Wed Nov  2 08:28:10 2016
+++ src/sys/dev/usb/ucom.c	Wed Nov  2 08:31:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.108.2.27 2016/11/02 08:28:10 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.108.2.28 2016/11/02 08:31:25 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.27 2016/11/02 08:28:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.28 2016/11/02 08:31:25 skrll Exp $");
 
 #include 
 #include 
@@ -540,7 +540,6 @@ ucomopen(dev_t dev, int flag, int mode, 
 {
 	const int unit = UCOMUNIT(dev);
 	struct ucom_softc * const sc = device_lookup_private(_cd, unit);
-	struct ucom_buffer *ub;
 	int error;
 
 	UCOMHIST_FUNC(); UCOMHIST_CALLED();
@@ -648,8 +647,8 @@ ucomopen(dev_t dev, int flag, int mode, 
 		/*
 		 * ucomsubmitread handles bulk vs other
 		 */
-		for (ub = >sc_ibuff[0]; ub != >sc_ibuff[UCOM_IN_BUFFS];
-		ub++) {
+		for (size_t i = 0; i < UCOM_IN_BUFFS; i++) {
+			struct ucom_buffer *ub = >sc_ibuff[i];
 			error = ucomsubmitread(sc, ub);
 			if (error)
 goto fail_2;



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  2 08:28:10 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ucom.c

Log Message:
Make ucomsubmitread return int instead of usbd_status.


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.26 -r1.108.2.27 src/sys/dev/usb/ucom.c

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

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.108.2.26 src/sys/dev/usb/ucom.c:1.108.2.27
--- src/sys/dev/usb/ucom.c:1.108.2.26	Tue Nov  1 08:27:57 2016
+++ src/sys/dev/usb/ucom.c	Wed Nov  2 08:28:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.108.2.26 2016/11/01 08:27:57 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.108.2.27 2016/11/02 08:28:10 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.26 2016/11/01 08:27:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.27 2016/11/02 08:28:10 skrll Exp $");
 
 #include 
 #include 
@@ -234,7 +234,7 @@ static void	ucom_write_status(struct uco
 
 static void	ucomwritecb(struct usbd_xfer *, void *, usbd_status);
 static void	ucom_read_complete(struct ucom_softc *);
-static usbd_status ucomsubmitread(struct ucom_softc *, struct ucom_buffer *);
+static int	ucomsubmitread(struct ucom_softc *, struct ucom_buffer *);
 static void	ucom_softintr(void *);
 
 int ucom_match(device_t, cfdata_t, void *);
@@ -650,10 +650,9 @@ ucomopen(dev_t dev, int flag, int mode, 
 		 */
 		for (ub = >sc_ibuff[0]; ub != >sc_ibuff[UCOM_IN_BUFFS];
 		ub++) {
-			if (ucomsubmitread(sc, ub) != USBD_NORMAL_COMPLETION) {
-error = EIO;
+			error = ucomsubmitread(sc, ub);
+			if (error)
 goto fail_2;
-			}
 		}
 	}
 	sc->sc_opening = 0;
@@ -1423,7 +1422,7 @@ ucom_read_complete(struct ucom_softc *sc
 	sc->sc_rx_unblock = (ub != NULL);
 }
 
-static usbd_status
+static int
 ucomsubmitread(struct ucom_softc *sc, struct ucom_buffer *ub)
 {
 	usbd_status err;
@@ -1435,13 +1434,13 @@ ucomsubmitread(struct ucom_softc *sc, st
 		if ((err = usbd_transfer(ub->ub_xfer)) != USBD_IN_PROGRESS) {
 			/* XXX: Recover from this, please! */
 			printf("%s: err=%s\n", __func__, usbd_errstr(err));
-			return err;
+			return EIO;
 		}
 	}
 
 	SIMPLEQ_INSERT_TAIL(>sc_ibuff_empty, ub, ub_link);
 
-	return USBD_NORMAL_COMPLETION;
+	return 0;
 }
 
 void



CVS commit: src/sys/dev/mii

2016-11-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  2 07:01:54 UTC 2016

Modified Files:
src/sys/dev/mii: ihphy.c ikphy.c

Log Message:
Set mii_mpd_{oui,model,rev}.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/mii/ikphy.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/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.9 src/sys/dev/mii/ihphy.c:1.10
--- src/sys/dev/mii/ihphy.c:1.9	Thu Jul  7 06:55:41 2016
+++ src/sys/dev/mii/ihphy.c	Wed Nov  2 07:01:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.9 2016/07/07 06:55:41 msaitoh Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.10 2016/11/02 07:01:54 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.9 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.10 2016/11/02 07:01:54 msaitoh Exp $");
 
 #include 
 #include 
@@ -132,6 +132,9 @@ ihphyattach(device_t parent, device_t se
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = MII_REV(ma->mii_id2);
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;

Index: src/sys/dev/mii/ikphy.c
diff -u src/sys/dev/mii/ikphy.c:1.11 src/sys/dev/mii/ikphy.c:1.12
--- src/sys/dev/mii/ikphy.c:1.11	Thu Jul  7 06:55:41 2016
+++ src/sys/dev/mii/ikphy.c	Wed Nov  2 07:01:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ikphy.c,v 1.11 2016/07/07 06:55:41 msaitoh Exp $	*/
+/*	$NetBSD: ikphy.c,v 1.12 2016/11/02 07:01:54 msaitoh Exp $	*/
 
 /***
 Copyright (c) 2001-2005, Intel Corporation 
@@ -59,7 +59,7 @@ POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.11 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.12 2016/11/02 07:01:54 msaitoh Exp $");
 
 #include 
 #include 
@@ -125,6 +125,9 @@ ikphyattach(device_t parent, device_t se
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = MII_REV(ma->mii_id2);
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;