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

2024-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 20 15:55:23 UTC 2024

Modified Files:
src/sys/net [netbsd-9]: if_bridge.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1858):

sys/net/if_bridge.c: revision 1.192

bridge: add missing curlwp_bind() for pppoe
>From knakahara@


To generate a diff of this commit:
cvs rdiff -u -r1.164.4.1 -r1.164.4.2 src/sys/net/if_bridge.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_bridge.c
diff -u src/sys/net/if_bridge.c:1.164.4.1 src/sys/net/if_bridge.c:1.164.4.2
--- src/sys/net/if_bridge.c:1.164.4.1	Thu Feb 27 18:34:12 2020
+++ src/sys/net/if_bridge.c	Sat Jul 20 15:55:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.164.4.1 2020/02/27 18:34:12 martin Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.164.4.2 2024/07/20 15:55:23 martin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.164.4.1 2020/02/27 18:34:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.164.4.2 2024/07/20 15:55:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -1486,7 +1486,7 @@ bridge_output(struct ifnet *ifp, struct 
 	struct ifnet *dst_if;
 	struct bridge_softc *sc;
 	struct mbuf *n;
-	int s;
+	int s, bound;
 
 	/*
 	 * bridge_output() is called from ether_output(), furthermore
@@ -1600,6 +1600,11 @@ bridge_output(struct ifnet *ifp, struct 
 			return 0;
 	}
 
+	/*
+	 * When we use pppoe over bridge, bridge_output() can be called
+	 * in a lwp context by pppoe_timeout_wk().
+	 */
+	bound = curlwp_bind();
 	do {
 		/* XXX Should call bridge_broadcast, but there are locking
 		 * issues which need resolving first. */
@@ -1695,6 +1700,8 @@ next:
 
 		m = n;
 	} while (m != NULL);
+	curlwp_bindx(bound);
+
 	return 0;
 
 unicast_asis:



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

2024-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 20 15:55:23 UTC 2024

Modified Files:
src/sys/net [netbsd-9]: if_bridge.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1858):

sys/net/if_bridge.c: revision 1.192

bridge: add missing curlwp_bind() for pppoe
>From knakahara@


To generate a diff of this commit:
cvs rdiff -u -r1.164.4.1 -r1.164.4.2 src/sys/net/if_bridge.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

2024-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 20 14:20:57 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1855):

sys/arch/x86/x86/identcpu.c: revision 1.129
sys/arch/x86/include/specialreg.h: revision 1.212
sys/arch/x86/x86/identcpu.c: revision 1.130

Disable the VIA Alternate Instructions according the VIA documentation:
* C7 and above do not support ALTINST, do not check or attempt to disable them.
* For VIA C3 Nehemiah check extended feature flags for support and status,
  do no attempt to disable when AIS is not supported or enabled.
* For pre-Nehemiah models explicitly disable, if they are in the range
  of documented models, flags aren't present to check the status on
  these models.

Note: for pre-Nehemiah may be other functional side effects depdending
on the version and stepping.

Explicit disabling of ALTINST was introduced with rev. 1.84 following
the discovery of some VIA CPUs having these instructions enabled by default
leading to the potential backdoor (aka rosenbrindge).

Unfortunately, implementation used a wrong check (ACE supported flag),
which can be true for the later models, still supporting padlock features.

Setting ALTINST bit on those may have unexpected side effects like VIA C7 CPUID
instruction for temperature sensor not reporting correct value or
`cpuctl identify' not reporting certain CPU features. Similar side effects
can be observed even for Nehemiah models not supporting AIS instructions. This
change should limit possibility of such issues to only the pre-Nehemiah models,
not covered at all in the previous implementation.

Feature Control Register (FCR) macros were unified under one group and
consistent naming while implementing the change. Few comments updated as well.
patch reviewed by Riastradh@ (thank you)

PR kern/58370

Move determination of the largest VIA CPU extended function value
to the intended place where the checks are performed.
Currently the value can be overridden while checking for the padlock features,
and failing the check for max function value as a result.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.15 -r1.150.2.16 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.93.2.5 -r1.93.2.6 src/sys/arch/x86/x86/identcpu.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

2024-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 20 14:20:57 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1855):

sys/arch/x86/x86/identcpu.c: revision 1.129
sys/arch/x86/include/specialreg.h: revision 1.212
sys/arch/x86/x86/identcpu.c: revision 1.130

Disable the VIA Alternate Instructions according the VIA documentation:
* C7 and above do not support ALTINST, do not check or attempt to disable them.
* For VIA C3 Nehemiah check extended feature flags for support and status,
  do no attempt to disable when AIS is not supported or enabled.
* For pre-Nehemiah models explicitly disable, if they are in the range
  of documented models, flags aren't present to check the status on
  these models.

Note: for pre-Nehemiah may be other functional side effects depdending
on the version and stepping.

Explicit disabling of ALTINST was introduced with rev. 1.84 following
the discovery of some VIA CPUs having these instructions enabled by default
leading to the potential backdoor (aka rosenbrindge).

Unfortunately, implementation used a wrong check (ACE supported flag),
which can be true for the later models, still supporting padlock features.

Setting ALTINST bit on those may have unexpected side effects like VIA C7 CPUID
instruction for temperature sensor not reporting correct value or
`cpuctl identify' not reporting certain CPU features. Similar side effects
can be observed even for Nehemiah models not supporting AIS instructions. This
change should limit possibility of such issues to only the pre-Nehemiah models,
not covered at all in the previous implementation.

Feature Control Register (FCR) macros were unified under one group and
consistent naming while implementing the change. Few comments updated as well.
patch reviewed by Riastradh@ (thank you)

PR kern/58370

Move determination of the largest VIA CPU extended function value
to the intended place where the checks are performed.
Currently the value can be overridden while checking for the padlock features,
and failing the check for max function value as a result.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.15 -r1.150.2.16 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.93.2.5 -r1.93.2.6 src/sys/arch/x86/x86/identcpu.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/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.15 src/sys/arch/x86/include/specialreg.h:1.150.2.16
--- src/sys/arch/x86/include/specialreg.h:1.150.2.15	Sat Jul 29 09:48:51 2023
+++ src/sys/arch/x86/include/specialreg.h	Sat Jul 20 14:20:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.15 2023/07/29 09:48:51 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.16 2024/07/20 14:20:57 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -1099,8 +1099,12 @@
 
 /*
  * Centaur Extended Feature flags.
- * CPUID FnC000_0001
+ * CPUID FnC000_0001 (VIA "Nehemiah" or later)
  */
+#define CPUID_VIA_HAS_AIS	__BIT(0)	/* Alternate Instruction Set supported */
+		/* (VIA "Nehemiah" only) */
+#define CPUID_VIA_DO_AIS	__BIT(1)	/* Alternate Instruction Set enabled */
+		/* (VIA "Nehemiah" only) */
 #define CPUID_VIA_HAS_RNG	__BIT(2)	/* Random number generator */
 #define CPUID_VIA_DO_RNG	__BIT(3)
 #define CPUID_VIA_HAS_ACE	__BIT(6)	/* AES Encryption */
@@ -1288,7 +1292,7 @@
 #define  MSR_X2APIC_SELF_IPI		0x03f	/* SELF IPI (W) */
 
 /*
- * VIA "Nehemiah" MSRs
+ * VIA "Nehemiah" or later MSRs
  */
 #define MSR_VIA_RNG		0x110b
 #define MSR_VIA_RNG_ENABLE	0x0040
@@ -1296,15 +1300,10 @@
 #define MSR_VIA_RNG_NOISE_A	0x
 #define MSR_VIA_RNG_NOISE_B	0x0100
 #define MSR_VIA_RNG_2NOISE	0x0300
-#define MSR_VIA_ACE		0x1107
-#define 	VIA_ACE_ALTINST	0x0001
-#define 	VIA_ACE_ECX8	0x0002
-#define 	VIA_ACE_ENABLE	0x1000
-
-/*
- * VIA "Eden" MSRs
- */
-#define MSR_VIA_FCR		MSR_VIA_ACE
+#define MSR_VIA_FCR		0x1107	/* Feature Control Register */
+#define 	VIA_FCR_ACE_ENABLE	0x1000	/* Enable PadLock (ex. RNG) */
+#define 	VIA_FCR_CX8_REPORT	0x0002	/* Enable CX8 CPUID reporting */
+#define 	VIA_FCR_ALTINST_ENABLE	0x0001	/* Enable ALTINST (C3 only) */
 
 /*
  * AMD K6/K7 MSRs.

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.93.2.5 src/sys/arch/x86/x86/identcpu.c:1.93.2.6
--- src/sys/arch/x86/x86/identcpu.c:1.93.2.5	Fri Dec 24 12:58:14 2021
+++ src/sys/arch/x86/x86/identcpu.c	Sat Jul 20 14:20:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.93.2.5 2021/12/24 12:58:14 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.93.2.6 2024/07/20 14:20:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ 

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

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:23:19 UTC 2024

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

Log Message:
Regen for ticket #1852 (Brainboxes devices)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.22 -r1.1371.2.23 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.22 -r1.1370.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-9] src/sys/dev/pci

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:23:19 UTC 2024

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

Log Message:
Regen for ticket #1852 (Brainboxes devices)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.22 -r1.1371.2.23 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.22 -r1.1370.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-9] src/sys/dev/pci

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:21:26 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by nia in ticket #1852):

sys/dev/pci/pcidevs: revision 1.1507

Add Brainboxes and devices
>From Cameron Williams in PR 58358.


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

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 17:21:26 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by nia in ticket #1852):

sys/dev/pci/pcidevs: revision 1.1507

Add Brainboxes and devices
>From Cameron Williams in PR 58358.


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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1383.2.22 src/sys/dev/pci/pcidevs:1.1383.2.23
--- src/sys/dev/pci/pcidevs:1.1383.2.22	Sat Feb  3 11:24:19 2024
+++ src/sys/dev/pci/pcidevs	Wed Jul  3 17:21:26 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.22 2024/02/03 11:24:19 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.23 2024/07/03 17:21:26 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -545,6 +545,7 @@ vendor FORTEMEDIA	0x1319	Forte Media
 vendor SIIG		0x131f	Siig
 vendor MICROMEMORY	0x1332	Micro Memory
 vendor DOMEX		0x134a	Domex
+vendor BRAINBOXES	0x135a	Brainboxes Ltd
 vendor QUATECH		0x135c	Quatech
 vendor LMC		0x1376	LAN Media
 vendor NETGEAR		0x1385	Netgear
@@ -2505,6 +2506,59 @@ product BIT3 PCIVME2706		0x0300	PCI-VME 
 product BLUESTEEL 5501		0x	5501
 product BLUESTEEL 5601		0x5601	5601
 
+/* Brainboxes products */
+product BRAINBOXES UC268	0x0841	Brainboxes UC-268
+product BRAINBOXES UC257	0x0861	Brainboxes UC-257
+product BRAINBOXES UC257R3	0x0862	Brainboxes UC-257
+product BRAINBOXES UC257R4	0x0863	Brainboxes UC-257
+product BRAINBOXES UC279	0x0881	Brainboxes UC-279
+product BRAINBOXES UC313	0x08a1	Brainboxes UC-313
+product BRAINBOXES UC313R3	0x08a2	Brainboxes UC-313
+product BRAINBOXES UC313R4	0x08a3	Brainboxes UC-313
+product BRAINBOXES UC310	0x08c1	Brainboxes UC-310
+product BRAINBOXES UC302	0x08e1	Brainboxes UC-302
+product BRAINBOXES UC302R3	0x08e2	Brainboxes UC-302
+product BRAINBOXES UC302R4	0x08e3	Brainboxes UC-302
+product BRAINBOXES UC431	0x0901	Brainboxes UC-431
+product BRAINBOXES UC420	0x0921	Brainboxes UC-420
+product BRAINBOXES UC475	0x0981	Brainboxes UC-475
+product BRAINBOXES UC475R3	0x0982	Brainboxes UC-475
+product BRAINBOXES UC607	0x09a1	Brainboxes UC-607
+product BRAINBOXES UC607R3	0x09a2	Brainboxes UC-607
+product BRAINBOXES UC607R4	0x09a3	Brainboxes UC-607
+product BRAINBOXES UC324	0x0a61	Brainboxes UC-324
+product BRAINBOXES UC357	0x0a81	Brainboxes UC-357
+product BRAINBOXES UC357R3	0x0a82	Brainboxes UC-357
+product BRAINBOXES UC357R4	0x0a83	Brainboxes UC-357
+product BRAINBOXES UC246	0x0aa1	Brainboxes UC-246
+product BRAINBOXES UC246R3	0x0aa2	Brainboxes UC-246
+product BRAINBOXES UP189	0x0ac1	Brainboxes UP-189
+product BRAINBOXES UP189R3	0x0ac2	Brainboxes UP-189
+product BRAINBOXES UP189R4	0x0ac3	Brainboxes UP-189
+product BRAINBOXES UC346	0x0b01	Brainboxes UC-346
+product BRAINBOXES UC346R3	0x0b02	Brainboxes UC-346
+product BRAINBOXES UP200	0x0b21	Brainboxes UP-200
+product BRAINBOXES UP200R3	0x0b22	Brainboxes UP-200
+product BRAINBOXES UP200R4	0x0b23	Brainboxes UP-200
+product BRAINBOXES UC101	0x0ba1	Brainboxes UC-101
+product BRAINBOXES UC203	0x0bc1	Brainboxes UC-203
+product BRAINBOXES UC203R3	0x0bc2	Brainboxes UC-203
+product BRAINBOXES UP869	0x0c01	Brainboxes UP-869
+product BRAINBOXES UP869R3	0x0c02	Brainboxes UP-869
+product BRAINBOXES UP869R4	0x0c03	Brainboxes UP-869
+product BRAINBOXES UP880	0x0c21	Brainboxes UP-880
+product BRAINBOXES UP880R3	0x0c22	Brainboxes UP-880
+product BRAINBOXES UP880R4	0x0c23	Brainboxes UP-880
+product BRAINBOXES UC368	0x0c41	Brainboxes UC-368
+product BRAINBOXES UC253	0x0ca1	Brainboxes UC-253
+product BRAINBOXES UC260	0x0d21	Brainboxes UC-260
+product BRAINBOXES UC836	0x0d41	Brainboxes UC-836
+product BRAINBOXES IS100	0x0d60	Intashield IS-100
+product BRAINBOXES IS200	0x0d80	Intashield IS-200
+product BRAINBOXES IS300	0x0da0	Intashield IS-300
+product BRAINBOXES IS400	0x0dc0	Intashield IS-400
+product BRAINBOXES UC414	0x0e61	Brainboxes UC-414
+
 /* Broadcom products */
 product BROADCOM BCM5752	0x1600	BCM5752 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5752M	0x1601	BCM5752M NetXtreme 1000baseT Ethernet



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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 09:58:56 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: coretemp.c

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #1848):

sys/arch/x86/x86/coretemp.c: revision 1.40

sys/arch/x86/x86/coretemp.c: revision 1.41

coretemp.c: fix grammar in a warning message
(I get several of these warnings on boot on a particular machine. Now,
it also seems that the code isn't retrieving the correct value, either;
TBD.)

coretemp.c: don't accept impossibly low TjMax values
r. 1.39 introduced a regression where instead of applying a reasonable
default maximum (as was done prior to that change), incorrect values
were accepted and applied, as failures to retrieve an expected MSR
value weren't accounted for.

Apply different logic for unexpectedly low vs. high maximums, with
distinct warnings for each. Also add another warning about a retrieval
failure right at the outset (which also just uses the default, then).

This change fundamentally doesn't address the fact that
__SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT)
doesn't necessarily return a valid value. It just restores prior
behaviour, which is more reasonable than applying a zero value, which
started happening on some older hardware. (I infer this is most likely
an issue with dated generations of Intel hardware with this feature.)

The challenge is that this evidently isn't all documented properly
anywhere. Various "magic values" in this driver need further
investigation.

While here, also fix output so warnings are cleanly formatted, rather
than the slightly scrambled way they were appearing.

Tested on older Intel hardware I had on hand:
E7500 (now falls back to default 100 rather than 0)
E5540 (successfully retrieves 97, as before)
i5-3340M (successfully retrieves 105, as before)


To generate a diff of this commit:
cvs rdiff -u -r1.36.4.2 -r1.36.4.3 src/sys/arch/x86/x86/coretemp.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/x86

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 09:58:56 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: coretemp.c

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #1848):

sys/arch/x86/x86/coretemp.c: revision 1.40

sys/arch/x86/x86/coretemp.c: revision 1.41

coretemp.c: fix grammar in a warning message
(I get several of these warnings on boot on a particular machine. Now,
it also seems that the code isn't retrieving the correct value, either;
TBD.)

coretemp.c: don't accept impossibly low TjMax values
r. 1.39 introduced a regression where instead of applying a reasonable
default maximum (as was done prior to that change), incorrect values
were accepted and applied, as failures to retrieve an expected MSR
value weren't accounted for.

Apply different logic for unexpectedly low vs. high maximums, with
distinct warnings for each. Also add another warning about a retrieval
failure right at the outset (which also just uses the default, then).

This change fundamentally doesn't address the fact that
__SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT)
doesn't necessarily return a valid value. It just restores prior
behaviour, which is more reasonable than applying a zero value, which
started happening on some older hardware. (I infer this is most likely
an issue with dated generations of Intel hardware with this feature.)

The challenge is that this evidently isn't all documented properly
anywhere. Various "magic values" in this driver need further
investigation.

While here, also fix output so warnings are cleanly formatted, rather
than the slightly scrambled way they were appearing.

Tested on older Intel hardware I had on hand:
E7500 (now falls back to default 100 rather than 0)
E5540 (successfully retrieves 97, as before)
i5-3340M (successfully retrieves 105, as before)


To generate a diff of this commit:
cvs rdiff -u -r1.36.4.2 -r1.36.4.3 src/sys/arch/x86/x86/coretemp.c

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

Modified files:

Index: src/sys/arch/x86/x86/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.36.4.2 src/sys/arch/x86/x86/coretemp.c:1.36.4.3
--- src/sys/arch/x86/x86/coretemp.c:1.36.4.2	Sat Jul 29 11:01:14 2023
+++ src/sys/arch/x86/x86/coretemp.c	Sat Jun 22 09:58:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.36.4.2 2023/07/29 11:01:14 martin Exp $ */
+/* $NetBSD: coretemp.c,v 1.36.4.3 2024/06/22 09:58:56 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36.4.2 2023/07/29 11:01:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36.4.3 2024/06/22 09:58:56 martin Exp $");
 
 #include 
 #include 
@@ -110,7 +110,7 @@ static int	coretemp_match(device_t, cfda
 static void	coretemp_attach(device_t, device_t, void *);
 static int	coretemp_detach(device_t, int);
 static int	coretemp_quirks(struct cpu_info *);
-static void	coretemp_tjmax(device_t);
+static int	coretemp_tjmax(device_t);
 static void	coretemp_refresh(struct sysmon_envsys *, envsys_data_t *);
 static void	coretemp_refresh_xcall(void *, void *);
 
@@ -194,9 +194,10 @@ coretemp_attach(device_t parent, device_
 	if (sysmon_envsys_register(sc->sc_sme) != 0)
 		goto fail;
 
-	coretemp_tjmax(self);
-	aprint_verbose(", Tjmax=%d", sc->sc_tjmax);
-	aprint_normal("\n");
+	if (coretemp_tjmax(self) == 0) {
+		aprint_verbose(", Tjmax=%d", sc->sc_tjmax);
+		aprint_normal("\n");
+	}
 	return;
 
 fail:
@@ -258,7 +259,7 @@ coretemp_quirks(struct cpu_info *ci)
 	return 1;
 }
 
-void
+static int
 coretemp_tjmax(device_t self)
 {
 	struct coretemp_softc *sc = device_private(self);
@@ -288,17 +289,19 @@ coretemp_tjmax(device_t self)
 		if ((model < 0x17) && ((msr & __BIT(28)) == 0))
 			goto notee;
 
-		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, ) == EFAULT)
-			return;
+		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, ) == EFAULT) {
+			aprint_normal("\n");
+			aprint_error_dev(sc->sc_dev,
+			"Failed to read MSR_IA32_EXT_CONFIG MSR. "
+			"Using default (%d)\n", sc->sc_tjmax);
+			return 1;
+		}
 
-		if ((msr & __BIT(30)) != 0) {
+		if ((msr & __BIT(30)) != 0)
 			sc->sc_tjmax = 85;
-			return;
-		}
 	} else if (model == 0x17 && stepping == 0x06) {
 		/* The mobile Penryn family. */
 		sc->sc_tjmax = 105;
-		return;
 	} else if (model == 0x1c) {
 		if (stepping == 0x0a) {
 			/* 45nm Atom D400, N400 and D500 series */
@@ -307,21 +310,39 @@ coretemp_tjmax(device_t self)
 			sc->sc_tjmax = 90;
 	} else {
 notee:
-		/* Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET. */
+		/* 
+		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET.
+		 * It is not fully known which CPU models have the MSR.
+		 */
 		if (rdmsr_safe(MSR_TEMPERATURE_TARGET, ) == EFAULT) {
+			aprint_normal("\n");
 			aprint_error_dev(sc->sc_dev,
 			"Failed to read TEMPERATURE_TARGET MSR. "
-			"Use the default (%d)\n", 

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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 18:16:22 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-9]: aed.c
src/sys/arch/macppc/dev [netbsd-9]: aed.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1847):

sys/arch/macppc/dev/aed.c: revision 1.35
sys/arch/mac68k/dev/aed.c: revision 1.39

Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.30 -r1.30.8.1 src/sys/arch/macppc/dev/aed.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/mac68k/dev/aed.c
diff -u src/sys/arch/mac68k/dev/aed.c:1.34 src/sys/arch/mac68k/dev/aed.c:1.34.8.1
--- src/sys/arch/mac68k/dev/aed.c:1.34	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/mac68k/dev/aed.c	Thu Jun 20 18:16:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.34 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: aed.c,v 1.34.8.1 2024/06/20 18:16:22 martin Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34.8.1 2024/06/20 18:16:22 martin Exp $");
 
 #include "opt_adb.h"
 
@@ -164,6 +164,7 @@ aed_input(adb_event_t *event)
 			aed_dokeyupdown(_event);
 		break;
 	case ADBADDR_MS:
+		event->u.m.buttons |= aed_sc->sc_buttons;
 		new_event.u.m.buttons |= aed_sc->sc_buttons;
 		aed_handoff(_event);
 		break;

Index: src/sys/arch/macppc/dev/aed.c
diff -u src/sys/arch/macppc/dev/aed.c:1.30 src/sys/arch/macppc/dev/aed.c:1.30.8.1
--- src/sys/arch/macppc/dev/aed.c:1.30	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/macppc/dev/aed.c	Thu Jun 20 18:16:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.30 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: aed.c,v 1.30.8.1 2024/06/20 18:16:22 martin Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.30 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.30.8.1 2024/06/20 18:16:22 martin Exp $");
 
 #include 
 #include 
@@ -167,6 +167,7 @@ aed_input(adb_event_t *event)
 			aed_dokeyupdown(_event);
 		break;
 	case ADBADDR_MS:
+		event->u.m.buttons |= aed_sc->sc_buttons;
 		new_event.u.m.buttons |= aed_sc->sc_buttons;
 		aed_handoff(_event);
 		break;



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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 18:16:22 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-9]: aed.c
src/sys/arch/macppc/dev [netbsd-9]: aed.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1847):

sys/arch/macppc/dev/aed.c: revision 1.35
sys/arch/mac68k/dev/aed.c: revision 1.39

Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.30 -r1.30.8.1 src/sys/arch/macppc/dev/aed.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/dev/usb

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 17:55:47 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
Regen for ticket #1846 (Mercusys MW150USV2 support)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.14 -r1.760.4.15 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 17:55:11 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: if_urtwn.c usbdevs

Log Message:
Pull up following revision(s) (requested by nia in ticket #1846):

sys/dev/usb/if_urtwn.c: revision 1.108
sys/dev/usb/usbdevs: revision 1.812

Add Mercusys and Mercusys MW150USV2
>From Daeil Lee in PR/57819

Add Mercusys NW150US V2 USB support

No changes needed, other than recognizing it as working.
>From Daeil Lee in PR/57819


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.7 -r1.71.2.8 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.770.4.14 -r1.770.4.15 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71.2.7 src/sys/dev/usb/if_urtwn.c:1.71.2.8
--- src/sys/dev/usb/if_urtwn.c:1.71.2.7	Sun Mar 10 18:59:19 2024
+++ src/sys/dev/usb/if_urtwn.c	Thu Jun 20 17:55:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.71.2.7 2024/03/10 18:59:19 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.71.2.8 2024/06/20 17:55:11 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.7 2024/03/10 18:59:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.8 2024/06/20 17:55:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -190,6 +190,7 @@ static const struct urtwn_dev {
 	/* URTWN_RTL8188E */
 	URTWN_RTL8188E_DEV(DLINK, DWA125D1),
 	URTWN_RTL8188E_DEV(ELECOM, WDC150SU2M),
+	URTWN_RTL8188E_DEV(MERCUSYS, MW150USV2),
 	URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV),
 	URTWN_RTL8188E_DEV(REALTEK, RTL8188EU),
 	URTWN_RTL8188E_DEV(ABOCOM, RTL8188EU),

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770.4.14 src/sys/dev/usb/usbdevs:1.770.4.15
--- src/sys/dev/usb/usbdevs:1.770.4.14	Sun Apr 28 13:29:40 2024
+++ src/sys/dev/usb/usbdevs	Thu Jun 20 17:55:11 2024
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.14 2024/04/28 13:29:40 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.15 2024/06/20 17:55:11 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -583,6 +583,7 @@ vendor HIROSE		0x2631	Hirose Electric
 vendor ONEPLUS		0x2717	ONEPLUS
 vendor NHJ		0x2770	NHJ
 vendor PLANEX		0x2c02	Planex Communications
+vendor MERCUSYS		0x2c4e	Mercusys
 vendor VIDZMEDIA	0x3275	VidzMedia Pte Ltd
 vendor AEI		0x3334	AEI
 vendor HANK		0x3353	Hank Connection
@@ -2288,6 +2289,9 @@ product MELCO WLIUCGNM		0x01a2	WLI-UC-GN
 product MELCO WLIUCGNM2T	0x01ee	WLI-UC-GNM2T
 product MELCO WIU2300D		0x0241	WI-U2-300D
 
+/* Mercusys products */
+product	MERCUSYS MW150USV2	0x0102	MW150US V2
+
 /* Merlin products */
 product MERLIN V620		0x1110	Merlin V620
 



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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 17:55:11 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: if_urtwn.c usbdevs

Log Message:
Pull up following revision(s) (requested by nia in ticket #1846):

sys/dev/usb/if_urtwn.c: revision 1.108
sys/dev/usb/usbdevs: revision 1.812

Add Mercusys and Mercusys MW150USV2
>From Daeil Lee in PR/57819

Add Mercusys NW150US V2 USB support

No changes needed, other than recognizing it as working.
>From Daeil Lee in PR/57819


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.7 -r1.71.2.8 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.770.4.14 -r1.770.4.15 src/sys/dev/usb/usbdevs

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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 17:58:47 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: eap.c

Log Message:
Pull up following revision(s) (requested by nia in ticket #1843):

sys/dev/pci/eap.c: revision 1.103

eap(4): Restore the full set of supported hardware encodings from netbsd-7

Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.2.1 src/sys/dev/pci/eap.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/dev/pci

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 17:58:47 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: eap.c

Log Message:
Pull up following revision(s) (requested by nia in ticket #1843):

sys/dev/pci/eap.c: revision 1.103

eap(4): Restore the full set of supported hardware encodings from netbsd-7

Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.2.1 src/sys/dev/pci/eap.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/eap.c
diff -u src/sys/dev/pci/eap.c:1.102 src/sys/dev/pci/eap.c:1.102.2.1
--- src/sys/dev/pci/eap.c:1.102	Thu Jul 25 15:06:07 2019
+++ src/sys/dev/pci/eap.c	Mon Jun 17 17:58:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $	*/
+/*	$NetBSD: eap.c,v 1.102.2.1 2024/06/17 17:58:46 martin Exp $	*/
 /*  $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */
 
 /*
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.102.2.1 2024/06/17 17:58:46 martin Exp $");
 
 #include "midi.h"
 #include "joy_eap.h"
@@ -218,9 +218,39 @@ static const struct audio_format eap_for
 		.precision	= 16,
 		.channels	= 2,
 		.channel_mask	= AUFMT_STEREO,
-		.frequency_type	= 2,
+		.frequency_type	= 0,
 		.frequency	= { 4000, 48000 },
 	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_LE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 1,
+		.channel_mask	= AUFMT_MONAURAL,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_ULINEAR_LE,
+		.validbits	= 8,
+		.precision	= 8,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_ULINEAR_LE,
+		.validbits	= 8,
+		.precision	= 8,
+		.channels	= 1,
+		.channel_mask	= AUFMT_MONAURAL,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	}
 };
 #define EAP_NFORMATS	__arraycount(eap_formats)
 



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 16:43:05 UTC 2024

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-9]: autoconf.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1842):

sys/arch/hp300/hp300/autoconf.c: revision 1.113

Fix a 20 years old botch by me in setbootdev() on switching to MI SCSI.
setbootdev() updates bootdev data shared between BOOTROM and
it notifies BOOTROM to choose a current root device as a boot device
on the next boot, but I didn't understand the intention and then
it has been broken on SCSI disks. Sigh.

(I wonder if no one has noticed this old feature for 20 years..)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.106.2.1 src/sys/arch/hp300/hp300/autoconf.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/hp300/hp300/autoconf.c
diff -u src/sys/arch/hp300/hp300/autoconf.c:1.106 src/sys/arch/hp300/hp300/autoconf.c:1.106.2.1
--- src/sys/arch/hp300/hp300/autoconf.c:1.106	Sat Jun 29 02:41:17 2019
+++ src/sys/arch/hp300/hp300/autoconf.c	Mon Jun 17 16:43:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.106 2019/06/29 02:41:17 tsutsui Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.106.2.1 2024/06/17 16:43:05 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.106 2019/06/29 02:41:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.106.2.1 2024/06/17 16:43:05 martin Exp $");
 
 #include "dvbox.h"
 #include "gbox.h"
@@ -654,10 +654,9 @@ setbootdev(void)
 	 */
 	switch (type) {
 	case 2: /* rd */
-	case 4: /* sd */
 		/*
 		 * "rd" -> "hpibbus" -> "fhpib"
-		 * "sd" -> "scsibus" -> "spc"
+		 * "rd" -> "hpibbus" -> "nhpib"
 		 */
 		for (cdd = LIST_FIRST(_data_list_hpib), ctlr = 0;
 		cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
@@ -673,6 +672,24 @@ setbootdev(void)
 			}
 		}
 		break;
+	case 4: /* sd */
+		/*
+		 * "sd" -> "scsibus" -> "spc"
+		 */
+		for (cdd = LIST_FIRST(_data_list_scsi), ctlr = 0;
+		cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
+			if (cdd->dd_dev ==
+			device_parent(device_parent(root_device))) {
+/*
+ * Found it!
+ */
+bootdev = MAKEBOOTDEV(type,
+ctlr, dd->dd_slave, dd->dd_punit,
+DISKPART(rootdev));
+break;
+			}
+		}
+		break;
 	}
 
  out:



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 16:43:05 UTC 2024

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-9]: autoconf.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1842):

sys/arch/hp300/hp300/autoconf.c: revision 1.113

Fix a 20 years old botch by me in setbootdev() on switching to MI SCSI.
setbootdev() updates bootdev data shared between BOOTROM and
it notifies BOOTROM to choose a current root device as a boot device
on the next boot, but I didn't understand the intention and then
it has been broken on SCSI disks. Sigh.

(I wonder if no one has noticed this old feature for 20 years..)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.106.2.1 src/sys/arch/hp300/hp300/autoconf.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/dev/hil

2024-05-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 16 12:23:13 UTC 2024

Modified Files:
src/sys/dev/hil [netbsd-9]: hil.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1840):

sys/dev/hil/hil.c: revision 1.8

Fix "stray level 1 interrupt" panic by pressing keys during autoconf(9).

Also explicitly initialize sc->sc_status = HIL_STATUS_BUSY in hil_attach().

Previously hil_intr(9) returned immediately during 'cold', but
all interrupts are enabled at the end of configure() (actually
in MD cpu_configure()) and cold is cleared in confiugre2()
after configure(), so there is a small window when hil interrupts
can be triggered during cold.

It looks there is no problem to process hil_intr() before
hil_attach_deferre() is called via configure2() because
we already check 'sc->sc_status != HIL_STATUS_BUSY' on
processing a kthread.

Note this seems also to appease the similar panic on mame's hp9k370
emulation (though mame's emulation around DMAC looks still incomplete).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/dev/hil/hil.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/hil/hil.c
diff -u src/sys/dev/hil/hil.c:1.3 src/sys/dev/hil/hil.c:1.3.4.1
--- src/sys/dev/hil/hil.c:1.3	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/hil/hil.c	Thu May 16 12:23:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hil.c,v 1.3 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: hil.c,v 1.3.4.1 2024/05/16 12:23:13 martin Exp $	*/
 /*	$OpenBSD: hil.c,v 1.24 2010/11/20 16:45:46 miod Exp $	*/
 /*
  * Copyright (c) 2003, 2004, Miodrag Vallat.
@@ -150,6 +150,7 @@ hil_attach(struct hil_softc *sc, int *hi
 	sc->sc_cmdbp = sc->sc_cmdbuf;
 	sc->sc_pollbp = sc->sc_pollbuf;
 	sc->sc_console = hil_is_console;
+	sc->sc_status = HIL_STATUS_BUSY;
 }
 
 /*
@@ -269,9 +270,6 @@ hil_intr(void *v)
 	struct hil_softc *sc = v;
 	uint8_t c, stat;
 
-	if (cold)
-		return 0;
-
 	stat = bus_space_read_1(sc->sc_bst, sc->sc_bsh, HILP_STAT);
 
 	/*



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

2024-05-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 16 12:23:13 UTC 2024

Modified Files:
src/sys/dev/hil [netbsd-9]: hil.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1840):

sys/dev/hil/hil.c: revision 1.8

Fix "stray level 1 interrupt" panic by pressing keys during autoconf(9).

Also explicitly initialize sc->sc_status = HIL_STATUS_BUSY in hil_attach().

Previously hil_intr(9) returned immediately during 'cold', but
all interrupts are enabled at the end of configure() (actually
in MD cpu_configure()) and cold is cleared in confiugre2()
after configure(), so there is a small window when hil interrupts
can be triggered during cold.

It looks there is no problem to process hil_intr() before
hil_attach_deferre() is called via configure2() because
we already check 'sc->sc_status != HIL_STATUS_BUSY' on
processing a kthread.

Note this seems also to appease the similar panic on mame's hp9k370
emulation (though mame's emulation around DMAC looks still incomplete).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/dev/hil/hil.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/mac68k/dev

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:47:31 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-9]: pm_direct.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1839):

sys/arch/mac68k/dev/pm_direct.c: revision 1.31

Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.34.1 src/sys/arch/mac68k/dev/pm_direct.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/mac68k/dev/pm_direct.c
diff -u src/sys/arch/mac68k/dev/pm_direct.c:1.29 src/sys/arch/mac68k/dev/pm_direct.c:1.29.34.1
--- src/sys/arch/mac68k/dev/pm_direct.c:1.29	Fri Oct 25 20:49:38 2013
+++ src/sys/arch/mac68k/dev/pm_direct.c	Sat May 11 14:47:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm_direct.c,v 1.29 2013/10/25 20:49:38 martin Exp $	*/
+/*	$NetBSD: pm_direct.c,v 1.29.34.1 2024/05/11 14:47:31 martin Exp $	*/
 
 /*
  * Copyright (C) 1997 Takashi Hamada
@@ -32,7 +32,7 @@
 /* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.29 2013/10/25 20:49:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.29.34.1 2024/05/11 14:47:31 martin Exp $");
 
 #include "opt_adb.h"
 
@@ -562,6 +562,7 @@ pm_intr_pm1(void *arg)
 			printf("pm: PM is not ready. error code=%08x\n", rval);
 #endif
 		splx(s);
+		return;
 	}
 
 	if ((pmdata.data[2] & 0x10) == 0x10) {
@@ -821,6 +822,7 @@ pm_intr_pm2(void *arg)
 			printf("pm: PM is not ready. error code: %08x\n", rval);
 #endif
 		splx(s);
+		return;
 	}
 
 	switch ((u_int)(pmdata.data[2] & 0xff)) {



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

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:47:31 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-9]: pm_direct.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1839):

sys/arch/mac68k/dev/pm_direct.c: revision 1.31

Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.34.1 src/sys/arch/mac68k/dev/pm_direct.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/hp300/stand

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:39:57 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/inst [netbsd-9]: Makefile
src/sys/arch/hp300/stand/uboot [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1838):

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.170.1 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.8 -r1.8.198.1 src/sys/arch/hp300/stand/uboot/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/hp300/stand/inst/Makefile
diff -u src/sys/arch/hp300/stand/inst/Makefile:1.9 src/sys/arch/hp300/stand/inst/Makefile:1.9.170.1
--- src/sys/arch/hp300/stand/inst/Makefile:1.9	Sun Dec 11 12:17:23 2005
+++ src/sys/arch/hp300/stand/inst/Makefile	Sat May 11 14:39:57 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2005/12/11 12:17:23 christos Exp $
+#	$NetBSD: Makefile,v 1.9.170.1 2024/05/11 14:39:57 martin Exp $
 
 PROGAOUT=	inst
 PROGSOURCE=	inst.c
@@ -6,16 +6,14 @@ NEWVERSWHAT=	"Miniroot Installer"
 
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
 
+LINKS=	${BINDIR}/${PROG} ${BINDIR}/rbootd/SYS_INST
+
 .include "../Makefile.buildboot"
 
-install:
+beforeinstall:
 	${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} ${INSTPRIV} \
 	${DESTDIR}${BINDIR}/rbootd
-	${INSTALL} ${COPY} -m 444 -o ${BINOWN} -g ${BINGRP} ${INSTPRIV} \
-	inst.lif ${DESTDIR}${BINDIR}/inst.lif
-	rm -f ${DESTDIR}${BINDIR}/rbootd/SYS_INST
-	ln ${DESTDIR}${BINDIR}/inst.lif ${DESTDIR}${BINDIR}/rbootd/SYS_INST
 
-release: check_RELEASEDIR .WAIT inst.lif
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} inst.lif \
+release: check_RELEASEDIR .WAIT ${PROG}
+	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${MACHINE}/installation/misc/SYS_INST

Index: src/sys/arch/hp300/stand/uboot/Makefile
diff -u src/sys/arch/hp300/stand/uboot/Makefile:1.8 src/sys/arch/hp300/stand/uboot/Makefile:1.8.198.1
--- src/sys/arch/hp300/stand/uboot/Makefile:1.8	Fri Jan  3 15:34:42 2003
+++ src/sys/arch/hp300/stand/uboot/Makefile	Sat May 11 14:39:57 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2003/01/03 15:34:42 lukem Exp $
+#	$NetBSD: Makefile,v 1.8.198.1 2024/05/11 14:39:57 martin Exp $
 
 PROGAOUT=	uboot
 PROGSOURCE=	uboot.c tgets.c
@@ -6,28 +6,20 @@ NEWVERSWHAT=	"Primary Boot"
 
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
 
+LINKS=	${BINDIR}/${PROG} ${BINDIR}/rdboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootrd
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/sdboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootsd
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/ctboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootct
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/rbootd/SYS_UBOOT
+
 .include "../Makefile.buildboot"
 
-install:
+beforeinstall:
 	${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \
 	${DESTDIR}${BINDIR}/rbootd
-	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
-	uboot.lif ${DESTDIR}${BINDIR}/uboot.lif
-	rm -f ${DESTDIR}${BINDIR}/rdboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/rdboot
-	rm -f ${DESTDIR}${BINDIR}/bootrd
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootrd
-	rm -f ${DESTDIR}${BINDIR}/sdboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/sdboot
-	rm -f ${DESTDIR}${BINDIR}/bootsd
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootsd
-	rm -f ${DESTDIR}${BINDIR}/ctboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/ctboot
-	rm -f ${DESTDIR}${BINDIR}/bootct
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootct
-	rm -f ${DESTDIR}${BINDIR}/rbootd/SYS_UBOOT
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/rbootd/SYS_UBOOT
 
-release: check_RELEASEDIR .WAIT uboot.lif
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} uboot.lif \
+release: check_RELEASEDIR .WAIT ${PROG}
+	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${MACHINE}/installation/misc/SYS_UBOOT



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

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:39:57 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/inst [netbsd-9]: Makefile
src/sys/arch/hp300/stand/uboot [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1838):

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.170.1 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.8 -r1.8.198.1 src/sys/arch/hp300/stand/uboot/Makefile

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/usb

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 13:30:11 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
Regen for ticket #1837


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.13 -r1.760.4.14 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



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

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 13:29:40 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: uftdi.c usbdevs

Log Message:
Pull up following revision(s) (requested by maya in ticket #1837):

sys/dev/usb/uftdi.c: revision 1.78
sys/dev/usb/usbdevs: revision 1.815

Add some USB serial adapters
>From Cameron Williams in PR kern/58127

Add support for a range of USB serial adapters
>From Cameron Williams in PR kern/58127


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.70.2.1 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.770.4.13 -r1.770.4.14 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.70 src/sys/dev/usb/uftdi.c:1.70.2.1
--- src/sys/dev/usb/uftdi.c:1.70	Thu May  9 02:43:35 2019
+++ src/sys/dev/usb/uftdi.c	Sun Apr 28 13:29:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.70 2019/05/09 02:43:35 mrg Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.70.2.1 2024/04/28 13:29:40 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.70 2019/05/09 02:43:35 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.70.2.1 2024/04/28 13:29:40 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -122,6 +122,25 @@ struct ucom_methods uftdi_methods = {
  */
 static const struct usb_devno uftdi_devs[] = {
 	{ USB_VENDOR_BBELECTRONICS, USB_PRODUCT_BBELECTRONICS_USOTL4 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US101 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US159 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US235 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US257 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_12 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_34 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_56 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_78 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US313 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US320 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US324 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US346_12 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US346_34 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US701_12 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US701_34 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_12 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_34 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_56 },
+	{ USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_78 },
 	{ USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_TWIST },
 	{ USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_SAMBA },
 	{ USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_230X },

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770.4.13 src/sys/dev/usb/usbdevs:1.770.4.14
--- src/sys/dev/usb/usbdevs:1.770.4.13	Fri Feb 17 17:40:28 2023
+++ src/sys/dev/usb/usbdevs	Sun Apr 28 13:29:40 2024
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.13 2023/02/17 17:40:28 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.14 2024/04/28 13:29:40 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1110,6 +1110,27 @@ product BILLIONTON USBEL100	0x0988	USB10
 product BILLIONTON USBE100	0x8511	USBE100
 product BILLIONTON USB2AR	0x90ff	USB2AR Ethernet
 
+/* Brainboxes Limited products */
+product BRAINBOXES US101	0x1011	US-101 USB2Serial 1xRS232
+product BRAINBOXES US159	0x1021	US-159 USB2Serial 1xRS232
+product BRAINBOXES US235	0x1017	US-235 USB2Serial 1xRS232
+product BRAINBOXES US257	0x5001	US-257 USB2Serial 2xRS232
+product BRAINBOXES US279_12	0x2021	US-279 USB2Serial 8xRS232 (Port 1 and 2)
+product BRAINBOXES US279_34	0x2022	US-279 USB2Serial 8xRS232 (Port 3 and 4)
+product BRAINBOXES US279_56	0x2023	US-279 USB2Serial 8xRS232 (Port 5 and 6)
+product BRAINBOXES US279_78	0x2024	US-279 USB2Serial 8xRS232 (Port 7 and 8)
+product BRAINBOXES US313	0x6001	US-313 USB2Serial 2xRS422/485
+product BRAINBOXES US320	0x1019	US-320 USB2Serial 1xRS422/485
+product BRAINBOXES US324	0x1013	US-324 USB2Serial 1xRS422/485
+product BRAINBOXES US346_12	0x3011	US-346 USB2Serial 4xRS422/485 (Port 1 and 2)
+product BRAINBOXES US346_34	0x3012	US-346 USB2Serial 4xRS422/485 (Port 3 and 4)
+product BRAINBOXES US701_12	0x2011	US-701 USB2Serial 4xRS232 (Port 1 and 2)
+product BRAINBOXES US701_34	0x2012	US-701 USB2Serial 4xRS232 (Port 3 and 4)
+product BRAINBOXES US842_12	0x8001	US-842 USB2Serial 8xRS422/485 (Port 1 and 2)
+product BRAINBOXES US842_34	0x8002	US-842 USB2Serial 8xRS422/485 (Port 3 and 4)
+product BRAINBOXES US842_56	0x8003	US-842 USB2Serial 8xRS422/485 (Port 5 and 6)
+product BRAINBOXES US842_78	0x8004	US-842 USB2Serial 8xRS422/485 (Port 7 and 8)
+
 /* Broadcom products */
 product BROADCOM BCMFW		0x0bdc	BCMFW
 product BROADCOM 

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

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 13:29:40 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: uftdi.c usbdevs

Log Message:
Pull up following revision(s) (requested by maya in ticket #1837):

sys/dev/usb/uftdi.c: revision 1.78
sys/dev/usb/usbdevs: revision 1.815

Add some USB serial adapters
>From Cameron Williams in PR kern/58127

Add support for a range of USB serial adapters
>From Cameron Williams in PR kern/58127


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.70.2.1 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.770.4.13 -r1.770.4.14 src/sys/dev/usb/usbdevs

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/netinet6

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 10:14:18 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-9]: frag6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1836):

sys/netinet6/frag6.c: revision 1.78

frag6: fix calculation of fragment length

Because of the miscalculation, 32 bytes fragmented IPv6 packets
have been wrongly dropped.

See https://mail-index.netbsd.org/tech-net/2024/04/14/msg008741.html
for more details.

Patch from Yasuyuki KOZAKAI (with minor tweaks)


To generate a diff of this commit:
cvs rdiff -u -r1.74.6.1 -r1.74.6.2 src/sys/netinet6/frag6.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/netinet6/frag6.c
diff -u src/sys/netinet6/frag6.c:1.74.6.1 src/sys/netinet6/frag6.c:1.74.6.2
--- src/sys/netinet6/frag6.c:1.74.6.1	Thu Oct 27 16:06:24 2022
+++ src/sys/netinet6/frag6.c	Sun Apr 28 10:14:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: frag6.c,v 1.74.6.1 2022/10/27 16:06:24 martin Exp $	*/
+/*	$NetBSD: frag6.c,v 1.74.6.2 2024/04/28 10:14:18 martin Exp $	*/
 /*	$KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.74.6.1 2022/10/27 16:06:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.74.6.2 2024/04/28 10:14:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -197,9 +197,10 @@ frag6_input(struct mbuf **mp, int *offp,
 	 * sizeof(struct ip6_frag) == 8
 	 * sizeof(struct ip6_hdr) = 40
 	 */
-	if ((ip6f->ip6f_offlg & IP6F_MORE_FRAG) &&
-	(((ntohs(ip6->ip6_plen) - offset) == 0) ||
-	 ((ntohs(ip6->ip6_plen) - offset) & 0x7) != 0)) {
+	frgpartlen = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - offset
+	- sizeof(struct ip6_frag);
+	if ((frgpartlen == 0) ||
+	((ip6f->ip6f_offlg & IP6F_MORE_FRAG) && (frgpartlen & 0x7) != 0)) {
 		icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
 		offsetof(struct ip6_hdr, ip6_plen));
 		in6_ifstat_inc(dstifp, ifs6_reass_fail);
@@ -307,7 +308,6 @@ frag6_input(struct mbuf **mp, int *offp,
 	 * in size. If it would exceed, discard the fragment and return an
 	 * ICMP error.
 	 */
-	frgpartlen = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - offset;
 	if (q6->ip6q_unfrglen >= 0) {
 		/* The 1st fragment has already arrived. */
 		if (q6->ip6q_unfrglen + fragoff + frgpartlen > IPV6_MAXPACKET) {



CVS commit: [netbsd-9] src/sys/netinet6

2024-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 28 10:14:18 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-9]: frag6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1836):

sys/netinet6/frag6.c: revision 1.78

frag6: fix calculation of fragment length

Because of the miscalculation, 32 bytes fragmented IPv6 packets
have been wrongly dropped.

See https://mail-index.netbsd.org/tech-net/2024/04/14/msg008741.html
for more details.

Patch from Yasuyuki KOZAKAI (with minor tweaks)


To generate a diff of this commit:
cvs rdiff -u -r1.74.6.1 -r1.74.6.2 src/sys/netinet6/frag6.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/x86

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:40:17 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: viac7temp.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1835):

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.32.1 src/sys/arch/x86/x86/viac7temp.c

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

Modified files:

Index: src/sys/arch/x86/x86/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.8 src/sys/arch/x86/x86/viac7temp.c:1.8.32.1
--- src/sys/arch/x86/x86/viac7temp.c:1.8	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/x86/x86/viac7temp.c	Thu Apr 18 16:40:17 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: viac7temp.c,v 1.8.32.1 2024/04/18 16:40:17 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8.32.1 2024/04/18 16:40:17 martin Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
 	edata->value_cur += 27315;
 	edata->state = ENVSYS_SVALID;
 }
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:40:17 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: viac7temp.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1835):

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.32.1 src/sys/arch/x86/x86/viac7temp.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/stand/efiboot

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 15:33:44 UTC 2024

Modified Files:
src/sys/stand/efiboot [netbsd-9]: efiboot.c

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

sys/stand/efiboot/efiboot.c: revision 1.23

efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@.  Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075


To generate a diff of this commit:
cvs rdiff -u -r1.16.4.1 -r1.16.4.2 src/sys/stand/efiboot/efiboot.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/stand/efiboot/efiboot.c
diff -u src/sys/stand/efiboot/efiboot.c:1.16.4.1 src/sys/stand/efiboot/efiboot.c:1.16.4.2
--- src/sys/stand/efiboot/efiboot.c:1.16.4.1	Thu Sep 26 19:15:18 2019
+++ src/sys/stand/efiboot/efiboot.c	Thu Apr 18 15:33:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.16.4.1 2019/09/26 19:15:18 martin Exp $ */
+/* $NetBSD: efiboot.c,v 1.16.4.2 2024/04/18 15:33:44 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -84,6 +84,8 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS
 	status = uefi_call_wrapper(BS->HandleProtocol, 3, efi_li->DeviceHandle, , (void **)_bootdp);
 	if (EFI_ERROR(status))
 		efi_bootdp = NULL;
+	else
+		efi_bootdp = DuplicateDevicePath(efi_bootdp);
 
 #ifdef EFIBOOT_DEBUG
 	Print(L"Loaded image  : 0x%" PRIxEFIPTR "\n", efi_li);



CVS commit: [netbsd-9] src/sys/stand/efiboot

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 15:33:44 UTC 2024

Modified Files:
src/sys/stand/efiboot [netbsd-9]: efiboot.c

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

sys/stand/efiboot/efiboot.c: revision 1.23

efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@.  Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075


To generate a diff of this commit:
cvs rdiff -u -r1.16.4.1 -r1.16.4.2 src/sys/stand/efiboot/efiboot.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/dev/pci

2024-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 17 16:24:26 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_iwn.c

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

sys/dev/pci/if_iwn.c: revision 1.100

if_iwn.c: pick up proper firmware for Centrino Wireless-N 130

Both variants should use iwlwifi-6000g2b-6 not iwlwifi-6000g2a-6. (It
seems only two specific product variants use iwlwifi-6000g2a-6. We
could simplify by reversing the sense of the test, as OpenBSD does, but
it doesn't seem to matter much, as what we now match seems to be the
full gamut possible, so the simpler diff was chosen here.)

Addresses PR kern/58105 from wandrien.dev%gmail.com@localhost, with the
PCI_PRODUCT_INTEL_WIFI_LINK_130_1 match tested by the reporter. Code
inspection of the FreeBSD driver indicates we should safely be able to
match PCI_PRODUCT_INTEL_WIFI_LINK_130_2 also.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.4.1 src/sys/dev/pci/if_iwn.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_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.91 src/sys/dev/pci/if_iwn.c:1.91.4.1
--- src/sys/dev/pci/if_iwn.c:1.91	Fri Apr 19 19:37:31 2019
+++ src/sys/dev/pci/if_iwn.c	Wed Apr 17 16:24:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.91 2019/04/19 19:37:31 gutteridge Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.91.4.1 2024/04/17 16:24:26 martin Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.91 2019/04/19 19:37:31 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.91.4.1 2024/04/17 16:24:26 martin Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -775,6 +775,8 @@ iwn5000_attach(struct iwn_softc *sc, pci
 		/* Type 6030 cards return IWN_HW_REV_TYPE_6005 */
 		if (pid == PCI_PRODUCT_INTEL_WIFI_LINK_1030_1 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_1030_2 ||
+		pid == PCI_PRODUCT_INTEL_WIFI_LINK_130_1  ||
+		pid == PCI_PRODUCT_INTEL_WIFI_LINK_130_2  ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6230_1 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6230_2 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6235   ||



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

2024-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 17 16:24:26 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_iwn.c

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

sys/dev/pci/if_iwn.c: revision 1.100

if_iwn.c: pick up proper firmware for Centrino Wireless-N 130

Both variants should use iwlwifi-6000g2b-6 not iwlwifi-6000g2a-6. (It
seems only two specific product variants use iwlwifi-6000g2a-6. We
could simplify by reversing the sense of the test, as OpenBSD does, but
it doesn't seem to matter much, as what we now match seems to be the
full gamut possible, so the simpler diff was chosen here.)

Addresses PR kern/58105 from wandrien.dev%gmail.com@localhost, with the
PCI_PRODUCT_INTEL_WIFI_LINK_130_1 match tested by the reporter. Code
inspection of the FreeBSD driver indicates we should safely be able to
match PCI_PRODUCT_INTEL_WIFI_LINK_130_2 also.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.4.1 src/sys/dev/pci/if_iwn.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/dev/qbus

2024-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 25 15:35:50 UTC 2024

Modified Files:
src/sys/dev/qbus [netbsd-9]: if_qe.c

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

sys/dev/qbus/if_qe.c: revision 1.82

vax/qe(4): supply an ipf->if_init() so that if_init() doesn't crash.

convert the existing qeinit() to one compatible with if_init.
should fix PR#58068.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.81.2.1 src/sys/dev/qbus/if_qe.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/qbus/if_qe.c
diff -u src/sys/dev/qbus/if_qe.c:1.81 src/sys/dev/qbus/if_qe.c:1.81.2.1
--- src/sys/dev/qbus/if_qe.c:1.81	Tue May 28 07:41:49 2019
+++ src/sys/dev/qbus/if_qe.c	Mon Mar 25 15:35:50 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_qe.c,v 1.81 2019/05/28 07:41:49 msaitoh Exp $ */
+/*  $NetBSD: if_qe.c,v 1.81.2.1 2024/03/25 15:35:50 martin Exp $ */
 /*
  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.81 2019/05/28 07:41:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qe.c,v 1.81.2.1 2024/03/25 15:35:50 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -97,7 +97,7 @@ struct	qe_softc {
 
 static	int	qematch(device_t, cfdata_t, void *);
 static	void	qeattach(device_t, device_t, void *);
-static	void	qeinit(struct qe_softc *);
+static	int	qeinit(struct ifnet *);
 static	void	qestart(struct ifnet *);
 static	void	qeintr(void *);
 static	int	qeioctl(struct ifnet *, u_long, void *);
@@ -341,6 +341,7 @@ qeattach(device_t parent, device_t self,
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = qestart;
+	ifp->if_init = qeinit;
 	ifp->if_ioctl = qeioctl;
 	ifp->if_watchdog = qetimeout;
 	IFQ_SET_READY(>if_snd);
@@ -381,10 +382,10 @@ qeattach(device_t parent, device_t self,
 /*
  * Initialization of interface.
  */
-void
-qeinit(struct qe_softc *sc)
+int
+qeinit(struct ifnet *ifp)
 {
-	struct ifnet *ifp = (struct ifnet *)>sc_if;
+	struct qe_softc *sc = ifp->if_softc;
 	struct qe_cdata *qc = sc->sc_qedata;
 	int i;
 
@@ -411,7 +412,6 @@ qeinit(struct qe_softc *sc)
 		qc->qc_xmit[i].qe_status1 = qc->qc_xmit[i].qe_flag = QE_NOTYET;
 	}
 
-
 	/*
 	 * Init receive descriptors.
 	 */
@@ -436,6 +436,7 @@ qeinit(struct qe_softc *sc)
 	 */
 	qe_setup(sc);
 
+	return 0;
 }
 
 /*
@@ -651,7 +652,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v
 		switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
 		case AF_INET:
-			qeinit(sc);
+			qeinit(ifp);
 			arp_ifinit(ifp, ifa);
 			break;
 #endif
@@ -677,7 +678,7 @@ qeioctl(struct ifnet *ifp, u_long cmd, v
 			 * If interface it marked up and it is stopped, then
 			 * start it.
 			 */
-			qeinit(sc);
+			qeinit(ifp);
 			break;
 		case IFF_UP | IFF_RUNNING:
 			/*
@@ -868,5 +869,5 @@ qetimeout(struct ifnet *ifp)
 	 * Do a reset of interface, to get it going again.
 	 * Will it work by just restart the transmit logic?
 	 */
-	qeinit(sc);
+	qeinit(ifp);
 }



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

2024-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 25 15:35:50 UTC 2024

Modified Files:
src/sys/dev/qbus [netbsd-9]: if_qe.c

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

sys/dev/qbus/if_qe.c: revision 1.82

vax/qe(4): supply an ipf->if_init() so that if_init() doesn't crash.

convert the existing qeinit() to one compatible with if_init.
should fix PR#58068.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.81.2.1 src/sys/dev/qbus/if_qe.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/dev/usb

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 12:34:50 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdi.c

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

sys/dev/usb/usbdi.c: revision 1.248

usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783


To generate a diff of this commit:
cvs rdiff -u -r1.182.4.5 -r1.182.4.6 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.182.4.5 src/sys/dev/usb/usbdi.c:1.182.4.6
--- src/sys/dev/usb/usbdi.c:1.182.4.5	Sat Jul 18 15:09:28 2020
+++ src/sys/dev/usb/usbdi.c	Tue Mar 12 12:34:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.182.4.5 2020/07/18 15:09:28 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.182.4.6 2024/03/12 12:34:50 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182.4.5 2020/07/18 15:09:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182.4.6 2024/03/12 12:34:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1229,14 +1229,34 @@ usbd_dopoll(struct usbd_interface *iface
 void
 usbd_set_polling(struct usbd_device *dev, int on)
 {
-	if (on)
-		dev->ud_bus->ub_usepolling++;
-	else
-		dev->ud_bus->ub_usepolling--;
 
-	/* Kick the host controller when switching modes */
 	mutex_enter(dev->ud_bus->ub_lock);
-	dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	if (on) {
+		/*
+		 * Enabling polling.  If we're enabling for the first
+		 * time, call the softint routine on transition while
+		 * we hold the lock and polling is still disabled, and
+		 * then enable polling -- once polling is enabled, we
+		 * must not hold the lock when we call the softint
+		 * routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling < __type_max(char));
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+		dev->ud_bus->ub_usepolling++;
+	} else {
+		/*
+		 * Disabling polling.  If we're disabling polling for
+		 * the last time, disable polling first and then call
+		 * the softint routine while we hold the lock -- until
+		 * polling is disabled, we must not hold the lock when
+		 * we call the softint routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling > 0);
+		dev->ud_bus->ub_usepolling--;
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	}
 	mutex_exit(dev->ud_bus->ub_lock);
 }
 



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 12:34:50 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdi.c

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

sys/dev/usb/usbdi.c: revision 1.248

usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783


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



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 09:59:31 UTC 2024

Modified Files:
src/sys/dev/ic [netbsd-9]: nvme.c

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

sys/dev/ic/nvme.c: revision 1.69

nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.6 -r1.44.2.7 src/sys/dev/ic/nvme.c

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

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.44.2.6 src/sys/dev/ic/nvme.c:1.44.2.7
--- src/sys/dev/ic/nvme.c:1.44.2.6	Mon Jun 21 17:25:48 2021
+++ src/sys/dev/ic/nvme.c	Tue Mar 12 09:59:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.44.2.6 2021/06/21 17:25:48 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.44.2.7 2024/03/12 09:59:31 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.6 2021/06/21 17:25:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.7 2024/03/12 09:59:31 martin Exp $");
 
 #include 
 #include 
@@ -552,7 +552,6 @@ nvme_detach(struct nvme_softc *sc, int f
 		return error;
 
 	/* from now on we are committed to detach, following will never fail */
-	sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
 	for (i = 0; i < sc->sc_nq; i++)
 		nvme_q_free(sc, sc->sc_q[i]);
 	kmem_free(sc->sc_q, sizeof(*sc->sc_q) * sc->sc_nq);
@@ -582,6 +581,11 @@ nvme_resume(struct nvme_softc *sc)
 	}
 
 	nvme_q_reset(sc, sc->sc_admin_q);
+	if (sc->sc_intr_establish(sc, NVME_ADMIN_Q, sc->sc_admin_q)) {
+		error = EIO;
+		device_printf(sc->sc_dev, "unable to establish admin q\n");
+		goto disable;
+	}
 
 	error = nvme_enable(sc, ffs(sc->sc_mps) - 1);
 	if (error) {
@@ -643,6 +647,8 @@ nvme_shutdown(struct nvme_softc *sc)
 	if (disabled)
 		goto disable;
 
+	sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
+
 	cc = nvme_read4(sc, NVME_CC);
 	CLR(cc, NVME_CC_SHN_MASK);
 	SET(cc, NVME_CC_SHN(NVME_CC_SHN_NORMAL));



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 09:59:31 UTC 2024

Modified Files:
src/sys/dev/ic [netbsd-9]: nvme.c

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

sys/dev/ic/nvme.c: revision 1.69

nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.6 -r1.44.2.7 src/sys/dev/ic/nvme.c

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



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 19:30:06 UTC 2024

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

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

sys/net/if_tun.c: revision 1.175

tun(4): Allow IPv6 packets with TUNSLMODE configured.
PR kern/58013


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.156.2.1 src/sys/net/if_tun.c

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

Modified files:

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.156 src/sys/net/if_tun.c:1.156.2.1
--- src/sys/net/if_tun.c:1.156	Fri Apr 26 08:38:25 2019
+++ src/sys/net/if_tun.c	Mon Mar 11 19:30:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.156 2019/04/26 08:38:25 pgoyette Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.156.2.1 2024/03/11 19:30:06 martin Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.156 2019/04/26 08:38:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.156.2.1 2024/03/11 19:30:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -586,9 +586,7 @@ tun_output(struct ifnet *ifp, struct mbu
 goto out;
 			}
 			memcpy(mtod(m0, char *), dst, dst->sa_len);
-		}
-
-		if (tp->tun_flags & TUN_IFHEAD) {
+		} else if (tp->tun_flags & TUN_IFHEAD) {
 			/* Prepend the address family */
 			M_PREPEND(m0, sizeof(*af), M_DONTWAIT);
 			if (m0 == NULL) {



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 19:30:06 UTC 2024

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

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

sys/net/if_tun.c: revision 1.175

tun(4): Allow IPv6 packets with TUNSLMODE configured.
PR kern/58013


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.156.2.1 src/sys/net/if_tun.c

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



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

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 18:01:48 UTC 2024

Modified Files:
src/sys/kern [netbsd-9]: sysv_shm.c

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

sys/kern/sysv_shm.c: revision 1.142

Avoid overflow when computing kern.ipc.shmmax. Keep shmmax (bytes) and
shmall (pages) values aligned and use arithmetic everywhere instead
of shifts.

Should fix PR 57979


To generate a diff of this commit:
cvs rdiff -u -r1.135.2.4 -r1.135.2.5 src/sys/kern/sysv_shm.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/kern

2024-03-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 11 18:01:48 UTC 2024

Modified Files:
src/sys/kern [netbsd-9]: sysv_shm.c

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

sys/kern/sysv_shm.c: revision 1.142

Avoid overflow when computing kern.ipc.shmmax. Keep shmmax (bytes) and
shmall (pages) values aligned and use arithmetic everywhere instead
of shifts.

Should fix PR 57979


To generate a diff of this commit:
cvs rdiff -u -r1.135.2.4 -r1.135.2.5 src/sys/kern/sysv_shm.c

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

Modified files:

Index: src/sys/kern/sysv_shm.c
diff -u src/sys/kern/sysv_shm.c:1.135.2.4 src/sys/kern/sysv_shm.c:1.135.2.5
--- src/sys/kern/sysv_shm.c:1.135.2.4	Thu Oct 10 17:23:45 2019
+++ src/sys/kern/sysv_shm.c	Mon Mar 11 18:01:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_shm.c,v 1.135.2.4 2019/10/10 17:23:45 martin Exp $	*/
+/*	$NetBSD: sysv_shm.c,v 1.135.2.5 2024/03/11 18:01:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.135.2.4 2019/10/10 17:23:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.135.2.5 2024/03/11 18:01:48 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -961,10 +961,10 @@ shminit(struct sysctllog **clog)
 	ALIGN(shminfo.shmmni * sizeof(struct shmid_ds)));
 
 	if (shminfo.shmmax == 0)
-		shminfo.shmmax = uimax(physmem / 4, 1024) * PAGE_SIZE;
+		shminfo.shmall = uimax(physmem / 4, 1024);
 	else
-		shminfo.shmmax *= PAGE_SIZE;
-	shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
+		shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
+	shminfo.shmmax = (uint64_t)shminfo.shmall * PAGE_SIZE;
 
 	for (i = 0; i < shminfo.shmmni; i++) {
 		cv_init(_cv[i], "shmwait");
@@ -1087,7 +1087,7 @@ sysctl_ipc_shmmax(SYSCTLFN_ARGS)
 		return EINVAL;
 
 	shminfo.shmmax = round_page(newsize);
-	shminfo.shmall = shminfo.shmmax >> PAGE_SHIFT;
+	shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
 
 	return 0;
 }



CVS commit: [netbsd-9] src/sys/netinet6

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 19:12:05 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-9]: in6.c

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

sys/netinet6/in6.c: revision 1.292

netinet6: Avoid NPD on `ifconfig ifN inet6 ... pltime 0 vltime 0'.
PR kern/53922


To generate a diff of this commit:
cvs rdiff -u -r1.275.2.2 -r1.275.2.3 src/sys/netinet6/in6.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.275.2.2 src/sys/netinet6/in6.c:1.275.2.3
--- src/sys/netinet6/in6.c:1.275.2.2	Fri Aug  4 14:29:44 2023
+++ src/sys/netinet6/in6.c	Sun Mar 10 19:12:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.275.2.2 2023/08/04 14:29:44 martin Exp $	*/
+/*	$NetBSD: in6.c,v 1.275.2.3 2024/03/10 19:12:05 martin Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.275.2.2 2023/08/04 14:29:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.275.2.3 2024/03/10 19:12:05 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -707,7 +707,14 @@ in6_control1(struct socket *so, u_long c
 		int s = splsoftnet();
 		error = in6_update_ifa1(ifp, ifra, , , 0);
 		splx(s);
-		if (error)
+		/*
+		 * in6_update_ifa1 doesn't create the address if its
+		 * valid lifetime (vltime) is zero, since we would just
+		 * delete the address immediately in that case anyway.
+		 * So it may succeed but return null ia.  In that case,
+		 * nothing left to do.
+		 */
+		if (error || ia == NULL)
 			break;
 		pfil_run_addrhooks(if_pfil, cmd, >ia_ifa);
 		break;



CVS commit: [netbsd-9] src/sys/netinet6

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 19:12:05 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-9]: in6.c

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

sys/netinet6/in6.c: revision 1.292

netinet6: Avoid NPD on `ifconfig ifN inet6 ... pltime 0 vltime 0'.
PR kern/53922


To generate a diff of this commit:
cvs rdiff -u -r1.275.2.2 -r1.275.2.3 src/sys/netinet6/in6.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/dev/usb

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 18:59:19 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: if_urtwn.c

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

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.6 -r1.71.2.7 src/sys/dev/usb/if_urtwn.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_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71.2.6 src/sys/dev/usb/if_urtwn.c:1.71.2.7
--- src/sys/dev/usb/if_urtwn.c:1.71.2.6	Sat Oct 23 11:21:54 2021
+++ src/sys/dev/usb/if_urtwn.c	Sun Mar 10 18:59:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.71.2.6 2021/10/23 11:21:54 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.71.2.7 2024/03/10 18:59:19 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.6 2021/10/23 11:21:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.7 2024/03/10 18:59:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -833,6 +833,24 @@ urtwn_tx_beacon(struct urtwn_softc *sc, 
 }
 
 static void
+urtwn_cmdq_invariants(struct urtwn_softc *sc)
+{
+	struct urtwn_host_cmd_ring *const ring __diagused = >cmdq;
+
+	KASSERT(mutex_owned(>sc_task_mtx));
+	KASSERTMSG((ring->cur >= 0 && ring->cur < URTWN_HOST_CMD_RING_COUNT),
+	"%s: cur=%d next=%d queued=%d",
+	device_xname(sc->sc_dev), ring->cur, ring->next, ring->queued);
+	KASSERTMSG((ring->next >= 0 && ring->next < URTWN_HOST_CMD_RING_COUNT),
+	"%s: cur=%d next=%d queued=%d",
+	device_xname(sc->sc_dev), ring->cur, ring->next, ring->queued);
+	KASSERTMSG((ring->queued >= 0 &&
+		ring->queued <= URTWN_HOST_CMD_RING_COUNT),
+	"%s: %d commands queued",
+	device_xname(sc->sc_dev), ring->queued);
+}
+
+static void
 urtwn_task(void *arg)
 {
 	struct urtwn_softc *sc = arg;
@@ -865,7 +883,11 @@ urtwn_task(void *arg)
 	/* Process host commands. */
 	s = splusb();
 	mutex_spin_enter(>sc_task_mtx);
+	urtwn_cmdq_invariants(sc);
 	while (ring->next != ring->cur) {
+		KASSERTMSG(ring->queued > 0, "%s: cur=%d next=%d queued=%d",
+		device_xname(sc->sc_dev),
+		ring->cur, ring->next, ring->queued);
 		cmd = >cmd[ring->next];
 		mutex_spin_exit(>sc_task_mtx);
 		splx(s);
@@ -873,6 +895,10 @@ urtwn_task(void *arg)
 		cmd->cb(sc, cmd->data);
 		s = splusb();
 		mutex_spin_enter(>sc_task_mtx);
+		urtwn_cmdq_invariants(sc);
+		KASSERTMSG(ring->queued > 0, "%s: cur=%d next=%d queued=%d",
+		device_xname(sc->sc_dev),
+		ring->cur, ring->next, ring->queued);
 		ring->queued--;
 		ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
 	}
@@ -887,6 +913,7 @@ urtwn_do_async(struct urtwn_softc *sc, v
 {
 	struct urtwn_host_cmd_ring *ring = >cmdq;
 	struct urtwn_host_cmd *cmd;
+	bool schedtask = false;
 	int s;
 
 	DPRINTFN(DBG_FN, ("%s: %s: cb=%p, arg=%p, len=%d\n",
@@ -894,19 +921,27 @@ urtwn_do_async(struct urtwn_softc *sc, v
 
 	s = splusb();
 	mutex_spin_enter(>sc_task_mtx);
+	urtwn_cmdq_invariants(sc);
 	cmd = >cmd[ring->cur];
 	cmd->cb = cb;
 	KASSERT(len <= sizeof(cmd->data));
 	memcpy(cmd->data, arg, len);
 	ring->cur = (ring->cur + 1) % URTWN_HOST_CMD_RING_COUNT;
 
-	/* If there is no pending command already, schedule a task. */
-	if (!sc->sc_dying && ++ring->queued == 1) {
-		mutex_spin_exit(>sc_task_mtx);
-		usb_add_task(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
-	} else
-		mutex_spin_exit(>sc_task_mtx);
+	/*
+	 * Schedule a task to process the command if need be.
+	 */
+	if (!sc->sc_dying) {
+		if (ring->queued == URTWN_HOST_CMD_RING_COUNT)
+			device_printf(sc->sc_dev, "command queue overflow\n");
+		else if (ring->queued++ == 0)
+			schedtask = true;
+	}
+	mutex_spin_exit(>sc_task_mtx);
 	splx(s);
+
+	if (schedtask)
+		usb_add_task(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
 }
 
 static void



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

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 18:59:19 UTC 2024

Modified Files:
src/sys/dev/usb [netbsd-9]: if_urtwn.c

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

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.6 -r1.71.2.7 src/sys/dev/usb/if_urtwn.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/netinet6

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 18:54:41 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-9]: icmp6.c raw_ip6.c

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

sys/netinet6/raw_ip6.c: revision 1.184 (patch)
sys/netinet6/icmp6.c: revision 1.256 (patch)

Deliver timestamps also to raw sockets.
Fixes PR 57955


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.242.4.1 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.175.4.1 -r1.175.4.2 src/sys/netinet6/raw_ip6.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/netinet6

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 18:54:41 UTC 2024

Modified Files:
src/sys/netinet6 [netbsd-9]: icmp6.c raw_ip6.c

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

sys/netinet6/raw_ip6.c: revision 1.184 (patch)
sys/netinet6/icmp6.c: revision 1.256 (patch)

Deliver timestamps also to raw sockets.
Fixes PR 57955


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.242.4.1 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.175.4.1 -r1.175.4.2 src/sys/netinet6/raw_ip6.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.242 src/sys/netinet6/icmp6.c:1.242.4.1
--- src/sys/netinet6/icmp6.c:1.242	Sat Dec 22 14:07:54 2018
+++ src/sys/netinet6/icmp6.c	Sun Mar 10 18:54:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.242 2018/12/22 14:07:54 maxv Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.242.4.1 2024/03/10 18:54:41 martin Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.242 2018/12/22 14:07:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.242.4.1 2024/03/10 18:54:41 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1965,7 +1965,8 @@ icmp6_rip6_input(struct mbuf **mp, int o
 		}
 #endif
 		else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
-			if (last->in6p_flags & IN6P_CONTROLOPTS)
+			if (last->in6p_flags & IN6P_CONTROLOPTS ||
+			SOOPT_TIMESTAMP(last->in6p_socket->so_options))
 ip6_savecontrol(last, , ip6, n);
 			/* strip intermediate headers */
 			m_adj(n, off);
@@ -1992,7 +1993,8 @@ icmp6_rip6_input(struct mbuf **mp, int o
 	} else
 #endif
 	if (last) {
-		if (last->in6p_flags & IN6P_CONTROLOPTS)
+		if (last->in6p_flags & IN6P_CONTROLOPTS ||
+		SOOPT_TIMESTAMP(last->in6p_socket->so_options))
 			ip6_savecontrol(last, , ip6, m);
 		/* strip intermediate headers */
 		m_adj(m, off);

Index: src/sys/netinet6/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.175.4.1 src/sys/netinet6/raw_ip6.c:1.175.4.2
--- src/sys/netinet6/raw_ip6.c:1.175.4.1	Thu Mar 23 12:06:49 2023
+++ src/sys/netinet6/raw_ip6.c	Sun Mar 10 18:54:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip6.c,v 1.175.4.1 2023/03/23 12:06:49 martin Exp $	*/
+/*	$NetBSD: raw_ip6.c,v 1.175.4.2 2024/03/10 18:54:41 martin Exp $	*/
 /*	$KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.175.4.1 2023/03/23 12:06:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.175.4.2 2024/03/10 18:54:41 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -140,7 +140,8 @@ rip6_sbappendaddr(struct in6pcb *last, s
 {
 	struct mbuf *opts = NULL;
 
-	if (last->in6p_flags & IN6P_CONTROLOPTS)
+	if (last->in6p_flags & IN6P_CONTROLOPTS ||
+	SOOPT_TIMESTAMP(last->in6p_socket->so_options))
 		ip6_savecontrol(last, , ip6, n);
 
 	m_adj(n, hlen);



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

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:45:40 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c if_wmreg.h

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

sys/dev/pci/if_wm.c 1.794-1.798 via patch
sys/dev/pci/if_wmreg.h  1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue
  system.
- Improve dmesg output:
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.20 -r1.645.2.21 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.8 -r1.115.2.9 src/sys/dev/pci/if_wmreg.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/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:45:40 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c if_wmreg.h

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

sys/dev/pci/if_wm.c 1.794-1.798 via patch
sys/dev/pci/if_wmreg.h  1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue
  system.
- Improve dmesg output:
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.20 -r1.645.2.21 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.8 -r1.115.2.9 src/sys/dev/pci/if_wmreg.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.20 src/sys/dev/pci/if_wm.c:1.645.2.21
--- src/sys/dev/pci/if_wm.c:1.645.2.20	Sat Feb  3 12:02:58 2024
+++ src/sys/dev/pci/if_wm.c	Fri Feb 23 19:45:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.20 2024/02/03 12:02:58 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.21 2024/02/23 19:45:40 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.20 2024/02/03 12:02:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.21 2024/02/23 19:45:40 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -472,9 +472,9 @@ struct wm_rxqueue {
 	/* RX event counters */
 	WM_Q_EVCNT_DEFINE(rxq, intr);	/* Interrupts */
 	WM_Q_EVCNT_DEFINE(rxq, defer);	/* Rx deferred processing */
-
 	WM_Q_EVCNT_DEFINE(rxq, ipsum);	/* IP checksums checked */
 	WM_Q_EVCNT_DEFINE(rxq, tusum);	/* TCP/UDP cksums checked */
+	WM_Q_EVCNT_DEFINE(rxq, qdrop);	/* Rx queue drop packet */
 #endif
 };
 
@@ -2722,6 +2722,10 @@ alloc_retry:
 	/* Reset the chip to a known state. */
 	wm_reset(sc);
 
+	/* sc->sc_pba is set in wm_reset(). */
+	aprint_verbose_dev(sc->sc_dev, "RX packet buffer size: %uKB\n",
+	sc->sc_pba);
+
 	/*
 	 * Check for I21[01] PLL workaround.
 	 *
@@ -6618,6 +6622,7 @@ wm_update_stats(struct wm_softc *sc)
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	uint64_t crcerrs, algnerrc, symerrc, mpc, colc,  sec, rlec, rxerrc,
 	cexterr;
+	uint64_t total_qdrop = 0;
 
 	crcerrs = CSR_READ(sc, WMREG_CRCERRS);
 	symerrc = CSR_READ(sc, WMREG_SYMERRC);
@@ -6766,6 +6771,22 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(>sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(>sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(>sc_ev_hrmpc, CSR_READ(sc, WMREG_HRMPC));
+#ifdef WM_EVENT_COUNTERS
+		for (int i = 0; i < sc->sc_nqueues; i++) {
+			struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
+			uint32_t rqdpc;
+
+			rqdpc = CSR_READ(sc, WMREG_RQDPC(i));
+			/*
+			 * On I210 and newer device, the RQDPC register is not
+			 * cleard on read.
+			 */
+			if ((rqdpc != 0) && (sc->sc_type >= WM_T_I210))
+CSR_WRITE(sc, WMREG_RQDPC(i), 0);
+			WM_Q_EVCNT_ADD(rxq, qdrop, rqdpc);
+			total_qdrop += rqdpc;
+		}
+#endif
 	}
 	if ((sc->sc_type >= WM_T_I350) && !WM_IS_ICHPCH(sc)) {
 		WM_EVCNT_ADD(>sc_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));
@@ -6794,7 +6815,7 @@ wm_update_stats(struct wm_softc *sc)
 	 * If you want to know the nubmer of WMREG_RMBC, you should use such as
 	 * own EVCNT instead of if_iqdrops.
 	 */
-	ifp->if_iqdrops += mpc;
+	ifp->if_iqdrops += mpc + total_qdrop;
 }
 
 void
@@ -6811,6 +6832,8 @@ wm_clear_evcnt(struct wm_softc *sc)
 		WM_Q_EVCNT_STORE(rxq, defer, 0);
 		WM_Q_EVCNT_STORE(rxq, ipsum, 0);
 		WM_Q_EVCNT_STORE(rxq, tusum, 0);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_STORE(rxq, qdrop, 0);
 	}
 
 	/* TX queues */
@@ -8147,9 +8170,10 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 
 		WM_Q_INTR_EVCNT_ATTACH(rxq, intr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, defer, rxq, i, xname);
-
 		WM_Q_MISC_EVCNT_ATTACH(rxq, ipsum, rxq, i, xname);
 		WM_Q_MISC_EVCNT_ATTACH(rxq, tusum, rxq, i, xname);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_MISC_EVCNT_ATTACH(rxq, qdrop, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;
@@ -8212,6 +8236,8 @@ wm_free_txrx_queues(struct wm_softc *sc)
 		WM_Q_EVCNT_DETACH(rxq, defer, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, ipsum, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, tusum, rxq, i);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_DETACH(rxq, qdrop, rxq, i);
 #endif /* WM_EVENT_COUNTERS */
 
 		wm_free_rx_buffer(sc, rxq);
@@ -8401,6 +8427,8 @@ wm_init_rx_regs(struct wm_softc *sc, str
 		rxq->rxq_descsize * rxq->rxq_ndesc);
 
 		if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
+			uint32_t srrctl;
+
 			if (MCLBYTES & ((1 << SRRCTL_BSIZEPKT_SHIFT) - 1))
 panic("%s: MCLBYTES %d unsupported for 82575 "
 "or 

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

2024-02-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 19 09:02:17 UTC 2024

Modified Files:
src/sys/arch/vax/vsa [netbsd-9]: ncr.c vsbus.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1800):

sys/arch/vax/vsa/vsbus.c: revision 1.69 (patch)
sys/arch/vax/vsa/ncr.c: revision 1.52

Fix SCSI tranfer corruption on VAXstation 3100/m30 (KA420) on netboot.

See my post on port-vax@ for details:
 https://mail-index.netbsd.org/port-vax/2024/02/16/msg004866.html
and "go ahead!" from ragge@.


To generate a diff of this commit:
cvs rdiff -u -r1.49.4.1 -r1.49.4.2 src/sys/arch/vax/vsa/ncr.c
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/arch/vax/vsa/vsbus.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/vax/vsa/ncr.c
diff -u src/sys/arch/vax/vsa/ncr.c:1.49.4.1 src/sys/arch/vax/vsa/ncr.c:1.49.4.2
--- src/sys/arch/vax/vsa/ncr.c:1.49.4.1	Mon Mar 23 10:06:26 2020
+++ src/sys/arch/vax/vsa/ncr.c	Mon Feb 19 09:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $	*/
+/*	$NetBSD: ncr.c,v 1.49.4.2 2024/02/19 09:02:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.2 2024/02/19 09:02:16 martin Exp $");
 
 #include 
 #include 
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49
 #include 
 #include 
 #include 
+#include 
 
 #include "ioconf.h"
 
@@ -209,6 +210,16 @@ si_vsbus_attach(device_t parent, device_
 	else
 		target = (clk_page[0xbc/2] >> tweak) & 7;
 
+	/*
+	 * Explicitly enable upto 128KB "Big DMA" on KA420.
+	 * (It looks KA420 firmware doesn't enable it on network boot)
+	 */
+#define STC_MODE_OFF	(KA420_STC_MODE - KA420_SCS_BASE)
+	if (vax_boardtype == VAX_BTYP_420) {
+		bus_space_write_1(ncr_sc->sc_regt, ncr_sc->sc_regh,
+		STC_MODE_OFF, 1);
+	}
+
 	aprint_normal("\n");
 	aprint_normal_dev(self, "NCR5380, SCSI ID %d\n", target);
 

Index: src/sys/arch/vax/vsa/vsbus.c
diff -u src/sys/arch/vax/vsa/vsbus.c:1.65 src/sys/arch/vax/vsa/vsbus.c:1.65.4.1
--- src/sys/arch/vax/vsa/vsbus.c:1.65	Mon Sep  3 16:29:28 2018
+++ src/sys/arch/vax/vsa/vsbus.c	Mon Feb 19 09:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsbus.c,v 1.65 2018/09/03 16:29:28 riastradh Exp $ */
+/*	$NetBSD: vsbus.c,v 1.65.4.1 2024/02/19 09:02:16 martin Exp $ */
 /*
  * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.65 2018/09/03 16:29:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.65.4.1 2024/02/19 09:02:16 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -146,7 +146,6 @@ vsbus_attach(device_t parent, device_t s
 		} else {
 			dbase = KA420_DMA_BASE;
 			dsize = KA420_DMA_SIZE;
-			*(char *)(sc->sc_vsregs + 0xe0) = 1; /* Big DMA */
 		}
 		sc->sc_dmasize = dsize;
 		sc->sc_dmaaddr = uvm_km_alloc(kernel_map, dsize, 0,



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

2024-02-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 19 09:02:17 UTC 2024

Modified Files:
src/sys/arch/vax/vsa [netbsd-9]: ncr.c vsbus.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1800):

sys/arch/vax/vsa/vsbus.c: revision 1.69 (patch)
sys/arch/vax/vsa/ncr.c: revision 1.52

Fix SCSI tranfer corruption on VAXstation 3100/m30 (KA420) on netboot.

See my post on port-vax@ for details:
 https://mail-index.netbsd.org/port-vax/2024/02/16/msg004866.html
and "go ahead!" from ragge@.


To generate a diff of this commit:
cvs rdiff -u -r1.49.4.1 -r1.49.4.2 src/sys/arch/vax/vsa/ncr.c
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/arch/vax/vsa/vsbus.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/dev/tc

2024-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 18 16:30:20 UTC 2024

Modified Files:
src/sys/dev/tc [netbsd-9]: zskbd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1799):

sys/dev/tc/zskbd.c: revision 1.22

Fix another fatal typo that causes zskbd_cngetc() to stall as dzkbd.
Tested on my DEC 3000/300 and LK421.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.24.1 src/sys/dev/tc/zskbd.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/dev/tc

2024-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 18 16:30:20 UTC 2024

Modified Files:
src/sys/dev/tc [netbsd-9]: zskbd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1799):

sys/dev/tc/zskbd.c: revision 1.22

Fix another fatal typo that causes zskbd_cngetc() to stall as dzkbd.
Tested on my DEC 3000/300 and LK421.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.24.1 src/sys/dev/tc/zskbd.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/tc/zskbd.c
diff -u src/sys/dev/tc/zskbd.c:1.18 src/sys/dev/tc/zskbd.c:1.18.24.1
--- src/sys/dev/tc/zskbd.c:1.18	Fri Jan  2 21:32:26 2015
+++ src/sys/dev/tc/zskbd.c	Sun Feb 18 16:30:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: zskbd.c,v 1.18 2015/01/02 21:32:26 jklos Exp $	*/
+/*	$NetBSD: zskbd.c,v 1.18.24.1 2024/02/18 16:30:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zskbd.c,v 1.18 2015/01/02 21:32:26 jklos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zskbd.c,v 1.18.24.1 2024/02/18 16:30:20 martin Exp $");
 
 #include 
 #include 
@@ -281,7 +281,7 @@ zskbd_cngetc(void *v, u_int *type, int *
 
 	do {
 		c = zs_getc(zsi->zsi_cs);
-	} while (!lk201_decode(>zsi_ks, 0, c, type, data) == LKD_NODATA);
+	} while (lk201_decode(>zsi_ks, 0, c, type, data) == LKD_NODATA);
 }
 
 static void



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

2024-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 17 16:19:14 UTC 2024

Modified Files:
src/sys/dev/dec [netbsd-9]: dzkbd.c lk201_ws.c lk201var.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1798):

sys/dev/dec/dzkbd.c: revision 1.32
sys/dev/dec/lk201var.h: revision 1.8
sys/dev/dec/lk201_ws.c: revision 1.11

Fix a fatal typo that causes dzkbd_cngetc() to stall.

Use proper macro for return values and remove #if 0'ed out block.
Mostly from OpenBSD/vax. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.24.1 src/sys/dev/dec/dzkbd.c
cvs rdiff -u -r1.10 -r1.10.24.1 src/sys/dev/dec/lk201_ws.c
cvs rdiff -u -r1.7 -r1.7.24.1 src/sys/dev/dec/lk201var.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/dec/dzkbd.c
diff -u src/sys/dev/dec/dzkbd.c:1.27 src/sys/dev/dec/dzkbd.c:1.27.24.1
--- src/sys/dev/dec/dzkbd.c:1.27	Fri Jan  2 21:32:26 2015
+++ src/sys/dev/dec/dzkbd.c	Sat Feb 17 16:19:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dzkbd.c,v 1.27 2015/01/02 21:32:26 jklos Exp $	*/
+/*	$NetBSD: dzkbd.c,v 1.27.24.1 2024/02/17 16:19:14 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.27 2015/01/02 21:32:26 jklos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.27.24.1 2024/02/17 16:19:14 martin Exp $");
 
 #include 
 #include 
@@ -237,7 +237,7 @@ dzkbd_cngetc(void *v, u_int *type, int *
 
 	do {
 		c = dzgetc(dzi->dzi_ls);
-	} while (!lk201_decode(>dzi_ks, 0, c, type, data) == LKD_NODATA);
+	} while (lk201_decode(>dzi_ks, 0, c, type, data) == LKD_NODATA);
 }
 
 static void

Index: src/sys/dev/dec/lk201_ws.c
diff -u src/sys/dev/dec/lk201_ws.c:1.10 src/sys/dev/dec/lk201_ws.c:1.10.24.1
--- src/sys/dev/dec/lk201_ws.c:1.10	Mon Jul 11 10:55:35 2016
+++ src/sys/dev/dec/lk201_ws.c	Sat Feb 17 16:19:14 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lk201_ws.c,v 1.10 2016/07/11 10:55:35 skrll Exp $ */
+/* $NetBSD: lk201_ws.c,v 1.10.24.1 2024/02/17 16:19:14 martin Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lk201_ws.c,v 1.10 2016/07/11 10:55:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lk201_ws.c,v 1.10.24.1 2024/02/17 16:19:14 martin Exp $");
 
 #include 
 #include 
@@ -133,17 +133,10 @@ lk201_decode(struct lk201_state *lks, in
 	}
 
 	switch (datain) {
-#if 0
-	case LK_KEY_UP:
-		for (i = 0; i < LK_KLL; i++)
-			lks->down_keys_list[i] = -1;
-		*type = WSCONS_EVENT_ALL_KEYS_UP;
-		return (1);
-#endif
 	case LK_POWER_UP:
 		printf("lk201_decode: powerup detected\n");
 		lk201_init(lks);
-		return (0);
+		return LKD_NODATA;
 	case LK_KDOWN_ERROR:
 	case LK_POWER_ERROR:
 	case LK_OUTPUT_ERROR:
@@ -152,7 +145,7 @@ lk201_decode(struct lk201_state *lks, in
 		/* FALLTHRU */
 	case LK_KEY_REPEAT: /* autorepeat handled by wskbd */
 	case LK_MODE_CHANGE: /* ignore silently */
-		return (0);
+		return LKD_NODATA;
 	}
 
 
@@ -164,18 +157,18 @@ lk201_decode(struct lk201_state *lks, in
 	*dataout = lks->down_keys_list[i] -
 	MIN_LK201_KEY;
 	lks->down_keys_list[i] = -1;
-	return (LKD_MORE);
+	return LKD_MORE;
 }
-			return (LKD_NODATA);
+			return LKD_NODATA;
 		} else {
 			for (i = 0; i < LK_KLL; i++)
 lks->down_keys_list[i] = -1;
 			*type = WSCONS_EVENT_ALL_KEYS_UP;
-			return (LKD_COMPLETE);
+			return LKD_COMPLETE;
 		}
 	} else if (datain < MIN_LK201_KEY || datain > MAX_LK201_KEY) {
 		printf("lk201_decode: %x\n", datain);
-		return (0);
+		return LKD_NODATA;
 	}
 
 	*dataout = datain - MIN_LK201_KEY;
@@ -185,7 +178,7 @@ lk201_decode(struct lk201_state *lks, in
 		if (lks->down_keys_list[i] == datain) {
 			*type = WSCONS_EVENT_KEY_UP;
 			lks->down_keys_list[i] = -1;
-			return (1);
+			return LKD_COMPLETE;
 		}
 		if (lks->down_keys_list[i] == -1 && freeslot == -1)
 			freeslot = i;
@@ -193,12 +186,12 @@ lk201_decode(struct lk201_state *lks, in
 
 	if (freeslot == -1) {
 		printf("lk201_decode: down(%d) no free slot\n", datain);
-		return (0);
+		return LKD_NODATA;
 	}
 
 	*type = WSCONS_EVENT_KEY_DOWN;
 	lks->down_keys_list[freeslot] = datain;
-	return (1);
+	return LKD_COMPLETE;
 }
 
 void

Index: src/sys/dev/dec/lk201var.h
diff -u src/sys/dev/dec/lk201var.h:1.7 src/sys/dev/dec/lk201var.h:1.7.24.1
--- src/sys/dev/dec/lk201var.h:1.7	Fri Jan  2 21:32:26 2015
+++ src/sys/dev/dec/lk201var.h	Sat Feb 17 16:19:14 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lk201var.h,v 1.7 2015/01/02 21:32:26 jklos Exp $ */
+/* $NetBSD: lk201var.h,v 1.7.24.1 2024/02/17 16:19:14 martin Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -54,7 +54,7 @@ void lk201_bell(struct lk201_state *, st
 void lk201_set_leds(struct lk201_state *, int);
 void lk201_set_keyclick(struct lk201_state *, int);
 
+/* Values returned by lk201_decode */
 #define LKD_NODATA	0x00
 #define LKD_COMPLETE	0x01
 #define 

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

2024-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 17 16:19:14 UTC 2024

Modified Files:
src/sys/dev/dec [netbsd-9]: dzkbd.c lk201_ws.c lk201var.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1798):

sys/dev/dec/dzkbd.c: revision 1.32
sys/dev/dec/lk201var.h: revision 1.8
sys/dev/dec/lk201_ws.c: revision 1.11

Fix a fatal typo that causes dzkbd_cngetc() to stall.

Use proper macro for return values and remove #if 0'ed out block.
Mostly from OpenBSD/vax. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.24.1 src/sys/dev/dec/dzkbd.c
cvs rdiff -u -r1.10 -r1.10.24.1 src/sys/dev/dec/lk201_ws.c
cvs rdiff -u -r1.7 -r1.7.24.1 src/sys/dev/dec/lk201var.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/dev/hdaudio

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 14:24:38 UTC 2024

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdafg.c

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

sys/dev/hdaudio/hdafg.c: revision 1.29

ignore NULL for hdaudio_audiodev in hdafg_freem

also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/sys/dev/hdaudio/hdafg.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/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.18.2.1 src/sys/dev/hdaudio/hdafg.c:1.18.2.2
--- src/sys/dev/hdaudio/hdafg.c:1.18.2.1	Sat Apr 25 10:40:45 2020
+++ src/sys/dev/hdaudio/hdafg.c	Sat Feb  3 14:24:38 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.18.2.1 2020/04/25 10:40:45 martin Exp $ */
+/* $NetBSD: hdafg.c,v 1.18.2.2 2024/02/03 14:24:38 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18.2.1 2020/04/25 10:40:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18.2.2 2024/02/03 14:24:38 martin Exp $");
 
 #include 
 #include 
@@ -4223,9 +4223,12 @@ hdafg_freem(void *opaque, void *addr, si
 	struct hdaudio_audiodev *ad = opaque;
 	struct hdaudio_stream *st;
 
-	if (addr == DMA_KERNADDR(>ad_playback->st_data))
+	if (ad == NULL)
+		return;
+
+	if (ad->ad_playback != NULL && addr == DMA_KERNADDR(>ad_playback->st_data))
 		st = ad->ad_playback;
-	else if (addr == DMA_KERNADDR(>ad_capture->st_data))
+	else if (ad->ad_capture != NULL && addr == DMA_KERNADDR(>ad_capture->st_data))
 		st = ad->ad_capture;
 	else
 		return;



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 14:24:38 UTC 2024

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdafg.c

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

sys/dev/hdaudio/hdafg.c: revision 1.29

ignore NULL for hdaudio_audiodev in hdafg_freem

also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/sys/dev/hdaudio/hdafg.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/dev/sdmmc

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:41:30 UTC 2024

Modified Files:
src/sys/dev/sdmmc [netbsd-9]: ld_sdmmc.c

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

sys/dev/sdmmc/ld_sdmmc.c: revision 1.43

ld@sdmmc(4): Hack around deadlock in cache sync on detach.

Yanking a card triggers the sdmmc discovery task, which runs in the
sdmmc task thread, to detach any attached child devices.

Detaching ld@sdmmc triggers a cache flush (via ldbegindetach ->
disk_begindetach -> ld_lastclose -> ld_flush -> ioctl DIOCCACHESYNC),
which is implemented by scheduling a task to do sdmmc_mem_flush_cache
and then waiting for it to complete.

The sdmmc_mem_cache_flush is done by an sdmmc task so it happens
after all previously scheduled I/O operations -- that way the cache
flush doesn't complete until the previously scheduled I/O operations
are complete.

However, when the cache flush task is issued from the discovery task,
this doesn't work, because the cache flush task can't start until the
discovery task has returned -- but the discovery task won't return
until the cache flush task has completed.

To work around this deadlock, which usually happens only when the
device has been yanked anyway so further I/O would be lost anyway,
just do the cache flush synchronously in DIOCCACHESYNC if we're
running in the task thread.

This isn't quite right -- implementation details of the task thread
shouldn't bleed into ld@sdmmc, and running the cache sync _before_
any subsequently scheduled I/O tasks is asking for trouble -- but it
should serve to avoid the deadlock in PR kern/57870 until we can fix
a host of concurrency bugs in sdmmc by fixing the locking scheme and
running discovery in a separate thread from tasks.


To generate a diff of this commit:
cvs rdiff -u -r1.36.4.1 -r1.36.4.2 src/sys/dev/sdmmc/ld_sdmmc.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/dev/sdmmc

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:41:30 UTC 2024

Modified Files:
src/sys/dev/sdmmc [netbsd-9]: ld_sdmmc.c

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

sys/dev/sdmmc/ld_sdmmc.c: revision 1.43

ld@sdmmc(4): Hack around deadlock in cache sync on detach.

Yanking a card triggers the sdmmc discovery task, which runs in the
sdmmc task thread, to detach any attached child devices.

Detaching ld@sdmmc triggers a cache flush (via ldbegindetach ->
disk_begindetach -> ld_lastclose -> ld_flush -> ioctl DIOCCACHESYNC),
which is implemented by scheduling a task to do sdmmc_mem_flush_cache
and then waiting for it to complete.

The sdmmc_mem_cache_flush is done by an sdmmc task so it happens
after all previously scheduled I/O operations -- that way the cache
flush doesn't complete until the previously scheduled I/O operations
are complete.

However, when the cache flush task is issued from the discovery task,
this doesn't work, because the cache flush task can't start until the
discovery task has returned -- but the discovery task won't return
until the cache flush task has completed.

To work around this deadlock, which usually happens only when the
device has been yanked anyway so further I/O would be lost anyway,
just do the cache flush synchronously in DIOCCACHESYNC if we're
running in the task thread.

This isn't quite right -- implementation details of the task thread
shouldn't bleed into ld@sdmmc, and running the cache sync _before_
any subsequently scheduled I/O tasks is asking for trouble -- but it
should serve to avoid the deadlock in PR kern/57870 until we can fix
a host of concurrency bugs in sdmmc by fixing the locking scheme and
running discovery in a separate thread from tasks.


To generate a diff of this commit:
cvs rdiff -u -r1.36.4.1 -r1.36.4.2 src/sys/dev/sdmmc/ld_sdmmc.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/sdmmc/ld_sdmmc.c
diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.36.4.1 src/sys/dev/sdmmc/ld_sdmmc.c:1.36.4.2
--- src/sys/dev/sdmmc/ld_sdmmc.c:1.36.4.1	Sun Aug  9 14:03:07 2020
+++ src/sys/dev/sdmmc/ld_sdmmc.c	Sat Feb  3 12:41:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_sdmmc.c,v 1.36.4.1 2020/08/09 14:03:07 martin Exp $	*/
+/*	$NetBSD: ld_sdmmc.c,v 1.36.4.2 2024/02/03 12:41:29 martin Exp $	*/
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.36.4.1 2020/08/09 14:03:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.36.4.2 2024/02/03 12:41:29 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -589,9 +589,24 @@ static int
 ld_sdmmc_cachesync(struct ld_softc *ld, bool poll)
 {
 	struct ld_sdmmc_softc *sc = device_private(ld->sc_dv);
+	struct sdmmc_softc *sdmmc = device_private(device_parent(ld->sc_dv));
 	struct ld_sdmmc_task *task;
 	int error = -1;
 
+	/*
+	 * If we come here through the sdmmc discovery task, we can't
+	 * wait for a new task because the new task can't even begin
+	 * until the sdmmc discovery task has completed.
+	 *
+	 * XXX This is wrong, because there may already be queued I/O
+	 * tasks ahead of us.  Fixing this properly requires doing
+	 * discovery in a separate thread.  But this should avoid the
+	 * deadlock of PR kern/57870 (https://gnats.NetBSD.org/57870)
+	 * until we do split that up.
+	 */
+	if (curlwp == sdmmc->sc_tskq_lwp)
+		return sdmmc_mem_flush_cache(sc->sc_sf, poll);
+
 	mutex_enter(>sc_lock);
 
 	/* Acquire a free task, or fail with EBUSY.  */



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:13:33 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.345-1.346,1.349 via 
patch
sys/dev/pci/ixgbe/ixgbe.h   1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h  1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
  - Move assignment of TXD.
  - ixv(4): Remove unused IFF_OACTIVE.
  - Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
  - The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
  - Use #ifdef LRO more to reduce the size of struct rx_ring.
  - Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
  - Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
  - Remove unused.
  - Modify for the readability.
  - Modify comment.
  - Fix comment. Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.14 -r1.54.2.15 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.29 -r1.199.2.30 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.12 -r1.56.2.13 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.41.2.11 -r1.41.2.12 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.125.2.24 -r1.125.2.25 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.14 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.15
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.14	Wed Oct 18 14:05:27 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Feb  3 12:13:32 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.14 2023/10/18 14:05:27 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.15 2024/02/03 12:13:32 martin Exp $ */
 
 /**
 
@@ -64,13 +64,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.14 2023/10/18 14:05:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.15 2024/02/03 12:13:32 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include "ixgbe.h"
 
+#ifdef RSC
 /*
  * HW RSC control:
  *  this feature only works with
@@ -84,7 +85,9 @@ __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 
  *  to enable.
  */
 static bool ixgbe_rsc_enable = FALSE;
+#endif
 
+#ifdef IXGBE_FDIR
 /*
  * For Flow Director: this is the
  * number of TX packets we sample
@@ -95,6 +98,7 @@ static bool ixgbe_rsc_enable = FALSE;
  * setting this to 0.
  */
 static int atr_sample_rate = 20;
+#endif
 
 #define IXGBE_M_ADJ(sc, rxr, mp)	\
 	if (sc->max_frame_size <= (rxr->mbuf_sz - ETHER_ALIGN))	\
@@ -122,8 +126,9 @@ static __inline void ixgbe_rx_input(stru
 static int   ixgbe_dma_malloc(struct ixgbe_softc *, bus_size_t,
   struct ixgbe_dma_alloc *, int);
 static void  ixgbe_dma_free(struct ixgbe_softc *, struct ixgbe_dma_alloc *);
-
-static void	ixgbe_setup_hw_rsc(struct rx_ring *);
+#ifdef RSC
+static void	 ixgbe_setup_hw_rsc(struct rx_ring *);
+#endif
 
 /
  * ixgbe_legacy_start_locked - Transmit entry point
@@ -406,7 +411,7 @@ ixgbe_drain_all(struct ixgbe_softc *sc)
 static int
 ixgbe_xmit(struct tx_ring *txr, struct mbuf *m_head)
 {
-	struct ixgbe_softc  *sc = txr->sc;
+	struct ixgbe_softc  *sc = txr->sc;
 	struct ixgbe_tx_buf *txbuf;
 	union ixgbe_adv_tx_desc *txd = NULL;
 	struct ifnet	*ifp = sc->ifp;
@@ -487,8 +492,8 @@ retry:
 	}
 
 	/*
-	 * Set up the appropriate offload context
-	 * this will consume the first descriptor
+	 * Set up the appropriate offload context if requested,
+	 * this may consume one TX descriptor.
 	 */
 	error = ixgbe_tx_ctx_setup(txr, m_head, _type_len, _status);
 	if (__predict_false(error)) {
@@ -625,14 +630,8 @@ ixgbe_allocate_transmit_buffers(struct t
 		goto fail;
 	}
 
-	txr->tx_buffers =
-	(struct ixgbe_tx_buf *) malloc(sizeof(struct ixgbe_tx_buf) *
-	sc->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (txr->tx_buffers == NULL) {
-		aprint_error_dev(dev, 

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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:13:33 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.345-1.346,1.349 via 
patch
sys/dev/pci/ixgbe/ixgbe.h   1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h  1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
  - Move assignment of TXD.
  - ixv(4): Remove unused IFF_OACTIVE.
  - Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
  - The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
  - Use #ifdef LRO more to reduce the size of struct rx_ring.
  - Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
  - Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
  - Remove unused.
  - Modify for the readability.
  - Modify comment.
  - Fix comment. Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.14 -r1.54.2.15 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.29 -r1.199.2.30 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.12 -r1.56.2.13 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.41.2.11 -r1.41.2.12 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.125.2.24 -r1.125.2.25 src/sys/dev/pci/ixgbe/ixv.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/dev/pci

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:02:58 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c

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

sys/dev/pci/if_wm.c: revision 1.793

Add Intel I219-{LM,V}(20,21) support.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.19 src/sys/dev/pci/if_wm.c:1.645.2.20
--- src/sys/dev/pci/if_wm.c:1.645.2.19	Wed Oct 18 14:29:18 2023
+++ src/sys/dev/pci/if_wm.c	Sat Feb  3 12:02:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.19 2023/10/18 14:29:18 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.20 2024/02/03 12:02:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.19 2023/10/18 14:29:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.20 2024/02/03 12:02:58 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1761,6 +1761,12 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM19,
 	  "I219 LM (19) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM20,
+	  "I219 LM (20) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM21,
+	  "I219 LM (21) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM22,
 	  "I219 LM (22) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
@@ -1821,6 +1827,12 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V19,
 	  "I219 V (19) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V20,
+	  "I219 V (20) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V21,
+	  "I219 V (21) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V22,
 	  "I219 V (22) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:02:58 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c

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

sys/dev/pci/if_wm.c: revision 1.793

Add Intel I219-{LM,V}(20,21) support.


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

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



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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:26:39 UTC 2024

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

Log Message:
regen (ticket #1790)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.21 -r1.1371.2.22 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.21 -r1.1370.2.22 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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:26:39 UTC 2024

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

Log Message:
regen (ticket #1790)


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.21 -r1.1371.2.22 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.21 -r1.1370.2.22 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/dev/pci

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:24:19 UTC 2024

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

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

sys/dev/pci/pcidevs: revision 1.1494
sys/dev/pci/pcidevs: revision 1.1498
sys/dev/pci/pcidevs: revision 1.1499
sys/dev/pci/pcidevs: revision 1.1500
sys/dev/pci/pcidevs: revision 1.1501
sys/dev/pci/pcidevs: revision 1.1502

pcidevs: Add missing I225/I226 series devices
pcidevs: Add Mellanox ConnectX-6 Lx.
add some newer Areca boards in prep for updating driver
Add Intel C26[26] eSPI.
Update Intel Raptor Lake devices.
Add Intel I219-{LM,V}(20,21)


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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 11:24:19 UTC 2024

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

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

sys/dev/pci/pcidevs: revision 1.1494
sys/dev/pci/pcidevs: revision 1.1498
sys/dev/pci/pcidevs: revision 1.1499
sys/dev/pci/pcidevs: revision 1.1500
sys/dev/pci/pcidevs: revision 1.1501
sys/dev/pci/pcidevs: revision 1.1502

pcidevs: Add missing I225/I226 series devices
pcidevs: Add Mellanox ConnectX-6 Lx.
add some newer Areca boards in prep for updating driver
Add Intel C26[26] eSPI.
Update Intel Raptor Lake devices.
Add Intel I219-{LM,V}(20,21)


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.21 -r1.1383.2.22 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.1383.2.21 src/sys/dev/pci/pcidevs:1.1383.2.22
--- src/sys/dev/pci/pcidevs:1.1383.2.21	Wed Oct 18 14:29:18 2023
+++ src/sys/dev/pci/pcidevs	Sat Feb  3 11:24:19 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.21 2023/10/18 14:29:18 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.22 2024/02/03 11:24:19 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1488,6 +1488,7 @@ product ARECA ARC1170		0x1170	ARC-1170
 product ARECA ARC1200		0x1200	ARC-1200
 product ARECA ARC1200_B		0x1201	ARC-1200 rev B
 product ARECA ARC1202		0x1202	ARC-1202
+product ARECA ARC1203		0x1203	ARC-1203
 product ARECA ARC1210		0x1210	ARC-1210
 product ARECA ARC1214 		0x1214	ARC-1214
 product ARECA ARC1220		0x1220	ARC-1220
@@ -1500,6 +1501,8 @@ product ARECA ARC1381		0x1381	ARC-1381
 product ARECA ARC1680		0x1680	ARC-1680
 product ARECA ARC1681		0x1681	ARC-1681
 product ARECA ARC1880 		0x1880	ARC-1880
+product ARECA ARC1884 		0x1884	ARC-1884
+product ARECA ARC1886 		0x1886	ARC-1886
 
 /* ASIX Electronics products */
 product ASIX AX88140A	0x1400	AX88140A 10/100 Ethernet
@@ -3934,6 +3937,7 @@ product INTEL I219_LM11		0x0d4c	I219-LM 
 product INTEL I219_V11		0x0d4d	I219-V (11) Ethernet Connection
 product INTEL I219_LM10		0x0d4e	I219-LM (10) Ethernet Connection
 product INTEL I219_V10		0x0d4f	I219-V (10) Ethernet Connection
+product INTEL I225_IT		0x0d9f	I225-IT Ethernet Connection
 product INTEL I219_LM12		0x0d53	I219-LM (12) Ethernet Connection
 product INTEL I219_V12		0x0d55	I219-V (12) Ethernet Connection
 product INTEL I219_LM23		0x0dc5	I219-LM (23) Ethernet Connection
@@ -4254,6 +4258,8 @@ product INTEL 82439HX		0x1250	82439HX (T
 product INTEL I226_LM		0x125b	I226-LM Ethernet
 product INTEL I226_V		0x125c	I226-V Ethernet
 product INTEL I226_IT		0x125d	I226-IT Ethernet
+product INTEL I221_V		0x125e	I221-V Ethernet Connection
+product INTEL I226_BLANK_NVM	0x125f	I226 Ethernet Connection (blankNVM)
 product INTEL C3K_X553_10G	0x1306	C3000 X553 10G Ethernet
 product INTEL C3K_X553_1G	0x1307	C3000 X553 1G Ethernet
 product INTEL 82870P2_PPB	0x1460	82870P2 P64H2 PCI-PCI Bridge
@@ -4380,9 +4386,12 @@ product INTEL C3K_X553_SGMII	0x15e4	C300
 product INTEL C3K_X553_SGMII_L	0x15e5	C3000 X553 1GbE SGMII (non-10G SKU)
 product INTEL I225_LM		0x15f2	I225 LM Ethernet
 product INTEL I225_V		0x15f3	I225 V Ethernet
+product INTEL I220_V		0x15f7	I220-V Ethernet Connection
+product INTEL I225_BLANK_NVM	0x15fd	I225 Ethernet Connection (blankNVM)
 product INTEL I219_LM15		0x15f4	I219-LM (15) Ethernet Connection
 product INTEL I219_V15		0x15f5	I219-V (15) Ethernet Connection
 product INTEL I210_SGMII_WOF	0x15f6	I210 Ethernet (SGMII)
+product INTEL I225_I		0x15f8	I225-I Ethernet Connection
 product INTEL I219_LM14		0x15f9	I219-LM (14) Ethernet Connection
 product INTEL I219_V14		0x15fa	I219-V (14) Ethernet Connection
 product INTEL I219_LM13		0x15fb	I219-LM (13) Ethernet Connection
@@ -5415,6 +5424,9 @@ product INTEL XE5_V3_BRA4	0x2ffb  Xeon E
 product INTEL XE5_V3_SADBR1	0x2ffc  Xeon E7 v3/Xeon E5 v3/Core i7 System Address Decoder & Broadcast Registers
 product INTEL XE5_V3_SADBR2	0x2ffd  Xeon E7 v3/Xeon E5 v3/Core i7 System Address Decoder & Broadcast Registers
 product INTEL XE5_V3_SADBR3	0x2ffe  Xeon E7 v3/Xeon E5 v3/Core i7 System Address Decoder & Broadcast Registers
+product INTEL I225_K		0x3100	I225-K Ethernet Connection
+product INTEL I225_K2		0x3101	I225-K2 Ethernet Connection
+product INTEL I226_K		0x3102	I226-K Ethernet Connection
 product INTEL WIFI_LINK_3165_1	0x3165	Dual Band Wireless AC 3165
 product INTEL WIFI_LINK_3165_2	0x3166	Dual Band Wireless AC 3165
 product INTEL GLK_IGD_1		0x3184	UHD Graphics 605
@@ -5951,7 +5963,7 @@ product INTEL ADL_U15_2_4_HOST	0x4609	Al
 product INTEL ADL_U9_2_4_HOST	0x460a	Alder Lake (U9,2+4) Host
 product INTEL ADL_PCIE_RP_0	0x460d	Alder Lake PCIe G5 Root Port 0 (x16)
 product INTEL ADL_XDCI		0x460e	Alder Lake USB-C Device (xDCI)
-product INTEL ADL_S_2_0_HOST	0x4610	Alder Lake 

CVS commit: [netbsd-9] src/sys/conf

2024-01-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  1 11:37:13 UTC 2024

Modified Files:
src/sys/conf [netbsd-9]: copyright

Log Message:
Pull up following revision(s) (requested by hgutch in ticket #1785):

sys/conf/copyright: revision 1.22

Update copyright notice for 2024.


To generate a diff of this commit:
cvs rdiff -u -r1.17.4.3 -r1.17.4.4 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.17.4.3 src/sys/conf/copyright:1.17.4.4
--- src/sys/conf/copyright:1.17.4.3	Tue Jan  3 16:46:12 2023
+++ src/sys/conf/copyright	Mon Jan  1 11:37:13 2024
@@ -1,6 +1,7 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
-2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023
+2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
+2024
 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-9] src/sys/conf

2024-01-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  1 11:37:13 UTC 2024

Modified Files:
src/sys/conf [netbsd-9]: copyright

Log Message:
Pull up following revision(s) (requested by hgutch in ticket #1785):

sys/conf/copyright: revision 1.22

Update copyright notice for 2024.


To generate a diff of this commit:
cvs rdiff -u -r1.17.4.3 -r1.17.4.4 src/sys/conf/copyright

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/nfs

2023-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 11 12:34:43 UTC 2023

Modified Files:
src/sys/nfs [netbsd-9]: nfs_vnops.c

Log Message:
Pull up following revision(s) (requested by schmonz in ticket #1778):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.311.4.1 src/sys/nfs/nfs_vnops.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/nfs/nfs_vnops.c
diff -u src/sys/nfs/nfs_vnops.c:1.311 src/sys/nfs/nfs_vnops.c:1.311.4.1
--- src/sys/nfs/nfs_vnops.c:1.311	Mon Sep  3 16:29:36 2018
+++ src/sys/nfs/nfs_vnops.c	Mon Dec 11 12:34:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_vnops.c,v 1.311 2018/09/03 16:29:36 riastradh Exp $	*/
+/*	$NetBSD: nfs_vnops.c,v 1.311.4.1 2023/12/11 12:34:43 martin Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.311 2018/09/03 16:29:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.311.4.1 2023/12/11 12:34:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -2466,8 +2466,13 @@ nfs_readdirrpc(struct vnode *vp, struct 
 txdr_cookie3(uiop->uio_offset, tl);
 			}
 			tl += 2;
-			*tl++ = dnp->n_cookieverf.nfsuquad[0];
-			*tl++ = dnp->n_cookieverf.nfsuquad[1];
+			if (uiop->uio_offset == 0) {
+*tl++ = 0;
+*tl++ = 0;
+			} else {
+*tl++ = dnp->n_cookieverf.nfsuquad[0];
+*tl++ = dnp->n_cookieverf.nfsuquad[1];
+			}
 		} else
 #endif
 		{
@@ -2676,8 +2681,13 @@ nfs_readdirplusrpc(struct vnode *vp, str
 			txdr_cookie3(uiop->uio_offset, tl);
 		}
 		tl += 2;
-		*tl++ = dnp->n_cookieverf.nfsuquad[0];
-		*tl++ = dnp->n_cookieverf.nfsuquad[1];
+		if (uiop->uio_offset == 0) {
+			*tl++ = 0;
+			*tl++ = 0;
+		} else {
+			*tl++ = dnp->n_cookieverf.nfsuquad[0];
+			*tl++ = dnp->n_cookieverf.nfsuquad[1];
+		}
 		*tl++ = txdr_unsigned(nmp->nm_readdirsize);
 		*tl = txdr_unsigned(nmp->nm_rsize);
 		nfsm_request(dnp, NFSPROC_READDIRPLUS, curlwp, cred);



CVS commit: [netbsd-9] src/sys/nfs

2023-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 11 12:34:43 UTC 2023

Modified Files:
src/sys/nfs [netbsd-9]: nfs_vnops.c

Log Message:
Pull up following revision(s) (requested by schmonz in ticket #1778):

sys/nfs/nfs_vnops.c: revision 1.325

NFS client: fix interop with macOS 14 servers.

Symptom: a bunch of "Cannot open `.' (Invalid argument)".
thorpej@ analysis and fix: on the first request to read a given
directory, make sure READDIR and READDIRPLUS cookie verifiers are
being set to 0. This is in RFC1813 and macOS must have gotten
stricter about it.

Verified on 10.0_RC1/aarch64 to fix the reproducers in PR kern/57691 as
well as the original use case in which I met the bug: pkg_rr once again
runs to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.311.4.1 src/sys/nfs/nfs_vnops.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/mips/mips

2023-12-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec  9 12:57:16 UTC 2023

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: lock_stubs_llsc.S

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

sys/arch/mips/mips/lock_stubs_llsc.S: revision 1.18

Add missing PTR_WORD command in front of 0.
Likely accidentally missed in the commit, since rev 1.9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/mips/mips/lock_stubs_llsc.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/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.9 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.9.4.1
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.9	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sat Dec  9 12:57:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.9 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.9.4.1 2023/12/09 12:57:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.9 2019/04/06 03:06:26 thorpej Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.9.4.1 2023/12/09 12:57:16 martin Exp $")
 
 #include "assym.h"
 
@@ -364,7 +364,7 @@ EXPORT(mips_llsc_locore_atomicvec)
 #ifdef _LP64
 	PTR_WORD	llsc_ucas_64
 #else
-			0
+	PTR_WORD	0
 #endif /* _LP64 */
 #ifdef LOCKDEBUG
 	PTR_WORD	mutex_vector_enter



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

2023-12-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec  9 12:57:16 UTC 2023

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: lock_stubs_llsc.S

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

sys/arch/mips/mips/lock_stubs_llsc.S: revision 1.18

Add missing PTR_WORD command in front of 0.
Likely accidentally missed in the commit, since rev 1.9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/mips/mips/lock_stubs_llsc.S

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/wscons

2023-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 29 18:59:00 UTC 2023

Modified Files:
src/sys/dev/wscons [netbsd-9]: wsemul_vt100.c

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

sys/dev/wscons/wsemul_vt100.c: revision 1.47
sys/dev/wscons/wsemul_vt100.c: revision 1.48

PR/56223: David Shao ^[]8;;^G make console unresponsive. From OpenBSD:

In `string' state, accept bell (^G) as an end of sequence in addition to
`ESC \', as supported by xterm; some third-party software such as
ncmpcpp rely upon this.

fix the NetBSD tag.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.4.1 src/sys/dev/wscons/wsemul_vt100.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/wscons/wsemul_vt100.c
diff -u src/sys/dev/wscons/wsemul_vt100.c:1.45 src/sys/dev/wscons/wsemul_vt100.c:1.45.4.1
--- src/sys/dev/wscons/wsemul_vt100.c:1.45	Mon Sep  3 16:29:34 2018
+++ src/sys/dev/wscons/wsemul_vt100.c	Wed Nov 29 18:59:00 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_vt100.c,v 1.45 2018/09/03 16:29:34 riastradh Exp $ */
+/*	$NetBSD: wsemul_vt100.c,v 1.45.4.1 2023/11/29 18:59:00 martin Exp $	*/
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.45 2018/09/03 16:29:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.45.4.1 2023/11/29 18:59:00 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsmsgattrs.h"
@@ -429,7 +429,13 @@ wsemul_vt100_output_c0c1(struct wsemul_v
 		/* ignore */
 		break;
 	case ASCII_BEL:
-		wsdisplay_emulbell(vd->cbcookie);
+		if (edp->state == VT100_EMUL_STATE_STRING) {
+			/* acts as an equivalent to the ``ESC \'' string end */
+			wsemul_vt100_handle_dcs(vd);
+			edp->state = VT100_EMUL_STATE_NORMAL;
+		} else {
+			wsdisplay_emulbell(vd->cbcookie);
+		}
 		break;
 	case ASCII_BS:
 		if (vd->ccol > 0) {
@@ -489,7 +495,7 @@ wsemul_vt100_output_c0c1(struct wsemul_v
 		break;
 	case ST: /* string end 8-bit */
 		/* XXX only in VT100_EMUL_STATE_STRING */
-		wsemul_vt100_handle_dcs(edp);
+		wsemul_vt100_handle_dcs(vd);
 		edp->state = VT100_EMUL_STATE_NORMAL;
 		break;
 #endif



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

2023-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 29 18:59:00 UTC 2023

Modified Files:
src/sys/dev/wscons [netbsd-9]: wsemul_vt100.c

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

sys/dev/wscons/wsemul_vt100.c: revision 1.47
sys/dev/wscons/wsemul_vt100.c: revision 1.48

PR/56223: David Shao ^[]8;;^G make console unresponsive. From OpenBSD:

In `string' state, accept bell (^G) as an end of sequence in addition to
`ESC \', as supported by xterm; some third-party software such as
ncmpcpp rely upon this.

fix the NetBSD tag.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.4.1 src/sys/dev/wscons/wsemul_vt100.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/kern

2023-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 29 12:27:05 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: exec_subr.c

Log Message:
Additionally pull up the following for ticket #1769:

sys/kern/exec_subr.c1.87

Fix build for kernels w/o PAX_MPROTECT.


To generate a diff of this commit:
cvs rdiff -u -r1.82.10.1 -r1.82.10.2 src/sys/kern/exec_subr.c

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

Modified files:

Index: src/sys/kern/exec_subr.c
diff -u src/sys/kern/exec_subr.c:1.82.10.1 src/sys/kern/exec_subr.c:1.82.10.2
--- src/sys/kern/exec_subr.c:1.82.10.1	Tue Nov 28 12:59:21 2023
+++ src/sys/kern/exec_subr.c	Wed Nov 29 12:27:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_subr.c,v 1.82.10.1 2023/11/28 12:59:21 martin Exp $	*/
+/*	$NetBSD: exec_subr.c,v 1.82.10.2 2023/11/29 12:27:05 martin Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.82.10.1 2023/11/28 12:59:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.82.10.2 2023/11/29 12:27:05 martin Exp $");
 
 #include "opt_pax.h"
 
@@ -162,7 +162,7 @@ static int
 vmcmd_get_prot(struct lwp *l, const struct exec_vmcmd *cmd, vm_prot_t *prot,
 vm_prot_t *maxprot)
 {
-	vm_prot_t extraprot = PROT_MPROTECT_EXTRACT(cmd->ev_prot);
+	vm_prot_t extraprot __unused = PROT_MPROTECT_EXTRACT(cmd->ev_prot);
 
 	*prot = cmd->ev_prot & UVM_PROT_ALL;
 	*maxprot = PAX_MPROTECT_MAXPROTECT(l, *prot, extraprot, UVM_PROT_ALL);



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

2023-11-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 29 12:27:05 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: exec_subr.c

Log Message:
Additionally pull up the following for ticket #1769:

sys/kern/exec_subr.c1.87

Fix build for kernels w/o PAX_MPROTECT.


To generate a diff of this commit:
cvs rdiff -u -r1.82.10.1 -r1.82.10.2 src/sys/kern/exec_subr.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/ufs/ffs

2023-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 28 13:11:38 UTC 2023

Modified Files:
src/sys/ufs/ffs [netbsd-9]: ffs_vfsops.c

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

sys/ufs/ffs/ffs_vfsops.c: revision 1.382

ffs_sync: Avoid unlocked access to v_numoutput/v_dirtyblkhd.

Found by lockdoc.

PR kern/57606


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.362.2.1 src/sys/ufs/ffs/ffs_vfsops.c

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

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.362 src/sys/ufs/ffs/ffs_vfsops.c:1.362.2.1
--- src/sys/ufs/ffs/ffs_vfsops.c:1.362	Thu Jun 20 03:31:30 2019
+++ src/sys/ufs/ffs/ffs_vfsops.c	Tue Nov 28 13:11:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.362 2019/06/20 03:31:30 pgoyette Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.362.2.1 2023/11/28 13:11:37 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.362 2019/06/20 03:31:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.362.2.1 2023/11/28 13:11:37 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1926,14 +1926,25 @@ ffs_sync(struct mount *mp, int waitfor, 
 	/*
 	 * Force stale file system control information to be flushed.
 	 */
-	if (waitfor != MNT_LAZY && (ump->um_devvp->v_numoutput > 0 ||
-	!LIST_EMPTY(>um_devvp->v_dirtyblkhd))) {
-		vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
-		if ((error = VOP_FSYNC(ump->um_devvp, cred,
-		(waitfor == MNT_WAIT ? FSYNC_WAIT : 0) | FSYNC_NOLOG,
-		0, 0)) != 0)
-			allerror = error;
-		VOP_UNLOCK(ump->um_devvp);
+	if (waitfor != MNT_LAZY)  {
+		bool need_devvp_fsync;
+
+		mutex_enter(ump->um_devvp->v_interlock);
+		need_devvp_fsync = (ump->um_devvp->v_numoutput > 0 ||
+		!LIST_EMPTY(>um_devvp->v_dirtyblkhd));
+		mutex_exit(ump->um_devvp->v_interlock);
+		if (need_devvp_fsync) {
+			int flags = FSYNC_NOLOG;
+
+			if (waitfor == MNT_WAIT)
+flags |= FSYNC_WAIT;
+
+			vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
+			if ((error = VOP_FSYNC(ump->um_devvp, cred, flags, 0,
+0)) != 0)
+allerror = error;
+			VOP_UNLOCK(ump->um_devvp);
+		}
 	}
 #if defined(QUOTA) || defined(QUOTA2)
 	qsync(mp);



CVS commit: [netbsd-9] src/sys/ufs/ffs

2023-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 28 13:11:38 UTC 2023

Modified Files:
src/sys/ufs/ffs [netbsd-9]: ffs_vfsops.c

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

sys/ufs/ffs/ffs_vfsops.c: revision 1.382

ffs_sync: Avoid unlocked access to v_numoutput/v_dirtyblkhd.

Found by lockdoc.

PR kern/57606


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.362.2.1 src/sys/ufs/ffs/ffs_vfsops.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/kern

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 20:01:40 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1768):
sys/kern/uipc_mbuf.c: revision 1.252

mbuf: avoid assertion failure when splitting mbuf cluster

>From OpenBSD:
commit 7b4d35e0a60ba1dd4daf4b1c2932020a22463a89
Author: bluhm 
Date:   Fri Oct 20 16:25:15 2023 +
Avoid assertion failure when splitting mbuf cluster.
m_split() calls m_align() to initialize the data pointer of newly
allocated mbuf.  If the new mbuf will be converted to a cluster,
this is not necessary.  If additionally the new mbuf is larger than
MLEN, this can lead to a panic.
Only call m_align() when a valid m_data is needed.  This is the
case if we do not refecence the existing cluster, but memcpy() the
data into the new mbuf.
Reported-by: syzbot+0e6817f5877926f0e...@syzkaller.appspotmail.com
OK claudio@ deraadt@

The issue is harmless if DIAGNOSTIC is not enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.232.4.2 -r1.232.4.3 src/sys/kern/uipc_mbuf.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/kern

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 20:01:40 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1768):
sys/kern/uipc_mbuf.c: revision 1.252

mbuf: avoid assertion failure when splitting mbuf cluster

>From OpenBSD:
commit 7b4d35e0a60ba1dd4daf4b1c2932020a22463a89
Author: bluhm 
Date:   Fri Oct 20 16:25:15 2023 +
Avoid assertion failure when splitting mbuf cluster.
m_split() calls m_align() to initialize the data pointer of newly
allocated mbuf.  If the new mbuf will be converted to a cluster,
this is not necessary.  If additionally the new mbuf is larger than
MLEN, this can lead to a panic.
Only call m_align() when a valid m_data is needed.  This is the
case if we do not refecence the existing cluster, but memcpy() the
data into the new mbuf.
Reported-by: syzbot+0e6817f5877926f0e...@syzkaller.appspotmail.com
OK claudio@ deraadt@

The issue is harmless if DIAGNOSTIC is not enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.232.4.2 -r1.232.4.3 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.232.4.2 src/sys/kern/uipc_mbuf.c:1.232.4.3
--- src/sys/kern/uipc_mbuf.c:1.232.4.2	Mon Oct 25 15:47:50 2021
+++ src/sys/kern/uipc_mbuf.c	Mon Nov 27 20:01:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.232.4.2 2021/10/25 15:47:50 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.232.4.3 2023/11/27 20:01:40 martin Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.232.4.2 2021/10/25 15:47:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.232.4.3 2023/11/27 20:01:40 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1273,10 +1273,7 @@ m_split_internal(struct mbuf *m0, int le
 		len_save = m0->m_pkthdr.len;
 		m0->m_pkthdr.len = len0;
 
-		if (m->m_flags & M_EXT)
-			goto extpacket;
-
-		if (remain > MHLEN) {
+		if ((m->m_flags & M_EXT) == 0 && remain > MHLEN) {
 			/* m can't be the lead packet */
 			m_align(n, 0);
 			n->m_len = 0;
@@ -1287,8 +1284,6 @@ m_split_internal(struct mbuf *m0, int le
 return NULL;
 			}
 			return n;
-		} else {
-			m_align(n, remain);
 		}
 	} else if (remain == 0) {
 		n = m->m_next;
@@ -1299,14 +1294,13 @@ m_split_internal(struct mbuf *m0, int le
 		if (n == NULL)
 			return NULL;
 		MCLAIM(n, m->m_owner);
-		m_align(n, remain);
 	}
 
-extpacket:
 	if (m->m_flags & M_EXT) {
 		n->m_data = m->m_data + len;
 		MCLADDREFERENCE(m, n);
 	} else {
+		m_align(n, remain);
 		memcpy(mtod(n, void *), mtod(m, char *) + len, remain);
 	}
 



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

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 19:39:54 UTC 2023

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1765):

sys/dev/acpi/acpi.c: revision 1.284

Stop walking MADT / GTDT subtables if we hit a header with length 0


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.278.4.1 src/sys/dev/acpi/acpi.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/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.278 src/sys/dev/acpi/acpi.c:1.278.4.1
--- src/sys/dev/acpi/acpi.c:1.278	Sun Oct 21 13:41:15 2018
+++ src/sys/dev/acpi/acpi.c	Mon Nov 27 19:39:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.278 2018/10/21 13:41:15 jmcneill Exp $	*/
+/*	$NetBSD: acpi.c,v 1.278.4.1 2023/11/27 19:39:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.278 2018/10/21 13:41:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.278.4.1 2023/11/27 19:39:53 martin Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -1757,7 +1757,7 @@ acpi_madt_walk(ACPI_STATUS (*func)(ACPI_
 
 		hdrp = (ACPI_SUBTABLE_HEADER *)where;
 
-		if (ACPI_FAILURE(func(hdrp, aux)))
+		if (hdrp->Length == 0 || ACPI_FAILURE(func(hdrp, aux)))
 			break;
 
 		where += hdrp->Length;
@@ -1777,7 +1777,7 @@ acpi_gtdt_walk(ACPI_STATUS (*func)(ACPI_
 
 		hdrp = (ACPI_GTDT_HEADER *)where;
 
-		if (ACPI_FAILURE(func(hdrp, aux)))
+		if (hdrp->Length == 0 || ACPI_FAILURE(func(hdrp, aux)))
 			break;
 
 		where += hdrp->Length;



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

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 19:39:54 UTC 2023

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1765):

sys/dev/acpi/acpi.c: revision 1.284

Stop walking MADT / GTDT subtables if we hit a header with length 0


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.278.4.1 src/sys/dev/acpi/acpi.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/newsmips/dev

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 19:32:23 UTC 2023

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: dmac_0448.h scsi_1185.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1764):

sys/arch/newsmips/dev/dmac_0448.h: revision 1.7
sys/arch/newsmips/dev/scsi_1185.c: revision 1.25

Use DELAY(9), not empty for() loop that could be optimized out.
No visible regression on NWS-3260 and NWS-3470.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.96.1 src/sys/arch/newsmips/dev/dmac_0448.h
cvs rdiff -u -r1.23 -r1.23.20.1 src/sys/arch/newsmips/dev/scsi_1185.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/newsmips/dev/dmac_0448.h
diff -u src/sys/arch/newsmips/dev/dmac_0448.h:1.6 src/sys/arch/newsmips/dev/dmac_0448.h:1.6.96.1
--- src/sys/arch/newsmips/dev/dmac_0448.h:1.6	Wed Apr  9 15:40:30 2008
+++ src/sys/arch/newsmips/dev/dmac_0448.h	Mon Nov 27 19:32:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmac_0448.h,v 1.6 2008/04/09 15:40:30 tsutsui Exp $	*/
+/*	$NetBSD: dmac_0448.h,v 1.6.96.1 2023/11/27 19:32:23 martin Exp $	*/
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -120,7 +120,7 @@ struct	dm_stat {
 	unsigned int dm_width;
 };
 
-#define	DMAC_WAIT	nops(10)
+#define	DMAC_WAIT	DELAY(1)
 
 #define PINTEN		0xbfc80001
 # define	DMA_INTEN	0x10

Index: src/sys/arch/newsmips/dev/scsi_1185.c
diff -u src/sys/arch/newsmips/dev/scsi_1185.c:1.23 src/sys/arch/newsmips/dev/scsi_1185.c:1.23.20.1
--- src/sys/arch/newsmips/dev/scsi_1185.c:1.23	Thu Jul 21 19:49:58 2016
+++ src/sys/arch/newsmips/dev/scsi_1185.c	Mon Nov 27 19:32:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsi_1185.c,v 1.23 2016/07/21 19:49:58 christos Exp $	*/
+/*	$NetBSD: scsi_1185.c,v 1.23.20.1 2023/11/27 19:32:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.23 2016/07/21 19:49:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.23.20.1 2023/11/27 19:32:23 martin Exp $");
 
 #define	__INTR_PRIVATE
 #include 
@@ -116,10 +116,9 @@ __KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,
 #define	splscsi splsc
 
 #if defined(__mips__) && defined(CPU_SINGLE)
-#define nops(x)		{ int __i; for (__i = 0; __i < (x); __i++) ; }
-#define	DMAC_WAIT0	;
+#define	DMAC_WAIT0	__nothing
 #else
-#define	DMAC_WAIT0	DMAC_WAIT
+#define	DMAC_WAIT0	DMAC_WAIT	/* see MODIFY HISTORY comment above */
 #endif
 
 #ifdef DMAC_MAP_INIT



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

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 19:32:23 UTC 2023

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: dmac_0448.h scsi_1185.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1764):

sys/arch/newsmips/dev/dmac_0448.h: revision 1.7
sys/arch/newsmips/dev/scsi_1185.c: revision 1.25

Use DELAY(9), not empty for() loop that could be optimized out.
No visible regression on NWS-3260 and NWS-3470.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.96.1 src/sys/arch/newsmips/dev/dmac_0448.h
cvs rdiff -u -r1.23 -r1.23.20.1 src/sys/arch/newsmips/dev/scsi_1185.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/newsmips

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:47:07 UTC 2023

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/newsmips/dev [netbsd-9]: fb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1763):

sys/arch/newsmips/dev/fb.c: revision 1.34
sys/arch/newsmips/conf/GENERIC: revision 1.146
sys/arch/newsmips/conf/INSTALL: revision 1.49
sys/arch/newsmips/dev/fb.c: revision 1.30
sys/arch/newsmips/dev/fb.c: revision 1.31
sys/arch/newsmips/dev/fb.c: revision 1.32
sys/arch/newsmips/dev/fb.c: revision 1.33

Make local functions and variables static.

Use proper C99 exact-width integer types.

Use C99 designated struct initializers.

Remove trailing spaces and tab.

Add support for LCD-MONO framebuffer on NWS-32x0 laptop machines.

Tested on NWS-3260, which was sent from ryo@'s belongins and repaired
by me, and also tested on my NWS-3470D, including Xorg mono server.
(Note X.org server on NEWS machines requires keymap modifications)

Also add proper initialization on consinit() in NMB-253 case.


To generate a diff of this commit:
cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.47 -r1.47.4.1 src/sys/arch/newsmips/conf/INSTALL
cvs rdiff -u -r1.26 -r1.26.34.1 src/sys/arch/newsmips/dev/fb.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/newsmips/conf/GENERIC
diff -u src/sys/arch/newsmips/conf/GENERIC:1.137.2.1 src/sys/arch/newsmips/conf/GENERIC:1.137.2.2
--- src/sys/arch/newsmips/conf/GENERIC:1.137.2.1	Sun Nov  5 17:30:38 2023
+++ src/sys/arch/newsmips/conf/GENERIC	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.137.2.1 2023/11/05 17:30:38 martin Exp $
+# $NetBSD: GENERIC,v 1.137.2.2 2023/11/05 17:47:07 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/newsmips/conf/std.newsmip
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.137.2.1 $"
+#ident 		"GENERIC-$Revision: 1.137.2.2 $"
 
 maxusers	16
 
@@ -166,6 +166,7 @@ zstty4	at zsc2 channel 0		# tty04
 zstty5	at zsc2 channel 1		# tty05
 
 fb0	at hb0 addr 0x8800		# NWB-253 frame buffer
+fb0	at hb0 addr 0x9020		# LCD-MONO on NWS-32x0
 wsdisplay0 at fb? console ?
 
 xafb*	at ap?# "XA" frame buffer

Index: src/sys/arch/newsmips/conf/INSTALL
diff -u src/sys/arch/newsmips/conf/INSTALL:1.47 src/sys/arch/newsmips/conf/INSTALL:1.47.4.1
--- src/sys/arch/newsmips/conf/INSTALL:1.47	Thu Feb  7 04:33:58 2019
+++ src/sys/arch/newsmips/conf/INSTALL	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-# 	$NetBSD: INSTALL,v 1.47 2019/02/07 04:33:58 mrg Exp $
+# 	$NetBSD: INSTALL,v 1.47.4.1 2023/11/05 17:47:07 martin Exp $
 #
 #	INSTALL kernel for RISC-NEWS
 
@@ -81,7 +81,8 @@ zsc0	at ap?
 zstty0	at zsc0 channel 0		# tty00
 zstty1	at zsc0 channel 1		# tty01
 
-fb0	at hb0 addr 0x8800		# frame buffer
+fb0	at hb0 addr 0x8800		# NWB-253 frame buffer
+fb0	at hb0 addr 0x9020		# LCD-MONO on NWS-32x0
 
 xafb*	at ap?
 kb0	at ap?

Index: src/sys/arch/newsmips/dev/fb.c
diff -u src/sys/arch/newsmips/dev/fb.c:1.26 src/sys/arch/newsmips/dev/fb.c:1.26.34.1
--- src/sys/arch/newsmips/dev/fb.c:1.26	Fri Jan 31 15:43:06 2014
+++ src/sys/arch/newsmips/dev/fb.c	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb.c,v 1.26 2014/01/31 15:43:06 tsutsui Exp $	*/
+/*	$NetBSD: fb.c,v 1.26.34.1 2023/11/05 17:47:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -25,9 +25,32 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+/*-
+ * Copyright (c) 2023 Izumi Tsutsui.  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 AUTHOR ``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 AUTHOR 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 

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

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:47:07 UTC 2023

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/newsmips/dev [netbsd-9]: fb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1763):

sys/arch/newsmips/dev/fb.c: revision 1.34
sys/arch/newsmips/conf/GENERIC: revision 1.146
sys/arch/newsmips/conf/INSTALL: revision 1.49
sys/arch/newsmips/dev/fb.c: revision 1.30
sys/arch/newsmips/dev/fb.c: revision 1.31
sys/arch/newsmips/dev/fb.c: revision 1.32
sys/arch/newsmips/dev/fb.c: revision 1.33

Make local functions and variables static.

Use proper C99 exact-width integer types.

Use C99 designated struct initializers.

Remove trailing spaces and tab.

Add support for LCD-MONO framebuffer on NWS-32x0 laptop machines.

Tested on NWS-3260, which was sent from ryo@'s belongins and repaired
by me, and also tested on my NWS-3470D, including Xorg mono server.
(Note X.org server on NEWS machines requires keymap modifications)

Also add proper initialization on consinit() in NMB-253 case.


To generate a diff of this commit:
cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.47 -r1.47.4.1 src/sys/arch/newsmips/conf/INSTALL
cvs rdiff -u -r1.26 -r1.26.34.1 src/sys/arch/newsmips/dev/fb.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/newsmips/conf

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:30:38 UTC 2023

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: DEJIKO GENERIC WAPIKO

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1759):

sys/arch/newsmips/conf/GENERIC: revision 1.144
sys/arch/newsmips/conf/WAPIKO: revision 1.50
sys/arch/newsmips/conf/DEJIKO: revision 1.36

Use FONT_SONY12x24 for Sony fans, rather than Gallant fonts used on Sun.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/newsmips/conf/DEJIKO
cvs rdiff -u -r1.137 -r1.137.2.1 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/newsmips/conf/WAPIKO

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/newsmips/conf/DEJIKO
diff -u src/sys/arch/newsmips/conf/DEJIKO:1.35 src/sys/arch/newsmips/conf/DEJIKO:1.35.4.1
--- src/sys/arch/newsmips/conf/DEJIKO:1.35	Wed Aug  1 20:04:13 2018
+++ src/sys/arch/newsmips/conf/DEJIKO	Sun Nov  5 17:30:38 2023
@@ -1,4 +1,4 @@
-# 	$NetBSD: DEJIKO,v 1.35 2018/08/01 20:04:13 maxv Exp $
+# 	$NetBSD: DEJIKO,v 1.35.4.1 2023/11/05 17:30:38 martin Exp $
 #
 #	Dejiko's sekai-seifuku NEWS5000 nyo.
 
@@ -45,7 +45,8 @@ include 	"conf/compat_netbsd14.config"
 # wscons options
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	FONT_GALLANT12x22
+#options 	FONT_GALLANT12x22
+options 	FONT_SONY12x24
 
 config	netbsd root on ? type ?
 

Index: src/sys/arch/newsmips/conf/GENERIC
diff -u src/sys/arch/newsmips/conf/GENERIC:1.137 src/sys/arch/newsmips/conf/GENERIC:1.137.2.1
--- src/sys/arch/newsmips/conf/GENERIC:1.137	Fri Apr 26 21:40:31 2019
+++ src/sys/arch/newsmips/conf/GENERIC	Sun Nov  5 17:30:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.137 2019/04/26 21:40:31 sevan Exp $
+# $NetBSD: GENERIC,v 1.137.2.1 2023/11/05 17:30:38 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/newsmips/conf/std.newsmip
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.137 $"
+#ident 		"GENERIC-$Revision: 1.137.2.1 $"
 
 maxusers	16
 
@@ -124,7 +124,8 @@ options 	NFS_BOOT_DHCP
 # wscons options
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	FONT_GALLANT12x22
+#options 	FONT_GALLANT12x22
+options 	FONT_SONY12x24
 
 config	netbsd	root on ? type ?
 

Index: src/sys/arch/newsmips/conf/WAPIKO
diff -u src/sys/arch/newsmips/conf/WAPIKO:1.49 src/sys/arch/newsmips/conf/WAPIKO:1.49.4.1
--- src/sys/arch/newsmips/conf/WAPIKO:1.49	Wed Aug  1 20:04:13 2018
+++ src/sys/arch/newsmips/conf/WAPIKO	Sun Nov  5 17:30:38 2023
@@ -1,7 +1,7 @@
 #
 # NEWS3400 config file
 #
-# 	$NetBSD: WAPIKO,v 1.49 2018/08/01 20:04:13 maxv Exp $
+# 	$NetBSD: WAPIKO,v 1.49.4.1 2023/11/05 17:30:38 martin Exp $
 #
 include 	"arch/newsmips/conf/std.newsmips"
 
@@ -84,7 +84,8 @@ sd*	at scsibus? target ? lun ?	# SCSI di
 
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	FONT_GALLANT12x22
+#options 	FONT_GALLANT12x22
+options 	FONT_SONY12x24
 
 wsdisplay0 at fb? console ?
 wskbd0	at kb? console ?



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

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:30:38 UTC 2023

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: DEJIKO GENERIC WAPIKO

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1759):

sys/arch/newsmips/conf/GENERIC: revision 1.144
sys/arch/newsmips/conf/WAPIKO: revision 1.50
sys/arch/newsmips/conf/DEJIKO: revision 1.36

Use FONT_SONY12x24 for Sony fans, rather than Gallant fonts used on Sun.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/newsmips/conf/DEJIKO
cvs rdiff -u -r1.137 -r1.137.2.1 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/newsmips/conf/WAPIKO

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/newsmips/dev

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:08:09 UTC 2023

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: zs_hb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1760):

sys/arch/newsmips/dev/zs_hb.c: revision 1.30

Don't use aprint_error(9) for a normal attach message.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.20.1 src/sys/arch/newsmips/dev/zs_hb.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/newsmips/dev/zs_hb.c
diff -u src/sys/arch/newsmips/dev/zs_hb.c:1.27 src/sys/arch/newsmips/dev/zs_hb.c:1.27.20.1
--- src/sys/arch/newsmips/dev/zs_hb.c:1.27	Thu Jul 21 19:49:58 2016
+++ src/sys/arch/newsmips/dev/zs_hb.c	Sun Nov  5 17:08:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs_hb.c,v 1.27 2016/07/21 19:49:58 christos Exp $	*/
+/*	$NetBSD: zs_hb.c,v 1.27.20.1 2023/11/05 17:08:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.27 2016/07/21 19:49:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.27.20.1 2023/11/05 17:08:08 martin Exp $");
 
 #include 
 #include 
@@ -214,7 +214,7 @@ zs_hb_attach(device_t parent, device_t s
 #endif
 	}
 
-	aprint_error(" level %d\n", intlevel);
+	aprint_normal(" level %d\n", intlevel);
 
 	zs_delay = zs_hb_delay;
 



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

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:08:09 UTC 2023

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: zs_hb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1760):

sys/arch/newsmips/dev/zs_hb.c: revision 1.30

Don't use aprint_error(9) for a normal attach message.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.20.1 src/sys/arch/newsmips/dev/zs_hb.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/dev/pci

2023-10-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 26 15:12:10 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-9]: mpii.c

Log Message:
Pull up following revision(s) (requested by buhrow in ticket #1756):

sys/dev/pci/mpii.c: revision 1.30

Fixes for PR kern/57133:

I can now explain why this assert is firing and have a fix for it.  It is a  
regression introduced in R1.22 of mpii.c.

If a request comes in and the IOC returns a 
MPII_SCSIIO_STATUS_CHECK_COND condition, after
 a successful transfer, or one that is a recovered error,
 mpii(4) correctly sets the xs->error to XS_SENSE, but incorrectly sets 
xs->resid to 0 before
 returning the xfer to the upper scsi layers.  Once the upper layers get it, 
they notice the
 XS_SENSE check condition and because it's a retryable error, they increment 
xs_requeuecnt, set
 ERESTART and send the xfer request down to the mpii(4) layer again for a 
retry. What they do
 not do is reset xs->resid equal to xs->datalen.  When the xfer comes down to 
mpii(4) again, the
 assert happens.  The fix is for the mpii(4) driver to leave xs->resid alone 
when it encounters
 a MPII_SCSIIO_STATUS_CHECK_COND condition.

This bug affects NetBSD-10, netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.22.4.1 -r1.22.4.2 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.22.4.1 src/sys/dev/pci/mpii.c:1.22.4.2
--- src/sys/dev/pci/mpii.c:1.22.4.1	Sun Aug  9 14:14:34 2020
+++ src/sys/dev/pci/mpii.c	Thu Oct 26 15:12:10 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.22.4.1 2020/08/09 14:14:34 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.22.4.2 2023/10/26 15:12:10 martin Exp $ */
 /*	$OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $	*/
 /*
  * Copyright (c) 2010, 2012 Mike Belopuhov
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.22.4.1 2020/08/09 14:14:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.22.4.2 2023/10/26 15:12:10 martin Exp $");
 
 #include "bio.h"
 
@@ -3225,7 +3225,6 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 	}
 	
 	KASSERT(xs->error == XS_NOERROR);
-	KASSERT(xs->resid == xs->datalen);
 	KASSERT(xs->status == SCSI_OK);
 	
 	if (ccb->ccb_rcb == NULL) {
@@ -3285,7 +3284,6 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 			break;
 
 		case MPII_SCSIIO_STATUS_CHECK_COND:
-			xs->resid = 0;
 			xs->error = XS_SENSE;
 			break;
 



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

2023-10-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 26 15:12:10 UTC 2023

Modified Files:
src/sys/dev/pci [netbsd-9]: mpii.c

Log Message:
Pull up following revision(s) (requested by buhrow in ticket #1756):

sys/dev/pci/mpii.c: revision 1.30

Fixes for PR kern/57133:

I can now explain why this assert is firing and have a fix for it.  It is a  
regression introduced in R1.22 of mpii.c.

If a request comes in and the IOC returns a 
MPII_SCSIIO_STATUS_CHECK_COND condition, after
 a successful transfer, or one that is a recovered error,
 mpii(4) correctly sets the xs->error to XS_SENSE, but incorrectly sets 
xs->resid to 0 before
 returning the xfer to the upper scsi layers.  Once the upper layers get it, 
they notice the
 XS_SENSE check condition and because it's a retryable error, they increment 
xs_requeuecnt, set
 ERESTART and send the xfer request down to the mpii(4) layer again for a 
retry. What they do
 not do is reset xs->resid equal to xs->datalen.  When the xfer comes down to 
mpii(4) again, the
 assert happens.  The fix is for the mpii(4) driver to leave xs->resid alone 
when it encounters
 a MPII_SCSIIO_STATUS_CHECK_COND condition.

This bug affects NetBSD-10, netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.22.4.1 -r1.22.4.2 src/sys/dev/pci/mpii.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/kern

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 15:07:06 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: subr_thmap.c

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

sys/kern/subr_thmap.c: revision 1.14
sys/kern/subr_thmap.c: revision 1.15

thmap(9): Test alloc failure, not THMAP_GETPTR failure.
THMAP_GETPTR may return nonnull even though alloc returned zero.

Note that this failure branch is not actually appropriate;
thmap_create should not fail.  We really need to pass KM_SLEEP
through in this call site even though there are other call sites for
which KM_NOSLEEP is appropriate.

Adapted from: https://github.com/rmind/thmap/pull/14
PR kern/57666
https://github.com/rmind/thmap/issues/13

thmap(9): Preallocate GC list storage for thmap_del.
thmap_del can't fail, and it is used in places in npf where sleeping
is forbidden, so it can't rely on allocating memory either.
Instead of having thmap_del allocate memory on the fly for each
object to defer freeing until thmap_gc, arrange to have thmap(9)
preallocate the same storage when allocating all the objects in the
first place, with a GC header.

This is suboptimal for memory usage, especially on insertion- and
lookup-heavy but deletion-light workloads, but it's not clear rmind's
alternative (https://github.com/rmind/thmap/tree/thmap_del_mem_fail)
is ready to use yet, so we'll go with this for correctness.
PR kern/57208

https://github.com/rmind/npf/issues/129


To generate a diff of this commit:
cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/sys/kern/subr_thmap.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/kern

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 15:07:06 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: subr_thmap.c

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

sys/kern/subr_thmap.c: revision 1.14
sys/kern/subr_thmap.c: revision 1.15

thmap(9): Test alloc failure, not THMAP_GETPTR failure.
THMAP_GETPTR may return nonnull even though alloc returned zero.

Note that this failure branch is not actually appropriate;
thmap_create should not fail.  We really need to pass KM_SLEEP
through in this call site even though there are other call sites for
which KM_NOSLEEP is appropriate.

Adapted from: https://github.com/rmind/thmap/pull/14
PR kern/57666
https://github.com/rmind/thmap/issues/13

thmap(9): Preallocate GC list storage for thmap_del.
thmap_del can't fail, and it is used in places in npf where sleeping
is forbidden, so it can't rely on allocating memory either.
Instead of having thmap_del allocate memory on the fly for each
object to defer freeing until thmap_gc, arrange to have thmap(9)
preallocate the same storage when allocating all the objects in the
first place, with a GC header.

This is suboptimal for memory usage, especially on insertion- and
lookup-heavy but deletion-light workloads, but it's not clear rmind's
alternative (https://github.com/rmind/thmap/tree/thmap_del_mem_fail)
is ready to use yet, so we'll go with this for correctness.
PR kern/57208

https://github.com/rmind/npf/issues/129


To generate a diff of this commit:
cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/sys/kern/subr_thmap.c

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

Modified files:

Index: src/sys/kern/subr_thmap.c
diff -u src/sys/kern/subr_thmap.c:1.5.6.1 src/sys/kern/subr_thmap.c:1.5.6.2
--- src/sys/kern/subr_thmap.c:1.5.6.1	Mon May 25 17:19:37 2020
+++ src/sys/kern/subr_thmap.c	Wed Oct 18 15:07:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_thmap.c,v 1.5.6.1 2020/05/25 17:19:37 martin Exp $	*/
+/*	$NetBSD: subr_thmap.c,v 1.5.6.2 2023/10/18 15:07:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 2018 Mindaugas Rasiukevicius 
@@ -111,7 +111,7 @@
 #include "utils.h"
 #endif
 
-THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.5.6.1 2020/05/25 17:19:37 martin Exp $");
+THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.5.6.2 2023/10/18 15:07:06 martin Exp $");
 
 /*
  * NetBSD kernel wrappers
@@ -207,11 +207,17 @@ typedef struct {
 	uint32_t	hashval;	// current hash value
 } thmap_query_t;
 
-typedef struct {
-	uintptr_t	addr;
+union thmap_align {
+	void *		p;
+	uint64_t	v;
+};
+
+typedef struct thmap_gc thmap_gc_t;
+struct thmap_gc {
 	size_t		len;
-	void *		next;
-} thmap_gc_t;
+	thmap_gc_t *	next;
+	char		data[] __aligned(sizeof(union thmap_align));
+};
 
 #define	THMAP_ROOT_LEN	(sizeof(thmap_ptr_t) * ROOT_SIZE)
 
@@ -246,6 +252,34 @@ static const thmap_ops_t thmap_default_o
 	.free = free_wrapper
 };
 
+static uintptr_t
+gc_alloc(const thmap_t *thmap, size_t len)
+{
+	const size_t alloclen = offsetof(struct thmap_gc, data[len]);
+	const uintptr_t gcaddr = thmap->ops->alloc(alloclen);
+
+	if (!gcaddr)
+		return 0;
+
+	thmap_gc_t *const gc = THMAP_GETPTR(thmap, gcaddr);
+	gc->len = len;
+	return THMAP_GETOFF(thmap, >data[0]);
+}
+
+static void
+gc_free(const thmap_t *thmap, uintptr_t addr, size_t len)
+{
+	const size_t alloclen = offsetof(struct thmap_gc, data[len]);
+	char *const ptr = THMAP_GETPTR(thmap, addr);
+	thmap_gc_t *const gc = container_of(ptr, struct thmap_gc, data[0]);
+	const uintptr_t gcaddr = THMAP_GETOFF(thmap, gc);
+
+	KASSERTMSG(gc->len == len, "thmap=%p ops=%p addr=%p len=%zu"
+	" gc=%p gc->len=%zu",
+	thmap, thmap->ops, (void *)addr, len, gc, gc->len);
+	thmap->ops->free(gcaddr, alloclen);
+}
+
 /*
  * NODE LOCKING.
  */
@@ -361,7 +395,7 @@ node_create(thmap_t *thmap, thmap_inode_
 	thmap_inode_t *node;
 	uintptr_t p;
 
-	p = thmap->ops->alloc(THMAP_INODE_LEN);
+	p = gc_alloc(thmap, THMAP_INODE_LEN);
 	if (!p) {
 		return NULL;
 	}
@@ -422,7 +456,7 @@ leaf_create(const thmap_t *thmap, const 
 	thmap_leaf_t *leaf;
 	uintptr_t leaf_off, key_off;
 
-	leaf_off = thmap->ops->alloc(sizeof(thmap_leaf_t));
+	leaf_off = gc_alloc(thmap, sizeof(thmap_leaf_t));
 	if (!leaf_off) {
 		return NULL;
 	}
@@ -433,9 +467,9 @@ leaf_create(const thmap_t *thmap, const 
 		/*
 		 * Copy the key.
 		 */
-		key_off = thmap->ops->alloc(len);
+		key_off = gc_alloc(thmap, len);
 		if (!key_off) {
-			thmap->ops->free(leaf_off, sizeof(thmap_leaf_t));
+			gc_free(thmap, leaf_off, sizeof(thmap_leaf_t));
 			return NULL;
 		}
 		memcpy(THMAP_GETPTR(thmap, key_off), key, len);
@@ -453,9 +487,9 @@ static void
 leaf_free(const thmap_t *thmap, thmap_leaf_t *leaf)
 {
 	if ((thmap->flags & THMAP_NOCOPY) == 0) {
-		thmap->ops->free(leaf->key, leaf->len);
+		gc_free(thmap, leaf->key, leaf->len);
 	}
-	thmap->ops->free(THMAP_GETOFF(thmap, leaf), sizeof(thmap_leaf_t));
+	gc_free(thmap, THMAP_GETOFF(thmap, leaf), 

  1   2   3   4   5   6   7   8   9   10   >