CVS commit: src/sys/conf

2021-12-31 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Jan  1 06:14:28 UTC 2022

Modified Files:
src/sys/conf: copyright

Log Message:
Welcome to 2022!


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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: src/sys/conf

2021-12-31 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Jan  1 06:14:28 UTC 2022

Modified Files:
src/sys/conf: copyright

Log Message:
Welcome to 2022!


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/conf/copyright:1.20
--- src/sys/conf/copyright:1.19	Fri Jan  1 08:02:16 2021
+++ src/sys/conf/copyright	Sat Jan  1 06:14:28 2022
@@ -1,5 +1,6 @@
 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 The NetBSD Foundation, Inc.  All rights reserved.
+2018, 2019, 2020, 2021, 2022
+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: src/sys/dev/pci

2021-12-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan  1 03:27:53 UTC 2022

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

Log Message:
Print Physical Layer 16.0 GT/s and Lane Margining at the Receiver extended cap.

 - Decode Physical Layer 16.0 GT/s extended capability.
 - Decode Lane Margining at the Receiver extended capability.
 - Rename pcie_link_compliance_preset_deemphasis to
   pcie_link_preset_preshoot_deemphasis because the table is referenced from
   multiple places.
 - Print "reserved" instead of "unknown" when printing equalization preset.
   One of them is known to be the default value.
 - Rename PCI_EXTCAP_PYSLAY_16GT to PCI_EXTCAP_PL16G.


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/pci/pcireg.h

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



CVS commit: src/sys/dev/pci

2021-12-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan  1 03:27:53 UTC 2022

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

Log Message:
Print Physical Layer 16.0 GT/s and Lane Margining at the Receiver extended cap.

 - Decode Physical Layer 16.0 GT/s extended capability.
 - Decode Lane Margining at the Receiver extended capability.
 - Rename pcie_link_compliance_preset_deemphasis to
   pcie_link_preset_preshoot_deemphasis because the table is referenced from
   multiple places.
 - Print "reserved" instead of "unknown" when printing equalization preset.
   One of them is known to be the default value.
 - Rename PCI_EXTCAP_PYSLAY_16GT to PCI_EXTCAP_PL16G.


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.235 src/sys/dev/pci/pci_subr.c:1.236
--- src/sys/dev/pci/pci_subr.c:1.235	Tue Dec 28 09:19:02 2021
+++ src/sys/dev/pci/pci_subr.c	Sat Jan  1 03:27:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.235 2021/12/28 09:19:02 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.236 2022/01/01 03:27:53 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.235 2021/12/28 09:19:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.236 2022/01/01 03:27:53 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1833,10 +1833,10 @@ pci_print_pcie_link_deemphasis(pcireg_t 
 	}
 }
 
-static const struct _pcie_link_compliance_preset_deemphasis {
+static const struct _pcie_link_preset_preshoot_deemphasis {
 	const char *preshoot;
 	const char *deemphasis;
-} pcie_link_compliance_preset_deemphasis[] = {
+} pcie_link_preset_preshoot_deemphasis[] = {
 	{ "0.0",	"-6.0+-1.5" },	/* P0 */
 	{ "0.0",	"-3.5+-1" },	/* P1 */
 	{ "0.0",	"-4.4+-1.5" },	/* P2 */
@@ -1851,18 +1851,22 @@ static const struct _pcie_link_complianc
 };
 
 static void
-pci_print_pcie_link_compliance_preset_deemphasis(pcireg_t val)
+pci_print_pcie_link_preset_preshoot_deemphasis(pcireg_t val)
 {
 	const char *deemphasis;
 
-	if (val >= __arraycount(pcie_link_compliance_preset_deemphasis)) {
-		printf("unknown value (0x%x)", val);
+	if (val >= __arraycount(pcie_link_preset_preshoot_deemphasis)) {
+		/*
+		 * This may be printed because the default value of some
+		 * register fields is 0b.
+		 */
+		printf("reserved value (0x%x)", val);
 		return;
 	}
 
 	printf("Preshoot %sdB",
-	pcie_link_compliance_preset_deemphasis[val].preshoot);
-	deemphasis = pcie_link_compliance_preset_deemphasis[val].deemphasis;
+	pcie_link_preset_preshoot_deemphasis[val].preshoot);
+	deemphasis = pcie_link_preset_preshoot_deemphasis[val].deemphasis;
 
 	if (deemphasis != NULL)
 		printf(", De-emphasis %sdB", deemphasis);
@@ -2402,7 +2406,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		onoff("Enter Modified Compliance", reg, PCIE_LCSR2_EN_MCOMP);
 		onoff("Compliance SOS", reg, PCIE_LCSR2_COMP_SOS);
 		printf("  Compliance Preset/De-emphasis: ");
-		pci_print_pcie_link_compliance_preset_deemphasis(
+		pci_print_pcie_link_preset_preshoot_deemphasis(
 			PCIREG_SHIFTOUT(reg, PCIE_LCSR2_COMP_DEEMP));
 		printf("\n");
 
@@ -4300,6 +4304,179 @@ pci_conf_print_dlf_cap(const pcireg_t *r
 	onoff("Remote DLF supported Valid", reg, PCI_DLF_STAT_RMTVALID);
 }
 
+static void
+pci_conf_print_pl16g_cap(const pcireg_t *regs, int extcapoff)
+{
+	pcireg_t reg, lwidth;
+	int pcie_capoff;
+	unsigned int i, j;
+
+	printf("\n  Physical Layer 16.0 GT/s\n");
+	reg = regs[o2i(extcapoff + PCI_PL16G_CAP)];
+	printf("Capability register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_CTL)];
+	printf("Control register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_STAT)];
+	printf("Status register: 0x%08x\n", reg);
+	onoff("Equalization 16.0 GT/s Complete", reg, PCI_PL16G_STAT_EQ_COMPL);
+	onoff("Equalization 16.0 GT/s Phase 1 Successful", reg,
+	PCI_PL16G_STAT_EQ_P1S);
+	onoff("Equalization 16.0 GT/s Phase 2 Successful", reg,
+	PCI_PL16G_STAT_EQ_P2S);
+	onoff("Equalization 16.0 GT/s Phase 3 Successful", reg,
+	PCI_PL16G_STAT_EQ_P3S);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_LDPMS)];
+	printf("Local Data Parity Mismatch Status register: 0x%08x\n",
+	reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_FRDPMS)];
+	printf("First Retimer Data Parity Mismatch Status register:"
+	" 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_SRDPMS)];
+	printf("Second Retimer Data Parity Mismatch Status register:"
+	" 0x%08x\n", reg);
+
+	if (pci_conf_find_cap(regs, PCI_CAP_PCIEXPRESS, _capoff) == 0)
+		return; /* error */
+
+	reg = regs[o2i(pcie_capoff + PCIE_LCAP)];
+	lwidth = 

CVS commit: src/sys/arch/powerpc/powerpc

2021-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  1 01:15:12 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: fixup.c

Log Message:
more KASSERT vs. DIAGNOSTIC fallout


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/powerpc/fixup.c

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



CVS commit: src/sys/arch/powerpc/powerpc

2021-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  1 01:15:12 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: fixup.c

Log Message:
more KASSERT vs. DIAGNOSTIC fallout


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/powerpc/fixup.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/powerpc/powerpc/fixup.c
diff -u src/sys/arch/powerpc/powerpc/fixup.c:1.12 src/sys/arch/powerpc/powerpc/fixup.c:1.13
--- src/sys/arch/powerpc/powerpc/fixup.c:1.12	Mon Jul  6 10:31:24 2020
+++ src/sys/arch/powerpc/powerpc/fixup.c	Sat Jan  1 01:15:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixup.c,v 1.12 2020/07/06 10:31:24 rin Exp $	*/
+/*	$NetBSD: fixup.c,v 1.13 2022/01/01 01:15:11 macallan Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fixup.c,v 1.12 2020/07/06 10:31:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fixup.c,v 1.13 2022/01/01 01:15:11 macallan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -186,7 +186,9 @@ powerpc_fixup_stubs(uint32_t *start, uin
 break;
 			}
 			case OPC_STW: {
+#ifdef DIAGNOSTIC
 KASSERT((i.i_d.i_rs == r_lr || i.i_d.i_rs == 31) && i.i_d.i_ra == 1);
+#endif
 break;
 			}
 			case OPC_STWU: {
@@ -195,8 +197,10 @@ powerpc_fixup_stubs(uint32_t *start, uin
 break;
 			}
 			case OPC_branch_19: {
+#ifdef DIAGNOSTIC
 KASSERT(r_lr == -1 || i.i_int == 0x4e800421);
 KASSERT(r_lr != -1 || i.i_int == 0x4e800420);
+#endif
 if (ctr == 0) {
 	panic("%s: jump at %p to %p would "
 	"branch to 0", __func__, insnp,



CVS commit: src/sys/arch/hppa/hppa

2021-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  1 01:03:50 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa: vm_machdep.c

Log Message:
make this compile again by moving a KASSERT into the #ifdef DIAGNOSTIC block
it depends on


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/hppa/hppa/vm_machdep.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/hppa/hppa/vm_machdep.c
diff -u src/sys/arch/hppa/hppa/vm_machdep.c:1.55 src/sys/arch/hppa/hppa/vm_machdep.c:1.56
--- src/sys/arch/hppa/hppa/vm_machdep.c:1.55	Mon Apr 15 06:16:42 2019
+++ src/sys/arch/hppa/hppa/vm_machdep.c	Sat Jan  1 01:03:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.55 2019/04/15 06:16:42 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.56 2022/01/01 01:03:50 macallan Exp $	*/
 
 /*	$OpenBSD: vm_machdep.c,v 1.64 2008/09/30 18:54:26 miod Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.55 2019/04/15 06:16:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.56 2022/01/01 01:03:50 macallan Exp $");
 
 #include 
 #include 
@@ -62,9 +62,8 @@ cpu_activate_pcb(struct lwp *l)
 #ifdef DIAGNOSTIC
 	vaddr_t uarea = (vaddr_t)pcb;
 	vaddr_t maxsp = uarea + USPACE;
-#endif
 	KASSERT(tf == (void *)(uarea + PAGE_SIZE));
-
+#endif
 	/*
 	 * Stash the physical address of FP regs for later perusal
 	 */



CVS commit: src/sys/arch/hppa/hppa

2021-12-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  1 01:03:50 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa: vm_machdep.c

Log Message:
make this compile again by moving a KASSERT into the #ifdef DIAGNOSTIC block
it depends on


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/hppa/hppa/vm_machdep.c

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



CVS commit: src/sys/dev/pci

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 20:38:08 UTC 2021

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

Log Message:
s/interrups/interrupts/


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/siisata_pci.c

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

Modified files:

Index: src/sys/dev/pci/siisata_pci.c
diff -u src/sys/dev/pci/siisata_pci.c:1.21 src/sys/dev/pci/siisata_pci.c:1.22
--- src/sys/dev/pci/siisata_pci.c:1.21	Wed May  5 19:30:51 2021
+++ src/sys/dev/pci/siisata_pci.c	Fri Dec 31 20:38:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_pci.c,v 1.21 2021/05/05 19:30:51 jdolecek Exp $ */
+/* $NetBSD: siisata_pci.c,v 1.22 2021/12/31 20:38:08 andvar Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.21 2021/05/05 19:30:51 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.22 2021/12/31 20:38:08 andvar Exp $");
 
 #include 
 #include 
@@ -95,7 +95,7 @@ static const struct siisata_pci_board si
 		.spb_chip = 3124,
 		/*
 		 * SiI3124 seems to be PCI/PCI-X chip behind PCI-e bridge,
-		 * claims MSI support but interrups don't work with MSI on.
+		 * claims MSI support but interrupts don't work with MSI on.
 		 */
 		.sbp_flags = SIISATA_BROKEN_MSI,
 	},



CVS commit: src/sys/dev/pci

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 20:38:08 UTC 2021

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

Log Message:
s/interrups/interrupts/


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/siisata_pci.c

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



CVS commit: src

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 20:22:49 UTC 2021

Modified Files:
src/lib/libresolv: dst_api.c
src/sys/altq: altq_cbq.c
src/sys/dev/pci/qat: qatreg.h
src/sys/dev/scsipi: scsi_changer.h
src/tests/lib/libcurses: t_curses.sh

Log Message:
fix few typos in comments, mainly in word "parameter".


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libresolv/dst_api.c
cvs rdiff -u -r1.38 -r1.39 src/sys/altq/altq_cbq.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/qat/qatreg.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/scsipi/scsi_changer.h
cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libcurses/t_curses.sh

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

Modified files:

Index: src/lib/libresolv/dst_api.c
diff -u src/lib/libresolv/dst_api.c:1.6 src/lib/libresolv/dst_api.c:1.7
--- src/lib/libresolv/dst_api.c:1.6	Mon Nov  1 21:28:02 2021
+++ src/lib/libresolv/dst_api.c	Fri Dec 31 20:22:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dst_api.c,v 1.6 2021/11/01 21:28:02 andvar Exp $	*/
+/*	$NetBSD: dst_api.c,v 1.7 2021/12/31 20:22:48 andvar Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -40,7 +40,7 @@
 #if 0
 static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 2007/09/24 17:18:25 each Exp ";
 #else
-__RCSID("$NetBSD: dst_api.c,v 1.6 2021/11/01 21:28:02 andvar Exp $");
+__RCSID("$NetBSD: dst_api.c,v 1.7 2021/12/31 20:22:48 andvar Exp $");
 #endif
 
 
@@ -638,7 +638,7 @@ dst_s_write_public_key(const DST_KEY *ke
  *  dst_dnskey_to_public_key
  *	This function converts the contents of a DNS KEY RR into a DST
  *	key structure.
- *  Paramters
+ *  Parameters
  *	len	 Length of the RDATA of the KEY RR RDATA
  *	rdata	 A pointer to the KEY RR RDATA.
  *	in_name Key name to be stored in key structure.

Index: src/sys/altq/altq_cbq.c
diff -u src/sys/altq/altq_cbq.c:1.38 src/sys/altq/altq_cbq.c:1.39
--- src/sys/altq/altq_cbq.c:1.38	Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_cbq.c	Fri Dec 31 20:22:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_cbq.c,v 1.38 2021/09/21 14:30:15 christos Exp $	*/
+/*	$NetBSD: altq_cbq.c,v 1.39 2021/12/31 20:22:48 andvar Exp $	*/
 /*	$KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.38 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.39 2021/12/31 20:22:48 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -696,8 +696,8 @@ cbq_modify_class(struct cbq_modify_class
  *		struct rm_class *parent, struct rm_class *borrow)
  *
  * This function create a new traffic class in the CBQ class hierarchy of
- * given paramters.  The class that created is either the root, default,
- * or a new dynamic class.  If CBQ is not initilaized, the root class
+ * given parameters.  The class that created is either the root, default,
+ * or a new dynamic class.  If CBQ is not initialized, the root class
  * will be created.
  */
 static int

Index: src/sys/dev/pci/qat/qatreg.h
diff -u src/sys/dev/pci/qat/qatreg.h:1.1 src/sys/dev/pci/qat/qatreg.h:1.2
--- src/sys/dev/pci/qat/qatreg.h:1.1	Wed Nov 20 09:37:46 2019
+++ src/sys/dev/pci/qat/qatreg.h	Fri Dec 31 20:22:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qatreg.h,v 1.1 2019/11/20 09:37:46 hikaru Exp $	*/
+/*	$NetBSD: qatreg.h,v 1.2 2021/12/31 20:22:49 andvar Exp $	*/
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -89,7 +89,7 @@
 
 #define AE_ALL_CTX		0xff
 
-/* PCIe configuration space paramter */
+/* PCIe configuration space parameter */
 #define NO_PCI_REG			(-1)
 #define NO_REG_OFFSET			0
 

Index: src/sys/dev/scsipi/scsi_changer.h
diff -u src/sys/dev/scsipi/scsi_changer.h:1.21 src/sys/dev/scsipi/scsi_changer.h:1.22
--- src/sys/dev/scsipi/scsi_changer.h:1.21	Fri Mar  8 08:35:58 2019
+++ src/sys/dev/scsipi/scsi_changer.h	Fri Dec 31 20:22:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsi_changer.h,v 1.21 2019/03/08 08:35:58 msaitoh Exp $	*/
+/*	$NetBSD: scsi_changer.h,v 1.22 2021/12/31 20:22:49 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996, 1999 Jason R. Thorpe 
@@ -288,7 +288,7 @@ struct scsi_send_volume_tag {
 /*	0x0e - 0x1b	reserved */
 /*	0x1c - 0x1f	vendor-specific */
 	u_int8_t	reserved1[2];
-	u_int8_t	length[2];	/* paremeter list length */
+	u_int8_t	length[2];	/* parameter list length */
 	u_int8_t	reserved2;
 	u_int8_t	control;
 };

Index: src/tests/lib/libcurses/t_curses.sh
diff -u src/tests/lib/libcurses/t_curses.sh:1.24 src/tests/lib/libcurses/t_curses.sh:1.25
--- src/tests/lib/libcurses/t_curses.sh:1.24	Sat Aug 21 11:55:26 2021
+++ src/tests/lib/libcurses/t_curses.sh	Fri Dec 31 20:22:49 2021
@@ -9,7 +9,7 @@ h_run()
 		if [ -z "${locale}" ]; then
 			atf_fail "test ${file} failed because locale ${locale} not available"
 		else
-			# export the locale and shift the parametes by two and pass the rest
+			# 

CVS commit: src

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 20:22:49 UTC 2021

Modified Files:
src/lib/libresolv: dst_api.c
src/sys/altq: altq_cbq.c
src/sys/dev/pci/qat: qatreg.h
src/sys/dev/scsipi: scsi_changer.h
src/tests/lib/libcurses: t_curses.sh

Log Message:
fix few typos in comments, mainly in word "parameter".


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libresolv/dst_api.c
cvs rdiff -u -r1.38 -r1.39 src/sys/altq/altq_cbq.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/qat/qatreg.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/scsipi/scsi_changer.h
cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libcurses/t_curses.sh

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



CVS commit: src/distrib/sets

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 17:51:14 UTC 2021

Modified Files:
src/distrib/sets: sets.subr

Log Message:
forgot one @CONFIG@


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/distrib/sets/sets.subr

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



CVS commit: src/distrib/sets

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 17:51:14 UTC 2021

Modified Files:
src/distrib/sets: sets.subr

Log Message:
forgot one @CONFIG@


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/distrib/sets/sets.subr

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

Modified files:

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.200 src/distrib/sets/sets.subr:1.201
--- src/distrib/sets/sets.subr:1.200	Fri Dec 31 11:14:44 2021
+++ src/distrib/sets/sets.subr	Fri Dec 31 12:51:14 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.200 2021/12/31 16:14:44 christos Exp $
+#	$NetBSD: sets.subr,v 1.201 2021/12/31 17:51:14 christos Exp $
 #
 
 #
@@ -192,7 +192,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.200 2021/12/31 16:14:44 christos Exp $
+# 	# $NetBSD: sets.subr,v 1.201 2021/12/31 17:51:14 christos Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -343,7 +343,7 @@ list_set_files()
 l_kmoddbpat = length(kmoddbpat)
 			}
 			if ("debug" in wanted) {
-debugkernelname = "./usr/libdata/debug/netbsd-CONFIG.debug"
+debugkernelname = "./usr/libdata/debug/netbsd-@CONFIG@.debug"
 l_debugkernelname = length(debugkernelname);
 			}
 



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

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:45 UTC 2021

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

Log Message:
drm: Reduce default debug level to driver-specific messages.

Let's make a little less log spew by default with `boot -x'.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/drm2/drm/drm_module.c

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

Modified files:

Index: src/sys/external/bsd/drm2/drm/drm_module.c
diff -u src/sys/external/bsd/drm2/drm/drm_module.c:1.28 src/sys/external/bsd/drm2/drm/drm_module.c:1.29
--- src/sys/external/bsd/drm2/drm/drm_module.c:1.28	Sun Dec 19 12:43:37 2021
+++ src/sys/external/bsd/drm2/drm/drm_module.c	Fri Dec 31 17:22:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_module.c,v 1.28 2021/12/19 12:43:37 riastradh Exp $	*/
+/*	$NetBSD: drm_module.c,v 1.29 2021/12/31 17:22:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.28 2021/12/19 12:43:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.29 2021/12/31 17:22:45 riastradh Exp $");
 
 #include 
 #include 
@@ -124,7 +124,7 @@ drm_init(void)
 #endif
 
 	if (ISSET(boothowto, AB_DEBUG))
-		__drm_debug = DRM_UT_CORE | DRM_UT_DRIVER | DRM_UT_KMS | DRM_UT_ATOMIC;
+		__drm_debug = DRM_UT_DRIVER;
 
 	spin_lock_init(_minor_lock);
 	idr_init(_minors_idr);



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

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:45 UTC 2021

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

Log Message:
drm: Reduce default debug level to driver-specific messages.

Let's make a little less log spew by default with `boot -x'.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/drm2/drm/drm_module.c

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:35 UTC 2021

Modified Files:
src/sys/dev/acpi: thinkpad_acpi.c

Log Message:
thinkpad(4): Omit workaround for acpiec_bus_read.

acpiec_bus_read now initializes the whole ACPI_INTEGER like its
signature suggests, so we don't need to pick out the low bits of the
result or carefully avoid undefined behaviour from uninitialized
stack garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/acpi/thinkpad_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/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.53 src/sys/dev/acpi/thinkpad_acpi.c:1.54
--- src/sys/dev/acpi/thinkpad_acpi.c:1.53	Sun May 30 11:24:10 2021
+++ src/sys/dev/acpi/thinkpad_acpi.c	Fri Dec 31 17:22:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.53 2021/05/30 11:24:10 riastradh Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.54 2021/12/31 17:22:35 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.53 2021/05/30 11:24:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.54 2021/12/31 17:22:35 riastradh Exp $");
 
 #include 
 #include 
@@ -803,12 +803,6 @@ thinkpad_fan_refresh(struct sysmon_envsy
 		return;
 	}
 
-	/*
-	 * Extract the low bytes from buffers
-	 */
-	lo = ((uint8_t *))[0];
-	hi = ((uint8_t *))[0];
-
 	rpm = int)hi) << 8) | ((int)lo));
 	if (rpm < 0) {
 		edata->state = ENVSYS_SINVALID;



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:35 UTC 2021

Modified Files:
src/sys/dev/acpi: thinkpad_acpi.c

Log Message:
thinkpad(4): Omit workaround for acpiec_bus_read.

acpiec_bus_read now initializes the whole ACPI_INTEGER like its
signature suggests, so we don't need to pick out the low bits of the
result or carefully avoid undefined behaviour from uninitialized
stack garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/acpi/thinkpad_acpi.c

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:25 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_ec.c

Log Message:
acpiec(4): Make sure to fully initialize an ACPI_INTEGER on read.

Write as essay about what this is supposed to do, as far as I can
tell from reading acpica and the commit history and the relevant PR.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/acpi/acpi_ec.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_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.85 src/sys/dev/acpi/acpi_ec.c:1.86
--- src/sys/dev/acpi/acpi_ec.c:1.85	Fri Jan 29 15:49:55 2021
+++ src/sys/dev/acpi/acpi_ec.c	Fri Dec 31 17:22:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.85 2021/01/29 15:49:55 thorpej Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.86 2021/12/31 17:22:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.85 2021/01/29 15:49:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.86 2021/12/31 17:22:25 riastradh Exp $");
 
 #include 
 #include 
@@ -655,6 +655,38 @@ done:
 	return AE_OK;
 }
 
+/*
+ * acpiec_space_handler(func, paddr, bitwidth, value, arg, region_arg)
+ *
+ *	Transfer bitwidth/8 bytes of data between paddr and *value:
+ *	from paddr to *value when func is ACPI_READ, and the other way
+ *	when func is ACPI_WRITE.  arg is the acpiec(4) or acpiecdt(4)
+ *	device.  region_arg is ignored (XXX why? determined by
+ *	acpiec_space_setup but never used by anything that I can see).
+ *
+ *	The caller always provides storage at *value large enough for
+ *	an ACPI_INTEGER object, i.e., a 64-bit integer.  However,
+ *	bitwidth may be larger; in this case the caller provides larger
+ *	storage at *value, e.g. 128 bits as documented in
+ *	.
+ *
+ *	On reads, this fully initializes one ACPI_INTEGER's worth of
+ *	data at *value, even if bitwidth < 64.  The integer is
+ *	interpreted in host byte order; in other words, bytes of data
+ *	are transferred in order between paddr and (uint8_t *)value.
+ *	The transfer is not atomic; it may go byte-by-byte.
+ *
+ *	XXX This only really makes sense on little-endian systems.
+ *	E.g., thinkpad_acpi.c assumes that a single byte is transferred
+ *	in the low-order bits of the result.  A big-endian system could
+ *	read a 64-bit integer in big-endian (and it did for a while!),
+ *	but what should it do for larger reads?  Unclear!
+ *
+ *	XXX It's not clear whether the object at *value is always
+ *	_aligned_ adequately for an ACPI_INTEGER object.  Currently it
+ *	always is as long as malloc, used by AcpiOsAllocate, returns
+ *	64-bit-aligned data.
+ */
 static ACPI_STATUS
 acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr,
 uint32_t width, ACPI_INTEGER *value, void *arg, void *region_arg)
@@ -681,6 +713,12 @@ acpiec_space_handler(uint32_t func, ACPI
 			if (rv != AE_OK)
 break;
 		}
+		/*
+		 * Make sure to fully initialize at least an
+		 * ACPI_INTEGER-sized object.
+		 */
+		for (; i < sizeof(*value)*8; i += 8, ++buf)
+			*buf = 0;
 		break;
 	case ACPI_WRITE:
 		for (i = 0; i < width; i += 8, ++addr, ++buf) {



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:25 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_ec.c

Log Message:
acpiec(4): Make sure to fully initialize an ACPI_INTEGER on read.

Write as essay about what this is supposed to do, as far as I can
tell from reading acpica and the commit history and the relevant PR.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/acpi/acpi_ec.c

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



CVS commit: src/sys/dev/acpi/acpica

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:15 UTC 2021

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
acpi(9): Return full 64-bit object to caller in PCI config read.

The value of the object will be as small as requested, but the whole
uint64_t object will be written as the caller of a space handler
expects, instead of just part of it.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpica/OsdHardware.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/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.12 src/sys/dev/acpi/acpica/OsdHardware.c:1.13
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.12	Fri Jan 17 17:06:33 2020
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Fri Dec 31 17:22:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.12 2020/01/17 17:06:33 jmcneill Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.13 2021/12/31 17:22:15 riastradh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.12 2020/01/17 17:06:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.13 2021/12/31 17:22:15 riastradh Exp $");
 
 #include 
 #include 
@@ -224,15 +224,15 @@ AcpiOsReadPciConfiguration(ACPI_PCI_ID *
 
 	switch (Width) {
 	case 8:
-		*(uint8_t *) Value = (tmp >> ((Register & 3) * 8)) & 0xff;
+		*Value = (tmp >> ((Register & 3) * 8)) & 0xff;
 		break;
 
 	case 16:
-		*(uint16_t *) Value = (tmp >> ((Register & 3) * 8)) & 0x;
+		*Value = (tmp >> ((Register & 3) * 8)) & 0x;
 		break;
 
 	case 32:
-		*(uint32_t *) Value = tmp;
+		*Value = tmp;
 		break;
 
 	default:



CVS commit: src/sys/dev/acpi/acpica

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 17:22:15 UTC 2021

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
acpi(9): Return full 64-bit object to caller in PCI config read.

The value of the object will be as small as requested, but the whole
uint64_t object will be written as the caller of a space handler
expects, instead of just part of it.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpica/OsdHardware.c

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



CVS commit: src/distrib/i386/installimage

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:43:04 UTC 2021

Modified Files:
src/distrib/i386/installimage: Makefile

Log Message:
Grow to fit debug kernels


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/distrib/i386/installimage/Makefile

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

Modified files:

Index: src/distrib/i386/installimage/Makefile
diff -u src/distrib/i386/installimage/Makefile:1.21 src/distrib/i386/installimage/Makefile:1.22
--- src/distrib/i386/installimage/Makefile:1.21	Mon May 31 03:59:02 2021
+++ src/distrib/i386/installimage/Makefile	Fri Dec 31 11:43:04 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.21 2021/05/31 07:59:02 martin Exp $
+#	$NetBSD: Makefile,v 1.22 2021/12/31 16:43:04 christos Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-i386-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	2100			# for all installation binaries
+INSTIMAGEMB?=	3000			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot



CVS commit: src/distrib/i386/installimage

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:43:04 UTC 2021

Modified Files:
src/distrib/i386/installimage: Makefile

Log Message:
Grow to fit debug kernels


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/distrib/i386/installimage/Makefile

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



CVS commit: src/distrib/evbarm/installimage

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:40:59 UTC 2021

Modified Files:
src/distrib/evbarm/installimage: Makefile

Log Message:
Grow a little


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/evbarm/installimage/Makefile

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

Modified files:

Index: src/distrib/evbarm/installimage/Makefile
diff -u src/distrib/evbarm/installimage/Makefile:1.9 src/distrib/evbarm/installimage/Makefile:1.10
--- src/distrib/evbarm/installimage/Makefile:1.9	Wed Sep  8 07:20:44 2021
+++ src/distrib/evbarm/installimage/Makefile	Fri Dec 31 11:40:59 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.9 2021/09/08 11:20:44 christos Exp $
+#	$NetBSD: Makefile,v 1.10 2021/12/31 16:40:59 christos Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-evbarm-${MACHINE_ARCH}-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	1600			# for all installation binaries
+INSTIMAGEMB?=	1650			# for all installation binaries
 
 .if !empty(MACHINE_ARCH:Maarch64*)
 EFIBOOT=		${WORKDIR}/usr/mdec/bootaa64.efi



CVS commit: src/distrib/evbarm/installimage

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:40:59 UTC 2021

Modified Files:
src/distrib/evbarm/installimage: Makefile

Log Message:
Grow a little


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/evbarm/installimage/Makefile

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



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

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:15:58 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: md.pmax
Added Files:
src/distrib/sets/lists/debug: ad.earmv5 ad.earmv5eb ad.mips64eb
ad.mips64el ad.mipseb ad.mipsel ad.mipsn64eb ad.mipsn64el md.emips
md.evbppc

Log Message:
Add kernel debug files.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/debug/ad.earmv5 \
src/distrib/sets/lists/debug/ad.earmv5eb \
src/distrib/sets/lists/debug/ad.mipseb \
src/distrib/sets/lists/debug/ad.mipsel \
src/distrib/sets/lists/debug/ad.mipsn64eb \
src/distrib/sets/lists/debug/ad.mipsn64el \
src/distrib/sets/lists/debug/md.emips \
src/distrib/sets/lists/debug/md.evbppc
cvs rdiff -u -r0 -r1.24 src/distrib/sets/lists/debug/ad.mips64eb
cvs rdiff -u -r0 -r1.25 src/distrib/sets/lists/debug/ad.mips64el
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/debug/md.pmax

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

Modified files:

Index: src/distrib/sets/lists/debug/md.pmax
diff -u src/distrib/sets/lists/debug/md.pmax:1.2 src/distrib/sets/lists/debug/md.pmax:1.3
--- src/distrib/sets/lists/debug/md.pmax:1.2	Wed Jan 16 16:11:09 2013
+++ src/distrib/sets/lists/debug/md.pmax	Fri Dec 31 11:15:58 2021
@@ -1 +1,3 @@
-# $NetBSD: md.pmax,v 1.2 2013/01/16 21:11:09 christos Exp $
+# $NetBSD: md.pmax,v 1.3 2021/12/31 16:15:58 christos Exp $
+./usr/libdata/debug/nfsnetbsd-GENERIC.debug	comp-sysutil-debug	debug
+./usr/libdata/debug/nfsnetbsd-INSTALL.debug	comp-sysutil-debug	debug

Added files:

Index: src/distrib/sets/lists/debug/ad.earmv5
diff -u /dev/null src/distrib/sets/lists/debug/ad.earmv5:1.1
--- /dev/null	Fri Dec 31 11:15:58 2021
+++ src/distrib/sets/lists/debug/ad.earmv5	Fri Dec 31 11:15:58 2021
@@ -0,0 +1,24 @@
+# $NetBSD: ad.earmv5,v 1.1 2021/12/31 16:15:58 christos Exp $
+./usr/libdata/debug/netbsd-fxp0-ADI_BRH.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-fxp0-IQ80310.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-mvgbe0-MV2120.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-ne0-TWINTAIL.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sd0-ADI_BRH.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sd0-CP3100.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sd0-IQ80310.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sd0-IQ80321.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sd0-TEAMASA_NPWR.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sm0-GUMSTIX.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-smsh0-GUMSTIX.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-ADI_BRH.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-CP3100.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-IQ80310.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-IQ80321.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-KUROBOX_PRO.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0e-MV2120.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0f-MV2120.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0g-MV2120.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0h-MV2120.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wm0-CP3100.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wm0-IQ80321.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wm0-TEAMASA_NPWR.debug	comp-sysutils-debug	debug
Index: src/distrib/sets/lists/debug/ad.earmv5eb
diff -u /dev/null src/distrib/sets/lists/debug/ad.earmv5eb:1.1
--- /dev/null	Fri Dec 31 11:15:58 2021
+++ src/distrib/sets/lists/debug/ad.earmv5eb	Fri Dec 31 11:15:58 2021
@@ -0,0 +1,5 @@
+# $NetBSD: ad.earmv5eb,v 1.1 2021/12/31 16:15:58 christos Exp $
+./usr/libdata/debug/netbsd-fxp0-ADI_BRH.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-sd0-ADI_BRH.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-ADI_BRH.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-wd0-KUROBOX_PRO.debug	comp-sysutils-debug	debug
Index: src/distrib/sets/lists/debug/ad.mipseb
diff -u /dev/null src/distrib/sets/lists/debug/ad.mipseb:1.1
--- /dev/null	Fri Dec 31 11:15:58 2021
+++ src/distrib/sets/lists/debug/ad.mipseb	Fri Dec 31 11:15:58 2021
@@ -0,0 +1,4 @@
+# $NetBSD: ad.mipseb,v 1.1 2021/12/31 16:15:58 christos Exp $
+./usr/libdata/debug/netbsd-aumac0-ALCHEMY.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-aumac0-DBAU1500.debug	comp-sysutils-debug	debug
+./usr/libdata/debug/netbsd-aumac0-DBAU1550.debug	comp-sysutils-debug	debug
Index: src/distrib/sets/lists/debug/ad.mipsel
diff -u /dev/null src/distrib/sets/lists/debug/ad.mipsel:1.1
--- /dev/null	Fri Dec 31 11:15:58 2021
+++ src/distrib/sets/lists/debug/ad.mipsel	Fri Dec 31 11:15:58 2021
@@ -0,0 +1,9 @@
+# 

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

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:15:58 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: md.pmax
Added Files:
src/distrib/sets/lists/debug: ad.earmv5 ad.earmv5eb ad.mips64eb
ad.mips64el ad.mipseb ad.mipsel ad.mipsn64eb ad.mipsn64el md.emips
md.evbppc

Log Message:
Add kernel debug files.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/debug/ad.earmv5 \
src/distrib/sets/lists/debug/ad.earmv5eb \
src/distrib/sets/lists/debug/ad.mipseb \
src/distrib/sets/lists/debug/ad.mipsel \
src/distrib/sets/lists/debug/ad.mipsn64eb \
src/distrib/sets/lists/debug/ad.mipsn64el \
src/distrib/sets/lists/debug/md.emips \
src/distrib/sets/lists/debug/md.evbppc
cvs rdiff -u -r0 -r1.24 src/distrib/sets/lists/debug/ad.mips64eb
cvs rdiff -u -r0 -r1.25 src/distrib/sets/lists/debug/ad.mips64el
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/debug/md.pmax

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



CVS commit: src/distrib/sets

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:14:44 UTC 2021

Modified Files:
src/distrib/sets: sets.subr
src/distrib/sets/lists/debug: mi

Log Message:
change CONFIG to @CONFIG@ to indicate substitution is going to happen.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/distrib/sets/sets.subr
cvs rdiff -u -r1.370 -r1.371 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.199 src/distrib/sets/sets.subr:1.200
--- src/distrib/sets/sets.subr:1.199	Wed Dec 29 21:30:53 2021
+++ src/distrib/sets/sets.subr	Fri Dec 31 11:14:44 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.199 2021/12/30 02:30:53 christos Exp $
+#	$NetBSD: sets.subr,v 1.200 2021/12/31 16:14:44 christos Exp $
 #
 
 #
@@ -192,7 +192,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.199 2021/12/30 02:30:53 christos Exp $
+# 	# $NetBSD: sets.subr,v 1.200 2021/12/31 16:14:44 christos Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -284,9 +284,9 @@ list_set_files()
 			split("'"${CONFIGS}"'", configs)
 			for (d in configs) {
 xfname = fname
-sub("CONFIG", configs[d], xfname)
+sub("@CONFIG@", configs[d], xfname)
 xline = line;
-sub("CONFIG", configs[d], xline)
+sub("@CONFIG@", configs[d], xline)
 list[xline] = xfname
 			}
 			return 1

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.370 src/distrib/sets/lists/debug/mi:1.371
--- src/distrib/sets/lists/debug/mi:1.370	Wed Dec 29 17:22:13 2021
+++ src/distrib/sets/lists/debug/mi	Fri Dec 31 11:14:44 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.370 2021/12/29 22:22:13 christos Exp $
+# $NetBSD: mi,v 1.371 2021/12/31 16:14:44 christos Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -325,7 +325,7 @@
 ./usr/libdata/debug/bin/test.debug		comp-util-debug		debug
 ./usr/libdata/debug/libexec/lfs_cleanerd.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/netbsd			comp-sysutil-debug	debug,kernel_dir
-./usr/libdata/debug/netbsd-CONFIG.debug		comp-sysutil-debug	debug
+./usr/libdata/debug/netbsd-@CONFIG@.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/amrctl.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/apmlabel.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/atactl.debug		comp-sysutil-debug	debug



CVS commit: src/distrib/sets

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 16:14:44 UTC 2021

Modified Files:
src/distrib/sets: sets.subr
src/distrib/sets/lists/debug: mi

Log Message:
change CONFIG to @CONFIG@ to indicate substitution is going to happen.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/distrib/sets/sets.subr
cvs rdiff -u -r1.370 -r1.371 src/distrib/sets/lists/debug/mi

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



CVS commit: src

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 15:43:35 UTC 2021

Modified Files:
src: build.sh

Log Message:
Don't try to install netbsd-CONFIG.debug files build with kernel=


To generate a diff of this commit:
cvs rdiff -u -r1.360 -r1.361 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.360 src/build.sh:1.361
--- src/build.sh:1.360	Wed Dec 29 17:22:12 2021
+++ src/build.sh	Fri Dec 31 10:43:35 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.360 2021/12/29 22:22:12 christos Exp $
+#	$NetBSD: build.sh,v 1.361 2021/12/31 15:43:35 christos Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1974,7 +1974,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src

2021-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 31 15:43:35 UTC 2021

Modified Files:
src: build.sh

Log Message:
Don't try to install netbsd-CONFIG.debug files build with kernel=


To generate a diff of this commit:
cvs rdiff -u -r1.360 -r1.361 src/build.sh

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



CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:44:50 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmonvar.h

Log Message:
sysmon(9): Document lock order.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sysmon/sysmonvar.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/sysmon/sysmonvar.h
diff -u src/sys/dev/sysmon/sysmonvar.h:1.52 src/sys/dev/sysmon/sysmonvar.h:1.53
--- src/sys/dev/sysmon/sysmonvar.h:1.52	Fri Dec 31 14:30:04 2021
+++ src/sys/dev/sysmon/sysmonvar.h	Fri Dec 31 14:44:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmonvar.h,v 1.52 2021/12/31 14:30:04 riastradh Exp $	*/
+/*	$NetBSD: sysmonvar.h,v 1.53 2021/12/31 14:44:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -217,6 +217,8 @@ struct sysmon_envsys {
 
 	/*
 	 * Locking/synchronization.
+	 *
+	 * Lock order: sme_global_mtx -> sme_mtx -> sme_work_mtx
 	 */
 	int sme_busy;			/* number of items on workqueue,
 	 * sme_work_mtx to read or write */



CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:44:50 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmonvar.h

Log Message:
sysmon(9): Document lock order.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sysmon/sysmonvar.h

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



CVS commit: src/sys/external/bsd/common/linux

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:30:20 UTC 2021

Modified Files:
src/sys/external/bsd/common/linux: linux_work.c

Log Message:
drm: Convert noisy flush_workqueue message to dtrace probe.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/external/bsd/common/linux/linux_work.c

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

Modified files:

Index: src/sys/external/bsd/common/linux/linux_work.c
diff -u src/sys/external/bsd/common/linux/linux_work.c:1.59 src/sys/external/bsd/common/linux/linux_work.c:1.60
--- src/sys/external/bsd/common/linux/linux_work.c:1.59	Sun Dec 19 12:27:39 2021
+++ src/sys/external/bsd/common/linux/linux_work.c	Fri Dec 31 14:30:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.59 2021/12/19 12:27:39 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.60 2021/12/31 14:30:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.59 2021/12/19 12:27:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.60 2021/12/31 14:30:20 riastradh Exp $");
 
 #include 
 #include 
@@ -113,6 +113,8 @@ SDT_PROBE_DEFINE1(sdt, linux, work, batc
 "struct workqueue_struct *"/*wq*/);
 SDT_PROBE_DEFINE1(sdt, linux, work, batch__done,
 "struct workqueue_struct *"/*wq*/);
+SDT_PROBE_DEFINE1(sdt, linux, work, flush__self,
+"struct workqueue_struct *"/*wq*/);
 SDT_PROBE_DEFINE1(sdt, linux, work, flush__start,
 "struct workqueue_struct *"/*wq*/);
 SDT_PROBE_DEFINE1(sdt, linux, work, flush__done,
@@ -1458,8 +1460,7 @@ flush_workqueue(struct workqueue_struct 
 	struct flush_work fw;
 
 	if (lwp_getspecific(workqueue_key) == wq) {
-		aprint_debug("%s: running from workqueue %s\n", __func__,
-		wq->wq_name);
+		SDT_PROBE1(sdt, linux, work, flush__self,  wq);
 		return;
 	}
 



CVS commit: src/sys/external/bsd/common/linux

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:30:20 UTC 2021

Modified Files:
src/sys/external/bsd/common/linux: linux_work.c

Log Message:
drm: Convert noisy flush_workqueue message to dtrace probe.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/external/bsd/common/linux/linux_work.c

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



CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:30:04 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c sysmon_envsys_events.c sysmonvar.h

Log Message:
sysmon(9): Fix callout/thread synchronization.

Callout may ONLY take sme_work_mtx, at IPL_SOFTCLOCK; MUST NOT touch
sme_mtx at IPL_NONE.  All state the callout needs is serialized by
sme_work_mtx now:

- calls to sme_schedule_callout
- calls to sme_schedule_halt
- struct sysmon_envsys::sme_events_timeout
- struct sysmon_envsys::sme_events_list
- struct sysmon_envsys::sme_callout_state
- struct envsys_data::flags
  => yes, this is a little silly -- used for ENVSYS_FNEED_REFRESH
  => should maybe separate the static driver-defined features from
 the state flags needed by sysmon_envsys but not important now

Sleeping under sme_work_mtx (except on other adaptive locks at
IPL_SOFTCLOCK) is forbidden.  Calling out to the driver under
sme_work_mtx is forbidden.

This should properly fix:

https://mail-index.netbsd.org/tech-kern/2015/10/14/msg019511.html
PR kern/56592


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/sysmon/sysmonvar.h

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



CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:30:04 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c sysmon_envsys_events.c sysmonvar.h

Log Message:
sysmon(9): Fix callout/thread synchronization.

Callout may ONLY take sme_work_mtx, at IPL_SOFTCLOCK; MUST NOT touch
sme_mtx at IPL_NONE.  All state the callout needs is serialized by
sme_work_mtx now:

- calls to sme_schedule_callout
- calls to sme_schedule_halt
- struct sysmon_envsys::sme_events_timeout
- struct sysmon_envsys::sme_events_list
- struct sysmon_envsys::sme_callout_state
- struct envsys_data::flags
  => yes, this is a little silly -- used for ENVSYS_FNEED_REFRESH
  => should maybe separate the static driver-defined features from
 the state flags needed by sysmon_envsys but not important now

Sleeping under sme_work_mtx (except on other adaptive locks at
IPL_SOFTCLOCK) is forbidden.  Calling out to the driver under
sme_work_mtx is forbidden.

This should properly fix:

https://mail-index.netbsd.org/tech-kern/2015/10/14/msg019511.html
PR kern/56592


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/sysmon/sysmonvar.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.149 src/sys/dev/sysmon/sysmon_envsys.c:1.150
--- src/sys/dev/sysmon/sysmon_envsys.c:1.149	Fri Dec 31 11:05:41 2021
+++ src/sys/dev/sysmon/sysmon_envsys.c	Fri Dec 31 14:30:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.149 2021/12/31 11:05:41 riastradh Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.150 2021/12/31 14:30:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.149 2021/12/31 11:05:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.150 2021/12/31 14:30:04 riastradh Exp $");
 
 #include 
 #include 
@@ -531,7 +531,7 @@ sysmon_envsys_create(void)
 	TAILQ_INIT(>sme_sensors_list);
 	LIST_INIT(>sme_events_list);
 	mutex_init(>sme_mtx, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sme_work_mtx, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sme_work_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK);
 	cv_init(>sme_condvar, "sme_wait");
 
 	return sme;
@@ -655,11 +655,13 @@ sysmon_envsys_sensor_detach(struct sysmo
 	if (oedata->flags & ENVSYS_FHAS_ENTROPY)
 		rnd_detach_source(>rnd_src);
 	sme_event_unregister_sensor(sme, edata);
+	mutex_enter(>sme_work_mtx);
 	if (LIST_EMPTY(>sme_events_list)) {
 		if (sme->sme_callout_state == SME_CALLOUT_READY)
 			sme_events_halt_callout(sme);
 		destroy = true;
 	}
+	mutex_exit(>sme_work_mtx);
 	TAILQ_REMOVE(>sme_sensors_list, edata, sensors_head);
 	sme->sme_nsensors--;
 	sysmon_envsys_release(sme, true);
@@ -1324,18 +1326,12 @@ sme_remove_userprops(void)
 		/*
 		 * Restore default timeout value.
 		 */
+		mutex_enter(>sme_work_mtx);
 		sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT;
-
-		/*
-		 * Note that we need to hold the sme_mtx while calling
-		 * sme_schedule_callout().  Thus to avoid dropping,
-		 * reacquiring, and dropping it again, we just tell
-		 * sme_envsys_release() that the mutex is already owned.
-		 */
-		mutex_enter(>sme_mtx);
 		sme_schedule_callout(sme);
-		sysmon_envsys_release(sme, true);
-		mutex_exit(>sme_mtx);
+		mutex_exit(>sme_work_mtx);
+
+		sysmon_envsys_release(sme, false);
 	}
 	mutex_exit(_global_mtx);
 }
@@ -1350,6 +1346,7 @@ sme_add_property_dictionary(struct sysmo
 			prop_dictionary_t dict)
 {
 	prop_dictionary_t pdict;
+	uint64_t timo;
 	const char *class;
 	int error = 0;
 
@@ -1374,15 +1371,15 @@ sme_add_property_dictionary(struct sysmo
 	 * 	...
 	 *
 	 */
+	mutex_enter(>sme_work_mtx);
 	if (sme->sme_events_timeout == 0) {
 		sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT;
-		mutex_enter(>sme_mtx);
 		sme_schedule_callout(sme);
-		mutex_exit(>sme_mtx);
 	}
+	timo = sme->sme_events_timeout;
+	mutex_exit(>sme_work_mtx);
 
-	if (!prop_dictionary_set_uint64(pdict, "refresh-timeout",
-	sme->sme_events_timeout)) {
+	if (!prop_dictionary_set_uint64(pdict, "refresh-timeout", timo)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -1606,6 +1603,7 @@ sme_update_dictionary(struct sysmon_envs
 {
 	envsys_data_t *edata;
 	prop_object_t array, dict, obj, obj2;
+	uint64_t timo;
 	int error = 0;
 
 	/*
@@ -1634,8 +1632,10 @@ sme_update_dictionary(struct sysmon_envs
 	/*
 	 * Update the 'refresh-timeout' property.
 	 */
-	if (!prop_dictionary_set_uint64(obj2, "refresh-timeout",
-	sme->sme_events_timeout))
+	mutex_enter(>sme_work_mtx);
+	timo = sme->sme_events_timeout;
+	mutex_exit(>sme_work_mtx);
+	if (!prop_dictionary_set_uint64(obj2, "refresh-timeout", timo))
 		return EINVAL;
 
 	/*
@@ -1852,12 +1852,12 @@ 

CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:29:14 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmon_taskq.c

Log Message:
sysmon(9): Fix mistake in sysmon_task_queue_barrier.

Need to allocate the task structure with malloc(9), not on the stack;
the task thread will free it with free(9).  Forgot to squash this
into previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sysmon/sysmon_taskq.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/sysmon/sysmon_taskq.c
diff -u src/sys/dev/sysmon/sysmon_taskq.c:1.22 src/sys/dev/sysmon/sysmon_taskq.c:1.23
--- src/sys/dev/sysmon/sysmon_taskq.c:1.22	Fri Dec 31 14:22:11 2021
+++ src/sys/dev/sysmon/sysmon_taskq.c	Fri Dec 31 14:29:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_taskq.c,v 1.22 2021/12/31 14:22:11 riastradh Exp $	*/
+/*	$NetBSD: sysmon_taskq.c,v 1.23 2021/12/31 14:29:14 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_taskq.c,v 1.22 2021/12/31 14:22:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_taskq.c,v 1.23 2021/12/31 14:29:14 riastradh Exp $");
 
 #include 
 #include 
@@ -280,7 +280,7 @@ tqbarrier_task(void *cookie)
 void
 sysmon_task_queue_barrier(u_int pri)
 {
-	struct sysmon_task st;
+	struct sysmon_task *st;
 	struct tqbarrier bar;
 
 	(void)RUN_ONCE(_tq, tq_preinit);
@@ -292,11 +292,12 @@ sysmon_task_queue_barrier(u_int pri)
 	cv_init(, "sysmontq");
 	bar.done = false;
 
-	st.st_func = _task;
-	st.st_arg = 
-	st.st_pri = pri;
+	st = malloc(sizeof(*st), M_TEMP, M_WAITOK);
+	st->st_func = _task;
+	st->st_arg = 
+	st->st_pri = pri;
 
-	sysmon_task_queue_sched_task();
+	sysmon_task_queue_sched_task(st);
 
 	mutex_enter();
 	while (!bar.done)



CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:29:14 UTC 2021

Modified Files:
src/sys/dev/sysmon: sysmon_taskq.c

Log Message:
sysmon(9): Fix mistake in sysmon_task_queue_barrier.

Need to allocate the task structure with malloc(9), not on the stack;
the task thread will free it with free(9).  Forgot to squash this
into previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sysmon/sysmon_taskq.c

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



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:26:29 UTC 2021

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

Log Message:
sys/net: Document if_mcast_op with comment and refuse other commands.

Meant only for multicast addition/deletion operations, nothing else.


To generate a diff of this commit:
cvs rdiff -u -r1.500 -r1.501 src/sys/net/if.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.c
diff -u src/sys/net/if.c:1.500 src/sys/net/if.c:1.501
--- src/sys/net/if.c:1.500	Fri Dec 31 14:26:19 2021
+++ src/sys/net/if.c	Fri Dec 31 14:26:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.500 2021/12/31 14:26:19 riastradh Exp $	*/
+/*	$NetBSD: if.c,v 1.501 2021/12/31 14:26:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.500 2021/12/31 14:26:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.501 2021/12/31 14:26:29 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3879,12 +3879,31 @@ if_flags_set(ifnet_t *ifp, const u_short
 	return rc;
 }
 
+/*
+ * if_mcast_op(ifp, cmd, sa)
+ *
+ *	Apply a multicast command, SIOCADDMULTI/SIOCDELMULTI, to the
+ *	interface.  Returns 0 on success, nonzero errno(3) number on
+ *	failure.
+ *
+ *	May sleep.
+ *
+ *	Use this, not if_ioctl, for the multicast commands.
+ */
 int
 if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa)
 {
 	int rc;
 	struct ifreq ifr;
 
+	switch (cmd) {
+	case SIOCADDMULTI:
+	case SIOCDELMULTI:
+		break;
+	default:
+		panic("invalid ifnet multicast command: 0x%lx", cmd);
+	}
+
 	ifreq_setaddr(cmd, , sa);
 	rc = if_ioctl(ifp, cmd, );
 



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:26:29 UTC 2021

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

Log Message:
sys/net: Document if_mcast_op with comment and refuse other commands.

Meant only for multicast addition/deletion operations, nothing else.


To generate a diff of this commit:
cvs rdiff -u -r1.500 -r1.501 src/sys/net/if.c

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



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:26:19 UTC 2021

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

Log Message:
sys/net: Document if_flags_set with a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.499 -r1.500 src/sys/net/if.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.c
diff -u src/sys/net/if.c:1.499 src/sys/net/if.c:1.500
--- src/sys/net/if.c:1.499	Fri Dec 31 14:25:58 2021
+++ src/sys/net/if.c	Fri Dec 31 14:26:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.499 2021/12/31 14:25:58 riastradh Exp $	*/
+/*	$NetBSD: if.c,v 1.500 2021/12/31 14:26:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.499 2021/12/31 14:25:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.500 2021/12/31 14:26:19 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3832,6 +3832,15 @@ if_do_dad(struct ifnet *ifp)
 	}
 }
 
+/*
+ * if_flags_set(ifp, flags)
+ *
+ *	Ask ifp to change ifp->if_flags to flags, as if with the
+ *	SIOCSIFFLAGS ioctl command.
+ *
+ *	May sleep.  Caller must hold ifp->if_ioctl_lock, a.k.a
+ *	IFNET_LOCK.
+ */
 int
 if_flags_set(ifnet_t *ifp, const u_short flags)
 {



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:26:19 UTC 2021

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

Log Message:
sys/net: Document if_flags_set with a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.499 -r1.500 src/sys/net/if.c

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



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:26:09 UTC 2021

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

Log Message:
ethersubr(9): Assert IFNET_LOCKED in ether_ioctl_reinit.

Changes to if_flags are nontrivial configuration changes that require
the long-term ioctl lock.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.309 src/sys/net/if_ethersubr.c:1.310
--- src/sys/net/if_ethersubr.c:1.309	Fri Dec 31 14:25:24 2021
+++ src/sys/net/if_ethersubr.c	Fri Dec 31 14:26:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.309 2021/12/31 14:25:24 riastradh Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.310 2021/12/31 14:26:09 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.309 2021/12/31 14:25:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.310 2021/12/31 14:26:09 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1455,6 +1455,8 @@ ether_ioctl_reinit(struct ethercom *ec)
 	struct ifnet *ifp = >ec_if;
 	int error;
 
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
+
 	switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
 	case IFF_RUNNING:
 		/*



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:26:09 UTC 2021

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

Log Message:
ethersubr(9): Assert IFNET_LOCKED in ether_ioctl_reinit.

Changes to if_flags are nontrivial configuration changes that require
the long-term ioctl lock.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/net/if_ethersubr.c

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



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:25:59 UTC 2021

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

Log Message:
sys/net: Assert IFNET_LOCKED in if_ioctl, if_init, and if_stop.

Exception: Not for SIOCADDMULTI/SIOCDELMULTI, for which it is the
driver's responsibility to take internal locks.  Typically this is
already done via struct ethercom::ec_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.498 -r1.499 src/sys/net/if.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.c
diff -u src/sys/net/if.c:1.498 src/sys/net/if.c:1.499
--- src/sys/net/if.c:1.498	Fri Dec 31 14:24:50 2021
+++ src/sys/net/if.c	Fri Dec 31 14:25:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.498 2021/12/31 14:24:50 riastradh Exp $	*/
+/*	$NetBSD: if.c,v 1.499 2021/12/31 14:25:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.498 2021/12/31 14:24:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.499 2021/12/31 14:25:58 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2733,13 +2733,25 @@ ifpromisc(struct ifnet *ifp, int pswitch
  *	Apply an ioctl command to the interface.  Returns 0 on success,
  *	nonzero errno(3) number on failure.
  *
- *	May sleep.  Caller must hold ifp->if_ioctl_lock.
+ *	For SIOCADDMULTI/SIOCDELMULTI, caller need not hold locks -- it
+ *	is the driver's responsibility to take any internal locks.
+ *	(Kernel logic should generally invoke these only through
+ *	if_mcast_op.)
+ *
+ *	For all other ioctls, caller must hold ifp->if_ioctl_lock,
+ *	a.k.a. IFNET_LOCK.  May sleep.
  */
 int
 if_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 
-	KASSERT(1 || IFNET_LOCKED(ifp));	/* XXX not yet */
+	switch (cmd) {
+	case SIOCADDMULTI:
+	case SIOCDELMULTI:
+		break;
+	default:
+		KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
+	}
 
 	return (*ifp->if_ioctl)(ifp, cmd, data);
 }
@@ -2758,7 +2770,7 @@ int
 if_init(struct ifnet *ifp)
 {
 
-	KASSERT(1 || IFNET_LOCKED(ifp));	/* XXX not yet */
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 
 	return (*ifp->if_init)(ifp);
 }
@@ -2777,7 +2789,7 @@ void
 if_stop(struct ifnet *ifp, int disable)
 {
 
-	KASSERT(1 || IFNET_LOCKED(ifp));	/* XXX not yet */
+	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 
 	(*ifp->if_stop)(ifp, disable);
 }
@@ -3864,11 +3876,6 @@ if_mcast_op(ifnet_t *ifp, const unsigned
 	int rc;
 	struct ifreq ifr;
 
-	/*
-	 * XXX NOMPSAFE - this calls if_ioctl without holding IFNET_LOCK()
-	 * in some cases - e.g. when called from vlan/netinet/netinet6 code
-	 * directly rather than via doifoictl()
-	 */
 	ifreq_setaddr(cmd, , sa);
 	rc = if_ioctl(ifp, cmd, );
 



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:25:59 UTC 2021

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

Log Message:
sys/net: Assert IFNET_LOCKED in if_ioctl, if_init, and if_stop.

Exception: Not for SIOCADDMULTI/SIOCDELMULTI, for which it is the
driver's responsibility to take internal locks.  Typically this is
already done via struct ethercom::ec_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.498 -r1.499 src/sys/net/if.c

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



CVS commit: src/sys/altq

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:25:47 UTC 2021

Modified Files:
src/sys/altq: altq_afmap.c

Log Message:
altq(9): Fix missing IFNET_LOCK around if_ioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/altq/altq_afmap.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/altq/altq_afmap.c
diff -u src/sys/altq/altq_afmap.c:1.22 src/sys/altq/altq_afmap.c:1.23
--- src/sys/altq/altq_afmap.c:1.22	Fri Dec 31 14:24:50 2021
+++ src/sys/altq/altq_afmap.c	Fri Dec 31 14:25:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_afmap.c,v 1.22 2021/12/31 14:24:50 riastradh Exp $	*/
+/*	$NetBSD: altq_afmap.c,v 1.23 2021/12/31 14:25:47 riastradh Exp $	*/
 /*	$KAME: altq_afmap.c,v 1.12 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_afmap.c,v 1.22 2021/12/31 14:24:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_afmap.c,v 1.23 2021/12/31 14:25:47 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -369,10 +369,15 @@ afmioctl(dev_t dev, ioctlcmd_t cmd, void
 	flowmap = (struct atm_flowmap *)addr;
 	flowmap->af_ifname[IFNAMSIZ-1] = '\0';
 	ifp = ifunit(flowmap->af_ifname);
-	if (ifp == NULL || (ifp->if_flags & IFF_RUNNING) == 0)
+	if (ifp == NULL)
+		return ENXIO;
+
+	IFNET_LOCK(ifp);
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		error = ENXIO;
 	else
 		error = if_ioctl(ifp, cmd, addr);
+	IFNET_UNLOCK(ifp);
 
 	return error;
 }



CVS commit: src/sys/altq

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:25:47 UTC 2021

Modified Files:
src/sys/altq: altq_afmap.c

Log Message:
altq(9): Fix missing IFNET_LOCK around if_ioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/altq/altq_afmap.c

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



CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:25:24 UTC 2021

Modified Files:
src/sys/arch/arm/imx: if_enet.c
src/sys/arch/arm/sociox: if_ave.c if_scx.c
src/sys/arch/arm/sunxi: sunxi_emac.c
src/sys/arch/arm/xscale: ixp425_if_npe.c
src/sys/dev/cadence: if_cemac.c
src/sys/dev/ic: bcmgenet.c dm9000.c rtl8169.c
src/sys/dev/pci: if_dge.c if_iwn.c if_kse.c if_sip.c if_wm.c
src/sys/dev/pci/ixgbe: ixgbe.c
src/sys/dev/usb: if_urtw.c
src/sys/net: if_bridge.c if_ethersubr.c if_ieee1394subr.c if_wg.c
link_proto.c
src/sys/net/agr: if_agr.c
src/sys/net/lagg: if_lagg.c

Log Message:
sys: Use if_init wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/sociox/if_ave.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/sociox/if_scx.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/arm/xscale/ixp425_if_npe.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/cadence/if_cemac.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/bcmgenet.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/if_dge.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/if_kse.c
cvs rdiff -u -r1.183 -r1.184 src/sys/dev/pci/if_sip.c
cvs rdiff -u -r1.725 -r1.726 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.301 -r1.302 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/if_urtw.c
cvs rdiff -u -r1.185 -r1.186 src/sys/net/if_bridge.c
cvs rdiff -u -r1.308 -r1.309 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.66 -r1.67 src/sys/net/if_ieee1394subr.c src/sys/net/if_wg.c
cvs rdiff -u -r1.39 -r1.40 src/sys/net/link_proto.c
cvs rdiff -u -r1.53 -r1.54 src/sys/net/agr/if_agr.c
cvs rdiff -u -r1.27 -r1.28 src/sys/net/lagg/if_lagg.c

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

Modified files:

Index: src/sys/arch/arm/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.33 src/sys/arch/arm/imx/if_enet.c:1.34
--- src/sys/arch/arm/imx/if_enet.c:1.33	Thu Dec 31 02:16:14 2020
+++ src/sys/arch/arm/imx/if_enet.c	Fri Dec 31 14:25:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.33 2020/12/31 02:16:14 uwe Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.34 2021/12/31 14:25:22 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.33 2020/12/31 02:16:14 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.34 2021/12/31 14:25:22 riastradh Exp $");
 
 #include "vlan.h"
 
@@ -1027,7 +1027,7 @@ enet_ioctl(struct ifnet *ifp, u_long com
 		error = 0;
 		switch (command) {
 		case SIOCSIFCAP:
-			error = (*ifp->if_init)(ifp);
+			error = if_init(ifp);
 			break;
 		case SIOCADDMULTI:
 		case SIOCDELMULTI:

Index: src/sys/arch/arm/sociox/if_ave.c
diff -u src/sys/arch/arm/sociox/if_ave.c:1.21 src/sys/arch/arm/sociox/if_ave.c:1.22
--- src/sys/arch/arm/sociox/if_ave.c:1.21	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/sociox/if_ave.c	Fri Dec 31 14:25:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ave.c,v 1.21 2021/01/27 03:10:19 thorpej Exp $	*/
+/*	$NetBSD: if_ave.c,v 1.22 2021/12/31 14:25:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.21 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.22 2021/12/31 14:25:22 riastradh Exp $");
 
 #include 
 #include 
@@ -790,7 +790,7 @@ ave_ioctl(struct ifnet *ifp, u_long cmd,
 		error = 0;
 
 		if (cmd == SIOCSIFCAP)
-			error = (*ifp->if_init)(ifp);
+			error = if_init(ifp);
 		if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
 			;
 		else if (ifp->if_flags & IFF_RUNNING) {

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.33 src/sys/arch/arm/sociox/if_scx.c:1.34
--- src/sys/arch/arm/sociox/if_scx.c:1.33	Tue Dec 21 21:30:49 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Fri Dec 31 14:25:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.33 2021/12/21 21:30:49 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.34 2021/12/31 14:25:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 #define NOT_MP_SAFE	0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.33 2021/12/21 21:30:49 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.34 2021/12/31 14:25:22 riastradh Exp $");
 
 #include 
 #include 
@@ -1201,7 +1201,7 @@ scx_ioctl(struct ifnet *ifp, u_long cmd,
 			break;
 		error = 0;
 		if (cmd == SIOCSIFCAP)
-			error = 

CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:25:24 UTC 2021

Modified Files:
src/sys/arch/arm/imx: if_enet.c
src/sys/arch/arm/sociox: if_ave.c if_scx.c
src/sys/arch/arm/sunxi: sunxi_emac.c
src/sys/arch/arm/xscale: ixp425_if_npe.c
src/sys/dev/cadence: if_cemac.c
src/sys/dev/ic: bcmgenet.c dm9000.c rtl8169.c
src/sys/dev/pci: if_dge.c if_iwn.c if_kse.c if_sip.c if_wm.c
src/sys/dev/pci/ixgbe: ixgbe.c
src/sys/dev/usb: if_urtw.c
src/sys/net: if_bridge.c if_ethersubr.c if_ieee1394subr.c if_wg.c
link_proto.c
src/sys/net/agr: if_agr.c
src/sys/net/lagg: if_lagg.c

Log Message:
sys: Use if_init wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/sociox/if_ave.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/sociox/if_scx.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/arm/xscale/ixp425_if_npe.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/cadence/if_cemac.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/bcmgenet.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/if_dge.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/if_kse.c
cvs rdiff -u -r1.183 -r1.184 src/sys/dev/pci/if_sip.c
cvs rdiff -u -r1.725 -r1.726 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.301 -r1.302 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/if_urtw.c
cvs rdiff -u -r1.185 -r1.186 src/sys/net/if_bridge.c
cvs rdiff -u -r1.308 -r1.309 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.66 -r1.67 src/sys/net/if_ieee1394subr.c src/sys/net/if_wg.c
cvs rdiff -u -r1.39 -r1.40 src/sys/net/link_proto.c
cvs rdiff -u -r1.53 -r1.54 src/sys/net/agr/if_agr.c
cvs rdiff -u -r1.27 -r1.28 src/sys/net/lagg/if_lagg.c

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



CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:51 UTC 2021

Modified Files:
src/sys/altq: altq_afmap.c
src/sys/net: if.c if_bridge.c
src/sys/net/lagg: if_lagg_lacp.c
src/sys/netcan: can.c

Log Message:
sys: Use if_ioctl wrapper function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/altq/altq_afmap.c
cvs rdiff -u -r1.497 -r1.498 src/sys/net/if.c
cvs rdiff -u -r1.184 -r1.185 src/sys/net/if_bridge.c
cvs rdiff -u -r1.9 -r1.10 src/sys/net/lagg/if_lagg_lacp.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netcan/can.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/altq/altq_afmap.c
diff -u src/sys/altq/altq_afmap.c:1.21 src/sys/altq/altq_afmap.c:1.22
--- src/sys/altq/altq_afmap.c:1.21	Tue Sep 21 14:30:15 2021
+++ src/sys/altq/altq_afmap.c	Fri Dec 31 14:24:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_afmap.c,v 1.21 2021/09/21 14:30:15 christos Exp $	*/
+/*	$NetBSD: altq_afmap.c,v 1.22 2021/12/31 14:24:50 riastradh Exp $	*/
 /*	$KAME: altq_afmap.c,v 1.12 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_afmap.c,v 1.21 2021/09/21 14:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_afmap.c,v 1.22 2021/12/31 14:24:50 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -372,7 +372,7 @@ afmioctl(dev_t dev, ioctlcmd_t cmd, void
 	if (ifp == NULL || (ifp->if_flags & IFF_RUNNING) == 0)
 		error = ENXIO;
 	else
-		error = ifp->if_ioctl(ifp, cmd, addr);
+		error = if_ioctl(ifp, cmd, addr);
 
 	return error;
 }

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.497 src/sys/net/if.c:1.498
--- src/sys/net/if.c:1.497	Fri Dec 31 14:24:26 2021
+++ src/sys/net/if.c	Fri Dec 31 14:24:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.497 2021/12/31 14:24:26 riastradh Exp $	*/
+/*	$NetBSD: if.c,v 1.498 2021/12/31 14:24:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.497 2021/12/31 14:24:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.498 2021/12/31 14:24:50 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3482,7 +3482,7 @@ doifioctl(struct socket *so, u_long cmd,
 	KERNEL_LOCK_UNLESS_IFP_MPSAFE(ifp);
 	IFNET_LOCK(ifp);
 
-	error = (*ifp->if_ioctl)(ifp, cmd, data);
+	error = if_ioctl(ifp, cmd, data);
 	if (error != ENOTTY)
 		;
 	else if (so->so_proto == NULL)
@@ -3781,8 +3781,8 @@ if_addr_init(ifnet_t *ifp, struct ifaddr
 	if (ifp->if_initaddr != NULL)
 		rc = (*ifp->if_initaddr)(ifp, ifa, src);
 	else if (src ||
-	 (rc = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, ifa)) == ENOTTY)
-		rc = (*ifp->if_ioctl)(ifp, SIOCINITIFADDR, ifa);
+	 (rc = if_ioctl(ifp, SIOCSIFDSTADDR, ifa)) == ENOTTY)
+		rc = if_ioctl(ifp, SIOCINITIFADDR, ifa);
 
 	return rc;
 }
@@ -3849,7 +3849,7 @@ if_flags_set(ifnet_t *ifp, const u_short
 		memset(, 0, sizeof(ifr));
 
 		ifr.ifr_flags = flags & ~IFF_CANTCHANGE;
-		rc = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, );
+		rc = if_ioctl(ifp, SIOCSIFFLAGS, );
 
 		if (rc != 0 && cantflags != 0)
 			ifp->if_flags ^= cantflags;
@@ -3870,7 +3870,7 @@ if_mcast_op(ifnet_t *ifp, const unsigned
 	 * directly rather than via doifoictl()
 	 */
 	ifreq_setaddr(cmd, , sa);
-	rc = (*ifp->if_ioctl)(ifp, cmd, );
+	rc = if_ioctl(ifp, cmd, );
 
 	return rc;
 }

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.184 src/sys/net/if_bridge.c:1.185
--- src/sys/net/if_bridge.c:1.184	Fri Dec 31 14:24:38 2021
+++ src/sys/net/if_bridge.c	Fri Dec 31 14:24:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.184 2021/12/31 14:24:38 riastradh Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.185 2021/12/31 14:24:50 riastradh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.184 2021/12/31 14:24:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.185 2021/12/31 14:24:50 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -869,7 +869,7 @@ bridge_ioctl_add(struct bridge_softc *sc
 			memset(, 0, sizeof(ifr));
 			ifr.ifr_mtu = sc->sc_if.if_mtu;
 			IFNET_LOCK(ifs);
-			error = ifs->if_ioctl(ifs, SIOCSIFMTU, );
+			error = if_ioctl(ifs, SIOCSIFMTU, );
 			IFNET_UNLOCK(ifs);
 			if (error != 0)
 goto out;

Index: src/sys/net/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.9 src/sys/net/lagg/if_lagg_lacp.c:1.10
--- src/sys/net/lagg/if_lagg_lacp.c:1.9	Tue Nov 30 01:17:02 2021
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Dec 31 14:24:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.9 2021/11/30 01:17:02 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.10 2021/12/31 14:24:51 riastradh Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, 

CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:51 UTC 2021

Modified Files:
src/sys/altq: altq_afmap.c
src/sys/net: if.c if_bridge.c
src/sys/net/lagg: if_lagg_lacp.c
src/sys/netcan: can.c

Log Message:
sys: Use if_ioctl wrapper function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/altq/altq_afmap.c
cvs rdiff -u -r1.497 -r1.498 src/sys/net/if.c
cvs rdiff -u -r1.184 -r1.185 src/sys/net/if_bridge.c
cvs rdiff -u -r1.9 -r1.10 src/sys/net/lagg/if_lagg_lacp.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netcan/can.c

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



CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:38 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: ixp425_if_npe.c
src/sys/net: if_bridge.c if_ethersubr.c if_wg.c
src/sys/net/lagg: if_lagg.c

Log Message:
sys: Use if_stop wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arm/xscale/ixp425_if_npe.c
cvs rdiff -u -r1.183 -r1.184 src/sys/net/if_bridge.c
cvs rdiff -u -r1.307 -r1.308 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.65 -r1.66 src/sys/net/if_wg.c
cvs rdiff -u -r1.26 -r1.27 src/sys/net/lagg/if_lagg.c

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

Modified files:

Index: src/sys/arch/arm/xscale/ixp425_if_npe.c
diff -u src/sys/arch/arm/xscale/ixp425_if_npe.c:1.48 src/sys/arch/arm/xscale/ixp425_if_npe.c:1.49
--- src/sys/arch/arm/xscale/ixp425_if_npe.c:1.48	Sun Sep 19 10:34:08 2021
+++ src/sys/arch/arm/xscale/ixp425_if_npe.c	Fri Dec 31 14:24:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ixp425_if_npe.c,v 1.48 2021/09/19 10:34:08 andvar Exp $ */
+/*	$NetBSD: ixp425_if_npe.c,v 1.49 2021/12/31 14:24:38 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2006 Sam Leffler.  All rights reserved.
@@ -28,7 +28,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.48 2021/09/19 10:34:08 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.49 2021/12/31 14:24:38 riastradh Exp $");
 
 /*
  * Intel XScale NPE Ethernet driver.
@@ -1429,7 +1429,7 @@ npeioctl(struct ifnet *ifp, u_long cmd, 
 			 * If interface is marked down and it is running,
 			 * then stop and disable it.
 			 */
-			(*ifp->if_stop)(ifp, 1);
+			if_stop(ifp, 1);
 		} else if ((ifp->if_flags & (IFF_UP |IFF_RUNNING)) == IFF_UP) {
 			/*
 			 * If interface is marked up and it is stopped, then

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.183 src/sys/net/if_bridge.c:1.184
--- src/sys/net/if_bridge.c:1.183	Thu Sep 30 03:57:48 2021
+++ src/sys/net/if_bridge.c	Fri Dec 31 14:24:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.183 2021/09/30 03:57:48 yamaguchi Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.184 2021/12/31 14:24:38 riastradh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.183 2021/09/30 03:57:48 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.184 2021/12/31 14:24:38 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -611,7 +611,7 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 			 * If interface is marked down and it is running,
 			 * then stop and disable it.
 			 */
-			(*ifp->if_stop)(ifp, 1);
+			if_stop(ifp, 1);
 			break;
 		case IFF_UP:
 			/*

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.307 src/sys/net/if_ethersubr.c:1.308
--- src/sys/net/if_ethersubr.c:1.307	Fri Dec 10 01:18:29 2021
+++ src/sys/net/if_ethersubr.c	Fri Dec 31 14:24:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.307 2021/12/10 01:18:29 msaitoh Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.308 2021/12/31 14:24:38 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.307 2021/12/10 01:18:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.308 2021/12/31 14:24:38 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1461,7 +1461,7 @@ ether_ioctl_reinit(struct ethercom *ec)
 		 * If interface is marked down and it is running,
 		 * then stop and disable it.
 		 */
-		(*ifp->if_stop)(ifp, 1);
+		if_stop(ifp, 1);
 		break;
 	case IFF_UP:
 		/*

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.65 src/sys/net/if_wg.c:1.66
--- src/sys/net/if_wg.c:1.65	Tue Aug 17 17:31:13 2021
+++ src/sys/net/if_wg.c	Fri Dec 31 14:24:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.65 2021/08/17 17:31:13 christos Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.66 2021/12/31 14:24:38 riastradh Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.65 2021/08/17 17:31:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.66 2021/12/31 14:24:38 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -4666,7 +4666,7 @@ wg_ioctl(struct ifnet *ifp, u_long cmd, 
 			 * If interface is marked down and it is running,
 			 * then stop and disable it.
 			 */
-			(*ifp->if_stop)(ifp, 1);
+			if_stop(ifp, 1);
 			break;
 		case IFF_UP:
 			/*

Index: src/sys/net/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.26 src/sys/net/lagg/if_lagg.c:1.27
--- src/sys/net/lagg/if_lagg.c:1.26	Mon Nov 

CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:38 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: ixp425_if_npe.c
src/sys/net: if_bridge.c if_ethersubr.c if_wg.c
src/sys/net/lagg: if_lagg.c

Log Message:
sys: Use if_stop wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arm/xscale/ixp425_if_npe.c
cvs rdiff -u -r1.183 -r1.184 src/sys/net/if_bridge.c
cvs rdiff -u -r1.307 -r1.308 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.65 -r1.66 src/sys/net/if_wg.c
cvs rdiff -u -r1.26 -r1.27 src/sys/net/lagg/if_lagg.c

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



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:26 UTC 2021

Modified Files:
src/sys/net: if.c if.h

Log Message:
sys/net: New functions if_ioctl, if_init, and if_stop.

These are wrappers, suitable for inserting appropriate kasserts
regarding the API's locking contract, for the corresponding functions
in struct ifnet.

Since these are intended to commit configuration changes to the
interface, which may involve resetting the device, the caller should
hold IFNET_LOCK.  However, I can't straightforwardly prove that all
callers do yet, so the assertion is disabled for now.


To generate a diff of this commit:
cvs rdiff -u -r1.496 -r1.497 src/sys/net/if.c
cvs rdiff -u -r1.295 -r1.296 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.496 src/sys/net/if.c:1.497
--- src/sys/net/if.c:1.496	Thu Sep 30 03:51:05 2021
+++ src/sys/net/if.c	Fri Dec 31 14:24:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.496 2021/09/30 03:51:05 yamaguchi Exp $	*/
+/*	$NetBSD: if.c,v 1.497 2021/12/31 14:24:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.496 2021/09/30 03:51:05 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.497 2021/12/31 14:24:26 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1622,7 +1622,7 @@ if_clone_destroy(const char *name)
 	struct ifnet *ifp;
 	struct psref psref;
 	int error;
-	int (*if_ioctl)(struct ifnet *, u_long, void *);
+	int (*if_ioctlfn)(struct ifnet *, u_long, void *);
 
 	KASSERT(mutex_owned(_clone_mtx));
 
@@ -1639,7 +1639,7 @@ if_clone_destroy(const char *name)
 
 	/* We have to disable ioctls here */
 	IFNET_LOCK(ifp);
-	if_ioctl = ifp->if_ioctl;
+	if_ioctlfn = ifp->if_ioctl;
 	ifp->if_ioctl = if_nullioctl;
 	IFNET_UNLOCK(ifp);
 
@@ -1654,7 +1654,7 @@ if_clone_destroy(const char *name)
 	if (error != 0) {
 		/* We have to restore if_ioctl on error */
 		IFNET_LOCK(ifp);
-		ifp->if_ioctl = if_ioctl;
+		ifp->if_ioctl = if_ioctlfn;
 		IFNET_UNLOCK(ifp);
 	}
 
@@ -2728,6 +2728,61 @@ ifpromisc(struct ifnet *ifp, int pswitch
 }
 
 /*
+ * if_ioctl(ifp, cmd, data)
+ *
+ *	Apply an ioctl command to the interface.  Returns 0 on success,
+ *	nonzero errno(3) number on failure.
+ *
+ *	May sleep.  Caller must hold ifp->if_ioctl_lock.
+ */
+int
+if_ioctl(struct ifnet *ifp, u_long cmd, void *data)
+{
+
+	KASSERT(1 || IFNET_LOCKED(ifp));	/* XXX not yet */
+
+	return (*ifp->if_ioctl)(ifp, cmd, data);
+}
+
+/*
+ * if_init(ifp)
+ *
+ *	Prepare the hardware underlying ifp to process packets
+ *	according to its current configuration.  Returns 0 on success,
+ *	nonzero errno(3) number on failure.
+ *
+ *	May sleep.  Caller must hold ifp->if_ioctl_lock, a.k.a
+ *	IFNET_LOCK.
+ */
+int
+if_init(struct ifnet *ifp)
+{
+
+	KASSERT(1 || IFNET_LOCKED(ifp));	/* XXX not yet */
+
+	return (*ifp->if_init)(ifp);
+}
+
+/*
+ * if_stop(ifp, disable)
+ *
+ *	Stop the hardware underlying ifp from processing packets.
+ *
+ *	If disable is true, ... XXX(?)
+ *
+ *	May sleep.  Caller must hold ifp->if_ioctl_lock, a.k.a
+ *	IFNET_LOCK.
+ */
+void
+if_stop(struct ifnet *ifp, int disable)
+{
+
+	KASSERT(1 || IFNET_LOCKED(ifp));	/* XXX not yet */
+
+	(*ifp->if_stop)(ifp, disable);
+}
+
+/*
  * Map interface name to
  * interface structure pointer.
  */

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.295 src/sys/net/if.h:1.296
--- src/sys/net/if.h:1.295	Thu Sep 30 03:51:05 2021
+++ src/sys/net/if.h	Fri Dec 31 14:24:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.295 2021/09/30 03:51:05 yamaguchi Exp $	*/
+/*	$NetBSD: if.h,v 1.296 2021/12/31 14:24:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1143,6 +1143,10 @@ int	if_mcast_op(ifnet_t *, const unsigne
 int	if_flags_set(struct ifnet *, const u_short);
 int	if_clone_list(int, char *, int *);
 
+int	if_ioctl(struct ifnet *, u_long, void *);
+int	if_init(struct ifnet *);
+void	if_stop(struct ifnet *, int);
+
 struct	ifnet *ifunit(const char *);
 struct	ifnet *if_get(const char *, struct psref *);
 ifnet_t *if_byindex(u_int);



CVS commit: src/sys/net

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:26 UTC 2021

Modified Files:
src/sys/net: if.c if.h

Log Message:
sys/net: New functions if_ioctl, if_init, and if_stop.

These are wrappers, suitable for inserting appropriate kasserts
regarding the API's locking contract, for the corresponding functions
in struct ifnet.

Since these are intended to commit configuration changes to the
interface, which may involve resetting the device, the caller should
hold IFNET_LOCK.  However, I can't straightforwardly prove that all
callers do yet, so the assertion is disabled for now.


To generate a diff of this commit:
cvs rdiff -u -r1.496 -r1.497 src/sys/net/if.c
cvs rdiff -u -r1.295 -r1.296 src/sys/net/if.h

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



CVS commit: src/sys/dev/usb

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:16 UTC 2021

Modified Files:
src/sys/dev/usb: umass.c umass_scsipi.c umassvar.h

Log Message:
umass(4): Omit needless reference counting.

autoconf never detaches before attach has completed, so there is no
longer any need for this mechanism.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/umass_scsipi.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/umassvar.h

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

Modified files:

Index: src/sys/dev/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.186 src/sys/dev/usb/umass.c:1.187
--- src/sys/dev/usb/umass.c:1.186	Thu Sep 16 22:19:11 2021
+++ src/sys/dev/usb/umass.c	Fri Dec 31 14:24:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.186 2021/09/16 22:19:11 andvar Exp $	*/
+/*	$NetBSD: umass.c,v 1.187 2021/12/31 14:24:16 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.186 2021/09/16 22:19:11 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.187 2021/12/31 14:24:16 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -392,7 +392,6 @@ umass_attach(device_t parent, device_t s
 	aprint_normal("\n");
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
-	cv_init(>sc_detach_cv, "umassdet");
 
 	devinfop = usbd_devinfo_alloc(uiaa->uiaa_device, 0);
 	aprint_normal_dev(self, "%s\n", devinfop);
@@ -872,18 +871,6 @@ umass_detach(device_t self, int flags)
 	}
 	usbd_abort_default_pipe(sc->sc_udev);
 
-	/* Do we really need reference counting?  Perhaps in ioctl() */
-	mutex_enter(>sc_lock);
-	if (--sc->sc_refcnt >= 0) {
-#ifdef DIAGNOSTIC
-		aprint_normal_dev(self, "waiting for refcnt\n");
-#endif
-		/* Wait for processes to go away. */
-		if (cv_timedwait(>sc_detach_cv, >sc_lock, hz * 60))
-			aprint_error_dev(self, ": didn't detach\n");
-	}
-	mutex_exit(>sc_lock);
-
 	scbus = sc->bus;
 	if (scbus != NULL) {
 		if (scbus->sc_child != NULL)
@@ -925,7 +912,6 @@ umass_detach(device_t self, int flags)
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
 
 	mutex_destroy(>sc_lock);
-	cv_destroy(>sc_detach_cv);
 
 out:	SDT_PROBE2(usb, umass, device, detach__done,  sc, rv);
 	return rv;

Index: src/sys/dev/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.69 src/sys/dev/usb/umass_scsipi.c:1.70
--- src/sys/dev/usb/umass_scsipi.c:1.69	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/usb/umass_scsipi.c	Fri Dec 31 14:24:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.69 2021/08/07 16:19:17 thorpej Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.70 2021/12/31 14:24:16 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.69 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.70 2021/12/31 14:24:16 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -131,6 +131,8 @@ umass_scsi_attach(struct umass_softc *sc
 	UMASSHIST_FUNC(); UMASSHIST_CALLED();
 	struct umass_scsipi_softc *scbus;
 
+	KASSERT(KERNEL_LOCKED_P());
+
 	scbus = umass_scsipi_setup(sc);
 
 	scbus->sc_channel.chan_bustype = _bustype;
@@ -139,17 +141,9 @@ umass_scsi_attach(struct umass_softc *sc
 	scbus->sc_channel.chan_id = scbus->sc_channel.chan_ntargets - 1;
 	DPRINTFM(UDMASS_USB, "sc %#jx: SCSI", (uintptr_t)sc, 0, 0, 0);
 
-	mutex_enter(>sc_lock);
-	sc->sc_refcnt++;
-	mutex_exit(>sc_lock);
 	scbus->base.sc_child =
 	config_found(sc->sc_dev, >sc_channel, scsiprint,
 			 CFARGS(.iattr = "scsi"));
-	mutex_enter(>sc_lock);
-	if (--sc->sc_refcnt < 0)
-		cv_broadcast(>sc_detach_cv);
-	mutex_exit(>sc_lock);
-
 
 	return 0;
 }
@@ -171,6 +165,8 @@ umass_atapi_attach(struct umass_softc *s
 	UMASSHIST_FUNC(); UMASSHIST_CALLED();
 	struct umass_scsipi_softc *scbus;
 
+	KASSERT(KERNEL_LOCKED_P());
+
 	scbus = umass_scsipi_setup(sc);
 	scbus->sc_atapi_adapter.atapi_probe_device =  umass_atapi_probe_device;
 
@@ -181,16 +177,9 @@ umass_atapi_attach(struct umass_softc *s
 	scbus->sc_channel.chan_defquirks |= sc->sc_busquirks;
 	DPRINTFM(UDMASS_USB, "sc %#jxp: ATAPI", (uintptr_t)sc, 0, 0, 0);
 
-	mutex_enter(>sc_lock);
-	sc->sc_refcnt++;
-	mutex_exit(>sc_lock);
 	scbus->base.sc_child =
 	config_found(sc->sc_dev, >sc_channel, atapiprint,
 			 CFARGS(.iattr = "atapi"));
-	mutex_enter(>sc_lock);
-	if (--sc->sc_refcnt < 0)
-		cv_broadcast(>sc_detach_cv);
-	mutex_exit(>sc_lock);
 
 	return 0;
 }

Index: src/sys/dev/usb/umassvar.h
diff -u src/sys/dev/usb/umassvar.h:1.39 src/sys/dev/usb/umassvar.h:1.40
--- src/sys/dev/usb/umassvar.h:1.39	Tue Nov 13 10:30:57 2018
+++ src/sys/dev/usb/umassvar.h	Fri Dec 31 14:24:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: umassvar.h,v 1.39 2018/11/13 10:30:57 mlelstv Exp $	*/
+/*	

CVS commit: src/sys/dev/usb

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:16 UTC 2021

Modified Files:
src/sys/dev/usb: umass.c umass_scsipi.c umassvar.h

Log Message:
umass(4): Omit needless reference counting.

autoconf never detaches before attach has completed, so there is no
longer any need for this mechanism.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/umass_scsipi.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/umassvar.h

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



CVS commit: src/sys/dev/usb

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:06 UTC 2021

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

Log Message:
ukbd(4): Avoid races in LED setting on attach.

- Don't reuse sc_delay for LED task -- a keyboard interrupt shortly
  after attach might reset sc_delay so that the LEDs never get turned
  back off.

- Don't turn the LEDs back off after attach if something else has
  already changed them by the time the callout fires.

(And make sure to callout_halt before done this time!)


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/usb/ukbd.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/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.155 src/sys/dev/usb/ukbd.c:1.156
--- src/sys/dev/usb/ukbd.c:1.155	Sun Dec 26 16:08:21 2021
+++ src/sys/dev/usb/ukbd.c	Fri Dec 31 14:24:06 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: ukbd.c,v 1.155 2021/12/26 16:08:21 andvar Exp $*/
+/*  $NetBSD: ukbd.c,v 1.156 2021/12/31 14:24:06 riastradh Exp $*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.155 2021/12/26 16:08:21 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.156 2021/12/31 14:24:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -270,6 +270,8 @@ struct ukbd_softc {
 	struct hid_location sc_compose;
 	int sc_leds;
 	struct usb_task sc_ledtask;
+	struct callout sc_ledreset;
+	int sc_leds_set;
 	device_t sc_wskbddev;
 
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
@@ -483,11 +485,13 @@ ukbd_attach(device_t parent, device_t se
 	sc->sc_data_r = 0;
 
 	usb_init_task(>sc_ledtask, ukbd_set_leds_task, sc, 0);
+	callout_init(>sc_ledreset, 0);
 
 	/* Flash the leds; no real purpose, just shows we're alive. */
 	ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS
 			| WSKBD_LED_COMPOSE);
-	callout_reset(>sc_delay, mstohz(400), ukbd_delayed_leds_off, sc);
+	callout_reset(>sc_ledreset, mstohz(400), ukbd_delayed_leds_off,
+	sc);
 
 	sc->sc_wskbddev = config_found(self, , wskbddevprint, CFARGS_NONE);
 
@@ -573,6 +577,7 @@ ukbd_detach(device_t self, int flags)
 		rv = config_detach(sc->sc_wskbddev, flags);
 
 	callout_halt(>sc_delay, NULL);
+	callout_halt(>sc_ledreset, NULL);
 	usb_rem_task_wait(sc->sc_hdev.sc_parent->sc_udev, >sc_ledtask,
 	USB_TASKQ_DRIVER, NULL);
 
@@ -715,6 +720,13 @@ ukbd_delayed_leds_off(void *addr)
 {
 	struct ukbd_softc *sc = addr;
 
+	/*
+	 * If the LEDs have already been set after attach, other than
+	 * by our initial flashing of them, leave them be.
+	 */
+	if (sc->sc_leds_set)
+		return;
+
 	ukbd_set_leds(sc, 0);
 }
 
@@ -880,6 +892,8 @@ ukbd_set_leds(void *v, int leds)
 	if (sc->sc_dying)
 		return;
 
+	sc->sc_leds_set = 1;
+
 	if (sc->sc_leds == leds)
 		return;
 



CVS commit: src/sys/dev/usb

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:24:06 UTC 2021

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

Log Message:
ukbd(4): Avoid races in LED setting on attach.

- Don't reuse sc_delay for LED task -- a keyboard interrupt shortly
  after attach might reset sc_delay so that the LEDs never get turned
  back off.

- Don't turn the LEDs back off after attach if something else has
  already changed them by the time the callout fires.

(And make sure to callout_halt before done this time!)


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/usb/ukbd.c

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:22:42 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi.c

Log Message:
acpi(9): Fix memory ordering and completion bugs in notifiers.

1. Guarantee everything which happened before acpi_register_notify
   has also happened before the notifier is actually called.

2. On acpi_deregister_notify, don't return until the notifier is
   definitely not running any more on any CPU, using
   AcpiOsWaitEventsComplete.


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 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.294 src/sys/dev/acpi/acpi.c:1.295
--- src/sys/dev/acpi/acpi.c:1.294	Mon Dec 20 11:17:40 2021
+++ src/sys/dev/acpi/acpi.c	Fri Dec 31 14:22:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.294 2021/12/20 11:17:40 skrll Exp $	*/
+/*	$NetBSD: acpi.c,v 1.295 2021/12/31 14:22:42 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,13 +100,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.294 2021/12/20 11:17:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.295 2021/12/31 14:22:42 riastradh Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1146,6 +1147,7 @@ acpi_notify_handler(ACPI_HANDLE handle, 
 {
 	struct acpi_softc *sc = acpi_softc;
 	struct acpi_devnode *ad;
+	ACPI_NOTIFY_HANDLER notify;
 
 	KASSERT(sc != NULL);
 	KASSERT(aux == NULL);
@@ -1189,13 +1191,13 @@ acpi_notify_handler(ACPI_HANDLE handle, 
 		if (ad->ad_device == NULL)
 			continue;
 
-		if (ad->ad_notify == NULL)
+		if ((notify = atomic_load_acquire(>ad_notify)) == NULL)
 			continue;
 
 		if (ad->ad_handle != handle)
 			continue;
 
-		(*ad->ad_notify)(ad->ad_handle, event, ad->ad_device);
+		(*notify)(ad->ad_handle, event, ad->ad_device);
 
 		return;
 	}
@@ -1218,7 +1220,7 @@ acpi_register_notify(struct acpi_devnode
 	if (ad == NULL || notify == NULL)
 		goto fail;
 
-	ad->ad_notify = notify;
+	atomic_store_release(>ad_notify, notify);
 
 	return true;
 
@@ -1233,7 +1235,10 @@ void
 acpi_deregister_notify(struct acpi_devnode *ad)
 {
 
-	ad->ad_notify = NULL;
+	atomic_store_relaxed(>ad_notify, NULL);
+
+	/* Wait for any in-flight calls to the notifier to complete.  */
+	AcpiOsWaitEventsComplete();
 }
 
 /*



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:22:42 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi.c

Log Message:
acpi(9): Fix memory ordering and completion bugs in notifiers.

1. Guarantee everything which happened before acpi_register_notify
   has also happened before the notifier is actually called.

2. On acpi_deregister_notify, don't return until the notifier is
   definitely not running any more on any CPU, using
   AcpiOsWaitEventsComplete.


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

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:22:26 UTC 2021

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
acpi(9): Implement AcpiOsWaitEventsComplete.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/acpica/OsdSchedule.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/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.19 src/sys/dev/acpi/acpica/OsdSchedule.c:1.20
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.19	Sun Nov 12 02:59:55 2017
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Fri Dec 31 14:22:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.19 2017/11/12 02:59:55 christos Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.20 2021/12/31 14:22:26 riastradh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.19 2017/11/12 02:59:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.20 2021/12/31 14:22:26 riastradh Exp $");
 
 #include 
 #include 
@@ -101,6 +101,10 @@ AcpiOsExecute(ACPI_EXECUTE_TYPE Type, AC
 {
 	int pri;
 
+	/*
+	 * If you raise any priority here make sure to adjust
+	 * AcpiOsWaitEventsComplete too.
+	 */
 	switch (Type) {
 	case OSL_GPE_HANDLER:
 		pri = 10;
@@ -185,14 +189,13 @@ AcpiOsGetTimer(void)
 }
 
 /*
- *
  * AcpiOsWaitEventsComplete:
  *
- * 	Wait for all asynchronous events to complete. This implementation
- *	does nothing.
+ * 	Wait for all asynchronous events to complete.
  */
 void
 AcpiOsWaitEventsComplete(void)
 {
-	return;
+	/* Highest priority used by AcpiOsExecute.  */
+	sysmon_task_queue_barrier(10);
 }



CVS commit: src/sys/dev/acpi/acpica

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:22:26 UTC 2021

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
acpi(9): Implement AcpiOsWaitEventsComplete.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/acpica/OsdSchedule.c

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



CVS commit: src

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:22:11 UTC 2021

Modified Files:
src/share/man/man9: sysmon_taskq.9
src/sys/dev/sysmon: sysmon_taskq.c sysmon_taskq.h

Log Message:
sysmon(9): New sysmon_task_queue_barrier(pri) function.

This waits for the completion of all tasks at priority pri or lower
that are currently queued at the time of the call.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man9/sysmon_taskq.9
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sysmon/sysmon_taskq.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sysmon/sysmon_taskq.h

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

Modified files:

Index: src/share/man/man9/sysmon_taskq.9
diff -u src/share/man/man9/sysmon_taskq.9:1.8 src/share/man/man9/sysmon_taskq.9:1.9
--- src/share/man/man9/sysmon_taskq.9:1.8	Tue Mar 18 18:20:40 2014
+++ src/share/man/man9/sysmon_taskq.9	Fri Dec 31 14:22:10 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: sysmon_taskq.9,v 1.8 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: sysmon_taskq.9,v 1.9 2021/12/31 14:22:10 riastradh Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -43,6 +43,8 @@
 .Fn sysmon_task_queue_fini "void"
 .Ft int
 .Fn sysmon_task_queue_sched "u_int pri" "void (*func)(void *)" "void *arg"
+.Ft void
+.Fn sysmon_task_queue_barrier "u_int pri"
 .Sh DESCRIPTION
 The machine-independent
 .Nm
@@ -67,7 +69,7 @@ All scheduled tasks are executed before 
 .Pp
 The
 .Fn sysmon_task_queue_sched
-enqueues
+function enqueues
 .Fa func
 to be executed at the priority
 .Fa pri .
@@ -78,6 +80,12 @@ The single argument passed to
 .Fa func
 is specified by
 .Fa arg .
+.Pp
+The
+.Fn sysmon_task_queue_barrier
+function waits for the completion of all tasks at
+.Fa pri
+or lower currently queued at the time of the call.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn sysmon_task_queue_sched

Index: src/sys/dev/sysmon/sysmon_taskq.c
diff -u src/sys/dev/sysmon/sysmon_taskq.c:1.21 src/sys/dev/sysmon/sysmon_taskq.c:1.22
--- src/sys/dev/sysmon/sysmon_taskq.c:1.21	Fri Dec 31 11:05:41 2021
+++ src/sys/dev/sysmon/sysmon_taskq.c	Fri Dec 31 14:22:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_taskq.c,v 1.21 2021/12/31 11:05:41 riastradh Exp $	*/
+/*	$NetBSD: sysmon_taskq.c,v 1.22 2021/12/31 14:22:11 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_taskq.c,v 1.21 2021/12/31 11:05:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_taskq.c,v 1.22 2021/12/31 14:22:11 riastradh Exp $");
 
 #include 
 #include 
@@ -202,6 +202,26 @@ sysmon_task_queue_thread(void *arg)
 	kthread_exit(0);
 }
 
+static void
+sysmon_task_queue_sched_task(struct sysmon_task *st)
+{
+	struct sysmon_task *lst;
+
+	mutex_enter(_task_queue_mtx);
+	TAILQ_FOREACH(lst, _task_queue, st_list) {
+		if (st->st_pri > lst->st_pri) {
+			TAILQ_INSERT_BEFORE(lst, st, st_list);
+			break;
+		}
+	}
+
+	if (lst == NULL)
+		TAILQ_INSERT_TAIL(_task_queue, st, st_list);
+
+	cv_broadcast(_task_queue_cv);
+	mutex_exit(_task_queue_mtx);
+}
+
 /*
  * sysmon_task_queue_sched:
  *
@@ -210,7 +230,7 @@ sysmon_task_queue_thread(void *arg)
 int
 sysmon_task_queue_sched(u_int pri, void (*func)(void *), void *arg)
 {
-	struct sysmon_task *st, *lst;
+	struct sysmon_task *st;
 
 	(void)RUN_ONCE(_tq, tq_preinit);
 
@@ -229,21 +249,62 @@ sysmon_task_queue_sched(u_int pri, void 
 	st->st_arg = arg;
 	st->st_pri = pri;
 
-	mutex_enter(_task_queue_mtx);
-	TAILQ_FOREACH(lst, _task_queue, st_list) {
-		if (st->st_pri > lst->st_pri) {
-			TAILQ_INSERT_BEFORE(lst, st, st_list);
-			break;
-		}
-	}
+	sysmon_task_queue_sched_task(st);
 
-	if (lst == NULL)
-		TAILQ_INSERT_TAIL(_task_queue, st, st_list);
+	return 0;
+}
 
-	cv_broadcast(_task_queue_cv);
-	mutex_exit(_task_queue_mtx);
+struct tqbarrier {
+	kmutex_t	lock;
+	kcondvar_t	cv;
+	bool		done;
+};
 
-	return 0;
+static void
+tqbarrier_task(void *cookie)
+{
+	struct tqbarrier *bar = cookie;
+
+	mutex_enter(>lock);
+	bar->done = true;
+	cv_broadcast(>cv);
+	mutex_exit(>lock);
+}
+
+/*
+ * sysmon_task_queue_barrier:
+ *
+ *	Wait for the completion of all tasks at priority pri or lower
+ *	currently queued at the time of the call.
+ */
+void
+sysmon_task_queue_barrier(u_int pri)
+{
+	struct sysmon_task st;
+	struct tqbarrier bar;
+
+	(void)RUN_ONCE(_tq, tq_preinit);
+
+	KASSERT(sysmon_task_queue_lwp);
+	KASSERT(curlwp != sysmon_task_queue_lwp);
+
+	mutex_init(, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(, "sysmontq");
+	bar.done = false;
+
+	st.st_func = _task;
+	st.st_arg = 
+	st.st_pri = pri;
+
+	sysmon_task_queue_sched_task();
+
+	mutex_enter();
+	while (!bar.done)
+		cv_wait(, );
+	mutex_exit();
+
+	cv_destroy();
+	mutex_destroy();
 }
 
 static int

Index: src/sys/dev/sysmon/sysmon_taskq.h
diff -u src/sys/dev/sysmon/sysmon_taskq.h:1.4 src/sys/dev/sysmon/sysmon_taskq.h:1.5
--- 

CVS commit: src

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:22:11 UTC 2021

Modified Files:
src/share/man/man9: sysmon_taskq.9
src/sys/dev/sysmon: sysmon_taskq.c sysmon_taskq.h

Log Message:
sysmon(9): New sysmon_task_queue_barrier(pri) function.

This waits for the completion of all tasks at priority pri or lower
that are currently queued at the time of the call.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man9/sysmon_taskq.9
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sysmon/sysmon_taskq.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sysmon/sysmon_taskq.h

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:20:56 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_bat.c

Log Message:
acpibat(4): Print ACPI error when _STA fails.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/acpi/acpi_bat.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_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.119 src/sys/dev/acpi/acpi_bat.c:1.120
--- src/sys/dev/acpi/acpi_bat.c:1.119	Fri Dec 31 14:20:40 2021
+++ src/sys/dev/acpi/acpi_bat.c	Fri Dec 31 14:20:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.119 2021/12/31 14:20:40 riastradh Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.120 2021/12/31 14:20:56 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.119 2021/12/31 14:20:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.120 2021/12/31 14:20:56 riastradh Exp $");
 
 #include 
 #include 
@@ -294,7 +294,8 @@ acpibat_get_sta(device_t dv)
 
 	rv = acpi_eval_integer(sc->sc_node->ad_handle, "_STA", );
 	if (ACPI_FAILURE(rv)) {
-		aprint_error_dev(dv, "failed to evaluate _STA\n");
+		aprint_error_dev(dv, "failed to evaluate _STA: %s\n",
+		AcpiFormatException(rv));
 		return -1;
 	}
 



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:20:56 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_bat.c

Log Message:
acpibat(4): Print ACPI error when _STA fails.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/acpi/acpi_bat.c

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:20:40 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_bat.c

Log Message:
acpibat(4): Delete excessive blank lines.

Makes it hard to follow when there is a big gap between everything
even when there is a tight logical coupling, like setting and testing
an error code.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/acpi/acpi_bat.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_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.118 src/sys/dev/acpi/acpi_bat.c:1.119
--- src/sys/dev/acpi/acpi_bat.c:1.118	Fri Dec 31 14:20:24 2021
+++ src/sys/dev/acpi/acpi_bat.c	Fri Dec 31 14:20:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.118 2021/12/31 14:20:24 riastradh Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.119 2021/12/31 14:20:40 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.118 2021/12/31 14:20:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.119 2021/12/31 14:20:40 riastradh Exp $");
 
 #include 
 #include 
@@ -248,7 +248,6 @@ acpibat_attach(device_t parent, device_t
 	 * If this is ever seen, the driver should be extended.
 	 */
 	rv = AcpiGetHandle(sc->sc_node->ad_handle, "_BIX", );
-
 	if (ACPI_SUCCESS(rv))
 		aprint_verbose_dev(self, "ACPI 4.0 functionality present\n");
 }
@@ -294,7 +293,6 @@ acpibat_get_sta(device_t dv)
 	ACPI_STATUS rv;
 
 	rv = acpi_eval_integer(sc->sc_node->ad_handle, "_STA", );
-
 	if (ACPI_FAILURE(rv)) {
 		aprint_error_dev(dv, "failed to evaluate _STA\n");
 		return -1;
@@ -320,17 +318,14 @@ acpibat_get_object(ACPI_HANDLE hdl, cons
 	ACPI_STATUS rv;
 
 	rv = acpi_eval_struct(hdl, pth, );
-
 	if (ACPI_FAILURE(rv))
 		return NULL;
 
 	obj = buf.Pointer;
-
 	if (obj->Type != ACPI_TYPE_PACKAGE) {
 		ACPI_FREE(buf.Pointer);
 		return NULL;
 	}
-
 	if (obj->Package.Count != count) {
 		ACPI_FREE(buf.Pointer);
 		return NULL;
@@ -355,21 +350,17 @@ acpibat_get_info(device_t dv)
 	uint64_t val;
 
 	obj = acpibat_get_object(hdl, "_BIF", ACPIBAT_BIF_COUNT);
-
 	if (obj == NULL) {
 		rv = AE_ERROR;
 		goto out;
 	}
 
 	elm = obj->Package.Elements;
-
 	for (i = ACPIBAT_BIF_UNIT; i < ACPIBAT_BIF_MODEL; i++) {
-
 		if (elm[i].Type != ACPI_TYPE_INTEGER) {
 			rv = AE_TYPE;
 			goto out;
 		}
-
 		if (elm[i].Integer.Value != ACPIBAT_VAL_UNKNOWN &&
 		elm[i].Integer.Value >= INT_MAX) {
 			rv = AE_LIMIT;
@@ -445,13 +436,10 @@ acpibat_print_info(device_t dv, ACPI_OBJ
 	int i;
 
 	for (i = ACPIBAT_BIF_OEM; i > ACPIBAT_BIF_GRANULARITY2; i--) {
-
 		if (elm[i].Type != ACPI_TYPE_STRING)
 			return;
-
 		if (elm[i].String.Pointer == NULL)
 			return;
-
 		if (elm[i].String.Pointer[0] == '\0')
 			return;
 	}
@@ -524,16 +512,13 @@ acpibat_get_status(device_t dv)
 	uint64_t val;
 
 	obj = acpibat_get_object(hdl, "_BST", ACPIBAT_BST_COUNT);
-
 	if (obj == NULL) {
 		rv = AE_ERROR;
 		goto out;
 	}
 
 	elm = obj->Package.Elements;
-
 	for (i = ACPIBAT_BST_STATE; i < ACPIBAT_BST_COUNT; i++) {
-
 		if (elm[i].Type != ACPI_TYPE_INTEGER) {
 			rv = AE_TYPE;
 			goto out;
@@ -541,7 +526,6 @@ acpibat_get_status(device_t dv)
 	}
 
 	state = elm[ACPIBAT_BST_STATE].Integer.Value;
-
 	if ((state & ACPIBAT_ST_CHARGING) != 0) {
 		/* XXX rate can be invalid */
 		rate = elm[ACPIBAT_BST_RATE].Integer.Value;
@@ -615,7 +599,6 @@ acpibat_update_info(void *arg)
 	mutex_enter(>sc_mutex);
 
 	rv = acpibat_get_sta(dv);
-
 	if (rv > 0) {
 		acpibat_get_info(dv);
 
@@ -628,7 +611,6 @@ acpibat_update_info(void *arg)
 			>sc_sensor[ACPIBAT_CAPACITY]);
 	} else {
 		i = (rv < 0) ? 0 : ACPIBAT_DVOLTAGE;
-
 		while (i < ACPIBAT_COUNT) {
 			sc->sc_sensor[i].state = ENVSYS_SINVALID;
 			i++;
@@ -650,16 +632,12 @@ acpibat_update_status(void *arg)
 	mutex_enter(>sc_mutex);
 
 	rv = acpibat_get_sta(dv);
-
 	if (rv > 0) {
-
 		if (sc->sc_present == 0)
 			acpibat_get_info(dv);
-
 		acpibat_get_status(dv);
 	} else {
 		i = (rv < 0) ? 0 : ACPIBAT_DVOLTAGE;
-
 		while (i < ACPIBAT_COUNT) {
 			sc->sc_sensor[i].state = ENVSYS_SINVALID;
 			i++;
@@ -685,19 +663,15 @@ acpibat_notify_handler(ACPI_HANDLE handl
 	device_t dv = context;
 
 	switch (notify) {
-
 	case ACPI_NOTIFY_BUS_CHECK:
 		break;
-
 	case ACPI_NOTIFY_BAT_INFO:
 	case ACPI_NOTIFY_DEVICE_CHECK:
 		(void)AcpiOsExecute(handler, acpibat_update_info, dv);
 		break;
-
 	case ACPI_NOTIFY_BAT_STATUS:
 		(void)AcpiOsExecute(handler, acpibat_update_status, dv);
 		break;
-
 	default:
 		aprint_error_dev(dv, "unknown notify: 0x%02X\n", notify);
 	}
@@ -753,7 +727,6 @@ acpibat_init_envsys(device_t dv)
 	sc->sc_sme = sysmon_envsys_create();
 
 	for (i = 0; i < ACPIBAT_COUNT; i++) {
-
 		if (sysmon_envsys_sensor_attach(sc->sc_sme,
 			>sc_sensor[i]))
 			goto fail;
@@ -802,7 +775,6 @@ acpibat_refresh(struct sysmon_envsys *sm
 
 	microtime();
 	

CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:20:40 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_bat.c

Log Message:
acpibat(4): Delete excessive blank lines.

Makes it hard to follow when there is a big gap between everything
even when there is a tight logical coupling, like setting and testing
an error code.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/acpi/acpi_bat.c

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:20:24 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_bat.c

Log Message:
acpibat(4): Fix attach and detach ordering.

On attach: Don't register acpibat_resume handler with pmf or
acpibat_notify_handler with acpi until it is safe to call
acpibat_update_info and acpibat_update_status.
=> This requires the sc->sc_sensor array to be allocated, so allocate
   that first.
=> This requires sc->sc_sme to be created, so defer them to
   config_interrupts after sysmon_envsys_register.
=> Make sure to register the notify handler before initially polling
   the info and status.

On detach: Deregister pmf handler and acpi notifier before we destroy
anything.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/acpi/acpi_bat.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_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.117 src/sys/dev/acpi/acpi_bat.c:1.118
--- src/sys/dev/acpi/acpi_bat.c:1.117	Fri Jan 29 15:20:13 2021
+++ src/sys/dev/acpi/acpi_bat.c	Fri Dec 31 14:20:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.117 2021/01/29 15:20:13 thorpej Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.118 2021/12/31 14:20:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.117 2021/01/29 15:20:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.118 2021/12/31 14:20:24 riastradh Exp $");
 
 #include 
 #include 
@@ -235,20 +235,13 @@ acpibat_attach(device_t parent, device_t
 	sc->sc_wcapacity = 0;
 
 	sc->sc_sme = NULL;
-	sc->sc_sensor = NULL;
 
 	mutex_init(>sc_mutex, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(>sc_condvar, device_xname(self));
 
-	(void)pmf_device_register(self, NULL, acpibat_resume);
-	(void)acpi_register_notify(sc->sc_node, acpibat_notify_handler);
-
 	sc->sc_sensor = kmem_zalloc(ACPIBAT_COUNT *
 	sizeof(*sc->sc_sensor), KM_SLEEP);
 
-	if (sc->sc_sensor == NULL)
-		return;
-
 	config_interrupts(self, acpibat_init_envsys);
 
 	/*
@@ -270,11 +263,9 @@ acpibat_detach(device_t self, int flags)
 {
 	struct acpibat_softc *sc = device_private(self);
 
+	pmf_device_deregister(self);
 	acpi_deregister_notify(sc->sc_node);
 
-	cv_destroy(>sc_condvar);
-	mutex_destroy(>sc_mutex);
-
 	if (sc->sc_sme != NULL)
 		sysmon_envsys_unregister(sc->sc_sme);
 
@@ -282,7 +273,8 @@ acpibat_detach(device_t self, int flags)
 		kmem_free(sc->sc_sensor, ACPIBAT_COUNT *
 		sizeof(*sc->sc_sensor));
 
-	pmf_device_deregister(self);
+	cv_destroy(>sc_condvar);
+	mutex_destroy(>sc_mutex);
 
 	return 0;
 }
@@ -774,12 +766,15 @@ acpibat_init_envsys(device_t dv)
 	sc->sc_sme->sme_flags = SME_POLL_ONLY | SME_INIT_REFRESH;
 	sc->sc_sme->sme_get_limits = acpibat_get_limits;
 
+	(void)acpi_register_notify(sc->sc_node, acpibat_notify_handler);
 	acpibat_update_info(dv);
 	acpibat_update_status(dv);
 
 	if (sysmon_envsys_register(sc->sc_sme))
 		goto fail;
 
+	(void)pmf_device_register(dv, NULL, acpibat_resume);
+
 	return;
 
 fail:



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:20:24 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_bat.c

Log Message:
acpibat(4): Fix attach and detach ordering.

On attach: Don't register acpibat_resume handler with pmf or
acpibat_notify_handler with acpi until it is safe to call
acpibat_update_info and acpibat_update_status.
=> This requires the sc->sc_sensor array to be allocated, so allocate
   that first.
=> This requires sc->sc_sme to be created, so defer them to
   config_interrupts after sysmon_envsys_register.
=> Make sure to register the notify handler before initially polling
   the info and status.

On detach: Deregister pmf handler and acpi notifier before we destroy
anything.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/acpi/acpi_bat.c

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



CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:19:57 UTC 2021

Modified Files:
src/sys/dev/wscons: wsdisplay.c
src/sys/kern: subr_autoconf.c subr_psref.c subr_thmap.c
src/sys/lib/libkern: libkern.h

Log Message:
libkern: Make KASSERT verify expression is valid if !DIAGNOSTIC.

This way it is no longer necessary to mark variables __diagused if
they are used in KASSERT conditions.

Fix fallout from this by removing now-unnecessary and `#ifdef
DIAGNOSTIC'.

Don't do the same for KDASSERT if !DEBUG -- unlike KASSERT and
DIAGNOSTIC, variables needed by KDASSERT and DEBUG are likely to be
expensive to compute (and potentially difficult for a compiler to
prove flushable), so we don't want to require them under !DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.290 -r1.291 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/kern/subr_psref.c
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_thmap.c
cvs rdiff -u -r1.143 -r1.144 src/sys/lib/libkern/libkern.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/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.162 src/sys/dev/wscons/wsdisplay.c:1.163
--- src/sys/dev/wscons/wsdisplay.c:1.162	Sun Dec 27 16:09:33 2020
+++ src/sys/dev/wscons/wsdisplay.c	Fri Dec 31 14:19:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.162 2020/12/27 16:09:33 tsutsui Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.163 2021/12/31 14:19:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.162 2020/12/27 16:09:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.163 2021/12/31 14:19:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -115,10 +115,8 @@ struct wsscreen {
 
 	struct wsdisplay_softc *sc;
 
-#ifdef DIAGNOSTIC
 	/* XXX this is to support a hack in emulinput, see comment below */
 	int scr_in_ttyoutput;
-#endif
 };
 
 static struct wsscreen *wsscreen_attach(struct wsdisplay_softc *, int,

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.290 src/sys/kern/subr_autoconf.c:1.291
--- src/sys/kern/subr_autoconf.c:1.290	Mon Oct 11 10:59:09 2021
+++ src/sys/kern/subr_autoconf.c	Fri Dec 31 14:19:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.290 2021/10/11 10:59:09 jmcneill Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.291 2021/12/31 14:19:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.290 2021/10/11 10:59:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.291 2021/12/31 14:19:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -838,7 +838,6 @@ cfdriver_get_iattr(const struct cfdriver
 	return 0;
 }
 
-#if defined(DIAGNOSTIC)
 static int
 cfdriver_iattr_count(const struct cfdriver *cd)
 {
@@ -853,7 +852,6 @@ cfdriver_iattr_count(const struct cfdriv
 	}
 	return i;
 }
-#endif /* DIAGNOSTIC */
 
 /*
  * Lookup an interface attribute description by name.

Index: src/sys/kern/subr_psref.c
diff -u src/sys/kern/subr_psref.c:1.15 src/sys/kern/subr_psref.c:1.16
--- src/sys/kern/subr_psref.c:1.15	Wed Jul 21 06:35:45 2021
+++ src/sys/kern/subr_psref.c	Fri Dec 31 14:19:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_psref.c,v 1.15 2021/07/21 06:35:45 skrll Exp $	*/
+/*	$NetBSD: subr_psref.c,v 1.16 2021/12/31 14:19:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.15 2021/07/21 06:35:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.16 2021/12/31 14:19:57 riastradh Exp $");
 
 #include 
 #include 
@@ -170,7 +170,6 @@ psref_class_create(const char *name, int
 	return class;
 }
 
-#ifdef DIAGNOSTIC
 static void
 psref_cpu_drained_p(void *p, void *cookie, struct cpu_info *ci __unused)
 {
@@ -190,7 +189,6 @@ psref_class_drained_p(const struct psref
 
 	return ret;
 }
-#endif	/* DIAGNOSTIC */
 
 /*
  * psref_class_destroy(class)

Index: src/sys/kern/subr_thmap.c
diff -u src/sys/kern/subr_thmap.c:1.7 src/sys/kern/subr_thmap.c:1.8
--- src/sys/kern/subr_thmap.c:1.7	Mon Aug 31 20:22:57 2020
+++ src/sys/kern/subr_thmap.c	Fri Dec 31 14:19:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_thmap.c,v 1.7 2020/08/31 20:22:57 riastradh Exp $	*/
+/*	$NetBSD: subr_thmap.c,v 1.8 2021/12/31 14:19:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 Mindaugas Rasiukevicius 
@@ -112,7 +112,7 @@
 #include "utils.h"
 #endif
 
-THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.7 2020/08/31 20:22:57 riastradh Exp $");
+THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.8 2021/12/31 14:19:57 riastradh Exp $");
 
 #include 
 
@@ -256,13 +256,11 @@ static const 

CVS commit: src/sys

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 14:19:57 UTC 2021

Modified Files:
src/sys/dev/wscons: wsdisplay.c
src/sys/kern: subr_autoconf.c subr_psref.c subr_thmap.c
src/sys/lib/libkern: libkern.h

Log Message:
libkern: Make KASSERT verify expression is valid if !DIAGNOSTIC.

This way it is no longer necessary to mark variables __diagused if
they are used in KASSERT conditions.

Fix fallout from this by removing now-unnecessary and `#ifdef
DIAGNOSTIC'.

Don't do the same for KDASSERT if !DEBUG -- unlike KASSERT and
DIAGNOSTIC, variables needed by KDASSERT and DEBUG are likely to be
expensive to compute (and potentially difficult for a compiler to
prove flushable), so we don't want to require them under !DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.290 -r1.291 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/kern/subr_psref.c
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_thmap.c
cvs rdiff -u -r1.143 -r1.144 src/sys/lib/libkern/libkern.h

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



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 31 13:15:00 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_util.c

Log Message:
acpi: Support DT link compat string lists

A "compatible" DSD property may either be a string, or a package of
strings. Support both variants in acpi_compatible_match.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/acpi/acpi_util.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_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.28 src/sys/dev/acpi/acpi_util.c:1.29
--- src/sys/dev/acpi/acpi_util.c:1.28	Sun Dec 26 14:34:39 2021
+++ src/sys/dev/acpi/acpi_util.c	Fri Dec 31 13:15:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.28 2021/12/26 14:34:39 jmcneill Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.29 2021/12/31 13:15:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2021 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.28 2021/12/26 14:34:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.29 2021/12/31 13:15:00 jmcneill Exp $");
 
 #include 
 #include 
@@ -83,6 +83,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_util.c,
 ACPI_MODULE_NAME	("acpi_util")
 
 static void		acpi_clean_node(ACPI_HANDLE, void *);
+static ACPI_STATUS	acpi_dsd_property(ACPI_HANDLE, const char *,
+			ACPI_BUFFER *, ACPI_OBJECT_TYPE, ACPI_OBJECT **);
 
 static const char * const acpicpu_ids[] = {
 	"ACPI0007",
@@ -438,6 +440,58 @@ acpi_compatible_free_strarray(const char
 	kmem_tmpbuf_free(cpp, count * sizeof(const char *), buf);
 }
 
+static int
+acpi_compatible_match_dtlink(const struct acpi_attach_args * const aa,
+const struct device_compatible_entry * const dce)
+{
+	const char *strings[ACPI_COMPATSTR_MAX * sizeof(const char *)];
+	ACPI_HANDLE handle = aa->aa_node->ad_handle;
+	ACPI_BUFFER buf;
+	char *compatible;
+	ACPI_STATUS ret;
+	ACPI_OBJECT *obj;
+	int rv = 0, n;
+
+	buf.Pointer = NULL;
+	buf.Length = ACPI_ALLOCATE_BUFFER;
+
+	/* Match a single string _DSD value */
+	ret = acpi_dsd_string(handle, "compatible", );
+	if (ACPI_SUCCESS(ret)) {
+		strings[0] = compatible;
+		rv = device_compatible_pmatch(strings, 1, dce);
+		kmem_strfree(compatible);
+		goto done;
+	}
+
+	/* Match from a list of strings in a _DSD value */
+	ret = acpi_dsd_property(handle, "compatible", ,
+	ACPI_TYPE_PACKAGE, );
+	if (ACPI_FAILURE(ret)) {
+		goto done;
+	}
+	if (obj->Package.Count == 0) {
+		goto done;
+	}
+	for (n = 0; n < imin(obj->Package.Count, ACPI_COMPATSTR_MAX); n++) {
+		if (obj->Package.Elements[n].Type != ACPI_TYPE_STRING) {
+			goto done;
+		}
+		strings[n] = obj->Package.Elements[n].String.Pointer;
+	}
+	rv = device_compatible_pmatch(strings, n, dce);
+
+done:
+	if (buf.Pointer != NULL) {
+		ACPI_FREE(buf.Pointer);
+	}
+	if (rv) {
+		rv = (rv - 1) + ACPI_MATCHSCORE_CID;
+		return imin(rv, ACPI_MATCHSCORE_CID_MAX);
+	}
+	return 0;
+}
+
 /*
  * acpi_compatible_match --
  *
@@ -451,7 +505,6 @@ acpi_compatible_match(const struct acpi_
 	const char *strings[ACPI_COMPATSTR_MAX * sizeof(const char *)];
 	const char **cpp;
 	bool dtlink = false;
-	ACPI_STATUS ret;
 	int rv;
 
 	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE) {
@@ -494,21 +547,7 @@ acpi_compatible_match(const struct acpi_
 	}
 
 	if (dtlink) {
-		char *compatible;
-
-		ret = acpi_dsd_string(aa->aa_node->ad_handle,
-		"compatible", );
-		if (ACPI_FAILURE(ret)) {
-			return 0;
-		}
-
-		strings[0] = compatible;
-		rv = device_compatible_pmatch(strings, 1, dce);
-		kmem_strfree(compatible);
-		if (rv) {
-			rv = (rv - 1) + ACPI_MATCHSCORE_CID;
-			return imin(rv, ACPI_MATCHSCORE_CID_MAX);
-		}
+		return acpi_compatible_match_dtlink(aa, dce);
 	}
 
 	return 0;
@@ -979,6 +1018,8 @@ acpi_dsd_string(ACPI_HANDLE handle, cons
 	return rv;
 }
 
+
+
 /*
  * Device Specific Method (_DSM) support
  */



CVS commit: src/sys/dev/acpi

2021-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 31 13:15:00 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_util.c

Log Message:
acpi: Support DT link compat string lists

A "compatible" DSD property may either be a string, or a package of
strings. Support both variants in acpi_compatible_match.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/acpi/acpi_util.c

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



CVS commit: src/games/mille

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 12:42:24 UTC 2021

Modified Files:
src/games/mille: mille.6

Log Message:
s/totaled/totalled/


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/games/mille/mille.6

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

Modified files:

Index: src/games/mille/mille.6
diff -u src/games/mille/mille.6:1.12 src/games/mille/mille.6:1.13
--- src/games/mille/mille.6:1.12	Sun Apr 12 18:31:47 2009
+++ src/games/mille/mille.6	Fri Dec 31 12:42:24 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mille.6,v 1.12 2009/04/12 18:31:47 wiz Exp $
+.\"	$NetBSD: mille.6,v 1.13 2021/12/31 12:42:24 andvar Exp $
 .\"
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -349,7 +349,7 @@ This gives you more points (see
 .Sx Scoring
 below).
 .Ss Scoring :
-Scores are totaled at the end of each hand,
+Scores are totalled at the end of each hand,
 whether or not anyone completed the trip.
 The terms used in the Score window have the following meanings:
 .Bl -ohang



CVS commit: src/games/mille

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 12:42:24 UTC 2021

Modified Files:
src/games/mille: mille.6

Log Message:
s/totaled/totalled/


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/games/mille/mille.6

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



CVS commit: src/sys/netinet6

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 12:41:50 UTC 2021

Modified Files:
src/sys/netinet6: nd6.c

Log Message:
s/quetion/question/


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/netinet6/nd6.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/nd6.c
diff -u src/sys/netinet6/nd6.c:1.277 src/sys/netinet6/nd6.c:1.278
--- src/sys/netinet6/nd6.c:1.277	Tue Aug 17 09:43:21 2021
+++ src/sys/netinet6/nd6.c	Fri Dec 31 12:41:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.277 2021/08/17 09:43:21 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.278 2021/12/31 12:41:50 andvar Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.277 2021/08/17 09:43:21 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.278 2021/12/31 12:41:50 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1458,7 +1458,7 @@ nd6_cache_lladdr(
 	 * - If lladdr exist, set IsRouter.  This means (1-5).
 	 * - If it is old entry (!newentry), set IsRouter.  This means (7).
 	 * So, based on the spec, in (1-5) and (7) cases we must set IsRouter.
-	 * A quetion arises for (1) case.  (1) case has no lladdr in the
+	 * A question arises for (1) case.  (1) case has no lladdr in the
 	 * neighbor cache, this is similar to (6).
 	 * This case is rare but we figured that we MUST NOT set IsRouter.
 	 *



CVS commit: src/sys/netinet6

2021-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Dec 31 12:41:50 UTC 2021

Modified Files:
src/sys/netinet6: nd6.c

Log Message:
s/quetion/question/


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/netinet6/nd6.c

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



CVS commit: src/sys/dev/usb

2021-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec 31 12:00:18 UTC 2021

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

Log Message:
usbd_do_request_len (and friends) return usbd_status so return one in
the usbd_create_xfer failure case.  Spotted by Riastradh.


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 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.220 src/sys/dev/usb/usbdi.c:1.221
--- src/sys/dev/usb/usbdi.c:1.220	Tue Dec 21 09:51:22 2021
+++ src/sys/dev/usb/usbdi.c	Fri Dec 31 12:00:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.220 2021/12/21 09:51:22 skrll Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.221 2021/12/31 12:00:18 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.220 2021/12/21 09:51:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.221 2021/12/31 12:00:18 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1243,7 +1243,7 @@ usbd_do_request_len(struct usbd_device *
 
 	int error = usbd_create_xfer(dev->ud_pipe0, len, 0, 0, );
 	if (error)
-		return error;
+		return USBD_NOMEM;
 
 	usbd_setup_default_xfer(xfer, dev, 0, timeout, req, data,
 	UGETW(req->wLength), flags, NULL);



CVS commit: src/sys/dev/usb

2021-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec 31 12:00:18 UTC 2021

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

Log Message:
usbd_do_request_len (and friends) return usbd_status so return one in
the usbd_create_xfer failure case.  Spotted by Riastradh.


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 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: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 11:05:41 UTC 2021

Modified Files:
src/sys/dev/sysmon: swsensor.c swwdog.c sysmon.c sysmon_envsys.c
sysmon_envsys_events.c sysmon_envsysvar.h sysmon_power.c
sysmon_taskq.c sysmon_wdog.c sysmonvar.h

Log Message:
sysmon: Delete trailing whitespace.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/sysmon/swsensor.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sysmon/swwdog.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sysmon/sysmon.c
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/sysmon/sysmon_envsysvar.h
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/sysmon/sysmon_power.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sysmon/sysmon_taskq.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sysmon/sysmon_wdog.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sysmon/sysmonvar.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/sysmon/swsensor.c
diff -u src/sys/dev/sysmon/swsensor.c:1.18 src/sys/dev/sysmon/swsensor.c:1.19
--- src/sys/dev/sysmon/swsensor.c:1.18	Thu Jun 11 02:39:31 2020
+++ src/sys/dev/sysmon/swsensor.c	Fri Dec 31 11:05:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swsensor.c,v 1.18 2020/06/11 02:39:31 thorpej Exp $ */
+/*	$NetBSD: swsensor.c,v 1.19 2021/12/31 11:05:41 riastradh Exp $ */
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.18 2020/06/11 02:39:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swsensor.c,v 1.19 2021/12/31 11:05:41 riastradh Exp $");
 
 #include 
 #include 
@@ -139,18 +139,18 @@ swsensor_refresh(struct sysmon_envsys *s
  * Sensor get/set limit routines
  */
 
-static void 
+static void
 swsensor_get_limits(struct sysmon_envsys *sme, envsys_data_t *edata,
-  sysmon_envsys_lim_t *limits, uint32_t *props)  
+  sysmon_envsys_lim_t *limits, uint32_t *props)
 {
 
 	*props = PROP_CRITMIN | PROP_DRIVER_LIMITS;
 	limits->sel_critmin = sw_sensor_limit;
 }
 
-static void 
+static void
 swsensor_set_limits(struct sysmon_envsys *sme, envsys_data_t *edata,
-  sysmon_envsys_lim_t *limits, uint32_t *props)  
+  sysmon_envsys_lim_t *limits, uint32_t *props)
 {
 
 	if (limits == NULL) {
@@ -250,7 +250,7 @@ swsensor_init(void *arg)
 			/* Sensor limit behavior
 			 *	0 - simple sensor, no hw limits
 			 *	1 - simple sensor, hw provides initial limit
-			 *	2 - complex sensor, hw provides settable 
+			 *	2 - complex sensor, hw provides settable
 			 *	limits and does its own limit checking
 			 */
 			if (strcmp(key, "mode") == 0) {

Index: src/sys/dev/sysmon/swwdog.c
diff -u src/sys/dev/sysmon/swwdog.c:1.22 src/sys/dev/sysmon/swwdog.c:1.23
--- src/sys/dev/sysmon/swwdog.c:1.22	Mon Mar 16 21:20:09 2020
+++ src/sys/dev/sysmon/swwdog.c	Fri Dec 31 11:05:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swwdog.c,v 1.22 2020/03/16 21:20:09 pgoyette Exp $	*/
+/*	$NetBSD: swwdog.c,v 1.23 2021/12/31 11:05:41 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2004, 2005 Steven M. Bellovin
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: swwdog.c,v 1.22 2020/03/16 21:20:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swwdog.c,v 1.23 2021/12/31 11:05:41 riastradh Exp $");
 
 /*
  *
@@ -286,8 +286,7 @@ SYSCTL_SETUP(swwdog_sysctl_setup, "swwdo
  * Module management
  */
 
-static
-int
+static int
 swwdog_init(void *arg)
 {
 	/*
@@ -314,8 +313,7 @@ swwdog_init(void *arg)
 	return error;
 }
 
-static
-int
+static int
 swwdog_fini(void *arg)
 {
 	int error;
@@ -337,26 +335,22 @@ swwdog_fini(void *arg)
 return error;
 }
 
-static
-int
+static int
 swwdog_modcmd(modcmd_t cmd, void *arg)
 {
 	int ret;
- 
+
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		ret = swwdog_init(arg);
 		break;
- 
 	case MODULE_CMD_FINI:
 		ret = swwdog_fini(arg);
 		break;
- 
 	case MODULE_CMD_STAT:
 	default:
 		ret = ENOTTY;
 	}
- 
+
 	return ret;
 }
-

Index: src/sys/dev/sysmon/sysmon.c
diff -u src/sys/dev/sysmon/sysmon.c:1.30 src/sys/dev/sysmon/sysmon.c:1.31
--- src/sys/dev/sysmon/sysmon.c:1.30	Mon Aug 26 10:05:34 2019
+++ src/sys/dev/sysmon/sysmon.c	Fri Dec 31 11:05:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon.c,v 1.30 2019/08/26 10:05:34 nakayama Exp $	*/
+/*	$NetBSD: sysmon.c,v 1.31 2021/12/31 11:05:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon.c,v 1.30 2019/08/26 10:05:34 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon.c,v 1.31 2021/12/31 11:05:41 riastradh Exp $");
 
 #include 
 #include 
@@ -78,7 +78,7 @@ const struct cdevsw sysmon_cdevsw = {
 	.d_flag = D_OTHER | D_MPSAFE
 };
 
-static int	

CVS commit: src/sys/dev/sysmon

2021-12-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 11:05:41 UTC 2021

Modified Files:
src/sys/dev/sysmon: swsensor.c swwdog.c sysmon.c sysmon_envsys.c
sysmon_envsys_events.c sysmon_envsysvar.h sysmon_power.c
sysmon_taskq.c sysmon_wdog.c sysmonvar.h

Log Message:
sysmon: Delete trailing whitespace.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/sysmon/swsensor.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sysmon/swwdog.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sysmon/sysmon.c
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/sysmon/sysmon_envsysvar.h
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/sysmon/sysmon_power.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sysmon/sysmon_taskq.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sysmon/sysmon_wdog.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sysmon/sysmonvar.h

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