CVS commit: src/sys/dev/pci

2021-05-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 15 13:00:45 UTC 2021

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

Log Message:
Change PCI_VENDOR_MASK and PCI_PRODUCT_MASK to unsigned values, to prevent
sign extension of product ID when shifted up into place in PCI_ID_CODE()

Should fix PR 56176.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.153 src/sys/dev/pci/pcireg.h:1.154
--- src/sys/dev/pci/pcireg.h:1.153	Mon Dec 28 13:12:24 2020
+++ src/sys/dev/pci/pcireg.h	Sat May 15 13:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.153 2020/12/28 13:12:24 skrll Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.154 2021/05/15 13:00:45 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -54,12 +54,12 @@ typedef u_int16_t pci_vendor_id_t;
 typedef u_int16_t pci_product_id_t;
 
 #define	PCI_VENDOR_SHIFT		0
-#define	PCI_VENDOR_MASK			0x
+#define	PCI_VENDOR_MASK			0xU
 #define	PCI_VENDOR(id) \
 	(((id) >> PCI_VENDOR_SHIFT) & PCI_VENDOR_MASK)
 
 #define	PCI_PRODUCT_SHIFT		16
-#define	PCI_PRODUCT_MASK		0x
+#define	PCI_PRODUCT_MASK		0xU
 #define	PCI_PRODUCT(id) \
 	(((id) >> PCI_PRODUCT_SHIFT) & PCI_PRODUCT_MASK)
 



CVS commit: src/doc

2021-05-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May  1 16:14:35 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
fix syntax of latest CHANGES entry


To generate a diff of this commit:
cvs rdiff -u -r1.2801 -r1.2802 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.2801 src/doc/CHANGES:1.2802
--- src/doc/CHANGES:1.2801	Fri Apr 30 22:22:49 2021
+++ src/doc/CHANGES	Sat May  1 16:14:35 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2801 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2802 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -367,5 +367,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	aarch64: Switch to GCC 10.  [mrg 20210425]
 	bind: Import version 9.16.15. [christos 20210429]
 	resolver: The default has been changed to check-names
-	(see resolv.conf(5)), which means that hostnames that
-	contain invalid characters will not resolve. [christos 20210430]
+		(see resolv.conf(5)), which means that hostnames that
+		contain invalid characters will not resolve. [christos 20210430]



CVS commit: src/sys/dev/pci

2021-04-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 21 13:12:43 UTC 2021

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regenerate


To generate a diff of this commit:
cvs rdiff -u -r1.1411 -r1.1412 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1410 -r1.1411 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1411 src/sys/dev/pci/pcidevs.h:1.1412
--- src/sys/dev/pci/pcidevs.h:1.1411	Fri Apr  2 01:08:02 2021
+++ src/sys/dev/pci/pcidevs.h	Wed Apr 21 13:12:42 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1411 2021/04/02 01:08:02 rin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1412 2021/04/21 13:12:42 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp
+ *	NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp
  */
 
 /*
@@ -7567,7 +7567,7 @@
 #define	PCI_PRODUCT_REALTEK_RT8029	0x8029		/* 8029 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8139D	0x8039		/* 8139D 10/100 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8100	0x8100		/* 8100 10/100 Ethernet */
-#define	PCI_PRODUCT_REALTEK_RT8125	0x8125		/* 8129 10/100/1G/2.5G Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8125	0x8125		/* 8125 10/100/1G/2.5G Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8129	0x8129		/* 8129 10/100 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8101E	0x8136		/* 8100E/8101E/8102E 10/100 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8138	0x8138		/* 8138 10/100 Ethernet */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1410 src/sys/dev/pci/pcidevs_data.h:1.1411
--- src/sys/dev/pci/pcidevs_data.h:1.1410	Fri Apr  2 01:08:02 2021
+++ src/sys/dev/pci/pcidevs_data.h	Wed Apr 21 13:12:42 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1410 2021/04/02 01:08:02 rin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1411 2021/04/21 13:12:42 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp
+ *	NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp
  */
 
 /*
@@ -13470,439 +13470,439 @@ static const uint16_t pci_products[] = {
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8125, 
 	33098, 33103, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, 
-	33098, 5786, 5684, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
 	33118, 5786, 5684, 0,
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
+	33123, 5786, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138, 
-	33136, 5786, 5684, 0,
+	33141, 5786, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, 
 	7566, 5786, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC, 
-	33141, 5699, 5684, 0,
+	33146, 5699, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8168, 
-	33155, 5699, 5684, 0,
+	33160, 5699, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169, 
-	33165, 5699, 5684, 0,
+	33170, 5699, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188CE, 
-	33175, 4759, 4534, 33185, 18821, 19433, 0,
+	33180, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192CE, 
-	33193, 4759, 4534, 33185, 18821, 19433, 0,
+	33198, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188EE, 
-	33203, 4759, 4534, 33185, 18821, 19433, 0,
+	33208, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180, 
-	33213, 7653, 0,
+	33218, 7653, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
-	33218, 33223, 0,
+	33223, 33228, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192EE, 
-	33235, 4759, 4534, 33185, 18821, 19433, 0,
+	33240, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_PPB, 
-	33245, 8506, 0,
+	33250, 8506, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_QXL, 
-	33250, 234, 0,
+	33255, 234, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7780, 
-	33254, 615, 6422, 0,
+	33259, 615, 6422, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7785, 
-	33261, 615, 6422, 0,
+	33266, 615, 6422, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PBI, 
-	33268, 8140, 33275, 33285, 0,
+	33273, 8140, 33280, 33290, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PPB, 
-	33268, 9419, 6530, 33291, 0,
+	33273, 9419, 6530, 33296, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PS, 
-	33268, 8140, 14350, 33297, 0,
+	33273, 8140, 14350, 33302, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720201, 
-	33302, 6912, 8200, 6920, 6422, 0,
+	33307, 6912, 8200, 6920, 6422, 0,
 	P

CVS commit: src/sys/dev/pci

2021-04-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 21 13:09:33 UTC 2021

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Fix Realtek RTL8125 description


To generate a diff of this commit:
cvs rdiff -u -r1.1425 -r1.1426 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1425 src/sys/dev/pci/pcidevs:1.1426
--- src/sys/dev/pci/pcidevs:1.1425	Fri Apr  2 01:07:16 2021
+++ src/sys/dev/pci/pcidevs	Wed Apr 21 13:09:33 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp $
+$NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7560,7 +7560,7 @@ product REALTEK RTL8411		0x5289	RTL8411 
 product REALTEK RT8029		0x8029	8029 Ethernet
 product REALTEK RT8139D		0x8039	8139D 10/100 Ethernet
 product REALTEK RT8100		0x8100	8100 10/100 Ethernet
-product REALTEK RT8125		0x8125	8129 10/100/1G/2.5G Ethernet
+product REALTEK RT8125		0x8125	8125 10/100/1G/2.5G Ethernet
 product REALTEK RT8129		0x8129	8129 10/100 Ethernet
 product REALTEK RT8101E		0x8136	8100E/8101E/8102E 10/100 Ethernet
 product REALTEK RT8138		0x8138	8138 10/100 Ethernet



CVS commit: src/distrib/sets/lists/man

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 21:01:39 UTC 2021

Modified Files:
src/distrib/sets/lists/man: mi

Log Message:
and the html for rge(4)...


To generate a diff of this commit:
cvs rdiff -u -r1.1715 -r1.1716 src/distrib/sets/lists/man/mi

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1715 src/distrib/sets/lists/man/mi:1.1716
--- src/distrib/sets/lists/man/mi:1.1715	Mon Mar  1 18:01:05 2021
+++ src/distrib/sets/lists/man/mi	Mon Mar  1 21:01:39 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1715 2021/03/01 18:01:05 jakllsch Exp $
+# $NetBSD: mi,v 1.1716 2021/03/01 21:01:39 jakllsch Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4814,6 +4814,7 @@
 ./usr/share/man/html4/rcons.html		man-sys-htmlman		html
 ./usr/share/man/html4/rdcphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/re.html			man-sys-htmlman		html
+./usr/share/man/html4/rge.html			man-sys-htmlman		html
 ./usr/share/man/html4/rgephy.html		man-sys-htmlman		html
 ./usr/share/man/html4/rlphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/rmidi.html		man-sys-htmlman		html



CVS commit: src/sys/dev

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 18:18:39 UTC 2021

Modified Files:
src/sys/dev: DEVNAMES

Log Message:
add rge


To generate a diff of this commit:
cvs rdiff -u -r1.329 -r1.330 src/sys/dev/DEVNAMES

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/DEVNAMES
diff -u src/sys/dev/DEVNAMES:1.329 src/sys/dev/DEVNAMES:1.330
--- src/sys/dev/DEVNAMES:1.329	Wed Sep  9 05:23:26 2020
+++ src/sys/dev/DEVNAMES	Mon Mar  1 18:18:39 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: DEVNAMES,v 1.329 2020/09/09 05:23:26 yamaguchi Exp $
+#	$NetBSD: DEVNAMES,v 1.330 2021/03/01 18:18:39 jakllsch Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -1146,6 +1146,7 @@ rbox			hp300
 rd			hp300
 rd			vax
 re			MI
+rge			MI
 repulse			amiga
 repulse			amigappc
 rf			MI



CVS commit: src/sys/arch

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 18:12:58 UTC 2021

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/evbarm/conf: GENERIC64
src/sys/arch/i386/conf: GENERIC

Log Message:
enable rge(4) on x86 and evbarm64


To generate a diff of this commit:
cvs rdiff -u -r1.583 -r1.584 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.176 -r1.177 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.1234 -r1.1235 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.583 src/sys/arch/amd64/conf/GENERIC:1.584
--- src/sys/arch/amd64/conf/GENERIC:1.583	Sun Jan 24 16:33:48 2021
+++ src/sys/arch/amd64/conf/GENERIC	Mon Mar  1 18:12:58 2021
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.583 2021/01/24 16:33:48 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.584 2021/03/01 18:12:58 jakllsch Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.583 $"
+#ident		"GENERIC-$Revision: 1.584 $"
 
 maxusers	64		# estimated number of users
 
@@ -833,6 +833,7 @@ ntwoc*	at pci? dev ? function ?	# Riscom
 pcn*	at pci? dev ? function ?	# AMD PCnet-PCI Ethernet
 ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g
 re*	at pci? dev ? function ?	# Realtek 8139C+/8169/8169S/8110S
+rge*	at pci? dev ? function ?	# Realtek 8125
 rtk*	at pci? dev ? function ?	# Realtek 8129/8139
 rtw*	at pci? dev ? function ?	# Realtek 8180L (802.11)
 rtwn*	at pci? dev ? function ?	# Realtek 8188CE/8192CE 802.11b/g/n

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.176 src/sys/arch/evbarm/conf/GENERIC64:1.177
--- src/sys/arch/evbarm/conf/GENERIC64:1.176	Wed Jan 27 15:52:46 2021
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Mar  1 18:12:58 2021
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.176 2021/01/27 15:52:46 skrll Exp $
+#	$NetBSD: GENERIC64,v 1.177 2021/03/01 18:12:58 jakllsch Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -256,6 +256,7 @@ mcx*		at pci? dev ? function ?	# Mellano
 mskc*		at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*		at mskc?
 re*		at pci? dev ? function ?	# Realtek RTL8111GS
+rge*		at pci? dev ? function ?	# Realtek 8125
 vmx*		at pci? dev ? function ?	# VMware VMXNET3
 wm*		at pci? dev ? function ?	# Intel Gigabit Ethernet
 

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1234 src/sys/arch/i386/conf/GENERIC:1.1235
--- src/sys/arch/i386/conf/GENERIC:1.1234	Wed Jan 20 13:22:08 2021
+++ src/sys/arch/i386/conf/GENERIC	Mon Mar  1 18:12:58 2021
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1234 2021/01/20 13:22:08 nia Exp $
+# $NetBSD: GENERIC,v 1.1235 2021/03/01 18:12:58 jakllsch Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1234 $"
+#ident		"GENERIC-$Revision: 1.1235 $"
 
 maxusers	64		# estimated number of users
 
@@ -1001,6 +1001,7 @@ ntwoc*	at pci? dev ? function ?	# Riscom
 pcn*	at pci? dev ? function ?	# AMD PCnet-PCI Ethernet
 ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g
 re*	at pci? dev ? function ?	# Realtek 8139C+/8169/8169S/8110S
+rge*	at pci? dev ? function ?	# Realtek 8125
 rtk*	at pci? dev ? function ?	# Realtek 8129/8139
 rtw*	at pci? dev ? function ?	# Realtek 8180L (802.11)
 rtwn*	at pci? dev ? function ?	# Realtek 8188CE/8192CE 802.11b/g/n



CVS commit: src/share/man/man4

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 18:08:36 UTC 2021

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

Log Message:
link to rge(4) from pci(4)


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/share/man/man4/pci.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/pci.4
diff -u src/share/man/man4/pci.4:1.104 src/share/man/man4/pci.4:1.105
--- src/share/man/man4/pci.4:1.104	Sat Feb 27 11:06:32 2021
+++ src/share/man/man4/pci.4	Mon Mar  1 18:08:36 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pci.4,v 1.104 2021/02/27 11:06:32 nia Exp $
+.\"	$NetBSD: pci.4,v 1.105 2021/03/01 18:08:36 jakllsch Exp $
 .\"
 .\" Copyright (c) 1997 Jason R. Thorpe.  All rights reserved.
 .\" Copyright (c) 1997 Jonathan Stone
@@ -29,7 +29,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 February 27, 2021
+.Dd March 1, 2021
 .Dt PCI 4
 .Os
 .Sh NAME
@@ -287,6 +287,11 @@ interfaces.
 Ralink Technology RT2500/RT2600-based 802.11a/b/g wireless network interfaces.
 .It re
 Realtek 10/100/1000 Ethernet adapters.
+.It rge
+.Tn Realtek
+RTL8125-based
+.Tn Ethernet
+interfaces.
 .It rtk
 Realtek 8129/8139 based
 .Tn Ethernet



CVS commit: src

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 18:01:05 UTC 2021

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile

Log Message:
install rge(4) manual


To generate a diff of this commit:
cvs rdiff -u -r1.1714 -r1.1715 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.711 -r1.712 src/share/man/man4/Makefile

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1714 src/distrib/sets/lists/man/mi:1.1715
--- src/distrib/sets/lists/man/mi:1.1714	Fri Feb 26 11:05:33 2021
+++ src/distrib/sets/lists/man/mi	Mon Mar  1 18:01:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1714 2021/02/26 11:05:33 nia Exp $
+# $NetBSD: mi,v 1.1715 2021/03/01 18:01:05 jakllsch Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7879,6 +7879,7 @@
 ./usr/share/man/man4/rcons.4			man-sys-man		.man
 ./usr/share/man/man4/rdcphy.4			man-sys-man		.man
 ./usr/share/man/man4/re.4			man-sys-man		.man
+./usr/share/man/man4/rge.4			man-sys-man		.man
 ./usr/share/man/man4/rgephy.4			man-sys-man		.man
 ./usr/share/man/man4/rl.4			man-obsolete		obsolete
 ./usr/share/man/man4/rlphy.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.711 src/share/man/man4/Makefile:1.712
--- src/share/man/man4/Makefile:1.711	Tue Oct 27 08:57:10 2020
+++ src/share/man/man4/Makefile	Mon Mar  1 18:01:05 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.711 2020/10/27 08:57:10 ryo Exp $
+#	$NetBSD: Makefile,v 1.712 2021/03/01 18:01:05 jakllsch Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -52,7 +52,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	pppoe.4 \
 	pseye.4 ptcd.4 ptm.4 pty.4 puc.4 pud.4 puffs.4 pwdog.4 px.4 pxagpio.4 \
 	pxaip.4 pxg.4 qat.4 qe.4 qec.4 qemufwcfg.4 qsphy.4 \
-	raid.4 ral.4 ray.4 rcons.4 rdcphy.4 re.4 rgephy.4 rlphy.4 \
+	raid.4 ral.4 ray.4 rcons.4 rdcphy.4 re.4 rge.4 rgephy.4 rlphy.4 \
 	rnd.4 route.4 rs5c372rtc.4 rtk.4 rtsx.4 rtw.4 rtwn.4 rum.4 run.4 \
 	s390rtc.4 satalink.4 sbus.4 schide.4 \
 	scsi.4 sctp.4 sd.4 se.4 seeprom.4 sem.4 \



CVS commit: src/share/man/man4

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 17:58:33 UTC 2021

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

Log Message:
update rge(4) manual page from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/rge.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/rge.4
diff -u src/share/man/man4/rge.4:1.1 src/share/man/man4/rge.4:1.2
--- src/share/man/man4/rge.4:1.1	Sat Jan 11 20:56:50 2020
+++ src/share/man/man4/rge.4	Mon Mar  1 17:58:33 2021
@@ -1,7 +1,7 @@
-.\" $NetBSD: rge.4,v 1.1 2020/01/11 20:56:50 sevan Exp $
-.\" $OpenBSD: rge.4,v 1.2 2019/11/18 22:09:59 jmc Exp $
+.\" $NetBSD: rge.4,v 1.2 2021/03/01 17:58:33 jakllsch Exp $
+.\" $OpenBSD: rge.4,v 1.4 2020/10/12 02:11:10 kevlo Exp $
 .\"
-.\" Copyright (c) 2019 Kevin Lo 
+.\" Copyright (c) 2019, 2020 Kevin Lo 
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
@@ -15,25 +15,28 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: November 18 2019 $
+.Dd $Mdocdate: October 12 2020 $
 .Dt RGE 4
 .Os
 .Sh NAME
 .Nm rge
-.Nd Realtek 8125 PCI Express 2.5Gb Ethernet device
+.Nd Realtek 8125/8125B PCI Express 2.5Gb Ethernet device
 .Sh SYNOPSIS
 .Cd "rge* at pci?"
 .Sh DESCRIPTION
 The
 .Nm
 driver provides support for PCI Express 2.5Gb Ethernet adapters based
-on the Realtek RTL8125 Ethernet controller, including the following:
+on the Realtek RTL8125 and RTL8125B Ethernet controllers,
+including the following:
 .Pp
 .Bl -bullet -offset indent -compact
 .It
-Realtek RTL8125 2.5GbE Adapter (2500baseT)
+Realtek 8125/8125B 2.5GbE Adapter (2500baseT)
 .It
 Rivet Networks Killer E3000 Adapter (2500baseT)
+.It
+TP-LINK TL-NG421 Adapter (2500baseT)
 .El
 .Sh SEE ALSO
 .Xr arp 4 ,



CVS commit: src/sys/arch

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 17:53:29 UTC 2021

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL

Log Message:
add rge(4) to x86 ALL kernels


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.497 -r1.498 src/sys/arch/i386/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.165 src/sys/arch/amd64/conf/ALL:1.166
--- src/sys/arch/amd64/conf/ALL:1.165	Sun Dec 13 08:23:52 2020
+++ src/sys/arch/amd64/conf/ALL	Mon Mar  1 17:53:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.165 2020/12/13 08:23:52 martin Exp $
+# $NetBSD: ALL,v 1.166 2021/03/01 17:53:29 jakllsch Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.165 $"
+#ident		"ALL-$Revision: 1.166 $"
 
 maxusers	64		# estimated number of users
 
@@ -1002,6 +1002,7 @@ ntwoc*	at pci? dev ? function ?	# Riscom
 pcn*	at pci? dev ? function ?	# AMD PCnet-PCI Ethernet
 ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g
 re*	at pci? dev ? function ?	# Realtek 8139C+/8169/8169S/8110S
+rge*	at pci? dev ? function ?	# Realtek 8125
 rtk*	at pci? dev ? function ?	# Realtek 8129/8139
 rtw*	at pci? dev ? function ?	# Realtek 8180L (802.11)
 rtwn*	at pci? dev ? function ?	# Realtek 8188CE/8192CE 802.11b/g/n

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.497 src/sys/arch/i386/conf/ALL:1.498
--- src/sys/arch/i386/conf/ALL:1.497	Sun Sep 27 13:48:51 2020
+++ src/sys/arch/i386/conf/ALL	Mon Mar  1 17:53:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.497 2020/09/27 13:48:51 roy Exp $
+# $NetBSD: ALL,v 1.498 2021/03/01 17:53:29 jakllsch Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.497 $"
+#ident		"ALL-$Revision: 1.498 $"
 
 maxusers	64		# estimated number of users
 
@@ -1081,6 +1081,7 @@ ntwoc*	at pci? dev ? function ?	# Riscom
 pcn*	at pci? dev ? function ?	# AMD PCnet-PCI Ethernet
 ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g
 re*	at pci? dev ? function ?	# Realtek 8139C+/8169/8169S/8110S
+rge*	at pci? dev ? function ?	# Realtek 8125
 rtk*	at pci? dev ? function ?	# Realtek 8129/8139
 rtw*	at pci? dev ? function ?	# Realtek 8180L (802.11)
 sf*	at pci? dev ? function ?	# Adaptec AIC-6915 Ethernet



CVS commit: src/sys/dev/pci

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 17:48:52 UTC 2021

Modified Files:
src/sys/dev/pci: files.pci if_rge.c if_rgereg.h

Log Message:
Update rge(4) from older OpenBSD, finish porting.

Should consider merging this all into re(4) and rgephy(4) someday.

Some cleanup tasks remain here.


To generate a diff of this commit:
cvs rdiff -u -r1.434 -r1.435 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/if_rge.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_rgereg.h

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

Modified files:

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.434 src/sys/dev/pci/files.pci:1.435
--- src/sys/dev/pci/files.pci:1.434	Wed Feb 17 08:15:43 2021
+++ src/sys/dev/pci/files.pci	Mon Mar  1 17:48:52 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.434 2021/02/17 08:15:43 knakahara Exp $
+#	$NetBSD: files.pci,v 1.435 2021/03/01 17:48:52 jakllsch Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -1183,3 +1183,8 @@ device	vmx: ether, ifnet, arp
 attach	vmx at pci
 file	dev/pci/if_vmx.c	vmx
 
+# Realtek RTL8125 2.5GBASE-T Ethernet
+device	rge: ether, ifnet, arp, mii
+attach	rge at pci
+file	dev/pci/if_rge.c		rge
+

Index: src/sys/dev/pci/if_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.16 src/sys/dev/pci/if_rge.c:1.17
--- src/sys/dev/pci/if_rge.c:1.16	Wed Jan 27 14:25:22 2021
+++ src/sys/dev/pci/if_rge.c	Mon Mar  1 17:48:52 2021
@@ -1,8 +1,8 @@
-/*	$NetBSD: if_rge.c,v 1.16 2021/01/27 14:25:22 jakllsch Exp $	*/
-/*	$OpenBSD: if_rge.c,v 1.4 2020/07/10 13:26:38 patrick Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.17 2021/03/01 17:48:52 jakllsch Exp $	*/
+/*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
- * Copyright (c) 2019 Kevin Lo 
+ * Copyright (c) 2019, 2020 Kevin Lo 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -18,9 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.16 2021/01/27 14:25:22 jakllsch Exp $");
-
-/* #include "vlan.h" Sevan */
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.17 2021/03/01 17:48:52 jakllsch Exp $");
 
 #include 
 
@@ -46,9 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1
 #include 
 #include 
 
-#if NBPFILTER > 0
 #include 
-#endif
 
 #include 
 #include 
@@ -64,16 +60,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1
 #ifdef __NetBSD__
 #define letoh32 	htole32
 #define nitems(x) 	__arraycount(x)
-#define MBUF_LIST_INITIALIZER() 	{ NULL, NULL, 0 }
-struct mbuf_list {
-	struct mbuf 	*ml_head;
-	struct mbuf 	*ml_tail;
-	u_int 	ml_len;
-};
 
 static struct mbuf *
-MCLGETI(struct rge_softc *sc __unused, int how,
-struct ifnet *ifp __unused, u_int size)
+MCLGETL(struct rge_softc *sc __unused, int how,
+u_int size)
 {
 	struct mbuf *m;
 
@@ -97,6 +87,13 @@ MCLGETI(struct rge_softc *sc __unused, i
 #endif
 #endif
 
+#ifdef RGE_DEBUG
+#define DPRINTF(x)	do { if (rge_debug > 0) printf x; } while (0)
+int rge_debug = 0;
+#else
+#define DPRINTF(x)
+#endif
+
 static int		rge_match(device_t, cfdata_t, void *);
 static void		rge_attach(device_t, device_t, void *);
 int		rge_intr(void *);
@@ -105,7 +102,7 @@ int		rge_ioctl(struct ifnet *, u_long, v
 void		rge_start(struct ifnet *);
 void		rge_watchdog(struct ifnet *);
 int		rge_init(struct ifnet *);
-void		rge_stop(struct ifnet *);
+void		rge_stop(struct ifnet *, int);
 int		rge_ifmedia_upd(struct ifnet *);
 void		rge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 int		rge_allocmem(struct rge_softc *);
@@ -119,6 +116,11 @@ void		rge_reset(struct rge_softc *);
 void		rge_iff(struct rge_softc *);
 void		rge_set_phy_power(struct rge_softc *, int);
 void		rge_phy_config(struct rge_softc *);
+void		rge_phy_config_mac_cfg2(struct rge_softc *);
+void		rge_phy_config_mac_cfg3(struct rge_softc *);
+void		rge_phy_config_mac_cfg4(struct rge_softc *);
+void		rge_phy_config_mac_cfg5(struct rge_softc *);
+void		rge_phy_config_mcu(struct rge_softc *, uint16_t);
 void		rge_set_macaddr(struct rge_softc *, const uint8_t *);
 void		rge_get_macaddr(struct rge_softc *, uint8_t *);
 void		rge_hw_init(struct rge_softc *);
@@ -126,6 +128,7 @@ void		rge_disable_phy_ocp_pwrsave(struct
 void		rge_patch_phy_mcu(struct rge_softc *, int);
 void		rge_add_media_types(struct rge_softc *);
 void		rge_config_imtype(struct rge_softc *, int);
+void		rge_disable_hw_im(struct rge_softc *);
 void		rge_disable_sim_im(struct rge_softc *);
 void		rge_setup_sim_im(struct rge_softc *);
 void		rge_setup_intr(struct rge_softc *, int);
@@ -135,7 +138,9 @@ uint32_t	rge_read_csi(struct rge_softc *
 void		rge_write_mac_ocp(struct rge_softc *, uint16_t, uint16_t);
 uint16_t	rge_read_mac_ocp(struct rge_softc *, uint16_t);
 void		rge_write_ephy(struct rge_softc *, uint16_t, uint16_t);
+uint16_t	rge_read_ep

CVS commit: src/sys/dev/usb

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 17:41:44 UTC 2021

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

Log Message:
reduce aprint_error(9) abuse


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/usbnet.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/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.39 src/sys/dev/usb/usbnet.c:1.40
--- src/sys/dev/usb/usbnet.c:1.39	Fri Aug 28 17:05:32 2020
+++ src/sys/dev/usb/usbnet.c	Mon Mar  1 17:41:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.39 2020/08/28 17:05:32 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.40 2021/03/01 17:41:44 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.39 2020/08/28 17:05:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.40 2021/03/01 17:41:44 jakllsch Exp $");
 
 #include 
 #include 
@@ -350,7 +350,7 @@ usbnet_rxeof(struct usbd_xfer *xfer, voi
 
 	if (status != USBD_NORMAL_COMPLETION) {
 		if (usbd_ratecheck(&unp->unp_rx_notice))
-			aprint_error_dev(un->un_dev, "usb errors on rx: %s\n",
+			device_printf(un->un_dev, "usb errors on rx: %s\n",
 			usbd_errstr(status));
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(unp->unp_ep[USBNET_ENDPT_RX]);
@@ -422,7 +422,7 @@ usbnet_txeof(struct usbd_xfer *xfer, voi
 
 		if_statinc(ifp, if_oerrors);
 		if (usbd_ratecheck(&unp->unp_tx_notice))
-			aprint_error_dev(un->un_dev, "usb error on tx: %s\n",
+			device_printf(un->un_dev, "usb error on tx: %s\n",
 			usbd_errstr(status));
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(unp->unp_ep[USBNET_ENDPT_TX]);
@@ -1139,13 +1139,13 @@ usbnet_watchdog(struct ifnet *ifp)
 	usbd_status err;
 
 	if_statinc(ifp, if_oerrors);
-	aprint_error_dev(un->un_dev, "watchdog timeout\n");
+	device_printf(un->un_dev, "watchdog timeout\n");
 
 	if (cd->uncd_tx_cnt > 0) {
 		DPRINTF("uncd_tx_cnt=%ju non zero, aborting pipe", 0, 0, 0, 0);
 		err = usbd_abort_pipe(unp->unp_ep[USBNET_ENDPT_TX]);
 		if (err)
-			aprint_error_dev(un->un_dev, "pipe abort failed: %s\n",
+			device_printf(un->un_dev, "pipe abort failed: %s\n",
 			usbd_errstr(err));
 		if (cd->uncd_tx_cnt != 0)
 			DPRINTF("uncd_tx_cnt now %ju", cd->uncd_tx_cnt, 0, 0, 0);



CVS commit: src/sys/dev/usb

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 17:41:00 UTC 2021

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

Log Message:
reduce aprint_error(9) abuse


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/usb/if_axe.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_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.131 src/sys/dev/usb/if_axe.c:1.132
--- src/sys/dev/usb/if_axe.c:1.131	Fri Mar 27 18:04:45 2020
+++ src/sys/dev/usb/if_axe.c	Mon Mar  1 17:41:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.131 2020/03/27 18:04:45 nisimura Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.132 2021/03/01 17:41:00 jakllsch Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.131 2020/03/27 18:04:45 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.132 2021/03/01 17:41:00 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -335,7 +335,7 @@ axe_uno_mii_read_reg(struct usbnet *un, 
 	axe_cmd(sc, AXE_CMD_MII_OPMODE_HW, 0, 0, NULL);
 
 	if (err) {
-		aprint_error_dev(un->un_dev, "read PHY failed\n");
+		device_printf(un->un_dev, "read PHY failed\n");
 		return EIO;
 	}
 
@@ -422,7 +422,7 @@ axe_uno_mii_statchg(struct ifnet *ifp)
 	DPRINTF("val=%#jx", val, 0, 0, 0);
 	err = axe_cmd(sc, AXE_CMD_WRITE_MEDIA, 0, val, NULL);
 	if (err)
-		aprint_error_dev(un->un_dev, "media change failed\n");
+		device_printf(un->un_dev, "media change failed\n");
 }
 
 static void
@@ -442,7 +442,7 @@ axe_rcvfilt_locked(struct usbnet *un)
 		return;
 
 	if (axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, &rxmode)) {
-		aprint_error_dev(un->un_dev, "can't read rxmode");
+		device_printf(un->un_dev, "can't read rxmode");
 		return;
 	}
 	rxmode = le16toh(rxmode);



CVS commit: src/etc/mtree

2021-02-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Feb 26 18:39:10 UTC 2021

Modified Files:
src/etc/mtree: special

Log Message:
Add /etc/ip6addrctl.conf as optional file so it is backed up.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/etc/mtree/special

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

Modified files:

Index: src/etc/mtree/special
diff -u src/etc/mtree/special:1.170 src/etc/mtree/special:1.171
--- src/etc/mtree/special:1.170	Sun Jun 28 03:05:59 2020
+++ src/etc/mtree/special	Fri Feb 26 18:39:10 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: special,v 1.170 2020/06/28 03:05:59 kim Exp $
+#	$NetBSD: special,v 1.171 2021/02/26 18:39:10 jakllsch Exp $
 #	@(#)special	8.2 (Berkeley) 1/23/94
 #
 # This file may be overwritten on upgrades.
@@ -92,6 +92,7 @@
 ./etc/hosts.lpd			type=file mode=0644 optional
 ./etc/ifaliases			type=file mode=0644 optional
 ./etc/inetd.conf		type=file mode=0644
+./etc/ip6addrctl.conf		type=file mode=0644 optional
 ./etc/ipf.conf			type=file mode=0644 optional
 ./etc/ipf6.conf			type=file mode=0644 optional
 ./etc/ipnat.conf		type=file mode=0644 optional



CVS commit: src/sys/netinet

2021-02-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Feb 19 15:43:56 UTC 2021

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
it's spelled struct tcphdr, not struct tcp_hdr


To generate a diff of this commit:
cvs rdiff -u -r1.426 -r1.427 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.426 src/sys/netinet/tcp_input.c:1.427
--- src/sys/netinet/tcp_input.c:1.426	Fri Feb 19 14:51:59 2021
+++ src/sys/netinet/tcp_input.c	Fri Feb 19 15:43:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.426 2021/02/19 14:51:59 christos Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.426 2021/02/19 14:51:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1274,7 +1274,7 @@ tcp_input(struct mbuf *m, int off, int p
 	 * Enforce alignment requirements that are violated in
 	 * some cases, see kern/50766 for details.
 	 */
-	if (ACCESSIBLE_POINTER(th, struct tcp_hdr) == 0) {
+	if (ACCESSIBLE_POINTER(th, struct tcphdr) == 0) {
 		m = m_copyup(m, off + sizeof(struct tcphdr), 0);
 		if (m == NULL) {
 			TCP_STATINC(TCP_STAT_RCVSHORT);
@@ -1282,7 +1282,7 @@ tcp_input(struct mbuf *m, int off, int p
 		}
 		th = (struct tcphdr *)(mtod(m, char *) + off);
 	}
-	KASSERT(ACCESSIBLE_POINTER(th, struct tcp_hdr));
+	KASSERT(ACCESSIBLE_POINTER(th, struct tcphdr));
 
 	/*
 	 * Get IP and TCP header.
@@ -1362,7 +1362,7 @@ tcp_input(struct mbuf *m, int off, int p
 			TCP_STATINC(TCP_STAT_RCVSHORT);
 			return;
 		}
-		KASSERT(ACCESSIBLE_POINTER(th, struct tcp_hdr));
+		KASSERT(ACCESSIBLE_POINTER(th, struct tcphdr));
 		optlen = thlen - sizeof(struct tcphdr);
 		optp = ((u_int8_t *)th) + sizeof(struct tcphdr);
 



CVS commit: src/sys/dev/pci

2021-02-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Feb 14 14:05:03 UTC 2021

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

Log Message:
if_bnx.c: fix misleading indentation

suggested by rillig@


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/pci/if_bnx.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.107 src/sys/dev/pci/if_bnx.c:1.108
--- src/sys/dev/pci/if_bnx.c:1.107	Sat Feb 13 16:33:30 2021
+++ src/sys/dev/pci/if_bnx.c	Sun Feb 14 14:05:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.108 2021/02/14 14:05:03 jakllsch Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.108 2021/02/14 14:05:03 jakllsch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -4588,7 +4588,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 		sc->free_rx_bd++;
 
 		DBRUN(BNX_VERBOSE_RECV, printf("%s(): ", __func__);
-		bnx_dump_rxbd(sc, sw_chain_cons, rxbd));
+		bnx_dump_rxbd(sc, sw_chain_cons, rxbd));
 
 		/* The mbuf is stored with the last rx_bd entry of a packet. */
 		if (sc->rx_mbuf_ptr[sw_chain_cons] != NULL) {



CVS commit: src/sys/dev/pci

2021-02-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Feb 13 16:33:30 UTC 2021

Modified Files:
src/sys/dev/pci: if_bnx.c if_bnxreg.h

Log Message:
Curb aprint_*() abuse in bnx(4)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_bnxreg.h

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

Modified files:

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.106 src/sys/dev/pci/if_bnx.c:1.107
--- src/sys/dev/pci/if_bnx.c:1.106	Sat Feb 13 01:51:24 2021
+++ src/sys/dev/pci/if_bnx.c	Sat Feb 13 16:33:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -923,10 +923,8 @@ bnx_attach(device_t parent, device_t sel
 	sc->bnx_intrhand = pci_intr_establish_xname(pc, sc->bnx_ih[0], IPL_NET,
 	bnx_intr, sc, device_xname(self));
 	if (sc->bnx_intrhand == NULL) {
-		aprint_error_dev(self, "couldn't establish interrupt");
-		if (intrstr != NULL)
-			aprint_error(" at %s", intrstr);
-		aprint_error("\n");
+		aprint_error_dev(self, "couldn't establish interrupt%s%s\n",
+		intrstr ? " at " : "", intrstr ? intrstr : "");
 		goto bnx_attach_fail;
 	}
 	aprint_normal_dev(sc->bnx_dev, "interrupting at %s\n", intrstr);
@@ -3991,7 +3989,7 @@ bnx_get_buf(struct bnx_softc *sc, uint16
 
 	/* Make sure the inputs are valid. */
 	DBRUNIF((*chain_prod > MAX_RX_BD),
-	aprint_error_dev(sc->bnx_dev,
+	device_printf(sc->bnx_dev,
 		"RX producer out of range: 0x%04X > 0x%04X\n",
 		*chain_prod, (uint16_t)MAX_RX_BD));
 
@@ -4007,7 +4005,7 @@ bnx_get_buf(struct bnx_softc *sc, uint16
 	while (sc->free_rx_bd >= min_free_bd) {
 		/* Simulate an mbuf allocation failure. */
 		DBRUNIF(DB_RANDOMTRUE(bnx_debug_mbuf_allocation_failure),
-		aprint_error_dev(sc->bnx_dev,
+		device_printf(sc->bnx_dev,
 		"Simulating mbuf allocation failure.\n");
 			sc->mbuf_sim_alloc_failed++;
 			rc = ENOBUFS;
@@ -4260,7 +4258,7 @@ bnx_free_tx_chain(struct bnx_softc *sc)
 
 	/* Check if we lost any mbufs in the process. */
 	DBRUNIF((sc->tx_mbuf_alloc),
-	aprint_error_dev(sc->bnx_dev,
+	device_printf(sc->bnx_dev,
 		"Memory leak! Lost %d mbufs from tx chain!\n",
 		sc->tx_mbuf_alloc));
 
@@ -4415,7 +4413,7 @@ bnx_free_rx_chain(struct bnx_softc *sc)
 
 	/* Check if we lost any mbufs in the process. */
 	DBRUNIF((sc->rx_mbuf_alloc),
-	aprint_error_dev(sc->bnx_dev,
+	device_printf(sc->bnx_dev,
 		"Memory leak! Lost %d mbufs from rx chain!\n",
 		sc->rx_mbuf_alloc));
 
@@ -4589,7 +4587,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 		rxbd = &sc->rx_bd_chain[RX_PAGE(sw_chain_cons)][RX_IDX(sw_chain_cons)];
 		sc->free_rx_bd++;
 
-		DBRUN(BNX_VERBOSE_RECV, aprint_error("%s(): ", __func__);
+		DBRUN(BNX_VERBOSE_RECV, printf("%s(): ", __func__);
 		bnx_dump_rxbd(sc, sw_chain_cons, rxbd));
 
 		/* The mbuf is stored with the last rx_bd entry of a packet. */
@@ -4650,13 +4648,13 @@ bnx_rx_intr(struct bnx_softc *sc)
 			status = l2fhdr->l2_fhdr_status;
 
 			DBRUNIF(DB_RANDOMTRUE(bnx_debug_l2fhdr_status_check),
-			aprint_error("Simulating l2_fhdr status error.\n");
+			printf("Simulating l2_fhdr status error.\n");
 			status = status | L2_FHDR_ERRORS_PHY_DECODE);
 
 			/* Watch for unusual sized frames. */
 			DBRUNIF(((len < BNX_MIN_MTU) ||
 			(len > BNX_MAX_JUMBO_ETHER_MTU_VLAN)),
-			aprint_error_dev(sc->bnx_dev,
+			device_printf(sc->bnx_dev,
 "Unusual frame size found. "
 "Min(%d), Actual(%d), Max(%d)\n",
 (int)BNX_MIN_MTU, len,
@@ -4697,7 +4695,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 			 */
 			if (bnx_get_buf(sc, &sw_prod, &sw_chain_prod,
 			&sw_prod_bseq)) {
-DBRUN(BNX_WARN, aprint_debug_dev(sc->bnx_dev,
+DBRUN(BNX_WARN, device_printf(sc->bnx_dev,
 "Failed to allocate "
 "new mbuf, incoming frame dropped!\n"));
 
@@ -4728,7 +4726,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 			DBRUN(BNX_VERBOSE_RECV,
 			struct ether_header *eh;
 			eh = mtod(m, struct ether_header *);
-			aprint_error("%s: to: %s, from: %s, type: 0x%04X\n",
+			printf("%s: to: %s, from: %s, type: 0x%04X\n",
 			__func__, ether_sprintf(eh->ether_dhost),
 			ether_sprintf(eh->ether_shost),
 			htons(eh->ether_type)));
@@ -4868,7 +4866,7 @@ bnx_tx_intr(struct bnx_softc *sc)
 		__func__, hw_tx_cons, sw_tx_cons, sw_tx_chain_cons);
 
 		DBRUNIF((sw_tx_chain_cons > MAX_TX_BD),
-		   

CVS commit: src/sys/external/bsd/drm2/via

2021-02-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Feb 13 15:42:15 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/via: via_pci.c

Log Message:
Add aprint_*() newlines for viadrmums(4) attach

>From Andrius V in kern/55884


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/via/via_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/external/bsd/drm2/via/via_pci.c
diff -u src/sys/external/bsd/drm2/via/via_pci.c:1.4 src/sys/external/bsd/drm2/via/via_pci.c:1.5
--- src/sys/external/bsd/drm2/via/via_pci.c:1.4	Mon Jul 20 21:29:38 2020
+++ src/sys/external/bsd/drm2/via/via_pci.c	Sat Feb 13 15:42:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: via_pci.c,v 1.4 2020/07/20 21:29:38 riastradh Exp $	*/
+/*	$NetBSD: via_pci.c,v 1.5 2021/02/13 15:42:15 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: via_pci.c,v 1.4 2020/07/20 21:29:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_pci.c,v 1.5 2021/02/13 15:42:15 jakllsch Exp $");
 
 #include 
 #include 
@@ -116,6 +116,9 @@ viadrm_attach(device_t parent, device_t 
 
 	KASSERT(cookiep != NULL);
 
+	aprint_naive("\n");
+	aprint_normal("\n");
+
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 



CVS commit: src/sys/dev/pci

2021-02-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Feb 13 01:51:24 UTC 2021

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

Log Message:
Revert bnx(4) to INTx interrupts.

Should fix PR kern/55974.

This driver does not yet do the special MSI and MSI-X setup that the
chip apparently requires.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/pci/if_bnx.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.105 src/sys/dev/pci/if_bnx.c:1.106
--- src/sys/dev/pci/if_bnx.c:1.105	Fri Jul 17 10:56:15 2020
+++ src/sys/dev/pci/if_bnx.c	Sat Feb 13 01:51:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.105 2020/07/17 10:56:15 jdolecek Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.105 2020/07/17 10:56:15 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -625,7 +625,13 @@ bnx_attach(device_t parent, device_t sel
 		return;
 	}
 
-	if (pci_intr_alloc(pa, &sc->bnx_ih, NULL, 0)) {
+	/* XXX driver needs more work before MSI or MSI-X can be enabled */
+	int counts[PCI_INTR_TYPE_SIZE] = {
+		[PCI_INTR_TYPE_INTX] = 1,
+		[PCI_INTR_TYPE_MSI] = 0,
+		[PCI_INTR_TYPE_MSIX] = 0,
+	};
+	if (pci_intr_alloc(pa, &sc->bnx_ih, counts, PCI_INTR_TYPE_INTX)) {
 		aprint_error_dev(sc->bnx_dev, "couldn't map interrupt\n");
 		goto bnx_attach_fail;
 	}



CVS commit: src/sys/dev/pci

2021-02-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Feb  9 15:05:49 UTC 2021

Modified Files:
src/sys/dev/pci: if_iavf.c if_ixl.c

Log Message:
Zero interrupt handles upon allocation.

Might prevent detach-time bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/if_iavf.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/if_ixl.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_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.11 src/sys/dev/pci/if_iavf.c:1.12
--- src/sys/dev/pci/if_iavf.c:1.11	Thu Dec 10 04:03:00 2020
+++ src/sys/dev/pci/if_iavf.c	Tue Feb  9 15:05:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iavf.c,v 1.11 2020/12/10 04:03:00 yamaguchi Exp $	*/
+/*	$NetBSD: if_iavf.c,v 1.12 2021/02/09 15:05:49 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.11 2020/12/10 04:03:00 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.12 2021/02/09 15:05:49 jakllsch Exp $");
 
 #include 
 #include 
@@ -1789,7 +1789,7 @@ iavf_setup_interrupts(struct iavf_softc 
 		num = counts[PCI_INTR_TYPE_MSIX];
 	}
 
-	sc->sc_ihs = kmem_alloc(sizeof(sc->sc_ihs[0]) * num, KM_NOSLEEP);
+	sc->sc_ihs = kmem_zalloc(sizeof(sc->sc_ihs[0]) * num, KM_NOSLEEP);
 	if (sc->sc_ihs == NULL) {
 		IAVF_LOG(sc, LOG_ERR,
 		"couldn't allocate memory for interrupts\n");

Index: src/sys/dev/pci/if_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.75 src/sys/dev/pci/if_ixl.c:1.76
--- src/sys/dev/pci/if_ixl.c:1.75	Tue Sep  8 10:05:47 2020
+++ src/sys/dev/pci/if_ixl.c	Tue Feb  9 15:05:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.75 2020/09/08 10:05:47 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.76 2021/02/09 15:05:49 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.75 2020/09/08 10:05:47 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.76 2021/02/09 15:05:49 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5925,7 +5925,7 @@ ixl_setup_interrupts(struct ixl_softc *s
 			PCI_INTR_MPSAFE, true);
 		}
 
-		sc->sc_ihs = kmem_alloc(sizeof(sc->sc_ihs[0]) * sc->sc_nintrs,
+		sc->sc_ihs = kmem_zalloc(sizeof(sc->sc_ihs[0]) * sc->sc_nintrs,
 		KM_SLEEP);
 
 		if (intr_type == PCI_INTR_TYPE_MSIX) {



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

2021-02-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Feb  9 14:24:14 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gic.c

Log Message:
Avoid an extra daif read when dispatching interrupts by using
ENABLE_INTERRUPT() / DISABLE_INTERRUPT() instead of cpsie() / cpsid() macros.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/cortex/gic.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.43 src/sys/arch/arm/cortex/gic.c:1.44
--- src/sys/arch/arm/cortex/gic.c:1.43	Thu Dec  3 07:45:52 2020
+++ src/sys/arch/arm/cortex/gic.c	Tue Feb  9 14:24:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.43 2020/12/03 07:45:52 skrll Exp $	*/
+/*	$NetBSD: gic.c,v 1.44 2021/02/09 14:24:14 jakllsch Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.43 2020/12/03 07:45:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.44 2021/02/09 14:24:14 jakllsch Exp $");
 
 #include 
 #include 
@@ -367,9 +367,9 @@ armgic_irq_handler(void *tf)
 			gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(ipl));
 			ci->ci_cpl = ipl;
 		}
-		cpsie(I32_bit);
+		ENABLE_INTERRUPT();
 		pic_dispatch(is, tf);
-		cpsid(I32_bit);
+		DISABLE_INTERRUPT();
 		gicc_write(sc, GICC_EOIR, iar);
 #ifdef DEBUG
 		n++;
@@ -529,7 +529,7 @@ armgic_cpu_init(struct pic_softc *pic, s
 	}
 	gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(ci->ci_cpl));	// set PMR
 	gicc_write(sc, GICC_CTRL, GICC_CTRL_V1_Enable);	// enable interrupt
-	cpsie(I32_bit);	// allow IRQ exceptions
+	ENABLE_INTERRUPT();// allow IRQ exceptions
 }
 
 void
@@ -656,7 +656,7 @@ armgic_attach(device_t parent, device_t 
 	armgic_set_priority(&sc->sc_pic, ci->ci_cpl);	// set PMR
 	gicd_write(sc, GICD_CTRL, GICD_CTRL_Enable);	// enable Distributer
 	gicc_write(sc, GICC_CTRL, GICC_CTRL_V1_Enable);	// enable CPU interrupts
-	cpsie(I32_bit);	// allow interrupt exceptions
+	ENABLE_INTERRUPT();// allow interrupt exceptions
 
 	/*
 	 * For each line that isn't valid, we set the intrsource for it to



CVS commit: src/share/misc

2021-01-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jan 30 19:20:44 UTC 2021

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add a few network interface offload feature initialisms


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.320 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.319 src/share/misc/acronyms.comp:1.320
--- src/share/misc/acronyms.comp:1.319	Thu Jan 21 18:09:10 2021
+++ src/share/misc/acronyms.comp	Sat Jan 30 19:20:44 2021
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.319 2021/01/21 18:09:10 kamil Exp $
+$NetBSD: acronyms.comp,v 1.320 2021/01/30 19:20:44 jakllsch Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -651,7 +651,9 @@ GPT	GUID partition table
 GPU	graphics processing unit
 GR	golden ratio
 GRE	generic routing encapsulation
+GRO	generic receive offload
 GSI	global system interrupt
+GSO	generic send offload
 GUI	graphical user interface
 GUID	globally unique identifier
 GVFSgit virtual file system
@@ -1375,6 +1377,7 @@ RSA	Rivest, Shamir, [and] Adleman
 RSIP	Realm Specific IP
 RSN	Robust Secure Network
 RSS	really simple syndication
+RSS	Receive Side Scaling
 RSS	residual sum of squares
 RSTP	Rapid Spanning Tree Protocol
 RT	real time
@@ -1630,6 +1633,7 @@ TMG	transmogrifier
 TMDS	transition minimized differential signaling
 TMO	timeout
 TOD	time of day
+TOE	TCP offload engine
 TOFU	trust on first use
 TOS	terms of service
 TOS	trusted operating system
@@ -1655,6 +1659,7 @@ TSD	time stamp disable
 TSDB	time series database
 TSL	test, set, lock
 TSO	time sharing option
+TSO	TCP segmentation offload
 TSO	Total Store Ordering
 TSP	Time-Stamp Protocol
 TSP	Tunnel Setup Protocol
@@ -1685,6 +1690,7 @@ UDMA	ultra DMA
 UDO	ultra density optical
 UDP	User Datagram Protocol
 UEFI	unified extensible firmware interface
+UFO	UDP fragmentation offload
 UFS	Unix File System
 UGA	universal graphics adapter
 UI	unit interval



CVS commit: src/sys/dev/pci

2021-01-27 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan 27 14:25:22 UTC 2021

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

Log Message:
if_rge.c: avoid aprint_error*() abuse


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.15 src/sys/dev/pci/if_rge.c:1.16
--- src/sys/dev/pci/if_rge.c:1.15	Wed Jan 20 18:26:11 2021
+++ src/sys/dev/pci/if_rge.c	Wed Jan 27 14:25:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.15 2021/01/20 18:26:11 jakllsch Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.16 2021/01/27 14:25:22 jakllsch Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.4 2020/07/10 13:26:38 patrick Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.15 2021/01/20 18:26:11 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.16 2021/01/27 14:25:22 jakllsch Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -623,7 +623,7 @@ rge_watchdog(struct ifnet *ifp)
 {
 	struct rge_softc *sc = ifp->if_softc;
 
-	aprint_error_dev(sc->sc_dev, "watchdog timeout\n");
+	device_printf(sc->sc_dev, "watchdog timeout\n");
 	if_statinc(ifp, if_oerrors);
 
 	rge_init(ifp);
@@ -658,7 +658,7 @@ rge_init(struct ifnet *ifp)
 
 	/* Initialize RX descriptors list. */
 	if (rge_rx_list_init(sc) == ENOBUFS) {
-		aprint_error_dev(sc->sc_dev,
+		device_printf(sc->sc_dev,
 		"init failed: no memory for RX buffers\n");
 		rge_stop(ifp);
 		return (ENOBUFS);
@@ -904,7 +904,7 @@ rge_ifmedia_upd(struct ifnet *ifp)
 		ifp->if_baudrate = IF_Mbps(10);
 		break;
 	default:
-		aprint_error_dev(sc->sc_dev,
+		device_printf(sc->sc_dev,
 		"unsupported media type\n");
 		return (EINVAL);
 	}
@@ -1089,7 +1089,7 @@ rge_newbuf(struct rge_softc *sc, int idx
 	r = &sc->rge_ldata.rge_rx_list[idx];
 
 	if (RGE_OWN(r)) {
-		aprint_error_dev(sc->sc_dev, "tried to map busy RX descriptor\n");
+		device_printf(sc->sc_dev, "tried to map busy RX descriptor\n");
 		goto out;
 	}
 
@@ -1384,7 +1384,7 @@ rge_reset(struct rge_softc *sc)
 			break;
 	}
 	if (i == RGE_TIMEOUT)
-		aprint_error_dev(sc->sc_dev, "reset never completed!\n");
+		device_printf(sc->sc_dev, "reset never completed!\n");
 }
 
 void



CVS commit: src/sys/dev/pci

2021-01-20 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Jan 20 18:26:11 UTC 2021

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

Log Message:
Sync with OpenBSD if_rge.c r1.4

"""
Change users of IFQ_SET_MAXLEN() and IFQ_IS_EMPTY() to use the "new" API.
"""


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.14 src/sys/dev/pci/if_rge.c:1.15
--- src/sys/dev/pci/if_rge.c:1.14	Sat May 30 22:39:40 2020
+++ src/sys/dev/pci/if_rge.c	Wed Jan 20 18:26:11 2021
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_rge.c,v 1.14 2020/05/30 22:39:40 sevan Exp $	*/
-/*	$OpenBSD: if_rge.c,v 1.3 2020/03/27 15:15:24 krw Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.15 2021/01/20 18:26:11 jakllsch Exp $	*/
+/*	$OpenBSD: if_rge.c,v 1.4 2020/07/10 13:26:38 patrick Exp $	*/
 
 /*
  * Copyright (c) 2019 Kevin Lo 
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.14 2020/05/30 22:39:40 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.15 2021/01/20 18:26:11 jakllsch Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -306,7 +306,7 @@ rge_attach(device_t parent, device_t sel
 	ifp->if_ioctl = rge_ioctl;
 	ifp->if_start = rge_start;
 	ifp->if_watchdog = rge_watchdog;
-	IFQ_SET_MAXLEN(&ifp->if_snd, RGE_TX_LIST_CNT);
+	ifq_set_maxlen(&ifp->if_snd, RGE_TX_LIST_CNT);
 	ifp->if_mtu = RGE_JUMBO_MTU;
 
 	ifp->if_capabilities = ETHERCAP_VLAN_MTU | IFCAP_CSUM_IPv4_Rx |



CVS commit: src/sys/dev/pci

2020-12-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Dec  9 14:21:09 UTC 2020

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

Log Message:
xhci_pci: avoid potential double free of interrupt handles

Found by Kouichi Hashikawa in PR 55855.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/xhci_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/pci/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.25 src/sys/dev/pci/xhci_pci.c:1.26
--- src/sys/dev/pci/xhci_pci.c:1.25	Tue Oct 27 13:50:57 2020
+++ src/sys/dev/pci/xhci_pci.c	Wed Dec  9 14:21:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.25 2020/10/27 13:50:57 skrll Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.25 2020/10/27 13:50:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -222,7 +222,7 @@ xhci_pci_attach(device_t parent, device_
 	xhci_intr, sc, device_xname(sc->sc_dev));
 	if (psc->sc_ih == NULL) {
 		pci_intr_release(pc, psc->sc_pihp, 1);
-		psc->sc_ih = NULL;
+		psc->sc_pihp = NULL;
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
 			aprint_error(" at %s", intrstr);



CVS commit: src/crypto/external/bsd/openssl/include/openssl

2020-10-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Oct  8 16:00:09 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/include/openssl: opensslconf.h

Log Message:
openssl: Define OPENSSL_NO_EC_NISTP_64_GCC_128 for Alpha too

The ecp_nistp521.c code depends on doing unaligned 64-bit accesses,
which the NetBSD/alpha kernel doesn't like to trap and emulate.

fixes PR lib/55701


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/openssl/include/openssl/opensslconf.h

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

Modified files:

Index: src/crypto/external/bsd/openssl/include/openssl/opensslconf.h
diff -u src/crypto/external/bsd/openssl/include/openssl/opensslconf.h:1.7 src/crypto/external/bsd/openssl/include/openssl/opensslconf.h:1.8
--- src/crypto/external/bsd/openssl/include/openssl/opensslconf.h:1.7	Sat Dec  8 17:07:27 2018
+++ src/crypto/external/bsd/openssl/include/openssl/opensslconf.h	Thu Oct  8 16:00:09 2020
@@ -50,7 +50,7 @@ extern "C" {
 #  define OPENSSL_NO_DEVCRYPTOENG
 # endif
 #endif
-#if !defined(_LP64) || defined(__sparc64__)
+#if !defined(_LP64) || defined(__alpha__) || defined(__sparc64__)
 # ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
 #  define OPENSSL_NO_EC_NISTP_64_GCC_128
 # endif



CVS commit: src/sys/dev/pci

2020-10-04 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Oct  4 16:23:05 UTC 2020

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

Log Message:
device_printf() instead of aprint_error_dev() where appropriate


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.113 src/sys/dev/pci/if_msk.c:1.114
--- src/sys/dev/pci/if_msk.c:1.113	Mon May 11 23:47:45 2020
+++ src/sys/dev/pci/if_msk.c	Sun Oct  4 16:23:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.113 2020/05/11 23:47:45 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.114 2020/10/04 16:23:04 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.113 2020/05/11 23:47:45 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.114 2020/10/04 16:23:04 jakllsch Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ msk_miibus_readreg(device_t dev, int phy
 	}
 
 	if (i == SK_TIMEOUT) {
-		aprint_error_dev(sc_if->sk_dev, "phy failed to come ready\n");
+		device_printf(sc_if->sk_dev, "phy failed to come ready\n");
 		return ETIMEDOUT;
 	}
 
@@ -289,7 +289,7 @@ msk_miibus_writereg(device_t dev, int ph
 	}
 
 	if (i == SK_TIMEOUT) {
-		aprint_error_dev(sc_if->sk_dev, "phy write timed out\n");
+		device_printf(sc_if->sk_dev, "phy write timed out\n");
 		return ETIMEDOUT;
 	}
 
@@ -2035,7 +2035,7 @@ msk_watchdog(struct ifnet *ifp)
 	 */
 	msk_txeof(sc_if);
 	if (sc_if->sk_cdata.sk_tx_cnt != 0) {
-		aprint_error_dev(sc_if->sk_dev, "watchdog timeout\n");
+		device_printf(sc_if->sk_dev, "watchdog timeout\n");
 
 		if_statinc(ifp, if_oerrors);
 



CVS commit: src/sys/dev/ata

2020-09-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Sep 28 12:47:49 UTC 2020

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
fix typo that prevented bytes/physsect reporting from working


To generate a diff of this commit:
cvs rdiff -u -r1.464 -r1.465 src/sys/dev/ata/wd.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/wd.c
diff -u src/sys/dev/ata/wd.c:1.464 src/sys/dev/ata/wd.c:1.465
--- src/sys/dev/ata/wd.c:1.464	Sun Sep 27 16:58:11 2020
+++ src/sys/dev/ata/wd.c	Mon Sep 28 12:47:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.464 2020/09/27 16:58:11 christos Exp $ */
+/*	$NetBSD: wd.c,v 1.465 2020/09/28 12:47:49 jakllsch Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.464 2020/09/27 16:58:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.465 2020/09/28 12:47:49 jakllsch Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -453,7 +453,7 @@ wdattach(device_t parent, device_t self,
 	wd->sc_blksize, (unsigned long long)wd->sc_capacity);
 	if (wd->sc_sectoralign.dsa_alignment != 1) {
 		aprint_normal(" (%d bytes/physsect",
-		wd->sc_sectoralign.dsa_alignment & wd->sc_blksize);
+		wd->sc_sectoralign.dsa_alignment * wd->sc_blksize);
 		if (wd->sc_sectoralign.dsa_firstaligned != 0) {
 			aprint_normal("; first aligned sector: %jd",
 			(intmax_t)wd->sc_sectoralign.dsa_firstaligned);



CVS commit: src/sys/dev/scsipi

2020-09-25 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep 25 13:08:00 UTC 2020

Modified Files:
src/sys/dev/scsipi: sd.c

Log Message:
spelling fixes in sd.c comments


To generate a diff of this commit:
cvs rdiff -u -r1.329 -r1.330 src/sys/dev/scsipi/sd.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/scsipi/sd.c
diff -u src/sys/dev/scsipi/sd.c:1.329 src/sys/dev/scsipi/sd.c:1.330
--- src/sys/dev/scsipi/sd.c:1.329	Mon Apr 13 08:05:02 2020
+++ src/sys/dev/scsipi/sd.c	Fri Sep 25 13:08:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.329 2020/04/13 08:05:02 maxv Exp $	*/
+/*	$NetBSD: sd.c,v 1.330 2020/09/25 13:08:00 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.329 2020/04/13 08:05:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.330 2020/09/25 13:08:00 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -444,7 +444,7 @@ sd_firstopen(device_t self, dev_t dev, i
 
 	/*
 	 * Start the pack spinning if necessary. Always allow the
-	 * raw parition to be opened, for raw IOCTLs. Data transfers
+	 * raw partition to be opened, for raw IOCTLs. Data transfers
 	 * will check for SDEV_MEDIA_LOADED.
 	 */
 	if (error == EIO) {
@@ -588,7 +588,7 @@ sd_lastclose(device_t self)
 }
 
 /*
- * close the device.. only called if we are the LAST occurence of an open
+ * close the device.. only called if we are the LAST occurrence of an open
  * device.  Convenient now but usually a pain.
  */
 static int
@@ -642,7 +642,7 @@ sdstrategy(struct buf *bp)
 /*
  * Issue single I/O command
  *
- * Called from dk_start and implicitely from dk_strategy
+ * Called from dk_start and implicitly from dk_strategy
  */
 static int
 sd_diskstart(device_t dev, struct buf *bp)
@@ -871,7 +871,7 @@ sdminphys(struct buf *bp)
 	 *
 	 * XXX Note that the SCSI-I spec says that 256-block transfers
 	 * are allowed in a 6-byte read/write, and are specified
-	 * by settng the "length" to 0.  However, we're conservative
+	 * by setting the "length" to 0.  However, we're conservative
 	 * here, allowing only 255-block transfers in case an
 	 * ancient device gets confused by length == 0.  A length of 0
 	 * in a 10-byte read/write actually means 0 blocks.



CVS commit: src/sys/dev/pci

2020-09-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep 23 13:45:14 UTC 2020

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

Log Message:
whitespace fix


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/virtio_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/pci/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.13 src/sys/dev/pci/virtio_pci.c:1.14
--- src/sys/dev/pci/virtio_pci.c:1.13	Thu Sep 17 17:33:50 2020
+++ src/sys/dev/pci/virtio_pci.c	Wed Sep 23 13:45:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.13 2020/09/17 17:33:50 jakllsch Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.14 2020/09/23 13:45:14 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.13 2020/09/17 17:33:50 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.14 2020/09/23 13:45:14 jakllsch Exp $");
 
 #include 
 #include 
@@ -734,7 +734,7 @@ retry:
 		psc->sc_ihs_num = 1;
 		psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI;
 
-	error = pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, NULL);
+		error = pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, NULL);
 		if (error != 0) {
 			ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
 			ctl &= ~PCI_MSIX_CTL_ENABLE;



CVS commit: src/share/man/man4/man4.sparc

2020-09-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Sep 22 01:11:48 UTC 2020

Modified Files:
src/share/man/man4/man4.sparc: intro.4

Log Message:
Fix weird spelling, refresh date.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/share/man/man4/man4.sparc/intro.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/man4.sparc/intro.4
diff -u src/share/man/man4/man4.sparc/intro.4:1.27 src/share/man/man4/man4.sparc/intro.4:1.28
--- src/share/man/man4/man4.sparc/intro.4:1.27	Mon Jul  3 21:30:59 2017
+++ src/share/man/man4/man4.sparc/intro.4	Tue Sep 22 01:11:48 2020
@@ -27,9 +27,9 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\"	$NetBSD: intro.4,v 1.27 2017/07/03 21:30:59 wiz Exp $
+.\"	$NetBSD: intro.4,v 1.28 2020/09/22 01:11:48 jakllsch Exp $
 .\"
-.Dd February 17, 2017
+.Dd September 22, 2020
 .Dt INTRO 4 sparc
 .Os
 .Sh NAME
@@ -273,7 +273,7 @@ commands can use it to power down the sy
 .It si
 NCR5380 "SCSI-2" VMEbus (Sun 4/200, Sun 4/400) SCSI controller
 .It sw
-NCR5380 obio (Sun 4/100) "SCSI Wierd" SCSI controller
+NCR5380 obio (Sun 4/100) "SCSI Weird" SCSI controller
 .It tcx
 8 or 24 bit Sbus color graphics frame buffer
 .It xd



CVS commit: src/sys/dev/scsipi

2020-09-18 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep 18 15:04:25 UTC 2020

Modified Files:
src/sys/dev/scsipi: scsiconf.c

Log Message:
Revert scsiconf.c 1.288, it only worked for LUN 1.

vioscsi(4) now sets PQUIRK_FORCELUNS, which fixes the original issue for
all LUNs.

To-do: should issue REPORT LUNS and use the information it returns to
probe LUNs in an optimized way.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/dev/scsipi/scsiconf.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/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.289 src/sys/dev/scsipi/scsiconf.c:1.290
--- src/sys/dev/scsipi/scsiconf.c:1.289	Thu Sep 17 01:19:41 2020
+++ src/sys/dev/scsipi/scsiconf.c	Fri Sep 18 15:04:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.289 2020/09/17 01:19:41 jakllsch Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.290 2020/09/18 15:04:25 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.289 2020/09/17 01:19:41 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.290 2020/09/18 15:04:25 jakllsch Exp $");
 
 #include 
 #include 
@@ -883,8 +883,6 @@ scsi_probe_device(struct scsibus_softc *
 		break;
 
 	case SID_QUAL_LU_NOTPRESENT:
-		docontinue = 1;
-		/* FALLTHROUGH */
 	case SID_QUAL_reserved:
 	case SID_QUAL_LU_NOT_SUPP:
 		goto bad;



CVS commit: src/sys/dev/pci

2020-09-18 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep 18 14:55:28 UTC 2020

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

Log Message:
Probe all LUNs on vioscsi(4) until scsi(4) can do REPORT LUNS.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/vioscsi.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/vioscsi.c
diff -u src/sys/dev/pci/vioscsi.c:1.22 src/sys/dev/pci/vioscsi.c:1.23
--- src/sys/dev/pci/vioscsi.c:1.22	Sun Jul 12 06:40:11 2020
+++ src/sys/dev/pci/vioscsi.c	Fri Sep 18 14:55:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vioscsi.c,v 1.22 2020/07/12 06:40:11 kim Exp $	*/
+/*	$NetBSD: vioscsi.c,v 1.23 2020/09/18 14:55:28 jakllsch Exp $	*/
 /*	$OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.22 2020/07/12 06:40:11 kim Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.23 2020/09/18 14:55:28 jakllsch Exp $");
 
 #include 
 #include 
@@ -196,6 +196,13 @@ vioscsi_attach(device_t parent, device_t
 	chan->chan_nluns = MIN(max_lun, 1024);		/* cap reasonably */
 	chan->chan_id = max_target;
 	chan->chan_flags = SCSIPI_CHAN_NOSETTLE;
+	/*
+	 * XXX Remove this when scsipi is REPORT LUNS-aware.
+	 * scsipi(4) insists that LUNs must be contiguous starting from 0.
+	 * This is not true on Linode (circa 2020) and Proxmox 6 hosts
+	 * with more than one disk exported to guest.
+	 */
+	chan->chan_defquirks = PQUIRK_FORCELUNS;
 
 	config_found(self, &sc->sc_channel, scsiprint);
 	return;



CVS commit: src/sys/dev/pci

2020-09-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 17 17:33:51 UTC 2020

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

Log Message:
Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.

The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.

This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/virtio_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/pci/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.12 src/sys/dev/pci/virtio_pci.c:1.13
--- src/sys/dev/pci/virtio_pci.c:1.12	Thu Sep 17 17:04:31 2020
+++ src/sys/dev/pci/virtio_pci.c	Thu Sep 17 17:33:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.12 2020/09/17 17:04:31 jakllsch Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.13 2020/09/17 17:33:50 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.12 2020/09/17 17:04:31 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.13 2020/09/17 17:33:50 jakllsch Exp $");
 
 #include 
 #include 
@@ -662,10 +662,13 @@ virtio_pci_setup_interrupts(struct virti
 	struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
 	device_t self = sc->sc_dev;
 	pci_chipset_tag_t pc = psc->sc_pa.pa_pc;
+	pcitag_t tag = psc->sc_pa.pa_tag;
 	int error;
 	int nmsix;
+	int off;
 	int counts[PCI_INTR_TYPE_SIZE];
 	pci_intr_type_t max_type;
+	pcireg_t ctl;
 
 	nmsix = pci_msix_count(psc->sc_pa.pa_pc, psc->sc_pa.pa_tag);
 	aprint_debug_dev(self, "pci_msix_count=%d\n", nmsix);
@@ -730,6 +733,13 @@ retry:
 
 		psc->sc_ihs_num = 1;
 		psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI;
+
+	error = pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, NULL);
+		if (error != 0) {
+			ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
+			ctl &= ~PCI_MSIX_CTL_ENABLE;
+			pci_conf_write(pc, tag, off + PCI_MSIX_CTL, ctl);
+		}
 	}
 
 	return 0;



CVS commit: src/sys/dev/pci

2020-09-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 17 17:09:59 UTC 2020

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

Log Message:
Fix word-o of function name in comment


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/virtio.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.41 src/sys/dev/pci/virtio.c:1.42
--- src/sys/dev/pci/virtio.c:1.41	Mon May 25 07:52:16 2020
+++ src/sys/dev/pci/virtio.c	Thu Sep 17 17:09:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.41 2020/05/25 07:52:16 yamaguchi Exp $	*/
+/*	$NetBSD: virtio.c,v 1.42 2020/09/17 17:09:59 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.41 2020/05/25 07:52:16 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.42 2020/09/17 17:09:59 jakllsch Exp $");
 
 #include 
 #include 
@@ -61,7 +61,7 @@ virtio_set_status(struct virtio_softc *s
  *	virtio_reset(sc);	 // this will stop the device activity
  *	; // virtio_dequeue() still can be called
  *	;
- *	virtio_reinit_begin(sc); // dequeue prohibitted
+ *	virtio_reinit_start(sc); // dequeue prohibitted
  *	newfeatures = virtio_negotiate_features(sc, requestedfeatures);
  *	;
  *	virtio_reinit_end(sc);	 // device activated; enqueue allowed



CVS commit: src/sys/dev/pci

2020-09-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 17 17:04:31 UTC 2020

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

Log Message:
Ensure interrupt handles buffer is zeroed on allocation

Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/virtio_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/pci/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.11 src/sys/dev/pci/virtio_pci.c:1.12
--- src/sys/dev/pci/virtio_pci.c:1.11	Wed May 27 11:24:31 2020
+++ src/sys/dev/pci/virtio_pci.c	Thu Sep 17 17:04:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.11 2020/05/27 11:24:31 yamaguchi Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.12 2020/09/17 17:04:31 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.11 2020/05/27 11:24:31 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.12 2020/09/17 17:04:31 jakllsch Exp $");
 
 #include 
 #include 
@@ -701,7 +701,7 @@ retry:
 	}
 
 	if (pci_intr_type(pc, psc->sc_ihp[0]) == PCI_INTR_TYPE_MSIX) {
-		psc->sc_ihs = kmem_alloc(sizeof(*psc->sc_ihs) * nmsix,
+		psc->sc_ihs = kmem_zalloc(sizeof(*psc->sc_ihs) * nmsix,
 		KM_SLEEP);
 
 		error = virtio_pci_setup_msix_interrupts(sc, &psc->sc_pa);
@@ -718,7 +718,7 @@ retry:
 		psc->sc_ihs_num = nmsix;
 		psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI;
 	} else if (pci_intr_type(pc, psc->sc_ihp[0]) == PCI_INTR_TYPE_INTX) {
-		psc->sc_ihs = kmem_alloc(sizeof(*psc->sc_ihs) * 1,
+		psc->sc_ihs = kmem_zalloc(sizeof(*psc->sc_ihs) * 1,
 		KM_SLEEP);
 
 		error = virtio_pci_setup_intx_interrupt(sc, &psc->sc_pa);



CVS commit: src/sys/dev/scsipi

2020-09-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 17 01:19:41 UTC 2020

Modified Files:
src/sys/dev/scsipi: scsiconf.c scsipi_base.c

Log Message:
Some misspelling-in-comments fixes for scsipi


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/dev/scsipi/scsiconf.c
cvs rdiff -u -r1.186 -r1.187 src/sys/dev/scsipi/scsipi_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/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.288 src/sys/dev/scsipi/scsiconf.c:1.289
--- src/sys/dev/scsipi/scsiconf.c:1.288	Sat Jul 11 14:31:46 2020
+++ src/sys/dev/scsipi/scsiconf.c	Thu Sep 17 01:19:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.288 2020/07/11 14:31:46 kim Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.289 2020/09/17 01:19:41 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.288 2020/07/11 14:31:46 kim Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.289 2020/09/17 01:19:41 jakllsch Exp $");
 
 #include 
 #include 
@@ -401,7 +401,7 @@ scsi_probe_bus(struct scsibus_softc *sc,
 
 	/*
 	 * Some HBAs provide an abstracted view of the bus; give them an
-	 * oppertunity to re-scan it before we do.
+	 * opportunity to re-scan it before we do.
 	 */
 	scsipi_adapter_ioctl(chan, SCBUSIOLLSCAN, NULL, 0, curproc);
 
@@ -809,10 +809,10 @@ scsi_probe_device(struct scsibus_softc *
 	int locs[SCSIBUSCF_NLOCS];
 
 	/*
-	 * Assume no more luns to search after this one.
+	 * Assume no more LUNs to search after this one.
 	 * If we successfully get Inquiry data and after
 	 * merging quirks we find we can probe for more
-	 * luns, we will.
+	 * LUNs, we will.
 	 */
 	docontinue = 0;
 
@@ -893,7 +893,7 @@ scsi_probe_device(struct scsibus_softc *
 		break;
 	}
 
-	/* Let the adapter driver handle the device separatley if it wants. */
+	/* Let the adapter driver handle the device separately if it wants. */
 	if (chan->chan_adapter->adapt_accesschk != NULL &&
 	(*chan->chan_adapter->adapt_accesschk)(periph, &sa.sa_inqbuf))
 		goto bad;

Index: src/sys/dev/scsipi/scsipi_base.c
diff -u src/sys/dev/scsipi/scsipi_base.c:1.186 src/sys/dev/scsipi/scsipi_base.c:1.187
--- src/sys/dev/scsipi/scsipi_base.c:1.186	Mon Apr 13 00:27:17 2020
+++ src/sys/dev/scsipi/scsipi_base.c	Thu Sep 17 01:19:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipi_base.c,v 1.186 2020/04/13 00:27:17 chs Exp $	*/
+/*	$NetBSD: scsipi_base.c,v 1.187 2020/09/17 01:19:41 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.186 2020/04/13 00:27:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.187 2020/09/17 01:19:41 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -871,7 +871,7 @@ scsipi_print_cdb(struct scsipi_generic *
  *	Look at the returned sense and act on the error, determining
  *	the unix error number to pass back.  (0 = report no error)
  *
- *	NOTE: If we return ERESTART, we are expected to haved
+ *	NOTE: If we return ERESTART, we are expected to have
  *	thawed the device!
  *
  *	THIS IS THE DEFAULT ERROR HANDLER FOR SCSI DEVICES.
@@ -1208,7 +1208,7 @@ scsipi_inquire(struct scsipi_periph *per
 	 * If we request more data than the device can provide, it SHOULD just
 	 * return a short response.  However, some devices error with an
 	 * ILLEGAL REQUEST sense code, and yet others have even more special
-	 * failture modes (such as the GL641USB flash adapter, which goes loony
+	 * failure modes (such as the GL641USB flash adapter, which goes loony
 	 * and sends corrupted CRCs).  To work around this, and to bring our
 	 * behavior more in line with other OSes, we do a shorter inquiry,
 	 * covering all the SCSI-2 information, first, and then request more
@@ -1395,7 +1395,7 @@ scsipi_mode_select_big(struct scsipi_per
 /*
  * scsipi_get_opcodeinfo:
  *
- * query the device for supported commends and their timeout
+ * query the device for supported commands and their timeout
  * building a timeout lookup table if timeout information is available.
  */
 void
@@ -1514,7 +1514,7 @@ scsipi_get_opcodeinfo(struct scsipi_peri
 
 /*
  * scsipi_update_timeouts:
- * 	Overide timeout value if device/config provided
+ * 	Override timeout value if device/config provided
  *  timeouts are available.
  */
 static void
@@ -1665,9 +1665,9 @@ scsipi_done(struct scsipi_xfer *xs)
 		/*
 		 * If it's a polling job, just return, to unwind the
 		 * call graph.  We don't need to restart the queue,
-		 * because pollings jobs are treated specially, and
+		 * because polling jobs are treated specially, and
 		 * are really only used during crash dumps anyway
-		 * (XXX or during boot-time autconfiguration of
+		 * (XXX or during boot-time autoconfiguration of

CVS commit: src/distrib/sets/lists/base

2020-09-11 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep 11 15:21:49 UTC 2020

Modified Files:
src/distrib/sets/lists/base: ad.arm

Log Message:
Limit bootarm.efi expectation further.

Should fix iyonix, and zaurus builds.  Also probably fixes all oarm AKA
'arm' builds too.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/distrib/sets/lists/base/ad.arm

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/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.83 src/distrib/sets/lists/base/ad.arm:1.84
--- src/distrib/sets/lists/base/ad.arm:1.83	Thu Sep 10 15:17:23 2020
+++ src/distrib/sets/lists/base/ad.arm	Fri Sep 11 15:21:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.83 2020/09/10 15:17:23 jakllsch Exp $
+# $NetBSD: ad.arm,v 1.84 2020/09/11 15:21:48 jakllsch Exp $
 ./libexec/ld.elf_so-oabi			base-sysutil-bin	compat,pic
 ./sbin/ldconfig	base-sysutil-root	pic,endian=1234
 ./usr/bin/fdformatbase-util-bin
@@ -17,7 +17,7 @@
 ./usr/mdec/boot26,ffabase-obsolete		obsolete
 ./usr/mdec/boot32base-sysutil-bin	endian=1234
 ./usr/mdec/boot32,ffabase-sysutil-bin	endian=1234
-./usr/mdec/bootarm.efibase-sysutil-bin	!machine_arch=earmv4,!machine_arch=earmv4eb,!machine_arch=earmv5,!machine_arch=earmv5eb,!machine_arch=earmv5hf,!machine_arch=earmv5hfeb,!machine_arch=earmv6,!machine_arch=earmv6eb,!machine_arch=earmv6hf,!machine_arch=earmv6hfeb,!machine_arch=earmv7,!machine_arch=earmv7eb
+./usr/mdec/bootarm.efibase-sysutil-bin	machine=evbarm,!machine_arch=arm,!machine_arch=earm,!machine_arch=earmeb,!machine_arch=earmv4,!machine_arch=earmv4eb,!machine_arch=earmv5,!machine_arch=earmv5eb,!machine_arch=earmv5hf,!machine_arch=earmv5hfeb,!machine_arch=earmv6,!machine_arch=earmv6eb,!machine_arch=earmv6hf,!machine_arch=earmv6hfeb,!machine_arch=earmv7,!machine_arch=earmv7eb
 ./usr/mdec/bootimx23base-sysutil-bin	endian=1234
 ./usr/mdec/bootmini2440base-sysutil-bin
 ./usr/mdec/gzboot_ADI_BRH_0x0014.bin	base-sysutil-bin



CVS commit: src/distrib/sets/lists/base

2020-09-10 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 10 15:17:23 UTC 2020

Modified Files:
src/distrib/sets/lists/base: ad.arm

Log Message:
fix earmv7hfeb set list for bootarm.efi

Do this by explicitly marking all the non-earmv7hf* arm archs as not wanted,
because the set lists processor doesn't have a better way to be told.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/distrib/sets/lists/base/ad.arm

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/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.82 src/distrib/sets/lists/base/ad.arm:1.83
--- src/distrib/sets/lists/base/ad.arm:1.82	Tue Sep  8 16:39:36 2020
+++ src/distrib/sets/lists/base/ad.arm	Thu Sep 10 15:17:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.82 2020/09/08 16:39:36 jmcneill Exp $
+# $NetBSD: ad.arm,v 1.83 2020/09/10 15:17:23 jakllsch Exp $
 ./libexec/ld.elf_so-oabi			base-sysutil-bin	compat,pic
 ./sbin/ldconfig	base-sysutil-root	pic,endian=1234
 ./usr/bin/fdformatbase-util-bin
@@ -17,7 +17,7 @@
 ./usr/mdec/boot26,ffabase-obsolete		obsolete
 ./usr/mdec/boot32base-sysutil-bin	endian=1234
 ./usr/mdec/boot32,ffabase-sysutil-bin	endian=1234
-./usr/mdec/bootarm.efibase-sysutil-bin	machine_arch=earmv7hf
+./usr/mdec/bootarm.efibase-sysutil-bin	!machine_arch=earmv4,!machine_arch=earmv4eb,!machine_arch=earmv5,!machine_arch=earmv5eb,!machine_arch=earmv5hf,!machine_arch=earmv5hfeb,!machine_arch=earmv6,!machine_arch=earmv6eb,!machine_arch=earmv6hf,!machine_arch=earmv6hfeb,!machine_arch=earmv7,!machine_arch=earmv7eb
 ./usr/mdec/bootimx23base-sysutil-bin	endian=1234
 ./usr/mdec/bootmini2440base-sysutil-bin
 ./usr/mdec/gzboot_ADI_BRH_0x0014.bin	base-sysutil-bin



CVS commit: src/sys/stand/efiboot/bootaa64

2020-09-10 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep 10 14:30:15 UTC 2020

Modified Files:
src/sys/stand/efiboot/bootaa64: Makefile

Log Message:
bootaa64: explicitly set GNUEFIARCH and LIBGNUEFI_ARCH to aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/stand/efiboot/bootaa64/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/stand/efiboot/bootaa64/Makefile
diff -u src/sys/stand/efiboot/bootaa64/Makefile:1.9 src/sys/stand/efiboot/bootaa64/Makefile:1.10
--- src/sys/stand/efiboot/bootaa64/Makefile:1.9	Tue Sep  8 16:34:43 2020
+++ src/sys/stand/efiboot/bootaa64/Makefile	Thu Sep 10 14:30:14 2020
@@ -1,8 +1,10 @@
-# $NetBSD: Makefile,v 1.9 2020/09/08 16:34:43 jmcneill Exp $
+# $NetBSD: Makefile,v 1.10 2020/09/10 14:30:14 jakllsch Exp $
 
 PROG=		bootaa64.efi
 OBJFMT=		binary
 NEWVERSWHAT=	"efiboot (arm64)"
+GNUEFIARCH=	aarch64
+LIBGNUEFI_ARCH=	aarch64
 
 EXTRA_SOURCES=	efibootaa64.c
 EXTRA_SOURCES+=	cache.S



CVS commit: src/common/lib/libc/arch/aarch64/string

2020-09-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  9 14:49:27 UTC 2020

Modified Files:
src/common/lib/libc/arch/aarch64/string: strlen.S

Log Message:
Re-do previous aarch64eb strlen fix more simply and correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/aarch64/string/strlen.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/string/strlen.S
diff -u src/common/lib/libc/arch/aarch64/string/strlen.S:1.4 src/common/lib/libc/arch/aarch64/string/strlen.S:1.5
--- src/common/lib/libc/arch/aarch64/string/strlen.S:1.4	Sat Sep  5 20:24:43 2020
+++ src/common/lib/libc/arch/aarch64/string/strlen.S	Wed Sep  9 14:49:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: strlen.S,v 1.4 2020/09/05 20:24:43 jakllsch Exp $ */
+/* $NetBSD: strlen.S,v 1.5 2020/09/09 14:49:27 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-RCSID("$NetBSD: strlen.S,v 1.4 2020/09/05 20:24:43 jakllsch Exp $")
+RCSID("$NetBSD: strlen.S,v 1.5 2020/09/09 14:49:27 jakllsch Exp $")
 
 #ifdef STRNLEN
 #define FUNCNAME	strnlen
@@ -66,12 +66,11 @@ ENTRY(FUNCNAME)
 	 */
 	add	x4, x4, x0		/* make dword aligned */
 	ldr	x7, [x4], #8		/* load dword */
-	lsl	x3, x3, #3		/* convert bytes to bits */
 #ifdef __AARCH64EB__
-	lsr	x5, x11, x3		/* make mask for BE */
-#else
-	lsl	x5, x11, x3		/* make mask for LE */
+	rev	x7, x7			/* convert to LE */
 #endif
+	lsl	x3, x3, #3		/* convert bytes to bits */
+	lsl	x5, x11, x3		/* make mask for LE */
 	eor	x5, x5, x11		/* invert mask */
 	orr	x7, x7, x5		/* prevent NULs */
 	b	.Lstrlen_dword_loop_noload
@@ -82,6 +81,9 @@ ENTRY(FUNCNAME)
 	b.hs	.Lstrlen_done
 #endif
 	ldr	x7, [x4], #8		/* load dword */
+#ifdef __AARCH64EB__
+	rev	x7, x7			/* convert to LE */
+#endif
 .Lstrlen_dword_loop_noload:
 	/*
 	 * Use the formula (X - 1) & ~(X | 0x7f) to find NUL bytes.
@@ -96,14 +98,6 @@ ENTRY(FUNCNAME)
 	/*
 	 * We know there is a NUL in this dword.  Use clz to find it.
 	 */
-#ifdef __AARCH64EB__
-	/* avoid BE problem due to carry propagation if last non-NUL is \x01 */
-	ldr	x7, [x4, #-8]		/* reload dword */
-	rev	x7, x7			/* byte swap */
-	sub	x6, x7, x11		/* a = X - 1 */
-	orr	x7, x7, #MASK8_0x7f	/* b = X | 0x7f */
-	bic	x6, x6, x7		/* a & ~b */
-#endif
 	rev	x6, x6			/* convert to BE */
 	clz	x6, x6			/* find null byte */
 	add	x0, x0, x6, lsr #3	/* add offset to the length */



CVS commit: src/sys/dev/pci

2020-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  9 00:35:36 UTC 2020

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

Log Message:
fix bad conditional in iavf_parse_modprop()

found by clang


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_iavf.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_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.2 src/sys/dev/pci/if_iavf.c:1.3
--- src/sys/dev/pci/if_iavf.c:1.2	Tue Sep  8 13:28:51 2020
+++ src/sys/dev/pci/if_iavf.c	Wed Sep  9 00:35:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iavf.c,v 1.2 2020/09/08 13:28:51 jakllsch Exp $	*/
+/*	$NetBSD: if_iavf.c,v 1.3 2020/09/09 00:35:36 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.2 2020/09/08 13:28:51 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.3 2020/09/09 00:35:36 jakllsch Exp $");
 
 #include 
 #include 
@@ -5235,7 +5235,7 @@ iavf_parse_modprop(prop_dictionary_t dic
 	if (obj != NULL && prop_object_type(obj) == PROP_TYPE_NUMBER) {
 		val = prop_number_signed_value((prop_number_t)obj);
 
-		if (val < 1 || I40E_MAX_VF_QUEUES) {
+		if (val < 1 || val > I40E_MAX_VF_QUEUES) {
 			printf("iavf: invalid queue size(1 <= n <= %d)",
 			I40E_MAX_VF_QUEUES);
 		} else {



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

2020-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Sep  8 17:39:04 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: std.generic64

Log Message:
Enable __BUS_SPACE_HAS_STREAM_METHODS in std.generic64

These are needed for virtio_pci on aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/conf/std.generic64

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.generic64
diff -u src/sys/arch/evbarm/conf/std.generic64:1.12 src/sys/arch/evbarm/conf/std.generic64:1.13
--- src/sys/arch/evbarm/conf/std.generic64:1.12	Sat Dec  7 16:00:09 2019
+++ src/sys/arch/evbarm/conf/std.generic64	Tue Sep  8 17:39:04 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: std.generic64,v 1.12 2019/12/07 16:00:09 jmcneill Exp $
+#	$NetBSD: std.generic64,v 1.13 2020/09/08 17:39:04 jakllsch Exp $
 #
 #	generic NetBSD/evbarm64 with FDT support
 
@@ -24,6 +24,7 @@ options 	__HAVE_GENERIC_CPU_INITCLOCKS
 options 	__HAVE_PCI_CONF_HOOK
 options 	__HAVE_PCI_MSI_MSIX
 options 	__BUS_SPACE_HAS_PROBING_METHODS
+options 	__BUS_SPACE_HAS_STREAM_METHODS
 
 # XXXNH not yet
 #options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP



CVS commit: src

2020-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Sep  8 17:35:27 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: files.aesneon
src/sys/crypto/chacha/arch/arm: files.chacha_arm
src/tests/sys/crypto/aes: Makefile
src/tests/sys/crypto/chacha: Makefile

Log Message:
Acknowledge clang warning for NEON cipher code on aarch64eb

We've already made the nonportable vector initializations portable; the
code works on aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/crypto/aes/arch/arm/files.aesneon
cvs rdiff -u -r1.4 -r1.5 src/sys/crypto/chacha/arch/arm/files.chacha_arm
cvs rdiff -u -r1.5 -r1.6 src/tests/sys/crypto/aes/Makefile
cvs rdiff -u -r1.5 -r1.6 src/tests/sys/crypto/chacha/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/crypto/aes/arch/arm/files.aesneon
diff -u src/sys/crypto/aes/arch/arm/files.aesneon:1.4 src/sys/crypto/aes/arch/arm/files.aesneon:1.5
--- src/sys/crypto/aes/arch/arm/files.aesneon:1.4	Sun Aug 16 18:02:03 2020
+++ src/sys/crypto/aes/arch/arm/files.aesneon	Tue Sep  8 17:35:27 2020
@@ -1,8 +1,10 @@
-#	$NetBSD: files.aesneon,v 1.4 2020/08/16 18:02:03 riastradh Exp $
+#	$NetBSD: files.aesneon,v 1.5 2020/09/08 17:35:27 jakllsch Exp $
 
 ifdef aarch64
 makeoptions	aes	"COPTS.aes_neon.c"+="-march=armv8-a"
 makeoptions	aes	"COPTS.aes_neon_subr.c"+="-march=armv8-a"
+makeoptions	aes	"CWARNFLAGS.aes_neon.c"+="${${ACTIVE_CC} == clang :? -Wno-nonportable-vector-initialization :}"
+makeoptions	aes	"CWARNFLAGS.aes_neon_subr.c"+="${${ACTIVE_CC} == clang :? -Wno-nonportable-vector-initialization :}"
 else
 makeoptions	aes	"COPTS.aes_neon.c"+="-mfloat-abi=softfp -mfpu=neon"
 makeoptions	aes	"COPTS.aes_neon_subr.c"+="-mfloat-abi=softfp -mfpu=neon"

Index: src/sys/crypto/chacha/arch/arm/files.chacha_arm
diff -u src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.4 src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.5
--- src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.4	Tue Sep  8 17:17:32 2020
+++ src/sys/crypto/chacha/arch/arm/files.chacha_arm	Tue Sep  8 17:35:27 2020
@@ -1,7 +1,8 @@
-#	$NetBSD: files.chacha_arm,v 1.4 2020/09/08 17:17:32 jakllsch Exp $
+#	$NetBSD: files.chacha_arm,v 1.5 2020/09/08 17:35:27 jakllsch Exp $
 
 ifdef aarch64
 makeoptions	chacha	"COPTS.chacha_neon.c"+="-march=armv8-a"
+makeoptions	chacha	"CWARNFLAGS.chacha_neon.c"+="${${ACTIVE_CC} == clang :? -Wno-nonportable-vector-initialization :}"
 else
 makeoptions	chacha	"COPTS.chacha_neon.c"+="-mfloat-abi=softfp -mfpu=neon"
 endif

Index: src/tests/sys/crypto/aes/Makefile
diff -u src/tests/sys/crypto/aes/Makefile:1.5 src/tests/sys/crypto/aes/Makefile:1.6
--- src/tests/sys/crypto/aes/Makefile:1.5	Mon Aug 17 16:26:02 2020
+++ src/tests/sys/crypto/aes/Makefile	Tue Sep  8 17:35:27 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2020/08/17 16:26:02 riastradh Exp $
+#	$NetBSD: Makefile,v 1.6 2020/09/08 17:35:27 jakllsch Exp $
 
 .include 
 
@@ -29,9 +29,13 @@ SRCS.t_aes+=	aes_armv8.c
 SRCS.t_aes+=	aes_armv8_64.S
 .endif
 
+CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION= ${${ACTIVE_CC} == "clang":? -Wno-nonportable-vector-initialization :}
+
 SRCS.t_aes+=	aes_neon.c
+COPTS.aes_neon.c+=${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
 SRCS.t_aes+=	aes_neon_impl.c
 SRCS.t_aes+=	aes_neon_subr.c
+COPTS.aes_neon_subr.c+=${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
 .if !empty(MACHINE_ARCH:Mearmv7*)
 SRCS.t_aes+=	aes_neon_32.S
 .endif

Index: src/tests/sys/crypto/chacha/Makefile
diff -u src/tests/sys/crypto/chacha/Makefile:1.5 src/tests/sys/crypto/chacha/Makefile:1.6
--- src/tests/sys/crypto/chacha/Makefile:1.5	Mon Aug 17 16:26:02 2020
+++ src/tests/sys/crypto/chacha/Makefile	Tue Sep  8 17:35:27 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2020/08/17 16:26:02 riastradh Exp $
+#	$NetBSD: Makefile,v 1.6 2020/09/08 17:35:27 jakllsch Exp $
 
 .include 
 
@@ -21,7 +21,10 @@ SRCS.t_chacha+=	chacha_selftest.c
 .PATH:	${NETBSDSRCDIR}/sys/crypto/chacha/arch/arm
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys/crypto/chacha/arch/arm
 
+CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION= ${${ACTIVE_CC} == "clang":? -Wno-nonportable-vector-initialization :}
+
 SRCS.t_chacha+=	chacha_neon.c
+COPTS.chacha_neon.c+=	${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
 .if !empty(MACHINE_ARCH:Mearmv7*)
 SRCS.t_chacha+=	chacha_neon_32.S
 .elif !empty(MACHINE_ARCH:Maarch64*)



CVS commit: src/sys/crypto/chacha/arch/arm

2020-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Sep  8 17:17:32 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: files.chacha_arm

Log Message:
use correct condition


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/crypto/chacha/arch/arm/files.chacha_arm

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

Modified files:

Index: src/sys/crypto/chacha/arch/arm/files.chacha_arm
diff -u src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.3 src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.4
--- src/sys/crypto/chacha/arch/arm/files.chacha_arm:1.3	Tue Jul 28 20:08:48 2020
+++ src/sys/crypto/chacha/arch/arm/files.chacha_arm	Tue Sep  8 17:17:32 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: files.chacha_arm,v 1.3 2020/07/28 20:08:48 riastradh Exp $
+#	$NetBSD: files.chacha_arm,v 1.4 2020/09/08 17:17:32 jakllsch Exp $
 
 ifdef aarch64
 makeoptions	chacha	"COPTS.chacha_neon.c"+="-march=armv8-a"
 else
-makeoptions	aes	"COPTS.chacha_neon.c"+="-mfloat-abi=softfp -mfpu=neon"
+makeoptions	chacha	"COPTS.chacha_neon.c"+="-mfloat-abi=softfp -mfpu=neon"
 endif
 
 file	crypto/chacha/arch/arm/chacha_neon.c	chacha & (cpu_cortex | aarch64)



CVS commit: src/sys/dev/pci

2020-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Sep  8 13:28:51 UTC 2020

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

Log Message:
iaq_datalen is 16-bit, always use htole16

fixes build failure on big endian


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/if_iavf.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_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.1 src/sys/dev/pci/if_iavf.c:1.2
--- src/sys/dev/pci/if_iavf.c:1.1	Tue Sep  8 10:05:47 2020
+++ src/sys/dev/pci/if_iavf.c	Tue Sep  8 13:28:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iavf.c,v 1.1 2020/09/08 10:05:47 yamaguchi Exp $	*/
+/*	$NetBSD: if_iavf.c,v 1.2 2020/09/08 13:28:51 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.1 2020/09/08 10:05:47 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.2 2020/09/08 13:28:51 jakllsch Exp $");
 
 #include 
 #include 
@@ -4734,7 +4734,7 @@ iavf_config_hena(struct iavf_softc *sc)
 	iaq.iaq_flags = htole16(IXL_AQ_BUF | IXL_AQ_RD);
 	iaq.iaq_opcode = htole16(IAVF_AQ_OP_SEND_TO_PF);
 	iavf_aq_vc_set_opcode(&iaq, IAVF_VC_OP_SET_RSS_HENA);
-	iaq.iaq_datalen = htole32(sizeof(*caps));
+	iaq.iaq_datalen = htole16(sizeof(*caps));
 
 	error = iavf_adminq_exec(sc, &iaq, aqb);
 	if (error != IAVF_VC_RC_SUCCESS) {
@@ -4781,7 +4781,7 @@ iavf_config_rss_key(struct iavf_softc *s
 	iaq.iaq_flags = htole16(IXL_AQ_BUF | IXL_AQ_RD);
 	iaq.iaq_opcode = htole16(IAVF_AQ_OP_SEND_TO_PF);
 	iavf_aq_vc_set_opcode(&iaq, IAVF_VC_OP_CONFIG_RSS_KEY);
-	iaq.iaq_datalen = htole32(sizeof(*rss_key) - sizeof(rss_key->pad)
+	iaq.iaq_datalen = htole16(sizeof(*rss_key) - sizeof(rss_key->pad)
 	+ (sizeof(rss_key->key[0]) * key_len));
 
 	rv = iavf_adminq_exec(sc, &iaq, aqb);
@@ -4823,7 +4823,7 @@ iavf_config_rss_lut(struct iavf_softc *s
 	iaq.iaq_flags = htole16(IXL_AQ_BUF | IXL_AQ_RD);
 	iaq.iaq_opcode = htole16(IAVF_AQ_OP_SEND_TO_PF);
 	iavf_aq_vc_set_opcode(&iaq, IAVF_VC_OP_CONFIG_RSS_LUT);
-	iaq.iaq_datalen = htole32(sizeof(*rss_lut) - sizeof(rss_lut->pad)
+	iaq.iaq_datalen = htole16(sizeof(*rss_lut) - sizeof(rss_lut->pad)
 	+ (sizeof(rss_lut->lut[0]) * IXL_RSS_VSI_LUT_SIZE));
 
 	rv = iavf_adminq_exec(sc, &iaq, aqb);



CVS commit: src/sys/crypto

2020-09-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Sep  7 18:06:13 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: arm_neon.h
src/sys/crypto/chacha/arch/arm: arm_neon.h

Log Message:
Fix vgetq_lane_u32 for aarch64eb with GCC

Fixes NEON AES on aarch64eb


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/crypto/aes/arch/arm/arm_neon.h
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/chacha/arch/arm/arm_neon.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/crypto/aes/arch/arm/arm_neon.h
diff -u src/sys/crypto/aes/arch/arm/arm_neon.h:1.10 src/sys/crypto/aes/arch/arm/arm_neon.h:1.11
--- src/sys/crypto/aes/arch/arm/arm_neon.h:1.10	Sun Aug  9 02:49:38 2020
+++ src/sys/crypto/aes/arch/arm/arm_neon.h	Mon Sep  7 18:06:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm_neon.h,v 1.10 2020/08/09 02:49:38 riastradh Exp $	*/
+/*	$NetBSD: arm_neon.h,v 1.11 2020/09/07 18:06:13 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -232,7 +232,7 @@ static __inline uint32_t
 vgetq_lane_u32(uint32x4_t __v, uint8_t __i)
 {
 #ifdef __aarch64__
-	return __v[__i];
+	return __v[__neon_laneq_index(__v,__i)];
 #else
 	return (uint32_t)__builtin_neon_vget_laneuv4si((int32x4_t)__v, __i);
 #endif

Index: src/sys/crypto/chacha/arch/arm/arm_neon.h
diff -u src/sys/crypto/chacha/arch/arm/arm_neon.h:1.6 src/sys/crypto/chacha/arch/arm/arm_neon.h:1.7
--- src/sys/crypto/chacha/arch/arm/arm_neon.h:1.6	Sun Aug  9 02:49:38 2020
+++ src/sys/crypto/chacha/arch/arm/arm_neon.h	Mon Sep  7 18:06:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm_neon.h,v 1.6 2020/08/09 02:49:38 riastradh Exp $	*/
+/*	$NetBSD: arm_neon.h,v 1.7 2020/09/07 18:06:13 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -232,7 +232,7 @@ static __inline uint32_t
 vgetq_lane_u32(uint32x4_t __v, uint8_t __i)
 {
 #ifdef __aarch64__
-	return __v[__i];
+	return __v[__neon_laneq_index(__v, __i)];
 #else
 	return (uint32_t)__builtin_neon_vget_laneuv4si((int32x4_t)__v, __i);
 #endif



CVS commit: src/sys/crypto/chacha/arch/arm

2020-09-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Sep  7 18:05:17 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_64.S

Log Message:
Use a working macro to detect big endian aarch64.

Fixes aarch64eb NEON ChaCha.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/crypto/chacha/arch/arm/chacha_neon_64.S

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

Modified files:

Index: src/sys/crypto/chacha/arch/arm/chacha_neon_64.S
diff -u src/sys/crypto/chacha/arch/arm/chacha_neon_64.S:1.6 src/sys/crypto/chacha/arch/arm/chacha_neon_64.S:1.7
--- src/sys/crypto/chacha/arch/arm/chacha_neon_64.S:1.6	Sat Aug  8 14:47:01 2020
+++ src/sys/crypto/chacha/arch/arm/chacha_neon_64.S	Mon Sep  7 18:05:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chacha_neon_64.S,v 1.6 2020/08/08 14:47:01 riastradh Exp $	*/
+/*	$NetBSD: chacha_neon_64.S,v 1.7 2020/09/07 18:05:17 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: chacha_neon_64.S,v 1.6 2020/08/08 14:47:01 riastradh Exp $")
+RCSID("$NetBSD: chacha_neon_64.S,v 1.7 2020/09/07 18:05:17 jakllsch Exp $")
 
 #define	ROUND(a0,b0,c0,d0,a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,t0,t1,t2,t3, r) \
 STEP(STEP0,a0,b0,c0,d0,a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,t0,t1,t2,t3, r);   \
@@ -130,12 +130,12 @@ STEP(STEP19,a0,b0,c0,d0,a1,b1,c1,d1,a2,b
 #define	STEP19(a,b,c,d, t, r)	/* nothing */
 #endif
 
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-#define	HTOLE32(x)
-#define	LE32TOH(x)
-#elif _BYTE_ORDER == _BIG_ENDIAN
+#if defined(__AARCH64EB__)
 #define	HTOLE32(x)	rev32	x, x
 #define	LE32TOH(x)	rev32	x, x
+#else
+#define	LE32TOH(x)
+#define	HTOLE32(x)
 #endif
 
 /*



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

2020-09-07 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Sep  7 13:19:20 UTC 2020

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
Fix printb string for LA57


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/arch/x86/include/specialreg.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/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.174 src/sys/arch/x86/include/specialreg.h:1.175
--- src/sys/arch/x86/include/specialreg.h:1.174	Mon Sep  7 03:03:09 2020
+++ src/sys/arch/x86/include/specialreg.h	Mon Sep  7 13:19:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.174 2020/09/07 03:03:09 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.175 2020/09/07 13:19:20 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -470,7 +470,7 @@
 	"b\4OSPKE\0"	"b\5WAITPKG\0"	"b\6AVX512_VBMI2\0" "b\7CET_SS\0" \
 	"b\10GFNI\0"	"b\11VAES\0"	"b\12VPCLMULQDQ\0" "b\13AVX512_VNNI\0"\
 	"b\14AVX512_BITALG\0"		"b\16AVX512_VPOPCNTDQ\0"	\
-	"b\20\LA57\0"			\
+	"b\20LA57\0"			\
 	"f\21\5MAWAU\0"			\
 	"b\26RDPID\0"			\
 			"b\31CLDEMOTE\0"		"b\33MOVDIRI\0"	\



CVS commit: src/external/gpl3/gcc

2020-09-06 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep  6 23:23:22 UTC 2020

Modified Files:
src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb:
backtrace-supported.h config.h
src/external/gpl3/gcc/lib/libgcc/libgcov/arch/aarch64eb: defs.mk
gcov-iov.h
src/external/gpl3/gcc/lib/libgomp/arch/aarch64eb: config.h libgomp_f.h
omp.h
src/external/gpl3/gcc/lib/libiberty/arch/aarch64eb: config.h
src/external/gpl3/gcc/lib/libobjc/arch/aarch64eb: config.h defs.mk
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64eb: c++config.h
cxxabi_tweaks.h defs.mk gstdint.h symver-config.h
src/external/gpl3/gcc/usr.bin/common-target/arch: aarch64eb.mk
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb: all-tree.def
auto-host.h bversion.h configargs.h defs.mk gtyp-input.list
insn-modes.h plugin-version.h
src/external/gpl3/gcc/usr.bin/libcpp/arch/aarch64eb: config.h

Log Message:
mknative-gcc for gcc 9.3.0 and aarch64eb


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/backtrace-supported.h 
\
src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/config.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/lib/libgcc/libgcov/arch/aarch64eb/defs.mk \
src/external/gpl3/gcc/lib/libgcc/libgcov/arch/aarch64eb/gcov-iov.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/lib/libgomp/arch/aarch64eb/config.h \
src/external/gpl3/gcc/lib/libgomp/arch/aarch64eb/libgomp_f.h \
src/external/gpl3/gcc/lib/libgomp/arch/aarch64eb/omp.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/lib/libiberty/arch/aarch64eb/config.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/lib/libobjc/arch/aarch64eb/config.h \
src/external/gpl3/gcc/lib/libobjc/arch/aarch64eb/defs.mk
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64eb/c++config.h \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64eb/cxxabi_tweaks.h \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64eb/defs.mk \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64eb/gstdint.h \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64eb/symver-config.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/usr.bin/common-target/arch/aarch64eb.mk
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/all-tree.def \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/auto-host.h \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/bversion.h \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/configargs.h \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/defs.mk \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/gtyp-input.list \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/insn-modes.h \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64eb/plugin-version.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/usr.bin/libcpp/arch/aarch64eb/config.h

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

Modified files:

Index: src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/backtrace-supported.h
diff -u src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/backtrace-supported.h:1.1 src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/backtrace-supported.h:1.2
--- src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/backtrace-supported.h:1.1	Fri Sep  4 02:29:54 2020
+++ src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/backtrace-supported.h	Sun Sep  6 23:23:21 2020
@@ -1,9 +1,9 @@
 /* This file is automatically generated.  DO NOT EDIT! */
-/* Generated from: NetBSD: mknative-gcc,v 1.105 2020/08/13 01:52:37 mrg Exp  */
+/* Generated from: NetBSD: mknative-gcc,v 1.109 2020/09/06 02:24:38 mrg Exp  */
 /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
 
 /* backtrace-supported.h.in -- Whether stack backtrace is supported.
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2019 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
 
 Redistribution and use in source and binary forms, with or without
Index: src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/config.h
diff -u src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/config.h:1.1 src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/config.h:1.2
--- src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/config.h:1.1	Fri Sep  4 02:29:54 2020
+++ src/external/gpl3/gcc/lib/libbacktrace/arch/aarch64eb/config.h	Sun Sep  6 23:23:21 2020
@@ -1,5 +1,5 @@
 /* This file is automatically generated.  DO NOT EDIT! */
-/* Generated from: NetBSD: mknative-gcc,v 1.105 2020/08/13 01:52:37 mrg Exp  */
+/* Generated from: NetBSD: mknative-gcc,v 1.109 2020/09/06 02:24:38 mrg Exp  */
 /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
 
 

CVS commit: src/common/lib/libc/arch/aarch64/string

2020-09-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Sep  5 20:24:43 UTC 2020

Modified Files:
src/common/lib/libc/arch/aarch64/string: strlen.S

Log Message:
Fix a broken corner case of strlen()/strnlen() on aarch64eb

Previously a string such as "\x1\x1\x1\x1\x1\x1\x1" would count as
0 instead of 7 on BE.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/aarch64/string/strlen.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/string/strlen.S
diff -u src/common/lib/libc/arch/aarch64/string/strlen.S:1.3 src/common/lib/libc/arch/aarch64/string/strlen.S:1.4
--- src/common/lib/libc/arch/aarch64/string/strlen.S:1.3	Wed Aug  1 17:09:26 2018
+++ src/common/lib/libc/arch/aarch64/string/strlen.S	Sat Sep  5 20:24:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: strlen.S,v 1.3 2018/08/01 17:09:26 ryo Exp $ */
+/* $NetBSD: strlen.S,v 1.4 2020/09/05 20:24:43 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-RCSID("$NetBSD: strlen.S,v 1.3 2018/08/01 17:09:26 ryo Exp $")
+RCSID("$NetBSD: strlen.S,v 1.4 2020/09/05 20:24:43 jakllsch Exp $")
 
 #ifdef STRNLEN
 #define FUNCNAME	strnlen
@@ -96,9 +96,15 @@ ENTRY(FUNCNAME)
 	/*
 	 * We know there is a NUL in this dword.  Use clz to find it.
 	 */
-#ifdef __AARCH64EL__
-	rev	x6, x6			/* convert to BE */
+#ifdef __AARCH64EB__
+	/* avoid BE problem due to carry propagation if last non-NUL is \x01 */
+	ldr	x7, [x4, #-8]		/* reload dword */
+	rev	x7, x7			/* byte swap */
+	sub	x6, x7, x11		/* a = X - 1 */
+	orr	x7, x7, #MASK8_0x7f	/* b = X | 0x7f */
+	bic	x6, x6, x7		/* a & ~b */
 #endif
+	rev	x6, x6			/* convert to BE */
 	clz	x6, x6			/* find null byte */
 	add	x0, x0, x6, lsr #3	/* add offset to the length */
 



CVS commit: src/sys/arch/aarch64/aarch64

2020-09-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Sep  5 17:49:26 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: locore_el2.S start.S

Log Message:
aarch64: switch CPU to the kernel's byte order during boot


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/locore_el2.S
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/start.S

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/aarch64/aarch64/locore_el2.S
diff -u src/sys/arch/aarch64/aarch64/locore_el2.S:1.4 src/sys/arch/aarch64/aarch64/locore_el2.S:1.5
--- src/sys/arch/aarch64/aarch64/locore_el2.S:1.4	Sat Aug 29 07:17:23 2020
+++ src/sys/arch/aarch64/aarch64/locore_el2.S	Sat Sep  5 17:49:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_el2.S,v 1.4 2020/08/29 07:17:23 maxv Exp $	*/
+/*	$NetBSD: locore_el2.S,v 1.5 2020/09/05 17:49:26 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2012-2014 Andrew Turner
@@ -32,7 +32,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore_el2.S,v 1.4 2020/08/29 07:17:23 maxv Exp $")
+RCSID("$NetBSD: locore_el2.S,v 1.5 2020/09/05 17:49:26 jakllsch Exp $")
 
 /*
  * For use in #include "locore_el2.S".
@@ -75,6 +75,9 @@ in_el2:
 
 	/* Set the bits that need to be 1 in SCTLR_EL1. */
 	ldr	x2, .Lsctlr_res1
+#ifdef __AARCH64EB__
+	orr	x2, x2, #SCTLR_EE
+#endif
 	msr	sctlr_el1, x2
 
 	/* Don't trap to EL2 on FP instructions. */

Index: src/sys/arch/aarch64/aarch64/start.S
diff -u src/sys/arch/aarch64/aarch64/start.S:1.8 src/sys/arch/aarch64/aarch64/start.S:1.9
--- src/sys/arch/aarch64/aarch64/start.S:1.8	Thu Jul 16 11:36:35 2020
+++ src/sys/arch/aarch64/aarch64/start.S	Sat Sep  5 17:49:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: start.S,v 1.8 2020/07/16 11:36:35 skrll Exp $	*/
+/*	$NetBSD: start.S,v 1.9 2020/09/05 17:49:26 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -31,8 +31,9 @@
 #include 
 
 #include 
+#include "assym.h"
 
-RCSID("$NetBSD: start.S,v 1.8 2020/07/16 11:36:35 skrll Exp $")
+RCSID("$NetBSD: start.S,v 1.9 2020/09/05 17:49:26 jakllsch Exp $")
 
 /*
  * Padding at start of kernel image to make room for 64-byte header
@@ -45,6 +46,32 @@ RCSID("$NetBSD: start.S,v 1.8 2020/07/16
  */
 	.global start
 start:
+	mrs	x8, CurrentEL
+	lsr	x8, x8, #2
+	cmp	x8, #0x2
+	b.lo	1f
+
+	mrs	x8, sctlr_el2
+#ifdef __AARCH64EB__
+	orr	x8, x8, #SCTLR_EE	/* set: Big Endian */
+#else
+	bic	x8, x8, #SCTLR_EE	/* clear: Little Endian */
+#endif
+	msr	sctlr_el2, x8
+	isb
+	b	2f
+
+1:
+	mrs	x8, sctlr_el1
+#ifdef __AARCH64EB__
+	orr	x8, x8, #SCTLR_EE	/* set: Big Endian */
+#else
+	bic	x8, x8, #SCTLR_EE	/* clear: Little Endian */
+#endif
+	msr	sctlr_el1, x8
+	isb
+
+2:
 	adr	x9, start
 	ldr	x10, =start
 



CVS commit: src/sys/arch/aarch64/aarch64

2020-09-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Sep  5 16:44:54 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: bus_space.c

Log Message:
Adjust aarch64 bus_space tags to also work on aarch64eb


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/bus_space.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/bus_space.c
diff -u src/sys/arch/aarch64/aarch64/bus_space.c:1.9 src/sys/arch/aarch64/aarch64/bus_space.c:1.10
--- src/sys/arch/aarch64/aarch64/bus_space.c:1.9	Sat Dec 28 17:19:43 2019
+++ src/sys/arch/aarch64/aarch64/bus_space.c	Sat Sep  5 16:44:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.9 2019/12/28 17:19:43 jmcneill Exp $ */
+/* $NetBSD: bus_space.c,v 1.10 2020/09/05 16:44:54 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.9 2019/12/28 17:19:43 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.10 2020/09/05 16:44:54 jakllsch Exp $");
 
 #include 
 #include 
@@ -43,6 +43,12 @@ __KERNEL_RCSID(1, "$NetBSD: bus_space.c,
 bs_protos(generic)
 bs_protos(generic_dsb)
 
+#if __AARCH64EB__
+#define NSWAP(n)	n ## _swap
+#else
+#define NSWAP(n)	n
+#endif
+
 struct bus_space arm_generic_bs_tag = {
 	.bs_cookie = &arm_generic_bs_tag,
 
@@ -60,27 +66,27 @@ struct bus_space arm_generic_bs_tag = {
 
 	/* read */
 	.bs_r_1 = generic_bs_r_1,
-	.bs_r_2 = generic_bs_r_2,
-	.bs_r_4 = generic_bs_r_4,
-	.bs_r_8 = generic_bs_r_8,
+	.bs_r_2 = NSWAP(generic_bs_r_2),
+	.bs_r_4 = NSWAP(generic_bs_r_4),
+	.bs_r_8 = NSWAP(generic_bs_r_8),
 
 	/* write */
 	.bs_w_1 = generic_bs_w_1,
-	.bs_w_2 = generic_bs_w_2,
-	.bs_w_4 = generic_bs_w_4,
-	.bs_w_8 = generic_bs_w_8,
+	.bs_w_2 = NSWAP(generic_bs_w_2),
+	.bs_w_4 = NSWAP(generic_bs_w_4),
+	.bs_w_8 = NSWAP(generic_bs_w_8),
 
 	/* read region */
 	.bs_rr_1 = generic_bs_rr_1,
-	.bs_rr_2 = generic_bs_rr_2,
-	.bs_rr_4 = generic_bs_rr_4,
-	.bs_rr_8 = generic_bs_rr_8,
+	.bs_rr_2 = NSWAP(generic_bs_rr_2),
+	.bs_rr_4 = NSWAP(generic_bs_rr_4),
+	.bs_rr_8 = NSWAP(generic_bs_rr_8),
 
 	/* write region */
 	.bs_wr_1 = generic_bs_wr_1,
-	.bs_wr_2 = generic_bs_wr_2,
-	.bs_wr_4 = generic_bs_wr_4,
-	.bs_wr_8 = generic_bs_wr_8,
+	.bs_wr_2 = NSWAP(generic_bs_wr_2),
+	.bs_wr_4 = NSWAP(generic_bs_wr_4),
+	.bs_wr_8 = NSWAP(generic_bs_wr_8),
 
 	/* copy region */
 	.bs_c_1 = generic_bs_c_1,
@@ -90,27 +96,27 @@ struct bus_space arm_generic_bs_tag = {
 
 	/* set region */
 	.bs_sr_1 = generic_bs_sr_1,
-	.bs_sr_2 = generic_bs_sr_2,
-	.bs_sr_4 = generic_bs_sr_4,
-	.bs_sr_8 = generic_bs_sr_8,
+	.bs_sr_2 = NSWAP(generic_bs_sr_2),
+	.bs_sr_4 = NSWAP(generic_bs_sr_4),
+	.bs_sr_8 = NSWAP(generic_bs_sr_8),
 
 	/* read multi */
 	.bs_rm_1 = generic_bs_rm_1,
-	.bs_rm_2 = generic_bs_rm_2,
-	.bs_rm_4 = generic_bs_rm_4,
-	.bs_rm_8 = generic_bs_rm_8,
+	.bs_rm_2 = NSWAP(generic_bs_rm_2),
+	.bs_rm_4 = NSWAP(generic_bs_rm_4),
+	.bs_rm_8 = NSWAP(generic_bs_rm_8),
 
 	/* write multi */
 	.bs_wm_1 = generic_bs_wm_1,
-	.bs_wm_2 = generic_bs_wm_2,
-	.bs_wm_4 = generic_bs_wm_4,
-	.bs_wm_8 = generic_bs_wm_8,
+	.bs_wm_2 = NSWAP(generic_bs_wm_2),
+	.bs_wm_4 = NSWAP(generic_bs_wm_4),
+	.bs_wm_8 = NSWAP(generic_bs_wm_8),
 
 	/* set multi */
 	.bs_sm_1 = generic_bs_sm_1,
-	.bs_sm_2 = generic_bs_sm_2,
-	.bs_sm_4 = generic_bs_sm_4,
-	.bs_sm_8 = generic_bs_sm_8,
+	.bs_sm_2 = NSWAP(generic_bs_sm_2),
+	.bs_sm_4 = NSWAP(generic_bs_sm_4),
+	.bs_sm_8 = NSWAP(generic_bs_sm_8),
 
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
 	/* read stream */
@@ -182,27 +188,27 @@ struct bus_space aarch64_generic_dsb_bs_
 
 	/* read */
 	.bs_r_1 = generic_dsb_bs_r_1,
-	.bs_r_2 = generic_dsb_bs_r_2,
-	.bs_r_4 = generic_dsb_bs_r_4,
-	.bs_r_8 = generic_dsb_bs_r_8,
+	.bs_r_2 = NSWAP(generic_dsb_bs_r_2),
+	.bs_r_4 = NSWAP(generic_dsb_bs_r_4),
+	.bs_r_8 = NSWAP(generic_dsb_bs_r_8),
 
 	/* write */
 	.bs_w_1 = generic_dsb_bs_w_1,
-	.bs_w_2 = generic_dsb_bs_w_2,
-	.bs_w_4 = generic_dsb_bs_w_4,
-	.bs_w_8 = generic_dsb_bs_w_8,
+	.bs_w_2 = NSWAP(generic_dsb_bs_w_2),
+	.bs_w_4 = NSWAP(generic_dsb_bs_w_4),
+	.bs_w_8 = NSWAP(generic_dsb_bs_w_8),
 
 	/* read region */
 	.bs_rr_1 = generic_dsb_bs_rr_1,
-	.bs_rr_2 = generic_dsb_bs_rr_2,
-	.bs_rr_4 = generic_dsb_bs_rr_4,
-	.bs_rr_8 = generic_dsb_bs_rr_8,
+	.bs_rr_2 = NSWAP(generic_dsb_bs_rr_2),
+	.bs_rr_4 = NSWAP(generic_dsb_bs_rr_4),
+	.bs_rr_8 = NSWAP(generic_dsb_bs_rr_8),
 
 	/* write region */
 	.bs_wr_1 = generic_dsb_bs_wr_1,
-	.bs_wr_2 = generic_dsb_bs_wr_2,
-	.bs_wr_4 = generic_dsb_bs_wr_4,
-	.bs_wr_8 = generic_dsb_bs_wr_8,
+	.bs_wr_2 = NSWAP(generic_dsb_bs_wr_2),
+	.bs_wr_4 = NSWAP(generic_dsb_bs_wr_4),
+	.bs_wr_8 = NSWAP(generic_dsb_bs_wr_8),
 
 	/* copy region */
 	.bs_c_1 = generic_dsb_bs_c_1,
@@ -212,27 +218,27 @@ struct bus_space aarch64_generic_dsb_bs_
 
 	/* set region */
 	.bs_sr_1 = generic_dsb_bs_sr_1,
-	.bs_sr_2 = generi

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

2020-09-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Sep  5 16:04:31 UTC 2020

Modified Files:
src/sys/arch/arm/include: bus_funcs.h

Log Message:
Add missing prototypes for __bs_c(f,_bs_sm_?_swap)

(implementations of these already exist for aarch64)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/include/bus_funcs.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/arch/arm/include/bus_funcs.h
diff -u src/sys/arch/arm/include/bus_funcs.h:1.9 src/sys/arch/arm/include/bus_funcs.h:1.10
--- src/sys/arch/arm/include/bus_funcs.h:1.9	Mon Apr 13 07:09:51 2020
+++ src/sys/arch/arm/include/bus_funcs.h	Sat Sep  5 16:04:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_funcs.h,v 1.9 2020/04/13 07:09:51 maxv Exp $	*/
+/*	$NetBSD: bus_funcs.h,v 1.10 2020/09/05 16:04:31 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -493,14 +493,20 @@ void	__bs_c(f,_bs_sm_1)(void *t, bus_spa
 
 #define	bs_sm_2_proto(f)		\
 void	__bs_c(f,_bs_sm_2)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint16_t value, bus_size_t count);	\
+void	__bs_c(f,_bs_sm_2_swap)(void *t, bus_space_handle_t bsh,		\
 	bus_size_t offset, uint16_t value, bus_size_t count);
 
 #define	bs_sm_4_proto(f)		\
 void	__bs_c(f,_bs_sm_4)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint32_t value, bus_size_t count);	\
+void	__bs_c(f,_bs_sm_4_swap)(void *t, bus_space_handle_t bsh,	\
 	bus_size_t offset, uint32_t value, bus_size_t count);
 
 #define	bs_sm_8_proto(f)		\
 void	__bs_c(f,_bs_sm_8)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint64_t value, bus_size_t count);	\
+void	__bs_c(f,_bs_sm_8_swap)(void *t, bus_space_handle_t bsh,	\
 	bus_size_t offset, uint64_t value, bus_size_t count);
 
 #define	bs_sr_1_proto(f)		\



CVS commit: src/sys/arch/aarch64/aarch64

2020-09-05 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Sep  5 15:59:09 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: disasm.c

Log Message:
AArch64 instructions are always LE: swap if we're BE


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/disasm.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/disasm.c
diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.9 src/sys/arch/aarch64/aarch64/disasm.c:1.10
--- src/sys/arch/aarch64/aarch64/disasm.c:1.9	Mon Aug  3 19:16:56 2020
+++ src/sys/arch/aarch64/aarch64/disasm.c	Sat Sep  5 15:59:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disasm.c,v 1.9 2020/08/03 19:16:56 ryo Exp $	*/
+/*	$NetBSD: disasm.c,v 1.10 2020/09/05 15:59:09 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.9 2020/08/03 19:16:56 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.10 2020/09/05 15:59:09 jakllsch Exp $");
 
 #include 
 #include 
@@ -4044,7 +4044,7 @@ disasm(const disasm_interface_t *di, uin
 {
 	uint32_t insn;
 
-	insn = di->di_readword(loc);
+	insn = le32toh(di->di_readword(loc));
 	disasm_insn(di, loc, insn);
 
 	/* return next address */



CVS commit: src/external/gpl3/gcc/usr.bin

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep  4 02:27:39 UTC 2020

Modified Files:
src/external/gpl3/gcc/usr.bin: Makefile.driver

Log Message:
Build driver-aarch64.c for both endians of aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/gpl3/gcc/usr.bin/Makefile.driver

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/gcc/usr.bin/Makefile.driver
diff -u src/external/gpl3/gcc/usr.bin/Makefile.driver:1.1 src/external/gpl3/gcc/usr.bin/Makefile.driver:1.2
--- src/external/gpl3/gcc/usr.bin/Makefile.driver:1.1	Fri Feb  1 10:32:32 2019
+++ src/external/gpl3/gcc/usr.bin/Makefile.driver	Fri Sep  4 02:27:39 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.driver,v 1.1 2019/02/01 10:32:32 mrg Exp $
+#	$NetBSD: Makefile.driver,v 1.2 2020/09/04 02:27:39 jakllsch Exp $
 
 .ifndef _EXTERNAL_GPL3_GCC_USR_BIN_MAKEFILE_DRIVER_
 _EXTERNAL_GPL3_GCC_USR_BIN_MAKEFILE_DRIVER_=1
@@ -12,7 +12,7 @@ SRCS+=		driver-i386.c
 SRCS+=		driver-rs6000.c
 .PATH:		${DIST}/gcc/config/rs6000
 .endif
-.if  ${GCC_MACHINE_ARCH} == "aarch64" 
+.if  ${MACHINE_CPU} == "aarch64"
 SRCS+=		driver-aarch64.c
 .PATH:		${DIST}/gcc/config/aarch64
 .endif



CVS commit: src/external/gpl3/gcc.old/usr.bin

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep  4 02:26:57 UTC 2020

Modified Files:
src/external/gpl3/gcc.old/usr.bin: Makefile.driver

Log Message:
Build driver-aarch64.c for both endians of aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc.old/usr.bin/Makefile.driver

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/gcc.old/usr.bin/Makefile.driver
diff -u src/external/gpl3/gcc.old/usr.bin/Makefile.driver:1.1.1.1 src/external/gpl3/gcc.old/usr.bin/Makefile.driver:1.2
--- src/external/gpl3/gcc.old/usr.bin/Makefile.driver:1.1.1.1	Thu Sep 26 05:45:54 2019
+++ src/external/gpl3/gcc.old/usr.bin/Makefile.driver	Fri Sep  4 02:26:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.driver,v 1.1.1.1 2019/09/26 05:45:54 mrg Exp $
+#	$NetBSD: Makefile.driver,v 1.2 2020/09/04 02:26:57 jakllsch Exp $
 
 .ifndef _EXTERNAL_GPL3_GCC_USR_BIN_MAKEFILE_DRIVER_
 _EXTERNAL_GPL3_GCC_USR_BIN_MAKEFILE_DRIVER_=1
@@ -12,7 +12,7 @@ SRCS+=		driver-i386.c
 SRCS+=		driver-rs6000.c
 .PATH:		${DIST}/gcc/config/rs6000
 .endif
-.if  ${GCC_MACHINE_ARCH} == "aarch64" 
+.if  ${MACHINE_CPU} == "aarch64"
 SRCS+=		driver-aarch64.c
 .PATH:		${DIST}/gcc/config/aarch64
 .endif



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

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep  4 02:21:49 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: mk.generic64

Log Message:
Link evbarm/aarch64eb kernels in big endian mode


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/mk.generic64

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

Modified files:

Index: src/sys/arch/evbarm/conf/mk.generic64
diff -u src/sys/arch/evbarm/conf/mk.generic64:1.5 src/sys/arch/evbarm/conf/mk.generic64:1.6
--- src/sys/arch/evbarm/conf/mk.generic64:1.5	Mon Dec 16 11:00:30 2019
+++ src/sys/arch/evbarm/conf/mk.generic64	Fri Sep  4 02:21:49 2020
@@ -1,4 +1,8 @@
-#	$NetBSD: mk.generic64,v 1.5 2019/12/16 11:00:30 skrll Exp $
+#	$NetBSD: mk.generic64,v 1.6 2020/09/04 02:21:49 jakllsch Exp $
+
+.if !empty(MACHINE_ARCH:M*eb)
+EXTRA_LINKFLAGS+=	-EB
+.endif
 
 SYSTEM_FIRST_OBJ=	start.o
 SYSTEM_FIRST_SFILE=	${ARM}/aarch64/start.S



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

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Sep  4 02:15:52 UTC 2020

Modified Files:
src/sys/arch/evbarm/stand: Makefile

Log Message:
Only build bootaa64.efi on LE aarch64 for now, to match set lists


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/stand/Makefile

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

Modified files:

Index: src/sys/arch/evbarm/stand/Makefile
diff -u src/sys/arch/evbarm/stand/Makefile:1.10 src/sys/arch/evbarm/stand/Makefile:1.11
--- src/sys/arch/evbarm/stand/Makefile:1.10	Sat Mar 30 13:54:09 2019
+++ src/sys/arch/evbarm/stand/Makefile	Fri Sep  4 02:15:52 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2019/03/30 13:54:09 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.11 2020/09/04 02:15:52 jakllsch Exp $
 
 .include 
 
@@ -12,7 +12,7 @@ SUBDIR+= bootimx23
 .endif
 .endif
 
-.if ${MACHINE_CPU} == "aarch64"
+.if ${MACHINE_ARCH} == "aarch64"
 SUBDIR+= ../../../stand/efiboot/bootaa64
 .endif
 



CVS commit: src/etc

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep  3 18:59:33 UTC 2020

Modified Files:
src/etc: Makefile

Log Message:
Treat aarch64 and aarch64eb identically with regard to ld.so.conf


To generate a diff of this commit:
cvs rdiff -u -r1.446 -r1.447 src/etc/Makefile

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

Modified files:

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.446 src/etc/Makefile:1.447
--- src/etc/Makefile:1.446	Mon Jun  1 01:41:40 2020
+++ src/etc/Makefile	Thu Sep  3 18:59:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.446 2020/06/01 01:41:40 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.447 2020/09/03 18:59:33 jakllsch Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -119,7 +119,7 @@ BIN1+=	disktab
 .endif
 
 .if exists(etc.${MACHINE}/ld.so.conf) && \
-empty(MACHINE_ARCH:M*arm*hf*) && ${MACHINE_ARCH} != "aarch64"
+empty(MACHINE_ARCH:M*arm*hf*) && empty(MACHINE_ARCH:Maarch64*)
 BIN1+=	etc.${MACHINE}/ld.so.conf
 .endif
 



CVS commit: src/distrib/sets/lists/base

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep  3 18:58:48 UTC 2020

Modified Files:
src/distrib/sets/lists/base: ad.aarch64

Log Message:
Only expect ACPI and UEFI-related files on little endian aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/distrib/sets/lists/base/ad.aarch64

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/base/ad.aarch64
diff -u src/distrib/sets/lists/base/ad.aarch64:1.31 src/distrib/sets/lists/base/ad.aarch64:1.32
--- src/distrib/sets/lists/base/ad.aarch64:1.31	Sun Oct 14 13:36:32 2018
+++ src/distrib/sets/lists/base/ad.aarch64	Thu Sep  3 18:58:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.31 2018/10/14 13:36:32 jmcneill Exp $
+# $NetBSD: ad.aarch64,v 1.32 2020/09/03 18:58:48 jakllsch Exp $
 ./lib/eabi	base-compat-lib		compat,llvm
 ./lib/eabi/npf	base-compat-lib		compat,llvm
 ./lib/eabihf	base-compat-lib		compat,llvm
@@ -8,7 +8,7 @@
 ./libexec/ld.elf_so-eabi			base-compat-shlib	compat,pic,llvm
 ./libexec/ld.elf_so-eabihf			base-compat-shlib	compat,pic,llvm
 ./libexec/ld.elf_so-oabi			base-sysutil-bin	compat,pic,llvm
-./usr/bin/iasl	base-util-bin
+./usr/bin/iasl	base-util-bin		endian=1234
 ./usr/lib/eabi	base-compat-lib		compat,llvm
 ./usr/lib/eabi/i18nbase-compat-lib		compat,llvm
 ./usr/lib/eabi/libarm.so.0			base-compat-shlib	compat,pic,llvm
@@ -37,8 +37,8 @@
 ./usr/libexec/ld.elf_so-eabi			base-compat-shlib	compat,pic,llvm
 ./usr/libexec/ld.elf_so-eabihf			base-compat-shlib	compat,pic,llvm
 ./usr/libexec/ld.elf_so-oabi			base-sysutil-bin	compat,pic,llvm
-./usr/mdec/bootaa64.efibase-sysutil-bin
-./usr/sbin/acpidumpbase-sysutil-bin
-./usr/sbin/amldbbase-sysutil-bin
+./usr/mdec/bootaa64.efibase-sysutil-bin	endian=1234
+./usr/sbin/acpidumpbase-sysutil-bin	endian=1234
+./usr/sbin/amldbbase-sysutil-bin	endian=1234
 ./usr/sbin/ofctlbase-sysutil-bin
 ./usr/sbin/tpctlbase-sysutil-bin



CVS commit: src/external/gpl3

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep  3 18:30:05 UTC 2020

Modified Files:
src/external/gpl3/gcc.old/usr.bin/backend: Makefile
src/external/gpl3/gcc/usr.bin/backend: Makefile

Log Message:
Treat aarch64eb the same as aarch64, enabling aarch64eb build


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc.old/usr.bin/backend/Makefile
cvs rdiff -u -r1.58 -r1.59 src/external/gpl3/gcc/usr.bin/backend/Makefile

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

Modified files:

Index: src/external/gpl3/gcc.old/usr.bin/backend/Makefile
diff -u src/external/gpl3/gcc.old/usr.bin/backend/Makefile:1.13 src/external/gpl3/gcc.old/usr.bin/backend/Makefile:1.14
--- src/external/gpl3/gcc.old/usr.bin/backend/Makefile:1.13	Wed Aug 19 07:48:02 2020
+++ src/external/gpl3/gcc.old/usr.bin/backend/Makefile	Thu Sep  3 18:30:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2020/08/19 07:48:02 mrg Exp $
+#	$NetBSD: Makefile,v 1.14 2020/09/03 18:30:05 jakllsch Exp $
 
 LIBISPRIVATE=	yes
 
@@ -612,6 +612,6 @@ CFLAGS+= -fno-exceptions -fno-rtti -fasy
 
 .PATH: ${DIST}/gcc ${DIST}/libiberty ${GCCARCH} ${G_out_file:H} ${DIST}/include
 .PATH: ${DIST}/gcc/config
-.if ${MACHINE_ARCH} == "aarch64"
+.if ${MACHINE_CPU} == "aarch64"
 .PATH: ${DIST}/gcc/config/arm
 .endif

Index: src/external/gpl3/gcc/usr.bin/backend/Makefile
diff -u src/external/gpl3/gcc/usr.bin/backend/Makefile:1.58 src/external/gpl3/gcc/usr.bin/backend/Makefile:1.59
--- src/external/gpl3/gcc/usr.bin/backend/Makefile:1.58	Fri Jun 12 14:37:51 2020
+++ src/external/gpl3/gcc/usr.bin/backend/Makefile	Thu Sep  3 18:30:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.58 2020/06/12 14:37:51 fox Exp $
+#	$NetBSD: Makefile,v 1.59 2020/09/03 18:30:05 jakllsch Exp $
 
 LIBISPRIVATE=	yes
 
@@ -612,6 +612,6 @@ CFLAGS+= -fno-exceptions -fno-rtti -fasy
 
 .PATH: ${DIST}/gcc ${DIST}/libiberty ${GCCARCH} ${G_out_file:H} ${DIST}/include
 .PATH: ${DIST}/gcc/config
-.if ${MACHINE_ARCH} == "aarch64"
+.if ${MACHINE_CPU} == "aarch64"
 .PATH: ${DIST}/gcc/config/arm
 .endif



CVS commit: src/common/lib/libc/arch/aarch64/gen

2020-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Sep  3 16:45:50 UTC 2020

Removed Files:
src/common/lib/libc/arch/aarch64/gen: clzdi2.S ctzdi2.S ffsdi2.S

Log Message:
Remove unused assembly source files


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/common/lib/libc/arch/aarch64/gen/clzdi2.S
cvs rdiff -u -r1.1 -r0 src/common/lib/libc/arch/aarch64/gen/ctzdi2.S \
src/common/lib/libc/arch/aarch64/gen/ffsdi2.S

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



CVS commit: src/lib/libc/compiler_rt

2020-09-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  2 16:22:46 UTC 2020

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
Treat aarch64eb the same as aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/compiler_rt/Makefile.inc

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

Modified files:

Index: src/lib/libc/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.38 src/lib/libc/compiler_rt/Makefile.inc:1.39
--- src/lib/libc/compiler_rt/Makefile.inc:1.38	Wed Apr 22 11:28:56 2020
+++ src/lib/libc/compiler_rt/Makefile.inc	Wed Sep  2 16:22:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.38 2020/04/22 11:28:56 rin Exp $
+# $NetBSD: Makefile.inc,v 1.39 2020/09/02 16:22:45 jakllsch Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -132,7 +132,7 @@ GENERIC_SRCS+= \
 .endif
 
 
-.if ${MACHINE_ARCH} != "aarch64"
+.if ${MACHINE_CPU} != "aarch64"
 GENERIC_SRCS+= \
 	fixunsdfti.c \
 	fixunssfti.c \
@@ -196,7 +196,7 @@ GENERIC_SRCS+= \
 
 # These have h/w instructions which are always used.
 .if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "powerpc64" \
-&& ${LIBC_MACHINE_ARCH} != "aarch64" && ${LIBC_MACHINE_CPU} != "or1k"
+&& ${LIBC_MACHINE_CPU} != "aarch64" && ${LIBC_MACHINE_CPU} != "or1k"
 GENERIC_SRCS+= \
 	clzdi2.c \
 	ctzdi2.c \



CVS commit: src/common/lib/libc/arch/aarch64/gen

2020-09-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  2 15:43:06 UTC 2020

Modified Files:
src/common/lib/libc/arch/aarch64/gen: clzdi2.S

Log Message:
Fix typo/pasteo in aarch64 clzdi2() END()


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/aarch64/gen/clzdi2.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/gen/clzdi2.S
diff -u src/common/lib/libc/arch/aarch64/gen/clzdi2.S:1.1 src/common/lib/libc/arch/aarch64/gen/clzdi2.S:1.2
--- src/common/lib/libc/arch/aarch64/gen/clzdi2.S:1.1	Sun Aug 10 05:47:35 2014
+++ src/common/lib/libc/arch/aarch64/gen/clzdi2.S	Wed Sep  2 15:43:06 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: clzdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: clzdi2.S,v 1.2 2020/09/02 15:43:06 jakllsch Exp $ */
 
 #include 
 
-RCSID("$NetBSD: clzdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $")
+RCSID("$NetBSD: clzdi2.S,v 1.2 2020/09/02 15:43:06 jakllsch Exp $")
 
 ENTRY(clzdi2)
 	clz	x0, x0
 	ret
-END(clsdi2)
+END(clzdi2)



CVS commit: src/external/lgpl3/gmp

2020-09-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  2 15:15:30 UTC 2020

Modified Files:
src/external/lgpl3/gmp: Makefile.arch

Log Message:
Teach native gmp about aarch64eb


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/lgpl3/gmp/Makefile.arch

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

Modified files:

Index: src/external/lgpl3/gmp/Makefile.arch
diff -u src/external/lgpl3/gmp/Makefile.arch:1.2 src/external/lgpl3/gmp/Makefile.arch:1.3
--- src/external/lgpl3/gmp/Makefile.arch:1.2	Tue Aug 22 09:59:37 2017
+++ src/external/lgpl3/gmp/Makefile.arch	Wed Sep  2 15:15:30 2020
@@ -1,3 +1,3 @@
-#	$NetBSD: Makefile.arch,v 1.2 2017/08/22 09:59:37 mrg Exp $
+#	$NetBSD: Makefile.arch,v 1.3 2020/09/02 15:15:30 jakllsch Exp $
 
-GMP_MACHINE_ARCH?=	${MACHINE_ARCH:C/e?arm(v[4567])?(hf)?/arm/}
+GMP_MACHINE_ARCH?=	${MACHINE_ARCH:C/e?arm(v[4567])?(hf)?/arm/:C/aarch64eb/aarch64/}



CVS commit: src/share/mk

2020-09-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  2 15:17:19 UTC 2020

Modified Files:
src/share/mk: bsd.endian.mk

Log Message:
Teach bsd.endian.mk about aarch64eb


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/share/mk/bsd.endian.mk

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

Modified files:

Index: src/share/mk/bsd.endian.mk
diff -u src/share/mk/bsd.endian.mk:1.22 src/share/mk/bsd.endian.mk:1.23
--- src/share/mk/bsd.endian.mk:1.22	Fri Sep 19 17:45:42 2014
+++ src/share/mk/bsd.endian.mk	Wed Sep  2 15:17:19 2020
@@ -1,11 +1,11 @@
-#	$NetBSD: bsd.endian.mk,v 1.22 2014/09/19 17:45:42 matt Exp $
+#	$NetBSD: bsd.endian.mk,v 1.23 2020/09/02 15:17:19 jakllsch Exp $
 
 .if !defined(_BSD_ENDIAN_MK_)
 _BSD_ENDIAN_MK_=1
 
 .include 
 
-.if ${MACHINE_ARCH} == "aarch64" || \
+.if (!empty(MACHINE_ARCH:Maarch64*) && empty(MACHINE_ARCH:Maarch64eb)) || \
 ${MACHINE_ARCH} == "alpha" || \
 ${MACHINE_ARCH} == "arm" || \
 (!empty(MACHINE_ARCH:Mearm*) && empty(MACHINE_ARCH:Mearm*eb)) || \



CVS commit: src/external/gpl3

2020-09-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep  2 14:13:21 UTC 2020

Modified Files:
src/external/gpl3/gcc.old/dist/gcc: config.gcc
src/external/gpl3/gcc/dist/gcc: config.gcc

Log Message:
Teach config.gcc about NetBSD aarch64eb


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/gpl3/gcc.old/dist/gcc/config.gcc
cvs rdiff -u -r1.62 -r1.63 src/external/gpl3/gcc/dist/gcc/config.gcc

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/gcc.old/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc.old/dist/gcc/config.gcc:1.15 src/external/gpl3/gcc.old/dist/gcc/config.gcc:1.16
--- src/external/gpl3/gcc.old/dist/gcc/config.gcc:1.15	Wed Aug 19 07:46:33 2020
+++ src/external/gpl3/gcc.old/dist/gcc/config.gcc	Wed Sep  2 14:13:21 2020
@@ -1000,7 +1000,11 @@ aarch64*-*-netbsd*)
 	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-netbsd.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-	# XXX big endian
+	case $target in
+	aarch64_be-*)
+		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+		;;
+	esac
 	;;
 aarch64*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"

Index: src/external/gpl3/gcc/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc/dist/gcc/config.gcc:1.62 src/external/gpl3/gcc/dist/gcc/config.gcc:1.63
--- src/external/gpl3/gcc/dist/gcc/config.gcc:1.62	Wed Mar 11 08:29:45 2020
+++ src/external/gpl3/gcc/dist/gcc/config.gcc	Wed Sep  2 14:13:20 2020
@@ -1000,7 +1000,11 @@ aarch64*-*-netbsd*)
 	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-netbsd.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-	# XXX big endian
+	case $target in
+	aarch64_be-*)
+		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+		;;
+	esac
 	;;
 aarch64*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"



CVS commit: src/sys/arch

2020-08-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 29 19:06:18 UTC 2020

Modified Files:
src/sys/arch/arm/nvidia: files.tegra tegra_xusb.c
src/sys/arch/evbarm/conf: mk.generic
Removed Files:
src/sys/arch/arm/nvidia: tegra_xusb-fw.mk

Log Message:
tegra_xusb: fix xusb static firmware build

To work around objcopy and ld now being unable to create a EABI5 object
from a binary, use the assembler directive .incbin in inline assembly
to pull in the firmware blob.

This also probably makes TEGRA210_XUSB_BIN_STATIC actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/arm/nvidia/files.tegra
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/nvidia/tegra_xusb-fw.mk
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/nvidia/tegra_xusb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/mk.generic

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

Modified files:

Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.51 src/sys/arch/arm/nvidia/files.tegra:1.52
--- src/sys/arch/arm/nvidia/files.tegra:1.51	Wed Jul  8 22:28:21 2020
+++ src/sys/arch/arm/nvidia/files.tegra	Sat Aug 29 19:06:17 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.tegra,v 1.51 2020/07/08 22:28:21 uwe Exp $
+#	$NetBSD: files.tegra,v 1.52 2020/08/29 19:06:17 jakllsch Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -108,6 +108,8 @@ file	arch/arm/nvidia/tegra_ehci.c		tegra
 attach	xhci at fdt with tegra_xusb : firmload
 file	arch/arm/nvidia/tegra_xusb.c		tegra_xusb
 defflag	opt_tegra.hTEGRA_XUSB_DEBUG
+defflag	opt_tegra.hTEGRA124_XUSB_BIN_STATIC
+defflag	opt_tegra.hTEGRA210_XUSB_BIN_STATIC
 
 # SDMMC
 attach	sdhc at fdt with tegra_sdhc

Index: src/sys/arch/arm/nvidia/tegra_xusb.c
diff -u src/sys/arch/arm/nvidia/tegra_xusb.c:1.19 src/sys/arch/arm/nvidia/tegra_xusb.c:1.20
--- src/sys/arch/arm/nvidia/tegra_xusb.c:1.19	Sun Oct 13 06:11:31 2019
+++ src/sys/arch/arm/nvidia/tegra_xusb.c	Sat Aug 29 19:06:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_xusb.c,v 1.19 2019/10/13 06:11:31 skrll Exp $ */
+/* $NetBSD: tegra_xusb.c,v 1.20 2020/08/29 19:06:17 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2016 Jonathan A. Kollasch
@@ -30,7 +30,7 @@
 #include "opt_tegra.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.19 2019/10/13 06:11:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.20 2020/08/29 19:06:17 jakllsch Exp $");
 
 #include 
 #include 
@@ -74,13 +74,29 @@ static void	tegra_xusb_mountroot(device_
 static int	tegra_xusb_intr_mbox(void *);
 
 #ifdef TEGRA124_XUSB_BIN_STATIC
-extern const char _binary_tegra124_xusb_bin_size[];
 extern const char _binary_tegra124_xusb_bin_start[];
+extern const char _binary_tegra124_xusb_bin_end[];
+__asm__(
+".section \".rodata\"\n"
+"_binary_tegra124_xusb_bin_start:\n"
+".incbin \"../external/nvidia-firmware/tegra/dist/tegra124/xusb.bin\"\n"
+".size _binary_tegra124_xusb_bin_start, . - _binary_tegra124_xusb_bin_start\n"
+"_binary_tegra124_xusb_bin_end:\n"
+".previous\n"
+);
 #endif
 
 #ifdef TEGRA210_XUSB_BIN_STATIC
-extern const char _binary_tegra210_xusb_bin_size[];
 extern const char _binary_tegra210_xusb_bin_start[];
+extern const char _binary_tegra210_xusb_bin_end[];
+__asm__(
+".section \".rodata\"\n"
+"_binary_tegra210_xusb_bin_start:\n"
+".incbin \"../external/nvidia-firmware/tegra/dist/tegra210/xusb.bin\"\n"
+".size _binary_tegra210_xusb_bin_start, . - _binary_tegra210_xusb_bin_start\n"
+"_binary_tegra210_xusb_bin_end:\n"
+".previous\n"
+);
 #endif
 
 enum xusb_type {
@@ -729,7 +745,8 @@ tegra_xusb_open_fw(struct tegra_xusb_sof
 	switch (psc->sc_txd->txd_type) {
 	case XUSB_T124:
 #if defined(TEGRA124_XUSB_BIN_STATIC)
-		firmware_size = (uintptr_t)&_binary_tegra124_xusb_bin_size;
+		firmware_size = (uintptr_t)&_binary_tegra124_xusb_bin_end
+		- (uintptr_t)&_binary_tegra124_xusb_bin_start;
 		fw_static = __UNCONST(_binary_tegra124_xusb_bin_start);
 #else
 		fw_path = "nvidia/tegra124";
@@ -737,7 +754,8 @@ tegra_xusb_open_fw(struct tegra_xusb_sof
 		break;
 	case XUSB_T210:
 #if defined(TEGRA210_XUSB_BIN_STATIC)
-		firmware_size = (uintptr_t)&_binary_tegra210_xusb_bin_size;
+		firmware_size = (uintptr_t)&_binary_tegra210_xusb_bin_end
+		- (uintptr_t)&_binary_tegra210_xusb_bin_start;
 		fw_static = __UNCONST(_binary_tegra210_xusb_bin_start);
 #else
 		fw_path = "nvidia/tegra210";

Index: src/sys/arch/evbarm/conf/mk.generic
diff -u src/sys/arch/evbarm/conf/mk.generic:1.9 src/sys/arch/evbarm/conf/mk.generic:1.10
--- src/sys/arch/evbarm/conf/mk.generic:1.9	Mon Dec 16 11:00:30 2019
+++ src/sys/arch/evbarm/conf/mk.generic	Sat Aug 29 19:06:18 2020
@@ -1,6 +1,4 @@
-#	$NetBSD: mk.generic,v 1.9 2019/12/16 11:00:30 skrll Exp $
-
-.include "$S/arch/arm/nvidia/tegra_xusb-fw.mk"
+#	$NetBSD: mk.generic,v 1.10 2020/08/29 19:06:18 jakllsch Exp $
 
 .if !empty(MACHINE_ARCH:M*eb)
 EXTRA_LINKFLAGS+=	--be8



CVS commit: src/sys/dev/usb

2020-08-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Aug 21 20:46:04 UTC 2020

Modified Files:
src/sys/dev/usb: xhci.c xhcivar.h

Log Message:
xhci(4): initial support for Isochronous pipes

Needs more cleanup, and more work, particularly transaction scheduling
may need to be examined with bus analyzer (to check if too frequent/
infrequent) or various isoc pipe consumers (to check if too infrequent)
and fixed if incorrect.

Begins to address PR kern/55574.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/xhcivar.h

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.133 src/sys/dev/usb/xhci.c:1.134
--- src/sys/dev/usb/xhci.c:1.133	Fri Aug 21 20:16:39 2020
+++ src/sys/dev/usb/xhci.c	Fri Aug 21 20:46:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.133 2020/08/21 20:16:39 jakllsch Exp $	*/
+/*	$NetBSD: xhci.c,v 1.134 2020/08/21 20:46:03 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.133 2020/08/21 20:16:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.134 2020/08/21 20:46:03 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -129,6 +129,9 @@ fail:
 struct xhci_pipe {
 	struct usbd_pipe xp_pipe;
 	struct usb_task xp_async_task;
+	int16_t xp_isoc_next; /* next frame */
+	uint8_t xp_maxb; /* max burst */
+	uint8_t xp_mult;
 };
 
 #define XHCI_COMMAND_RING_TRBS 256
@@ -199,6 +202,12 @@ static void xhci_device_ctrl_abort(struc
 static void xhci_device_ctrl_close(struct usbd_pipe *);
 static void xhci_device_ctrl_done(struct usbd_xfer *);
 
+static usbd_status xhci_device_isoc_transfer(struct usbd_xfer *);
+static usbd_status xhci_device_isoc_enter(struct usbd_xfer *);
+static void xhci_device_isoc_abort(struct usbd_xfer *);
+static void xhci_device_isoc_close(struct usbd_pipe *);
+static void xhci_device_isoc_done(struct usbd_xfer *);
+
 static usbd_status xhci_device_intr_transfer(struct usbd_xfer *);
 static usbd_status xhci_device_intr_start(struct usbd_xfer *);
 static void xhci_device_intr_abort(struct usbd_xfer *);
@@ -244,7 +253,11 @@ static const struct usbd_pipe_methods xh
 };
 
 static const struct usbd_pipe_methods xhci_device_isoc_methods = {
+	.upm_transfer = xhci_device_isoc_transfer,
+	.upm_abort = xhci_device_isoc_abort,
+	.upm_close = xhci_device_isoc_close,
 	.upm_cleartoggle = xhci_noop,
+	.upm_done = xhci_device_isoc_done,
 };
 
 static const struct usbd_pipe_methods xhci_device_bulk_methods = {
@@ -1595,6 +1608,7 @@ static usbd_status
 xhci_open(struct usbd_pipe *pipe)
 {
 	struct usbd_device * const dev = pipe->up_dev;
+	struct xhci_pipe * const xpipe = (struct xhci_pipe *)pipe;
 	struct xhci_softc * const sc = XHCI_BUS2SC(dev->ud_bus);
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 	usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
@@ -1638,7 +1652,8 @@ xhci_open(struct usbd_pipe *pipe)
 		break;
 	case UE_ISOCHRONOUS:
 		pipe->up_methods = &xhci_device_isoc_methods;
-		return USBD_INVAL;
+		pipe->up_serialise = false;
+		xpipe->xp_isoc_next = -1;
 		break;
 	case UE_BULK:
 		pipe->up_methods = &xhci_device_bulk_methods;
@@ -1997,6 +2012,9 @@ xhci_event_transfer(struct xhci_softc * 
 		return;
 	}
 
+	const uint8_t xfertype =
+	UE_GET_XFERTYPE(xfer->ux_pipe->up_endpoint->ue_edesc->bmAttributes);
+
 	/* 4.11.5.2 Event Data TRB */
 	if ((trb_3 & XHCI_TRB_3_ED_BIT) != 0) {
 		DPRINTFN(14, "transfer Event Data: 0x%016jx 0x%08jx"
@@ -2029,6 +2047,13 @@ xhci_event_transfer(struct xhci_softc * 
 		 * ctrl xfer uses EVENT_DATA, and others do not.
 		 * Thus driver can switch the flow by checking ED bit.
 		 */
+		if (xfertype == UE_ISOCHRONOUS) {
+			xfer->ux_frlengths[xx->xx_isoc_done] -=
+			XHCI_TRB_2_REM_GET(trb_2);
+			xfer->ux_actlen += xfer->ux_frlengths[xx->xx_isoc_done];
+			if (++xx->xx_isoc_done < xfer->ux_nframes)
+return;
+		} else
 		if ((trb_3 & XHCI_TRB_3_ED_BIT) == 0) {
 			if (xfer->ux_actlen == 0)
 xfer->ux_actlen = xfer->ux_length -
@@ -2257,7 +2282,7 @@ xhci_allocx(struct usbd_bus *bus, unsign
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
-	ntrbs = XHCI_XFER_NTRB;
+	ntrbs = uimax(3, nframes);
 	const size_t trbsz = sizeof(*xx->xx_trb) * ntrbs;
 
 	xx = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
@@ -3360,6 +3385,7 @@ xhci_setup_tthub(struct usbd_pipe *pipe,
 static void
 xhci_setup_maxburst(struct usbd_pipe *pipe, uint32_t *cp)
 {
+	struct xhci_pipe * const xpipe = (struct xhci_pipe *)pipe;
 	struct usbd_device *dev = pipe->up_dev;
 	usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
 	const uint8_t xfertype 

CVS commit: src/sys/dev/usb

2020-08-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Aug 21 20:16:39 UTC 2020

Modified Files:
src/sys/dev/usb: xhci.c xhcivar.h

Log Message:
xhci(4): copy HCCPARAMS regs to softc, use when needed

We'll need more than just the AC64 bit for the Isoc support coming up;
and we don't need to keep all the bits as bools in the softc.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/usb/xhcivar.h

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.132 src/sys/dev/usb/xhci.c:1.133
--- src/sys/dev/usb/xhci.c:1.132	Sat Jun  6 08:56:30 2020
+++ src/sys/dev/usb/xhci.c	Fri Aug 21 20:16:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.132 2020/06/06 08:56:30 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.133 2020/08/21 20:16:39 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.132 2020/06/06 08:56:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.133 2020/08/21 20:16:39 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -323,7 +323,7 @@ xhci_op_read_8(const struct xhci_softc *
 {
 	uint64_t value;
 
-	if (sc->sc_ac64) {
+	if (XHCI_HCC_AC64(sc->sc_hcc)) {
 #ifdef XHCI_USE_BUS_SPACE_8
 		value = bus_space_read_8(sc->sc_iot, sc->sc_obh, offset);
 #else
@@ -342,7 +342,7 @@ static inline void
 xhci_op_write_8(const struct xhci_softc * const sc, bus_size_t offset,
 uint64_t value)
 {
-	if (sc->sc_ac64) {
+	if (XHCI_HCC_AC64(sc->sc_hcc)) {
 #ifdef XHCI_USE_BUS_SPACE_8
 		bus_space_write_8(sc->sc_iot, sc->sc_obh, offset, value);
 #else
@@ -382,7 +382,7 @@ xhci_rt_read_8(const struct xhci_softc *
 {
 	uint64_t value;
 
-	if (sc->sc_ac64) {
+	if (XHCI_HCC_AC64(sc->sc_hcc)) {
 #ifdef XHCI_USE_BUS_SPACE_8
 		value = bus_space_read_8(sc->sc_iot, sc->sc_rbh, offset);
 #else
@@ -402,7 +402,7 @@ static inline void
 xhci_rt_write_8(const struct xhci_softc * const sc, bus_size_t offset,
 uint64_t value)
 {
-	if (sc->sc_ac64) {
+	if (XHCI_HCC_AC64(sc->sc_hcc)) {
 #ifdef XHCI_USE_BUS_SPACE_8
 		bus_space_write_8(sc->sc_iot, sc->sc_rbh, offset, value);
 #else
@@ -826,11 +826,11 @@ xhci_id_protocols(struct xhci_softc *sc,
 
 /* Process extended capabilities */
 static void
-xhci_ecp(struct xhci_softc *sc, uint32_t hcc)
+xhci_ecp(struct xhci_softc *sc)
 {
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
-	bus_size_t ecp = XHCI_HCC_XECP(hcc) * 4;
+	bus_size_t ecp = XHCI_HCC_XECP(sc->sc_hcc) * 4;
 	while (ecp != 0) {
 		uint32_t ecr = xhci_read_4(sc, ecp);
 		aprint_debug_dev(sc->sc_dev, "ECR: 0x%08x\n", ecr);
@@ -944,7 +944,7 @@ int
 xhci_init(struct xhci_softc *sc)
 {
 	bus_size_t bsz;
-	uint32_t hcs1, hcs2, hcs3, hcc, dboff, rtsoff, hcc2;
+	uint32_t hcs1, hcs2, hcs3, dboff, rtsoff;
 	uint32_t pagesize, config;
 	int i = 0;
 	uint16_t hciversion;
@@ -993,21 +993,20 @@ xhci_init(struct xhci_softc *sc)
 	aprint_debug_dev(sc->sc_dev,
 	"hcs1=%"PRIx32" hcs2=%"PRIx32" hcs3=%"PRIx32"\n", hcs1, hcs2, hcs3);
 
-	hcc = xhci_cap_read_4(sc, XHCI_HCCPARAMS);
-	sc->sc_ac64 = XHCI_HCC_AC64(hcc);
-	sc->sc_ctxsz = XHCI_HCC_CSZ(hcc) ? 64 : 32;
+	sc->sc_hcc = xhci_cap_read_4(sc, XHCI_HCCPARAMS);
+	sc->sc_ctxsz = XHCI_HCC_CSZ(sc->sc_hcc) ? 64 : 32;
 
 	char sbuf[128];
 	if (hciversion < XHCI_HCIVERSION_1_0)
-		snprintb(sbuf, sizeof(sbuf), XHCI_HCCPREV1_BITS, hcc);
+		snprintb(sbuf, sizeof(sbuf), XHCI_HCCPREV1_BITS, sc->sc_hcc);
 	else
-		snprintb(sbuf, sizeof(sbuf), XHCI_HCCV1_x_BITS, hcc);
+		snprintb(sbuf, sizeof(sbuf), XHCI_HCCV1_x_BITS, sc->sc_hcc);
 	aprint_debug_dev(sc->sc_dev, "hcc=%s\n", sbuf);
 	aprint_debug_dev(sc->sc_dev, "xECP %" __PRIxBITS "\n",
-	XHCI_HCC_XECP(hcc) * 4);
+	XHCI_HCC_XECP(sc->sc_hcc) * 4);
 	if (hciversion >= XHCI_HCIVERSION_1_1) {
-		hcc2 = xhci_cap_read_4(sc, XHCI_HCCPARAMS2);
-		snprintb(sbuf, sizeof(sbuf), XHCI_HCC2_BITS, hcc2);
+		sc->sc_hcc2 = xhci_cap_read_4(sc, XHCI_HCCPARAMS2);
+		snprintb(sbuf, sizeof(sbuf), XHCI_HCC2_BITS, sc->sc_hcc2);
 		aprint_debug_dev(sc->sc_dev, "hcc2=%s\n", sbuf);
 	}
 
@@ -1024,7 +1023,7 @@ xhci_init(struct xhci_softc *sc)
 	/*
 	 * Process all Extended Capabilities
 	 */
-	xhci_ecp(sc, hcc);
+	xhci_ecp(sc);
 
 	bsz = XHCI_PORTSC(sc->sc_maxports);
 	if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, caplength, bsz,

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.15 src/sys/dev/usb/xhcivar.h:1.16
--- src/sys/dev/usb/xhcivar.h:1.15	Thu May 21 13:47:10 2020
+++ src/sys/dev/usb/xhcivar.h	Fri Aug 21 20:16:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.15 2020/05/21 13:47:10 jakllsch Exp $

CVS commit: src/sys/dev/usb

2020-05-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 30 17:19:45 UTC 2020

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

Log Message:
aubtfwl(4): Use kmem_asprintf() for firmware file name creation.

A MAXPATHLEN+1 array of char on stack is "too much".


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/aubtfwl.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/aubtfwl.c
diff -u src/sys/dev/usb/aubtfwl.c:1.9 src/sys/dev/usb/aubtfwl.c:1.10
--- src/sys/dev/usb/aubtfwl.c:1.9	Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/aubtfwl.c	Sat May 30 17:19:45 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: aubtfwl.c,v 1.9 2020/03/14 02:35:33 christos Exp $ */
+/* $NetBSD: aubtfwl.c,v 1.10 2020/05/30 17:19:45 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2011 Jonathan A. Kollasch
@@ -27,9 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aubtfwl.c,v 1.9 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aubtfwl.c,v 1.10 2020/05/30 17:19:45 jakllsch Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -272,7 +273,7 @@ static void
 aubtfwl_attach_hook(device_t self)
 {
 	struct aubtfwl_softc * const sc = device_private(self);
-	char firmware_name[MAXPATHLEN+1];
+	char *fw_name;
 	struct ar3k_version ver;
 	uint8_t state;
 	int clock = 0;
@@ -292,9 +293,10 @@ aubtfwl_attach_hook(device_t self)
 		aprint_verbose_dev(self, "state is 0x%02x\n", state);
 
 		if (!(state & AR3K_STATE_IS_PATCHED)) {
-			snprintf(firmware_name, sizeof(firmware_name),
-"ar3k/AthrBT_0x%08x.dfu", ver.rom);
-			error = aubtfwl_firmware_load(self, firmware_name);
+			fw_name = kmem_asprintf("ar3k/AthrBT_0x%08x.dfu",
+			ver.rom);
+			error = aubtfwl_firmware_load(self, fw_name);
+			kmem_strfree(fw_name);
 
 			if (error)
 return;
@@ -312,9 +314,10 @@ aubtfwl_attach_hook(device_t self)
 			break;
 		}
 
-		snprintf(firmware_name, sizeof(firmware_name),
-			"ar3k/ramps_0x%08x_%d.dfu", ver.rom, clock);
-		aubtfwl_firmware_load(self, firmware_name);
+		fw_name = kmem_asprintf("ar3k/ramps_0x%08x_%d.dfu",
+		ver.rom, clock);
+		aubtfwl_firmware_load(self, fw_name);
+		kmem_strfree(fw_name);
 
 		if ((state & AR3K_STATE_MODE_MASK) != AR3K_STATE_MODE_NORMAL) {
 			error = aubtfwl_send_command(sc, AR3K_SET_NORMAL_MODE);



CVS commit: src/sys/dev/usb

2020-05-24 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun May 24 17:28:20 UTC 2020

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

Log Message:
uvideo(4): clamp (micro)frames-per-xfer to at most 80

Previously, on a 30fps YUV422 640x480 webcam, we were putting over 250
USB (micro)frames per video frame in the host controller queue.

xhci(4) is currently limited to 256-1 TRBs per xHC Transfer Ring, and as
such, trying to place 3 xfers each of 250+ microframes in the queue fails.

As there is no UVC requirement that whole video frames be in one logical
chunk of isoc transactions, and there doesn't seem to be compelling reason
to keep the xfer completion rate slower than 1 in 10ms, we can limit each
of the 3 uvideo xfers to 80 (micro)frames of bus time, and solve the
Transfer Ring constraint for upcoming xhci(4) Isochronous pipe support.
This works out to using only 240 TRBs on the 255-usable-TRB Transfer Ring.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/usb/uvideo.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/uvideo.c
diff -u src/sys/dev/usb/uvideo.c:1.57 src/sys/dev/usb/uvideo.c:1.58
--- src/sys/dev/usb/uvideo.c:1.57	Fri May 22 11:25:06 2020
+++ src/sys/dev/usb/uvideo.c	Sun May 24 17:28:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvideo.c,v 1.57 2020/05/22 11:25:06 jmcneill Exp $	*/
+/*	$NetBSD: uvideo.c,v 1.58 2020/05/24 17:28:20 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.57 2020/05/22 11:25:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.58 2020/05/24 17:28:20 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -81,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1
 #include 
 
 #define UVIDEO_NXFERS	3
+#define UVIDEO_NFRAMES_MAX 80
 #define PRI_UVIDEO	PRI_BIO
 
 /* #define UVIDEO_DISABLE_MJPEG */
@@ -1561,6 +1562,7 @@ uvideo_stream_start_xfer(struct uvideo_s
 		uframe_len = alt->max_packet_size;
 		nframes = (vframe_len + uframe_len - 1) / uframe_len;
 		nframes = (nframes + 7) & ~7; /*round up for ehci inefficiency*/
+		nframes = uimin(UVIDEO_NFRAMES_MAX, nframes);
 		DPRINTF(("uvideo_stream_start_xfer: nframes=%d\n", nframes));
 
 		ix->ix_nframes = nframes;



CVS commit: src/sys/dev/usb

2020-05-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu May 21 15:28:35 UTC 2020

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

Log Message:
xhci(4): only usbd_xfer_trycomplete() if certain to usb_transfer_complete()

Previously we'd cancel the timeout after the data stage of control xfers, and
then hope that the status stage would eventually interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.128 src/sys/dev/usb/xhci.c:1.129
--- src/sys/dev/usb/xhci.c:1.128	Thu May 21 13:47:10 2020
+++ src/sys/dev/usb/xhci.c	Thu May 21 15:28:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.128 2020/05/21 13:47:10 jakllsch Exp $	*/
+/*	$NetBSD: xhci.c,v 1.129 2020/05/21 15:28:35 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.128 2020/05/21 13:47:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.129 2020/05/21 15:28:35 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1992,13 +1992,6 @@ xhci_event_transfer(struct xhci_softc * 
 		return;
 	}
 
-	/*
-	 * Try to claim this xfer for completion.  If it has already
-	 * completed or aborted, drop it on the floor.
-	 */
-	if (!usbd_xfer_trycomplete(xfer))
-		return;
-
 	/* 4.11.5.2 Event Data TRB */
 	if ((trb_3 & XHCI_TRB_3_ED_BIT) != 0) {
 		DPRINTFN(14, "transfer Event Data: 0x%016jx 0x%08jx"
@@ -2054,6 +2047,13 @@ xhci_event_transfer(struct xhci_softc * 
 		DPRINTFN(1, "ERR %ju slot %ju dci %ju", trbcode, slot, dci, 0);
 		xr->is_halted = true;
 		/*
+		 * Try to claim this xfer for completion.  If it has already
+		 * completed or aborted, drop it on the floor.
+		 */
+		if (!usbd_xfer_trycomplete(xfer))
+			return;
+
+		/*
 		 * Stalled endpoints can be recoverd by issuing
 		 * command TRB TYPE_RESET_EP on xHCI instead of
 		 * issuing request CLEAR_FEATURE UF_ENDPOINT_HALT
@@ -2078,6 +2078,13 @@ xhci_event_transfer(struct xhci_softc * 
 		break;
 	}
 
+	/*
+	 * Try to claim this xfer for completion.  If it has already
+	 * completed or aborted, drop it on the floor.
+	 */
+	if (!usbd_xfer_trycomplete(xfer))
+		return;
+
 	/* Set the status.  */
 	xfer->ux_status = err;
 



CVS commit: src/sys/dev/usb

2020-05-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu May 21 13:47:11 UTC 2020

Modified Files:
src/sys/dev/usb: xhci.c xhcivar.h

Log Message:
xhci(4): dynamically allocate xhci_xfer->xx_trb buffer

Allocation size remains the same for now.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/xhcivar.h

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.127 src/sys/dev/usb/xhci.c:1.128
--- src/sys/dev/usb/xhci.c:1.127	Thu May 21 13:23:38 2020
+++ src/sys/dev/usb/xhci.c	Thu May 21 13:47:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.127 2020/05/21 13:23:38 jakllsch Exp $	*/
+/*	$NetBSD: xhci.c,v 1.128 2020/05/21 13:47:10 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.127 2020/05/21 13:23:38 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.128 2020/05/21 13:47:10 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -520,7 +520,7 @@ static inline void
 xhci_xfer_put_trb(struct xhci_xfer * const xx, u_int idx,
 uint64_t parameter, uint32_t status, uint32_t control)
 {
-	KASSERTMSG(idx < XHCI_XFER_NTRB, "idx=%u", idx);
+	KASSERTMSG(idx < xx->xx_ntrb, "idx=%u xx_ntrb=%u", idx, xx->xx_ntrb);
 	xx->xx_trb[idx].trb_0 = parameter;
 	xx->xx_trb[idx].trb_2 = status;
 	xx->xx_trb[idx].trb_3 = control;
@@ -2241,12 +2241,20 @@ xhci_allocx(struct usbd_bus *bus, unsign
 {
 	struct xhci_softc * const sc = XHCI_BUS2SC(bus);
 	struct xhci_xfer *xx;
+	u_int ntrbs;
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
+	ntrbs = XHCI_XFER_NTRB;
+	const size_t trbsz = sizeof(*xx->xx_trb) * ntrbs;
+
 	xx = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
 	if (xx != NULL) {
 		memset(xx, 0, sizeof(*xx));
+		if (ntrbs > 0) {
+			xx->xx_trb = kmem_alloc(trbsz, KM_SLEEP);
+			xx->xx_ntrb = ntrbs;
+		}
 #ifdef DIAGNOSTIC
 		xx->xx_xfer.ux_state = XFER_BUSY;
 #endif
@@ -2271,6 +2279,11 @@ xhci_freex(struct usbd_bus *bus, struct 
 	}
 	xfer->ux_state = XFER_FREE;
 #endif
+	if (xx->xx_ntrb > 0) {
+		kmem_free(xx->xx_trb, xx->xx_ntrb * sizeof(*xx->xx_trb));
+		xx->xx_trb = NULL;
+		xx->xx_ntrb = 0;
+	}
 	pool_cache_put(sc->sc_xferpool, xx);
 }
 
@@ -2675,7 +2688,7 @@ static inline void
 xhci_ring_put_xfer(struct xhci_softc * const sc, struct xhci_ring * const tr,
 struct xhci_xfer *xx, u_int ntrb)
 {
-	KASSERT(ntrb <= XHCI_XFER_NTRB);
+	KASSERT(ntrb <= xx->xx_ntrb);
 	xhci_ring_put(sc, tr, xx, xx->xx_trb, ntrb);
 }
 

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.14 src/sys/dev/usb/xhcivar.h:1.15
--- src/sys/dev/usb/xhcivar.h:1.14	Tue May 19 18:18:33 2020
+++ src/sys/dev/usb/xhcivar.h	Thu May 21 13:47:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.14 2020/05/19 18:18:33 jakllsch Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.15 2020/05/21 13:47:10 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -42,7 +42,8 @@ struct xhci_soft_trb {
 
 struct xhci_xfer {
 	struct usbd_xfer xx_xfer;
-	struct xhci_soft_trb xx_trb[XHCI_XFER_NTRB];
+	struct xhci_soft_trb *xx_trb;
+	u_int xx_ntrb;
 };
 
 #define XHCI_BUS2SC(bus)	((bus)->ub_hcpriv)



CVS commit: src/sys/dev/usb

2020-05-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu May 21 13:23:38 UTC 2020

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

Log Message:
xhci(4): Check for overflows with KASSERT when putting TRBs on xfer TRB buffer.

Also more-correctly check for overruns when putting TRBs on a ring.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.126 src/sys/dev/usb/xhci.c:1.127
--- src/sys/dev/usb/xhci.c:1.126	Thu May 21 12:46:44 2020
+++ src/sys/dev/usb/xhci.c	Thu May 21 13:23:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.126 2020/05/21 12:46:44 jakllsch Exp $	*/
+/*	$NetBSD: xhci.c,v 1.127 2020/05/21 13:23:38 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.126 2020/05/21 12:46:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.127 2020/05/21 13:23:38 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -517,12 +517,13 @@ xhci_ring_trbp(struct xhci_ring * const 
 }
 
 static inline void
-xhci_soft_trb_put(struct xhci_soft_trb * const trb,
+xhci_xfer_put_trb(struct xhci_xfer * const xx, u_int idx,
 uint64_t parameter, uint32_t status, uint32_t control)
 {
-	trb->trb_0 = parameter;
-	trb->trb_2 = status;
-	trb->trb_3 = control;
+	KASSERTMSG(idx < XHCI_XFER_NTRB, "idx=%u", idx);
+	xx->xx_trb[idx].trb_0 = parameter;
+	xx->xx_trb[idx].trb_2 = status;
+	xx->xx_trb[idx].trb_3 = control;
 }
 
 static inline void
@@ -2577,7 +2578,8 @@ xhci_ring_put(struct xhci_softc * const 
 	XHCIHIST_CALLARGS("%#jx xr_ep %#jx xr_cs %ju",
 	(uintptr_t)xr, xr->xr_ep, xr->xr_cs, 0);
 
-	KASSERTMSG(ntrbs <= XHCI_XFER_NTRB, "ntrbs %zu", ntrbs);
+	KASSERTMSG(ntrbs < xr->xr_ntrb, "ntrbs %zu, xr->xr_ntrb %u",
+	ntrbs, xr->xr_ntrb);
 	for (i = 0; i < ntrbs; i++) {
 		DPRINTFN(12, "xr %#jx trbs %#jx num %ju", (uintptr_t)xr,
 		(uintptr_t)trbs, i, 0);
@@ -2669,6 +2671,14 @@ xhci_ring_put(struct xhci_softc * const 
 	xr->xr_cs, 0);
 }
 
+static inline void
+xhci_ring_put_xfer(struct xhci_softc * const sc, struct xhci_ring * const tr,
+struct xhci_xfer *xx, u_int ntrb)
+{
+	KASSERT(ntrb <= XHCI_XFER_NTRB);
+	xhci_ring_put(sc, tr, xx, xx->xx_trb, ntrb);
+}
+
 /*
  * Stop execution commands, purge all commands on command ring, and
  * rewind dequeue pointer.
@@ -3875,7 +3885,7 @@ xhci_device_ctrl_start(struct usbd_xfer 
 	 (isread ? XHCI_TRB_3_TRT_IN : XHCI_TRB_3_TRT_OUT)) |
 	XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_SETUP_STAGE) |
 	XHCI_TRB_3_IDT_BIT;
-	xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
+	xhci_xfer_put_trb(xx, i++, parameter, status, control);
 
 	if (len != 0) {
 		/* data phase */
@@ -3888,7 +3898,7 @@ xhci_device_ctrl_start(struct usbd_xfer 
 		XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_DATA_STAGE) |
 		(isread ? XHCI_TRB_3_ISP_BIT : 0) |
 		XHCI_TRB_3_IOC_BIT;
-		xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
+		xhci_xfer_put_trb(xx, i++, parameter, status, control);
 
 		usb_syncmem(dma, 0, len,
 		isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
@@ -3900,11 +3910,11 @@ xhci_device_ctrl_start(struct usbd_xfer 
 	control = ((isread && (len > 0)) ? 0 : XHCI_TRB_3_DIR_IN) |
 	XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) |
 	XHCI_TRB_3_IOC_BIT;
-	xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
+	xhci_xfer_put_trb(xx, i++, parameter, status, control);
 
 	if (!polling)
 		mutex_enter(&tr->xr_lock);
-	xhci_ring_put(sc, tr, xfer, xx->xx_trb, i);
+	xhci_ring_put_xfer(sc, tr, xx, i);
 	if (!polling)
 		mutex_exit(&tr->xr_lock);
 
@@ -4025,11 +4035,11 @@ xhci_device_bulk_start(struct usbd_xfer 
 	control = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) |
 	(isread ? XHCI_TRB_3_ISP_BIT : 0) |
 	XHCI_TRB_3_IOC_BIT;
-	xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
+	xhci_xfer_put_trb(xx, i++, parameter, status, control);
 
 	if (!polling)
 		mutex_enter(&tr->xr_lock);
-	xhci_ring_put(sc, tr, xfer, xx->xx_trb, i);
+	xhci_ring_put_xfer(sc, tr, xx, i);
 	if (!polling)
 		mutex_exit(&tr->xr_lock);
 
@@ -4139,11 +4149,11 @@ xhci_device_intr_start(struct usbd_xfer 
 	XHCI_TRB_2_BYTES_SET(len);
 	control = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) |
 	(isread ? XHCI_TRB_3_ISP_BIT : 0) | XHCI_TRB_3_IOC_BIT;
-	xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
+	xhci_xfer_put_trb(xx, i++, parameter, status, control);
 
 	if (!polling)
 		mutex_enter(&tr->xr_lock);
-	xhci_ring_put(sc, tr, xfer, xx->xx_trb, i);
+	xhci_ring_put_xfer(sc, tr, xx, i);
 	if (!polling)
 		mutex_exit(&tr->xr_lock);
 



CVS commit: src/sys/dev/usb

2020-05-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu May 21 12:46:45 UTC 2020

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

Log Message:
xhci(4): Be more concise in putting the setup request in TRB immediate data.

Or: memcpy(),htole64() is replaced by functionally-identical le64dec().


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.125 src/sys/dev/usb/xhci.c:1.126
--- src/sys/dev/usb/xhci.c:1.125	Wed May 20 17:32:27 2020
+++ src/sys/dev/usb/xhci.c	Thu May 21 12:46:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.125 2020/05/20 17:32:27 jakllsch Exp $	*/
+/*	$NetBSD: xhci.c,v 1.126 2020/05/21 12:46:44 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.125 2020/05/20 17:32:27 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.126 2020/05/21 12:46:44 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3869,14 +3869,13 @@ xhci_device_ctrl_start(struct usbd_xfer 
 	i = 0;
 
 	/* setup phase */
-	memcpy(¶meter, req, sizeof(parameter));
+	parameter = le64dec(req); /* to keep USB endian after xhci_trb_put() */
 	status = XHCI_TRB_2_IRQ_SET(0) | XHCI_TRB_2_BYTES_SET(sizeof(*req));
 	control = ((len == 0) ? XHCI_TRB_3_TRT_NONE :
 	 (isread ? XHCI_TRB_3_TRT_IN : XHCI_TRB_3_TRT_OUT)) |
 	XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_SETUP_STAGE) |
 	XHCI_TRB_3_IDT_BIT;
-	/* we need parameter un-swapped on big endian, so pre-swap it here */
-	xhci_soft_trb_put(&xx->xx_trb[i++], htole64(parameter), status, control);
+	xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
 
 	if (len != 0) {
 		/* data phase */



CVS commit: src/sys/dev/usb

2020-05-20 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 20 17:32:28 UTC 2020

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

Log Message:
Use more-semantically-correct types in xhci allocx/freex functions.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.124 src/sys/dev/usb/xhci.c:1.125
--- src/sys/dev/usb/xhci.c:1.124	Sun Apr  5 20:59:38 2020
+++ src/sys/dev/usb/xhci.c	Wed May 20 17:32:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.124 2020/04/05 20:59:38 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.125 2020/05/20 17:32:27 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.124 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.125 2020/05/20 17:32:27 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2239,25 +2239,26 @@ static struct usbd_xfer *
 xhci_allocx(struct usbd_bus *bus, unsigned int nframes)
 {
 	struct xhci_softc * const sc = XHCI_BUS2SC(bus);
-	struct usbd_xfer *xfer;
+	struct xhci_xfer *xx;
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
-	xfer = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
-	if (xfer != NULL) {
-		memset(xfer, 0, sizeof(struct xhci_xfer));
+	xx = pool_cache_get(sc->sc_xferpool, PR_WAITOK);
+	if (xx != NULL) {
+		memset(xx, 0, sizeof(*xx));
 #ifdef DIAGNOSTIC
-		xfer->ux_state = XFER_BUSY;
+		xx->xx_xfer.ux_state = XFER_BUSY;
 #endif
 	}
 
-	return xfer;
+	return &xx->xx_xfer;
 }
 
 static void
 xhci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
 {
 	struct xhci_softc * const sc = XHCI_BUS2SC(bus);
+	struct xhci_xfer * const xx = XHCI_XFER2XXFER(xfer);
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
@@ -2269,7 +2270,7 @@ xhci_freex(struct usbd_bus *bus, struct 
 	}
 	xfer->ux_state = XFER_FREE;
 #endif
-	pool_cache_put(sc->sc_xferpool, xfer);
+	pool_cache_put(sc->sc_xferpool, xx);
 }
 
 static bool



CVS commit: src/sys/dev/usb

2020-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue May 19 19:09:43 UTC 2020

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

Log Message:
ohci(4): always use usb_syncmem() when reading from HCCA


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.306 src/sys/dev/usb/ohci.c:1.307
--- src/sys/dev/usb/ohci.c:1.306	Tue May 19 18:57:26 2020
+++ src/sys/dev/usb/ohci.c	Tue May 19 19:09:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.306 2020/05/19 18:57:26 jakllsch Exp $	*/
+/*	$NetBSD: ohci.c,v 1.307 2020/05/19 19:09:43 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.306 2020/05/19 18:57:26 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.307 2020/05/19 19:09:43 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1228,6 +1228,11 @@ ohci_dumpregs(ohci_softc_t *sc)
 	DPRINTF("   port1=0x%08jx port2=0x%08jx",
 		 OREAD4(sc, OHCI_RH_PORT_STATUS(1)),
 		 OREAD4(sc, OHCI_RH_PORT_STATUS(2)), 0, 0);
+	usb_syncmem(&sc->sc_hccadma,
+	offsetof(struct ohci_hcca, hcca_frame_number),
+	sizeof(sc->sc_hcca->hcca_frame_number) +
+	sizeof(sc->sc_hcca->hcca_done_head),
+	BUS_DMASYNC_POSTREAD);
 	DPRINTF(" HCCA: frame_number=0x%04jx done_head=0x%08jx",
 		 O32TOH(sc->sc_hcca->hcca_frame_number),
 		 O32TOH(sc->sc_hcca->hcca_done_head), 0, 0);
@@ -3469,6 +3474,10 @@ ohci_device_isoc_enter(struct usbd_xfer 
 
 	if (isoc->next == -1) {
 		/* Not in use yet, schedule it a few frames ahead. */
+		usb_syncmem(&sc->sc_hccadma,
+		offsetof(struct ohci_hcca, hcca_frame_number),
+		sizeof(sc->sc_hcca->hcca_frame_number),
+		BUS_DMASYNC_POSTREAD);
 		isoc->next = O32TOH(sc->sc_hcca->hcca_frame_number) + 5;
 		DPRINTFN(2,"start next=%jd", isoc->next, 0, 0, 0);
 	}
@@ -3558,6 +3567,10 @@ ohci_device_isoc_enter(struct usbd_xfer 
 
 #ifdef OHCI_DEBUG
 	if (ohcidebug >= 5) {
+		usb_syncmem(&sc->sc_hccadma,
+		offsetof(struct ohci_hcca, hcca_frame_number),
+		sizeof(sc->sc_hcca->hcca_frame_number),
+		BUS_DMASYNC_POSTREAD);
 		DPRINTF("frame=%jd", O32TOH(sc->sc_hcca->hcca_frame_number),
 		0, 0, 0);
 		ohci_dump_itds(sc, xfer->ux_hcpriv);



CVS commit: src/sys/dev/usb

2020-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue May 19 18:57:26 UTC 2020

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

Log Message:
ohci_device_isoc_done(): use ux_length rather than ux_bufsize

For consistency.  Nick may have missed this in previous because I'd
unexpectedly adjusted it.


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.305 src/sys/dev/usb/ohci.c:1.306
--- src/sys/dev/usb/ohci.c:1.305	Fri May 15 06:23:54 2020
+++ src/sys/dev/usb/ohci.c	Tue May 19 18:57:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.305 2020/05/15 06:23:54 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.306 2020/05/19 18:57:26 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.305 2020/05/15 06:23:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.306 2020/05/19 18:57:26 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3643,7 +3643,7 @@ ohci_device_isoc_done(struct usbd_xfer *
 
 	DPRINTFN(10, "xfer=%#jx, actlen=%jd", (uintptr_t)xfer, xfer->ux_actlen,
 	0, 0);
-	usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_bufsize,
+	usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length,
 	isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
 }
 



CVS commit: src/sys/dev/usb

2020-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue May 19 18:32:35 UTC 2020

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

Log Message:
Use usbd_destroy_xfer() in usbd_request_async() instead of usbd_free_xfer().

The only user of usbd_request_async() & co. does a usbd_create_xfer(), so use
the correct deconstructor.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/usb/usbdi.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/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.201 src/sys/dev/usb/usbdi.c:1.202
--- src/sys/dev/usb/usbdi.c:1.201	Fri May 15 06:15:42 2020
+++ src/sys/dev/usb/usbdi.c	Tue May 19 18:32:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.201 2020/05/15 06:15:42 skrll Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.202 2020/05/19 18:32:35 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.201 2020/05/15 06:15:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.202 2020/05/19 18:32:35 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1243,7 +1243,7 @@ usbd_do_request_len(struct usbd_device *
 static void
 usbd_request_async_cb(struct usbd_xfer *xfer, void *priv, usbd_status status)
 {
-	usbd_free_xfer(xfer);
+	usbd_destroy_xfer(xfer);
 }
 
 /*
@@ -1264,7 +1264,7 @@ usbd_request_async(struct usbd_device *d
 	callback);
 	err = usbd_transfer(xfer);
 	if (err != USBD_IN_PROGRESS) {
-		usbd_free_xfer(xfer);
+		usbd_destroy_xfer(xfer);
 		return (err);
 	}
 	return (USBD_NORMAL_COMPLETION);



CVS commit: src/sys/dev/usb

2020-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue May 19 18:18:33 UTC 2020

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

Log Message:
Remove definition of unused struct xhci_endpoint.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/xhcivar.h

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

Modified files:

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.13 src/sys/dev/usb/xhcivar.h:1.14
--- src/sys/dev/usb/xhcivar.h:1.13	Thu Apr  2 11:52:41 2020
+++ src/sys/dev/usb/xhcivar.h	Tue May 19 18:18:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.13 2020/04/02 11:52:41 skrll Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.14 2020/05/19 18:18:33 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -64,10 +64,6 @@ struct xhci_ring {
 	bool is_halted;
 };
 
-struct xhci_endpoint {
-	struct xhci_ring xe_tr;		/* transfer ring */
-};
-
 struct xhci_slot {
 	usb_dma_t xs_dc_dma;		/* device context page */
 	usb_dma_t xs_ic_dma;		/* input context page */



CVS commit: src/sys/dev/usb

2020-05-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 13 19:33:48 UTC 2020

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

Log Message:
Use ux_bufsize rather than ux_length in isoc path usb_syncmem calls.

ux_length is always 0 for isoc pipes, so it could not be used here.

To do: revisit this for other host controllers, uhci and ehci in particular?


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.302 src/sys/dev/usb/ohci.c:1.303
--- src/sys/dev/usb/ohci.c:1.302	Wed May 13 18:44:51 2020
+++ src/sys/dev/usb/ohci.c	Wed May 13 19:33:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.302 2020/05/13 18:44:51 jakllsch Exp $	*/
+/*	$NetBSD: ohci.c,v 1.303 2020/05/13 19:33:48 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.302 2020/05/13 18:44:51 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.303 2020/05/13 19:33:48 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3463,7 +3463,7 @@ ohci_device_isoc_enter(struct usbd_xfer 
 	int isread =
 	(UE_GET_DIR(xfer->ux_pipe->up_endpoint->ue_edesc->bEndpointAddress) == UE_DIR_IN);
 
-	usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length,
+	usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_bufsize,
 	isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 
 	if (isoc->next == -1) {
@@ -3642,7 +3642,7 @@ ohci_device_isoc_done(struct usbd_xfer *
 
 	DPRINTFN(10, "xfer=%#jx, actlen=%jd", (uintptr_t)xfer, xfer->ux_actlen,
 	0, 0);
-	usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length,
+	usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_bufsize,
 	isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
 }
 



CVS commit: src/sys/dev/usb

2020-05-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 13 18:44:51 UTC 2020

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

Log Message:
ohci_alloc_sed() returns a pointer, so use NULL rather than 0 on bail-out


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.301 src/sys/dev/usb/ohci.c:1.302
--- src/sys/dev/usb/ohci.c:1.301	Sun Apr  5 20:59:38 2020
+++ src/sys/dev/usb/ohci.c	Wed May 13 18:44:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.301 2020/04/05 20:59:38 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.302 2020/05/13 18:44:51 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.301 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.302 2020/05/13 18:44:51 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -411,7 +411,7 @@ ohci_alloc_sed(ohci_softc_t *sc)
 		err = usb_allocmem(&sc->sc_bus, OHCI_SED_SIZE * OHCI_SED_CHUNK,
 		OHCI_ED_ALIGN, USBMALLOC_COHERENT, &dma);
 		if (err)
-			return 0;
+			return NULL;
 
 		mutex_enter(&sc->sc_lock);
 		for (i = 0; i < OHCI_SED_CHUNK; i++) {



CVS commit: src/sys/dev/pci

2020-05-11 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon May 11 23:47:45 UTC 2020

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

Log Message:
msk(4): ack Status BMU IRQ only if we're (apparently) caught up with it

Possibility for acking an unprocessed Status BMU IRQ still exists, and
remains handled by the watchdog.  Nevertheless this should reduce the
likelyhood that path is taken.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.112 src/sys/dev/pci/if_msk.c:1.113
--- src/sys/dev/pci/if_msk.c:1.112	Mon May 11 19:17:46 2020
+++ src/sys/dev/pci/if_msk.c	Mon May 11 23:47:45 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.112 2020/05/11 19:17:46 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.113 2020/05/11 23:47:45 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.112 2020/05/11 19:17:46 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.113 2020/05/11 23:47:45 jakllsch Exp $");
 
 #include 
 #include 
@@ -2277,6 +2277,7 @@ msk_intr(void *xsc)
 	struct ifnet		*ifp0 = NULL, *ifp1 = NULL;
 	uint32_t		status;
 	struct msk_status_desc	*cur_st;
+	bool			retried = false;
 
 	status = CSR_READ_4(sc, SK_Y2_ISSR2);
 	if (status == 0x)
@@ -2303,6 +2304,7 @@ msk_intr(void *xsc)
 		msk_intr_yukon(sc_if1);
 	}
 
+again:
 	MSK_CDSTSYNC(sc, sc->sk_status_idx,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	cur_st = &sc->sk_status_ring[sc->sk_status_idx];
@@ -2336,8 +2338,11 @@ msk_intr(void *xsc)
 		cur_st = &sc->sk_status_ring[sc->sk_status_idx];
 	}
 
-	if (status & SK_Y2_IMR_BMU) {
+	if (CSR_READ_2(sc, SK_STAT_BMU_PUTIDX) == sc->sk_status_idx) {
 		CSR_WRITE_4(sc, SK_STAT_BMU_CSR, SK_STAT_BMU_IRQ_CLEAR);
+	} else if (!retried) {
+		retried = true;
+		goto again;
 	}
 
 	CSR_WRITE_4(sc, SK_Y2_ICR, 2);



CVS commit: src/sys/dev/pci

2020-05-11 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon May 11 19:17:46 UTC 2020

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

Log Message:
msk(4): simplify interrupt return value creation

This also corrects a problem where we would not claim we handled an
interrupt that was ours.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.111 src/sys/dev/pci/if_msk.c:1.112
--- src/sys/dev/pci/if_msk.c:1.111	Mon May 11 18:49:04 2020
+++ src/sys/dev/pci/if_msk.c	Mon May 11 19:17:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.111 2020/05/11 18:49:04 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.112 2020/05/11 19:17:46 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.111 2020/05/11 18:49:04 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.112 2020/05/11 19:17:46 jakllsch Exp $");
 
 #include 
 #include 
@@ -2275,7 +2275,6 @@ msk_intr(void *xsc)
 	struct sk_if_softc	*sc_if0 = sc->sk_if[SK_PORT_A];
 	struct sk_if_softc	*sc_if1 = sc->sk_if[SK_PORT_B];
 	struct ifnet		*ifp0 = NULL, *ifp1 = NULL;
-	int			claimed = 0;
 	uint32_t		status;
 	struct msk_status_desc	*cur_st;
 
@@ -2339,7 +2338,6 @@ msk_intr(void *xsc)
 
 	if (status & SK_Y2_IMR_BMU) {
 		CSR_WRITE_4(sc, SK_STAT_BMU_CSR, SK_STAT_BMU_IRQ_CLEAR);
-		claimed = 1;
 	}
 
 	CSR_WRITE_4(sc, SK_Y2_ICR, 2);
@@ -2355,7 +2353,7 @@ msk_intr(void *xsc)
 	if (sc->sk_int_mod_pending)
 		msk_update_int_mod(sc, 1);
 
-	return claimed;
+	return (status & sc->sk_intrmask) != 0;
 }
 
 static void



CVS commit: src/sys/dev/pci

2020-05-11 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon May 11 18:49:05 UTC 2020

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

Log Message:
msk(4): moderate no interrupts globally

The global interrupt moderator on mskc(4) is mostly redundant with the Status 
Unit's tx and rx interrupt coalescing for our purpouses

Revisits interrupt moderation change in 1.108.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.110 src/sys/dev/pci/if_msk.c:1.111
--- src/sys/dev/pci/if_msk.c:1.110	Fri May  8 14:56:49 2020
+++ src/sys/dev/pci/if_msk.c	Mon May 11 18:49:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.110 2020/05/08 14:56:49 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.111 2020/05/11 18:49:04 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.110 2020/05/08 14:56:49 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.111 2020/05/11 18:49:04 jakllsch Exp $");
 
 #include 
 #include 
@@ -860,7 +860,7 @@ msk_update_int_mod(struct sk_softc *sc, 
 		aprint_verbose_dev(sc->sk_dev,
 		"interrupt moderation is %d us\n", sc->sk_int_mod);
 	sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod));
-	sk_win_write_4(sc, SK_IMMR, SK_Y2_IMR_BMU);
+	sk_win_write_4(sc, SK_IMMR, 0); /* moderate no interrupts */
 	sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
 	sc->sk_int_mod_pending = 0;
 }



CVS commit: src/sys/dev/pci

2020-05-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri May  8 16:43:18 UTC 2020

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

Log Message:
if_skreg.h: remove duplicate or triplicate identical #defines


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_skreg.h

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

Modified files:

Index: src/sys/dev/pci/if_skreg.h
diff -u src/sys/dev/pci/if_skreg.h:1.28 src/sys/dev/pci/if_skreg.h:1.29
--- src/sys/dev/pci/if_skreg.h:1.28	Sun Apr 26 15:39:04 2020
+++ src/sys/dev/pci/if_skreg.h	Fri May  8 16:43:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_skreg.h,v 1.28 2020/04/26 15:39:04 jakllsch Exp $ */
+/* $NetBSD: if_skreg.h,v 1.29 2020/05/08 16:43:17 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -1624,11 +1624,6 @@ struct sk_type {
 
 #define SK_RING_ALIGN	64
 
-#define SK_ADDR_LO(x)	((u_int64_t) (x) & 0x)
-#define SK_ADDR_HI(x)	((u_int64_t) (x) >> 32)
-
-#define SK_RING_ALIGN	64
-
 /* RX queue descriptor data structure */
 struct sk_rx_desc {
 	u_int32_t		sk_ctl;
@@ -1739,14 +1734,6 @@ struct msk_status_desc {
 #define SK_Y2_ST_TXA2_MSKH	0x000f
 #define SK_Y2_ST_TXA2_SHIFTH	8
 
-#define SK_Y2_ST_TXA1_MSKL	0x0fff
-#define SK_Y2_ST_TXA1_SHIFT	0
-
-#define SK_Y2_ST_TXA2_MSKL	0xff00
-#define SK_Y2_ST_TXA2_SHIFTL	24
-#define SK_Y2_ST_TXA2_MSKH	0x000f
-#define SK_Y2_ST_TXA2_SHIFTH	8
-
 #define MSK_TX_RING_CNT		512
 #define MSK_RX_RING_CNT		512
 #define MSK_STATUS_RING_CNT	2048
@@ -1953,42 +1940,6 @@ struct msk_status_desc {
 
 #define YU_RXSTAT_BYTES(x)  ((x) >> YU_RXSTAT_LENSHIFT)
 
-/* Receive status */
-#define YU_RXSTAT_FOFL		0x0001	/* Rx FIFO overflow */
-#define YU_RXSTAT_CRCERR	0x0002	/* CRC error */
-#define YU_RXSTAT_FRAGMENT	0x0008	/* fragment */
-#define YU_RXSTAT_LONGERR	0x0010	/* too long packet */
-#define YU_RXSTAT_MIIERR	0x0020	/* MII error */
-#define YU_RXSTAT_BADFC		0x0040	/* bad flow-control packet */
-#define YU_RXSTAT_GOODFC	0x0080	/* good flow-control packet */
-#define YU_RXSTAT_RXOK		0x0100	/* receice OK (Good packet) */
-#define YU_RXSTAT_BROADCAST	0x0200	/* broadcast packet */
-#define YU_RXSTAT_MULTICAST	0x0400	/* multicast packet */
-#define YU_RXSTAT_RUNT		0x0800	/* undersize packet */
-#define YU_RXSTAT_JABBER	0x1000	/* jabber packet */
-#define YU_RXSTAT_VLAN		0x2000	/* VLAN packet */
-#define YU_RXSTAT_LENSHIFT	16
-
-#define	YU_RXSTAT_BYTES(x)	((x) >> YU_RXSTAT_LENSHIFT)
-
-/* Receive status */
-#define YU_RXSTAT_FOFL		0x0001	/* Rx FIFO overflow */
-#define YU_RXSTAT_CRCERR	0x0002	/* CRC error */
-#define YU_RXSTAT_FRAGMENT	0x0008	/* fragment */
-#define YU_RXSTAT_LONGERR	0x0010	/* too long packet */
-#define YU_RXSTAT_MIIERR	0x0020	/* MII error */
-#define YU_RXSTAT_BADFC		0x0040	/* bad flow-control packet */
-#define YU_RXSTAT_GOODFC	0x0080	/* good flow-control packet */
-#define YU_RXSTAT_RXOK		0x0100	/* receice OK (Good packet) */
-#define YU_RXSTAT_BROADCAST	0x0200	/* broadcast packet */
-#define YU_RXSTAT_MULTICAST	0x0400	/* multicast packet */
-#define YU_RXSTAT_RUNT		0x0800	/* undersize packet */
-#define YU_RXSTAT_JABBER	0x1000	/* jabber packet */
-#define YU_RXSTAT_VLAN		0x2000	/* VLAN packet */
-#define YU_RXSTAT_LENSHIFT	16
-
-#define	YU_RXSTAT_BYTES(x)	((x) >> YU_RXSTAT_LENSHIFT)
-
 /*
  * Registers and data structures for the XaQti Corporation XMAC II
  * Gigabit Ethernet MAC. Datasheet is available from http://www.xaqti.com.



CVS commit: src/sys/dev/pci

2020-05-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri May  8 14:56:49 UTC 2020

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

Log Message:
Use sysctl_teardown() upon detach of mskc(4).


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.109 src/sys/dev/pci/if_msk.c:1.110
--- src/sys/dev/pci/if_msk.c:1.109	Fri May  8 14:35:19 2020
+++ src/sys/dev/pci/if_msk.c	Fri May  8 14:56:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.109 2020/05/08 14:35:19 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.110 2020/05/08 14:56:49 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.109 2020/05/08 14:35:19 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.110 2020/05/08 14:56:49 jakllsch Exp $");
 
 #include 
 #include 
@@ -1831,6 +1831,8 @@ mskc_detach(device_t self, int flags)
 	if (rv != 0)
 		return rv;
 
+	sysctl_teardown(&sc->sk_clog);
+
 	if (sc->sk_status_nseg > 0) {
 		bus_dmamap_destroy(sc->sc_dmatag, sc->sk_status_map);
 		bus_dmamem_unmap(sc->sc_dmatag, sc->sk_status_ring,



CVS commit: src/sys/dev/pci

2020-05-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri May  8 14:35:19 UTC 2020

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

Log Message:
msk(4): Simplify setting the first List Element owner-bit last.

We don't actually need to do this, as the BMU won't proceed to the new
descriptor until we advance the ring-end pointer on the chip, but perhaps
it has value as paranoia.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.108 src/sys/dev/pci/if_msk.c:1.109
--- src/sys/dev/pci/if_msk.c:1.108	Thu Apr 30 14:04:54 2020
+++ src/sys/dev/pci/if_msk.c	Fri May  8 14:35:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.108 2020/04/30 14:04:54 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.109 2020/05/08 14:35:19 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.108 2020/04/30 14:04:54 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.109 2020/05/08 14:35:19 jakllsch Exp $");
 
 #include 
 #include 
@@ -482,8 +482,9 @@ msk_newbuf(struct sk_if_softc *sc_if)
 	bus_addr_t		addr;
 	bus_dmamap_t		rxmap;
 	size_t			i;
-	uint32_t		rxidx, frag, cur, hiaddr, old_hiaddr, total;
+	uint32_t		rxidx, frag, cur, hiaddr, total;
 	uint32_t		entries = 0;
+	uint8_t			own = 0;
 
 	MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 	if (m_new == NULL)
@@ -537,7 +538,6 @@ msk_newbuf(struct sk_if_softc *sc_if)
 	bus_dmamap_sync(sc->sc_dmatag, rxmap, 0, rxmap->dm_mapsize,
 	BUS_DMASYNC_PREREAD);
 
-	old_hiaddr = sc_if->sk_cdata.sk_rx_hiaddr;
 	for (i = 0; i < rxmap->dm_nsegs; i++) {
 		addr = rxmap->dm_segs[i].ds_addr;
 		DPRINTFN(2, ("msk_newbuf: addr %llx\n",
@@ -551,11 +551,8 @@ msk_newbuf(struct sk_if_softc *sc_if)
 			r->sk_addr = htole32(hiaddr);
 			r->sk_len = 0;
 			r->sk_ctl = 0;
-			if (i == 0)
-r->sk_opcode = SK_Y2_BMUOPC_ADDR64;
-			else
-r->sk_opcode = SK_Y2_BMUOPC_ADDR64 |
-SK_Y2_RXOPC_OWN;
+			r->sk_opcode = SK_Y2_BMUOPC_ADDR64 | own;
+			own = SK_Y2_RXOPC_OWN;
 			sc_if->sk_cdata.sk_rx_hiaddr = hiaddr;
 			MSK_CDRXSYNC(sc_if, frag,
 			BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
@@ -571,13 +568,10 @@ msk_newbuf(struct sk_if_softc *sc_if)
 		r->sk_len = htole16(rxmap->dm_segs[i].ds_len);
 		r->sk_ctl = 0;
 		if (i == 0) {
-			if (hiaddr != old_hiaddr)
-r->sk_opcode = SK_Y2_RXOPC_PACKET |
-SK_Y2_RXOPC_OWN;
-			else
-r->sk_opcode = SK_Y2_RXOPC_PACKET;
+			r->sk_opcode = SK_Y2_RXOPC_PACKET | own;
 		} else
-			r->sk_opcode = SK_Y2_RXOPC_BUFFER | SK_Y2_RXOPC_OWN;
+			r->sk_opcode = SK_Y2_RXOPC_BUFFER | own;
+		own = SK_Y2_RXOPC_OWN;
 		MSK_CDRXSYNC(sc_if, frag,
 		BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 		cur = frag;
@@ -1856,8 +1850,9 @@ msk_encap(struct sk_if_softc *sc_if, str
 {
 	struct sk_softc		*sc = sc_if->sk_softc;
 	struct msk_tx_desc		*f = NULL;
-	uint32_t		frag, cur, hiaddr, old_hiaddr, total;
+	uint32_t		frag, cur, hiaddr, total;
 	uint32_t		entries = 0;
+	uint8_t			own = 0;
 	size_t			i;
 	bus_dmamap_t		txmap;
 	bus_addr_t		addr;
@@ -1907,7 +1902,6 @@ msk_encap(struct sk_if_softc *sc_if, str
 	bus_dmamap_sync(sc->sc_dmatag, txmap, 0, txmap->dm_mapsize,
 	BUS_DMASYNC_PREWRITE);
 
-	old_hiaddr = sc_if->sk_cdata.sk_tx_hiaddr;
 	for (i = 0; i < txmap->dm_nsegs; i++) {
 		addr = txmap->dm_segs[i].ds_addr;
 		DPRINTFN(2, ("msk_encap: addr %llx\n",
@@ -1919,10 +1913,8 @@ msk_encap(struct sk_if_softc *sc_if, str
 			f->sk_addr = htole32(hiaddr);
 			f->sk_len = 0;
 			f->sk_ctl = 0;
-			if (i == 0)
-f->sk_opcode = SK_Y2_BMUOPC_ADDR64;
-			else
-f->sk_opcode = SK_Y2_BMUOPC_ADDR64 | SK_Y2_TXOPC_OWN;
+			f->sk_opcode = SK_Y2_BMUOPC_ADDR64 | own;
+			own = SK_Y2_TXOPC_OWN;
 			sc_if->sk_cdata.sk_tx_hiaddr = hiaddr;
 			SK_INC(frag, MSK_TX_RING_CNT);
 			entries++;
@@ -1935,12 +1927,10 @@ msk_encap(struct sk_if_softc *sc_if, str
 		f->sk_len = htole16(txmap->dm_segs[i].ds_len);
 		f->sk_ctl = 0;
 		if (i == 0) {
-			if (hiaddr != old_hiaddr)
-f->sk_opcode = SK_Y2_TXOPC_PACKET | SK_Y2_TXOPC_OWN;
-			else
-f->sk_opcode = SK_Y2_TXOPC_PACKET;
+			f->sk_opcode = SK_Y2_TXOPC_PACKET | own;
 		} else
-			f->sk_opcode = SK_Y2_TXOPC_BUFFER | SK_Y2_TXOPC_OWN;
+			f->sk_opcode = SK_Y2_TXOPC_BUFFER | own;
+		own = SK_Y2_TXOPC_OWN;
 		cur = frag;
 		SK_INC(frag, MSK_TX_RING_CNT);
 		entries++;



CVS commit: src/sys/dev/pci

2020-04-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Apr 30 14:04:55 UTC 2020

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

Log Message:
msk(4): actually moderate interrupts from the Yukon 2 Status BMU

Previously the interrupt moderation enable register was being programmed
with sk(4)-style enable bits, none of which matched the significant
interrupt sources of the Yukon 2 we enable.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.107 src/sys/dev/pci/if_msk.c:1.108
--- src/sys/dev/pci/if_msk.c:1.107	Thu Apr 30 13:51:43 2020
+++ src/sys/dev/pci/if_msk.c	Thu Apr 30 14:04:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.107 2020/04/30 13:51:43 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.108 2020/04/30 14:04:54 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.107 2020/04/30 13:51:43 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.108 2020/04/30 14:04:54 jakllsch Exp $");
 
 #include 
 #include 
@@ -866,8 +866,7 @@ msk_update_int_mod(struct sk_softc *sc, 
 		aprint_verbose_dev(sc->sk_dev,
 		"interrupt moderation is %d us\n", sc->sk_int_mod);
 	sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod));
-	sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF | SK_ISR_TX2_S_EOF |
-	SK_ISR_RX1_EOF | SK_ISR_RX2_EOF);
+	sk_win_write_4(sc, SK_IMMR, SK_Y2_IMR_BMU);
 	sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
 	sc->sk_int_mod_pending = 0;
 }



CVS commit: src/sys/dev/pci

2020-04-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Apr 30 13:51:43 UTC 2020

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

Log Message:
msk(4): during attach print intrstr only once


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.106 src/sys/dev/pci/if_msk.c:1.107
--- src/sys/dev/pci/if_msk.c:1.106	Thu Apr 30 01:52:08 2020
+++ src/sys/dev/pci/if_msk.c	Thu Apr 30 13:51:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.106 2020/04/30 01:52:08 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.107 2020/04/30 13:51:43 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.106 2020/04/30 01:52:08 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.107 2020/04/30 13:51:43 jakllsch Exp $");
 
 #include 
 #include 
@@ -1740,7 +1740,7 @@ mskc_attach(device_t parent, device_t se
 	aprint_normal(", %s", sc->sk_name);
 	if (revstr != NULL)
 		aprint_normal(" rev. %s", revstr);
-	aprint_normal(" (0x%x): %s\n", sc->sk_rev, intrstr);
+	aprint_normal(" (0x%x)\n", sc->sk_rev);
 
 	aprint_normal_dev(sc->sk_dev, "interrupting at %s\n", intrstr);
 



CVS commit: src/sys/dev/pci

2020-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Apr 30 01:52:09 UTC 2020

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

Log Message:
msk(4): rework rx descriptor loading to support multiple segments

This paves the way to replace the driver-internal jumbo frame rx buffer
with other recieve buffers (for example MCLGET/MEXTMALLOC) in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.105 src/sys/dev/pci/if_msk.c:1.106
--- src/sys/dev/pci/if_msk.c:1.105	Wed Apr 29 20:03:52 2020
+++ src/sys/dev/pci/if_msk.c	Thu Apr 30 01:52:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.106 2020/04/30 01:52:08 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.106 2020/04/30 01:52:08 jakllsch Exp $");
 
 #include 
 #include 
@@ -113,7 +113,7 @@ static int msk_init(struct ifnet *);
 static void msk_init_yukon(struct sk_if_softc *);
 static void msk_stop(struct ifnet *, int);
 static void msk_watchdog(struct ifnet *);
-static int msk_newbuf(struct sk_if_softc *, bus_dmamap_t);
+static int msk_newbuf(struct sk_if_softc *);
 static int msk_alloc_jumbo_mem(struct sk_if_softc *);
 static void *msk_jalloc(struct sk_if_softc *);
 static void msk_jfree(struct mbuf *, void *, size_t, void *);
@@ -472,13 +472,18 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 }
 
 static int
-msk_newbuf(struct sk_if_softc *sc_if, bus_dmamap_t dmamap)
+msk_newbuf(struct sk_if_softc *sc_if)
 {
+	struct sk_softc		*sc = sc_if->sk_softc;
 	struct mbuf		*m_new = NULL;
 	struct sk_chain		*c;
 	struct msk_rx_desc	*r;
 	void			*buf = NULL;
 	bus_addr_t		addr;
+	bus_dmamap_t		rxmap;
+	size_t			i;
+	uint32_t		rxidx, frag, cur, hiaddr, old_hiaddr, total;
+	uint32_t		entries = 0;
 
 	MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 	if (m_new == NULL)
@@ -499,44 +504,99 @@ msk_newbuf(struct sk_if_softc *sc_if, bu
 
 	m_adj(m_new, ETHER_ALIGN);
 
-	addr = dmamap->dm_segs[0].ds_addr +
-		  ((vaddr_t)m_new->m_data -
-		   (vaddr_t)sc_if->sk_cdata.sk_jumbo_buf);
-
-	if (sc_if->sk_cdata.sk_rx_hiaddr != MSK_ADDR_HI(addr)) {
-		c = &sc_if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-		r = &sc_if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
-		c->sk_mbuf = NULL;
-		r->sk_addr = htole32(MSK_ADDR_HI(addr));
-		r->sk_len = 0;
-		r->sk_ctl = 0;
-		r->sk_opcode = SK_Y2_BMUOPC_ADDR64 | SK_Y2_RXOPC_OWN;
-		sc_if->sk_cdata.sk_rx_hiaddr = MSK_ADDR_HI(addr);
+	rxidx = frag = cur = sc_if->sk_cdata.sk_rx_prod;
+	rxmap = sc_if->sk_cdata.sk_rx_chain[rxidx].sk_dmamap;
 
-		MSK_CDRXSYNC(sc_if, sc_if->sk_cdata.sk_rx_prod,
-		BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+	if (bus_dmamap_load_mbuf(sc->sc_dmatag, rxmap, m_new, BUS_DMA_NOWAIT)) {
+		DPRINTFN(2, ("msk_newbuf: dmamap_load failed\n"));
+		m_freem(m_new);
+		return ENOBUFS;
+	}
 
-		SK_INC(sc_if->sk_cdata.sk_rx_prod, MSK_RX_RING_CNT);
-		sc_if->sk_cdata.sk_rx_cnt++;
+	/* Count how many rx descriptors needed. */
+	hiaddr = sc_if->sk_cdata.sk_rx_hiaddr;
+	for (total = i = 0; i < rxmap->dm_nsegs; i++) {
+		if (hiaddr != MSK_ADDR_HI(rxmap->dm_segs[i].ds_addr)) {
+			hiaddr = MSK_ADDR_HI(rxmap->dm_segs[i].ds_addr);
+			total++;
+		}
+		total++;
+	}
 
-		DPRINTFN(10, ("%s: rx ADDR64: %#x\n",
-		sc_if->sk_ethercom.ec_if.if_xname,
-			(unsigned)MSK_ADDR_HI(addr)));
+	if (total > MSK_RX_RING_CNT - sc_if->sk_cdata.sk_rx_cnt - 1) {
+		DPRINTFN(2, ("msk_newbuf: too few descriptors free\n"));
+		bus_dmamap_unload(sc->sc_dmatag, rxmap);
+		m_freem(m_new);
+		return ENOBUFS;
 	}
 
-	c = &sc_if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-	r = &sc_if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
-	c->sk_mbuf = m_new;
-	r->sk_addr = htole32(MSK_ADDR_LO(addr));
-	r->sk_len = htole16(SK_JLEN);
-	r->sk_ctl = 0;
-	r->sk_opcode = SK_Y2_RXOPC_PACKET | SK_Y2_RXOPC_OWN;
+	DPRINTFN(2, ("msk_newbuf: dm_nsegs=%d total desc=%u\n",
+	rxmap->dm_nsegs, total));
 
-	MSK_CDRXSYNC(sc_if, sc_if->sk_cdata.sk_rx_prod,
+	/* Sync the DMA map. */
+	bus_dmamap_sync(sc->sc_dmatag, rxmap, 0, rxmap->dm_mapsize,
+	BUS_DMASYNC_PREREAD);
+
+	old_hiaddr = sc_if->sk_cdata.sk_rx_hiaddr;
+	for (i = 0; i < rxmap->dm_nsegs; i++) {
+		addr = rxmap->dm_segs[i].ds_addr;
+		DPRINTFN(2, ("msk_newbuf: addr %llx\n",
+		(unsigned long long)addr));
+		hiaddr = MSK_ADDR_HI(addr);
+
+		if (sc_if->sk_cdata.sk_rx_hiaddr != hiaddr) {
+			c = &sc_if->sk_cdata.sk_rx_chain[frag];
+			c->sk_mbuf = NULL;
+			r = &sc_if->sk_rdata->sk_rx_ring[frag];
+			r->sk_addr = htole32(hiaddr);
+			r->sk_len = 0;
+			r->sk_ctl = 0;
+			if (i == 0)
+r

CVS commit: src/sys/dev/pci

2020-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 29 20:03:52 UTC 2020

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

Log Message:
msk(4): Simply keep a ring of (tx) dmamaps, rather than a linked list


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_mskvar.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.104 src/sys/dev/pci/if_msk.c:1.105
--- src/sys/dev/pci/if_msk.c:1.104	Wed Apr 29 18:52:03 2020
+++ src/sys/dev/pci/if_msk.c	Wed Apr 29 20:03:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $");
 
 #include 
 #include 
@@ -1099,7 +1099,6 @@ msk_attach(device_t parent, device_t sel
 	struct sk_softc *sc = device_private(parent);
 	struct skc_attach_args *sa = aux;
 	bus_dmamap_t dmamap;
-	struct sk_txmap_entry *entry;
 	struct ifnet *ifp;
 	struct mii_data * const mii = &sc_if->sk_mii;
 	void *kva;
@@ -1177,7 +1176,6 @@ msk_attach(device_t parent, device_t sel
 		goto fail_3;
 	}
 
-	SIMPLEQ_INIT(&sc_if->sk_txmap_head);
 	for (i = 0; i < MSK_TX_RING_CNT; i++) {
 		sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
 
@@ -1188,9 +1186,7 @@ msk_attach(device_t parent, device_t sel
 			goto fail_3;
 		}
 
-		entry = malloc(sizeof(*entry), M_DEVBUF, M_WAITOK);
-		entry->dmamap = dmamap;
-		SIMPLEQ_INSERT_HEAD(&sc_if->sk_txmap_head, entry, link);
+		sc_if->sk_cdata.sk_tx_chain[i].sk_dmamap = dmamap;
 	}
 
 	sc_if->sk_rdata = (struct msk_ring_data *)kva;
@@ -1294,18 +1290,17 @@ msk_detach(device_t self, int flags)
 {
 	struct sk_if_softc *sc_if = device_private(self);
 	struct sk_softc *sc = sc_if->sk_softc;
-	struct sk_txmap_entry *entry;
 	struct ifnet *ifp = &sc_if->sk_ethercom.ec_if;
+	int i;
 
 	if (sc->sk_if[sc_if->sk_port] == NULL)
 		return 0;
 
 	msk_stop(ifp, 1);
 
-	while ((entry = SIMPLEQ_FIRST(&sc_if->sk_txmap_head))) {
-		SIMPLEQ_REMOVE_HEAD(&sc_if->sk_txmap_head, link);
-		bus_dmamap_destroy(sc->sc_dmatag, entry->dmamap);
-		free(entry, M_DEVBUF);
+	for (i = 0; i < MSK_TX_RING_CNT; i++) {
+		bus_dmamap_destroy(sc->sc_dmatag,
+		sc_if->sk_cdata.sk_tx_chain[i].sk_dmamap);
 	}
 
 	if (--sc->rnd_attached == 0)
@@ -1786,18 +1781,12 @@ msk_encap(struct sk_if_softc *sc_if, str
 	uint32_t		frag, cur, hiaddr, old_hiaddr, total;
 	uint32_t		entries = 0;
 	size_t			i;
-	struct sk_txmap_entry	*entry;
 	bus_dmamap_t		txmap;
 	bus_addr_t		addr;
 
 	DPRINTFN(2, ("msk_encap\n"));
 
-	entry = SIMPLEQ_FIRST(&sc_if->sk_txmap_head);
-	if (entry == NULL) {
-		DPRINTFN(2, ("msk_encap: no txmap available\n"));
-		return ENOBUFS;
-	}
-	txmap = entry->dmamap;
+	txmap = sc_if->sk_cdata.sk_tx_chain[*txidx].sk_dmamap;
 
 	cur = frag = *txidx;
 
@@ -1880,10 +1869,11 @@ msk_encap(struct sk_if_softc *sc_if, str
 	}
 	KASSERTMSG(entries == total, "entries %u total %u", entries, total);
 
+	sc_if->sk_cdata.sk_tx_chain[*txidx].sk_dmamap =
+		sc_if->sk_cdata.sk_tx_chain[cur].sk_dmamap;
 	sc_if->sk_cdata.sk_tx_chain[cur].sk_mbuf = m_head;
-	SIMPLEQ_REMOVE_HEAD(&sc_if->sk_txmap_head, link);
+	sc_if->sk_cdata.sk_tx_chain[cur].sk_dmamap = txmap;
 
-	sc_if->sk_cdata.sk_tx_map[cur] = entry;
 	sc_if->sk_rdata->sk_tx_ring[cur].sk_ctl |= SK_Y2_TXCTL_LASTFRAG;
 
 	/* Sync descriptors before handing to chip */
@@ -2087,7 +2077,7 @@ msk_txeof(struct sk_if_softc *sc_if)
 	struct msk_tx_desc	*cur_tx;
 	struct ifnet		*ifp = &sc_if->sk_ethercom.ec_if;
 	uint32_t		idx, reg, sk_ctl;
-	struct sk_txmap_entry	*entry;
+	bus_dmamap_t		dmamap;
 
 	DPRINTFN(2, ("msk_txeof\n"));
 
@@ -2114,15 +2104,12 @@ msk_txeof(struct sk_if_softc *sc_if)
 		if (sk_ctl & SK_Y2_TXCTL_LASTFRAG)
 			if_statinc(ifp, if_opackets);
 		if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) {
-			entry = sc_if->sk_cdata.sk_tx_map[idx];
+			dmamap = sc_if->sk_cdata.sk_tx_chain[idx].sk_dmamap;
 
-			bus_dmamap_sync(sc->sc_dmatag, entry->dmamap, 0,
-			entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+			bus_dmamap_sync(sc->sc_dmatag, dmamap, 0,
+			dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
 
-			bus_dmamap_unload(sc->sc_dmatag, entry->dmamap);
-			SIMPLEQ_INSERT_TAIL(&sc_if->sk_txmap_head, entry,
-	  link);
-			sc_if->sk_cdata.sk_tx_map[idx] = NULL;
+			bus_dmamap_unload(sc->sc_dmatag, dmamap);
 			m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
 			sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
 		}
@@ -2611,7 +2598,7 @@ msk_stop(struct ifnet *ifp, int disable)
 {
 	struct sk_if_softc	*sc_if = ifp->if_softc;
 	struct s

CVS commit: src/sys/dev/pci

2020-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 29 18:52:03 UTC 2020

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

Log Message:
msk(4): don't keep array of pointers to each ring descriptor

With 512 descriptors each in 2 rings this saves 4KiB (LP32) or 8KiB (LP64)
per interface.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_mskvar.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.103 src/sys/dev/pci/if_msk.c:1.104
--- src/sys/dev/pci/if_msk.c:1.103	Tue Apr 28 17:26:01 2020
+++ src/sys/dev/pci/if_msk.c	Wed Apr 29 18:52:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.103 2020/04/28 17:26:01 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.103 2020/04/28 17:26:01 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $");
 
 #include 
 #include 
@@ -418,14 +418,9 @@ msk_init_rx_ring(struct sk_if_softc *sc_
 	struct msk_chain_data	*cd = &sc_if->sk_cdata;
 	struct msk_ring_data	*rd = sc_if->sk_rdata;
 	struct msk_rx_desc	*r;
-	int			i;
 
 	memset(rd->sk_rx_ring, 0, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT);
 
-	for (i = 0; i < MSK_RX_RING_CNT; i++) {
-		cd->sk_rx_chain[i].sk_le = &rd->sk_rx_ring[i];
-	}
-
 	sc_if->sk_cdata.sk_rx_prod = 0;
 	sc_if->sk_cdata.sk_rx_cons = 0;
 	sc_if->sk_cdata.sk_rx_cnt = 0;
@@ -453,14 +448,9 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 	struct msk_chain_data	*cd = &sc_if->sk_cdata;
 	struct msk_ring_data	*rd = sc_if->sk_rdata;
 	struct msk_tx_desc	*t;
-	int			i;
 
 	memset(rd->sk_tx_ring, 0, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT);
 
-	for (i = 0; i < MSK_TX_RING_CNT; i++) {
-		cd->sk_tx_chain[i].sk_le = &rd->sk_tx_ring[i];
-	}
-
 	sc_if->sk_cdata.sk_tx_prod = 0;
 	sc_if->sk_cdata.sk_tx_cons = 0;
 	sc_if->sk_cdata.sk_tx_cnt = 0;
@@ -515,7 +505,7 @@ msk_newbuf(struct sk_if_softc *sc_if, bu
 
 	if (sc_if->sk_cdata.sk_rx_hiaddr != MSK_ADDR_HI(addr)) {
 		c = &sc_if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-		r = c->sk_le;
+		r = &sc_if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
 		c->sk_mbuf = NULL;
 		r->sk_addr = htole32(MSK_ADDR_HI(addr));
 		r->sk_len = 0;
@@ -535,7 +525,7 @@ msk_newbuf(struct sk_if_softc *sc_if, bu
 	}
 
 	c = &sc_if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-	r = c->sk_le;
+	r = &sc_if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
 	c->sk_mbuf = m_new;
 	r->sk_addr = htole32(MSK_ADDR_LO(addr));
 	r->sk_len = htole16(SK_JLEN);

Index: src/sys/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.23 src/sys/dev/pci/if_mskvar.h:1.24
--- src/sys/dev/pci/if_mskvar.h:1.23	Sun Apr 26 16:14:14 2020
+++ src/sys/dev/pci/if_mskvar.h	Wed Apr 29 18:52:03 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.23 2020/04/26 16:14:14 jakllsch Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.24 2020/04/29 18:52:03 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -89,7 +89,6 @@ struct sk_jpool_entry {
 };
 
 struct sk_chain {
-	void			*sk_le;
 	struct mbuf		*sk_mbuf;
 };
 



CVS commit: src/sys/dev/pci

2020-04-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Apr 28 17:26:02 UTC 2020

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

Log Message:
Use correct-semantic byteorder(9) functions to provide letoh*() in msk(4)


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.102 src/sys/dev/pci/if_msk.c:1.103
--- src/sys/dev/pci/if_msk.c:1.102	Tue Apr 28 17:15:48 2020
+++ src/sys/dev/pci/if_msk.c	Tue Apr 28 17:26:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.102 2020/04/28 17:15:48 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.103 2020/04/28 17:26:01 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.102 2020/04/28 17:15:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.103 2020/04/28 17:26:01 jakllsch Exp $");
 
 #include 
 #include 
@@ -68,8 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1
 #include 
 #include 
 #ifdef __NetBSD__
- #define letoh16 htole16
- #define letoh32 htole32
+ #define letoh16 le16toh
+ #define letoh32 le32toh
 #endif
 
 #include 



CVS commit: src/sys/dev/pci

2020-04-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Apr 28 17:15:48 UTC 2020

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

Log Message:
Remove unused cargo cult include of  in if_msk.c.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.101 src/sys/dev/pci/if_msk.c:1.102
--- src/sys/dev/pci/if_msk.c:1.101	Sun Apr 26 16:14:14 2020
+++ src/sys/dev/pci/if_msk.c	Tue Apr 28 17:15:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.101 2020/04/26 16:14:14 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.102 2020/04/28 17:15:48 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.101 2020/04/26 16:14:14 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.102 2020/04/28 17:15:48 jakllsch Exp $");
 
 #include 
 #include 
@@ -83,7 +83,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1
 
 #include 
 #include 
-#include 
 
 #include 
 #include 



CVS commit: src/sys/dev/pci

2020-04-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Apr 26 16:14:14 UTC 2020

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

Log Message:
Remove written-only sk_next member of struct (m)sk_chain.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_mskvar.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.100 src/sys/dev/pci/if_msk.c:1.101
--- src/sys/dev/pci/if_msk.c:1.100	Wed Apr 22 14:26:27 2020
+++ src/sys/dev/pci/if_msk.c	Sun Apr 26 16:14:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.100 2020/04/22 14:26:27 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.101 2020/04/26 16:14:14 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.100 2020/04/22 14:26:27 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.101 2020/04/26 16:14:14 jakllsch Exp $");
 
 #include 
 #include 
@@ -419,17 +419,12 @@ msk_init_rx_ring(struct sk_if_softc *sc_
 	struct msk_chain_data	*cd = &sc_if->sk_cdata;
 	struct msk_ring_data	*rd = sc_if->sk_rdata;
 	struct msk_rx_desc	*r;
-	int			i, nexti;
+	int			i;
 
 	memset(rd->sk_rx_ring, 0, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT);
 
 	for (i = 0; i < MSK_RX_RING_CNT; i++) {
 		cd->sk_rx_chain[i].sk_le = &rd->sk_rx_ring[i];
-		if (i == (MSK_RX_RING_CNT - 1))
-			nexti = 0;
-		else
-			nexti = i + 1;
-		cd->sk_rx_chain[i].sk_next = &cd->sk_rx_chain[nexti];
 	}
 
 	sc_if->sk_cdata.sk_rx_prod = 0;
@@ -459,17 +454,12 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 	struct msk_chain_data	*cd = &sc_if->sk_cdata;
 	struct msk_ring_data	*rd = sc_if->sk_rdata;
 	struct msk_tx_desc	*t;
-	int			i, nexti;
+	int			i;
 
 	memset(rd->sk_tx_ring, 0, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT);
 
 	for (i = 0; i < MSK_TX_RING_CNT; i++) {
 		cd->sk_tx_chain[i].sk_le = &rd->sk_tx_ring[i];
-		if (i == (MSK_TX_RING_CNT - 1))
-			nexti = 0;
-		else
-			nexti = i + 1;
-		cd->sk_tx_chain[i].sk_next = &cd->sk_tx_chain[nexti];
 	}
 
 	sc_if->sk_cdata.sk_tx_prod = 0;

Index: src/sys/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.22 src/sys/dev/pci/if_mskvar.h:1.23
--- src/sys/dev/pci/if_mskvar.h:1.22	Fri Sep 13 07:55:07 2019
+++ src/sys/dev/pci/if_mskvar.h	Sun Apr 26 16:14:14 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.22 2019/09/13 07:55:07 msaitoh Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.23 2020/04/26 16:14:14 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -91,7 +91,6 @@ struct sk_jpool_entry {
 struct sk_chain {
 	void			*sk_le;
 	struct mbuf		*sk_mbuf;
-	struct sk_chain		*sk_next;
 };
 
 /*



CVS commit: src/sys/dev/pci

2020-04-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Apr 26 15:39:04 UTC 2020

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

Log Message:
Use __aligned(8) with naturally-aligned-yet-__packed msk(4) descriptors.

Allows compiler to generate more efficent struct member accesses.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_skreg.h

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

Modified files:

Index: src/sys/dev/pci/if_skreg.h
diff -u src/sys/dev/pci/if_skreg.h:1.27 src/sys/dev/pci/if_skreg.h:1.28
--- src/sys/dev/pci/if_skreg.h:1.27	Fri Nov 15 12:38:09 2019
+++ src/sys/dev/pci/if_skreg.h	Sun Apr 26 15:39:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_skreg.h,v 1.27 2019/11/15 12:38:09 msaitoh Exp $ */
+/* $NetBSD: if_skreg.h,v 1.28 2020/04/26 15:39:04 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -1701,7 +1701,7 @@ struct msk_rx_desc {
 	u_int16_t		sk_len;
 	u_int8_t		sk_ctl;
 	u_int8_t		sk_opcode;
-} __packed;
+} __packed __aligned(8);
 
 #define SK_Y2_RXOPC_BUFFER	0x40
 #define SK_Y2_RXOPC_PACKET	0x41
@@ -1712,7 +1712,7 @@ struct msk_tx_desc {
 	u_int16_t		sk_len;
 	u_int8_t		sk_ctl;
 	u_int8_t		sk_opcode;
-} __packed;
+} __packed __aligned(8);
 
 #define SK_Y2_TXCTL_LASTFRAG	0x80
 
@@ -1725,7 +1725,7 @@ struct msk_status_desc {
 	u_int16_t		sk_len;
 	u_int8_t		sk_link;
 	u_int8_t		sk_opcode;
-} __packed;
+} __packed __aligned(8);
 
 #define SK_Y2_STOPC_RXSTAT	0x60
 #define SK_Y2_STOPC_TXSTAT	0x68



  1   2   3   4   5   6   7   8   9   10   >