CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu

2018-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 04:38:22 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu:
nouveau_nvkm_subdev_mmu_base.c

Log Message:
Destroy mutex before freeing memory.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.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/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c:1.3	Mon Aug 27 07:41:19 2018
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c	Sat Sep  1 04:38:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.3 2018/08/27 07:41:19 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.4 2018/09/01 04:38:22 riastradh Exp $	*/
 
 /*
  * Copyright 2010 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.3 2018/08/27 07:41:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.4 2018/09/01 04:38:22 riastradh Exp $");
 
 #include "priv.h"
 
@@ -436,6 +436,11 @@ nvkm_vm_create(struct nvkm_mmu *mmu, u64
 
 	vm->pgt  = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt));
 	if (!vm->pgt) {
+#ifdef __NetBSD__
+		linux_mutex_destroy(>mutex);
+#else
+		mutex_destroy(>mutex);
+#endif
 		kfree(vm);
 		return -ENOMEM;
 	}
@@ -444,6 +449,11 @@ nvkm_vm_create(struct nvkm_mmu *mmu, u64
 			   block >> 12);
 	if (ret) {
 		vfree(vm->pgt);
+#ifdef __NetBSD__
+		linux_mutex_destroy(>mutex);
+#else
+		mutex_destroy(>mutex);
+#endif
 		kfree(vm);
 		return ret;
 	}



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu

2018-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 04:38:22 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu:
nouveau_nvkm_subdev_mmu_base.c

Log Message:
Destroy mutex before freeing memory.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c

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



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

2018-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 04:35:03 UTC 2018

Removed Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph:
nouveau_engine_graph_ctxgk20a.c nouveau_engine_graph_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb:
nouveau_subdev_fb_gk20a.c nouveau_subdev_fb_ramgk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus:
nouveau_subdev_ibus_gk20a.c

Log Message:
Delete backported files that were renamed upstream.

Not sure how these didn't get nixed in the import.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_gk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxgk20a.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_gk20a.c
cvs rdiff -u -r1.5 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_gk20a.c

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



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

2018-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 04:35:03 UTC 2018

Removed Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph:
nouveau_engine_graph_ctxgk20a.c nouveau_engine_graph_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb:
nouveau_subdev_fb_gk20a.c nouveau_subdev_fb_ramgk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus:
nouveau_subdev_ibus_gk20a.c

Log Message:
Delete backported files that were renamed upstream.

Not sure how these didn't get nixed in the import.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_gk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxgk20a.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_gk20a.c
cvs rdiff -u -r1.5 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_gk20a.c

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 19:36:28 UTC 2018

Modified Files:
src/share/man/man4: adb.4 atppc.4 az.4 bktr.4

Log Message:
Use the An macro in the AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/adb.4
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/atppc.4
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/az.4
cvs rdiff -u -r1.18 -r1.19 src/share/man/man4/bktr.4

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

Modified files:

Index: src/share/man/man4/adb.4
diff -u src/share/man/man4/adb.4:1.3 src/share/man/man4/adb.4:1.4
--- src/share/man/man4/adb.4:1.3	Tue Aug  6 17:32:30 2013
+++ src/share/man/man4/adb.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: adb.4,v 1.3 2013/08/06 17:32:30 snj Exp $
+.\"	$NetBSD: adb.4,v 1.4 2018/08/31 19:36:28 sevan Exp $
 .\"
 .\" Copyright (c) 2003 Alex Zepeda 
 .\" Copyright (c) 1997 Colin Wood
@@ -30,7 +30,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 21, 2003
+.Dd August 31, 2018
 .Dt ADB 4
 .Os
 .Sh NAME
@@ -210,14 +210,17 @@ interface first appeared in
 .Nx 0.9 .
 It has been under development ever since.
 .Sh AUTHORS
-Bradley A. Grantham wrote the original
+.An -nosplit
+.An "Bradley A. Grantham"
+wrote the original
 .Nm
 driver, including the
 .Tn MRG
 support.
 The hardware direct interface was written by
-John P. Wittkowski.
-The PowerManager interface was written by Takashi Hamada.
+.An "John P. Wittkowski" .
+The PowerManager interface was written by
+.An "Takashi Hamada" .
 .Sh BUGS
 .Bl -bullet
 .It

Index: src/share/man/man4/atppc.4
diff -u src/share/man/man4/atppc.4:1.15 src/share/man/man4/atppc.4:1.16
--- src/share/man/man4/atppc.4:1.15	Sat Jan 31 21:28:45 2004
+++ src/share/man/man4/atppc.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: atppc.4,v 1.15 2004/01/31 21:28:45 wiz Exp $
+.\"	$NetBSD: atppc.4,v 1.16 2018/08/31 19:36:28 sevan Exp $
 .\"
 .\" Copyright (c) 1998, 1999, Nicolas Souchu
 .\" Copyright (c) 2003, 2004 Gary Thorpe 
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 30, 2004
+.Dd August 31, 2018
 .Dt ATPPC 4
 .Os
 .Sh NAME
@@ -103,7 +103,8 @@ This manual page is based on the
 manual page.
 The information has been updated for the
 .Nx
-port by Gary Thorpe.
+port by
+.An "Gary Thorpe" .
 .Sh BUGS
 The
 .Fx

Index: src/share/man/man4/az.4
diff -u src/share/man/man4/az.4:1.6 src/share/man/man4/az.4:1.7
--- src/share/man/man4/az.4:1.6	Sat Mar 20 04:52:59 2004
+++ src/share/man/man4/az.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: az.4,v 1.6 2004/03/20 04:52:59 snj Exp $
+.\"	$NetBSD: az.4,v 1.7 2018/08/31 19:36:28 sevan Exp $
 .\"	$RuOBSD: az.4,v 1.3 2001/10/26 05:38:43 form Exp $
 .\"	$OpenBSD: az.4,v 1.1 2001/12/05 10:58:54 mickey Exp $
 .\"
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 8, 2001
+.Dd August 31, 2018
 .Dt AZ 4
 .Os
 .Sh NAME
@@ -61,10 +61,15 @@ device driver appeared in
 and
 .Nx 1.6 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
-driver was written by Vladimir Popov and Maxim Tsyplakov.
-The man page was written by Vladimir Popov.
+driver was written by
+.An "Vladimir Popov"
+and
+.An "Maxim Tsyplakov" .
+The man page was written by
+.An "Vladimir Popov" .
 .Sh BUGS
 It is impossible to determine to which frequency the card is tuned.
 Thus, the driver will report an internally stored value even if it is not

Index: src/share/man/man4/bktr.4
diff -u src/share/man/man4/bktr.4:1.18 src/share/man/man4/bktr.4:1.19
--- src/share/man/man4/bktr.4:1.18	Tue Aug 30 05:58:02 2011
+++ src/share/man/man4/bktr.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: bktr.4,v 1.18 2011/08/30 05:58:02 jruoho Exp $
+.\" $NetBSD: bktr.4,v 1.19 2018/08/31 19:36:28 sevan Exp $
 .\"
 .\" Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005 Thomas Klausner
 .\" 	All rights reserved.
@@ -481,11 +481,19 @@ driver appeared in
 and
 .Nx 1.5 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
-driver was originally written by Amancio Hasty for
+driver was originally written by
+.An "Amancio Hasty"
+for
 .Fx
-and is now maintained by Roger Hardiman.
+and is now maintained by
+.An "Roger Hardiman" .
 .Nx
-porting was done by Bernd Ernesti, Berndt Josef Wulf, Matthias
-Scheler, and Thomas Klausner.
+porting was done by
+.An "Bernd Ernesti" ,
+.An "Berndt Josef Wulf" ,
+.An "Matthias Scheler" ,
+and
+.An "Thomas Klausner" .



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 19:36:28 UTC 2018

Modified Files:
src/share/man/man4: adb.4 atppc.4 az.4 bktr.4

Log Message:
Use the An macro in the AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/adb.4
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/atppc.4
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/az.4
cvs rdiff -u -r1.18 -r1.19 src/share/man/man4/bktr.4

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 19:34:44 UTC 2018

Modified Files:
src/share/man/man4: acpicpu.4

Log Message:
Pp before Bl


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/share/man/man4/acpicpu.4

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

Modified files:

Index: src/share/man/man4/acpicpu.4
diff -u src/share/man/man4/acpicpu.4:1.34 src/share/man/man4/acpicpu.4:1.35
--- src/share/man/man4/acpicpu.4:1.34	Tue Aug  9 07:18:54 2011
+++ src/share/man/man4/acpicpu.4	Fri Aug 31 19:34:44 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpicpu.4,v 1.34 2011/08/09 07:18:54 jruoho Exp $
+.\" $NetBSD: acpicpu.4,v 1.35 2018/08/31 19:34:44 sevan Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 6, 2011
+.Dd August 31, 2018
 .Dt ACPICPU 4
 .Os
 .Sh NAME
@@ -69,7 +69,6 @@ The following C-states are typically ava
 Additional processor or vendor specific
 states (C4, ..., Cn) are handled internally by
 .Nm .
-.Pp
 .Bl -tag -width C1 -offset indent
 .It Dv C0
 This is the normal state of a processor; the



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 19:34:44 UTC 2018

Modified Files:
src/share/man/man4: acpicpu.4

Log Message:
Pp before Bl


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/share/man/man4/acpicpu.4

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



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:23:54 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
fix comment - dynamically allocated yes, per-drive not


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4.2.1 src/sys/dev/ata/TODO.ncq:1.4.2.2
--- src/sys/dev/ata/TODO.ncq:1.4.2.1	Fri Aug 31 19:15:04 2018
+++ src/sys/dev/ata/TODO.ncq	Fri Aug 31 19:23:54 2018
@@ -1,5 +1,5 @@
 jdolecek-ncqfixes goals:
-- make ata_xfer dynamically allocated per-drive using a pool
+- make ata_xfer dynamically allocated using a pool
   - fixes: queue is allocated regardless if there are any drives, fix? 
 - remove limit of queued ata_xfers, allow any number of pending xfers;
   this should fix kern/52614 AKA wdc-attached ATAPI cd(4)



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:23:54 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
fix comment - dynamically allocated yes, per-drive not


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/ata/TODO.ncq

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



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:15:04 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
list goals for the jdolecek-ncqfixes branch


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4 src/sys/dev/ata/TODO.ncq:1.4.2.1
--- src/sys/dev/ata/TODO.ncq:1.4	Fri Aug 31 18:44:04 2018
+++ src/sys/dev/ata/TODO.ncq	Fri Aug 31 19:15:04 2018
@@ -1,3 +1,16 @@
+jdolecek-ncqfixes goals:
+- make ata_xfer dynamically allocated per-drive using a pool
+  - fixes: queue is allocated regardless if there are any drives, fix? 
+- remove limit of queued ata_xfers, allow any number of pending xfers;
+  this should fix kern/52614 AKA wdc-attached ATAPI cd(4)
+- remove the wd(4) flush condition, just allocate a dynamic ata_xfer
+- change wd(4) dump code to use on-stack ata_xfer to not rely on pool having
+  memory
+- re-fix QEMU ahci(4) bug workaround (no READ LOG EXT support) - now it
+  triggers KASSERT()
+- fix ahci(4) error handling under paralles - invalid bio via WD_CHAOS_MONKEY
+  ends up being handled as NOERROR, triggering KASSERT() in wd(4)
+
 Bugs
 
 test wd* at umass?, confirm the ata_channel kludge works
@@ -15,8 +28,6 @@ xfers for several different drives
 maybe do device error handling in not-interrupt-context (maybe this should be
 done on a mpata branch?)
 
-queue is allocated regardless if there are any drives, fix? 
-
 dump to unopened disk fails (e.g. dump do wd1b when wd1a not mounted), due
 to the open path executing ata_get_params(), which eventually tsleeps()
 while waiting for the command to finish; specifically, if WDF_LOADED is not



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:15:04 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
list goals for the jdolecek-ncqfixes branch


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/ata/TODO.ncq

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



CVS commit: [jdolecek-ncqfixes] src/sys/dev

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:08:03 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c ata_subr.c ata_wdc.c
atavar.h wd.c wdvar.h
src/sys/dev/ic [jdolecek-ncqfixes]: ahcisata_core.c mvsata.c siisata.c
wdc.c
src/sys/dev/scsipi [jdolecek-ncqfixes]: atapi_wdc.c

Log Message:
refactor ata_xfer to be just dumb structure; move all callouts/condvars out

retry callout to wd(4); reset callout and the active/cmd finish condvars
to channel queue; change code using the condvars so it works if there
are multiple waiters

simplify the async wait code for cmds, replace ata_wait_xfer()/ata_wake_xfer()
with ata_wait_cmd()

fix the callout_invoking/ack race handling code for timeouts to
actually have chance to work; change mvsata(4) to use generic timeout func

towards resolution of kern/52614


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.141.6.1 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/ata/ata_subr.c
cvs rdiff -u -r1.110 -r1.110.4.1 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.99 -r1.99.2.1 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.441 -r1.441.2.1 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.46 -r1.46.6.1 src/sys/dev/ata/wdvar.h
cvs rdiff -u -r1.62 -r1.62.2.1 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.288 -r1.288.6.1 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.129 -r1.129.6.1 src/sys/dev/scsipi/atapi_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/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141 src/sys/dev/ata/ata.c:1.141.6.1
--- src/sys/dev/ata/ata.c:1.141	Sat Oct 28 04:53:54 2017
+++ src/sys/dev/ata/ata.c	Fri Aug 31 19:08:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141 2017/10/28 04:53:54 riastradh Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.1 2018/08/31 19:08:03 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141 2017/10/28 04:53:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.1 2018/08/31 19:08:03 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -1075,19 +1075,19 @@ ata_exec_xfer(struct ata_channel *chp, s
 		while (chp->ch_queue->queue_active > 0 ||
 		TAILQ_FIRST(>ch_queue->queue_xfer) != xfer) {
 			xfer->c_flags |= C_WAITACT;
-			cv_wait(>c_active, >ch_lock);
+			cv_wait(>ch_queue->c_active, >ch_lock);
 			xfer->c_flags &= ~C_WAITACT;
+		}
 
-			/*
-			 * Free xfer now if it there was attempt to free it
-			 * while we were waiting.
-			 */
-			if ((xfer->c_flags & (C_FREE|C_WAITTIMO)) == C_FREE) {
-ata_channel_unlock(chp);
+		/*
+		 * Free xfer now if it there was attempt to free it
+		 * while we were waiting.
+		 */
+		if ((xfer->c_flags & (C_FREE|C_WAITTIMO)) == C_FREE) {
+			ata_channel_unlock(chp);
 
-ata_free_xfer(chp, xfer);
-return;
-			}
+			ata_free_xfer(chp, xfer);
+			return;
 		}
 	}
 
@@ -1187,7 +1187,7 @@ again:
 		ATADEBUG_PRINT(("atastart: xfer %p channel %d drive %d "
 		"wait active\n", xfer, chp->ch_channel, xfer->c_drive),
 		DEBUG_XFERS);
-		cv_signal(>c_active);
+		cv_broadcast(>ch_queue->c_active);
 		goto out;
 	}
 
@@ -1300,15 +1300,20 @@ ata_deactivate_xfer(struct ata_channel *
 	KASSERT(chq->queue_active > 0);
 	KASSERT((chq->active_xfers_used & __BIT(xfer->c_slot)) != 0);
 
-	callout_stop(>c_timo_callout);
+	/* Stop only when this is last active xfer */
+	if (chq->queue_active == 1)
+		callout_stop(>c_timo_callout);
 
-	if (callout_invoking(>c_timo_callout))
+	if (callout_invoking(>c_timo_callout))
 		xfer->c_flags |= C_WAITTIMO;
 
 	TAILQ_REMOVE(>active_xfers, xfer, c_activechain);
 	chq->active_xfers_used &= ~__BIT(xfer->c_slot);
 	chq->queue_active--;
 
+	if (xfer->c_flags & C_WAIT)
+		cv_broadcast(>c_cmd_finish);
+
 	ata_channel_unlock(chp);
 }
 
@@ -1356,8 +1361,6 @@ ata_timo_xfer_check(struct ata_xfer *xfe
 
 	ata_channel_lock(chp);
 
-	callout_ack(>c_timo_callout);
-
 	if (xfer->c_flags & C_WAITTIMO) {
 		xfer->c_flags &= ~C_WAITTIMO;
 
@@ -1389,30 +1392,6 @@ ata_timo_xfer_check(struct ata_xfer *xfe
 	return false;
 }
 
-void
-ata_timeout(void *v)
-{
-	struct ata_xfer *xfer = v;
-	int s;
-
-	ATADEBUG_PRINT(("%s: slot %d\n", __func__, xfer->c_slot),
-	DEBUG_FUNCS|DEBUG_XFERS);
-
-	s = splbio();/* XXX MPSAFE */
-
-	if (ata_timo_xfer_check(xfer)) {
-		/* Already logged */
-		goto out;
-	}
-
-	/* Mark as timed out. Do not print anything, wd(4) will. */
-	xfer->c_flags |= C_TIMEOU;
-	xfer->c_intr(xfer->c_chp, xfer, 0);
-
-out:
-	splx(s);
-}
-
 /*
  * Kill off all active xfers for a ata_channel.
  *
@@ -2304,17 +2283,17 @@ atacmd_toncq(struct ata_xfer *xfer, uint
 }
 
 void
-ata_wait_xfer(struct ata_channel *chp, struct ata_xfer *xfer)
+ata_wait_cmd(struct ata_channel *chp, 

CVS commit: [jdolecek-ncqfixes] src/sys/dev

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:08:03 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c ata_subr.c ata_wdc.c
atavar.h wd.c wdvar.h
src/sys/dev/ic [jdolecek-ncqfixes]: ahcisata_core.c mvsata.c siisata.c
wdc.c
src/sys/dev/scsipi [jdolecek-ncqfixes]: atapi_wdc.c

Log Message:
refactor ata_xfer to be just dumb structure; move all callouts/condvars out

retry callout to wd(4); reset callout and the active/cmd finish condvars
to channel queue; change code using the condvars so it works if there
are multiple waiters

simplify the async wait code for cmds, replace ata_wait_xfer()/ata_wake_xfer()
with ata_wait_cmd()

fix the callout_invoking/ack race handling code for timeouts to
actually have chance to work; change mvsata(4) to use generic timeout func

towards resolution of kern/52614


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.141.6.1 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/ata/ata_subr.c
cvs rdiff -u -r1.110 -r1.110.4.1 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.99 -r1.99.2.1 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.441 -r1.441.2.1 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.46 -r1.46.6.1 src/sys/dev/ata/wdvar.h
cvs rdiff -u -r1.62 -r1.62.2.1 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.288 -r1.288.6.1 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.129 -r1.129.6.1 src/sys/dev/scsipi/atapi_wdc.c

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



CVS commit: src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 18:44:04 UTC 2018

Modified Files:
src/sys/dev/ata: TODO.ncq

Log Message:
one less


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.3 src/sys/dev/ata/TODO.ncq:1.4
--- src/sys/dev/ata/TODO.ncq:1.3	Wed Nov  1 21:27:22 2017
+++ src/sys/dev/ata/TODO.ncq	Fri Aug 31 18:44:04 2018
@@ -32,8 +32,7 @@ implement DIOCGCACHE/DIOCCACHESYNC for l
 
 MSI/MSI-X support for AHCI and mvsata(4)
 
-mvsata - constify mvsata_pci_products and move pci-specific code to
-the pci attach code
+mvsata - move pci-specific code to the pci attach code
 
 mvsata(4) 64-bit DMA
 - at least with AHA1430SA does not really work, crash in mvsata_intr() on boot



CVS commit: src/sys/dev

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 18:43:30 UTC 2018

Modified Files:
src/sys/dev/ic: mvsata.c mvsatavar.h
src/sys/dev/pci: mvsata_pci.c

Log Message:
constify mvsata_pci_products[]


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/mvsatavar.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mvsata_pci.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/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.40 src/sys/dev/ic/mvsata.c:1.41
--- src/sys/dev/ic/mvsata.c:1.40	Sun Apr  8 11:57:43 2018
+++ src/sys/dev/ic/mvsata.c	Fri Aug 31 18:43:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.40 2018/04/08 11:57:43 mlelstv Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.41 2018/08/31 18:43:29 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.40 2018/04/08 11:57:43 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.41 2018/08/31 18:43:29 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -255,7 +255,7 @@ mvsata_pmp_select(struct mvsata_port *mv
 }
 
 int
-mvsata_attach(struct mvsata_softc *sc, struct mvsata_product *product,
+mvsata_attach(struct mvsata_softc *sc, const struct mvsata_product *product,
 	  int (*mvsata_sreset)(struct mvsata_softc *),
 	  int (*mvsata_misc_reset)(struct mvsata_softc *),
 	  int read_pre_amps)

Index: src/sys/dev/ic/mvsatavar.h
diff -u src/sys/dev/ic/mvsatavar.h:1.3 src/sys/dev/ic/mvsatavar.h:1.4
--- src/sys/dev/ic/mvsatavar.h:1.3	Sat Oct  7 16:05:32 2017
+++ src/sys/dev/ic/mvsatavar.h	Fri Aug 31 18:43:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsatavar.h,v 1.3 2017/10/07 16:05:32 jdolecek Exp $	*/
+/*	$NetBSD: mvsatavar.h,v 1.4 2018/08/31 18:43:29 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -142,7 +142,7 @@ struct mvsata_softc {
 	void (*sc_enable_intr)(struct mvsata_port *, int);
 };
 
-int mvsata_attach(struct mvsata_softc *, struct mvsata_product *,
+int mvsata_attach(struct mvsata_softc *, const struct mvsata_product *,
 		  int (*mvsata_sreset)(struct mvsata_softc *),
 		  int (*mvsata_misc_reset)(struct mvsata_softc *), int);
 int mvsata_intr(struct mvsata_hc *);

Index: src/sys/dev/pci/mvsata_pci.c
diff -u src/sys/dev/pci/mvsata_pci.c:1.9 src/sys/dev/pci/mvsata_pci.c:1.10
--- src/sys/dev/pci/mvsata_pci.c:1.9	Wed Jun 21 22:48:05 2017
+++ src/sys/dev/pci/mvsata_pci.c	Fri Aug 31 18:43:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata_pci.c,v 1.9 2017/06/21 22:48:05 jdolecek Exp $	*/
+/*	$NetBSD: mvsata_pci.c,v 1.10 2018/08/31 18:43:29 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata_pci.c,v 1.9 2017/06/21 22:48:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata_pci.c,v 1.10 2018/08/31 18:43:29 jdolecek Exp $");
 
 #include 
 #include 
@@ -108,7 +108,7 @@ static void mvsata_pci_enable_intr(struc
 CFATTACH_DECL_NEW(mvsata_pci, sizeof(struct mvsata_pci_softc),
 mvsata_pci_match, mvsata_pci_attach, mvsata_pci_detach, NULL);
 
-struct mvsata_product mvsata_pci_products[] = {
+static const struct mvsata_product mvsata_pci_products[] = {
 #define PCI_VP(v, p)	PCI_VENDOR_ ## v, PCI_PRODUCT_ ## v ## _ ## p
 	{ PCI_VP(MARVELL, 88SX5040),		1, 4, gen1, 0 },
 	{ PCI_VP(MARVELL, 88SX5041),		1, 4, gen1, 0 },



CVS commit: src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 18:44:04 UTC 2018

Modified Files:
src/sys/dev/ata: TODO.ncq

Log Message:
one less


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ata/TODO.ncq

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



CVS commit: src/sys/dev

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 18:43:30 UTC 2018

Modified Files:
src/sys/dev/ic: mvsata.c mvsatavar.h
src/sys/dev/pci: mvsata_pci.c

Log Message:
constify mvsata_pci_products[]


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/mvsatavar.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mvsata_pci.c

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:27:47 UTC 2018

Modified Files:
src/share/man/man4: acphy.4

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/acphy.4

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

Modified files:

Index: src/share/man/man4/acphy.4
diff -u src/share/man/man4/acphy.4:1.3 src/share/man/man4/acphy.4:1.4
--- src/share/man/man4/acphy.4:1.3	Fri Jan 17 06:23:53 2003
+++ src/share/man/man4/acphy.4	Fri Aug 31 18:27:47 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: acphy.4,v 1.3 2003/01/17 06:23:53 gendalia Exp $
+.\"	$NetBSD: acphy.4,v 1.4 2018/08/31 18:27:47 sevan Exp $
 .\"
 .\" Copyright 2001 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 24, 2001
+.Dd August 31, 2018
 .Dt ACPHY 4
 .Os
 .Sh NAME
@@ -45,9 +45,9 @@
 The
 .Nm
 driver supports the Altima AC101, AC101L and AMD Am79c874 NetPHY-1LP
-10/100 Ethernet PHYs.  These PHYs are often found on low-power
-Ethernet interfaces, such as MiniPCI interfaces found in
-laptops and embedded systems.
+10/100 Ethernet PHYs.
+These PHYs are often found on low-power Ethernet interfaces, such as MiniPCI
+interfaces found in laptops and embedded systems.
 .Pp
 The AMD 79c874 is a work-alike (most likely an OEM of the core) of the
 Altima part.



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:27:47 UTC 2018

Modified Files:
src/share/man/man4: acphy.4

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/acphy.4

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:20:10 UTC 2018

Modified Files:
src/share/man/man4: cgd.4

Log Message:
Apply Tn macro to XTS


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/share/man/man4/cgd.4

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:20:10 UTC 2018

Modified Files:
src/share/man/man4: cgd.4

Log Message:
Apply Tn macro to XTS


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/share/man/man4/cgd.4

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

Modified files:

Index: src/share/man/man4/cgd.4
diff -u src/share/man/man4/cgd.4:1.21 src/share/man/man4/cgd.4:1.22
--- src/share/man/man4/cgd.4:1.21	Mon Dec 12 10:13:00 2016
+++ src/share/man/man4/cgd.4	Fri Aug 31 18:20:10 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: cgd.4,v 1.21 2016/12/12 10:13:00 wiz Exp $
+.\" $NetBSD: cgd.4,v 1.22 2018/08/31 18:20:10 sevan Exp $
 .\"
 .\" Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 11, 2016
+.Dd August 31, 2018
 .Dt CGD 4
 .Os
 .Sh NAME
@@ -189,8 +189,8 @@ possible to change every second block on
 .Tn CBC
 mode to plaintext blocks of their choice.
 The
-.Tn
-XTS mode isn't vulnerable to this particular attack but a lack of
+.Tn XTS
+mode isn't vulnerable to this particular attack but a lack of
 integrity should be taken into account when evaluating security risks.
 .Sh FILES
 .Bl -tag -width indentxxx



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

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:11:20 UTC 2018

Modified Files:
src/sys/arch/macppc/conf: INSTALL

Log Message:
Enable USB 2.0 support so installs go a little faster on systems which support
it.
Include support for USB Ethernet adapters and relevant PHY as a fallback if
onboard Ethernet port is unavailable for some reason.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/macppc/conf/INSTALL

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



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

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:11:20 UTC 2018

Modified Files:
src/sys/arch/macppc/conf: INSTALL

Log Message:
Enable USB 2.0 support so installs go a little faster on systems which support
it.
Include support for USB Ethernet adapters and relevant PHY as a fallback if
onboard Ethernet port is unavailable for some reason.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/macppc/conf/INSTALL

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/macppc/conf/INSTALL
diff -u src/sys/arch/macppc/conf/INSTALL:1.127 src/sys/arch/macppc/conf/INSTALL:1.128
--- src/sys/arch/macppc/conf/INSTALL:1.127	Fri May 11 22:51:33 2018
+++ src/sys/arch/macppc/conf/INSTALL	Fri Aug 31 18:11:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.127 2018/05/11 22:51:33 macallan Exp $
+#	$NetBSD: INSTALL,v 1.128 2018/08/31 18:11:20 sevan Exp $
 #
 # config file for INSTALL FLOPPY
 #
@@ -95,6 +95,7 @@ siop*	at pci? dev ? function ?	# NCR 53c
 #ofb*	at pci? dev ? function ?	# Generic Open Firmware Framebuffer
 genfb*	at pci? dev ? function ?
 cbb*	at pci? dev ? function ?	# PCI-CardBus bridge
+ehci* 	at pci?	dev ? function ?	# Enhanced Host Controller
 ohci*	at pci? dev ? function ?	# Open Host Controller
 pciide* at pci? dev ? function ? flags 0x	# GENERIC pciide driver
 acardide* at pci? dev ? function ?	# Acard IDE controllers
@@ -130,6 +131,7 @@ rlphy*	at mii? phy ?			# Realtek 8139/82
 sqphy*	at mii? phy ?			# Seeq 80220/80221/80223 PHYs
 tqphy*	at mii? phy ?			# TDK Semiconductor PHYs
 ukphy*	at mii? phy ?			# generic unknown PHYs
+urlphy* at mii? phy ?			# Realtek RTL8150L internal PHYs
 
 cardslot* at cbb?
 cardbus* at cardslot?
@@ -180,6 +182,7 @@ atapibus* at atapi?
 cd*	at atapibus? drive ? flags 0x	# ATAPI CD-ROM drives
 sd*	at atapibus? drive ? flags 0x	# ATAPI disk drives
 
+usb* 	at ehci?
 usb*	at ohci?
 uhub*	at usb?
 uhub*	at uhub? port ?
@@ -187,6 +190,16 @@ uhidev* 	at uhub? port ? configuration ?
 ukbd* 	at uhidev? reportid ?
 umass*	at uhub? port ? configuration ? interface ?	# USB Mass Storage
 
+# USB Ethernet adapters
+aue*	at uhub? port ?		# ADMtek AN986 Pegasus based adapters
+axe*	at uhub? port ?		# ASIX AX88172 based adapters
+axen*	at uhub? port ?		# ASIX AX88178a/AX88179 based adapters
+cdce*	at uhub? port ?		# CDC, Ethernet Networking Control Model
+cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
+kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
+url*	at uhub? port ?		# Realtek RTL8150L based adapters
+udav*	at uhub? port ?		# Davicom DM9601 based adapters
+
 pseudo-device	md			# memory disk
 #pseudo-device	fss			# file system snapshot device
 pseudo-device	loop			# network loopback



CVS commit: [netbsd-8] src/sys

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:51:15 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: agp_i810.c agp_i810var.h
src/sys/external/bsd/drm2/i915drm [netbsd-8]: intel_gtt.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #998):

sys/dev/pci/agp_i810var.h: revision 1.7
sys/external/bsd/drm2/i915drm/intel_gtt.c: revision 1.7
sys/dev/pci/agp_i810.c: revision 1.123

Restore gtt page table control register on resume.

Additional subroutine agp_i810_reset is used by i915drmkms to make
sure it happens early enough, since i915drmkms resumes before agp.

XXX pullup-7
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.122.10.1 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/dev/pci/agp_i810var.h
cvs rdiff -u -r1.5.10.1 -r1.5.10.2 \
src/sys/external/bsd/drm2/i915drm/intel_gtt.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.122 src/sys/dev/pci/agp_i810.c:1.122.10.1
--- src/sys/dev/pci/agp_i810.c:1.122	Sun May  1 04:22:50 2016
+++ src/sys/dev/pci/agp_i810.c	Fri Aug 31 17:51:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.122 2016/05/01 04:22:50 nonaka Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.122.10.1 2018/08/31 17:51:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.122 2016/05/01 04:22:50 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.122.10.1 2018/08/31 17:51:15 martin Exp $");
 
 #include 
 #include 
@@ -1490,17 +1490,24 @@ agp_i810_unbind_memory(struct agp_softc 
 	return 0;
 }
 
+void
+agp_i810_reset(struct agp_i810_softc *isc)
+{
+
+	/* Restore the page table control register.  */
+	bus_space_write_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL,
+	isc->pgtblctl);
+
+	agp_flush_cache();
+}
+
 static bool
 agp_i810_resume(device_t dv, const pmf_qual_t *qual)
 {
 	struct agp_softc *sc = device_private(dv);
 	struct agp_i810_softc *isc = sc->as_chipc;
 
-	/*
-	 * XXX Nothing uses this!  Save on suspend, restore on resume?
-	 */
-	isc->pgtblctl_resume_hack = READ4(AGP_I810_PGTBL_CTL);
-	agp_flush_cache();
+	agp_i810_reset(isc);
 
 	return true;
 }

Index: src/sys/dev/pci/agp_i810var.h
diff -u src/sys/dev/pci/agp_i810var.h:1.6 src/sys/dev/pci/agp_i810var.h:1.6.10.1
--- src/sys/dev/pci/agp_i810var.h:1.6	Fri Mar  6 22:03:06 2015
+++ src/sys/dev/pci/agp_i810var.h	Fri Aug 31 17:51:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810var.h,v 1.6 2015/03/06 22:03:06 riastradh Exp $	*/
+/*	$NetBSD: agp_i810var.h,v 1.6.10.1 2018/08/31 17:51:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -58,11 +58,8 @@ struct agp_i810_softc {
 	struct agp_gatt *gatt;		/* i810-only OS-allocated GTT */
 	uint32_t dcache_size;		/* i810-only on-chip memory size */
 
-	/* XXX Kludge to work around broken X servers.  */
+	/* Cached pgtblctl register for resume.  */
 	pcireg_t pgtblctl;
-
-	/* XXX Vestige of unfinished powerhook?  */
-	uint32_t pgtblctl_resume_hack;
 };
 
 extern struct agp_softc	*agp_i810_sc;
@@ -75,3 +72,4 @@ int	agp_i810_write_gtt_entry(struct agp_
 	int);
 void	agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t);
 void	agp_i810_chipset_flush(struct agp_i810_softc *);
+void	agp_i810_reset(struct agp_i810_softc *);

Index: src/sys/external/bsd/drm2/i915drm/intel_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.1 src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.2
--- src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.1	Fri Aug 31 17:43:03 2018
+++ src/sys/external/bsd/drm2/i915drm/intel_gtt.c	Fri Aug 31 17:51:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $	*/
+/*	$NetBSD: intel_gtt.c,v 1.5.10.2 2018/08/31 17:51:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5.10.2 2018/08/31 17:51:15 martin Exp $");
 
 #include 
 #include 
@@ -125,8 +125,14 @@ intel_gmch_remove(void)
 bool
 intel_enable_gtt(void)
 {
+	struct agp_softc *sc = agp_i810_sc;
+	struct agp_i810_softc *isc;
 
-	return (agp_i810_sc != NULL);
+	if (sc == NULL)
+		return false;
+	isc = sc->as_chipc;
+	agp_i810_reset(isc);
+	return true;
 }
 
 void



CVS commit: [netbsd-8] src/sys

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:51:15 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: agp_i810.c agp_i810var.h
src/sys/external/bsd/drm2/i915drm [netbsd-8]: intel_gtt.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #998):

sys/dev/pci/agp_i810var.h: revision 1.7
sys/external/bsd/drm2/i915drm/intel_gtt.c: revision 1.7
sys/dev/pci/agp_i810.c: revision 1.123

Restore gtt page table control register on resume.

Additional subroutine agp_i810_reset is used by i915drmkms to make
sure it happens early enough, since i915drmkms resumes before agp.

XXX pullup-7
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.122.10.1 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/dev/pci/agp_i810var.h
cvs rdiff -u -r1.5.10.1 -r1.5.10.2 \
src/sys/external/bsd/drm2/i915drm/intel_gtt.c

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



CVS commit: [netbsd-8] src/sys/external/bsd

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:43:03 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux [netbsd-8]: kernel.h
src/sys/external/bsd/drm2/i915drm [netbsd-8]: intel_gtt.c
src/sys/external/bsd/drm2/include/linux [netbsd-8]: bitops.h delay.h
vmalloc.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #997):

sys/external/bsd/drm2/i915drm/intel_gtt.c: revision 1.6
sys/external/bsd/drm2/include/linux/delay.h: revision 1.5
sys/external/bsd/common/include/linux/kernel.h: revision 1.9
sys/external/bsd/drm2/include/linux/vmalloc.h: revision 1.5
sys/external/bsd/drm2/include/linux/bitops.h: revision 1.12
sys/external/bsd/drm2/include/linux/bitops.h: revision 1.13

hweight32 should take uint32_t, not uint16_t.  OOPS.
XXX pullup

Fix find_first_zero_bit to find the high bits of 64-bit words...oops.
XXX pullup

Use uvm_km_alloc(kernel_map) and pmap_kenter, not uvm_pagermapin.
XXX pullup

Flush chipset writes after GGTT update.

Echoes Linux commit:

commit 8516673a996870ea0ceb337ee4f83c33c5ec3111
Author: Chris Wilson 
Date:   Fri Dec 8 21:46:16 2017 +
agp/intel: Flush all chipset writes after updating the GGTT
Before accessing the GGTT we must flush the PTE writes and make them
visible to the chipset, or else the indirect access may end up in the
wrong page. In commit 3497971a71d8 ("agp/intel: Flush chipset writes
after updating a single PTE"), we noticed corruption of the uploads for
pwrite and for capturing GPU error states, but it was presumed that the
explicit calls to intel_gtt_chipset_flush() were sufficient for the
execbuffer path. However, we have not been flushing the chipset between
the PTE writes and access via the GTT itself.
For simplicity, do the flush after any PTE update rather than try and
batch the flushes on a just-in-time basis.
References: 3497971a71d8 ("agp/intel: Flush chipset writes after updating a 
single PTE")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc: Mika Kuoppala 
Cc: drm-intel-fixes%lists.freedesktop.org@localhost
Reviewed-by: Joonas Lahtinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20171208214616.30147-1-chris%chris-wilson.co.uk@localhost

XXX pullup

Round nsec up for usec delay.
XXX pullup

libkern min/max is 32-bit.  Linux min/max is generic.  @!*#@!$&
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.10.1 \
src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/external/bsd/drm2/i915drm/intel_gtt.c
cvs rdiff -u -r1.11 -r1.11.10.1 \
src/sys/external/bsd/drm2/include/linux/bitops.h
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/external/bsd/drm2/include/linux/delay.h
cvs rdiff -u -r1.4 -r1.4.12.1 \
src/sys/external/bsd/drm2/include/linux/vmalloc.h

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

Modified files:

Index: src/sys/external/bsd/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.8 src/sys/external/bsd/common/include/linux/kernel.h:1.8.10.1
--- src/sys/external/bsd/common/include/linux/kernel.h:1.8	Thu Aug 20 21:41:12 2015
+++ src/sys/external/bsd/common/include/linux/kernel.h	Fri Aug 31 17:43:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.8 2015/08/20 21:41:12 skrll Exp $	*/
+/*	$NetBSD: kernel.h,v 1.8.10.1 2018/08/31 17:43:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -59,6 +59,9 @@
 #define	uninitialized_var(x)	x = 0
 
 /* XXX These will multiply evaluate their arguments.  */
+#define	min(X, Y)	MIN(X, Y)
+#define	max(X, Y)	MAX(X, Y)
+
 #define	max_t(T, X, Y)	MAX(X, Y)
 #define	min_t(T, X, Y)	MIN(X, Y)
 

Index: src/sys/external/bsd/drm2/i915drm/intel_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5 src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.1
--- src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5	Fri Mar  6 22:03:06 2015
+++ src/sys/external/bsd/drm2/i915drm/intel_gtt.c	Fri Aug 31 17:43:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_gtt.c,v 1.5 2015/03/06 22:03:06 riastradh Exp $	*/
+/*	$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5 2015/03/06 22:03:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $");
 
 #include 
 #include 
@@ -176,6 +176,7 @@ intel_gtt_insert_entries(bus_dmamap_t dm
 		va += PAGE_SIZE;
 	}
 	agp_i810_post_gtt_entry(isc, (va - PAGE_SIZE));
+	intel_gtt_chipset_flush();
 }
 
 void

Index: src/sys/external/bsd/drm2/include/linux/bitops.h
diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.11 

CVS commit: [netbsd-8] src/sys/external/bsd

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:43:03 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux [netbsd-8]: kernel.h
src/sys/external/bsd/drm2/i915drm [netbsd-8]: intel_gtt.c
src/sys/external/bsd/drm2/include/linux [netbsd-8]: bitops.h delay.h
vmalloc.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #997):

sys/external/bsd/drm2/i915drm/intel_gtt.c: revision 1.6
sys/external/bsd/drm2/include/linux/delay.h: revision 1.5
sys/external/bsd/common/include/linux/kernel.h: revision 1.9
sys/external/bsd/drm2/include/linux/vmalloc.h: revision 1.5
sys/external/bsd/drm2/include/linux/bitops.h: revision 1.12
sys/external/bsd/drm2/include/linux/bitops.h: revision 1.13

hweight32 should take uint32_t, not uint16_t.  OOPS.
XXX pullup

Fix find_first_zero_bit to find the high bits of 64-bit words...oops.
XXX pullup

Use uvm_km_alloc(kernel_map) and pmap_kenter, not uvm_pagermapin.
XXX pullup

Flush chipset writes after GGTT update.

Echoes Linux commit:

commit 8516673a996870ea0ceb337ee4f83c33c5ec3111
Author: Chris Wilson 
Date:   Fri Dec 8 21:46:16 2017 +
agp/intel: Flush all chipset writes after updating the GGTT
Before accessing the GGTT we must flush the PTE writes and make them
visible to the chipset, or else the indirect access may end up in the
wrong page. In commit 3497971a71d8 ("agp/intel: Flush chipset writes
after updating a single PTE"), we noticed corruption of the uploads for
pwrite and for capturing GPU error states, but it was presumed that the
explicit calls to intel_gtt_chipset_flush() were sufficient for the
execbuffer path. However, we have not been flushing the chipset between
the PTE writes and access via the GTT itself.
For simplicity, do the flush after any PTE update rather than try and
batch the flushes on a just-in-time basis.
References: 3497971a71d8 ("agp/intel: Flush chipset writes after updating a 
single PTE")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc: Mika Kuoppala 
Cc: drm-intel-fixes%lists.freedesktop.org@localhost
Reviewed-by: Joonas Lahtinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20171208214616.30147-1-chris%chris-wilson.co.uk@localhost

XXX pullup

Round nsec up for usec delay.
XXX pullup

libkern min/max is 32-bit.  Linux min/max is generic.  @!*#@!$&
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.10.1 \
src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/external/bsd/drm2/i915drm/intel_gtt.c
cvs rdiff -u -r1.11 -r1.11.10.1 \
src/sys/external/bsd/drm2/include/linux/bitops.h
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/external/bsd/drm2/include/linux/delay.h
cvs rdiff -u -r1.4 -r1.4.12.1 \
src/sys/external/bsd/drm2/include/linux/vmalloc.h

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



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/dist/drm/nouveau

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:35:51 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau [netbsd-8]: nouveau_fence.c
nouveau_fence.h nouveau_nv84_fence.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #996):

sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c: revision 
1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.8
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.9

Rewrite nouveau_fence in an attempt to make it make sense.
PR kern/53441
XXX pullup-7
XXX pullup-8

Fences may last longer than their channels.
- Use a reference count on the nouveau_fence_chan object.
- Acquire it with kpreemption disabled.
- Use xcall to wait for kpreempt-disabled sections to complete.
PR kern/53441
XXX pullup-7
XXX pullup-8

Defer nouveau_fence_unref until spin unlock.
- kfree while holding a spin lock is not a good idea.
- Make sure we GC every time we might signal fences.
PR kern/53441
XXX pullup-7
XXX pullup-8

Attempt to make sense of return values of nouveau_fence_wait.
PR kern/53441
XXX pullup-7
XXX pullup-8

Fix edge case of reference counting, oops.
PR kern/53441
XXX pullup-7
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
cvs rdiff -u -r1.2 -r1.2.24.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h
cvs rdiff -u -r1.2 -r1.2.10.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c

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



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/dist/drm/nouveau

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:35:51 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau [netbsd-8]: nouveau_fence.c
nouveau_fence.h nouveau_nv84_fence.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #996):

sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c: revision 
1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.8
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.9

Rewrite nouveau_fence in an attempt to make it make sense.
PR kern/53441
XXX pullup-7
XXX pullup-8

Fences may last longer than their channels.
- Use a reference count on the nouveau_fence_chan object.
- Acquire it with kpreemption disabled.
- Use xcall to wait for kpreempt-disabled sections to complete.
PR kern/53441
XXX pullup-7
XXX pullup-8

Defer nouveau_fence_unref until spin unlock.
- kfree while holding a spin lock is not a good idea.
- Make sure we GC every time we might signal fences.
PR kern/53441
XXX pullup-7
XXX pullup-8

Attempt to make sense of return values of nouveau_fence_wait.
PR kern/53441
XXX pullup-7
XXX pullup-8

Fix edge case of reference counting, oops.
PR kern/53441
XXX pullup-7
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
cvs rdiff -u -r1.2 -r1.2.24.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h
cvs rdiff -u -r1.2 -r1.2.10.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.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/nouveau/nouveau_fence.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.4.10.1
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.4	Wed Apr 13 07:57:15 2016
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c	Fri Aug 31 17:35:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_fence.c,v 1.4 2016/04/13 07:57:15 riastradh Exp $	*/
+/*	$NetBSD: nouveau_fence.c,v 1.4.10.1 2018/08/31 17:35:51 martin Exp $	*/
 
 /*
  * Copyright (C) 2007 Ben Skeggs.
@@ -27,7 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.4 2016/04/13 07:57:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.4.10.1 2018/08/31 17:35:51 martin Exp $");
+
+#include 
+#include 
 
 #include 
 
@@ -41,6 +44,12 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_fenc
 
 #include 
 
+/*
+ * struct fence_work
+ *
+ *	State for a work action scheduled when a fence is completed.
+ *	Will call func(data) at some point after that happens.
+ */
 struct fence_work {
 	struct work_struct base;
 	struct list_head head;
@@ -48,101 +57,291 @@ struct fence_work {
 	void *data;
 };
 
+/*
+ * nouveau_fence_channel_acquire(fence)
+ *
+ *	Try to return the channel associated with fence.
+ */
+static struct nouveau_channel *
+nouveau_fence_channel_acquire(struct nouveau_fence *fence)
+{
+	struct nouveau_channel *chan;
+	struct nouveau_fence_chan *fctx;
+
+	/*
+	 * Block cross-calls while we examine fence.  If we observe
+	 * that fence->done is false, then the channel cannot be
+	 * destroyed even by another CPU until after kpreempt_enable.
+	 */
+	kpreempt_disable();
+	if (fence->done) {
+		chan = NULL;
+	} else {
+		chan = fence->channel;
+		fctx = chan->fence;
+		atomic_inc_uint(>refcnt);
+	}
+	kpreempt_enable();
+
+	return chan;
+}
+
+/*
+ * nouveau_fence_gc_grab(fctx, list)
+ *
+ *	Move all of channel's done fences to list.
+ *
+ *	Caller must hold channel's fence lock.
+ */
+static void
+nouveau_fence_gc_grab(struct nouveau_fence_chan *fctx, struct list_head *list)
+{
+	struct list_head *node, *next;
+
+	BUG_ON(!spin_is_locked(>lock));
+
+	list_for_each_safe(node, next, >done) {
+		list_move_tail(node, list);
+	}
+}
+
+/*
+ * nouveau_fence_gc_free(list)
+ *
+ *	Unreference all of the fences in the list.
+ *
+ *	Caller MUST NOT hold the fences' channel's fence lock.
+ */
+static void
+nouveau_fence_gc_free(struct list_head *list)
+{
+	struct nouveau_fence *fence, *next;
+
+	list_for_each_entry_safe(fence, next, list, head) {
+		list_del(>head);
+		nouveau_fence_unref();
+	}
+}
+
+/*
+ * nouveau_fence_channel_release(channel)
+ *
+ *	Release the channel acquired with nouveau_fence_channel_acquire.
+ */
+static void

CVS commit: src/share/man/man4

2018-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Aug 31 17:35:06 UTC 2018

Modified Files:
src/share/man/man4: axe.4

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/axe.4

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

Modified files:

Index: src/share/man/man4/axe.4
diff -u src/share/man/man4/axe.4:1.14 src/share/man/man4/axe.4:1.15
--- src/share/man/man4/axe.4:1.14	Fri Aug 31 16:43:26 2018
+++ src/share/man/man4/axe.4	Fri Aug 31 17:35:06 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: axe.4,v 1.14 2018/08/31 16:43:26 sevan Exp $
+.\" $NetBSD: axe.4,v 1.15 2018/08/31 17:35:06 wiz Exp $
 .\"
 .\" Copyright (c) 2003-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -131,7 +131,6 @@ The chip also supports USB 2.0, thereby 
 The
 .Nm
 driver supports the following media types:
-.Pp
 .Bl -tag -width 
 .It autoselect
 Enable automatic selection of the media type and options.
@@ -170,7 +169,6 @@ operation (AX88178 only).
 The
 .Nm
 driver supports the following media options:
-.Pp
 .Bl -tag -width 
 .It full-duplex
 Force full duplex operation.



CVS commit: src/share/man/man4

2018-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Aug 31 17:35:06 UTC 2018

Modified Files:
src/share/man/man4: axe.4

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/axe.4

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



CVS commit: src/usr.bin/printf

2018-08-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Aug 31 17:27:35 UTC 2018

Modified Files:
src/usr.bin/printf: printf.1 printf.c

Log Message:
PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/printf/printf.1
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/printf/printf.c

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

Modified files:

Index: src/usr.bin/printf/printf.1
diff -u src/usr.bin/printf/printf.1:1.30 src/usr.bin/printf/printf.1:1.31
--- src/usr.bin/printf/printf.1:1.30	Tue Jul 24 20:58:39 2018
+++ src/usr.bin/printf/printf.1	Fri Aug 31 17:27:35 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: printf.1,v 1.30 2018/07/24 20:58:39 kre Exp $
+.\"	$NetBSD: printf.1,v 1.31 2018/08/31 17:27:35 kre Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)printf.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd July 25, 2018
+.Dd August 31, 2018
 .Dt PRINTF 1
 .Os
 .Sh NAME
@@ -255,9 +255,12 @@ The format characters and their meanings
 .Bl -tag -width Fl
 .It Cm diouXx
 The
-.Ar argument
-is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
-or unsigned hexadecimal (X or x), respectively.
+.Ar argument ,
+which must represent an integer constant,
+with an optional leading plus or minus sign,
+is printed as a signed decimal (d or i),
+unsigned octal (o), unsigned decimal (u),
+or unsigned hexadecimal (X or x).
 .It Cm fF
 The
 .Ar argument

Index: src/usr.bin/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.42 src/usr.bin/printf/printf.c:1.43
--- src/usr.bin/printf/printf.c:1.42	Wed Jul 25 15:35:27 2018
+++ src/usr.bin/printf/printf.c	Fri Aug 31 17:27:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.42 2018/07/25 15:35:27 kre Exp $	*/
+/*	$NetBSD: printf.c,v 1.43 2018/08/31 17:27:35 kre Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.42 2018/07/25 15:35:27 kre Exp $");
+__RCSID("$NetBSD: printf.c,v 1.43 2018/08/31 17:27:35 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,7 +72,6 @@ static char	 getchr(void);
 static double	 getdouble(void);
 static int	 getwidth(void);
 static intmax_t	 getintmax(void);
-static uintmax_t getuintmax(void);
 static char	*getstr(void);
 static char	*mklong(const char *, char);
 static void  check_conversion(const char *, const char *);
@@ -301,7 +300,7 @@ int main(int argc, char *argv[])
 			case 'u':
 			case 'x':
 			case 'X': {
-uintmax_t p = getuintmax();
+uintmax_t p = (uintmax_t)getintmax();
 char *f = mklong(start, ch);
 
 PF(f, p);
@@ -655,35 +654,6 @@ getintmax(void)
 	return val;
 }
 
-static uintmax_t
-getuintmax(void)
-{
-	uintmax_t val;
-	char *cp, *ep;
-
-	cp = *gargv;
-	if (cp == NULL)
-		return 0;
-	gargv++;
-
-	if (*cp == '\"' || *cp == '\'')
-		return (uintmax_t)*(cp + 1);
-
-	/* strtoumax won't error -ve values */
-	while (isspace(*(unsigned char *)cp))
-		cp++;
-	if (*cp == '-') {
-		warnx("%s: expected positive numeric value", cp);
-		rval = 1;
-		return 0;
-	}
-
-	errno = 0;
-	val = strtoumax(cp, , 0);
-	check_conversion(cp, ep);
-	return val;
-}
-
 static double
 getdouble(void)
 {



CVS commit: src/usr.bin/printf

2018-08-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Aug 31 17:27:35 UTC 2018

Modified Files:
src/usr.bin/printf: printf.1 printf.c

Log Message:
PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/printf/printf.1
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/printf/printf.c

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 16:43:26 UTC 2018

Modified Files:
src/share/man/man4: axe.4

Log Message:
Add the correct PHY to SYNOPSIS

axe0 at uhub3 port 1
axe0: Apple Computer (0x5ac) Apple USB to Ethernet (0x1402), rev 2.00/0.01, 
addr 3
axe0: Ethernet address b8:8d:12:XX:XX:XX
ukphy0 at axe0 phy 16: OUI 0x007063, model 0x0006, rev. 1
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/axe.4

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

Modified files:

Index: src/share/man/man4/axe.4
diff -u src/share/man/man4/axe.4:1.13 src/share/man/man4/axe.4:1.14
--- src/share/man/man4/axe.4:1.13	Sat Jan 21 09:53:29 2017
+++ src/share/man/man4/axe.4	Fri Aug 31 16:43:26 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: axe.4,v 1.13 2017/01/21 09:53:29 skrll Exp $
+.\" $NetBSD: axe.4,v 1.14 2018/08/31 16:43:26 sevan Exp $
 .\"
 .\" Copyright (c) 2003-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -60,7 +60,7 @@
 .\" $FreeBSD: /repoman/r/ncvs/src/share/man/man4/axe.4,v 1.3 2003/05/29 21:28:35 ru Exp $
 .\" $OpenBSD: axe.4,v 1.37 2009/11/08 20:25:29 jasper Exp $
 .\"
-.Dd December 19, 2016
+.Dd August 31, 2018
 .Dt AXE 4
 .Os
 .Sh NAME
@@ -68,7 +68,7 @@
 .Nd ASIX Electronics AX88172/AX88178/AX88772 10/100/Gigabit USB Ethernet device
 .Sh SYNOPSIS
 .Cd "axe*   at uhub?"
-.Cd "XXphy* at mii?"
+.Cd "ukphy* at mii?"
 .Sh HARDWARE
 The
 .Nm



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 16:43:26 UTC 2018

Modified Files:
src/share/man/man4: axe.4

Log Message:
Add the correct PHY to SYNOPSIS

axe0 at uhub3 port 1
axe0: Apple Computer (0x5ac) Apple USB to Ethernet (0x1402), rev 2.00/0.01, 
addr 3
axe0: Ethernet address b8:8d:12:XX:XX:XX
ukphy0 at axe0 phy 16: OUI 0x007063, model 0x0006, rev. 1
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/axe.4

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



CVS commit: src/sys/net

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 15:15:23 UTC 2018

Modified Files:
src/sys/net: rtsock.c

Log Message:
Fix buffer overflow, detected by kASan.

ifconfig gif0 create
ifconfig gif0 up

[   50.682919] kASan: Unauthorized Access In 0x80f22655: Addr 
0x81b997a0 [8 bytes, read]
[   50.682919] #0 0x8021ce6a in kasan_memcpy 
[   50.692999] #1 0x80f22655 in m_copyback_internal 
[   50.692999] #2 0x80f22e81 in m_copyback 
[   50.692999] #3 0x8103109a in rt_msg1 
[   50.692999] #4 0x8159109a in compat_70_rt_newaddrmsg1 
[   50.692999] #5 0x81031b0f in rt_newaddrmsg 
[   50.692999] #6 0x8102c35e in rt_ifa_addlocal 
[   50.692999] #7 0x80a5287c in in6_update_ifa1 
[   50.692999] #8 0x80a54149 in in6_update_ifa 
[   50.692999] #9 0x80a59176 in in6_ifattach 
[   50.692999] #10 0x80a56dd4 in in6_if_up 
[   50.692999] #11 0x80fc5cb8 in if_up_locked 
[   50.703622] #12 0x80fcc4c1 in ifioctl_common 
[   50.703622] #13 0x80fde694 in gif_ioctl 
[   50.703622] #14 0x80fcdb1f in doifioctl 


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/net/rtsock.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.241 src/sys/net/rtsock.c:1.242
--- src/sys/net/rtsock.c:1.241	Wed Apr 25 03:49:57 2018
+++ src/sys/net/rtsock.c	Fri Aug 31 15:15:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.241 2018/04/25 03:49:57 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.242 2018/08/31 15:15:23 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.241 2018/04/25 03:49:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.242 2018/08/31 15:15:23 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1221,11 +1221,11 @@ COMPATNAME(rt_msg1)(int type, struct rt_
 		m_copyback(m, len, sa->sa_len, sa);
 		if (dlen != sa->sa_len) {
 			/*
-			 * Up to 6 + 1 nul's since roundup is to
+			 * Up to 7 + 1 nul's since roundup is to
 			 * sizeof(uint64_t) (8 bytes)
 			 */
 			m_copyback(m, len + sa->sa_len,
-			dlen - sa->sa_len, "\0\0\0\0\0\0");
+			dlen - sa->sa_len, "\0\0\0\0\0\0\0");
 		}
 		len += dlen;
 	}



CVS commit: src/sys/net

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 15:15:23 UTC 2018

Modified Files:
src/sys/net: rtsock.c

Log Message:
Fix buffer overflow, detected by kASan.

ifconfig gif0 create
ifconfig gif0 up

[   50.682919] kASan: Unauthorized Access In 0x80f22655: Addr 
0x81b997a0 [8 bytes, read]
[   50.682919] #0 0x8021ce6a in kasan_memcpy 
[   50.692999] #1 0x80f22655 in m_copyback_internal 
[   50.692999] #2 0x80f22e81 in m_copyback 
[   50.692999] #3 0x8103109a in rt_msg1 
[   50.692999] #4 0x8159109a in compat_70_rt_newaddrmsg1 
[   50.692999] #5 0x81031b0f in rt_newaddrmsg 
[   50.692999] #6 0x8102c35e in rt_ifa_addlocal 
[   50.692999] #7 0x80a5287c in in6_update_ifa1 
[   50.692999] #8 0x80a54149 in in6_update_ifa 
[   50.692999] #9 0x80a59176 in in6_ifattach 
[   50.692999] #10 0x80a56dd4 in in6_if_up 
[   50.692999] #11 0x80fc5cb8 in if_up_locked 
[   50.703622] #12 0x80fcc4c1 in ifioctl_common 
[   50.703622] #13 0x80fde694 in gif_ioctl 
[   50.703622] #14 0x80fcdb1f in doifioctl 


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/net/rtsock.c

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



CVS commit: src/sys/net/npf

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 14:16:07 UTC 2018

Modified Files:
src/sys/net/npf: npf_ext_normalize.c npf_impl.h npf_inet.c

Log Message:
Introduce npf_set_mss(). When the MSS is not 16bit-aligned, it sets:

0  8   16  2432
+--+---+---+--+
| data | MSS (low) | MSS (hig) | data |
+--+---+---+--+
^  ^
old[0] old[1]

And sets new[0,1] accordingly with the new value. The MSS-clamping code
then adjusts twice the checksum on a 16bit boundary:

from old[0] to new[0]
from old[1] to new[1]

Fixes PR/53479, opened by myself. Tested with wireshark and kASan.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/net/npf/npf_ext_normalize.c
cvs rdiff -u -r1.70 -r1.71 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.50 -r1.51 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_ext_normalize.c
diff -u src/sys/net/npf/npf_ext_normalize.c:1.7 src/sys/net/npf/npf_ext_normalize.c:1.8
--- src/sys/net/npf/npf_ext_normalize.c:1.7	Sat Apr  7 09:20:25 2018
+++ src/sys/net/npf/npf_ext_normalize.c	Fri Aug 31 14:16:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ext_normalize.c,v 1.7 2018/04/07 09:20:25 maxv Exp $	*/
+/*	$NetBSD: npf_ext_normalize.c,v 1.8 2018/08/31 14:16:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ext_normalize.c,v 1.7 2018/04/07 09:20:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ext_normalize.c,v 1.8 2018/08/31 14:16:06 maxv Exp $");
 
 #include 
 #include 
@@ -148,8 +148,10 @@ npf_normalize(npf_cache_t *npc, void *pa
 {
 	npf_normalize_t *np = params;
 	uint16_t cksum, mss, maxmss = np->n_maxmss;
+	uint16_t old[2], new[2];
 	struct tcphdr *th;
 	int wscale;
+	bool mid;
 
 	/* Skip, if already blocking. */
 	if (*decision == NPF_DECISION_BLOCK) {
@@ -182,13 +184,22 @@ npf_normalize(npf_cache_t *npc, void *pa
 	maxmss = htons(maxmss);
 
 	/*
-	 * Store new MSS, calculate TCP checksum and update it.
+	 * Store new MSS, calculate TCP checksum and update it. The MSS may
+	 * not be aligned and fall in the middle of two uint16_t's, so we
+	 * need to take care of that when calculating the checksum.
+	 *
 	 * WARNING: must re-fetch the TCP header after the modification.
 	 */
-	if (npf_fetch_tcpopts(npc, , ) &&
+	if (npf_set_mss(npc, maxmss, old, new, ) &&
 	!nbuf_cksum_barrier(npc->npc_nbuf, mi->mi_di)) {
 		th = npc->npc_l4.tcp;
-		cksum = npf_fixup16_cksum(th->th_sum, mss, maxmss);
+		if (mid) {
+			cksum = th->th_sum;
+			cksum = npf_fixup16_cksum(cksum, old[0], new[0]);
+			cksum = npf_fixup16_cksum(cksum, old[1], new[1]);
+		} else {
+			cksum = npf_fixup16_cksum(th->th_sum, mss, maxmss);
+		}
 		th->th_sum = cksum;
 	}
 

Index: src/sys/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.70 src/sys/net/npf/npf_impl.h:1.71
--- src/sys/net/npf/npf_impl.h:1.70	Sun Dec 10 01:18:21 2017
+++ src/sys/net/npf/npf_impl.h	Fri Aug 31 14:16:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.70 2017/12/10 01:18:21 rmind Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.71 2018/08/31 14:16:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -283,6 +283,8 @@ void		npf_addr_mask(const npf_addr_t *, 
 int		npf_tcpsaw(const npf_cache_t *, tcp_seq *, tcp_seq *,
 		uint32_t *);
 bool		npf_fetch_tcpopts(npf_cache_t *, uint16_t *, int *);
+bool		npf_set_mss(npf_cache_t *, uint16_t, uint16_t *, uint16_t *,
+		bool *);
 bool		npf_return_block(npf_cache_t *, const int);
 
 /* BPF interface. */

Index: src/sys/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.50 src/sys/net/npf/npf_inet.c:1.51
--- src/sys/net/npf/npf_inet.c:1.50	Sun Apr  8 05:51:45 2018
+++ src/sys/net/npf/npf_inet.c	Fri Aug 31 14:16:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.50 2018/04/08 05:51:45 maxv Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.51 2018/08/31 14:16:06 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.50 2018/04/08 05:51:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.51 2018/08/31 14:16:06 maxv Exp $");
 
 #include 
 #include 
@@ -230,7 +230,6 @@ npf_fetch_tcpopts(npf_cache_t *npc, uint
 	nbuf_t *nbuf = npc->npc_nbuf;
 	const struct tcphdr *th = npc->npc_l4.tcp;
 	int cnt, optlen = 0;
-	bool setmss = false;
 	uint8_t *cp, opt;
 	uint8_t val;
 	bool ok;
@@ -246,11 +245,6 @@ npf_fetch_tcpopts(npf_cache_t *npc, uint
 	}
 	KASSERT(cnt <= MAX_TCPOPTLEN);
 
-	/* Determine if we want to set or get the mss. */
-	if (mss) {
-		setmss = (*mss != 0);
-	}
-
 	/* Fetch all the options at once. */
 	nbuf_reset(nbuf);
 	const int step = 

CVS commit: src/sys/net/npf

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 14:16:07 UTC 2018

Modified Files:
src/sys/net/npf: npf_ext_normalize.c npf_impl.h npf_inet.c

Log Message:
Introduce npf_set_mss(). When the MSS is not 16bit-aligned, it sets:

0  8   16  2432
+--+---+---+--+
| data | MSS (low) | MSS (hig) | data |
+--+---+---+--+
^  ^
old[0] old[1]

And sets new[0,1] accordingly with the new value. The MSS-clamping code
then adjusts twice the checksum on a 16bit boundary:

from old[0] to new[0]
from old[1] to new[1]

Fixes PR/53479, opened by myself. Tested with wireshark and kASan.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/net/npf/npf_ext_normalize.c
cvs rdiff -u -r1.70 -r1.71 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.50 -r1.51 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.



CVS commit: src/sys/dev/usb

2018-08-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug 31 11:21:00 UTC 2018

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

Log Message:
Convert debug printf to KASSERTMSG for check of RX buffer length.
Also turn KASSERT into KASSERTMSG for that of TX buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/if_mue.c

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



CVS commit: src/sys/dev/usb

2018-08-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug 31 11:21:00 UTC 2018

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

Log Message:
Convert debug printf to KASSERTMSG for check of RX buffer length.
Also turn KASSERT into KASSERTMSG for that of TX buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/if_mue.c

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

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.4 src/sys/dev/usb/if_mue.c:1.5
--- src/sys/dev/usb/if_mue.c:1.4	Thu Aug 30 09:59:12 2018
+++ src/sys/dev/usb/if_mue.c	Fri Aug 31 11:21:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.4 2018/08/30 09:59:12 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.5 2018/08/31 11:21:00 rin Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.4 2018/08/30 09:59:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.5 2018/08/31 11:21:00 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1229,7 +1229,8 @@ mue_encap(struct mue_softc *sc, struct m
 	memcpy(c->mue_buf, , sizeof(hdr)); 
 	len = sizeof(hdr);
 
-	KASSERT(len + m->m_pkthdr.len <= sc->mue_txbufsz);
+	KASSERTMSG(len + m->m_pkthdr.len <= sc->mue_txbufsz, "%d <= %u",
+	len + m->m_pkthdr.len, sc->mue_txbufsz);
 
 	m_copydata(m, 0, m->m_pkthdr.len, c->mue_buf + len);
 	len += m->m_pkthdr.len;
@@ -1447,10 +1448,8 @@ mue_rxeof(struct usbd_xfer *xfer, void *
 
 	usbd_get_xfer_status(xfer, NULL, NULL, _len, NULL);
 
-	if (__predict_false(total_len > sc->mue_rxbufsz)) {
-		DPRINTF(sc, "too large transfer\n");
-		goto done;
-	}
+	KASSERTMSG(total_len <= sc->mue_rxbufsz, "%d <= %u",
+	total_len, sc->mue_rxbufsz);
 
 	do {
 		if (__predict_false(total_len < sizeof(*hdrp))) {



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:18:35 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
rename net-seg -> map-seg, and document it


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/npf/npfctl/npf.conf.5

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/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.69 src/usr.sbin/npf/npfctl/npf.conf.5:1.70
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.69	Fri Aug 31 11:11:21 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 11:18:35 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.69 2018/08/31 11:11:21 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.70 2018/08/31 11:18:35 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -408,11 +408,12 @@ table-def	= "table" table-id "type" ( "h
 map		= "map" interface
 		  ( "static" [ "algo" map-algo ] | "dynamic" )
 		  [ map-flags ] [ proto ]
-		  net-seg ( "->" | "<-" | "<->" ) net-seg
+		  map-seg ( "->" | "<-" | "<->" ) map-seg
 		  [ "pass" [ proto ] filt-opts ]
 
 map-algo	= "npt66"
 map-flags	= "no-ports"
+map-seg		= ( addr-mask | interface ) [ port-opts ]
 
 # Rule procedure definition.  The name should be in the double quotes.
 #
@@ -448,11 +449,11 @@ family-opt	= "inet4" | "inet6"
 proto-opts	= "flags" tcp-flags [ "/" tcp-flag-mask ] |
 		  "icmp-type" type [ "code" icmp-code ]
 
-addr-mask	= addr [ "/" mask ]
 filt-opts	= "from" filt-addr [ port-opts ] "to" filt-addr [ port-opts ]
 filt-addr	= [ "!" ] [ interface | addr-mask | table-id | "any" ]
 
 port-opts	= "port" ( port-num | port-from "-" port-to | var-name )
+addr-mask	= addr [ "/" mask ]
 .Ed
 .\" -
 .Sh FILES



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:18:35 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
rename net-seg -> map-seg, and document it


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/npf/npfctl/npf.conf.5

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



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:11:21 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
"interface" already contains "var-name", so don't mention it in "filt-addr",
that's redundant


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/npf/npfctl/npf.conf.5

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



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:11:21 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
"interface" already contains "var-name", so don't mention it in "filt-addr",
that's redundant


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/npf/npfctl/npf.conf.5

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/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.68 src/usr.sbin/npf/npfctl/npf.conf.5:1.69
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.68	Fri Aug 31 11:01:09 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 11:11:21 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.68 2018/08/31 11:01:09 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.69 2018/08/31 11:11:21 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -450,8 +450,7 @@ proto-opts	= "flags" tcp-flags [ "/" tcp
 
 addr-mask	= addr [ "/" mask ]
 filt-opts	= "from" filt-addr [ port-opts ] "to" filt-addr [ port-opts ]
-filt-addr	= [ "!" ] [ interface | var-name |
-  addr-mask | table-id | "any" ]
+filt-addr	= [ "!" ] [ interface | addr-mask | table-id | "any" ]
 
 port-opts	= "port" ( port-num | port-from "-" port-to | var-name )
 .Ed



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:01:09 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
should be port-opts


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/npf/npfctl/npf.conf.5

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/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.67 src/usr.sbin/npf/npfctl/npf.conf.5:1.68
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.67	Fri Aug 31 10:52:30 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 11:01:09 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.67 2018/08/31 10:52:30 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.68 2018/08/31 11:01:09 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -452,7 +452,8 @@ addr-mask	= addr [ "/" mask ]
 filt-opts	= "from" filt-addr [ port-opts ] "to" filt-addr [ port-opts ]
 filt-addr	= [ "!" ] [ interface | var-name |
   addr-mask | table-id | "any" ]
-filt-port	= "port" ( port-num | port-from "-" port-to | var-name )
+
+port-opts	= "port" ( port-num | port-from "-" port-to | var-name )
 .Ed
 .\" -
 .Sh FILES



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:01:09 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
should be port-opts


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/npf/npfctl/npf.conf.5

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



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 10:52:30 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Clarify the "Groups" section.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/npf/npfctl/npf.conf.5

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/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.66 src/usr.sbin/npf/npfctl/npf.conf.5:1.67
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.66	Mon Aug 27 13:20:47 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 10:52:30 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.66 2018/08/27 13:20:47 wiz Exp $
+.\"$NetBSD: npf.conf.5,v 1.67 2018/08/31 10:52:30 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 27, 2018
+.Dd August 31, 2018
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -132,17 +132,25 @@ The
 .Cd family
 keyword can be used in combination of a filtering rule to be explicit.
 .Ss Groups
+NPF requires that all rules be defined within groups.
+Groups can be thought of as higher level rules which can contain subrules.
 Groups may have the following options: name, interface, and direction.
-They are defined in the following form:
+Packets matching group criteria are passed to the ruleset of that group.
+If a packet does not match any group, it is passed to the
+.Cd default group .
+The
+.Cd default group
+must always be defined.
+.Pp
+Example of configuration:
 .Bd -literal
 group "my-name" in on wm0 {
-	# List of rules
+	# List of rules, for packets received on wm0
+}
+group default {
+	# List of rules, for the other packets
 }
 .Ed
-A minimal
-.Nm
-must contain a mandatory
-.Cd default group .
 .Ss Rules
 With a rule statement NPF is instructed to
 .Cd pass



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 10:52:30 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Clarify the "Groups" section.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/npf/npfctl/npf.conf.5

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



CVS commit: src/usr.sbin/npf/npfd

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 10:38:17 UTC 2018

Modified Files:
src/usr.sbin/npf/npfd: npfd.8

Log Message:
remove commented reference to pflog


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npfd/npfd.8

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/npf/npfd/npfd.8
diff -u src/usr.sbin/npf/npfd/npfd.8:1.5 src/usr.sbin/npf/npfd/npfd.8:1.6
--- src/usr.sbin/npf/npfd/npfd.8:1.5	Tue Aug  7 22:55:47 2018
+++ src/usr.sbin/npf/npfd/npfd.8	Fri Aug 31 10:38:17 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: npfd.8,v 1.5 2018/08/07 22:55:47 sevan Exp $
+.\"	$NetBSD: npfd.8,v 1.6 2018/08/31 10:38:17 maxv Exp $
 .\"	$OpenBSD: pflogd.8,v 1.35 2007/05/31 19:19:47 jmc Exp $
 .\"
 .\" Copyright (c) 2001 Can Erkin Acar.  All rights reserved.
@@ -156,7 +156,6 @@ Log specific tcp packets to a different 
 .Ed
 .Pp
 Log from another
-.\" .Xr pflog 4
 npflog
 interface, excluding specific packets:
 .Bd -literal -offset indent



CVS commit: src/usr.sbin/npf/npfd

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 10:38:17 UTC 2018

Modified Files:
src/usr.sbin/npf/npfd: npfd.8

Log Message:
remove commented reference to pflog


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npfd/npfd.8

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