CVS commit: src/sys

2022-10-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 11 22:03:37 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c
src/sys/arch/hppa/hppa: mainbus.c
src/sys/arch/vax/vax: bus_dma.c
src/sys/dev/pci: if_bge.c vioscsi.c

Log Message:
fix typos in log messages s/bus_dmamem_create/bus_dmamap_create/ and
s/bus_dmamem_load/bus_dmamap_load/.
Inspired by recent similar fixes in OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/arch/arm/arm32/bus_dma.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/hppa/mainbus.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/vax/vax/bus_dma.c
cvs rdiff -u -r1.387 -r1.388 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.29 -r1.30 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.



CVS commit: src/sys

2022-10-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 11 22:03:37 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c
src/sys/arch/hppa/hppa: mainbus.c
src/sys/arch/vax/vax: bus_dma.c
src/sys/dev/pci: if_bge.c vioscsi.c

Log Message:
fix typos in log messages s/bus_dmamem_create/bus_dmamap_create/ and
s/bus_dmamem_load/bus_dmamap_load/.
Inspired by recent similar fixes in OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/arch/arm/arm32/bus_dma.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/hppa/mainbus.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/vax/vax/bus_dma.c
cvs rdiff -u -r1.387 -r1.388 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.29 -r1.30 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/arch/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.137 src/sys/arch/arm/arm32/bus_dma.c:1.138
--- src/sys/arch/arm/arm32/bus_dma.c:1.137	Tue Jul 26 20:08:54 2022
+++ src/sys/arch/arm/arm32/bus_dma.c	Tue Oct 11 22:03:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.137 2022/07/26 20:08:54 andvar Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.138 2022/10/11 22:03:37 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.137 2022/07/26 20:08:54 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.138 2022/10/11 22:03:37 andvar Exp $");
 
 #include 
 
@@ -1640,7 +1640,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 	pmap_t pmap;
 
 #ifdef DEBUG_DMA
-	printf("_bus_dmamem_load_buffer(buf=%p, len=%#lx, flags=%#x)\n",
+	printf("_bus_dmamap_load_buffer(buf=%p, len=%#lx, flags=%#x)\n",
 	buf, buflen, flags);
 #endif	/* DEBUG_DMA */
 

Index: src/sys/arch/hppa/hppa/mainbus.c
diff -u src/sys/arch/hppa/hppa/mainbus.c:1.10 src/sys/arch/hppa/hppa/mainbus.c:1.11
--- src/sys/arch/hppa/hppa/mainbus.c:1.10	Tue Jul 26 20:08:55 2022
+++ src/sys/arch/hppa/hppa/mainbus.c	Tue Oct 11 22:03:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.10 2022/07/26 20:08:55 andvar Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.11 2022/10/11 22:03:37 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2022/07/26 20:08:55 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2022/10/11 22:03:37 andvar Exp $");
 
 #include "locators.h"
 #include "power.h"
@@ -944,12 +944,12 @@ mbus_dmamap_load_raw(void *v, bus_dmamap
 	for (m = TAILQ_FIRST(mlist); m != NULL; m = TAILQ_NEXT(m,pageq.queue)) {
 
 		if (size == 0)
-			panic("mbus_dmamem_load_raw: size botch");
+			panic("mbus_dmamap_load_raw: size botch");
 
 		pa = VM_PAGE_TO_PHYS(m);
 		if (pa != pa_next) {
 			if (++seg >= map->_dm_segcnt)
-panic("mbus_dmamem_load_raw: nsegs botch");
+panic("mbus_dmamap_load_raw: nsegs botch");
 			map->dm_segs[seg].ds_addr = pa;
 			map->dm_segs[seg].ds_len = 0;
 		}

Index: src/sys/arch/vax/vax/bus_dma.c
diff -u src/sys/arch/vax/vax/bus_dma.c:1.38 src/sys/arch/vax/vax/bus_dma.c:1.39
--- src/sys/arch/vax/vax/bus_dma.c:1.38	Tue Jul 26 20:08:56 2022
+++ src/sys/arch/vax/vax/bus_dma.c	Tue Oct 11 22:03:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.38 2022/07/26 20:08:56 andvar Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.39 2022/10/11 22:03:37 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.38 2022/07/26 20:08:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.39 2022/10/11 22:03:37 andvar Exp $");
 
 #include 
 #include 
@@ -556,7 +556,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 	pmap_t pmap;
 
 #ifdef DEBUG_DMA
-	printf("_bus_dmamem_load_buffer(buf=%p, len=%lx, flags=%d, 1st=%d)\n",
+	printf("_bus_dmamap_load_buffer(buf=%p, len=%lx, flags=%d, 1st=%d)\n",
 	buf, buflen, flags, first);
 #endif	/* DEBUG_DMA */
 

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.387 src/sys/dev/pci/if_bge.c:1.388
--- src/sys/dev/pci/if_bge.c:1.387	Sun Sep  4 08:55:43 2022
+++ src/sys/dev/pci/if_bge.c	Tue Oct 11 22:03:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.387 2022/09/04 08:55:43 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.388 2022/10/11 22:03:37 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.387 2022/09/04 08:55:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.388 2022/10/11 22:03:37 andvar Exp $");
 
 #include 
 #include 
@@ -3814,7 +3814,7 @@ bge_attach(device_t parent, device_t sel
 		sc->bge_ring_rseg);
 		return;
 	}
-	DPRINTFN(5, ("bus_dmamem_create\n"));
+	DPRINTFN(5, ("bus_dmamap_create\n"));
 	if (bus_dmamap_create(sc->bge_dmatag, sizeof(struct bge_ring_data), 

CVS commit: [netbsd-9] src/doc

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:26:37 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Tickets #1537 - #1540


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/doc/CHANGES-9.4

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-9.4
diff -u src/doc/CHANGES-9.4:1.1.2.23 src/doc/CHANGES-9.4:1.1.2.24
--- src/doc/CHANGES-9.4:1.1.2.23	Mon Oct 10 15:03:40 2022
+++ src/doc/CHANGES-9.4	Tue Oct 11 18:26:37 2022
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.23 2022/10/10 15:03:40 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.24 2022/10/11 18:26:37 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -316,3 +316,38 @@ sys/arch/x86/x86/ioapic.c			1.66
 	- Print detail about misconfigured APIC ID.
 	[msaitoh, ticket #1536]
 
+sys/arch/x86/pci/imcsmb/imc.c			1.5
+sys/dev/pci/pcidevs1.1461-1.1468
+sys/dev/pci/pcidevs.h(regen)
+sys/dev/pci/pcidevs_data.h			(regen)
+
+	- Add several samsung nvme entries.
+	- Add more Alder Lake devices.
+	- Jasper Lake Intel Trace Hub on Compute Die is not 0x4da6 but 0x4e29.
+	- Add Intel Core 8G (8core, H, Halo) Host Bridge, DRAM.
+	- Add AMD 19h/6xh Root Complex. 
+	- Add AMD FCH SATA Controller D.
+	- Add NVIDIA GeForce GTX 770.
+	- Sort by number.
+	[msaitoh, ticket #1537]
+
+sys/arch/x86/include/cpu_ucode.h		1.5
+sys/arch/x86/x86/cpu_ucode_intel.c		1.19,1.20
+
+	- Verify checksum of the extended signature table.
+	- KNF.
+	[msaitoh, ticket #1538]
+
+share/man/man4/man4.x86/amdsmn.4		1.5
+sys/arch/x86/pci/amdsmn.c			1.14
+sys/arch/x86/pci/amdzentemp.c			1.12-1.15
+
+	amdsmn(4), amdzentemp(4): Add zen3 and zen4 support.
+	Add support for per CCD temperature sensor.
+	[msaitoh, ticket #1539]
+
+usr.bin/skey/skeyaudit.sh			1.5
+
+	Adapt to removal of "Mail".
+	[is, ticket #1540]
+



CVS commit: [netbsd-9] src/doc

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:26:37 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Tickets #1537 - #1540


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/doc/CHANGES-9.4

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



CVS commit: [netbsd-9] src/usr.bin/skey

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:25:26 UTC 2022

Modified Files:
src/usr.bin/skey [netbsd-9]: skeyaudit.sh

Log Message:
Pull up following revision(s) (requested by is in ticket #1540):

usr.bin/skey/skeyaudit.sh: revision 1.5

We removed Mail before branching netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.102.1 src/usr.bin/skey/skeyaudit.sh

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

Modified files:

Index: src/usr.bin/skey/skeyaudit.sh
diff -u src/usr.bin/skey/skeyaudit.sh:1.4 src/usr.bin/skey/skeyaudit.sh:1.4.102.1
--- src/usr.bin/skey/skeyaudit.sh:1.4	Thu Jul 27 14:40:58 2000
+++ src/usr.bin/skey/skeyaudit.sh	Tue Oct 11 18:25:26 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: skeyaudit.sh,v 1.4 2000/07/27 14:40:58 mjl Exp $
+#	$NetBSD: skeyaudit.sh,v 1.4.102.1 2022/10/11 18:25:26 martin Exp $
 #
 # This script will look thru the skeykeys file for
 # people with sequence numbers less than LOWLIMIT=12
@@ -56,6 +56,6 @@ while [ "X$1" != "X" ]; do
 $ECHO " "
 $ECHO "Use \"skeyinit -s\" to reinitialize your sequence number."
 $ECHO ""
-) | /usr/bin/Mail -s "$SUBJECT"  $USER $ADMIN
+) | /usr/bin/mailx -s "$SUBJECT"  $USER $ADMIN
   fi
 done



CVS commit: [netbsd-9] src/usr.bin/skey

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:25:26 UTC 2022

Modified Files:
src/usr.bin/skey [netbsd-9]: skeyaudit.sh

Log Message:
Pull up following revision(s) (requested by is in ticket #1540):

usr.bin/skey/skeyaudit.sh: revision 1.5

We removed Mail before branching netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.102.1 src/usr.bin/skey/skeyaudit.sh

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



CVS commit: [netbsd-8] src/doc

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:24:18 UTC 2022

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

Log Message:
Tickets #1771 - #1773


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.154 -r1.1.2.155 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.154 src/doc/CHANGES-8.3:1.1.2.155
--- src/doc/CHANGES-8.3:1.1.2.154	Mon Oct 10 15:11:45 2022
+++ src/doc/CHANGES-8.3	Tue Oct 11 18:24:18 2022
@@ -1,4 +1,4 @@
- $NetBSD: CHANGES-8.3,v 1.1.2.154 2022/10/10 15:11:45 martin Exp $
+ $NetBSD: CHANGES-8.3,v 1.1.2.155 2022/10/11 18:24:18 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -2886,3 +2886,34 @@ sys/net/if_ethersubr.c1.254
 	Fix inverted logic dropping wrong sized packets in the VLAN path.
 	[msaitoh, ticket #1770]
 
+sys/dev/pci/pcidevs1.1461-1.1468 via patch
+sys/dev/pci/pcidevs.hregen
+sys/dev/pci/pcidevs_data.h			regen
+
+	- Add several samsung nvme entries.
+	- Add more Alder Lake devices.
+	- Jasper Lake Intel Trace Hub on Compute Die is not 0x4da6 but 0x4e29.
+	- Add Intel Core 8G (8core, H, Halo) Host Bridge, DRAM.
+	- Add AMD 19h/6xh Root Complex.
+	- Add AMD FCH SATA Controller D.
+	- Add NVIDIA GeForce GTX 770.
+	- Sort by number.
+	[msaitoh, ticket #1771]
+
+sys/arch/x86/include/cpu_ucode.h		1.5
+sys/arch/x86/x86/cpu_ucode_intel.c		1.19,1.20
+
+	- Verify checksum of the extended signature table.
+	- KNF.
+	[msaitoh, ticket #1772]
+
+share/man/man4/man4.x86/amdsmn.4		1.4,1.5
+share/man/man4/man4.x86/amdzentemp.4		1.7
+sys/arch/x86/pci/amdsmn.c			1.7-1.9,1.13,1.14
+sys/arch/x86/pci/amdzentemp.c			1.8-1.10,1.12-1.15
+
+	- Add some newer zen2, zen3 and zen4 support.
+	- Fix temperature bias values.
+	- Add support for per CCD temperature sensor.
+	[msaitoh, ticket #1773]
+



CVS commit: [netbsd-8] src/doc

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:24:18 UTC 2022

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

Log Message:
Tickets #1771 - #1773


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.154 -r1.1.2.155 src/doc/CHANGES-8.3

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



CVS commit: [netbsd-8] src

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:22:44 UTC 2022

Modified Files:
src/share/man/man4/man4.x86 [netbsd-8]: amdsmn.4 amdzentemp.4
src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1773):

share/man/man4/man4.x86/amdsmn.41.4,1.5
share/man/man4/man4.x86/amdzentemp.41.7
sys/arch/x86/pci/amdsmn.c   1.7-1.9,1.13,1.14
sys/arch/x86/pci/amdzentemp.c   1.8-1.10,1.12-1.15

adjust for possible 49K offset

presence of this offset is indicated by a set 19th bit which is shifted away
this brings the temperature to "normal" levels on my ryzen 2700
(I assumed the same 49K offset as the k10temp project)

correct for known temperature bias values.

Update to support Family 15h Model 60 temperature sensors.

Changes based on FreeBSD amdtemp driver changes by Conrad Meyer.

XXX: Some code duplication between this driver and amdtemp as
 parts of the 15h refresh code share more in common with
 older CPUs while accessing the device more like 17h.

Don't mix sign and unsigned operands. Just use size_t for the loop.

Apply previous change ("Don't mix sign and unsigned operands. Just use
size_t for the loop.") to another loop variable.

amdzentemp(4): Add Zen 3 support.

amdzentemp(4): Add support for per CCD temperature sensor from FreeBSD.

Fix build failure on i386.

Rename for AMD F15/6X device. No functional change.
amdsmn(4),amdzentemp(4): Add support for 17h/6xh and 19h/6xh.

Note that these drivers are present on some newer AMD Family 15h
processors.

amdsmn.4: Now support AMD Family 19h processors.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/share/man/man4/man4.x86/amdsmn.4
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/share/man/man4/man4.x86/amdzentemp.4
cvs rdiff -u -r1.3.2.4 -r1.3.2.5 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/sys/arch/x86/pci/amdzentemp.c

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.x86/amdsmn.4
diff -u src/share/man/man4/man4.x86/amdsmn.4:1.3.2.2 src/share/man/man4/man4.x86/amdsmn.4:1.3.2.3
--- src/share/man/man4/man4.x86/amdsmn.4:1.3.2.2	Mon Feb  5 13:06:55 2018
+++ src/share/man/man4/man4.x86/amdsmn.4	Tue Oct 11 18:22:44 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: amdsmn.4,v 1.3.2.2 2018/02/05 13:06:55 martin Exp $
+.\"	$NetBSD: amdsmn.4,v 1.3.2.3 2022/10/11 18:22:44 martin Exp $
 .\"
 .\" Copyright (c) 2018 Ian Clark 
 .\" All rights reserved.
@@ -54,7 +54,7 @@
 .\"
 .\" $FreeBSD: head/share/man/man4/amdsmn.4 323184 2017-09-05 15:13:41Z cem $
 .\"
-.Dd January 22, 2018
+.Dd October 2, 2022
 .Dt AMDSMN 4 x86
 .Os
 .Sh NAME
@@ -66,7 +66,8 @@
 The
 .Nm
 driver provides support for resources on the System Management Network bus
-in AMD Family 17h processors.
+in AMD Family 19h processors, 17h processors and some later
+AMD Family 15h processors.
 .Sh SEE ALSO
 .Xr amdzentemp 4
 .Sh HISTORY

Index: src/share/man/man4/man4.x86/amdzentemp.4
diff -u src/share/man/man4/man4.x86/amdzentemp.4:1.6.2.2 src/share/man/man4/man4.x86/amdzentemp.4:1.6.2.3
--- src/share/man/man4/man4.x86/amdzentemp.4:1.6.2.2	Mon Feb  5 13:06:55 2018
+++ src/share/man/man4/man4.x86/amdzentemp.4	Tue Oct 11 18:22:44 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: amdzentemp.4,v 1.6.2.2 2018/02/05 13:06:55 martin Exp $
+.\" $NetBSD: amdzentemp.4,v 1.6.2.3 2022/10/11 18:22:44 martin Exp $
 .\"-
 .\" Copyright (c) 2008 Christoph Egger
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.4 2007/10/15 20:00:19 netchild Exp $
 .\"
-.Dd January 28, 2018
+.Dd April 20, 2020
 .Dt AMDZENTEMP 4 x86
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 The
 .Nm
 driver provides support for the on-die digital thermal sensor present
-on AMD Ryzen CPUs
+on AMD Ryzen CPUs and some later AMD Opteron CPUs.
 .Pp
 These sensors provide 0.125\(deC accuracy.
 There is one sensor for each CPU socket.

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.3.2.4 src/sys/arch/x86/pci/amdsmn.c:1.3.2.5
--- src/sys/arch/x86/pci/amdsmn.c:1.3.2.4	Tue Aug  6 16:05:11 2019
+++ src/sys/arch/x86/pci/amdsmn.c	Tue Oct 11 18:22:44 2022
@@ -1,7 +1,7 @@
-/*	$NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.3.2.5 2022/10/11 18:22:44 martin Exp $	*/
 
 /*-
- * Copyright (c) 2017 Conrad Meyer 
+ * Copyright (c) 2017, 2019 Conrad Meyer 
  * All rights reserved.
  *
  * NetBSD port by Ian Clark 
@@ -29,10 +29,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.5 2022/10/11 18:22:44 martin Exp $ ");
 
 /*
- * Driver for the AMD Family 17h CPU System Management Network.
+ * Driver for the AMD Family 15h (model 60+) and 17h 

CVS commit: [netbsd-8] src

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:22:44 UTC 2022

Modified Files:
src/share/man/man4/man4.x86 [netbsd-8]: amdsmn.4 amdzentemp.4
src/sys/arch/x86/pci [netbsd-8]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1773):

share/man/man4/man4.x86/amdsmn.41.4,1.5
share/man/man4/man4.x86/amdzentemp.41.7
sys/arch/x86/pci/amdsmn.c   1.7-1.9,1.13,1.14
sys/arch/x86/pci/amdzentemp.c   1.8-1.10,1.12-1.15

adjust for possible 49K offset

presence of this offset is indicated by a set 19th bit which is shifted away
this brings the temperature to "normal" levels on my ryzen 2700
(I assumed the same 49K offset as the k10temp project)

correct for known temperature bias values.

Update to support Family 15h Model 60 temperature sensors.

Changes based on FreeBSD amdtemp driver changes by Conrad Meyer.

XXX: Some code duplication between this driver and amdtemp as
 parts of the 15h refresh code share more in common with
 older CPUs while accessing the device more like 17h.

Don't mix sign and unsigned operands. Just use size_t for the loop.

Apply previous change ("Don't mix sign and unsigned operands. Just use
size_t for the loop.") to another loop variable.

amdzentemp(4): Add Zen 3 support.

amdzentemp(4): Add support for per CCD temperature sensor from FreeBSD.

Fix build failure on i386.

Rename for AMD F15/6X device. No functional change.
amdsmn(4),amdzentemp(4): Add support for 17h/6xh and 19h/6xh.

Note that these drivers are present on some newer AMD Family 15h
processors.

amdsmn.4: Now support AMD Family 19h processors.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/share/man/man4/man4.x86/amdsmn.4
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/share/man/man4/man4.x86/amdzentemp.4
cvs rdiff -u -r1.3.2.4 -r1.3.2.5 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/sys/arch/x86/pci/amdzentemp.c

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



CVS commit: [netbsd-9] src

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:16:21 UTC 2022

Modified Files:
src/share/man/man4/man4.x86 [netbsd-9]: amdsmn.4
src/sys/arch/x86/pci [netbsd-9]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1539):

share/man/man4/man4.x86/amdsmn.4: revision 1.5
sys/arch/x86/pci/amdsmn.c: revision 1.14
sys/arch/x86/pci/amdzentemp.c: revision 1.12-1.15

amdzentemp(4): Add Zen 3 support.

amdzentemp(4): Add support for per CCD temperature sensor from FreeBSD.

Fix build failure on i386.

amdsmn(4),amdzentemp(4): Add support for 17h/6xh and 19h/6xh.

amdsmn.4: Now support AMD Family 19h processors.


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/share/man/man4/man4.x86/amdsmn.4
cvs rdiff -u -r1.5.2.2 -r1.5.2.3 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.1 -r1.9.2.2 src/sys/arch/x86/pci/amdzentemp.c

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



CVS commit: [netbsd-9] src

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:16:21 UTC 2022

Modified Files:
src/share/man/man4/man4.x86 [netbsd-9]: amdsmn.4
src/sys/arch/x86/pci [netbsd-9]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1539):

share/man/man4/man4.x86/amdsmn.4: revision 1.5
sys/arch/x86/pci/amdsmn.c: revision 1.14
sys/arch/x86/pci/amdzentemp.c: revision 1.12-1.15

amdzentemp(4): Add Zen 3 support.

amdzentemp(4): Add support for per CCD temperature sensor from FreeBSD.

Fix build failure on i386.

amdsmn(4),amdzentemp(4): Add support for 17h/6xh and 19h/6xh.

amdsmn.4: Now support AMD Family 19h processors.


To generate a diff of this commit:
cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/share/man/man4/man4.x86/amdsmn.4
cvs rdiff -u -r1.5.2.2 -r1.5.2.3 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.1 -r1.9.2.2 src/sys/arch/x86/pci/amdzentemp.c

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.x86/amdsmn.4
diff -u src/share/man/man4/man4.x86/amdsmn.4:1.3.8.1 src/share/man/man4/man4.x86/amdsmn.4:1.3.8.2
--- src/share/man/man4/man4.x86/amdsmn.4:1.3.8.1	Fri Apr 24 17:46:44 2020
+++ src/share/man/man4/man4.x86/amdsmn.4	Tue Oct 11 18:16:20 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: amdsmn.4,v 1.3.8.1 2020/04/24 17:46:44 martin Exp $
+.\"	$NetBSD: amdsmn.4,v 1.3.8.2 2022/10/11 18:16:20 martin Exp $
 .\"
 .\" Copyright (c) 2018 Ian Clark 
 .\" All rights reserved.
@@ -54,7 +54,7 @@
 .\"
 .\" $FreeBSD: head/share/man/man4/amdsmn.4 323184 2017-09-05 15:13:41Z cem $
 .\"
-.Dd April 20, 2020
+.Dd October 2, 2022
 .Dt AMDSMN 4 x86
 .Os
 .Sh NAME
@@ -66,7 +66,8 @@
 The
 .Nm
 driver provides support for resources on the System Management Network bus
-in AMD Family 17h processors and some later AMD Family 15h processors.
+in AMD Family 19h processors, 17h processors and some later
+AMD Family 15h processors.
 .Sh SEE ALSO
 .Xr amdzentemp 4
 .Sh HISTORY

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.5.2.2 src/sys/arch/x86/pci/amdsmn.c:1.5.2.3
--- src/sys/arch/x86/pci/amdsmn.c:1.5.2.2	Wed Jul 27 14:40:08 2022
+++ src/sys/arch/x86/pci/amdsmn.c	Tue Oct 11 18:16:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.5.2.2 2022/07/27 14:40:08 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.5.2.3 2022/10/11 18:16:20 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.2 2022/07/27 14:40:08 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.3 2022/10/11 18:16:20 martin Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -88,10 +88,20 @@ static const struct pciid {
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
 	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_6X_RC,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
+	{
 		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC,
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F19_6X_RC,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
 };
 
 static int amdsmn_match(device_t, cfdata_t, void *);

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.9.2.1 src/sys/arch/x86/pci/amdzentemp.c:1.9.2.2
--- src/sys/arch/x86/pci/amdzentemp.c:1.9.2.1	Fri Apr 24 17:46:44 2020
+++ src/sys/arch/x86/pci/amdzentemp.c	Tue Oct 11 18:16:20 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.9.2.1 2020/04/24 17:46:44 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.9.2.2 2022/10/11 18:16:20 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.1 2020/04/24 17:46:44 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.2 2022/10/11 18:16:20 martin Exp $ ");
 
 #include 
 #include 
@@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c
 #define	AMD_CURTMP_RANGE_ADJUST	4900	/* in microKelvins (ie, 49C) */
 #define	AMD_CURTMP_RANGE_CHECK	__BIT(19)
 #define	F10_TEMP_CURTMP		__BITS(31,21)	/* XXX same as amdtemp.c */
+#define	F10_TEMP_CURTMP_MASK	0x7ff
 #define	F15M60_CURTMP_TJSEL	__BITS(17,16)
 
 /*
@@ -96,13 +97,40 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c
  */
 #define	AMD_17H_CUR_TMP			0x59800
 
+/*
+ * The following register set was discovered experimentally by Ondrej Čerman
+ * and collaborators, but is not (yet) documented in a PPR/OSRR (other than
+ * the M70H PPR SMN memory map showing [0x59800, +0x314] as allocated to
+ * SMU::THM).  It seems plausible and the Linux sensor folks have adopted it.
+ */
+#define	AMD_17H_CCD_TMP_BASE		0x59954
+#define	AMD_17H_CCD_TMP_VALID		__BIT(11)
+
 struct amdzentemp_softc {
+	device_t sc_dev;
 	

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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:07:11 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-8]: cpu_ucode.h
src/sys/arch/x86/x86 [netbsd-8]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1772):

sys/arch/x86/include/cpu_ucode.h: revision 1.5
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.19
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.20

Add missing newline in a message. KNF.
Verify checksum of the extended signature table.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.30.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/arch/x86/x86/cpu_ucode_intel.c

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

Modified files:

Index: src/sys/arch/x86/include/cpu_ucode.h
diff -u src/sys/arch/x86/include/cpu_ucode.h:1.3 src/sys/arch/x86/include/cpu_ucode.h:1.3.30.1
--- src/sys/arch/x86/include/cpu_ucode.h:1.3	Wed Oct 17 20:19:55 2012
+++ src/sys/arch/x86/include/cpu_ucode.h	Tue Oct 11 18:07:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.h,v 1.3 2012/10/17 20:19:55 drochner Exp $ */
+/* $NetBSD: cpu_ucode.h,v 1.3.30.1 2022/10/11 18:07:11 martin Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -72,17 +72,16 @@ struct intel1_ucode_header {
 	uint32_t	uh_reserved[3];
 };
 
-struct intel1_ucode_proc_signature {
-	uint32_t	ups_signature;
-	uint32_t	ups_proc_flags;
-	uint32_t	ups_checksum;
-};
-
 struct intel1_ucode_ext_table {
 	uint32_t	uet_count;
 	uint32_t	uet_checksum;
 	uint32_t	uet_reserved[3];
-	struct intel1_ucode_proc_signature uet_proc_sig[1];
+};
+
+struct intel1_ucode_proc_signature {
+	uint32_t	ups_signature;
+	uint32_t	ups_proc_flags;
+	uint32_t	ups_checksum;
 };
 
 #endif

Index: src/sys/arch/x86/x86/cpu_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.12.2.2 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.12.2.3
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.12.2.2	Sun May 12 09:22:52 2019
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c	Tue Oct 11 18:07:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.12.2.2 2019/05/12 09:22:52 martin Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.12.2.3 2022/10/11 18:07:11 martin Exp $ */
 
 /*
  * Copyright (c) 2012, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.12.2.2 2019/05/12 09:22:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.12.2.3 2022/10/11 18:07:11 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_cpu_ucode.h"
@@ -109,63 +109,65 @@ static int
 cpu_ucode_intel_verify(struct cpu_ucode_softc *sc,
 struct intel1_ucode_header *buf)
 {
+	struct intel1_ucode_ext_table *ehdr;
 	uint32_t data_size, total_size, payload_size, ext_size;
 	uint32_t sum;
+	uint32_t *p;
 	int i;
 
 	if ((buf->uh_header_ver != 1) || (buf->uh_loader_rev != 1))
 		return EINVAL;
 
-	/*
-	 * Data size.
-	 */
-	if (buf->uh_data_size == 0) {
+	/* Data size. */
+	if (buf->uh_data_size == 0)
 		data_size = 2000;
-	} else {
+	else
 		data_size = buf->uh_data_size;
-	}
 	if ((data_size % 4) != 0)
 		return EINVAL;
 	if (data_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Total size.
-	 */
-	if (buf->uh_total_size == 0) {
+	/* Total size. */
+	if (buf->uh_total_size == 0)
 		total_size = data_size + 48;
-	} else {
+	else
 		total_size = buf->uh_total_size;
-	}
 	if ((total_size % 1024) != 0)
 		return EINVAL;
 	if (total_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Payload size.
-	 */
+	/* Payload size. */
 	payload_size = data_size + 48;
 	if (payload_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Verify checksum of update data and header. Exclude extended
-	 * signature.
-	 */
+	/* Verify checksum of update data and header(s). */
 	sum = 0;
-	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) {
-		sum += *((uint32_t *)buf + i);
-	}
+	p = (uint32_t *)buf;
+	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+		sum += p[i];
 	if (sum != 0)
 		return EINVAL;
 
-	/*
-	 * Extended table size. Ignored for now.
-	 */
 	ext_size = total_size - payload_size;
 	if (ext_size > 0) {
-		printf("This image has extended signature table.");
+		/* This image has extended signature table. */
+		ehdr = (struct intel1_ucode_ext_table *)
+		((uint8_t *)buf + sizeof(struct intel1_ucode_header) +
+			data_size);
+		payload_size =
+		sizeof(struct intel1_ucode_ext_table) +
+		sizeof(struct intel1_ucode_proc_signature) *
+		ehdr->uet_count;
+		
+		sum = 0;
+		p = (uint32_t *)ehdr;
+		for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+			sum += p[i];
+		if (sum != 0)
+			return EINVAL;
 	}
 
 	return 0;
@@ -196,7 +198,8 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
 		/* Make the buffer 16 byte aligned. */
 		newbufsize = sc->sc_blobsize + 15;
 		uha = kmem_alloc(newbufsize, 

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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:07:11 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-8]: cpu_ucode.h
src/sys/arch/x86/x86 [netbsd-8]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1772):

sys/arch/x86/include/cpu_ucode.h: revision 1.5
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.19
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.20

Add missing newline in a message. KNF.
Verify checksum of the extended signature table.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.30.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/arch/x86/x86/cpu_ucode_intel.c

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



CVS commit: [netbsd-9] src/sys/arch/x86

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:05:44 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-9]: cpu_ucode.h
src/sys/arch/x86/x86 [netbsd-9]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1538):
sys/arch/x86/include/cpu_ucode.h: revision 1.5
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.19
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.20
Add missing newline in a message. KNF.
Verify checksum of the extended signature table.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/x86/x86/cpu_ucode_intel.c

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

Modified files:

Index: src/sys/arch/x86/include/cpu_ucode.h
diff -u src/sys/arch/x86/include/cpu_ucode.h:1.4 src/sys/arch/x86/include/cpu_ucode.h:1.4.6.1
--- src/sys/arch/x86/include/cpu_ucode.h:1.4	Sat Mar 17 15:56:32 2018
+++ src/sys/arch/x86/include/cpu_ucode.h	Tue Oct 11 18:05:44 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.h,v 1.4 2018/03/17 15:56:32 christos Exp $ */
+/* $NetBSD: cpu_ucode.h,v 1.4.6.1 2022/10/11 18:05:44 martin Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -69,17 +69,16 @@ struct intel1_ucode_header {
 	uint32_t	uh_reserved[3];
 };
 
-struct intel1_ucode_proc_signature {
-	uint32_t	ups_signature;
-	uint32_t	ups_proc_flags;
-	uint32_t	ups_checksum;
-};
-
 struct intel1_ucode_ext_table {
 	uint32_t	uet_count;
 	uint32_t	uet_checksum;
 	uint32_t	uet_reserved[3];
-	struct intel1_ucode_proc_signature uet_proc_sig[1];
+};
+
+struct intel1_ucode_proc_signature {
+	uint32_t	ups_signature;
+	uint32_t	ups_proc_flags;
+	uint32_t	ups_checksum;
 };
 
 #endif

Index: src/sys/arch/x86/x86/cpu_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.17 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.17.2.1
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.17	Fri May 10 18:21:01 2019
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c	Tue Oct 11 18:05:44 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.17 2019/05/10 18:21:01 maxv Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.17.2.1 2022/10/11 18:05:44 martin Exp $ */
 
 /*
  * Copyright (c) 2012, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.17 2019/05/10 18:21:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.17.2.1 2022/10/11 18:05:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xen.h"
@@ -111,63 +111,65 @@ static int
 cpu_ucode_intel_verify(struct cpu_ucode_softc *sc,
 struct intel1_ucode_header *buf)
 {
+	struct intel1_ucode_ext_table *ehdr;
 	uint32_t data_size, total_size, payload_size, ext_size;
 	uint32_t sum;
+	uint32_t *p;
 	int i;
 
 	if ((buf->uh_header_ver != 1) || (buf->uh_loader_rev != 1))
 		return EINVAL;
 
-	/*
-	 * Data size.
-	 */
-	if (buf->uh_data_size == 0) {
+	/* Data size. */
+	if (buf->uh_data_size == 0)
 		data_size = 2000;
-	} else {
+	else
 		data_size = buf->uh_data_size;
-	}
 	if ((data_size % 4) != 0)
 		return EINVAL;
 	if (data_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Total size.
-	 */
-	if (buf->uh_total_size == 0) {
+	/* Total size. */
+	if (buf->uh_total_size == 0)
 		total_size = data_size + 48;
-	} else {
+	else
 		total_size = buf->uh_total_size;
-	}
 	if ((total_size % 1024) != 0)
 		return EINVAL;
 	if (total_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Payload size.
-	 */
+	/* Payload size. */
 	payload_size = data_size + 48;
 	if (payload_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Verify checksum of update data and header. Exclude extended
-	 * signature.
-	 */
+	/* Verify checksum of update data and header(s). */
 	sum = 0;
-	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) {
-		sum += *((uint32_t *)buf + i);
-	}
+	p = (uint32_t *)buf;
+	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+		sum += p[i];
 	if (sum != 0)
 		return EINVAL;
 
-	/*
-	 * Extended table size. Ignored for now.
-	 */
 	ext_size = total_size - payload_size;
 	if (ext_size > 0) {
-		printf("This image has extended signature table.");
+		/* This image has extended signature table. */
+		ehdr = (struct intel1_ucode_ext_table *)
+		((uint8_t *)buf + sizeof(struct intel1_ucode_header) +
+			data_size);
+		payload_size =
+		sizeof(struct intel1_ucode_ext_table) +
+		sizeof(struct intel1_ucode_proc_signature) *
+		ehdr->uet_count;
+		
+		sum = 0;
+		p = (uint32_t *)ehdr;
+		for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+			sum += p[i];
+		if (sum != 0)
+			return EINVAL;
 	}
 
 	return 0;
@@ -198,7 +200,8 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
 		/* Make the buffer 16 byte aligned. */
 		newbufsize = sc->sc_blobsize + 15;
 		uha = kmem_alloc(newbufsize, KM_SLEEP);
-		uh = (struct 

CVS commit: [netbsd-9] src/sys/arch/x86

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:05:44 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-9]: cpu_ucode.h
src/sys/arch/x86/x86 [netbsd-9]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1538):
sys/arch/x86/include/cpu_ucode.h: revision 1.5
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.19
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.20
Add missing newline in a message. KNF.
Verify checksum of the extended signature table.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/x86/x86/cpu_ucode_intel.c

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



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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:59:12 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (Ticket #1771)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.22 -r1.1281.2.23 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.22 -r1.1280.2.23 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.

diffs are larger than 1MB and have been omitted


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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:59:12 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (Ticket #1771)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.22 -r1.1281.2.23 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.22 -r1.1280.2.23 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.



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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:57:17 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1771:

sys/dev/pci/pcidevs 1.1461-1.1468 via patch

- Add several samsung nvme entries.
- Add more Alder Lake devices.
- Jasper Lake Intel Trace Hub on Compute Die is not 0x4da6 but 0x4e29.
- Add Intel Core 8G (8core, H, Halo) Host Bridge, DRAM.
- Add AMD 19h/6xh Root Complex.
- Add AMD FCH SATA Controller D.
- Add NVIDIA GeForce GTX 770.
- Sort by number.


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

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



CVS commit: [netbsd-9] src/sys/dev/pci

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:51:46 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-9]: pcidevs.h pcidevs_data.h

Log Message:
regen (Ticket #1537)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.12 -r1.1371.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.12 -r1.1370.2.13 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.

diffs are larger than 1MB and have been omitted


CVS commit: [netbsd-9] src/sys/dev/pci

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:51:46 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-9]: pcidevs.h pcidevs_data.h

Log Message:
regen (Ticket #1537)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.12 -r1.1371.2.13 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.12 -r1.1370.2.13 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.



CVS commit: [netbsd-9] src/sys

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:49:35 UTC 2022

Modified Files:
src/sys/arch/x86/pci/imcsmb [netbsd-9]: imc.c
src/sys/dev/pci [netbsd-9]: pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1537):

sys/arch/x86/pci/imcsmb/imc.c: revision 1.5
sys/dev/pci/pcidevs: revision 1.1461-1.1468

add several samsung nvme entries

Add more Alder Lake devices.

Jasper Lake Intel Trace Hub on Compute Die is not 0x4da6 but 0x4e29.

Add Intel Core 8G (8core, H, Halo) Host Bridge, DRAM.

Sort by number. No functional change.

Add AMD 19h/6xh Root Complex.

Add AMD FCH SATA Controller D

add NVIDIA GeForce GTX 770

Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/x86/pci/imcsmb/imc.c
cvs rdiff -u -r1.1383.2.12 -r1.1383.2.13 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/arch/x86/pci/imcsmb/imc.c
diff -u src/sys/arch/x86/pci/imcsmb/imc.c:1.2 src/sys/arch/x86/pci/imcsmb/imc.c:1.2.6.1
--- src/sys/arch/x86/pci/imcsmb/imc.c:1.2	Thu Mar 15 23:57:17 2018
+++ src/sys/arch/x86/pci/imcsmb/imc.c	Tue Oct 11 17:49:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.2 2018/03/15 23:57:17 maya Exp $ */
+/* $NetBSD: imc.c,v 1.2.6.1 2022/10/11 17:49:35 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.2 2018/03/15 23:57:17 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.2.6.1 2022/10/11 17:49:35 martin Exp $");
 
 #include 
 #include 
@@ -137,12 +137,12 @@ __KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.2 
 
 #define IMCSMB_PCI_DEV_ID_IMC0_SBX	0x3ca8
 #define IMCSMB_PCI_DEV_ID_IMC0_IBX	0x0ea8
-#define IMCSMB_PCI_DEV_ID_IMC0_HSX	PCI_PRODUCT_INTEL_XE5_V3_IMC0_MAIN
+#define IMCSMB_PCI_DEV_ID_IMC0_HSX	PCI_PRODUCT_INTEL_XE5_V3_IMC0_TATRR
 #define IMCSMB_PCI_DEV_ID_IMC0_BDX	PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1
 
 /* (Sandy,Ivy)bridge-Xeon only have a single memory controller per socket */
 
-#define IMCSMB_PCI_DEV_ID_IMC1_HSX	PCI_PRODUCT_INTEL_XE5_V3_IMC1_MAIN
+#define IMCSMB_PCI_DEV_ID_IMC1_HSX	PCI_PRODUCT_INTEL_XE5_V3_IMC1_TATRR
 #define IMCSMB_PCI_DEV_ID_IMC1_BDX	PCI_PRODUCT_INTEL_COREI76K_IMC_0
 
 /* There are two SMBus controllers in each device. These define the registers
@@ -299,8 +299,8 @@ imc_probe(device_t dev, cfdata_t cf, voi
 		switch(PCI_PRODUCT(pa->pa_id)) {
 		case  PCI_PRODUCT_INTEL_COREI76K_IMC_0:
 		case  PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1:
-		case  PCI_PRODUCT_INTEL_XE5_V3_IMC0_MAIN:
-		case  PCI_PRODUCT_INTEL_XE5_V3_IMC1_MAIN:
+		case  PCI_PRODUCT_INTEL_XE5_V3_IMC0_TATRR:
+		case  PCI_PRODUCT_INTEL_XE5_V3_IMC1_TATRR:
 		case  PCI_PRODUCT_INTEL_E5_IMC_TA:
 		case  PCI_PRODUCT_INTEL_E5V2_IMC_TA:
 			return 1;

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1383.2.12 src/sys/dev/pci/pcidevs:1.1383.2.13
--- src/sys/dev/pci/pcidevs:1.1383.2.12	Wed Jul 27 14:40:07 2022
+++ src/sys/dev/pci/pcidevs	Tue Oct 11 17:49:35 2022
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.12 2022/07/27 14:40:07 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.13 2022/10/11 17:49:35 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -961,8 +961,8 @@ product ALTIMA AC9100	0x03ea	AC9100 Giga
 product ALTIMA AC1003	0x03eb	AC1003 Gigabit Ethernet
 
 /* Amazon.com, Inc. products */
-product AMAZON UART	0x8250	16650-compatible UART
 product AMAZON NVME	0x8061	NVMe SSD
+product AMAZON UART	0x8250	16650-compatible UART
 product AMAZON ENA	0xec20	Elastic Network Adapter
 
 /* AMD products */
@@ -1053,6 +1053,7 @@ product AMD F17_7X_RESV_SPP	0x1485	Famil
 product AMD F17_7X_CCP		0x1486	Family17h/7xh Crypto
 product AMD F17_3X_HDA		0x1487	17h/7xh HD Audio
 product AMD F17_7X_USB3		0x149c	Family17h/7xh USB 3.0 Host Controller
+product AMD F19_6X_RC		0x14d8	19h/6xh Root Complex
 product AMD F14_RC		0x1510	Family14h Root Complex
 product AMD F14_PCIE_1		0x1512	Family14h PCIe
 product AMD F14_PCIE_2		0x1513	Family14h PCIe
@@ -1182,6 +1183,7 @@ product AMD HUDSON_PCIE_2	0x43a2	Hudson 
 product AMD HUDSON_PCIE_3	0x43a3	Hudson PCIe Root Port 3
 product AMD 300SERIES_PCIE	0x43b4	300 Series PCIe
 product AMD 300SERIES_SATA	0x43b7	300 Series SATA
+product AMD FCH_SATA_D		0x43b8	FCH SATA Controller D
 product AMD 300SERIES_XHCI	0x43bb	300 Series xHCI
 product AMD 400SERIES_PCIE_1	0x43c6	400 Series PCIe
 product AMD 400SERIES_PCIE_2	0x43c7	400 Series PCIe
@@ -2455,8 +2457,8 @@ product BROADCOM BCM5714	0x1668	BCM5714 
 product BROADCOM BCM5714S	0x1669	BCM5714S 1000baseSX Ethernet
 product BROADCOM BCM5780	0x166a	BCM5780 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5780S	0x166b	BCM5780S NetXtreme 1000baseSX Ethernet
-product BROADCOM BCM57712_VF	0x166f	BCM57712 NetXtreme II 10Gb Ethernet VF
 product BROADCOM BCM5705F	0x166e	BCM5705F 10/100 Ethernet
+product BROADCOM BCM57712_VF	

CVS commit: [netbsd-9] src/sys

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 17:49:35 UTC 2022

Modified Files:
src/sys/arch/x86/pci/imcsmb [netbsd-9]: imc.c
src/sys/dev/pci [netbsd-9]: pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1537):

sys/arch/x86/pci/imcsmb/imc.c: revision 1.5
sys/dev/pci/pcidevs: revision 1.1461-1.1468

add several samsung nvme entries

Add more Alder Lake devices.

Jasper Lake Intel Trace Hub on Compute Die is not 0x4da6 but 0x4e29.

Add Intel Core 8G (8core, H, Halo) Host Bridge, DRAM.

Sort by number. No functional change.

Add AMD 19h/6xh Root Complex.

Add AMD FCH SATA Controller D

add NVIDIA GeForce GTX 770

Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/x86/pci/imcsmb/imc.c
cvs rdiff -u -r1.1383.2.12 -r1.1383.2.13 src/sys/dev/pci/pcidevs

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



CVS commit: src/usr.bin/skey

2022-10-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Oct 11 15:59:38 UTC 2022

Modified Files:
src/usr.bin/skey: skeyaudit.sh

Log Message:
We removed Mail before branching netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/skey/skeyaudit.sh

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

Modified files:

Index: src/usr.bin/skey/skeyaudit.sh
diff -u src/usr.bin/skey/skeyaudit.sh:1.4 src/usr.bin/skey/skeyaudit.sh:1.5
--- src/usr.bin/skey/skeyaudit.sh:1.4	Thu Jul 27 14:40:58 2000
+++ src/usr.bin/skey/skeyaudit.sh	Tue Oct 11 15:59:38 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: skeyaudit.sh,v 1.4 2000/07/27 14:40:58 mjl Exp $
+#	$NetBSD: skeyaudit.sh,v 1.5 2022/10/11 15:59:38 is Exp $
 #
 # This script will look thru the skeykeys file for
 # people with sequence numbers less than LOWLIMIT=12
@@ -56,6 +56,6 @@ while [ "X$1" != "X" ]; do
 $ECHO " "
 $ECHO "Use \"skeyinit -s\" to reinitialize your sequence number."
 $ECHO ""
-) | /usr/bin/Mail -s "$SUBJECT"  $USER $ADMIN
+) | /usr/bin/mailx -s "$SUBJECT"  $USER $ADMIN
   fi
 done



CVS commit: src/usr.bin/skey

2022-10-11 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Oct 11 15:59:38 UTC 2022

Modified Files:
src/usr.bin/skey: skeyaudit.sh

Log Message:
We removed Mail before branching netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/skey/skeyaudit.sh

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



CVS commit: src/doc

2022-10-11 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Tue Oct 11 15:22:16 UTC 2022

Modified Files:
src/doc: 3RDPARTY

Log Message:
New OpenSSL 1.1.1r/3.0.6.


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

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1887 src/doc/3RDPARTY:1.1888
--- src/doc/3RDPARTY:1.1887	Sun Oct  9 21:43:46 2022
+++ src/doc/3RDPARTY	Tue Oct 11 15:22:16 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1887 2022/10/09 21:43:46 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1888 2022/10/11 15:22:16 taca Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1115,7 +1115,7 @@ markus is very cooperative about it):
 
 Package:	OpenSSL
 Version:	1.0.2o/1.1.1n
-Current Vers:	1.0.2zd/1.1.1q/3.0.5
+Current Vers:	1.0.2zd/1.1.1r/3.0.6
 Maintainer:	The OpenSSL Project
 Archive Site:	ftp://ftp.openssl.org/source/
 Home Page:	http://www.openssl.org/



CVS commit: src/doc

2022-10-11 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Tue Oct 11 15:22:16 UTC 2022

Modified Files:
src/doc: 3RDPARTY

Log Message:
New OpenSSL 1.1.1r/3.0.6.


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

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



CVS commit: src/sys/dev/usb

2022-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 11 11:01:17 UTC 2022

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

Log Message:
KNF a bit. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 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.



CVS commit: src/sys/dev/usb

2022-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 11 11:01:17 UTC 2022

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

Log Message:
KNF a bit. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 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.174 src/sys/dev/usb/xhci.c:1.175
--- src/sys/dev/usb/xhci.c:1.174	Tue Oct 11 09:30:46 2022
+++ src/sys/dev/usb/xhci.c	Tue Oct 11 11:01:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.174 2022/10/11 09:30:46 msaitoh Exp $	*/
+/*	$NetBSD: xhci.c,v 1.175 2022/10/11 11:01:17 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.174 2022/10/11 09:30:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.175 2022/10/11 11:01:17 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1213,11 +1213,11 @@ xhci_id_protocols(struct xhci_softc *sc,
 	case 0x0310:
 	case 0x0320:
 		aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n",
-		major == 3 ? "ss" : "hs", cpo, cpo + cpc -1);
+		major == 3 ? "ss" : "hs", cpo, cpo + cpc - 1);
 		if (major == 3)
-			sc->sc_usb3nports += cpo + cpc -1;
+			sc->sc_usb3nports += cpo + cpc - 1;
 		else
-			sc->sc_usb2nports += cpo + cpc -1;
+			sc->sc_usb2nports += cpo + cpc - 1;
 		break;
 	default:
 		aprint_error_dev(sc->sc_dev, " unknown major/minor (%d/%d)\n",
@@ -1438,11 +1438,13 @@ xhci_init(struct xhci_softc *sc)
 	/* default all ports to bus 0, i.e. usb 3 */
 	sc->sc_ctlrportbus = kmem_zalloc(
 	howmany(sc->sc_maxports * sizeof(uint8_t), NBBY), KM_SLEEP);
-	sc->sc_ctlrportmap = kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
+	sc->sc_ctlrportmap =
+	kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
 
 	/* controller port to bus roothub port map */
 	for (size_t j = 0; j < __arraycount(sc->sc_rhportmap); j++) {
-		sc->sc_rhportmap[j] = kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
+		sc->sc_rhportmap[j] =
+		kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
 	}
 
 	/*



CVS commit: src

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:55:21 UTC 2022

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/net/ipsec: Makefile
Added Files:
src/tests/net/ipsec: t_ipsec_spflags.sh

Log Message:
Add test for sadb_x_policy->sadb_x_policy_flags.


To generate a diff of this commit:
cvs rdiff -u -r1.1223 -r1.1224 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.10 -r1.11 src/tests/net/ipsec/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/ipsec/t_ipsec_spflags.sh

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1223 src/distrib/sets/lists/tests/mi:1.1224
--- src/distrib/sets/lists/tests/mi:1.1223	Fri Sep  9 22:14:28 2022
+++ src/distrib/sets/lists/tests/mi	Tue Oct 11 09:55:21 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1223 2022/09/09 22:14:28 wiz Exp $
+# $NetBSD: mi,v 1.1224 2022/10/11 09:55:21 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4217,6 +4217,7 @@
 ./usr/tests/net/ipsec/t_ipsec_misc			tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_natt			tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_sockopt			tests-net-tests		atf,rump
+./usr/tests/net/ipsec/t_ipsec_spflags			tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_sysctl			tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_tcp			tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_transport			tests-net-tests		atf,rump

Index: src/tests/net/ipsec/Makefile
diff -u src/tests/net/ipsec/Makefile:1.10 src/tests/net/ipsec/Makefile:1.11
--- src/tests/net/ipsec/Makefile:1.10	Mon Oct 30 15:59:23 2017
+++ src/tests/net/ipsec/Makefile	Tue Oct 11 09:55:21 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2017/10/30 15:59:23 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.11 2022/10/11 09:55:21 knakahara Exp $
 #
 
 .include 
@@ -6,8 +6,8 @@
 TESTSDIR=	${TESTSBASE}/net/ipsec
 
 .for name in ipsec_ah_keys ipsec_esp_keys ipsec_gif ipsec_l2tp ipsec_misc \
-ipsec_natt ipsec_sockopt ipsec_sysctl ipsec_tcp ipsec_transport \
-ipsec_tunnel ipsec_tunnel_ipcomp ipsec_tunnel_odd
+ipsec_natt ipsec_sockopt ipsec_spflags ipsec_sysctl ipsec_tcp \
+ipsec_transport ipsec_tunnel ipsec_tunnel_ipcomp ipsec_tunnel_odd
 TESTS_SH+=		t_${name}
 TESTS_SH_SRC_t_${name}=	../net_common.sh ./common.sh ./algorithms.sh \
 t_${name}.sh

Added files:

Index: src/tests/net/ipsec/t_ipsec_spflags.sh
diff -u /dev/null src/tests/net/ipsec/t_ipsec_spflags.sh:1.1
--- /dev/null	Tue Oct 11 09:55:21 2022
+++ src/tests/net/ipsec/t_ipsec_spflags.sh	Tue Oct 11 09:55:21 2022
@@ -0,0 +1,97 @@
+#   $NetBSD: t_ipsec_spflags.sh,v 1.1 2022/10/11 09:55:21 knakahara Exp $
+#
+# Copyright (c) 2022 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+SOCK_LOCAL=unix://ipsec_local
+
+DEBUG=${DEBUG:-false}
+
+test_flag_if_ipsec_sp_common()
+{
+	local ip_gwlo_tun=20.0.0.1
+	local ip_gwre_tun=20.0.0.2
+
+	rump_server_crypto_start $SOCK_LOCAL netipsec ipsec
+	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.ifconfig ipsec0 create
+	atf_check -s exit:0 rump.ifconfig ipsec0 \
+	tunnel $ip_gwlo_tun $ip_gwre_tun
+	atf_check -s exit:0 -o match:'sadb_x_policy\{ type=2 dir=2 flags=0x80' $HIJACKING setkey -DPv
+}
+
+test_flag_userland_sp_common()
+{
+	local ip_gwlo_tun=20.0.0.1
+	local ip_gwre_tun=20.0.0.2
+	local tmpfile=./tmp
+
+	name="ipsec_spflag_userland_sp"
+	desc="Tests of IPsec SPD flags at userland"
+
+	atf_test_case ${name} cleanup
+
+	rump_server_crypto_start $SOCK_LOCAL netipsec ipsec
+
+	export 

CVS commit: src

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:55:21 UTC 2022

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/net/ipsec: Makefile
Added Files:
src/tests/net/ipsec: t_ipsec_spflags.sh

Log Message:
Add test for sadb_x_policy->sadb_x_policy_flags.


To generate a diff of this commit:
cvs rdiff -u -r1.1223 -r1.1224 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.10 -r1.11 src/tests/net/ipsec/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/ipsec/t_ipsec_spflags.sh

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



CVS commit: src/crypto/dist/ipsec-tools/src/libipsec

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:54:15 UTC 2022

Modified Files:
src/crypto/dist/ipsec-tools/src/libipsec: key_debug.c

Log Message:
Add parser sadb_x_policy_flags to libipsec/key_debug.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c

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



CVS commit: src/crypto/dist/ipsec-tools/src/libipsec

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:54:15 UTC 2022

Modified Files:
src/crypto/dist/ipsec-tools/src/libipsec: key_debug.c

Log Message:
Add parser sadb_x_policy_flags to libipsec/key_debug.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c
diff -u src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c:1.16 src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c:1.17
--- src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c:1.16	Mon Sep  6 17:19:52 2021
+++ src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c	Tue Oct 11 09:54:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: key_debug.c,v 1.16 2021/09/06 17:19:52 rillig Exp $	*/
+/*	$NetBSD: key_debug.c,v 1.17 2022/10/11 09:54:15 knakahara Exp $	*/
 
 /*	$KAME: key_debug.c,v 1.29 2001/08/16 14:25:41 itojun Exp $	*/
 
@@ -453,11 +453,11 @@ kdebug_sadb_x_policy(struct sadb_ext *ex
 		panic("kdebug_sadb_x_policy: NULL pointer was passed.\n");
 
 #ifdef HAVE_PFKEY_POLICY_PRIORITY
-	printf("sadb_x_policy{ type=%u dir=%u id=%x priority=%u }\n",
+	printf("sadb_x_policy{ type=%u dir=%u flags=0x%02x id=%x priority=%u }\n",
 #else
-	printf("sadb_x_policy{ type=%u dir=%u id=%x }\n",
+	printf("sadb_x_policy{ type=%u dir=%u flags=0x%02x id=%x }\n",
 #endif
-		xpl->sadb_x_policy_type, xpl->sadb_x_policy_dir,
+		xpl->sadb_x_policy_type, xpl->sadb_x_policy_dir, xpl->sadb_x_policy_flags,
 #ifdef HAVE_PFKEY_POLICY_PRIORITY
 		xpl->sadb_x_policy_id, xpl->sadb_x_policy_priority);
 #else



CVS commit: src/sys/sys

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:52:50 UTC 2022

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 9.99.101

- changed struct sadb_x_policy in pfkeyv2.h


To generate a diff of this commit:
cvs rdiff -u -r1.713 -r1.714 src/sys/sys/param.h

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



CVS commit: src/sys/sys

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:52:50 UTC 2022

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 9.99.101

- changed struct sadb_x_policy in pfkeyv2.h


To generate a diff of this commit:
cvs rdiff -u -r1.713 -r1.714 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.713 src/sys/sys/param.h:1.714
--- src/sys/sys/param.h:1.713	Tue Sep 20 02:24:18 2022
+++ src/sys/sys/param.h	Tue Oct 11 09:52:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.713 2022/09/20 02:24:18 knakahara Exp $	*/
+/*	$NetBSD: param.h,v 1.714 2022/10/11 09:52:49 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	99901	/* NetBSD 9.99.100 */
+#define	__NetBSD_Version__	999010100	/* NetBSD 9.99.101 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:51:47 UTC 2022

Modified Files:
src/sys/net: if_ipsec.c pfkeyv2.h
src/sys/netipsec: key.c key_debug.c

Log Message:
Add sadb_x_policy_flags to inform SP origination.

This extension(struct sadb_x_policy) is *not* defined by RFC2367.

OpenBSD does not have reserved fields in struct sadb_x_policy.
Linux does not use this field yet.
FreeBSD uses this field as "sadb_x_policy_scope"; the value range is
from 0x00 to 0x04.

We use from most significant bit to avoid the above usage.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/net/if_ipsec.c src/sys/net/pfkeyv2.h
cvs rdiff -u -r1.276 -r1.277 src/sys/netipsec/key.c
cvs rdiff -u -r1.24 -r1.25 src/sys/netipsec/key_debug.c

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

Modified files:

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.33 src/sys/net/if_ipsec.c:1.34
--- src/sys/net/if_ipsec.c:1.33	Thu Oct  6 06:59:24 2022
+++ src/sys/net/if_ipsec.c	Tue Oct 11 09:51:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.33 2022/10/06 06:59:24 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.34 2022/10/11 09:51:47 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.33 2022/10/06 06:59:24 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.34 2022/10/11 09:51:47 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1706,7 +1706,7 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 	xpl->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
 	xpl->sadb_x_policy_type = policy;
 	xpl->sadb_x_policy_dir = dir;
-	xpl->sadb_x_policy_reserved = 0;
+	xpl->sadb_x_policy_flags = 0;
 	xpl->sadb_x_policy_id = id;
 	xpl->sadb_x_policy_reserved2 = 0;
 
Index: src/sys/net/pfkeyv2.h
diff -u src/sys/net/pfkeyv2.h:1.33 src/sys/net/pfkeyv2.h:1.34
--- src/sys/net/pfkeyv2.h:1.33	Sat Apr 16 18:15:22 2022
+++ src/sys/net/pfkeyv2.h	Tue Oct 11 09:51:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfkeyv2.h,v 1.33 2022/04/16 18:15:22 andvar Exp $	*/
+/*	$NetBSD: pfkeyv2.h,v 1.34 2022/10/11 09:51:47 knakahara Exp $	*/
 /*	$KAME: pfkeyv2.h,v 1.36 2003/07/25 09:33:37 itojun Exp $	*/
 
 /*
@@ -228,7 +228,8 @@ struct sadb_x_policy {
   uint16_t sadb_x_policy_exttype;
   uint16_t sadb_x_policy_type;		/* See policy type of ipsec.h */
   uint8_t sadb_x_policy_dir;		/* direction, see ipsec.h */
-  uint8_t sadb_x_policy_reserved;
+  uint8_t sadb_x_policy_flags;
+#define IPSEC_POLICY_FLAG_ORIGIN_KERNEL 0x80	/* policy is generated by kernel */
   uint32_t sadb_x_policy_id;
   uint32_t sadb_x_policy_reserved2;
 };

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.276 src/sys/netipsec/key.c:1.277
--- src/sys/netipsec/key.c:1.276	Tue Aug  9 08:03:22 2022
+++ src/sys/netipsec/key.c	Tue Oct 11 09:51:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.276 2022/08/09 08:03:22 knakahara Exp $	*/
+/*	$NetBSD: key.c,v 1.277 2022/10/11 09:51:47 knakahara Exp $	*/
 /*	$FreeBSD: key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.276 2022/08/09 08:03:22 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.277 2022/10/11 09:51:47 knakahara Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -2089,6 +2089,8 @@ key_sp2msg(const struct secpolicy *sp, i
 	xpl->sadb_x_policy_type = sp->policy;
 	xpl->sadb_x_policy_dir = sp->spidx.dir;
 	xpl->sadb_x_policy_id = sp->id;
+	if (sp->origin == IPSEC_SPORIGIN_KERNEL)
+		xpl->sadb_x_policy_flags |= IPSEC_POLICY_FLAG_ORIGIN_KERNEL;
 	p = (char *)xpl + sizeof(*xpl);
 
 	/* if is the policy for ipsec ? */

Index: src/sys/netipsec/key_debug.c
diff -u src/sys/netipsec/key_debug.c:1.24 src/sys/netipsec/key_debug.c:1.25
--- src/sys/netipsec/key_debug.c:1.24	Wed May 18 15:20:18 2022
+++ src/sys/netipsec/key_debug.c	Tue Oct 11 09:51:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: key_debug.c,v 1.24 2022/05/18 15:20:18 christos Exp $	*/
+/*	$NetBSD: key_debug.c,v 1.25 2022/10/11 09:51:47 knakahara Exp $	*/
 /*	$FreeBSD: key_debug.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$KAME: key_debug.c,v 1.26 2001/06/27 10:46:50 sakane Exp $	*/
 
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.24 2022/05/18 15:20:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.25 2022/10/11 09:51:47 knakahara Exp $");
 #endif
 
 #if defined(_KERNEL_OPT)
@@ -377,9 +377,9 @@ kdebug_sadb_x_policy(const struct sadb_e
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed", __func__);
 
-	printf(" sadb_x_policy { type=%u dir=%u id=%x }",
+	printf(" sadb_x_policy { type=%u dir=%u flags=0x%02x id=%x }",
 		xpl->sadb_x_policy_type, xpl->sadb_x_policy_dir,
-		xpl->sadb_x_policy_id);
+		xpl->sadb_x_policy_flags, 

CVS commit: src/sys

2022-10-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Oct 11 09:51:47 UTC 2022

Modified Files:
src/sys/net: if_ipsec.c pfkeyv2.h
src/sys/netipsec: key.c key_debug.c

Log Message:
Add sadb_x_policy_flags to inform SP origination.

This extension(struct sadb_x_policy) is *not* defined by RFC2367.

OpenBSD does not have reserved fields in struct sadb_x_policy.
Linux does not use this field yet.
FreeBSD uses this field as "sadb_x_policy_scope"; the value range is
from 0x00 to 0x04.

We use from most significant bit to avoid the above usage.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/net/if_ipsec.c src/sys/net/pfkeyv2.h
cvs rdiff -u -r1.276 -r1.277 src/sys/netipsec/key.c
cvs rdiff -u -r1.24 -r1.25 src/sys/netipsec/key_debug.c

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



CVS commit: src/sys/dev/usb

2022-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 11 09:30:46 UTC 2022

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

Log Message:
"Add" number of ports because the same speed's ECR may appear multiple times.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 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.173 src/sys/dev/usb/xhci.c:1.174
--- src/sys/dev/usb/xhci.c:1.173	Tue Oct 11 09:18:22 2022
+++ src/sys/dev/usb/xhci.c	Tue Oct 11 09:30:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.173 2022/10/11 09:18:22 msaitoh Exp $	*/
+/*	$NetBSD: xhci.c,v 1.174 2022/10/11 09:30:46 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.173 2022/10/11 09:18:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.174 2022/10/11 09:30:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1215,9 +1215,9 @@ xhci_id_protocols(struct xhci_softc *sc,
 		aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n",
 		major == 3 ? "ss" : "hs", cpo, cpo + cpc -1);
 		if (major == 3)
-			sc->sc_usb3nports = cpo + cpc -1;
+			sc->sc_usb3nports += cpo + cpc -1;
 		else
-			sc->sc_usb2nports = cpo + cpc -1;
+			sc->sc_usb2nports += cpo + cpc -1;
 		break;
 	default:
 		aprint_error_dev(sc->sc_dev, " unknown major/minor (%d/%d)\n",



CVS commit: src/sys/dev/usb

2022-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 11 09:30:46 UTC 2022

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

Log Message:
"Add" number of ports because the same speed's ECR may appear multiple times.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 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.



CVS commit: src/sys/dev

2022-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 11 09:18:22 UTC 2022

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

Log Message:
There is an xHCI device which has USB 2 port only. Support it.

 - Example:

xhci4 at pci17 dev 0 function 0: AMD product 15b8 (rev. 0x00)
xhci4: 64-bit DMA
allocated pic msix10 type edge pin 0 level 6 to cpu0 slot 32 idt entry 107
xhci4: interrupting at msix10 vec 0
xhci4: xHCI version 1.20
xhci4: hcs1=1000840 hcs2=14f1 hcs3=7000a
xhci4: hcc=0x110ffc5
xhci4: xECP 440
xhci4: hcc2=0x3f
xhci4: ECR: 0x0401
xhci4: ECR: 0x02000402
xhci4:  SP: 0x02000402 0x20425355 0x00180101 0x
xhci4:  hs ports 1 - 1
xhci4: ECR: 0x000f000a
xhci4: PAGESIZE 0x0001
xhci4: sc_pgsz 0x1000
xhci4: sc_maxslots 0x0040
xhci4: sc_maxports 1
xhci4: sc_maxspbuf 2
xhci4: eventst: 0x00013ee60fc0 0xb08826f5afc0 1000
xhci4: dcbaa: 0x00013ee63000 0xb08826f5b000 1000
xhci4: current IMOD 0
(snip)
usb8 at xhci4: USB revision 3.1
usb9 at xhci4: USB revision 2.0
uhub8 at usb8: NetBSD (0x) xHCI root hub (0x), class 9/0, rev 
3.00/1.00, addr 0
uhub8: 0 ports with 0 removable, self powered
uhub8: no ports, hub ignored
uhub8: WARNING: power management not supported
autoconfiguration error: usb8: root device is not a hub
usb8: WARNING: power management not supported
uhub9 at usb9: NetBSD (0x) xHCI root hub (0x), class 9/0, rev 
2.00/1.00, addr 0
uhub9: 1 port with 1 removable, self powered

 - To resolve this problem, keep number of ports of SS and HS and use
   it to attach child device(s).
 - Tested on ASUS TUF GAMING X670E-PLUS.
 - OK'd by skrll@.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/xhci_pci.c
cvs rdiff -u -r1.172 -r1.173 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.21 -r1.22 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/pci/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.30 src/sys/dev/pci/xhci_pci.c:1.31
--- src/sys/dev/pci/xhci_pci.c:1.30	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/xhci_pci.c	Tue Oct 11 09:18:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.30 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.31 2022/10/11 09:18:22 msaitoh 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.30 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.31 2022/10/11 09:18:22 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -287,10 +287,13 @@ xhci_pci_attach(device_t parent, device_
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
 	/* Attach usb buses. */
-	sc->sc_child = config_found(self, >sc_bus, usbctlprint, CFARGS_NONE);
-
- 	sc->sc_child2 = config_found(self, >sc_bus2, usbctlprint,
- 	CFARGS_NONE);
+	if (sc->sc_usb3nports != 0)
+		sc->sc_child =
+		config_found(self, >sc_bus, usbctlprint, CFARGS_NONE);
+
+	if (sc->sc_usb2nports != 0)
+		sc->sc_child2 =
+		config_found(self, >sc_bus2, usbctlprint, CFARGS_NONE);
 
 	return;
 

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.172 src/sys/dev/usb/xhci.c:1.173
--- src/sys/dev/usb/xhci.c:1.172	Sun Sep 25 07:23:07 2022
+++ src/sys/dev/usb/xhci.c	Tue Oct 11 09:18:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.172 2022/09/25 07:23:07 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.173 2022/10/11 09:18:22 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.172 2022/09/25 07:23:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.173 2022/10/11 09:18:22 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1214,6 +1214,10 @@ xhci_id_protocols(struct xhci_softc *sc,
 	case 0x0320:
 		aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n",
 		major == 3 ? "ss" : "hs", cpo, cpo + cpc -1);
+		if (major == 3)
+			sc->sc_usb3nports = cpo + cpc -1;
+		else
+			sc->sc_usb2nports = cpo + cpc -1;
 		break;
 	default:
 		aprint_error_dev(sc->sc_dev, " unknown major/minor (%d/%d)\n",

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.21 src/sys/dev/usb/xhcivar.h:1.22
--- src/sys/dev/usb/xhcivar.h:1.21	Sun Mar 13 11:30:04 2022
+++ src/sys/dev/usb/xhcivar.h	Tue Oct 11 09:18:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.21 2022/03/13 11:30:04 riastradh Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.22 2022/10/11 09:18:22 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -112,6 +112,8 @@ struct xhci_softc {
 	 * Port routing and root hub - xHCI 4.19.7
 	 */
 	int sc_maxports;		/* number of controller ports */
+	int sc_usb3nports;
+	int sc_usb2nports;
 
 	uint8_t *sc_ctlrportbus;	/* a bus bit per port */
 



CVS commit: src/sys/dev

2022-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 11 09:18:22 UTC 2022

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

Log Message:
There is an xHCI device which has USB 2 port only. Support it.

 - Example:

xhci4 at pci17 dev 0 function 0: AMD product 15b8 (rev. 0x00)
xhci4: 64-bit DMA
allocated pic msix10 type edge pin 0 level 6 to cpu0 slot 32 idt entry 107
xhci4: interrupting at msix10 vec 0
xhci4: xHCI version 1.20
xhci4: hcs1=1000840 hcs2=14f1 hcs3=7000a
xhci4: hcc=0x110ffc5
xhci4: xECP 440
xhci4: hcc2=0x3f
xhci4: ECR: 0x0401
xhci4: ECR: 0x02000402
xhci4:  SP: 0x02000402 0x20425355 0x00180101 0x
xhci4:  hs ports 1 - 1
xhci4: ECR: 0x000f000a
xhci4: PAGESIZE 0x0001
xhci4: sc_pgsz 0x1000
xhci4: sc_maxslots 0x0040
xhci4: sc_maxports 1
xhci4: sc_maxspbuf 2
xhci4: eventst: 0x00013ee60fc0 0xb08826f5afc0 1000
xhci4: dcbaa: 0x00013ee63000 0xb08826f5b000 1000
xhci4: current IMOD 0
(snip)
usb8 at xhci4: USB revision 3.1
usb9 at xhci4: USB revision 2.0
uhub8 at usb8: NetBSD (0x) xHCI root hub (0x), class 9/0, rev 
3.00/1.00, addr 0
uhub8: 0 ports with 0 removable, self powered
uhub8: no ports, hub ignored
uhub8: WARNING: power management not supported
autoconfiguration error: usb8: root device is not a hub
usb8: WARNING: power management not supported
uhub9 at usb9: NetBSD (0x) xHCI root hub (0x), class 9/0, rev 
2.00/1.00, addr 0
uhub9: 1 port with 1 removable, self powered

 - To resolve this problem, keep number of ports of SS and HS and use
   it to attach child device(s).
 - Tested on ASUS TUF GAMING X670E-PLUS.
 - OK'd by skrll@.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/xhci_pci.c
cvs rdiff -u -r1.172 -r1.173 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.21 -r1.22 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.