CVS commit: src/sys/dev/pci

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 07:28:34 UTC 2021

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

Log Message:
Fixup NQTXC_CMD_{TCP,UDP} after previous


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.124 src/sys/dev/pci/if_wmreg.h:1.125
--- src/sys/dev/pci/if_wmreg.h:1.124	Wed Dec 22 07:19:34 2021
+++ src/sys/dev/pci/if_wmreg.h	Wed Dec 22 07:28:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.124 2021/12/22 07:19:34 skrll Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.125 2021/12/22 07:28:34 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -1686,8 +1686,9 @@ typedef union nq_txdesc {
 #define	NQTXC_CMD_IPV_MASK		__BIT(10)
 #define	NQTXC_CMD_IP4			__SHIFTIN(1, NQTXC_CMD_IPV_MASK)
 #define	NQTXC_CMD_IP6			__SHIFTIN(0, NQTXC_CMD_IPV_MASK)
-#define	NQTXC_CMD_TCP			__BIT(11)
-#define	NQTXC_CMD_UDP			(0U << 11)
+#define	NQTXC_CMD_TP_MASK		__BIT(11)
+#define	NQTXC_CMD_TCP			__SHIFTIN(1, NQTXC_CMD_TP_MASK)
+#define	NQTXC_CMD_UDP			__SHIFTIN(0, NQTXC_CMD_TP_MASK)
 #define	NQTXC_MSSIDX_IDX_SHIFT		4	/* context index shift */
 #define	NQTXC_MSSIDX_IDX_MASK		0xf
 #define	NQTXC_MSSIDX_L4LEN_SHIFT	8	/* L4 header len shift */



CVS commit: src/sys/dev/pci

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 07:28:34 UTC 2021

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

Log Message:
Fixup NQTXC_CMD_{TCP,UDP} after previous


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/pci/if_wmreg.h

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



CVS commit: src/sys/dev/pci

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 07:19:34 UTC 2021

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

Log Message:
In a close run thing use #define everywhere for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.123 src/sys/dev/pci/if_wmreg.h:1.124
--- src/sys/dev/pci/if_wmreg.h:1.123	Wed Dec 22 07:16:44 2021
+++ src/sys/dev/pci/if_wmreg.h	Wed Dec 22 07:19:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.123 2021/12/22 07:16:44 skrll Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.124 2021/12/22 07:19:34 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -144,7 +144,7 @@ typedef union ext_rxdesc {
 	} erx_ctx;
 } __packed ext_rxdesc_t;
 
-#define EXTRXD_DD_MASK		__BIT(0)
+#define	EXTRXD_DD_MASK		__BIT(0)
 
 /*
  * erxc_rsshash is used for below 2 patterns
@@ -156,57 +156,57 @@ typedef union ext_rxdesc {
  * (2) RSS Hash
  * when RXCSUM.PCSD bit is set
  */
-#define EXTRXC_IP_ID_MASK	__BITS(15,0)
-#define EXTRXC_FRAG_CSUM_MASK	__BITS(31,16)
-#define EXTRXC_IP_ID(rsshash)	__SHIFTOUT(rsshash,ERXC_IP_ID_MASK)
-#define EXTRXC_FRAG_CSUM(rsshash) __SHIFTOUT(rsshash,ERXC_FRAG_CSUM_MASK)
+#define	EXTRXC_IP_ID_MASK	__BITS(15,0)
+#define	EXTRXC_FRAG_CSUM_MASK	__BITS(31,16)
+#define	EXTRXC_IP_ID(rsshash)	__SHIFTOUT(rsshash,ERXC_IP_ID_MASK)
+#define	EXTRXC_FRAG_CSUM(rsshash) __SHIFTOUT(rsshash,ERXC_FRAG_CSUM_MASK)
 
 /* macros for nrxc_mrq */
-#define EXTRXC_RSS_TYPE_MASK		__BITS(3,0)
+#define	EXTRXC_RSS_TYPE_MASK		__BITS(3,0)
 /* __BITS(7,4) is reserved */
-#define EXTRXC_QUEUE_MASK		__BITS(12,8)
+#define	EXTRXC_QUEUE_MASK		__BITS(12,8)
 /* __BITS(31,13) is reserved */
-#define EXTRXC_RSS_TYPE(mrq)	__SHIFTOUT(mrq,EXTRXC_RSS_TYPE_MASK)
-#define EXTRXC_QUEUE(mrq)	__SHIFTOUT(mrq,EXTRXC_QUEUE_MASK)
+#define	EXTRXC_RSS_TYPE(mrq)	__SHIFTOUT(mrq,EXTRXC_RSS_TYPE_MASK)
+#define	EXTRXC_QUEUE(mrq)	__SHIFTOUT(mrq,EXTRXC_QUEUE_MASK)
 
-#define EXTRXC_RSS_TYPE_NONE		0x0 /* No hash computation done. */
-#define EXTRXC_RSS_TYPE_TCP_IPV4	0x1
-#define EXTRXC_RSS_TYPE_IPV4		0x2
-#define EXTRXC_RSS_TYPE_TCP_IPV6	0x3
-#define EXTRXC_RSS_TYPE_IPV6_EX		0x4
-#define EXTRXC_RSS_TYPE_IPV6		0x5
+#define	EXTRXC_RSS_TYPE_NONE		0x0 /* No hash computation done. */
+#define	EXTRXC_RSS_TYPE_TCP_IPV4	0x1
+#define	EXTRXC_RSS_TYPE_IPV4		0x2
+#define	EXTRXC_RSS_TYPE_TCP_IPV6	0x3
+#define	EXTRXC_RSS_TYPE_IPV6_EX		0x4
+#define	EXTRXC_RSS_TYPE_IPV6		0x5
 /*0x6:0xF is reserved. */
 
-#define EXTRXC_STATUS_MASK	__BITS(19,0)
-#define EXTRXC_ERROR_MASK	__BITS(31,20)
-#define EXTRXC_STATUS(err_stat)	__SHIFTOUT(err_stat,EXTRXC_STATUS_MASK)
-#define EXTRXC_ERROR(err_stat)	__SHIFTOUT(err_stat,EXTRXC_ERROR_MASK)
+#define	EXTRXC_STATUS_MASK	__BITS(19,0)
+#define	EXTRXC_ERROR_MASK	__BITS(31,20)
+#define	EXTRXC_STATUS(err_stat)	__SHIFTOUT(err_stat,EXTRXC_STATUS_MASK)
+#define	EXTRXC_ERROR(err_stat)	__SHIFTOUT(err_stat,EXTRXC_ERROR_MASK)
 
 /* 3:0 is reserved. */
-#define EXTRXC_ERROR_CE		__BIT(4) /* The same as WRX_ER_CE. */
-#define EXTRXC_ERROR_SE		__BIT(5) /* The same as WRX_ER_SE. */
-#define EXTRXC_ERROR_SEQ	__BIT(6) /* The same as WRX_ER_SEQ. */
+#define	EXTRXC_ERROR_CE		__BIT(4) /* The same as WRX_ER_CE. */
+#define	EXTRXC_ERROR_SE		__BIT(5) /* The same as WRX_ER_SE. */
+#define	EXTRXC_ERROR_SEQ	__BIT(6) /* The same as WRX_ER_SEQ. */
 /* 7 is reserved. */
-#define EXTRXC_ERROR_CXE	__BIT(8) /* The same as WRX_ER_CXE. */
-#define EXTRXC_ERROR_TCPE	__BIT(9) /* The same as WRX_ER_TCPE. */
-#define EXTRXC_ERROR_IPE	__BIT(10) /* The same as WRX_ER_IPE. */
-#define EXTRXC_ERROR_RXE	__BIT(11) /* The same as WRX_ER_RXE. */
+#define	EXTRXC_ERROR_CXE	__BIT(8) /* The same as WRX_ER_CXE. */
+#define	EXTRXC_ERROR_TCPE	__BIT(9) /* The same as WRX_ER_TCPE. */
+#define	EXTRXC_ERROR_IPE	__BIT(10) /* The same as WRX_ER_IPE. */
+#define	EXTRXC_ERROR_RXE	__BIT(11) /* The same as WRX_ER_RXE. */
 
-#define EXTRXC_STATUS_DD		__BIT(0) /* The same as WRX_ST_DD. */
-#define EXTRXC_STATUS_EOP		__BIT(1) /* The same as WRX_ST_EOP. */
+#define	EXTRXC_STATUS_DD		__BIT(0) /* The same as WRX_ST_DD. */
+#define	EXTRXC_STATUS_EOP		__BIT(1) /* The same as WRX_ST_EOP. */
 /* 2 is reserved. */
-#define EXTRXC_STATUS_VP		__BIT(3) /* The same as WRX_ST_VP. */
-#define EXTRXC_STATUS_UDPCS		__BIT(4) /* UDP checksum calculated on packet. */
-#define EXTRXC_STATUS_TCPCS		__BIT(5) /* The same as WRX_ST_TCPCS. */
-#define EXTRXC_STATUS_IPCS		__BIT(6) /* The same as WRX_ST_IPCS. */
+#define	EXTRXC_STATUS_VP		__BIT(3) /* The same as WRX_ST_VP. */
+#define	EXTRXC_STATUS_UDPCS		__BIT(4) /* UDP checksum calculated on packet. */
+#define	EXTRXC_STATUS_TCPCS		__BIT(5) /* The same as WRX_ST_TCPCS. */
+#define	EXTRXC_STATUS_IPCS		__BIT(6) /* The same as WRX_ST_IPCS. */
 /* 7 is reserved. */
-#define EXTRXC

CVS commit: src/sys/dev/pci

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 07:19:34 UTC 2021

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

Log Message:
In a close run thing use #define everywhere for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/pci/if_wmreg.h

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



CVS commit: src/sys/dev/pci

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 07:16:44 UTC 2021

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

Log Message:
Use __BIT() some more. Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.122 src/sys/dev/pci/if_wmreg.h:1.123
--- src/sys/dev/pci/if_wmreg.h:1.122	Mon Dec 20 12:50:35 2021
+++ src/sys/dev/pci/if_wmreg.h	Wed Dec 22 07:16:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.122 2021/12/20 12:50:35 skrll Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.123 2021/12/22 07:16:44 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -101,28 +101,28 @@ typedef struct wiseman_rxdesc {
 } __packed wiseman_rxdesc_t;
 
 /* wrx_status bits */
-#define	WRX_ST_DD	(1U << 0)	/* descriptor done */
-#define	WRX_ST_EOP	(1U << 1)	/* end of packet */
-#define	WRX_ST_IXSM	(1U << 2)	/* ignore checksum indication */
-#define	WRX_ST_VP	(1U << 3)	/* VLAN packet */
-#define	WRX_ST_BPDU	(1U << 4)	/* ??? */
-#define	WRX_ST_TCPCS	(1U << 5)	/* TCP checksum performed */
-#define	WRX_ST_IPCS	(1U << 6)	/* IP checksum performed */
-#define	WRX_ST_PIF	(1U << 7)	/* passed in-exact filter */
+#define	WRX_ST_DD	__BIT(0)	/* descriptor done */
+#define	WRX_ST_EOP	__BIT(1)	/* end of packet */
+#define	WRX_ST_IXSM	__BIT(2)	/* ignore checksum indication */
+#define	WRX_ST_VP	__BIT(3)	/* VLAN packet */
+#define	WRX_ST_BPDU	__BIT(4)	/* ??? */
+#define	WRX_ST_TCPCS	__BIT(5)	/* TCP checksum performed */
+#define	WRX_ST_IPCS	__BIT(6)	/* IP checksum performed */
+#define	WRX_ST_PIF	__BIT(7)	/* passed in-exact filter */
 
 /* wrx_error bits */
-#define	WRX_ER_CE	(1U << 0)	/* CRC error */
-#define	WRX_ER_SE	(1U << 1)	/* symbol error */
-#define	WRX_ER_SEQ	(1U << 2)	/* sequence error */
-#define	WRX_ER_ICE	(1U << 3)	/* ??? */
-#define	WRX_ER_CXE	(1U << 4)	/* carrier extension error */
-#define	WRX_ER_TCPE	(1U << 5)	/* TCP checksum error */
-#define	WRX_ER_IPE	(1U << 6)	/* IP checksum error */
-#define	WRX_ER_RXE	(1U << 7)	/* Rx data error */
+#define	WRX_ER_CE	__BIT(0)	/* CRC error */
+#define	WRX_ER_SE	__BIT(1)	/* symbol error */
+#define	WRX_ER_SEQ	__BIT(2)	/* sequence error */
+#define	WRX_ER_ICE	__BIT(3)	/* ??? */
+#define	WRX_ER_CXE	__BIT(4)	/* carrier extension error */
+#define	WRX_ER_TCPE	__BIT(5)	/* TCP checksum error */
+#define	WRX_ER_IPE	__BIT(6)	/* IP checksum error */
+#define	WRX_ER_RXE	__BIT(7)	/* Rx data error */
 
 /* wrx_special field for VLAN packets */
 #define	WRX_VLAN_ID(x)	((x) & 0x0fff)	/* VLAN identifier */
-#define	WRX_VLAN_CFI	(1U << 12)	/* Canonical Form Indicator */
+#define	WRX_VLAN_CFI	__BIT(12)	/* Canonical Form Indicator */
 #define	WRX_VLAN_PRI(x)	(((x) >> 13) & 7)/* VLAN priority field */
 
 /* extended RX descriptor for 82574 */
@@ -348,27 +348,28 @@ typedef struct wiseman_txdesc {
 } __packed wiseman_txdesc_t;
 
 /* Commands for wtx_cmdlen */
-#define	WTX_CMD_EOP	(1U << 24)	/* end of packet */
-#define	WTX_CMD_IFCS	(1U << 25)	/* insert FCS */
-#define	WTX_CMD_RS	(1U << 27)	/* report status */
-#define	WTX_CMD_RPS	(1U << 28)	/* report packet sent */
-#define	WTX_CMD_DEXT	(1U << 29)	/* descriptor extension */
-#define	WTX_CMD_VLE	(1U << 30)	/* VLAN enable */
-#define	WTX_CMD_IDE	(1U << 31)	/* interrupt delay enable */
+#define	WTX_CMD_EOP	__BIT(24)	/* end of packet */
+#define	WTX_CMD_IFCS	__BIT(25)	/* insert FCS */
+#define	WTX_CMD_RS	__BIT(27)	/* report status */
+#define	WTX_CMD_RPS	__BIT(28)	/* report packet sent */
+#define	WTX_CMD_DEXT	__BIT(29)	/* descriptor extension */
+#define	WTX_CMD_VLE	__BIT(30)	/* VLAN enable */
+#define	WTX_CMD_IDE	__BIT(31)	/* interrupt delay enable */
 
 /* Descriptor types (if DEXT is set) */
-#define	WTX_DTYP_C	(0U << 20)	/* context */
-#define	WTX_DTYP_D	(1U << 20)	/* data */
+#define	WTX_DTYP_MASK	__BIT(20)
+#define	WTX_DTYP_C	__SHIFTIN(0, WTX_DTYP_MASK)	/* context */
+#define	WTX_DTYP_D	__SHIFTIN(1, WTX_DTYP_MASK)	/* data */
 
 /* wtx_fields status bits */
-#define	WTX_ST_DD	(1U << 0)	/* descriptor done */
-#define	WTX_ST_EC	(1U << 1)	/* excessive collisions */
-#define	WTX_ST_LC	(1U << 2)	/* late collision */
-#define	WTX_ST_TU	(1U << 3)	/* transmit underrun */
+#define	WTX_ST_DD	__BIT(0)	/* descriptor done */
+#define	WTX_ST_EC	__BIT(1)	/* excessive collisions */
+#define	WTX_ST_LC	__BIT(2)	/* late collision */
+#define	WTX_ST_TU	__BIT(3)	/* transmit underrun */
 
 /* wtx_fields option bits for IP/TCP/UDP checksum offload */
-#define	WTX_IXSM	(1U << 0)	/* IP checksum offload */
-#define	WTX_TXSM	(1U << 1)	/* TCP/UDP checksum offload */
+#define	WTX_IXSM	__BIT(0)	/* IP checksum offload */
+#define	WTX_TXSM	__BIT(1)	/* TCP/UDP checksum offload */
 
 /* Maximum payload per Tx descriptor */
 #define	WTX_MAX_LEN	4096
@@ -384,9 +385,9 @@ struct livengood_tcpip_ctxdesc {

CVS commit: src/sys/dev/pci

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 22 07:16:44 UTC 2021

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

Log Message:
Use __BIT() some more. Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/pci/if_wmreg.h

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



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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Dec 22 02:32:53 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: sni_i2c.c

Log Message:
add register definitions. the design is BCM2835 I2C look-a-like.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sociox/sni_i2c.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/sociox/sni_i2c.c
diff -u src/sys/arch/arm/sociox/sni_i2c.c:1.13 src/sys/arch/arm/sociox/sni_i2c.c:1.14
--- src/sys/arch/arm/sociox/sni_i2c.c:1.13	Tue Dec 21 06:00:45 2021
+++ src/sys/arch/arm/sociox/sni_i2c.c	Wed Dec 22 02:32:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_i2c.c,v 1.13 2021/12/21 06:00:45 nisimura Exp $	*/
+/*	$NetBSD: sni_i2c.c,v 1.14 2021/12/22 02:32:53 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.13 2021/12/21 06:00:45 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.14 2021/12/22 02:32:53 nisimura Exp $");
 
 #include 
 #include 
@@ -53,23 +53,67 @@ __KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 
 #include 
 #include 
 
+#define BSR		0x00		/* status */
+#define  BSR_BB		(1U<<7)		/* busy */
+#define  BSR_RSC	(1U<<6)		/* repeated cycle condition */
+#define  BSR_AL		(1U<<5)		/* arbitration lost */
+#define  BSR_LRB	(1U<<4)		/* last bit received */
+#define  BSR_XFR	(1U<<3)		/* start transfer */
+#define  BSR_AAS	(1U<<2)		/* ??? address as slave */
+#define  BSR_GCA	(1U<<1)		/* ??? general call address */
+#define  BSR_FBT	(1U<<0)		/* first byte transfer detected */
+#define BCR		0x04		/* control */
+#define  BCR_BERR	(1U<<7)		/* bus error report; W0C */
+#define  BCR_BEIEN	(1U<<6)		/* enable bus error interrupt */
+#define  BCR_SCC	(1U<<5)		/* make start condition */
+#define  BCR_MSS	(1U<<4)		/* 1: xmit, 0: recv */ 
+#define  BCR_ACK	(1U<<3)		/* make acknowledge at last byte */
+#define  BCR_GCAA	(1U<<2)		/* ??? general call access ack */
+#define  BCR_IEN	(1U<<1)		/* enable interupt */
+#define  BCR_INT	(1U<<0)		/* interrupt report; W0C */
+#define CCR		0x08
+#define  CCR_FM		(1U<<6)		/* speed; 1: fast, 0: standard */
+#define  CCR_EN		(1U<<5)		/* enable clock feed */
+/* 4:0 clock rate select */
+#define ADR		0x0c		/* 6:0 my own address */
+#define DAR		0x10		/* 7:0 data port */
+#define CSR		0x14		/* 5:0 clock divisor */
+#define FSR		0x18		/* bus clock frequency */
+#define BC2R		0x1c		/* control 2 */
+#define  BC2R_SDA	(1U<<5)		/* detected SDA signal */
+#define  BC2R_SCL	(1U<<5)		/* detected SCL signal */
+#define  BC2R_SDA_L	(1U<<1)		/* make SDA signal low */
+#define  BC2R_SCL_L	(1U<<1)		/* make SCL signal low */
+
 static int sniiic_fdt_match(device_t, struct cfdata *, void *);
 static void sniiic_fdt_attach(device_t, device_t, void *);
 static int sniiic_acpi_match(device_t, struct cfdata *, void *);
 static void sniiic_acpi_attach(device_t, device_t, void *);
 
+typedef enum {
+	EXEC_IDLE	= 0,	/* sane and idle */
+	EXEC_ADDR	= 1,	/* send address bits */
+	EXEC_CMD	= 2,	/* send command bits */
+	EXEC_SEND	= 3,	/* data xmit */
+	EXEC_RECV	= 4,	/* data recv */
+	EXEC_DONE	= 5,	/* xter done */
+	EXEC_ERR	= 6,	/* recover error */
+} state_t;
+
 struct sniiic_softc {
 	device_t		sc_dev;
 	struct i2c_controller	sc_ic;
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
-	bus_addr_t		sc_iob;
 	bus_size_t		sc_ios;
 	void			*sc_ih;
 	kmutex_t		sc_lock;
 	kmutex_t		sc_mtx;
 	kcondvar_t		sc_cv;
 	volatile bool		sc_busy;
+	state_t			sc_state;
+	u_int			sc_frequency;
+	u_int			sc_clkrate;
 	int			sc_phandle;
 };
 
@@ -90,9 +134,9 @@ static int sni_i2c_intr(void *);
 static void sni_i2c_reset(struct sniiic_softc *);
 static void sni_i2c_flush(struct sniiic_softc *);
 
-#define I2C_READ(sc, reg) \
+#define CSR_READ(sc, reg) \
 bus_space_read_4((sc)->sc_ioh,(sc)->sc_ioh,(reg))
-#define I2C_WRITE(sc, reg, val) \
+#define CSR_WRITE(sc, reg, val) \
 bus_space_write_4((sc)->sc_ioh,(sc)->sc_ioh,(reg),(val))
 
 static const struct device_compatible_entry compat_data[] = {
@@ -146,7 +190,6 @@ sniiic_fdt_attach(device_t parent, devic
 	sc->sc_dev = self;
 	sc->sc_iot = faa->faa_bst;
 	sc->sc_ioh = ioh;
-	sc->sc_iob = addr;
 	sc->sc_ios = size;
 	sc->sc_phandle = phandle;
 
@@ -213,7 +256,6 @@ sniiic_acpi_attach(device_t parent, devi
 	sc->sc_dev = self;
 	sc->sc_iot = aa->aa_memt;
 	sc->sc_ioh = ioh;
-	sc->sc_iob = mem->ar_base;
 	sc->sc_ios = mem->ar_length;
 	sc->sc_phandle = 0;
 



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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Dec 22 02:32:53 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: sni_i2c.c

Log Message:
add register definitions. the design is BCM2835 I2C look-a-like.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sociox/sni_i2c.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-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 00:45:53 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c d_c99_init.exp
d_init_array_using_string.c d_init_array_using_string.exp init.c
init.exp msg_179.c msg_179.exp
src/usr.bin/xlint/lint1: err.c init.c

Log Message:
lint: fix handling of initializations

The implementation from March 2021 added proper support for designators
but didn't model the brace levels correctly.  In particular, it could
not handle additional braces or omitted braces.  In such a case, lint
skipped the remaining initializers from the initialization.  Due to
this, type errors in the remaining initializers went unnoticed.  Another
effect was that arrays of unknown size were wrongly reported as having
size 0.

Both GCC and Clang recommend placing braces around each sub-type that is
initialized, such as a struct, union or array.  Postfix does not follow
these recommendations, therefore lint had to be disabled in
external/ibm-public/postfix/Makefile.inc.  This commit fixes the bugs
mentioned there.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/d_c99_init.exp
cvs rdiff -u -r1.7 -r1.8 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/init.c \
src/tests/usr.bin/xlint/lint1/init.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_179.c \
src/tests/usr.bin/xlint/lint1/msg_179.exp
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.228 -r1.229 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.35 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.36
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.35	Tue Dec 21 16:50:11 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Wed Dec 22 00:45:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.35 2021/12/21 16:50:11 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.36 2021/12/22 00:45:53 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -24,7 +24,7 @@ int scalar_with_too_many_braces = {{ 3 }
 int scalar_with_too_many_initializers = { 3, 5 };	/* expect: 174 */
 
 
-// See init_expr, 'handing over to ASSIGN'.
+// See initialization_expr, 'handing over to INIT'.
 void
 struct_initialization_via_assignment(any arg)
 {
@@ -427,31 +427,46 @@ union value unknown_union_member_name_se
 	.unknown_value = 4,	/* expect: does not have member */
 };
 
-struct point designators_with_subscript = {
+struct point subscript_designator_on_struct = {
 	[0] = 3,		/* expect: only for arrays */
-	.member[0][0].member = 4, /* expect: does not have member 'member' */
-	.x.y.z = 5,	/* intentionally not caught, see designator_look_up */
+};
+
+struct point unknown_member_on_struct = {
+	/* expect+1: error: type 'struct point' does not have member 'member' [101] */
+	.member[0][0].member = 4,
+};
+
+struct point unknown_member_on_scalar = {
+	/* expect+1: error: syntax error 'scalar type cannot use designator' [249] */
+	.x.y.z = 5,
 };
 
 struct {
 	int : 16;
-} struct_with_only_unnamed_members = {	/* expect: has no named members */
-	123,		/* expect: too many struct/union initializers */
+	/* expect+2: warning: structure has no named members [65] */
+	/* expect+1: error: cannot initialize struct/union with no named member [179] */
+} struct_with_only_unnamed_members = {
+	123,
 };
 
 union {
 	int : 16;
-} union_with_only_unnamed_members = {	/* expect: has no named members */
-	123,		/* expect: too many struct/union initializers */
+	/* expect+2: warning: union has no named members [65] */
+	/* expect+1: error: cannot initialize struct/union with no named member [179] */
+} union_with_only_unnamed_members = {
+	123,
 };
 
 int designator_for_scalar = {
 	.value = 3,		/* expect: scalar type cannot use designator */
 };
 
-struct point designator_for_scalar_in_struct = {
+struct point member_designator_for_scalar_in_struct = {
 	{ .x = 3 },		/* expect: scalar type cannot use designator */
-	{ [1] = 4 },		/* expect: scalar type cannot use designator */
+};
+struct point subscript_designator_for_scalar_in_struct = {
+	/* expect+1: error: syntax error 'designator '[...]' is only for arrays' [249] */
+	{ [1] = 4 },
 };
 
 

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.27 src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.28
--- src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.27	Fri Dec 17 15:52:30 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.exp	Wed Dec 22 00:45:53 2021
@@ -18,11 +18,12 @@ d_c99_init.c(412): error: type 'struct p
 d_c99_init.c(421): e

CVS commit: src

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Dec 22 00:45:53 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c d_c99_init.exp
d_init_array_using_string.c d_init_array_using_string.exp init.c
init.exp msg_179.c msg_179.exp
src/usr.bin/xlint/lint1: err.c init.c

Log Message:
lint: fix handling of initializations

The implementation from March 2021 added proper support for designators
but didn't model the brace levels correctly.  In particular, it could
not handle additional braces or omitted braces.  In such a case, lint
skipped the remaining initializers from the initialization.  Due to
this, type errors in the remaining initializers went unnoticed.  Another
effect was that arrays of unknown size were wrongly reported as having
size 0.

Both GCC and Clang recommend placing braces around each sub-type that is
initialized, such as a struct, union or array.  Postfix does not follow
these recommendations, therefore lint had to be disabled in
external/ibm-public/postfix/Makefile.inc.  This commit fixes the bugs
mentioned there.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/d_c99_init.exp
cvs rdiff -u -r1.7 -r1.8 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/init.c \
src/tests/usr.bin/xlint/lint1/init.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_179.c \
src/tests/usr.bin/xlint/lint1/msg_179.exp
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.228 -r1.229 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/sys/compat/netbsd32

2021-12-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Dec 22 00:21:32 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Handle the SIOCGNBRINFO ioctl for compat32.
arp -a works with compat32 now.

Credit to simonb@ for the ndp fix from which this is cribbed.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.78 -r1.79 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.119 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.120
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.119	Wed Apr 14 16:26:23 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Wed Dec 22 00:21:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.119 2021/04/14 16:26:23 mlelstv Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.120 2021/12/22 00:21:32 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.119 2021/04/14 16:26:23 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.120 2021/12/22 00:21:32 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -180,6 +180,18 @@ netbsd32_to_ifmediareq(struct netbsd32_i
 }
 
 static inline void
+netbsd32_to_in_nbrinfo(struct netbsd32_in_nbrinfo *s32p, struct in_nbrinfo *p,
+u_long cmd)
+{
+
+	memcpy(p->ifname, s32p->ifname, sizeof p->ifname);
+	memcpy(&p->addr, &s32p->addr, sizeof p->addr);
+	p->asked = s32p->asked;
+	p->state = s32p->state;
+	p->expire = s32p->expire;
+}
+
+static inline void
 netbsd32_to_in6_nbrinfo(struct netbsd32_in6_nbrinfo *s32p, struct in6_nbrinfo *p,
 u_long cmd)
 {
@@ -190,7 +202,6 @@ netbsd32_to_in6_nbrinfo(struct netbsd32_
 	p->isrouter = s32p->isrouter;
 	p->state = s32p->state;
 	p->expire = s32p->expire;
-	
 }
 
 static inline void
@@ -715,6 +726,18 @@ netbsd32_from_ifmediareq(struct ifmediar
 }
 
 static inline void
+netbsd32_from_in_nbrinfo(struct in_nbrinfo *p, struct netbsd32_in_nbrinfo *s32p,
+u_long cmd)
+{
+
+	memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname);
+	memcpy(&s32p->addr, &p->addr, sizeof s32p->addr);
+	s32p->asked = p->asked;
+	s32p->state = p->state;
+	s32p->expire = p->expire;
+}
+
+static inline void
 netbsd32_from_in6_nbrinfo(struct in6_nbrinfo *p, struct netbsd32_in6_nbrinfo *s32p,
 u_long cmd)
 {
@@ -1525,6 +1548,8 @@ netbsd32_ioctl(struct lwp *l,
 	case SIOCGIFMEDIA32:
 		IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq);
 
+	case SIOCGNBRINFO32:
+		IOCTL_STRUCT_CONV_TO(SIOCGNBRINFO, in_nbrinfo);
 	case SIOCGNBRINFO_IN632:
 		IOCTL_STRUCT_CONV_TO(SIOCGNBRINFO_IN6, in6_nbrinfo);
 

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.78 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.79
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.78	Wed Apr 14 16:26:23 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Wed Dec 22 00:21:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.78 2021/04/14 16:26:23 mlelstv Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.79 2021/12/22 00:21:32 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -480,6 +480,17 @@ struct netbsd32_sioc_vif_req {
 /* from  */
 #define	SIOCGETVIFCNT32	_IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */
 
+/* from  */
+struct netbsd32_in_nbrinfo {
+	char ifname[IFNAMSIZ];	/* if name, e.g. "en0" */
+	struct in_addr	addr;	/* IPv4 address of the neighbor */
+	netbsd32_long	asked;	/* number of queries already sent for this addr */
+	int	state;		/* reachability state */
+	int	expire;		/* lifetime for NDP state transition */
+};
+/* from  */
+#define	SIOCGNBRINFO32		_IOWR('i', 249, struct netbsd32_in_nbrinfo)
+
 /* from  */
 struct netbsd32_in6_nbrinfo {
 	char ifname[IFNAMSIZ];	/* if name, e.g. "en0" */



CVS commit: src/sys/compat/netbsd32

2021-12-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Dec 22 00:21:32 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Handle the SIOCGNBRINFO ioctl for compat32.
arp -a works with compat32 now.

Credit to simonb@ for the ndp fix from which this is cribbed.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.78 -r1.79 src/sys/compat/netbsd32/netbsd32_ioctl.h

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



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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 23:40:03 UTC 2021

Removed Files:
src/sys/arch/sandpoint/conf: ENCPP1

Log Message:
retire Ampro EnCorePP1 board configuration


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r0 src/sys/arch/sandpoint/conf/ENCPP1

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



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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 23:40:03 UTC 2021

Removed Files:
src/sys/arch/sandpoint/conf: ENCPP1

Log Message:
retire Ampro EnCorePP1 board configuration


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r0 src/sys/arch/sandpoint/conf/ENCPP1

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 23:12:21 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_171.c

Log Message:
tests/lint: extend test for nested initializations


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_171.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 23:12:21 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_171.c

Log Message:
tests/lint: extend test for nested initializations


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_171.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_171.c
diff -u src/tests/usr.bin/xlint/lint1/msg_171.c:1.6 src/tests/usr.bin/xlint/lint1/msg_171.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_171.c:1.6	Tue Mar 23 18:40:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_171.c	Tue Dec 21 23:12:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_171.c,v 1.6 2021/03/23 18:40:50 rillig Exp $	*/
+/*	$NetBSD: msg_171.c,v 1.7 2021/12/21 23:12:21 rillig Exp $	*/
 # 3 "msg_171.c"
 
 // Test for message: cannot assign to '%s' from '%s' [171]
@@ -37,6 +37,27 @@ pointer_to_compound_literal(void)
 		int y;
 	};
 	struct point *p = &(struct point){
-	12, 5,
+		12, 5,
+	};
+
+	/*
+	 * A sizeof expression is another way to create nested
+	 * initializations.
+	 */
+	struct point p2 = {
+		(int)sizeof(struct point){
+			(int)sizeof(struct point){
+(int)sizeof(struct point){
+	(int)sizeof(struct point){
+		0,
+		0,
+	},
+	0,
+},
+0,
+			},
+			0,
+		},
+		0,
 	};
 }



CVS commit: src/sys/dev/scsipi

2021-12-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 21 22:53:21 UTC 2021

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

Log Message:
scsi(4): Take kernel lock around entry into autoconf.

This code paths is entered by kthreads marked MP-safe, not just from
autoconf.

I'm not sure this is sufficient -- it's not clear to me whether
anything prevents concurrently scanning the same target.  Someone with
a better understanding of scsi(4) locking will have to audit this.

(For example, maybe it is guaranteed only to happen only either (a)
in autoconf, or (b) in a thread that doesn't start until autoconf is
done.  But I don't know -- and if it is this, it should be asserted
so we can verify it.)


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/dev/scsipi/scsiconf.c

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

Modified files:

Index: src/sys/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.292 src/sys/dev/scsipi/scsiconf.c:1.293
--- src/sys/dev/scsipi/scsiconf.c:1.292	Sat Aug  7 16:19:16 2021
+++ src/sys/dev/scsipi/scsiconf.c	Tue Dec 21 22:53:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.292 2021/08/07 16:19:16 thorpej Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.293 2021/12/21 22:53:21 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.292 2021/08/07 16:19:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.293 2021/12/21 22:53:21 riastradh Exp $");
 
 #include 
 #include 
@@ -1012,6 +1012,7 @@ scsi_probe_device(struct scsibus_softc *
 	locs[SCSIBUSCF_TARGET] = target;
 	locs[SCSIBUSCF_LUN] = lun;
 
+	KERNEL_LOCK(1, NULL);
 	if ((cf = config_search(sc->sc_dev, &sa,
 CFARGS(.submatch = config_stdsubmatch,
    .locators = locs))) != NULL) {
@@ -1034,9 +1035,11 @@ scsi_probe_device(struct scsibus_softc *
 		 */
 		config_attach(sc->sc_dev, cf, &sa, scsibusprint,
 		CFARGS(.locators = locs));
+		KERNEL_UNLOCK_ONE(NULL);
 	} else {
 		scsibusprint(&sa, device_xname(sc->sc_dev));
 		aprint_normal(" not configured\n");
+		KERNEL_UNLOCK_ONE(NULL);
 		goto bad;
 	}
 



CVS commit: src/sys/dev/scsipi

2021-12-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 21 22:53:21 UTC 2021

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

Log Message:
scsi(4): Take kernel lock around entry into autoconf.

This code paths is entered by kthreads marked MP-safe, not just from
autoconf.

I'm not sure this is sufficient -- it's not clear to me whether
anything prevents concurrently scanning the same target.  Someone with
a better understanding of scsi(4) locking will have to audit this.

(For example, maybe it is guaranteed only to happen only either (a)
in autoconf, or (b) in a thread that doesn't start until autoconf is
done.  But I don't know -- and if it is this, it should be asserted
so we can verify it.)


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/dev/scsipi/scsiconf.c

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



CVS commit: src

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 22:21:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_init_array_using_string.c
d_init_array_using_string.exp msg_187.c msg_187.exp
src/usr.bin/xlint/lint1: err.c init.c

Log Message:
lint: reword message 187 about too long string literal for initializer

The previous message was imprecise in that it didn't distinguish between
non-terminating and terminating null bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_187.c \
src/tests/usr.bin/xlint/lint1/msg_187.exp
cvs rdiff -u -r1.148 -r1.149 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.227 -r1.228 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c
diff -u src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.6 src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.7
--- src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.6	Fri Sep 10 20:02:51 2021
+++ src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c	Tue Dec 21 22:21:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_init_array_using_string.c,v 1.6 2021/09/10 20:02:51 rillig Exp $	*/
+/*	$NetBSD: d_init_array_using_string.c,v 1.7 2021/12/21 22:21:11 rillig Exp $	*/
 # 3 "d_init_array_using_string.c"
 
 /*
@@ -70,8 +70,10 @@ test_array_initialization_in_struct(void
 	};
 
 	struct cs_ws too_many_characters = {
-		"0123456789X",	/* expect: non-null byte ignored */
-		L"0123456789X",	/* expect: non-null byte ignored */
+		/* expect+1: warning: string literal too long (11) for target array (10) */
+		"0123456789X",
+		/* expect+1: warning: string literal too long (11) for target array (10) */
+		L"0123456789X",
 	};
 
 	struct cs_ws extra_braces = {
Index: src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
diff -u src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp:1.6 src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp:1.7
--- src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp:1.6	Sat Aug 14 13:00:55 2021
+++ src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp	Tue Dec 21 22:21:11 2021
@@ -4,5 +4,5 @@ d_init_array_using_string.c(37): warning
 d_init_array_using_string.c(39): warning: illegal combination of 'pointer to const int' and 'pointer to char', op 'init' [124]
 d_init_array_using_string.c(63): error: cannot initialize 'array[10] of const char' from 'pointer to int' [185]
 d_init_array_using_string.c(64): error: cannot initialize 'array[10] of const int' from 'pointer to char' [185]
-d_init_array_using_string.c(73): warning: non-null byte ignored in string initializer [187]
-d_init_array_using_string.c(74): warning: non-null byte ignored in string initializer [187]
+d_init_array_using_string.c(74): warning: string literal too long (11) for target array (10) [187]
+d_init_array_using_string.c(76): warning: string literal too long (11) for target array (10) [187]

Index: src/tests/usr.bin/xlint/lint1/msg_187.c
diff -u src/tests/usr.bin/xlint/lint1/msg_187.c:1.3 src/tests/usr.bin/xlint/lint1/msg_187.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_187.c:1.3	Thu Sep  2 18:20:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_187.c	Tue Dec 21 22:21:11 2021
@@ -1,25 +1,22 @@
-/*	$NetBSD: msg_187.c,v 1.3 2021/09/02 18:20:00 rillig Exp $	*/
+/*	$NetBSD: msg_187.c,v 1.4 2021/12/21 22:21:11 rillig Exp $	*/
 # 3 "msg_187.c"
 
-// Test for message: non-null byte ignored in string initializer [187]
+// Test for message: string literal too long (%lu) for target array (%lu) [187]
 
 char auto_msg[] = "the string length is determined automatically";
 
+/* The terminating null byte is not copied to the array. */
 char large_enough[10] = "0123456789";
 
-/* expect+1: warning: non-null byte ignored in string initializer [187] */
+/* expect+1: warning: string literal too long (10) for target array (9) [187] */
 char too_small[9] = "0123456789";
 
 char x0[3] = "x\0";
 
 char xx0[3] = "xx\0";
 
-/* expect+1: warning: non-null byte ignored in string initializer [187] */
+/* expect+1: warning: string literal too long (4) for target array (3) [187] */
 char xxx0[3] = "012\0";
 
-/*
- * The warning is not entirely correct.  It is a non-terminating byte that
- * is ignored.
- */
-/* expect+1: warning: non-null byte ignored in string initializer [187] */
+/* expect+1: warning: string literal too long (4) for target array (3) [187] */
 char xx00[3] = "01\0\0";
Index: src/tests/usr.bin/xlint/lint1/msg_187.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_187.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_187.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_187.exp:1.3	Thu Sep  2 18:20:00 2021
+++ src/

CVS commit: src

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 22:21:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_init_array_using_string.c
d_init_array_using_string.exp msg_187.c msg_187.exp
src/usr.bin/xlint/lint1: err.c init.c

Log Message:
lint: reword message 187 about too long string literal for initializer

The previous message was imprecise in that it didn't distinguish between
non-terminating and terminating null bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_187.c \
src/tests/usr.bin/xlint/lint1/msg_187.exp
cvs rdiff -u -r1.148 -r1.149 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.227 -r1.228 src/usr.bin/xlint/lint1/init.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-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 21:42:21 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: init.c init.exp
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: treat incomplete union in the same way as incomplete struct

The newly added tests triggered the assertion in begin_designation since
for incomplete types the initialization is stopped before handling the
first brace.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/init.c \
src/tests/usr.bin/xlint/lint1/init.exp
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/xlint/lint1/init.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-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 21:42:21 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: init.c init.exp
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: treat incomplete union in the same way as incomplete struct

The newly added tests triggered the assertion in begin_designation since
for incomplete types the initialization is stopped before handling the
first brace.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/init.c \
src/tests/usr.bin/xlint/lint1/init.exp
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/init.c
diff -u src/tests/usr.bin/xlint/lint1/init.c:1.8 src/tests/usr.bin/xlint/lint1/init.c:1.9
--- src/tests/usr.bin/xlint/lint1/init.c:1.8	Tue Dec 21 21:16:08 2021
+++ src/tests/usr.bin/xlint/lint1/init.c	Tue Dec 21 21:42:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.8 2021/12/21 21:16:08 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.9 2021/12/21 21:42:21 rillig Exp $	*/
 # 3 "init.c"
 
 /*
@@ -73,14 +73,32 @@ struct {
 	do_nothing,
 };
 
+
+/* expect+1: error: initialization of incomplete type 'incomplete struct incomplete_struct' [175] */
+struct incomplete_struct s1 = {
+	1,
+/* expect+1: error: 's1' has incomplete type 'incomplete struct incomplete_struct' [31] */
+};
+
+/* expect+1: error: initialization of incomplete type 'incomplete struct incomplete_struct' [175] */
+struct incomplete_struct s2 = {
+	.member = 1,
+/* expect+1: error: 's2' has incomplete type 'incomplete struct incomplete_struct' [31] */
+};
+
+struct incomplete_struct {
+	int num;
+};
+
+
+/* expect+1: error: initialization of incomplete type 'incomplete union incomplete_union' [175] */
 union incomplete_union u1 = {
-	/* expect+1: error: too many struct/union initializers [172] */
 	1,
 /* expect+1: error: 'u1' has incomplete type 'incomplete union incomplete_union' [31] */
 };
 
+/* expect+1: error: initialization of incomplete type 'incomplete union incomplete_union' [175] */
 union incomplete_union u2 = {
-	/* expect+1: error: type 'incomplete union incomplete_union' does not have member 'member' [101] */
 	.member = 1,
 /* expect+1: error: 'u2' has incomplete type 'incomplete union incomplete_union' [31] */
 };
Index: src/tests/usr.bin/xlint/lint1/init.exp
diff -u src/tests/usr.bin/xlint/lint1/init.exp:1.8 src/tests/usr.bin/xlint/lint1/init.exp:1.9
--- src/tests/usr.bin/xlint/lint1/init.exp:1.8	Tue Dec 21 21:16:08 2021
+++ src/tests/usr.bin/xlint/lint1/init.exp	Tue Dec 21 21:42:21 2021
@@ -1,5 +1,9 @@
 init.c(16): error: empty array declaration: empty_array_with_initializer [190]
-init.c(78): error: too many struct/union initializers [172]
-init.c(80): error: 'u1' has incomplete type 'incomplete union incomplete_union' [31]
-init.c(84): error: type 'incomplete union incomplete_union' does not have member 'member' [101]
-init.c(86): error: 'u2' has incomplete type 'incomplete union incomplete_union' [31]
+init.c(78): error: initialization of incomplete type 'incomplete struct incomplete_struct' [175]
+init.c(81): error: 's1' has incomplete type 'incomplete struct incomplete_struct' [31]
+init.c(84): error: initialization of incomplete type 'incomplete struct incomplete_struct' [175]
+init.c(87): error: 's2' has incomplete type 'incomplete struct incomplete_struct' [31]
+init.c(95): error: initialization of incomplete type 'incomplete union incomplete_union' [175]
+init.c(98): error: 'u1' has incomplete type 'incomplete union incomplete_union' [31]
+init.c(101): error: initialization of incomplete type 'incomplete union incomplete_union' [175]
+init.c(104): error: 'u2' has incomplete type 'incomplete union incomplete_union' [31]

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.226 src/usr.bin/xlint/lint1/init.c:1.227
--- src/usr.bin/xlint/lint1/init.c:1.226	Tue Dec 21 21:04:08 2021
+++ src/usr.bin/xlint/lint1/init.c	Tue Dec 21 21:42:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.226 2021/12/21 21:04:08 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.227 2021/12/21 21:42:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.226 2021/12/21 21:04:08 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.227 2021/12/21 21:42:21 rillig Exp $");
 #endif
 
 #include 
@@ -731,7 +731,7 @@ initialization_lbrace(initialization *in
 		warning(238);
 	}
 
-	if (tp->t_tspec == STRUCT && tp->t_str->sou_incomplete) {
+	if (is_struct_or_union(tp->t_tspec) && tp->t_str->sou_incomplete) {
 		/* initialization of incomplete type '%s' */
 		error(175, type_name(tp));
 		in->in_err = true;
@@ -990,9 +990,14 @@ end_initialization(void)
 void
 begin_designation(void)
 {
+	initialization *in;
 	brace_level *bl;
 
-	bl = current_init()-

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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 21:30:49 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
pursue better register description


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/sociox/if_scx.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/arm/sociox

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 21:30:49 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
pursue better register description


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/sociox/if_scx.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/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.32 src/sys/arch/arm/sociox/if_scx.c:1.33
--- src/sys/arch/arm/sociox/if_scx.c:1.32	Tue Dec 21 12:12:52 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Tue Dec 21 21:30:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.32 2021/12/21 12:12:52 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.33 2021/12/21 21:30:49 nisimura 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.32 2021/12/21 12:12:52 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.33 2021/12/21 21:30:49 nisimura Exp $");
 
 #include 
 #include 
@@ -163,7 +163,7 @@ struct rdes {
 #define  DESCNF_CHRST	(1U<<30)	/* channel reset */
 #define  DESCNF_TMR	(1U<<4)		/* coalesce timer mode select */
 #define  DESCNF_LE	(1)		/* little endian desc format */
-#define TXSUBMIT	0x410		/* submit loaded tx frame */
+#define TXSUBMIT	0x410		/* submit frame(s) to transmit */
 #define TXCLSCMAX	0x418		/* tx intr coalesce upper bound */
 #define RXCLSCMAX	0x458		/* rx intr coalesce upper bound */
 #define TXITIMER	0x420		/* coalesce timer usec, MSB to use */



CVS commit: src/usr.sbin/makefs

2021-12-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec 21 21:28:31 UTC 2021

Modified Files:
src/usr.sbin/makefs: cd9660.c

Log Message:
s/filname/filename/


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/cd9660.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660.c
diff -u src/usr.sbin/makefs/cd9660.c:1.57 src/usr.sbin/makefs/cd9660.c:1.58
--- src/usr.sbin/makefs/cd9660.c:1.57	Tue Nov 10 20:48:29 2020
+++ src/usr.sbin/makefs/cd9660.c	Tue Dec 21 21:28:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.c,v 1.57 2020/11/10 20:48:29 reinoud Exp $	*/
+/*	$NetBSD: cd9660.c,v 1.58 2021/12/21 21:28:31 andvar Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.57 2020/11/10 20:48:29 reinoud Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.58 2021/12/21 21:28:31 andvar Exp $");
 #endif  /* !__lint */
 
 #include 
@@ -1011,7 +1011,7 @@ cd9660_sorted_child_insert(cd9660node *p
 
 /*
  * Called After cd9660_sorted_child_insert
- * handles file collisions by suffixing each filname with ~n
+ * handles file collisions by suffixing each filename with ~n
  * where n represents the files respective place in the ordering
  */
 static int



CVS commit: src/usr.sbin/makefs

2021-12-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec 21 21:28:31 UTC 2021

Modified Files:
src/usr.sbin/makefs: cd9660.c

Log Message:
s/filname/filename/


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/cd9660.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 21:16:08 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: init.c init.exp

Log Message:
tests/lint: test initialization of incomplete union

The function initialization_lbrace only mentions STRUCT, which looks
suspicious.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/init.c \
src/tests/usr.bin/xlint/lint1/init.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/init.c
diff -u src/tests/usr.bin/xlint/lint1/init.c:1.7 src/tests/usr.bin/xlint/lint1/init.c:1.8
--- src/tests/usr.bin/xlint/lint1/init.c:1.7	Fri Dec 17 11:06:15 2021
+++ src/tests/usr.bin/xlint/lint1/init.c	Tue Dec 21 21:16:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.7 2021/12/17 11:06:15 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.8 2021/12/21 21:16:08 rillig Exp $	*/
 # 3 "init.c"
 
 /*
@@ -72,3 +72,19 @@ struct {
 	do_nothing,
 	do_nothing,
 };
+
+union incomplete_union u1 = {
+	/* expect+1: error: too many struct/union initializers [172] */
+	1,
+/* expect+1: error: 'u1' has incomplete type 'incomplete union incomplete_union' [31] */
+};
+
+union incomplete_union u2 = {
+	/* expect+1: error: type 'incomplete union incomplete_union' does not have member 'member' [101] */
+	.member = 1,
+/* expect+1: error: 'u2' has incomplete type 'incomplete union incomplete_union' [31] */
+};
+
+union incomplete_union {
+	int num;
+};
Index: src/tests/usr.bin/xlint/lint1/init.exp
diff -u src/tests/usr.bin/xlint/lint1/init.exp:1.7 src/tests/usr.bin/xlint/lint1/init.exp:1.8
--- src/tests/usr.bin/xlint/lint1/init.exp:1.7	Fri Dec 17 11:06:15 2021
+++ src/tests/usr.bin/xlint/lint1/init.exp	Tue Dec 21 21:16:08 2021
@@ -1 +1,5 @@
 init.c(16): error: empty array declaration: empty_array_with_initializer [190]
+init.c(78): error: too many struct/union initializers [172]
+init.c(80): error: 'u1' has incomplete type 'incomplete union incomplete_union' [31]
+init.c(84): error: type 'incomplete union incomplete_union' does not have member 'member' [101]
+init.c(86): error: 'u2' has incomplete type 'incomplete union incomplete_union' [31]



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 21:16:08 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: init.c init.exp

Log Message:
tests/lint: test initialization of incomplete union

The function initialization_lbrace only mentions STRUCT, which looks
suspicious.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/init.c \
src/tests/usr.bin/xlint/lint1/init.exp

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 21:04:08 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: debug.c externs1.h init.c

Log Message:
lint: rename debug_indent to debug_print_indent

The previous name could be mistaken to mean "increase the indentation of
the debug output".  Instead, the function prints the current indentation.

In externs1.h, the macro definition was a duplicate, the macros were
sorted differently than the functions a few lines above.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.143 -r1.144 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 21:04:08 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: debug.c externs1.h init.c

Log Message:
lint: rename debug_indent to debug_print_indent

The previous name could be mistaken to mean "increase the indentation of
the debug output".  Instead, the function prints the current indentation.

In externs1.h, the macro definition was a duplicate, the macros were
sorted differently than the functions a few lines above.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.143 -r1.144 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.6 src/usr.bin/xlint/lint1/debug.c:1.7
--- src/usr.bin/xlint/lint1/debug.c:1.6	Mon Dec 20 00:10:07 2021
+++ src/usr.bin/xlint/lint1/debug.c	Tue Dec 21 21:04:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.6 2021/12/20 00:10:07 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.7 2021/12/21 21:04:08 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: debug.c,v 1.6 2021/12/20 00:10:07 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.7 2021/12/21 21:04:08 rillig Exp $");
 #endif
 
 #include 
@@ -59,7 +59,7 @@ debug_printf(const char *fmt, ...)
 }
 
 void
-debug_indent(void)
+debug_print_indent(void)
 {
 
 	debug_printf("%*s", 2 * debug_indentation, "");
@@ -91,7 +91,7 @@ debug_step(const char *fmt, ...)
 {
 	va_list va;
 
-	debug_indent();
+	debug_print_indent();
 	va_start(va, fmt);
 	vfprintf(stdout, fmt, va);
 	va_end(va);
@@ -116,7 +116,7 @@ debug_node(const tnode_t *tn)
 	}
 
 	op = tn->tn_op;
-	debug_indent();
+	debug_print_indent();
 	debug_printf("'%s' with type '%s'%s%s%s",
 	op == CVT && !tn->tn_cast ? "convert" : modtab[op].m_name,
 	type_name(tn->tn_type), tn->tn_lvalue ? ", lvalue" : "",

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.143 src/usr.bin/xlint/lint1/externs1.h:1.144
--- src/usr.bin/xlint/lint1/externs1.h:1.143	Mon Dec 20 19:34:01 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Tue Dec 21 21:04:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.143 2021/12/20 19:34:01 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.144 2021/12/21 21:04:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -118,7 +118,7 @@ extern	void	expr_restore_memory(struct m
 #ifdef DEBUG
 void	debug_node(const tnode_t *);
 void	debug_printf(const char *fmt, ...) __printflike(1, 2);
-void	debug_indent(void);
+void	debug_print_indent(void);
 void	debug_indent_inc(void);
 void	debug_indent_dec(void);
 void	debug_enter(const char *);
@@ -130,12 +130,11 @@ void	debug_leave(const char *);
 #define	debug_noop()		do { } while (false)
 #define	debug_node(tn)		debug_noop()
 #define	debug_printf(...)	debug_noop()
-#define	debug_indent()		debug_noop()
-#define	debug_step(...)		debug_noop()
-#define	debug_indent()		debug_noop()
+#define	debug_print_indent()	debug_noop()
 #define	debug_indent_inc()	debug_noop()
 #define	debug_indent_dec()	debug_noop()
 #define	debug_enter()		debug_noop()
+#define	debug_step(...)		debug_noop()
 #define	debug_leave()		debug_noop()
 #endif
 

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.225 src/usr.bin/xlint/lint1/init.c:1.226
--- src/usr.bin/xlint/lint1/init.c:1.225	Tue Dec 21 16:50:11 2021
+++ src/usr.bin/xlint/lint1/init.c	Tue Dec 21 21:04:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.225 2021/12/21 16:50:11 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.226 2021/12/21 21:04:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.225 2021/12/21 16:50:11 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.226 2021/12/21 21:04:08 rillig Exp $");
 #endif
 
 #include 
@@ -436,7 +436,7 @@ designation_debug(const designation *dn)
 	if (dn->dn_len == 0)
 		return;
 
-	debug_indent();
+	debug_print_indent();
 	debug_printf("designation: ");
 	for (i = 0; i < dn->dn_len; i++) {
 		const designator *dr = dn->dn_items + i;
@@ -680,7 +680,7 @@ initialization_debug(const initializatio
 
 	i = 0;
 	for (bl = in->in_brace_level; bl != NULL; bl = bl->bl_enclosing) {
-		debug_indent();
+		debug_print_indent();
 		debug_printf("brace level %zu: ", i);
 		brace_level_debug(bl);
 		i++;



CVS commit: src/sys/external/bsd

2021-12-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 21 19:07:09 UTC 2021

Modified Files:
src/sys/external/bsd/common/include/linux: slab.h
src/sys/external/bsd/drm2/dist/drm/i915: i915_request.c

Log Message:
- For kmem_cache_create_dtor(), use a pre-destructor to issue the
  synchronize_rcu() if the caller uses SLAB_TYPESAFE_BY_RCU.  A
  special pool allocator is not required in this case.
- Now that SLAB_TYPESAFE_BY_RCU does the right thing, no need to
  call synchronize_rcu() in __i915_request_dtor().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/common/include/linux/slab.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_request.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/include/linux/slab.h
diff -u src/sys/external/bsd/common/include/linux/slab.h:1.10 src/sys/external/bsd/common/include/linux/slab.h:1.11
--- src/sys/external/bsd/common/include/linux/slab.h:1.10	Sun Dec 19 12:20:46 2021
+++ src/sys/external/bsd/common/include/linux/slab.h	Tue Dec 21 19:07:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: slab.h,v 1.10 2021/12/19 12:20:46 riastradh Exp $	*/
+/*	$NetBSD: slab.h,v 1.11 2021/12/21 19:07:09 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -212,6 +212,12 @@ kmem_cache_dtor(void *cookie, void *ptr)
 		(*kc->kc_dtor)(ptr);
 }
 
+static void
+kmem_cache_pre_dtor(void *cookie)
+{
+	synchronize_rcu();
+}
+
 static inline struct kmem_cache *
 kmem_cache_create(const char *name, size_t size, size_t align,
 unsigned long flags, void (*ctor)(void *))
@@ -243,8 +249,10 @@ kmem_cache_create_dtor(const char *name,
 
 	if (ISSET(flags, SLAB_HWCACHE_ALIGN))
 		align = roundup(MAX(1, align), CACHE_LINE_SIZE);
-	if (ISSET(flags, SLAB_TYPESAFE_BY_RCU))
-		palloc = &pool_allocator_kmem_rcu;
+	/*
+	 * No need to use pool_allocator_kmem_rcu here; RCU synchronization
+	 * will be handled by the pre-destructor hook.
+	 */
 
 	kc = kmem_alloc(sizeof(*kc), KM_SLEEP);
 	kc->kc_pool_cache = pool_cache_init(size, align, 0, 0, name, palloc,
@@ -252,6 +260,10 @@ kmem_cache_create_dtor(const char *name,
 	kc->kc_size = size;
 	kc->kc_ctor = ctor;
 	kc->kc_dtor = dtor;
+	if (ISSET(flags, SLAB_TYPESAFE_BY_RCU)) {
+		pool_cache_setpredestruct(kc->kc_pool_cache,
+		kmem_cache_pre_dtor);
+	}
 
 	return kc;
 }

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c:1.12 src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c:1.13
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c:1.12	Sun Dec 19 12:34:34 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c	Tue Dec 21 19:07:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_request.c,v 1.12 2021/12/19 12:34:34 riastradh Exp $	*/
+/*	$NetBSD: i915_request.c,v 1.13 2021/12/21 19:07:09 thorpej Exp $	*/
 
 /*
  * Copyright © 2008-2015 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.12 2021/12/19 12:34:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.13 2021/12/21 19:07:09 thorpej Exp $");
 
 #include 
 #include 
@@ -614,11 +614,6 @@ static void __i915_request_dtor(void *ar
 {
 	struct i915_request *rq = arg;
 
-#ifdef __NetBSD__
-	/* XXX pool cache does not guarantee this for us.  */
-	synchronize_rcu();
-#endif
-
 	dma_fence_destroy(&rq->fence);
 #ifdef __NetBSD__
 	i915_sw_fence_fini(&rq->submit);



CVS commit: src/sys/external/bsd

2021-12-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 21 19:07:09 UTC 2021

Modified Files:
src/sys/external/bsd/common/include/linux: slab.h
src/sys/external/bsd/drm2/dist/drm/i915: i915_request.c

Log Message:
- For kmem_cache_create_dtor(), use a pre-destructor to issue the
  synchronize_rcu() if the caller uses SLAB_TYPESAFE_BY_RCU.  A
  special pool allocator is not required in this case.
- Now that SLAB_TYPESAFE_BY_RCU does the right thing, no need to
  call synchronize_rcu() in __i915_request_dtor().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/common/include/linux/slab.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c

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



CVS commit: src/sys/kern

2021-12-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 21 19:00:38 UTC 2021

Modified Files:
src/sys/kern: kern_lwp.c

Log Message:
Rather than calling xc_barrier() in lwp_dtor(), set a pre-destruct hook
on the lwp_cache and invoke the barrier there.


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/kern/kern_lwp.c

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

Modified files:

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.244 src/sys/kern/kern_lwp.c:1.245
--- src/sys/kern/kern_lwp.c:1.244	Tue Sep 28 15:05:42 2021
+++ src/sys/kern/kern_lwp.c	Tue Dec 21 19:00:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.244 2021/09/28 15:05:42 thorpej Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.245 2021/12/21 19:00:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -217,7 +217,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.244 2021/09/28 15:05:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.245 2021/12/21 19:00:37 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -262,6 +262,7 @@ struct lwplist		alllwp		__cacheline_alig
 
 static int		lwp_ctor(void *, void *, int);
 static void		lwp_dtor(void *, void *);
+static void		lwp_pre_dtor(void *);
 
 /* DTrace proc provider probes */
 SDT_PROVIDER_DEFINE(proc);
@@ -341,6 +342,7 @@ lwpinit(void)
 	lwpinit_specificdata();
 	lwp_cache = pool_cache_init(sizeof(lwp_t), MIN_LWP_ALIGNMENT, 0, 0,
 	"lwppl", NULL, IPL_NONE, lwp_ctor, lwp_dtor, NULL);
+	pool_cache_setpredestruct(lwp_cache, lwp_pre_dtor);
 
 	maxlwp = cpu_maxlwp();
 	sysctl_kern_lwp_setup();
@@ -391,23 +393,29 @@ lwp_ctor(void *arg, void *obj, int flags
 }
 
 static void
-lwp_dtor(void *arg, void *obj)
+lwp_pre_dtor(void *arg __unused)
 {
-	lwp_t *l = obj;
-	(void)l;
-
 	/*
 	 * Provide a barrier to ensure that all mutex_oncpu() and rw_oncpu()
-	 * calls will exit before memory of LWP is returned to the pool, where
+	 * calls will exit before memory of LWPs is returned to the pool, where
 	 * KVA of LWP structure might be freed and re-used for other purposes.
 	 * Kernel preemption is disabled around mutex_oncpu() and rw_oncpu()
-	 * callers, therefore cross-call to all CPUs will do the job.  Also,
-	 * the value of l->l_cpu must be still valid at this point.
+	 * callers, therefore cross-call to all CPUs will do the job.
 	 *
 	 * XXX should use epoch based reclamation.
 	 */
-	KASSERT(l->l_cpu != NULL);
 	xc_barrier(0);
+}
+
+static void
+lwp_dtor(void *arg, void *obj)
+{
+	lwp_t *l = obj;
+
+	/*
+	 * The value of l->l_cpu must still be valid at this point.
+	 */
+	KASSERT(l->l_cpu != NULL);
 
 	/*
 	 * We can't return turnstile0 to the pool (it didn't come from it),



CVS commit: src/sys/kern

2021-12-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 21 19:00:38 UTC 2021

Modified Files:
src/sys/kern: kern_lwp.c

Log Message:
Rather than calling xc_barrier() in lwp_dtor(), set a pre-destruct hook
on the lwp_cache and invoke the barrier there.


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/kern/kern_lwp.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-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 21 18:59:23 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile pool_cache.9
src/sys/kern: subr_pool.c
src/sys/sys: param.h pool.h

Log Message:
Add pool_cache_setpredestruct(), which allows a pool cache to specify
a function to be called before the destructor for a batch of one or more
objects is called.  This can be used as a synchronization point by
subsystems that rely on the type-stable nature of pool cache objects or
subsystems that use other forms of passive serialization.


To generate a diff of this commit:
cvs rdiff -u -r1.2399 -r1.2400 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.458 -r1.459 src/share/man/man9/Makefile
cvs rdiff -u -r1.22 -r1.23 src/share/man/man9/pool_cache.9
cvs rdiff -u -r1.277 -r1.278 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.705 -r1.706 src/sys/sys/param.h
cvs rdiff -u -r1.94 -r1.95 src/sys/sys/pool.h

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



CVS commit: src

2021-12-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 21 18:59:23 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile pool_cache.9
src/sys/kern: subr_pool.c
src/sys/sys: param.h pool.h

Log Message:
Add pool_cache_setpredestruct(), which allows a pool cache to specify
a function to be called before the destructor for a batch of one or more
objects is called.  This can be used as a synchronization point by
subsystems that rely on the type-stable nature of pool cache objects or
subsystems that use other forms of passive serialization.


To generate a diff of this commit:
cvs rdiff -u -r1.2399 -r1.2400 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.458 -r1.459 src/share/man/man9/Makefile
cvs rdiff -u -r1.22 -r1.23 src/share/man/man9/pool_cache.9
cvs rdiff -u -r1.277 -r1.278 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.705 -r1.706 src/sys/sys/param.h
cvs rdiff -u -r1.94 -r1.95 src/sys/sys/pool.h

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2399 src/distrib/sets/lists/comp/mi:1.2400
--- src/distrib/sets/lists/comp/mi:1.2399	Tue Dec  7 17:39:53 2021
+++ src/distrib/sets/lists/comp/mi	Tue Dec 21 18:59:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2399 2021/12/07 17:39:53 brad Exp $
+#	$NetBSD: mi,v 1.2400 2021/12/21 18:59:22 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -12282,6 +12282,7 @@
 ./usr/share/man/cat9/pool_cache_sethardlimit.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_cache_sethiwat.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_cache_setlowat.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pool_cache_setpredestruct.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_create.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_destroy.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pool_get.0			comp-sys-catman		.cat
@@ -20474,6 +20475,7 @@
 ./usr/share/man/html9/pool_cache_sethardlimit.html	comp-sys-htmlman	html
 ./usr/share/man/html9/pool_cache_sethiwat.html	comp-sys-htmlman	html
 ./usr/share/man/html9/pool_cache_setlowat.html	comp-sys-htmlman	html
+./usr/share/man/html9/pool_cache_setpredestruct.html	comp-sys-htmlman	html
 ./usr/share/man/html9/pool_create.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pool_destroy.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pool_get.html		comp-sys-htmlman	html
@@ -28827,6 +28829,7 @@
 ./usr/share/man/man9/pool_cache_sethardlimit.9	comp-sys-man		.man
 ./usr/share/man/man9/pool_cache_sethiwat.9	comp-sys-man		.man
 ./usr/share/man/man9/pool_cache_setlowat.9	comp-sys-man		.man
+./usr/share/man/man9/pool_cache_setpredestruct.9	comp-sys-man		.man
 ./usr/share/man/man9/pool_create.9		comp-sys-man		.man
 ./usr/share/man/man9/pool_destroy.9		comp-sys-man		.man
 ./usr/share/man/man9/pool_get.9			comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.458 src/share/man/man9/Makefile:1.459
--- src/share/man/man9/Makefile:1.458	Wed Apr 28 00:49:22 2021
+++ src/share/man/man9/Makefile	Tue Dec 21 18:59:22 2021
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.458 2021/04/28 00:49:22 thorpej Exp $
+#   $NetBSD: Makefile,v 1.459 2021/12/21 18:59:22 thorpej Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -758,7 +758,8 @@ MLINKS+=pool_cache.9 pool_cache_init.9 \
 	pool_cache.9 pool_cache_invalidate.9 \
 	pool_cache.9 pool_cache_sethiwat.9 \
 	pool_cache.9 pool_cache_setlowat.9 \
-	pool_cache.9 pool_cache_sethardlimit.9
+	pool_cache.9 pool_cache_sethardlimit.9 \
+	pool_cache.9 pool_cache_setpredestruct.9
 MLINKS+=powerhook_establish.9 powerhook_disestablish.9
 MLINKS+=preempt.9 yield.9
 MLINKS+=pserialize.9 pserialize_create.9 \

Index: src/share/man/man9/pool_cache.9
diff -u src/share/man/man9/pool_cache.9:1.22 src/share/man/man9/pool_cache.9:1.23
--- src/share/man/man9/pool_cache.9:1.22	Mon Apr 13 08:59:14 2020
+++ src/share/man/man9/pool_cache.9	Tue Dec 21 18:59:22 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pool_cache.9,v 1.22 2020/04/13 08:59:14 wiz Exp $
+.\"	$NetBSD: pool_cache.9,v 1.23 2021/12/21 18:59:22 thorpej Exp $
 .\"
 .\" Copyright (c)2003 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" 
-.Dd April 12, 2020
+.Dd December 21, 2021
 .Dt POOL_CACHE 9
 .Os
 .\" 
@@ -69,7 +69,8 @@
 .Nm pool_cache_invalidate ,
 .Nm pool_cache_sethiwat ,
 .Nm pool_cache_setlowat ,
-.Nm pool_cache_sethardlimit
+.Nm pool_cache_sethardlimit ,
+.Nm pool_cache_setpredestruct
 .Nd resource-pool cache manager
 .\" 
 .Sh SYNOPSIS
@@ -119,6 +120,10 @@
 .Fn pool_cache_se

CVS commit: src

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 16:50:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: make function names a bit more concise

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.224 -r1.225 src/usr.bin/xlint/lint1/init.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-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 16:50:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: make function names a bit more concise

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.224 -r1.225 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.34 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.35
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.34	Fri Dec 17 15:52:30 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Tue Dec 21 16:50:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.34 2021/12/17 15:52:30 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.35 2021/12/21 16:50:11 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -33,7 +33,7 @@ struct_initialization_via_assignment(any
 }
 
 
-// See init_expr, initialization_init_array_using_string.
+// See initialization_expr, initialization_init_array_from_string.
 char static_duration[] = "static duration";
 signed char static_duration_signed[] = "static duration";
 unsigned char static_duration_unsigned[] = "static duration";

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.224 src/usr.bin/xlint/lint1/init.c:1.225
--- src/usr.bin/xlint/lint1/init.c:1.224	Tue Dec 21 15:15:45 2021
+++ src/usr.bin/xlint/lint1/init.c	Tue Dec 21 16:50:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.224 2021/12/21 15:15:45 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.225 2021/12/21 16:50:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.224 2021/12/21 15:15:45 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.225 2021/12/21 16:50:11 rillig Exp $");
 #endif
 
 #include 
@@ -395,7 +395,7 @@ check_init_expr(const type_t *ltp, sym_t
 
 
 static const type_t *
-designator_look_up(const designator *dr, const type_t *tp)
+designator_type(const designator *dr, const type_t *tp)
 {
 	switch (tp->t_tspec) {
 	case STRUCT:
@@ -474,12 +474,12 @@ designation_add(designation *dn, const c
  * C99 6.7.8p18
  */
 static const type_t *
-designation_look_up(const designation *dn, const type_t *tp)
+designation_type(const designation *dn, const type_t *tp)
 {
 	size_t i;
 
 	for (i = 0; i < dn->dn_len && tp != NULL; i++)
-		tp = designator_look_up(dn->dn_items + i, tp);
+		tp = designator_type(dn->dn_items + i, tp);
 	return tp;
 }
 
@@ -547,7 +547,7 @@ brace_level_sub_type(const brace_level *
 {
 
 	if (bl->bl_designation.dn_len > 0)
-		return designation_look_up(&bl->bl_designation, bl->bl_type);
+		return designation_type(&bl->bl_designation, bl->bl_type);
 
 	switch (bl->bl_type->t_tspec) {
 	case STRUCT:
@@ -708,7 +708,7 @@ initialization_sub_type(initialization *
 }
 
 static void
-initialization_begin_brace_level(initialization *in)
+initialization_lbrace(initialization *in)
 {
 	const type_t *tp;
 
@@ -766,7 +766,7 @@ initialization_set_size_of_unknown_array
 }
 
 static void
-initialization_end_brace_level(initialization *in)
+initialization_rbrace(initialization *in)
 {
 	brace_level *inner_bl, *outer_bl;
 
@@ -832,7 +832,7 @@ initialization_expr_using_op(initializat
 
 /* Initialize a character array or wchar_t array with a string literal. */
 static bool
-initialization_init_array_using_string(initialization *in, tnode_t *tn)
+initialization_init_array_from_string(initialization *in, tnode_t *tn)
 {
 	brace_level *bl;
 	const type_t *tp;
@@ -898,7 +898,7 @@ initialization_expr(initialization *in, 
 		goto advance;
 	if (initialization_expr_using_op(in, tn))
 		goto done;
-	if (initialization_init_array_using_string(in, tn))
+	if (initialization_init_array_from_string(in, tn))
 		goto advance;
 	if (in->in_err)
 		goto done;
@@ -1015,7 +1015,7 @@ void
 init_lbrace(void)
 {
 
-	initialization_begin_brace_level(current_init());
+	initialization_lbrace(current_init());
 }
 
 void
@@ -1029,5 +1029,5 @@ void
 init_rbrace(void)
 {
 
-	initialization_end_brace_level(current_init());
+	initialization_rbrace(current_init());
 }



CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 16:25:14 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
d_c99_bool_strict_syshdr.exp

Log Message:
tests/lint: remove false assumptions from comments

https://stackoverflow.com/q/65868752


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
cvs rdiff -u -r1.11 -r1.12 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.9 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.10
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.9	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c	Tue Dec 21 16:25:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_bool_strict_syshdr.c,v 1.9 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: d_c99_bool_strict_syshdr.c,v 1.10 2021/12/21 16:25:14 rillig Exp $	*/
 # 3 "d_c99_bool_strict_syshdr.c"
 
 /*
@@ -9,14 +9,6 @@
  * compatible with pre-C99 code.  Therefore, the checks for system headers are
  * loosened.  In contexts where a scalar expression is compared to 0, macros
  * and functions from system headers may use int expressions as well.
- *
- * These headers are not allowed to include [references needed].
- * Doing so would inject lint's own , which defines the macros
- * false and true to other identifiers instead of the plain 0 and 1, thereby
- * allowing to see whether the code really uses true and false as identifiers.
- *
- * Since the system headers cannot include , they need to use the
- * traditional bool constants 0 and 1.
  */
 
 /* lint1-extra-flags: -T */
@@ -30,9 +22,8 @@ extern void println(const char *);
  * in the well-known 'do { ... } while (CONSTCOND 0)' loop.  The 0 in the
  * controlling expression has type INT but should be allowed nevertheless
  * since that header does not have a way to distinguish between bool and int.
- * It just follows the C99 standard, unlike the lint-provided stdbool.h, which
- * redefines 'false' to '__lint_false'.  Plus,  must not include
- *  itself.
+ * It just follows the C99 standard, unlike the lint-provided stdbool.h,
+ * which redefines 'false' to '__lint_false'.
  */
 void
 strict_bool_system_header_statement_macro(void)
@@ -40,17 +31,19 @@ strict_bool_system_header_statement_macr
 
 	do {
 		println("nothing");
-	} while (/*CONSTCOND*/0);	/* expect: 333 */
+	} while (/*CONSTCOND*/0);
+	/* expect-1: error: controlling expression must be bool, not 'int' [333] */
 
-# 46 "d_c99_bool_strict_syshdr.c" 3 4
+# 38 "d_c99_bool_strict_syshdr.c" 3 4
 	do {
 		println("nothing");
 	} while (/*CONSTCOND*/0);	/* ok */
 
-# 51 "d_c99_bool_strict_syshdr.c"
+# 43 "d_c99_bool_strict_syshdr.c"
 	do {
 		println("nothing");
-	} while (/*CONSTCOND*/0);	/* expect: 333 */
+	} while (/*CONSTCOND*/0);
+	/* expect-1: error: controlling expression must be bool, not 'int' [333] */
 }
 
 
@@ -81,28 +74,29 @@ strict_bool_system_header_ctype(int c)
 	 * All other combinations of type are safe from truncation.
 	 */
 	_Bool system_int_assigned_to_bool =
-# 85 "d_c99_bool_strict_syshdr.c" 3 4
+# 78 "d_c99_bool_strict_syshdr.c" 3 4
 	(int)((ctype_table + 1)[c] & 0x0040)	/* INT */
-# 87 "d_c99_bool_strict_syshdr.c"
-	;			/* expect: 107 */
+# 80 "d_c99_bool_strict_syshdr.c"
+	;
+	/* expect-1: error: operands of 'init' have incompatible types (_Bool != int) [107] */
 
 	int system_bool_assigned_to_int =
-# 91 "d_c99_bool_strict_syshdr.c" 3 4
+# 85 "d_c99_bool_strict_syshdr.c" 3 4
 	(int)((ctype_table + 1)[c] & 0x0040) != 0	/* BOOL */
-# 93 "d_c99_bool_strict_syshdr.c"
+# 87 "d_c99_bool_strict_syshdr.c"
 	;
 
 	if (
-# 97 "d_c99_bool_strict_syshdr.c" 3 4
+# 91 "d_c99_bool_strict_syshdr.c" 3 4
 	(int)((ctype_table + 1)[c] & 0x0040)	/* INT */
-# 99 "d_c99_bool_strict_syshdr.c"
+# 93 "d_c99_bool_strict_syshdr.c"
 	)
 		println("system macro returning INT");
 
 	if (
-# 104 "d_c99_bool_strict_syshdr.c" 3 4
+# 98 "d_c99_bool_strict_syshdr.c" 3 4
 	((ctype_table + 1)[c] & 0x0040) != 0	/* BOOL */
-# 106 "d_c99_bool_strict_syshdr.c"
+# 100 "d_c99_bool_strict_syshdr.c"
 	)
 		println("system macro returning BOOL");
 }
@@ -111,9 +105,9 @@ static inline _Bool
 ch_isspace_sys_int(char c)
 {
 	return
-# 115 "d_c99_bool_strict_syshdr.c" 3 4
+# 109 "d_c99_bool_strict_syshdr.c" 3 4
 	((ctype_table + 1)[c] & 0x0040)
-# 117 "d_c99_bool_strict_syshdr.c"
+# 111 "d_c99_bool_strict_syshdr.c"
 	!= 0;
 }
 
@@ -126,9 +120,9 @@ static inline _Bool
 ch_isspace_sys_bool(char c)
 {
 	return
-# 130 "d_c99_bool_strict_syshdr.c" 3 4
+# 124 "d_c99_bool_strict_syshdr.c" 3 4
 	((ctype_table + 1)[(unsigned char)c] & 0x0040) != 0
-# 132 "d_c99_bool_strict_

CVS commit: src/tests/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 16:25:14 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c
d_c99_bool_strict_syshdr.exp

Log Message:
tests/lint: remove false assumptions from comments

https://stackoverflow.com/q/65868752


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
cvs rdiff -u -r1.11 -r1.12 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 15:33:20 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: sync comment with recent change of parameter name


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.401 src/usr.bin/xlint/lint1/tree.c:1.402
--- src/usr.bin/xlint/lint1/tree.c:1.401	Tue Dec 21 15:24:28 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Dec 21 15:33:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.401 2021/12/21 15:24:28 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.402 2021/12/21 15:33:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.401 2021/12/21 15:24:28 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.402 2021/12/21 15:33:20 rillig Exp $");
 #endif
 
 #include 
@@ -260,10 +260,7 @@ build_name_call(sym_t *sym)
 	sym->s_type = derive_type(sym->s_type, FUNC);
 }
 
-/*
- * Create a node for a name (symbol table entry).
- * follow_token is the token which follows the name.
- */
+/* Create a node for a name (symbol table entry). */
 tnode_t *
 build_name(sym_t *sym, bool is_funcname)
 {



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 15:33:20 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: sync comment with recent change of parameter name


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Dec 21 15:27:19 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
Fix build of xlint/line1 with OBJDIR set.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint1/Makefile

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

Modified files:

Index: src/usr.bin/xlint/lint1/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.87 src/usr.bin/xlint/lint1/Makefile:1.88
--- src/usr.bin/xlint/lint1/Makefile:1.87	Sun Sep  5 17:49:55 2021
+++ src/usr.bin/xlint/lint1/Makefile	Tue Dec 21 15:27:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.87 2021/09/05 17:49:55 rillig Exp $
+#	$NetBSD: Makefile,v 1.88 2021/12/21 15:27:19 roy Exp $
 
 .include 
 
@@ -24,7 +24,7 @@ LINTFLAGS.scan.c+=	-X 192,214	# due to s
 LINTFLAGS.scan.c+=	-X 307		# static variable unused
 
 CPPFLAGS+=	-DIS_LINT1
-CPPFLAGS+=	-I${.CURDIR}
+CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR}
 CPPFLAGS+=	${DEBUG:D-DDEBUG -DYYDEBUG}
 
 COPTS.err.c+=	${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Dec 21 15:27:19 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
Fix build of xlint/line1 with OBJDIR set.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint1/Makefile

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 15:24:28 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: mem1.c tree.c

Log Message:
lint: invert condition in build_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.400 -r1.401 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 15:24:28 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: mem1.c tree.c

Log Message:
lint: invert condition in build_name

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.400 -r1.401 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.55 src/usr.bin/xlint/lint1/mem1.c:1.56
--- src/usr.bin/xlint/lint1/mem1.c:1.55	Tue Nov 16 21:01:05 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Tue Dec 21 15:24:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.55 2021/11/16 21:01:05 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.56 2021/12/21 15:24:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.55 2021/11/16 21:01:05 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.56 2021/12/21 15:24:28 rillig Exp $");
 #endif
 
 #include 
@@ -354,6 +354,9 @@ str_endswith(const char *haystack, const
 /*
  * Return a freshly allocated tree node that is freed at the end of the
  * current expression.
+ *
+ * The node records whether it comes from a system file, which makes strict
+ * bool mode less restrictive.
  */
 tnode_t *
 expr_zalloc_tnode(void)

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.400 src/usr.bin/xlint/lint1/tree.c:1.401
--- src/usr.bin/xlint/lint1/tree.c:1.400	Fri Dec 17 00:05:24 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Dec 21 15:24:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.400 2021/12/17 00:05:24 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.401 2021/12/21 15:24:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.400 2021/12/17 00:05:24 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.401 2021/12/21 15:24:28 rillig Exp $");
 #endif
 
 #include 
@@ -282,15 +282,15 @@ build_name(sym_t *sym, bool is_funcname)
 
 	n = expr_zalloc_tnode();
 	n->tn_type = sym->s_type;
-	if (sym->s_scl != CTCONST) {
+	if (sym->s_scl == CTCONST) {
+		n->tn_op = CON;
+		n->tn_val = expr_zalloc(sizeof(*n->tn_val));
+		*n->tn_val = sym->s_value;
+	} else {
 		n->tn_op = NAME;
 		n->tn_sym = sym;
 		if (sym->s_kind == FVFT && sym->s_type->t_tspec != FUNC)
 			n->tn_lvalue = true;
-	} else {
-		n->tn_op = CON;
-		n->tn_val = expr_zalloc(sizeof(*n->tn_val));
-		*n->tn_val = sym->s_value;
 	}
 
 	return n;



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 15:15:45 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: rename parameters in check_init_expr

An initialization has a left-hand and a right-hand side, reflect this in
the parameter names to avoid confusion.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.223 src/usr.bin/xlint/lint1/init.c:1.224
--- src/usr.bin/xlint/lint1/init.c:1.223	Mon Dec 20 19:34:01 2021
+++ src/usr.bin/xlint/lint1/init.c	Tue Dec 21 15:15:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.223 2021/12/20 19:34:01 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.224 2021/12/21 15:15:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.223 2021/12/20 19:34:01 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.224 2021/12/21 15:15:45 rillig Exp $");
 #endif
 
 #include 
@@ -348,30 +348,30 @@ check_trad_no_auto_aggregate(const sym_t
 }
 
 static void
-check_init_expr(const type_t *tp, sym_t *sym, tnode_t *tn)
+check_init_expr(const type_t *ltp, sym_t *lsym, tnode_t *rn)
 {
 	tnode_t *ln;
-	type_t *ltp;
+	type_t *lutp;
 	tspec_t lt, rt;
 	struct memory_block *tmem;
 
-	ltp = expr_unqualified_type(tp);
+	lutp = expr_unqualified_type(ltp);
 
 	/* Create a temporary node for the left side. */
 	ln = expr_zalloc(sizeof(*ln));
 	ln->tn_op = NAME;
-	ln->tn_type = ltp;
+	ln->tn_type = lutp;
 	ln->tn_lvalue = true;
-	ln->tn_sym = sym;
+	ln->tn_sym = lsym;
 
-	tn = cconv(tn);
+	rn = cconv(rn);
 
 	lt = ln->tn_type->t_tspec;
-	rt = tn->tn_type->t_tspec;
+	rt = rn->tn_type->t_tspec;
 
 	debug_step("typeok '%s', '%s'",
-	type_name(ln->tn_type), type_name(tn->tn_type));
-	if (!typeok(INIT, 0, ln, tn))
+	type_name(ln->tn_type), type_name(rn->tn_type));
+	if (!typeok(INIT, 0, ln, rn))
 		return;
 
 	/*
@@ -379,7 +379,7 @@ check_init_expr(const type_t *tp, sym_t 
 	 * expr() would free it.
 	 */
 	tmem = expr_save_memory();
-	expr(tn, true, false, true, false);
+	expr(rn, true, false, true, false);
 	expr_restore_memory(tmem);
 
 	check_bit_field_init(ln, lt, rt);
@@ -387,10 +387,10 @@ check_init_expr(const type_t *tp, sym_t 
 	/*
 	 * XXX: Is it correct to do this conversion _after_ the typeok above?
 	 */
-	if (lt != rt || (tp->t_bitfield && tn->tn_op == CON))
-		tn = convert(INIT, 0, unconst_cast(tp), tn);
+	if (lt != rt || (ltp->t_bitfield && rn->tn_op == CON))
+		rn = convert(INIT, 0, unconst_cast(ltp), rn);
 
-	check_non_constant_initializer(tn, sym);
+	check_non_constant_initializer(rn, lsym);
 }
 
 



CVS commit: src/usr.bin/xlint/lint1

2021-12-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec 21 15:15:45 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: rename parameters in check_init_expr

An initialization has a left-hand and a right-hand side, reflect this in
the parameter names to avoid confusion.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-12-21 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Tue Dec 21 15:08:14 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_acl.c

Log Message:
Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD 
(patch by hannken@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-12-21 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Tue Dec 21 15:08:14 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_acl.c

Log Message:
Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD 
(patch by hannken@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c:1.6	Tue Mar 17 00:54:03 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c	Tue Dec 21 15:08:14 2021
@@ -1661,7 +1661,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla
 			} else {
 acl_ids->z_fgid = zfs_fuid_create_cred(zfsvfs,
 ZFS_GROUP, cr, &acl_ids->z_fuidp);
-#ifdef __FreeBSD_kernel__
+#if defined(__FreeBSD_kernel__) || defined(__NetBSD__)
 gid = acl_ids->z_fgid = dzp->z_gid;
 #else
 gid = crgetgid(cr);



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 13:56:58 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/radeon: files.radeon

Log Message:
files.radeon: add clang -Wno-format for radeon_uvd.c

int vs. short mismatch in UVD firmware version printf.
Also change some makeoptions conditional copypasta i915drmkms -> radeon.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/drm2/radeon/files.radeon

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/radeon/files.radeon
diff -u src/sys/external/bsd/drm2/radeon/files.radeon:1.35 src/sys/external/bsd/drm2/radeon/files.radeon:1.36
--- src/sys/external/bsd/drm2/radeon/files.radeon:1.35	Sun Dec 19 10:55:37 2021
+++ src/sys/external/bsd/drm2/radeon/files.radeon	Tue Dec 21 13:56:58 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.radeon,v 1.35 2021/12/19 10:55:37 riastradh Exp $
+#	$NetBSD: files.radeon,v 1.36 2021/12/21 13:56:58 tnn Exp $
 
 version	20180827
 
@@ -34,10 +34,11 @@ makeoptions	radeon	"CWARNFLAGS.radeon"+=
 
 makeoptions	radeon	"CWARNFLAGS.radeon"+="${${ACTIVE_CC} == gcc:? -Wno-maybe-uninitialized :}"
 
-#makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_evergreen_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_r300.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.radeon_r420.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+#makeoptions 	radeon 	"CWARNFLAGS.radeon_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	radeon 	"CWARNFLAGS.radeon_evergreen_cs.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	radeon 	"CWARNFLAGS.radeon_r300.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	radeon 	"CWARNFLAGS.radeon_r420.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions	radeon	"CWARNFLAGS.radeon_uvd.c"+="${${ACTIVE_CC} == clang:? -Wno-format :}"
 
 file	external/bsd/drm2/radeon/radeon_module.c		radeon
 file	external/bsd/drm2/radeon/radeon_pci.c			radeon



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 13:56:58 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/radeon: files.radeon

Log Message:
files.radeon: add clang -Wno-format for radeon_uvd.c

int vs. short mismatch in UVD firmware version printf.
Also change some makeoptions conditional copypasta i915drmkms -> radeon.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/drm2/radeon/files.radeon

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



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:55:24 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
drm: sprinkle some -Wno-unused-function for clang

915_sw_fence.c: for debug_fence_init_onstack
drm_mm.c: for rb_hole_size_to_node
intel_hdmi.c: for intel_hdmi_hdcp2_protocol
intel_guc_submission.c: for rq_prio
nouveau_nvkm_subdev_instmem_base.c: for fake_ioread32_native
nouveau_nvkm_subdev_mmu_vmmnv04.c: for nv04_vmm_pgt_pte


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.84 -r1.85 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.36 -r1.37 src/sys/external/bsd/drm2/nouveau/files.nouveau

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



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:55:24 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
drm: sprinkle some -Wno-unused-function for clang

915_sw_fence.c: for debug_fence_init_onstack
drm_mm.c: for rb_hole_size_to_node
intel_hdmi.c: for intel_hdmi_hdcp2_protocol
intel_guc_submission.c: for rq_prio
nouveau_nvkm_subdev_instmem_base.c: for fake_ioread32_native
nouveau_nvkm_subdev_mmu_vmmnv04.c: for nv04_vmm_pgt_pte


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.84 -r1.85 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.36 -r1.37 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.71 src/sys/external/bsd/drm2/drm/files.drmkms:1.72
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.71	Sun Dec 19 12:39:48 2021
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Tue Dec 21 12:55:23 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.71 2021/12/19 12:39:48 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.72 2021/12/21 12:55:23 tnn Exp $
 
 version	20180827
 
@@ -79,6 +79,7 @@ makeoptions 	drmkms 	"CWARNFLAGS.drm_dp_
 makeoptions 	drmkms 	"CWARNFLAGS.drm_fb_helper.c"+="-Wno-shadow"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_edid.c"+="-Wno-shadow"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_ioctl.c"+="-Wno-shadow"
+makeoptions	drmkms	"CWARNFLAGS.drm_mm.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_modes.c"+="-Wno-shadow"
 
 # Legacy user-mode setting

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.84 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.85
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.84	Sun Dec 19 11:57:42 2021
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Tue Dec 21 12:55:23 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.84 2021/12/19 11:57:42 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.85 2021/12/21 12:55:23 tnn Exp $
 
 version	20180827
 
@@ -45,11 +45,14 @@ makeoptions	i915drmkms	"CWARNFLAGS.i915d
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.i915_pci.c"+="${${ACTIVE_CC} == gcc:? -Wno-override-init :}"
 makeoptions 	i915drmkms 	"CWARNFLAGS.i915_pci.c"+="${${ACTIVE_CC} == clang:? -Wno-initializer-overrides :}"
+makeoptions	i915drmkms	"CWARNFLAGS.i915_sw_fence.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sprite.c"+="${${ACTIVE_CC} == gcc:? -Wno-maybe-uninitialized :}"
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_ddi.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 10:? -Wno-maybe-uninitialized :} ${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_display.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
+makeoptions	i915drmkms	"CWARNFLAGS.intel_guc_submission.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
+makeoptions	i915drmkms	"CWARNFLAGS.intel_hdmi.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sdvo.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
 
 makeoptions	intelfb		"CPPFLAGS.intelfb"+="${CPPFLAGS.i915drmkms}"

Index: src/sys/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.36 src/sys/external/bsd/drm2/nouveau/files.nouveau:1.37
--- src/sys/external/bsd/drm2/nouveau/files.nouveau:1.36	Sun Dec 19 10:55:37 2021
+++ src/sys/external/bsd/drm2/nouveau/files.nouveau	Tue Dec 21 12:55:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.nouveau,v 1.36 2021/12/19 10:55:37 riastradh Exp $
+#	$NetBSD: files.nouveau,v 1.37 2021/12/21 12:55:24 tnn Exp $
 
 version	20180827
 
@@ -37,6 +37,8 @@ makeoptions	nouveau	"CWARNFLAGS.nouveau"
 makeoptions	nouveau	"CWARNFLAGS.nouveau"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_bios_timing.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=int-in-bool-context :}"
 makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_clk_gt215.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=int-in-bool-context :}"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_instmem_base.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
+makeoptions	nouveau	"CWARNFLAGS.nouveau_nvkm_subdev_mmu_vmmnv04.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 
 file	external/bsd/drm2/nouveau/nouveau_module.c	nouveau
 



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:28:34 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_device.h

Log Message:
drm_device.h: don't redefine vmem_t


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/include/drm/drm_device.h

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_device.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.8 src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.9
--- src/sys/external/bsd/drm2/dist/include/drm/drm_device.h:1.8	Sun Dec 19 12:05:09 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_device.h	Tue Dec 21 12:28:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_device.h,v 1.8 2021/12/19 12:05:09 riastradh Exp $	*/
+/*	$NetBSD: drm_device.h,v 1.9 2021/12/21 12:28:34 tnn Exp $	*/
 
 #ifndef _DRM_DEVICE_H_
 #define _DRM_DEVICE_H_
@@ -29,7 +29,11 @@ struct drm_fb_helper;
 struct pci_dev;
 struct pci_controller;
 
+#if defined(__NetBSD__)
+#include 
+#else
 typedef struct vmem vmem_t;
+#endif
 
 /**
  * enum drm_switch_power - power state of drm device



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:28:34 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drm_device.h

Log Message:
drm_device.h: don't redefine vmem_t


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/include/drm/drm_device.h

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



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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 12:12:52 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
correct register definition error and improve naming


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/sociox/if_scx.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/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.31 src/sys/arch/arm/sociox/if_scx.c:1.32
--- src/sys/arch/arm/sociox/if_scx.c:1.31	Tue Dec 21 11:07:51 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Tue Dec 21 12:12:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.31 2021/12/21 11:07:51 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.32 2021/12/21 12:12:52 nisimura 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.31 2021/12/21 11:07:51 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.32 2021/12/21 12:12:52 nisimura Exp $");
 
 #include 
 #include 
@@ -163,12 +163,13 @@ struct rdes {
 #define  DESCNF_CHRST	(1U<<30)	/* channel reset */
 #define  DESCNF_TMR	(1U<<4)		/* coalesce timer mode select */
 #define  DESCNF_LE	(1)		/* little endian desc format */
-#define TXCOLMAX	0x410		/* tx intr coalesce upper bound */
-#define RXCOLMAX	0x454		/* rx intr coalesce upper bound */
+#define TXSUBMIT	0x410		/* submit loaded tx frame */
+#define TXCLSCMAX	0x418		/* tx intr coalesce upper bound */
+#define RXCLSCMAX	0x458		/* rx intr coalesce upper bound */
 #define TXITIMER	0x420		/* coalesce timer usec, MSB to use */
 #define RXITIMER	0x460		/* coalesce timer usec, MSB to use */
-#define TXDONECNT	0x424		/* tx completed count, auto-zero */
-#define RXDONECNT	0x458		/* rx available count, auto-zero */
+#define TXDONECNT	0x414		/* tx completed count, auto-zero */
+#define RXDONECNT	0x454		/* rx available count, auto-zero */
 #define UCODE_H2M	0x210		/* host2media engine ucode port */
 #define UCODE_M2H	0x21c		/* media2host engine ucode port */
 #define CORESTAT	0x218		/* engine run state */
@@ -1117,8 +1118,8 @@ scx_init(struct ifnet *ifp)
 	CSR_WRITE(sc, RXIE_CLR, ~0);	/* clear Rx interrupt enable */
 	CSR_WRITE(sc, TXIE_CLR, ~0);	/* clear Tx interrupt enable */
 
-	CSR_WRITE(sc, RXCOLMAX, 8);	/* Rx coalesce upper bound */
-	CSR_WRITE(sc, TXCOLMAX, 8);	/* Tx coalesce upper bound */
+	CSR_WRITE(sc, RXCLSCMAX, 8);	/* Rx coalesce upper bound */
+	CSR_WRITE(sc, TXCLSCMAX, 8);	/* Tx coalesce upper bound */
 	CSR_WRITE(sc, RXITIMER, 500);	/* Rx co. timer usec */
 	CSR_WRITE(sc, TXITIMER, 500);	/* Tx co. timer usec */
 
@@ -1408,8 +1409,8 @@ scx_start(struct ifnet *ifp)
 		SCX_CDTXSYNC(sc, sc->sc_txnext, dmamap->dm_nsegs,
 		BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
-		/* Tell DMA start transmit */
-		mac_write(sc, GMACTPD, 1);
+		/* submit one frame to xmit */
+		CSR_WRITE(sc, TXSUBMIT, 1);
 
 		txs->txs_mbuf = m0;
 		txs->txs_firstdesc = sc->sc_txnext;



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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 12:12:52 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
correct register definition error and improve naming


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/sociox/if_scx.c

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



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:06:30 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_scheduler.c

Log Message:
i915_scheduler.c: node_to_request: duplicate 'const' declaration specifier


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c:1.7	Sun Dec 19 12:12:47 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c	Tue Dec 21 12:06:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_scheduler.c,v 1.7 2021/12/19 12:12:47 riastradh Exp $	*/
+/*	$NetBSD: i915_scheduler.c,v 1.8 2021/12/21 12:06:29 tnn Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.7 2021/12/19 12:12:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.8 2021/12/21 12:06:29 tnn Exp $");
 
 #include 
 
@@ -34,7 +34,7 @@ static DEFINE_SPINLOCK(schedule_lock);
 static const struct i915_request *
 node_to_request(const struct i915_sched_node *node)
 {
-	return const_container_of(node, const struct i915_request, sched);
+	return const_container_of(node, struct i915_request, sched);
 }
 
 static inline bool node_started(const struct i915_sched_node *node)



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:06:30 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_scheduler.c

Log Message:
i915_scheduler.c: node_to_request: duplicate 'const' declaration specifier


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:00:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_shmem.c

Log Message:
i915_gem_shmem.c: shmem_get_pages: fix uninitialize use of "noreclaim"


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c:1.10 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c:1.10	Sun Dec 19 12:25:56 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c	Tue Dec 21 12:00:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_shmem.c,v 1.10 2021/12/19 12:25:56 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_shmem.c,v 1.11 2021/12/21 12:00:40 tnn Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_shmem.c,v 1.10 2021/12/19 12:25:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_shmem.c,v 1.11 2021/12/21 12:00:40 tnn Exp $");
 
 #include 
 #include 
@@ -89,12 +89,13 @@ rebuild_st:
 	 */
 #ifdef __NetBSD__
 	mapping = obj->base.filp;
+	noreclaim = GFP_KERNEL;
 #else
 	mapping = obj->base.filp->f_mapping;
 	mapping_set_unevictable(mapping);
 	noreclaim = mapping_gfp_constraint(mapping, ~__GFP_RECLAIM);
-	noreclaim |= __GFP_NORETRY | __GFP_NOWARN;
 #endif
+	noreclaim |= __GFP_NORETRY | __GFP_NOWARN;
 
 	sg = st->sgl;
 	st->nents = 0;



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 12:00:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_shmem.c

Log Message:
i915_gem_shmem.c: shmem_get_pages: fix uninitialize use of "noreclaim"


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_shmem.c

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



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 11:44:18 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c

Log Message:
i915_drm_resume_early: initialize ret

clang -Wsometimes-uninitialized says uninitialized use
on line 2043 when if statement on line 2037 is false


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.46 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.47
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.46	Sun Dec 19 12:40:43 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c	Tue Dec 21 11:44:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_drv.c,v 1.46 2021/12/19 12:40:43 riastradh Exp $	*/
+/*	$NetBSD: i915_drv.c,v 1.47 2021/12/21 11:44:18 tnn Exp $	*/
 
 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
  */
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.46 2021/12/19 12:40:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.47 2021/12/21 11:44:18 tnn Exp $");
 
 #include 
 #include 
@@ -1983,7 +1983,7 @@ int i915_drm_resume_early(struct drm_dev
 #ifndef __NetBSD__
 	struct pci_dev *pdev = dev_priv->drm.pdev;
 #endif
-	int ret;
+	int ret = 0;
 
 	/*
 	 * We have a resume ordering issue with the snd-hda driver also



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

2021-12-21 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Dec 21 11:44:18 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c

Log Message:
i915_drm_resume_early: initialize ret

clang -Wsometimes-uninitialized says uninitialized use
on line 2043 when if statement on line 2037 is false


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.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/arm/sociox

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 11:07:51 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
add interrupt logic stuff


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/sociox/if_scx.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/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.30 src/sys/arch/arm/sociox/if_scx.c:1.31
--- src/sys/arch/arm/sociox/if_scx.c:1.30	Mon Dec 20 06:47:24 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Tue Dec 21 11:07:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.30 2021/12/20 06:47:24 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.31 2021/12/21 11:07:51 nisimura 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.30 2021/12/20 06:47:24 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.31 2021/12/21 11:07:51 nisimura Exp $");
 
 #include 
 #include 
@@ -129,28 +129,29 @@ struct rdes {
 #define xINTSR		0x200		/* aggregated interrupt status */
 #define  IRQ_RX		(1U<<1)		/* top level Rx interrupt */
 #define  IRQ_TX		(1U<<0)		/* top level Rx interrupt */
-#define  IRQ_UCODE	(1U<<20)	/* ucode load completed */
+#define  IRQ_UCODE	(1U<<20)	/* ucode load completed; W1C */
 #define xINTAEN		0x204		/* INT_A enable */
 #define xINTAE_SET	0x234		/* bit to set */
 #define xINTAE_CLR	0x238		/* bit to clr */
 #define xINTBEN		0x23c		/* INT_B enable */
 #define xINTBE_SET	0x240		/* bit to set */
 #define xINTBE_CLR	0x244		/* bit to clr */
-#define TXISR		0x400		/* transmit status */
+#define TXISR		0x400		/* transmit status; W1C */
 #define TXIEN		0x404		/* tx interrupt enable */
 #define TXIE_SET	0x428		/* bit to set */
 #define TXIE_CLR	0x42c		/* bit to clr */
-#define  TXI_NTOWNR	(1U<<17)	/* ready desc got empty */
+#define  TXI_NTOWNR	(1U<<17)	/* ??? desc array got empty */
 #define  TXI_TR_ERR	(1U<<16)	/* tx error */
 #define  TXI_TXDONE	(1U<<15)	/* tx completed */
 #define  TXI_TMREXP	(1U<<14)	/* coalesce timer expired */
-#define RXISR		0x440		/* receive status */
+#define RXISR		0x440		/* receive status; W1C */
 #define RXIEN		0x444		/* rx interrupt enable */
 #define RXIE_SET	0x468		/* bit to set */
 #define RXIE_CLR	0x46c		/* bit to clr */
 #define  RXI_RC_ERR	(1U<<16)	/* rx error */
 #define  RXI_PKTCNT	(1U<<15)	/* rx counter has new value */
 #define  RXI_TMREXP	(1U<<14)	/* coalesce timer expired */
+/* 13 sets of special purpose desc interrupt handling register exist */
 #define TDBA_LO		0x408		/* tdes array base addr 31:0 */
 #define TDBA_HI		0x434		/* tdes array base addr 63:32 */
 #define RDBA_LO		0x448		/* rdes array base addr 31:0 */
@@ -459,7 +460,6 @@ struct scx_softc {
 	int sc_flowflags;		/* 802.3x PAUSE flow control */
 	uint32_t sc_mdclk;		/* GAR 5:2 clock selection */
 	uint32_t sc_t0cotso;		/* T0_CSUM | T0_TSO to run */
-	int sc_ucodeloaded;		/* ucode for H2M/M2H/PKT */
 	int sc_100mii;			/* 1 for RMII/MII, 0 for RGMII */
 	int sc_phandle;			/* fdt phandle */
 	uint64_t sc_freq;
@@ -603,7 +603,7 @@ static int
 mac_read(struct scx_softc *sc, int reg)
 {
 
-	CSR_WRITE(sc, MACCMD, reg);
+	CSR_WRITE(sc, MACCMD, reg | CMD_BUSY);
 	(void)WAIT_FOR_CLR(sc, MACCMD, CMD_BUSY, 0);
 	return CSR_READ(sc, MACDATA);
 }
@@ -613,10 +613,11 @@ mac_write(struct scx_softc *sc, int reg,
 {
 
 	CSR_WRITE(sc, MACDATA, val);
-	CSR_WRITE(sc, MACCMD, reg | CMD_IOWR);
+	CSR_WRITE(sc, MACCMD, reg | CMD_IOWR | CMD_BUSY);
 	(void)WAIT_FOR_CLR(sc, MACCMD, CMD_BUSY, 0);
 }
 
+/* dig and decode "clock-frequency" value for a given clkname */
 static int
 get_clk_freq(int phandle, const char *clkname)
 {
@@ -671,7 +672,6 @@ scx_fdt_attach(device_t parent, device_t
 	struct scx_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	bus_space_tag_t bst = faa->faa_bst;
 	bus_space_handle_t bsh;
 	bus_space_handle_t eebsh;
 	bus_addr_t addr[2];
@@ -683,7 +683,7 @@ scx_fdt_attach(device_t parent, device_t
 	long ref_clk;
 
 	aprint_naive("\n");
-	aprint_normal(": Gigabit Ethernet Controller\n");
+	aprint_normal(": Socionext Gigabit Ethernet controller\n");
 
 	if (fdtbus_get_reg(phandle, 0, addr+0, size+0) != 0
 	|| bus_space_map(faa->faa_bst, addr[0], size[0], 0, &bsh) != 0) {
@@ -707,7 +707,7 @@ scx_fdt_attach(device_t parent, device_t
 	}
 
 	sc->sc_dev = self;
-	sc->sc_st = bst;
+	sc->sc_st = faa->faa_bst;
 	sc->sc_sh = bsh;
 	sc->sc_sz = size[0];
 	sc->sc_eesh = eebsh;
@@ -754,7 +754,6 @@ scx_acpi_attach(device_t parent, device_
 	struct scx_softc * const sc = device_private(self);
 	struct acpi_attach_args * const aa = aux;
 	ACPI_HANDLE handle = aa->aa_node->ad_handle;
-	bus_space_tag_t bst = aa->aa_memt;
 	bus_space_handle_t bsh, eebsh;
 	struct acpi_resources res;
 	struct acpi_mem *mem;
@@ -763,

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

2021-12-21 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Dec 21 11:07:51 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
add interrupt logic stuff


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/sociox/if_scx.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/arm/acpi

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 11:02:39 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c

Log Message:
Remove unneeded struct acpi_pci_intr forward declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/acpi/acpi_pci_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/arm/acpi/acpi_pci_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.20 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.21
--- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.20	Sun Aug  8 12:09:52 2021
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.c	Tue Dec 21 11:02:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.20 2021/08/08 12:09:52 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.21 2021/12/21 11:02:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.20 2021/08/08 12:09:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.21 2021/12/21 11:02:38 skrll Exp $");
 
 #include 
 #include 
@@ -86,8 +86,6 @@ struct acpi_pci_pct {
 static TAILQ_HEAD(, acpi_pci_pct) acpi_pci_chipset_tags =
 TAILQ_HEAD_INITIALIZER(acpi_pci_chipset_tags);
 
-struct acpi_pci_intr;
-
 struct acpi_pci_intr {
 	struct pic_softc		pi_pic;
 	intpi_irqbase;



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

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 11:02:39 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c

Log Message:
Remove unneeded struct acpi_pci_intr forward declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/acpi/acpi_pci_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/usb

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 10:16:05 UTC 2021

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

Log Message:
Remove an empty line


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/dev/usb/ehci.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.294 src/sys/dev/usb/ehci.c:1.295
--- src/sys/dev/usb/ehci.c:1.294	Tue Dec 21 10:14:43 2021
+++ src/sys/dev/usb/ehci.c	Tue Dec 21 10:16:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.294 2021/12/21 10:14:43 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.295 2021/12/21 10:16:05 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.294 2021/12/21 10:14:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.295 2021/12/21 10:16:05 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3163,7 +3163,6 @@ ehci_alloc_sitd(ehci_softc_t *sc)
 	mutex_enter(&sc->sc_lock);
 	freesitd = LIST_FIRST(&sc->sc_freesitds);
 	if (freesitd == NULL) {
-
 		DPRINTF("allocating chunk", 0, 0, 0, 0);
 		mutex_exit(&sc->sc_lock);
 



CVS commit: src/sys/dev/usb

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 10:16:05 UTC 2021

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

Log Message:
Remove an empty line


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/dev/usb/ehci.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-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 10:14:43 UTC 2021

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

Log Message:
Wrap a long line


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/sys/dev/usb/ehci.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.293 src/sys/dev/usb/ehci.c:1.294
--- src/sys/dev/usb/ehci.c:1.293	Tue Dec 21 09:51:22 2021
+++ src/sys/dev/usb/ehci.c	Tue Dec 21 10:14:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.293 2021/12/21 09:51:22 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.294 2021/12/21 10:14:43 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.293 2021/12/21 09:51:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.294 2021/12/21 10:14:43 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2000,8 +2000,9 @@ ehci_open(struct usbd_pipe *pipe)
 
 	switch (xfertype) {
 	case UE_CONTROL:
-		err = usb_allocmem(sc->sc_bus.ub_dmatag, sizeof(usb_device_request_t),
-		0, USBMALLOC_COHERENT, &epipe->ctrl.reqdma);
+		err = usb_allocmem(sc->sc_bus.ub_dmatag,
+		 sizeof(usb_device_request_t), 0, USBMALLOC_COHERENT,
+		 &epipe->ctrl.reqdma);
 #ifdef EHCI_DEBUG
 		if (err)
 			printf("ehci_open: usb_allocmem()=%d\n", err);



CVS commit: src/sys/dev/usb

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 10:14:43 UTC 2021

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

Log Message:
Wrap a long line


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/sys/dev/usb/ehci.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-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 09:51:22 UTC 2021

Modified Files:
src/sys/arch/mips/adm5120/dev: ahci.c
src/sys/dev/usb: ehci.c ohci.c uhci.c usb_mem.c usb_mem.h usbdi.c
xhci.c
src/sys/external/bsd/dwc2: dwc2.c
src/sys/external/bsd/dwc2/dist: dwc2_hcd.c dwc2_hcdddma.c
dwc2_hcdqueue.c

Log Message:
Change the usb_mem API to take a bus_dma_tag_t in usb_allocmem instead of
a struct usbd_bus *.

This allows an HCD to use more than one tag.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mips/adm5120/dev/ahci.c
cvs rdiff -u -r1.292 -r1.293 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.317 -r1.318 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.307 -r1.308 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/usb_mem.h
cvs rdiff -u -r1.219 -r1.220 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.76 -r1.77 src/sys/external/bsd/dwc2/dwc2.c
cvs rdiff -u -r1.25 -r1.26 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_hcdddma.c
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.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/mips/adm5120/dev/ahci.c
diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.27 src/sys/arch/mips/adm5120/dev/ahci.c:1.28
--- src/sys/arch/mips/adm5120/dev/ahci.c:1.27	Tue Dec  7 06:49:15 2021
+++ src/sys/arch/mips/adm5120/dev/ahci.c	Tue Dec 21 09:51:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahci.c,v 1.27 2021/12/07 06:49:15 skrll Exp $	*/
+/*	$NetBSD: ahci.c,v 1.28 2021/12/21 09:51:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.27 2021/12/07 06:49:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.28 2021/12/21 09:51:22 skrll Exp $");
 
 #include 
 #include 
@@ -877,7 +877,7 @@ ahci_device_ctrl_start(struct usbd_xfer 
 		td1 = (struct admhcd_td *)KSEG1ADDR(&td_v[1]);
 		td2 = (struct admhcd_td *)KSEG1ADDR(&td_v[2]);
 		td3 = (struct admhcd_td *)KSEG1ADDR(&td_v[3]);
-		err = usb_allocmem(&sc->sc_bus,
+		err = usb_allocmem(sc->sc_bus.ub_dmatag,
 			sizeof(usb_device_request_t),
 			0, USBMALLOC_COHERENT, &reqdma);
 		if (err)
@@ -990,7 +990,7 @@ ahci_device_ctrl_start(struct usbd_xfer 
 	usb_transfer_complete(xfer);
 	mutex_exit(&sc->sc_lock);
 
-	usb_freemem(&sc->sc_bus, &reqdma);
+	usb_freemem(&reqdma);
 
 	return USBD_NORMAL_COMPLETION;
 }

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.292 src/sys/dev/usb/ehci.c:1.293
--- src/sys/dev/usb/ehci.c:1.292	Tue Dec 21 08:49:03 2021
+++ src/sys/dev/usb/ehci.c	Tue Dec 21 09:51:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.292 2021/12/21 08:49:03 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.293 2021/12/21 09:51:22 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.292 2021/12/21 08:49:03 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.293 2021/12/21 09:51:22 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -517,7 +517,8 @@ ehci_init(ehci_softc_t *sc)
 	case 2: sc->sc_flsize = 256; break;
 	case 3: return EIO;
 	}
-	err = usb_allocmem(&sc->sc_bus, sc->sc_flsize * sizeof(ehci_link_t),
+	err = usb_allocmem(sc->sc_bus.ub_dmatag,
+	sc->sc_flsize * sizeof(ehci_link_t),
 	EHCI_FLALIGN_ALIGN, USBMALLOC_COHERENT, &sc->sc_fldma);
 	if (err)
 		return err;
@@ -654,7 +655,7 @@ ehci_init(ehci_softc_t *sc)
 	ehci_free_sqh(sc, sc->sc_async_head);
 #endif
  bad1:
-	usb_freemem(&sc->sc_bus, &sc->sc_fldma);
+	usb_freemem(&sc->sc_fldma);
 	return err;
 }
 
@@ -1999,7 +2000,7 @@ ehci_open(struct usbd_pipe *pipe)
 
 	switch (xfertype) {
 	case UE_CONTROL:
-		err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t),
+		err = usb_allocmem(sc->sc_bus.ub_dmatag, sizeof(usb_device_request_t),
 		0, USBMALLOC_COHERENT, &epipe->ctrl.reqdma);
 #ifdef EHCI_DEBUG
 		if (err)
@@ -2796,7 +2797,7 @@ ehci_alloc_sqh(ehci_softc_t *sc)
 		mutex_exit(&sc->sc_lock);
 
 		usb_dma_t dma;
-		int err = usb_allocmem(&sc->sc_bus,
+		int err = usb_allocmem(sc->sc_bus.ub_dmatag,
 		EHCI_SQH_SIZE * EHCI_SQH_CHUNK,
 		EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
 
@@ -2852,7 +2853,7 @@ ehci_alloc_sqtd(ehci_softc_t *sc)
 		mutex_exit(&sc->sc_lock);
 
 		usb_dma_t dma;
-		int err = usb_allocmem(&sc->sc_bus,
+		int err = usb_allocmem(sc->sc_bus.ub_dmatag,
 		EHCI_SQTD_SIZE * EHCI_SQTD_CHUNK,
 		EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
 
@@ -3112,7 +3113,7 @@ ehci_alloc_itd(ehci_softc_t *sc)
 		mutex_exit(&sc->sc_lock);
 
 		usb_dma_t dma;
-		int err = usb_allocmem(&sc->sc_bus,
+		int err = usb_allocmem(sc->sc_bus.ub_dmatag,
 		EHCI_ITD_S

CVS commit: src/sys

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 09:51:22 UTC 2021

Modified Files:
src/sys/arch/mips/adm5120/dev: ahci.c
src/sys/dev/usb: ehci.c ohci.c uhci.c usb_mem.c usb_mem.h usbdi.c
xhci.c
src/sys/external/bsd/dwc2: dwc2.c
src/sys/external/bsd/dwc2/dist: dwc2_hcd.c dwc2_hcdddma.c
dwc2_hcdqueue.c

Log Message:
Change the usb_mem API to take a bus_dma_tag_t in usb_allocmem instead of
a struct usbd_bus *.

This allows an HCD to use more than one tag.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mips/adm5120/dev/ahci.c
cvs rdiff -u -r1.292 -r1.293 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.317 -r1.318 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.307 -r1.308 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/usb_mem.h
cvs rdiff -u -r1.219 -r1.220 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.76 -r1.77 src/sys/external/bsd/dwc2/dwc2.c
cvs rdiff -u -r1.25 -r1.26 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_hcdddma.c
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.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-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 09:25:17 UTC 2021

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

Log Message:
Pass up bus_dma error from usb_block_allocmem rather than always returning
USBD_NOMEM on error.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/usb/usb_mem.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/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.82 src/sys/dev/usb/usb_mem.c:1.83
--- src/sys/dev/usb/usb_mem.c:1.82	Tue Dec 21 09:23:41 2021
+++ src/sys/dev/usb/usb_mem.c	Tue Dec 21 09:25:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.82 2021/12/21 09:23:41 skrll Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.83 2021/12/21 09:25:17 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.82 2021/12/21 09:23:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.83 2021/12/21 09:25:17 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -210,7 +210,7 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 	kmem_free(b, sizeof(*b));
 	mutex_enter(&usb_blk_lock);
 
-	return USBD_NOMEM;
+	return error;
 }
 
 #if 0



CVS commit: src/sys/dev/usb

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 09:25:17 UTC 2021

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

Log Message:
Pass up bus_dma error from usb_block_allocmem rather than always returning
USBD_NOMEM on error.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/usb/usb_mem.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-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 09:23:41 UTC 2021

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

Log Message:
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/usb_mem.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/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.81 src/sys/dev/usb/usb_mem.c:1.82
--- src/sys/dev/usb/usb_mem.c:1.81	Thu May 27 10:44:29 2021
+++ src/sys/dev/usb/usb_mem.c	Tue Dec 21 09:23:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.81 2021/05/27 10:44:29 jmcneill Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.82 2021/12/21 09:23:41 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.81 2021/05/27 10:44:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.82 2021/12/21 09:23:41 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -167,9 +167,8 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 	b->segs = kmem_alloc(b->nsegs * sizeof(*b->segs), KM_SLEEP);
 	b->nsegs_alloc = b->nsegs;
 
-	error = bus_dmamem_alloc(tag, b->size, align, 0,
- b->segs, b->nsegs,
- &b->nsegs, BUS_DMA_WAITOK);
+	error = bus_dmamem_alloc(tag, b->size, align, 0, b->segs, b->nsegs,
+	&b->nsegs, BUS_DMA_WAITOK);
 	if (error)
 		goto free0;
 
@@ -178,13 +177,13 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 	if (error)
 		goto free1;
 
-	error = bus_dmamap_create(tag, b->size, b->nsegs, b->size,
-  0, BUS_DMA_WAITOK, &b->map);
+	error = bus_dmamap_create(tag, b->size, b->nsegs, b->size, 0,
+	BUS_DMA_WAITOK, &b->map);
 	if (error)
 		goto unmap;
 
 	error = bus_dmamap_load(tag, b->map, b->kaddr, b->size, NULL,
-BUS_DMA_WAITOK);
+	BUS_DMA_WAITOK);
 	if (error)
 		goto destroy;
 



CVS commit: src/sys/dev/usb

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 09:23:41 UTC 2021

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

Log Message:
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/usb_mem.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-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 08:49:03 UTC 2021

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

Log Message:
KASSERT(BUS_ADDR_HI32(baddr) == 0) in, and apply some consistent code
style to all of ehci_alloc_{sqh,sqtd,itd,sitd}.

While ehci can address memory >4GB for control structures
EHCI_CTRLDSSEGMENT is always set to zero so ehci assumes it's using the
low 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.292 src/sys/dev/usb/ehci.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.291 src/sys/dev/usb/ehci.c:1.292
--- src/sys/dev/usb/ehci.c:1.291	Sat Dec 18 14:48:14 2021
+++ src/sys/dev/usb/ehci.c	Tue Dec 21 08:49:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.291 2021/12/18 14:48:14 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.292 2021/12/21 08:49:03 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.291 2021/12/18 14:48:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.292 2021/12/21 08:49:03 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2787,8 +2787,6 @@ Static ehci_soft_qh_t *
 ehci_alloc_sqh(ehci_softc_t *sc)
 {
 	ehci_soft_qh_t *sqh;
-	int i, offs;
-	usb_dma_t dma;
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
@@ -2797,6 +2795,7 @@ ehci_alloc_sqh(ehci_softc_t *sc)
 		DPRINTF("allocating chunk", 0, 0, 0, 0);
 		mutex_exit(&sc->sc_lock);
 
+		usb_dma_t dma;
 		int err = usb_allocmem(&sc->sc_bus,
 		EHCI_SQH_SIZE * EHCI_SQH_CHUNK,
 		EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
@@ -2807,12 +2806,17 @@ ehci_alloc_sqh(ehci_softc_t *sc)
 		}
 
 		mutex_enter(&sc->sc_lock);
-		for (i = 0; i < EHCI_SQH_CHUNK; i++) {
-			offs = i * EHCI_SQH_SIZE;
+		for (size_t i = 0; i < EHCI_SQH_CHUNK; i++) {
+			const int offs = i * EHCI_SQH_SIZE;
+			const bus_addr_t baddr = DMAADDR(&dma, offs);
+
+			KASSERT(BUS_ADDR_HI32(baddr) == 0);
+
 			sqh = KERNADDR(&dma, offs);
-			sqh->physaddr = DMAADDR(&dma, offs);
+			sqh->physaddr = BUS_ADDR_LO32(baddr);
 			sqh->dma = dma;
 			sqh->offs = offs;
+
 			sqh->next = sc->sc_freeqhs;
 			sc->sc_freeqhs = sqh;
 		}
@@ -2839,8 +2843,6 @@ Static ehci_soft_qtd_t *
 ehci_alloc_sqtd(ehci_softc_t *sc)
 {
 	ehci_soft_qtd_t *sqtd = NULL;
-	int i, offs;
-	usb_dma_t dma;
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
@@ -2849,6 +2851,7 @@ ehci_alloc_sqtd(ehci_softc_t *sc)
 		DPRINTF("allocating chunk", 0, 0, 0, 0);
 		mutex_exit(&sc->sc_lock);
 
+		usb_dma_t dma;
 		int err = usb_allocmem(&sc->sc_bus,
 		EHCI_SQTD_SIZE * EHCI_SQTD_CHUNK,
 		EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
@@ -2859,10 +2862,14 @@ ehci_alloc_sqtd(ehci_softc_t *sc)
 		}
 
 		mutex_enter(&sc->sc_lock);
-		for (i = 0; i < EHCI_SQTD_CHUNK; i++) {
-			offs = i * EHCI_SQTD_SIZE;
+		for (size_t i = 0; i < EHCI_SQTD_CHUNK; i++) {
+			const int offs = i * EHCI_SQTD_SIZE;
+			const bus_addr_t baddr = DMAADDR(&dma, offs);
+
+			KASSERT(BUS_ADDR_HI32(baddr) == 0);
+
 			sqtd = KERNADDR(&dma, offs);
-			sqtd->physaddr = DMAADDR(&dma, offs);
+			sqtd->physaddr = BUS_ADDR_LO32(baddr);
 			sqtd->dma = dma;
 			sqtd->offs = offs;
 
@@ -3094,7 +3101,6 @@ Static ehci_soft_itd_t *
 ehci_alloc_itd(ehci_softc_t *sc)
 {
 	struct ehci_soft_itd *itd, *freeitd;
-	usb_dma_t dma;
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
@@ -3105,6 +3111,7 @@ ehci_alloc_itd(ehci_softc_t *sc)
 		DPRINTF("allocating chunk", 0, 0, 0, 0);
 		mutex_exit(&sc->sc_lock);
 
+		usb_dma_t dma;
 		int err = usb_allocmem(&sc->sc_bus,
 		EHCI_ITD_SIZE * EHCI_ITD_CHUNK,
 		EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
@@ -3115,12 +3122,17 @@ ehci_alloc_itd(ehci_softc_t *sc)
 		}
 
 		mutex_enter(&sc->sc_lock);
-		for (int i = 0; i < EHCI_ITD_CHUNK; i++) {
-			int offs = i * EHCI_ITD_SIZE;
+		for (size_t i = 0; i < EHCI_ITD_CHUNK; i++) {
+			const int offs = i * EHCI_ITD_SIZE;
+			const bus_addr_t baddr = DMAADDR(&dma, offs);
+
+			KASSERT(BUS_ADDR_HI32(baddr) == 0);
+
 			itd = KERNADDR(&dma, offs);
-			itd->physaddr = DMAADDR(&dma, offs);
+			itd->physaddr = BUS_ADDR_LO32(baddr);
 	 		itd->dma = dma;
 			itd->offs = offs;
+
 			LIST_INSERT_HEAD(&sc->sc_freeitds, itd, free_list);
 		}
 		freeitd = LIST_FIRST(&sc->sc_freeitds);
@@ -3143,17 +3155,17 @@ Static ehci_soft_sitd_t *
 ehci_alloc_sitd(ehci_softc_t *sc)
 {
 	struct ehci_soft_sitd *sitd, *freesitd;
-	int i, offs;
-	usb_dma_t dma;
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
 	mutex_enter(&sc->sc_lock);
 	freesitd = LIST_FIRST(&sc->sc_freesitds);
 	if (freesitd == NULL) {
+
 		DPRINTF("allocating chunk", 0, 0, 0, 0);
 		mutex_exit(&sc->sc_lock);
 
+		usb_dma_t dma;
 		int err = usb_allocmem(&sc->sc_bus,
 		EHCI_SITD_SIZE * EHCI_SITD_CHUNK,
 		EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
@@ -3164,12 +3176,17 @@ ehci_alloc_sitd(ehci_softc_t *sc)
 		}
 
 		mutex_enter(&sc->sc_lock);
-

CVS commit: src/sys/dev/usb

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 08:49:03 UTC 2021

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

Log Message:
KASSERT(BUS_ADDR_HI32(baddr) == 0) in, and apply some consistent code
style to all of ehci_alloc_{sqh,sqtd,itd,sitd}.

While ehci can address memory >4GB for control structures
EHCI_CTRLDSSEGMENT is always set to zero so ehci assumes it's using the
low 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.292 src/sys/dev/usb/ehci.c

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



CVS commit: src/sys/uvm

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 08:27:49 UTC 2021

Modified Files:
src/sys/uvm: uvm_pglist.c

Log Message:
Update uvm_pglistalloc_[cs]_ps to return EINVAL if [low, high] doesn't
match any memory.

Useful for bus_dmamem_alloc where a tag might not cover any memory.
This will be used in an update to ehci.

"looks good" from chuq@


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.89 src/sys/uvm/uvm_pglist.c:1.90
--- src/sys/uvm/uvm_pglist.c:1.89	Mon Dec 20 22:40:46 2021
+++ src/sys/uvm/uvm_pglist.c	Tue Dec 21 08:27:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.89 2021/12/20 22:40:46 skrll Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.89 2021/12/20 22:40:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $");
 
 #include 
 #include 
@@ -131,7 +131,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 	 */
 	if (high <= uvm_physseg_get_avail_start(psi) ||
 	low >= uvm_physseg_get_avail_end(psi))
-		return 0;
+		return -1;
 
 	/*
 	 * We start our search at the just after where the last allocation
@@ -456,6 +456,7 @@ uvm_pglistalloc_contig(int num, paddr_t 
 
 	/* Default to "lose". */
 	error = ENOMEM;
+	bool valid = false;
 
 	/*
 	 * Block all memory allocation and lock the free list.
@@ -477,8 +478,12 @@ uvm_pglistalloc_contig(int num, paddr_t 
 			if (uvm_physseg_get_free_list(psi) != fl)
 continue;
 
-			num -= uvm_pglistalloc_c_ps(psi, num, low, high,
-		alignment, boundary, rlist);
+			int done = uvm_pglistalloc_c_ps(psi, num, low, high,
+			alignment, boundary, rlist);
+			if (done >= 0) {
+valid = true;
+num -= done;
+			}
 			if (num == 0) {
 #ifdef PGALLOC_VERBOSE
 printf("pgalloc: %"PRIxMAX"-%"PRIxMAX"\n",
@@ -490,6 +495,10 @@ uvm_pglistalloc_contig(int num, paddr_t 
 			}
 		}
 	}
+	if (!valid) {
+		uvm_pgfl_unlock();
+		return EINVAL;
+	}
 
 out:
 	uvm_pgfl_unlock();
@@ -534,7 +543,7 @@ uvm_pglistalloc_s_ps(uvm_physseg_t psi, 
 	 */
 	if (high <= uvm_physseg_get_avail_start(psi) ||
 	low >= uvm_physseg_get_avail_end(psi))
-		return 0;
+		return -1;
 
 	todo = num;
 	candidate = uimax(low, uvm_physseg_get_avail_start(psi) +
@@ -609,6 +618,7 @@ uvm_pglistalloc_simple(int num, paddr_t 
 
 	/* Default to "lose". */
 	error = ENOMEM;
+	bool valid = false;
 
 again:
 	/*
@@ -632,7 +642,12 @@ again:
 			if (uvm_physseg_get_free_list(psi) != fl)
 continue;
 
-			num -= uvm_pglistalloc_s_ps(psi, num, low, high, rlist);
+			int done = uvm_pglistalloc_s_ps(psi, num, low, high,
+rlist);
+			if (done >= 0) {
+valid = true;
+num -= done;
+			}
 			if (num == 0) {
 error = 0;
 goto out;
@@ -640,6 +655,10 @@ again:
 		}
 
 	}
+	if (!valid) {
+		uvm_pgfl_unlock();
+		return EINVAL;
+	}
 
 out:
 	/*



CVS commit: src/sys/uvm

2021-12-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 21 08:27:49 UTC 2021

Modified Files:
src/sys/uvm: uvm_pglist.c

Log Message:
Update uvm_pglistalloc_[cs]_ps to return EINVAL if [low, high] doesn't
match any memory.

Useful for bus_dmamem_alloc where a tag might not cover any memory.
This will be used in an update to ehci.

"looks good" from chuq@


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/uvm/uvm_pglist.c

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