CVS commit: src/sys/arch/landisk/dev

2021-07-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 05:07:50 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: btn_obio.c button.c buttonvar.h

Log Message:
Migrate btn_init() from btnopen() (with RUN_ONCE) to btn_obio_attach().

Fix uninitialized use of btn_event_list_lock in btn_event_register().

Found by LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/dev/btn_obio.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/landisk/dev/button.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/landisk/dev/buttonvar.h

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

Modified files:

Index: src/sys/arch/landisk/dev/btn_obio.c
diff -u src/sys/arch/landisk/dev/btn_obio.c:1.6 src/sys/arch/landisk/dev/btn_obio.c:1.7
--- src/sys/arch/landisk/dev/btn_obio.c:1.6	Sat Jan 21 19:44:29 2012
+++ src/sys/arch/landisk/dev/btn_obio.c	Thu Jul 15 05:07:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: btn_obio.c,v 1.6 2012/01/21 19:44:29 nonaka Exp $	*/
+/*	$NetBSD: btn_obio.c,v 1.7 2021/07/15 05:07:50 rin Exp $	*/
 
 /*-
  * Copyright (C) 2005 NONAKA Kimihiro 
@@ -28,7 +28,7 @@
 #include "pwrsw_obio.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btn_obio.c,v 1.6 2012/01/21 19:44:29 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btn_obio.c,v 1.7 2021/07/15 05:07:50 rin Exp $");
 
 #include 
 #include 
@@ -141,6 +141,7 @@ btn_obio_attach(device_t parent, device_
 	}
 	sc->sc_mask |= BTN_RESET_BIT;
 
+	btn_init();
 	for (i = 0; i < NBUTTON; i++) {
 		int idx = btnlist[i].idx;
 		sc->sc_bev[idx].bev_name = btnlist[i].name;

Index: src/sys/arch/landisk/dev/button.c
diff -u src/sys/arch/landisk/dev/button.c:1.10 src/sys/arch/landisk/dev/button.c:1.11
--- src/sys/arch/landisk/dev/button.c:1.10	Sat Dec 19 21:25:03 2020
+++ src/sys/arch/landisk/dev/button.c	Thu Jul 15 05:07:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: button.c,v 1.10 2020/12/19 21:25:03 thorpej Exp $	*/
+/*	$NetBSD: button.c,v 1.11 2021/07/15 05:07:50 rin Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.10 2020/12/19 21:25:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.11 2021/07/15 05:07:50 rin Exp $");
 
 #include 
 #include 
@@ -59,7 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: button.c,v 1
 /*
  * event handler
  */
-static ONCE_DECL(btn_once);
 static LIST_HEAD(, btn_event) btn_event_list;
 static kmutex_t btn_event_list_lock;
 
@@ -105,7 +104,7 @@ const struct cdevsw button_cdevsw = {
 	.d_flag = 0
 };
 
-static int
+int
 btn_init(void)
 {
 
@@ -161,11 +160,6 @@ btnopen(dev_t dev, int flag, int mode, s
 {
 	int error;
 
-	error = RUN_ONCE(_once, btn_init);
-	if (error) {
-		return error;
-	}
-
 	if (minor(dev) != 0) {
 		return (ENODEV);
 	}

Index: src/sys/arch/landisk/dev/buttonvar.h
diff -u src/sys/arch/landisk/dev/buttonvar.h:1.1 src/sys/arch/landisk/dev/buttonvar.h:1.2
--- src/sys/arch/landisk/dev/buttonvar.h:1.1	Fri Sep  1 21:26:18 2006
+++ src/sys/arch/landisk/dev/buttonvar.h	Thu Jul 15 05:07:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: buttonvar.h,v 1.1 2006/09/01 21:26:18 uwe Exp $	*/
+/*	$NetBSD: buttonvar.h,v 1.2 2021/07/15 05:07:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -45,6 +45,8 @@ struct btn_event {
 	LIST_ENTRY(btn_event) bev_list;
 };
 
+int	btn_init(void);
+
 void	btn_settype(const char *type);
 
 int	btn_event_register(struct btn_event *bev);



CVS commit: src/sys/arch/sh3/sh3

2021-07-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 04:58:33 UTC 2021

Modified Files:
src/sys/arch/sh3/sh3: locore_subr.S

Log Message:
For cpu_switchto(), inherit PSL_IMASK field of SR between lwp's.

Otherwise, IPL is lost during context switch, which allows improper
interrupts when, e.g., spin mutexes are hold.

With this fix, full ATF is successfully completed on DIAGNOSTIC
kernel (with one KASSERT in uvm_map.c, which triggers kern/51254,
converted to printf).

Thanks uwe@ for review and suggesting optimization.

Also thanks ad@ for useful comment, and ryo@ for giving me reference
manuals of SH-4!


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sh3/sh3/locore_subr.S

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

Modified files:

Index: src/sys/arch/sh3/sh3/locore_subr.S
diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.60 src/sys/arch/sh3/sh3/locore_subr.S:1.61
--- src/sys/arch/sh3/sh3/locore_subr.S:1.60	Mon Aug  3 16:43:44 2020
+++ src/sys/arch/sh3/sh3/locore_subr.S	Thu Jul 15 04:58:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.61 2021/07/15 04:58:33 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $")
+__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.61 2021/07/15 04:58:33 rin Exp $")
 
 
 /*
@@ -140,7 +140,22 @@ ENTRY(cpu_switchto)
 	mov	r10, r1		! >l_md.md_pcb->pcb_sf
 	mov	r9, r0		! return olwp (we are about to clobber r9)
 	ldc.l	@r1+, gbr
-	ldc.l	@r1+, sr
+
+	/*
+	 * We cannot simply pop SR here; PSL_IMASK field should be
+	 * inherited to nlwp. Otherwise, IPL is lost during context
+	 * switch, which allows improper interrupts when, e.g.,
+	 * spin mutexes are hold.
+	 */
+	mov.l	@r1+, r8	! r8  = new SR
+	mov	#0x78, r9
+	shll	r9		! r9  =  PSL_IMASK
+	not	r9, r10		! r10 = ~PSL_IMASK
+	and	r9, r11		! r11 = old SR & PSL_IMASK
+	and	r10, r8
+	or	r11, r8
+	ldc	r8, sr
+
 	lds.l	@r1+, pr
 	mov.l	@r1+, r8
 	mov.l	@r1+, r9



CVS commit: src/sys/net

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Jul 15 04:05:47 UTC 2021

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

Log Message:
vlan: drop tagged outgoing packets

vlan(4) doesn't support Q-in-Q yet.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.159 src/sys/net/if_vlan.c:1.160
--- src/sys/net/if_vlan.c:1.159	Wed Jul 14 06:50:22 2021
+++ src/sys/net/if_vlan.c	Thu Jul 15 04:05:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.159 2021/07/14 06:50:22 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.160 2021/07/15 04:05:47 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.159 2021/07/14 06:50:22 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.160 2021/07/15 04:05:47 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1321,6 +1321,7 @@ vlan_start(struct ifnet *ifp)
 	struct mbuf *m;
 	struct ifvlan_linkmib *mib;
 	struct psref psref;
+	struct ether_header *eh;
 	int error;
 
 	mib = vlan_getref_linkmib(ifv, );
@@ -1342,6 +1343,21 @@ vlan_start(struct ifnet *ifp)
 		if (m == NULL)
 			break;
 
+		if (m->m_len < sizeof(*eh)) {
+			m = m_pullup(m, sizeof(*eh));
+			if (m == NULL) {
+if_statinc(ifp, if_oerrors);
+continue;
+			}
+		}
+
+		eh = mtod(m, struct ether_header *);
+		if (ntohs(eh->ether_type) == ETHERTYPE_VLAN) {
+			m_freem(m);
+			if_statinc(ifp, if_noproto);
+			continue;
+		}
+
 #ifdef ALTQ
 		/*
 		 * KERNEL_LOCK is required for ALTQ even if NET_MPSAFE is
@@ -1465,10 +1481,26 @@ vlan_transmit(struct ifnet *ifp, struct 
 	struct ethercom *ec;
 	struct ifvlan_linkmib *mib;
 	struct psref psref;
+	struct ether_header *eh;
 	int error;
 	size_t pktlen = m->m_pkthdr.len;
 	bool mcast = (m->m_flags & M_MCAST) != 0;
 
+	if (m->m_len < sizeof(*eh)) {
+		m = m_pullup(m, sizeof(*eh));
+		if (m == NULL) {
+			if_statinc(ifp, if_oerrors);
+			return ENOBUFS;
+		}
+	}
+
+	eh = mtod(m, struct ether_header *);
+	if (ntohs(eh->ether_type) == ETHERTYPE_VLAN) {
+		m_freem(m);
+		if_statinc(ifp, if_noproto);
+		return EPROTONOSUPPORT;
+	}
+
 	mib = vlan_getref_linkmib(ifv, );
 	if (mib == NULL) {
 		m_freem(m);



CVS commit: src/sys/dev/usb

2021-07-14 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Jul 15 03:25:50 UTC 2021

Modified Files:
src/sys/dev/usb: if_mue.c uchcom.c

Log Message:
explanation typo


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/usb/if_mue.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/uchcom.c

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

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.60 src/sys/dev/usb/if_mue.c:1.61
--- src/sys/dev/usb/if_mue.c:1.60	Sat Jun 27 13:33:26 2020
+++ src/sys/dev/usb/if_mue.c	Thu Jul 15 03:25:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.60 2020/06/27 13:33:26 jmcneill Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.60 2020/06/27 13:33:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -98,7 +98,7 @@ static void	mue_setmtu_locked(struct usb
 static void	mue_reset(struct usbnet *);
 
 static void	mue_uno_stop(struct ifnet *, int);
-static int	mue_uno_ioctl(struct ifnet *, u_long, void *);
+static int	mue_uno_override_ioctl(struct ifnet *, u_long, void *);
 static int	mue_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static int	mue_uno_mii_write_reg(struct usbnet *, int, int, uint16_t);
 static void	mue_uno_mii_statchg(struct ifnet *);
@@ -110,7 +110,7 @@ static int	mue_uno_init(struct ifnet *);
 
 static const struct usbnet_ops mue_ops = {
 	.uno_stop = mue_uno_stop,
-	.uno_ioctl = mue_uno_ioctl,
+	.uno_override_ioctl = mue_uno_override_ioctl,
 	.uno_read_reg = mue_uno_mii_read_reg,
 	.uno_write_reg = mue_uno_mii_write_reg,
 	.uno_statchg = mue_uno_mii_statchg,
@@ -137,7 +137,14 @@ static const struct usbnet_ops mue_ops =
 #define ETHER_IS_ZERO(addr) \
 	(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
 
-CFATTACH_DECL_NEW(mue, sizeof(struct usbnet), mue_match, mue_attach,
+struct mue_softc {
+	struct usbnet	   sc_un;
+	struct usbnet_intr sc_intr;
+	uint8_t sc_ibuf[8];
+	unsigned sc_flowflags;		/* 802.3x PAUSE flow control */
+};
+
+CFATTACH_DECL_NEW(mue, sizeof(struct mue_softc), mue_match, mue_attach,
 usbnet_detach, usbnet_activate);
 
 static uint32_t
@@ -760,14 +767,15 @@ static void
 mue_attach(device_t parent, device_t self, void *aux)
 {
 	USBNET_MII_DECL_DEFAULT(unm);
-	struct usbnet * const un = device_private(self);
 	prop_dictionary_t dict = device_properties(self);
+	struct mue_softc * const sc = device_private(self);
 	struct usb_attach_arg *uaa = aux;
 	struct usbd_device *dev = uaa->uaa_device;
+	struct usbnet *un = >sc_un;
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
-	char *devinfop;
 	usbd_status err;
+	char *devinfop;
 	const char *descr;
 	uint32_t id_rev;
 	uint8_t i;
@@ -782,7 +790,7 @@ mue_attach(device_t parent, device_t sel
 
 	un->un_dev = self;
 	un->un_udev = dev;
-	un->un_sc = un;
+	un->un_sc = sc; /* @@! */
 	un->un_ops = _ops;
 	un->un_rx_xfer_flags = USBD_SHORT_XFER_OK;
 	un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER;
@@ -884,6 +892,8 @@ mue_attach(device_t parent, device_t sel
 	ec->ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU;
 #endif
 
+	unm.un_mii_phyloc = un->un_phyno;	/* use internal PHY 1 */
+	unm.un_mii_flags |= MIIF_DOPAUSE;	/* use PAUSE cap. */
 	usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
 	0, );
 }
@@ -997,90 +1007,93 @@ mue_setiff_locked(struct usbnet *un)
 {
 	struct ethercom *ec = usbnet_ec(un);
 	struct ifnet * const ifp = usbnet_ifp(un);
-	const uint8_t *enaddr = CLLADDR(ifp->if_sadl);
-	struct ether_multi *enm;
 	struct ether_multistep step;
-	uint32_t pfiltbl[MUE_NUM_ADDR_FILTX][2];
-	uint32_t hashtbl[MUE_DP_SEL_VHF_HASH_LEN];
-	uint32_t reg, rxfilt, h, hireg, loreg;
+	struct ether_multi *enm;
+	uint32_t mchash[MUE_DP_SEL_VHF_HASH_LEN];
+	uint32_t rfe, rxfilt, crc, hireg, loreg;
 	size_t i;
 
 	if (usbnet_isdying(un))
 		return;
 
-	/* Clear perfect filter and hash tables. */
-	memset(pfiltbl, 0, sizeof(pfiltbl));
-	memset(hashtbl, 0, sizeof(hashtbl));
+	for (i = 1; i < MUE_NUM_ADDR_FILTX; i++) {
+		hireg = (un->un_flags & LAN7500)
+		? MUE_7500_ADDR_FILTX(i) : MUE_7800_ADDR_FILTX(i);
+		mue_csr_write(un, hireg, 0);
+	}
+	memset(mchash, 0, sizeof(mchash));
 
-	reg = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL;
-	rxfilt = mue_csr_read(un, reg);
-	rxfilt &= ~(MUE_RFE_CTL_PERFECT | MUE_RFE_CTL_MULTICAST_HASH |
+	rfe = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL;
+	rxfilt = mue_csr_read(un, rfe);
+	rxfilt &= ~(MUE_RFE_CTL_MULTICAST_HASH |
 	MUE_RFE_CTL_UNICAST | MUE_RFE_CTL_MULTICAST);
 
-	/* Always accept broadcast frames. */
-	rxfilt |= 

CVS commit: src/sys/arch/alpha/jensenio

2021-07-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jul 15 01:43:54 UTC 2021

Modified Files:
src/sys/arch/alpha/jensenio: jensenio_intr.c

Log Message:
- Use defined constants for PIC registers, not magic numbers (XXX except
  for the ELCR register; need a new header file).
- In jensenio_specific_eoi(), actually issue a specific EOI (the code
  was erroneously issuing a non-specific EOI).
- In jensenio_pic_init(), ensure all IRQs are initialized to EDGE trigger.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/jensenio/jensenio_intr.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/alpha/jensenio/jensenio_intr.c
diff -u src/sys/arch/alpha/jensenio/jensenio_intr.c:1.17 src/sys/arch/alpha/jensenio/jensenio_intr.c:1.18
--- src/sys/arch/alpha/jensenio/jensenio_intr.c:1.17	Sun Jul  4 22:42:35 2021
+++ src/sys/arch/alpha/jensenio/jensenio_intr.c	Thu Jul 15 01:43:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: jensenio_intr.c,v 1.17 2021/07/04 22:42:35 thorpej Exp $ */
+/* $NetBSD: jensenio_intr.c,v 1.18 2021/07/15 01:43:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.17 2021/07/04 22:42:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.18 2021/07/15 01:43:54 thorpej Exp $");
 
 #include 
 #include 
@@ -44,6 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: jensenio_int
 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -97,11 +99,12 @@ static inline void
 jensenio_specific_eoi(int irq)
 {
 
-	if (irq > 7)
-		bus_space_write_1(pic_iot, pic_ioh[1],
-		0, 0x20 | (irq & 0x07));
-	bus_space_write_1(pic_iot, pic_ioh[0],
-	0, 0x20 | (irq > 7 ? 2 : irq));
+	if (irq > 7) {
+		bus_space_write_1(pic_iot, pic_ioh[1], PIC_OCW2,
+		OCW2_EOI | OCW2_SL | (irq & 0x07));
+	}
+	bus_space_write_1(pic_iot, pic_ioh[0], PIC_OCW2,
+	OCW2_EOI | OCW2_SL | (irq > 7 ? 2 : irq));
 }
 
 void
@@ -341,12 +344,12 @@ jensenio_enable_intr(int irq, int onoff)
 	pic = irq >> 3;
 	bit = 1 << (irq & 0x7);
 
-	mask = bus_space_read_1(pic_iot, pic_ioh[pic], 1);
+	mask = bus_space_read_1(pic_iot, pic_ioh[pic], PIC_OCW1);
 	if (onoff)
 		mask &= ~bit;
 	else
 		mask |= bit;
-	bus_space_write_1(pic_iot, pic_ioh[pic], 1, mask);
+	bus_space_write_1(pic_iot, pic_ioh[pic], PIC_OCW1, mask);
 }
 
 void
@@ -378,12 +381,15 @@ jensenio_pic_init(void)
 	for (pic = 0; pic < 2; pic++) {
 		if (bus_space_map(pic_iot, picaddr[pic], 2, 0, _ioh[pic]))
 			panic("jensenio_init_intr: unable to map PIC %d", pic);
-		bus_space_write_1(pic_iot, pic_ioh[pic], 1, 0xff);
+		bus_space_write_1(pic_iot, pic_ioh[pic], PIC_OCW1, 0xff);
 	}
 
 	/*
-	 * Map the ELCR registers.
+	 * Map the ELCR registers and initialize all interrupts to EDGE
+	 * trigger.
 	 */
 	if (bus_space_map(pic_iot, 0x4d0, 2, 0, _elcr_ioh))
 		panic("jensenio_init_intr: unable to map ELCR registers");
+	bus_space_write_1(pic_iot, pic_elcr_ioh, 0, 0);
+	bus_space_write_1(pic_iot, pic_elcr_ioh, 1, 0);
 }



CVS commit: src/sys/arch/alpha/pci

2021-07-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jul 15 01:29:23 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: sio_pic.c

Log Message:
- Use defined constants for PIC registers, not magic numbers.
- Inline specific_eoi().

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/alpha/pci/sio_pic.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/alpha/pci/sio_pic.c
diff -u src/sys/arch/alpha/pci/sio_pic.c:1.52 src/sys/arch/alpha/pci/sio_pic.c:1.53
--- src/sys/arch/alpha/pci/sio_pic.c:1.52	Sun Jul  4 22:42:36 2021
+++ src/sys/arch/alpha/pci/sio_pic.c	Thu Jul 15 01:29:23 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sio_pic.c,v 1.52 2021/07/04 22:42:36 thorpej Exp $ */
+/* $NetBSD: sio_pic.c,v 1.53 2021/07/15 01:29:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2020 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.52 2021/07/04 22:42:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 1.53 2021/07/15 01:29:23 thorpej Exp $");
 
 #include 
 #include 
@@ -78,6 +78,8 @@ __KERNEL_RCSID(0, "$NetBSD: sio_pic.c,v 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -150,7 +152,7 @@ i82378_setup_elcr(void)
 	 * fall-back in case nothing else matches.
 	 */
 
-	rv = bus_space_map(sio_iot, 0x4d0, 2, 0, _ioh_elcr);
+	rv = bus_space_map(sio_iot, SIO_REG_ICU1ELC, 2, 0, _ioh_elcr);
 
 	if (rv == 0) {
 		sio_read_elcr = i82378_read_elcr;
@@ -270,6 +272,17 @@ static int (*const sio_elcr_setup_funcs[
 
 / Shared SIO/Cypress functions /
 
+static inline void
+specific_eoi(int irq)
+{
+	if (irq > 7) {
+		bus_space_write_1(sio_iot, sio_ioh_icu2, PIC_OCW2,
+		OCW2_EOI | OCW2_SL | (irq & 0x07));	/* XXX */
+	}
+	bus_space_write_1(sio_iot, sio_ioh_icu1, PIC_OCW2,
+	OCW2_EOI | OCW2_SL | (irq > 7 ? 2 : irq));
+}
+
 static void
 sio_setirqstat(int irq, int enabled, int type)
 {
@@ -284,8 +297,8 @@ sio_setirqstat(int irq, int enabled, int
 	icu = irq / 8;
 	bit = irq % 8;
 
-	ocw1[0] = bus_space_read_1(sio_iot, sio_ioh_icu1, 1);
-	ocw1[1] = bus_space_read_1(sio_iot, sio_ioh_icu2, 1);
+	ocw1[0] = bus_space_read_1(sio_iot, sio_ioh_icu1, PIC_OCW1);
+	ocw1[1] = bus_space_read_1(sio_iot, sio_ioh_icu2, PIC_OCW1);
 	elcr[0] = (*sio_read_elcr)(0);/* XXX */
 	elcr[1] = (*sio_read_elcr)(1);/* XXX */
 
@@ -730,12 +743,3 @@ sio_intr_alloc(void *v, int mask, int ty
 
 	return (0);
 }
-
-static void
-specific_eoi(int irq)
-{
-	if (irq > 7)
-		bus_space_write_1(sio_iot,
-		sio_ioh_icu2, 0, 0x60 | (irq & 0x07));	/* XXX */
-	bus_space_write_1(sio_iot, sio_ioh_icu1, 0, 0x60 | (irq > 7 ? 2 : irq));
-}



CVS commit: src

2021-07-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 14 20:39:13 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile decl.c decl.exp
decl_struct_member.c decl_struct_member.exp gcc_attribute_func.c
gcc_attribute_func.exp init_c90.c init_c90.exp msg_002.c
msg_002.exp msg_072.c msg_072.exp
Added Files:
src/tests/usr.bin/xlint/lint1: gcc_stmt_asm.c gcc_stmt_asm.exp
stmt_goto.c stmt_goto.exp

Log Message:
tests/lint: add several tests for edge cases in the grammar


To generate a diff of this commit:
cvs rdiff -u -r1.1087 -r1.1088 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.88 -r1.89 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/decl.c \
src/tests/usr.bin/xlint/lint1/decl.exp \
src/tests/usr.bin/xlint/lint1/decl_struct_member.exp \
src/tests/usr.bin/xlint/lint1/msg_002.c \
src/tests/usr.bin/xlint/lint1/msg_072.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_func.c \
src/tests/usr.bin/xlint/lint1/gcc_attribute_func.exp \
src/tests/usr.bin/xlint/lint1/init_c90.c \
src/tests/usr.bin/xlint/lint1/init_c90.exp
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/gcc_stmt_asm.c \
src/tests/usr.bin/xlint/lint1/gcc_stmt_asm.exp \
src/tests/usr.bin/xlint/lint1/stmt_goto.c \
src/tests/usr.bin/xlint/lint1/stmt_goto.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_002.exp \
src/tests/usr.bin/xlint/lint1/msg_072.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1087 src/distrib/sets/lists/tests/mi:1.1088
--- src/distrib/sets/lists/tests/mi:1.1087	Wed Jul 14 03:22:33 2021
+++ src/distrib/sets/lists/tests/mi	Wed Jul 14 20:39:13 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1087 2021/07/14 03:22:33 ozaki-r Exp $
+# $NetBSD: mi,v 1.1088 2021/07/14 20:39:13 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6248,6 +6248,8 @@
 ./usr/tests/usr.bin/xlint/lint1/gcc_bit_field_types.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/gcc_stmt_asm.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/gcc_stmt_asm.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/init.ctests-usr.bin-tests	compattestfile,atf
@@ -6982,6 +6984,8 @@
 ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_for.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_for.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/stmt_goto.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/stmt_goto.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_if.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_if.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/t_integration			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.88 src/tests/usr.bin/xlint/lint1/Makefile:1.89
--- src/tests/usr.bin/xlint/lint1/Makefile:1.88	Tue Jul 13 19:38:10 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Wed Jul 14 20:39:13 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.88 2021/07/13 19:38:10 rillig Exp $
+# $NetBSD: Makefile,v 1.89 2021/07/14 20:39:13 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -146,6 +146,8 @@ FILES+=		gcc_bit_field_types.c
 FILES+=		gcc_bit_field_types.exp
 FILES+=		gcc_init_compound_literal.c
 FILES+=		gcc_init_compound_literal.exp
+FILES+=		gcc_stmt_asm.c
+FILES+=		gcc_stmt_asm.exp
 FILES+=		gcc_typeof_after_statement.c
 FILES+=		gcc_typeof_after_statement.exp
 FILES+=		init.c
@@ -188,6 +190,8 @@ FILES+=		op_shl_lp64.c
 FILES+=		op_shl_lp64.exp
 FILES+=		stmt_for.c
 FILES+=		stmt_for.exp
+FILES+=		stmt_goto.c
+FILES+=		stmt_goto.exp
 FILES+=		stmt_if.c
 FILES+=		stmt_if.exp
 

Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.4 src/tests/usr.bin/xlint/lint1/decl.c:1.5
--- src/tests/usr.bin/xlint/lint1/decl.c:1.4	Sun Jul 11 15:07:39 2021
+++ 

CVS commit: src/usr.sbin/sysinst

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 18:56:05 UTC 2021

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
When converting partitions from one scheme to another, never fail
without providing (if requested) a proper error message.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.sbin/sysinst/disks.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/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.72 src/usr.sbin/sysinst/disks.c:1.73
--- src/usr.sbin/sysinst/disks.c:1.72	Sun Jan 31 22:45:46 2021
+++ src/usr.sbin/sysinst/disks.c	Wed Jul 14 18:56:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.72 2021/01/31 22:45:46 rillig Exp $ */
+/*	$NetBSD: disks.c,v 1.73 2021/07/14 18:56:05 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -754,17 +754,23 @@ convert_scheme(struct pm_devs *p, bool i
 	new_scheme = select_part_scheme(p, old_parts->pscheme,
 	false, MSG_select_other_partscheme);
 
-	if (new_scheme == NULL)
+	if (new_scheme == NULL) {
+		if (err_msg)
+			*err_msg = INTERNAL_ERROR;
 		return false;
+	}
 
 	new_parts = new_scheme->create_new_for_disk(p->diskdev,
 	0, p->dlsize, is_boot_drive, NULL);
-	if (new_parts == NULL)
+	if (new_parts == NULL) {
+		if (err_msg)
+			*err_msg = MSG_out_of_memory;
 		return false;
+	}
 
 	convert_copy(old_parts, new_parts);
 
-	if (new_parts->num_part == 0) {
+	if (new_parts->num_part == 0 && old_parts->num_part != 0) {
 		/* need to cleanup */
 		new_parts->pscheme->free(new_parts);
 		return false;



CVS commit: [netbsd-9] src/doc

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 18:05:25 UTC 2021

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

Log Message:
Tickets #1322 and #1323


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.16 src/doc/CHANGES-9.3:1.1.2.17
--- src/doc/CHANGES-9.3:1.1.2.16	Fri Jul  9 17:53:05 2021
+++ src/doc/CHANGES-9.3	Wed Jul 14 18:05:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.3,v 1.1.2.16 2021/07/09 17:53:05 martin Exp $
+# $NetBSD: CHANGES-9.3,v 1.1.2.17 2021/07/14 18:05:25 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -354,3 +354,25 @@ sys/rump/librump/rumpvfs/vm_vfs.c		(appl
 	Adapt the uvm pageout changes to the branch.
 	[chs, ticket #1321]
 
+sys/arch/hppa/dev/sti_sgc.c			1.3
+
+	PR 52162: Fix silent freeze on probing sti(4) framebuffer on 712/60.
+	[tsutsui, ticket #1322]
+
+etc/etc.hp300/MAKEDEV.conf			1.15
+sys/arch/hp300/dev/ct.c1.62,1.63
+sys/arch/hp300/dev/ctreg.h			1.11
+sys/arch/hp300/dev/hpib.c			1.43 (patch)
+sys/arch/hp300/dev/hpibvar.h			1.22-1.24
+sys/arch/hp300/dev/mt.c1.55
+sys/arch/hp300/dev/rd.c1.103-1.109
+sys/arch/hp300/dev/rdreg.h			1.14-1.17
+sys/arch/hp300/dev/rdvar.h			1.24-1.26
+sys/arch/hp300/stand/Makefile.buildboot		1.37
+sys/arch/hp300/stand/common/ct.c		1.8
+sys/arch/hp300/stand/common/hpibvar.h		1.6
+sys/arch/hp300/stand/common/rd.c		1.11
+
+	hp300: various rd(4) improvements.
+	[tsutsui, ticket #1323]
+



CVS commit: [netbsd-9] src

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 18:04:05 UTC 2021

Modified Files:
src/etc/etc.hp300 [netbsd-9]: MAKEDEV.conf
src/sys/arch/hp300/dev [netbsd-9]: ct.c ctreg.h hpib.c hpibvar.h mt.c
rd.c rdreg.h rdvar.h
src/sys/arch/hp300/stand [netbsd-9]: Makefile.buildboot
src/sys/arch/hp300/stand/common [netbsd-9]: ct.c hpibvar.h rd.c

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

sys/arch/hp300/dev/rd.c: revision 1.109
sys/arch/hp300/stand/Makefile.buildboot: revision 1.37
sys/arch/hp300/stand/common/ct.c: revision 1.8
sys/arch/hp300/dev/hpibvar.h: revision 1.22
sys/arch/hp300/dev/ct.c: revision 1.62
sys/arch/hp300/dev/hpibvar.h: revision 1.23
sys/arch/hp300/dev/ct.c: revision 1.63
sys/arch/hp300/dev/hpibvar.h: revision 1.24
sys/arch/hp300/dev/mt.c: revision 1.55
sys/arch/hp300/dev/rdreg.h: revision 1.14
sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch)
sys/arch/hp300/dev/rdreg.h: revision 1.15
sys/arch/hp300/dev/rdreg.h: revision 1.16
sys/arch/hp300/dev/rdreg.h: revision 1.17
etc/etc.hp300/MAKEDEV.conf: revision 1.15
sys/arch/hp300/stand/common/hpibvar.h: revision 1.6
sys/arch/hp300/stand/common/rd.c: revision 1.11
sys/arch/hp300/dev/ctreg.h: revision 1.11
sys/arch/hp300/dev/rdvar.h: revision 1.24
sys/arch/hp300/dev/rdvar.h: revision 1.25
sys/arch/hp300/dev/rdvar.h: revision 1.26
sys/arch/hp300/dev/rd.c: revision 1.103
sys/arch/hp300/dev/rd.c: revision 1.104
sys/arch/hp300/dev/rd.c: revision 1.105
sys/arch/hp300/dev/rd.c: revision 1.106
sys/arch/hp300/dev/rd.c: revision 1.107
sys/arch/hp300/dev/rd.c: revision 1.108

Consistently use #define here.

Consistently use #define as rdreg.h.

No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.

Pull HP-IB probe fixes from OpenBSD/hp300.
https://marc.info/?l=openbsd-cvs=113217630426615=2

Overhaul the way HP-IB devices are probed. We will now do an exhaustive
probe of the (slave, punit) tuple space, since this is the only way we
can get a dual disk or dual tape enclosure to attach two devices of the
same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.

Move attach messages from common rdident() to explicit rdattach().

Cleanup duplicated CS/80 indentify structures.  From OpenBSD.
https://marc.info/?l=openbsd-cvs=113227249626888=2

Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for
its size.
No functional change.
https://marc.info/?l=openbsd-cvs=113273001020159=2

Pick HP-IB describe structures changes from main kernel code here as well.

Add support of multiple rd(4) disks on all punits for HPDisk.

Special thanks to Anders Gustafsson, the author of "HPDisk"
(GPIB disk emulator) http://www.dalton.ax/hpdisk/
for providing bare boards and improving firmwares for NetBSD/hp300.

Specify -fno-unwind-tables to shrink binaries.

Before:
   textdata bss dec hex filename
  779024328  137120  219350   358d6 uboot

After:
   textdata bss dec hex filename
  641864328  137120  205634   32342 uboot

Create rd3 device nodes, for HPDisk.

Add Device and drive info of 2202A, 7908A, 7911A, and 7941A.

Geometries and description info are taken from hpdrive.ini.sample
in HPDrive.  Briefly tested on HPDisk.

Print rd(4) capacity and geometry info as sd(4) and wd(4) do.

Before:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block

After:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.32.1 src/etc/etc.hp300/MAKEDEV.conf
cvs rdiff -u -r1.61 -r1.61.32.1 src/sys/arch/hp300/dev/ct.c
cvs rdiff -u -r1.10 -r1.10.170.1 src/sys/arch/hp300/dev/ctreg.h
cvs rdiff -u -r1.39 -r1.39.42.1 src/sys/arch/hp300/dev/hpib.c
cvs rdiff -u -r1.21 -r1.21.42.1 src/sys/arch/hp300/dev/hpibvar.h
cvs rdiff -u -r1.54 -r1.54.32.1 src/sys/arch/hp300/dev/mt.c
cvs rdiff -u -r1.101 -r1.101.22.1 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.13 -r1.13.60.1 src/sys/arch/hp300/dev/rdreg.h
cvs rdiff -u -r1.23 -r1.23.22.1 src/sys/arch/hp300/dev/rdvar.h
cvs rdiff -u -r1.36 -r1.36.18.1 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.7 -r1.7.58.1 src/sys/arch/hp300/stand/common/ct.c
cvs rdiff -u -r1.5 -r1.5.154.1 src/sys/arch/hp300/stand/common/hpibvar.h
cvs rdiff -u -r1.10 -r1.10.58.1 src/sys/arch/hp300/stand/common/rd.c

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


CVS commit: [netbsd-8] src/doc

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 17:55:18 UTC 2021

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

Log Message:
Ticket #1689


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

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.93 src/doc/CHANGES-8.3:1.1.2.94
--- src/doc/CHANGES-8.3:1.1.2.93	Fri Jun 25 19:14:29 2021
+++ src/doc/CHANGES-8.3	Wed Jul 14 17:55:18 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.93 2021/06/25 19:14:29 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.94 2021/07/14 17:55:18 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1983,3 +1983,8 @@ distrib/sun3/miniroot/Makefile			1.50
 	- The modules and rescue sets are also required on upgrade.
 	[tsutsui, ticket #1686]
 
+sys/arch/hppa/dev/sti_sgc.c			1.3
+
+	PR 52162: Fix silent freeze on probing sti(4) framebuffer on 712/60.
+	[tsutsui, ticket #1689]
+



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

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 17:53:50 UTC 2021

Modified Files:
src/sys/arch/hppa/dev [netbsd-8]: sti_sgc.c

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

sys/arch/hppa/dev/sti_sgc.c: revision 1.3

Fix silent freeze on probing sti(4) framebuffer on 712/60.  PR/52162

Ok'ed by skrll@.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.28.1 src/sys/arch/hppa/dev/sti_sgc.c

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

Modified files:

Index: src/sys/arch/hppa/dev/sti_sgc.c
diff -u src/sys/arch/hppa/dev/sti_sgc.c:1.1 src/sys/arch/hppa/dev/sti_sgc.c:1.1.28.1
--- src/sys/arch/hppa/dev/sti_sgc.c:1.1	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/dev/sti_sgc.c	Wed Jul 14 17:53:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti_sgc.c,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: sti_sgc.c,v 1.1.28.1 2021/07/14 17:53:50 martin Exp $	*/
 
 /*	$OpenBSD: sti_sgc.c,v 1.38 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.1 2014/02/24 07:23:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.1.28.1 2021/07/14 17:53:50 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -73,6 +73,16 @@ extern int stidebug;
 #define	STI_ROMSIZE	(sizeof(struct sti_dd) * 4)
 #define	STI_ID_FDDI	0x280b31af	/* Medusa FDDI ROM id */
 
+/*
+ * hpa addresses to check on-board variants
+ * XXX should check via device_register(9)?
+ * 
+ * 0xf400: HPA1991AC19 on 715/33, 715/50
+ * 0xf800: HPA1439A on 735/99, HPA208LCxxx on 715/80, 715/100, 712
+ */
+#define	STI_ONBOARD_HPA0	0xf400
+#define	STI_ONBOARD_HPA1	0xf800
+
 /* gecko optional graphics */
 #define	STI_GOPT1_REV	0x17
 #define	STI_GOPT2_REV	0x70
@@ -118,7 +128,9 @@ sti_sgc_getrom(struct confargs *ca)
 	rom = PAGE0->pd_resv2[1];
 	hppa_pagezero_unmap(pagezero_cookie);
 
-	if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC) {
+	if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC &&
+	ca->ca_hpa != STI_ONBOARD_HPA0 &&
+	ca->ca_hpa != STI_ONBOARD_HPA1) {
 		int i;
 		for (i = sizeof(sti_sgc_opt); i--; )
 			if (sti_sgc_opt[i] == ca->ca_type.iodc_revision)



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

2021-07-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 14 17:52:32 UTC 2021

Modified Files:
src/sys/arch/hppa/dev [netbsd-9]: sti_sgc.c

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

sys/arch/hppa/dev/sti_sgc.c: revision 1.3

Fix silent freeze on probing sti(4) framebuffer on 712/60.  PR/52162

Ok'ed by skrll@.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/arch/hppa/dev/sti_sgc.c

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

Modified files:

Index: src/sys/arch/hppa/dev/sti_sgc.c
diff -u src/sys/arch/hppa/dev/sti_sgc.c:1.2 src/sys/arch/hppa/dev/sti_sgc.c:1.2.4.1
--- src/sys/arch/hppa/dev/sti_sgc.c:1.2	Mon Apr 15 20:40:37 2019
+++ src/sys/arch/hppa/dev/sti_sgc.c	Wed Jul 14 17:52:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti_sgc.c,v 1.2 2019/04/15 20:40:37 skrll Exp $	*/
+/*	$NetBSD: sti_sgc.c,v 1.2.4.1 2021/07/14 17:52:31 martin Exp $	*/
 
 /*	$OpenBSD: sti_sgc.c,v 1.38 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.2 2019/04/15 20:40:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.2.4.1 2021/07/14 17:52:31 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -73,6 +73,16 @@ extern int stidebug;
 #define	STI_ROMSIZE	(sizeof(struct sti_dd) * 4)
 #define	STI_ID_FDDI	0x280b31af	/* Medusa FDDI ROM id */
 
+/*
+ * hpa addresses to check on-board variants
+ * XXX should check via device_register(9)?
+ * 
+ * 0xf400: HPA1991AC19 on 715/33, 715/50
+ * 0xf800: HPA1439A on 735/99, HPA208LCxxx on 715/80, 715/100, 712
+ */
+#define	STI_ONBOARD_HPA0	0xf400
+#define	STI_ONBOARD_HPA1	0xf800
+
 /* gecko optional graphics */
 #define	STI_GOPT1_REV	0x17
 #define	STI_GOPT2_REV	0x70
@@ -118,7 +128,9 @@ sti_sgc_getrom(struct confargs *ca)
 	rom = PAGE0->pd_resv2[1];
 	hppa_pagezero_unmap(pagezero_cookie);
 
-	if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC) {
+	if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC &&
+	ca->ca_hpa != STI_ONBOARD_HPA0 &&
+	ca->ca_hpa != STI_ONBOARD_HPA1) {
 		int i;
 		for (i = sizeof(sti_sgc_opt); i--; )
 			if (sti_sgc_opt[i] == ca->ca_type.iodc_revision)



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

2021-07-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 14 17:19:37 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: in the grammar, rename 'decl' to 'declarator'

For a casual reader, the abbreviation 'decl' was ambiguous since C has
both declarations and declarators.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.323 -r1.324 src/usr.bin/xlint/lint1/cgram.y

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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.323 src/usr.bin/xlint/lint1/cgram.y:1.324
--- src/usr.bin/xlint/lint1/cgram.y:1.323	Wed Jul 14 17:07:24 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 14 17:19:37 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.323 2021/07/14 17:07:24 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.324 2021/07/14 17:19:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.323 2021/07/14 17:07:24 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.324 2021/07/14 17:19:37 rillig Exp $");
 #endif
 
 #include 
@@ -309,10 +309,10 @@ anonymize(sym_t *s)
 %type			struct_declaration_list_with_rbrace
 %type			struct_declaration_list
 %type			struct_declaration
-%type			notype_member_decls
-%type			type_member_decls
-%type			notype_member_decl
-%type			type_member_decl
+%type			notype_struct_declarators
+%type			type_struct_declarators
+%type			notype_struct_declarator
+%type			type_struct_declarator
 %type		enum_specifier
 %type			enum_declaration
 %type			enums_with_opt_comma
@@ -323,14 +323,14 @@ anonymize(sym_t *s)
 %type		asterisk
 %type		type_qualifier_list_opt
 %type		type_qualifier_list
-%type			notype_decl
-%type			type_decl
-%type			notype_direct_decl
-%type			type_direct_decl
-%type			type_param_decl
-%type			notype_param_decl
-%type			direct_param_decl
-%type			direct_notype_param_decl
+%type			notype_declarator
+%type			type_declarator
+%type			notype_direct_declarator
+%type			type_direct_declarator
+%type			type_param_declarator
+%type			notype_param_declarator
+%type			direct_param_declarator
+%type			direct_notype_param_declarator
 %type			param_list
 %type		array_size
 %type			identifier_list
@@ -348,7 +348,7 @@ anonymize(sym_t *s)
 %type	 block_item_list
 %type	 block_item
 %type		do_while_expr
-%type			func_decl
+%type			func_declarator
 
 %%
 
@@ -726,7 +726,7 @@ declaration:			/* C99 6.7 */
 			warning(2);
 		}
 	  }
-	| begin_type_declmods end_type notype_init_decls T_SEMI
+	| begin_type_declmods end_type notype_init_declarators T_SEMI
 	| begin_type_declaration_specifiers end_type T_SEMI {
 		if (dcs->d_scl == TYPEDEF) {
 			/* typedef declares no type name */
@@ -736,7 +736,8 @@ declaration:			/* C99 6.7 */
 			warning(2);
 		}
 	  }
-	| begin_type_declaration_specifiers end_type type_init_decls T_SEMI
+	| begin_type_declaration_specifiers end_type
+	type_init_declarators T_SEMI
 	| error T_SEMI
 	;
 
@@ -951,13 +952,13 @@ struct_declaration:		/* C99 6.7.2.1 */
 	  begin_type_noclass_declmods end_type {
 		/* too late, i know, but getsym() compensates it */
 		symtyp = FMEMBER;
-	  } notype_member_decls type_attribute_opt {
+	  } notype_struct_declarators type_attribute_opt {
 		symtyp = FVFT;
 		$$ = $4;
 	  }
 	| begin_type_noclass_declspecs end_type {
 		symtyp = FMEMBER;
-	  } type_member_decls type_attribute_opt {
+	  } type_struct_declarators type_attribute_opt {
 		symtyp = FVFT;
 		$$ = $4;
 	  }
@@ -987,32 +988,31 @@ struct_declaration:		/* C99 6.7.2.1 */
 	  }
 	;
 
-/* TODO: rename 'decls' to 'declarators', everywhere. */
-notype_member_decls:
-	  notype_member_decl {
+notype_struct_declarators:
+	  notype_struct_declarator {
 		$$ = declarator_1_struct_union($1);
 	  }
-	| notype_member_decls {
+	| notype_struct_declarators {
 		symtyp = FMEMBER;
-	  } T_COMMA type_member_decl {
+	  } T_COMMA type_struct_declarator {
 		$$ = lnklst($1, declarator_1_struct_union($4));
 	  }
 	;
 
-type_member_decls:
-	  type_member_decl {
+type_struct_declarators:
+	  type_struct_declarator {
 		$$ = declarator_1_struct_union($1);
 	  }
-	| type_member_decls {
+	| type_struct_declarators {
 		symtyp = FMEMBER;
-	  } T_COMMA type_member_decl {
+	  } T_COMMA type_struct_declarator {
 		$$ = lnklst($1, declarator_1_struct_union($4));
 	  }
 	;
 
-notype_member_decl:
-	  notype_decl
-	| notype_decl T_COLON constant_expr {		/* C99 6.7.2.1 */
+notype_struct_declarator:
+	  notype_declarator
+	| notype_declarator T_COLON constant_expr {		/* C99 6.7.2.1 */
 		$$ = bitfield($1, to_int_constant($3, true));
 	  }
 	| {
@@ -1022,9 +1022,9 @@ notype_member_decl:
 	  }
 	;
 
-type_member_decl:
-	  type_decl
-	| type_decl T_COLON constant_expr {
+type_struct_declarator:
+	  type_declarator
+	| type_declarator T_COLON constant_expr {
 		$$ = 

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

2021-07-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 14 17:07:24 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h tree.c

Log Message:
lint: extract build_member_access from the grammar

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.313 -r1.314 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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.322 src/usr.bin/xlint/lint1/cgram.y:1.323
--- src/usr.bin/xlint/lint1/cgram.y:1.322	Wed Jul 14 16:59:39 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 14 17:07:24 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.322 2021/07/14 16:59:39 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.323 2021/07/14 17:07:24 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.322 2021/07/14 16:59:39 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.323 2021/07/14 17:07:24 rillig Exp $");
 #endif
 
 #include 
@@ -478,24 +478,7 @@ postfix_expression:
 		$$ = new_function_call_node($1, $3);
 	  }
 	| postfix_expression point_or_arrow T_NAME {
-		if ($1 != NULL) {
-			sym_t	*msym;
-			/*
-			 * XXX struct_or_union_member should be integrated
-			 * in build()
-			 */
-			if ($2 == ARROW) {
-/*
- * must do this before struct_or_union_member
- * is called
- */
-$1 = cconv($1);
-			}
-			msym = struct_or_union_member($1, $2, getsym($3));
-			$$ = build($2, $1, new_name_node(msym, 0));
-		} else {
-			$$ = NULL;
-		}
+		$$ = build_member_access($1, $2, $3);
 	  }
 	| postfix_expression T_INCDEC {
 		$$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL);

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.116 src/usr.bin/xlint/lint1/externs1.h:1.117
--- src/usr.bin/xlint/lint1/externs1.h:1.116	Sat Jul 10 17:35:54 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Wed Jul 14 17:07:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.116 2021/07/10 17:35:54 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.117 2021/07/14 17:07:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -212,6 +212,7 @@ extern	tnode_t	*build_generic_selection(
 		struct generic_association *);
 
 extern	tnode_t	*build(op_t, tnode_t *, tnode_t *);
+extern	tnode_t	*build_member_access(tnode_t *, op_t, sbuf_t *);
 extern	tnode_t	*cconv(tnode_t *);
 extern	bool	is_typeok_bool_operand(const tnode_t *);
 extern	bool	typeok(op_t, int, const tnode_t *, const tnode_t *);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.313 src/usr.bin/xlint/lint1/tree.c:1.314
--- src/usr.bin/xlint/lint1/tree.c:1.313	Tue Jul  6 04:44:20 2021
+++ src/usr.bin/xlint/lint1/tree.c	Wed Jul 14 17:07:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.313 2021/07/06 04:44:20 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.314 2021/07/14 17:07:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.313 2021/07/06 04:44:20 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.314 2021/07/14 17:07:24 rillig Exp $");
 #endif
 
 #include 
@@ -687,6 +687,22 @@ build(op_t op, tnode_t *ln, tnode_t *rn)
 	return ntn;
 }
 
+tnode_t *
+build_member_access(tnode_t *ln, op_t op, sbuf_t *member)
+{
+	sym_t	*msym;
+
+	if (ln == NULL)
+		return NULL;
+
+	if (op == ARROW) {
+		/* must do this before struct_or_union_member is called */
+		ln = cconv(ln);
+	}
+	msym = struct_or_union_member(ln, op, getsym(member));
+	return build(op, ln, new_name_node(msym, 0));
+}
+
 /*
  * Perform class conversions.
  *



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

2021-07-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 14 16:59:39 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: rename grammar rule 'expr' to 'expression'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/usr.bin/xlint/lint1/cgram.y

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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.321 src/usr.bin/xlint/lint1/cgram.y:1.322
--- src/usr.bin/xlint/lint1/cgram.y:1.321	Wed Jul 14 16:51:57 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 14 16:59:39 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.321 2021/07/14 16:51:57 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.322 2021/07/14 16:59:39 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.321 2021/07/14 16:51:57 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.322 2021/07/14 16:59:39 rillig Exp $");
 #endif
 
 #include 
@@ -295,8 +295,8 @@ anonymize(sym_t *s)
 %type		argument_expression_list
 %type		unary_expression
 %type		cast_expression
-%type		expr_opt
-%type		expr
+%type		expression_opt
+%type		expression
 %type		assignment_expression
 %type		constant_expr
 
@@ -419,7 +419,7 @@ primary_expression:
 	| string {
 		$$ = new_string_node($1);
 	  }
-	| T_LPAREN expr T_RPAREN {
+	| T_LPAREN expression T_RPAREN {
 		if ($2 != NULL)
 			$2->tn_parenthesized = true;
 		$$ = $2;
@@ -468,7 +468,7 @@ generic_association:
 /* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */
 postfix_expression:
 	  primary_expression
-	| postfix_expression T_LBRACK expr T_RBRACK {
+	| postfix_expression T_LBRACK expression T_RBRACK {
 		$$ = build(INDIR, build(PLUS, $1, $3), NULL);
 	  }
 	| postfix_expression T_LPAREN T_RPAREN {
@@ -551,7 +551,7 @@ gcc_statement_expr_item:
 		$$ = expr_zalloc_tnode();
 		$$->tn_type = gettyp(VOID);
 	  }
-	| expr T_SEMI {
+	| expression T_SEMI {
 		if ($1 == NULL) {	/* in case of syntax errors */
 			$$ = expr_zalloc_tnode();
 			$$->tn_type = gettyp(VOID);
@@ -579,10 +579,10 @@ point_or_arrow:			/* helper for 'postfix
 
 /* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */
 argument_expression_list:
-	  expr %prec T_COMMA {
+	  expression %prec T_COMMA {
 		$$ = new_function_argument_node(NULL, $1);
 	  }
-	| argument_expression_list T_COMMA expr {
+	| argument_expression_list T_COMMA expression {
 		$$ = new_function_argument_node($1, $3);
 	  }
 	;
@@ -645,11 +645,11 @@ cast_expression:
 	  }
 	;
 
-expr_opt:
+expression_opt:
 	  /* empty */ {
 		$$ = NULL;
 	  }
-	| expr
+	| expression
 	;
 
 /* 'expression' also implements 'multiplicative_expression'. */
@@ -664,52 +664,51 @@ expr_opt:
 /* 'expression' also implements 'logical_OR_expression'. */
 /* 'expression' also implements 'conditional_expression'. */
 /* 'expression' also implements 'assignment_expression'. */
-/* TODO: rename to 'expression' */
 /* K ???, C90 ???, C99 6.5.5 to 6.5.17, C11 ??? */
-expr:
-	  expr T_ASTERISK expr {
+expression:
+	  expression T_ASTERISK expression {
 		$$ = build(MULT, $1, $3);
 	  }
-	| expr T_MULTIPLICATIVE expr {
+	| expression T_MULTIPLICATIVE expression {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_ADDITIVE expr {
+	| expression T_ADDITIVE expression {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_SHIFT expr {
+	| expression T_SHIFT expression {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_RELATIONAL expr {
+	| expression T_RELATIONAL expression {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_EQUALITY expr {
+	| expression T_EQUALITY expression {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_AMPER expr {
+	| expression T_AMPER expression {
 		$$ = build(BITAND, $1, $3);
 	  }
-	| expr T_BITXOR expr {
+	| expression T_BITXOR expression {
 		$$ = build(BITXOR, $1, $3);
 	  }
-	| expr T_BITOR expr {
+	| expression T_BITOR expression {
 		$$ = build(BITOR, $1, $3);
 	  }
-	| expr T_LOGAND expr {
+	| expression T_LOGAND expression {
 		$$ = build(LOGAND, $1, $3);
 	  }
-	| expr T_LOGOR expr {
+	| expression T_LOGOR expression {
 		$$ = build(LOGOR, $1, $3);
 	  }
-	| expr T_QUEST expr T_COLON expr {
+	| expression T_QUEST expression T_COLON expression {
 		$$ = build(QUEST, $1, build(COLON, $3, $5));
 	  }
-	| expr T_ASSIGN expr {
+	| expression T_ASSIGN expression {
 		$$ = build(ASSIGN, $1, $3);
 	  }
-	| expr T_OPASSIGN expr {
+	| expression T_OPASSIGN expression {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_COMMA expr {
+	| expression T_COMMA expression {
 		$$ = build(COMMA, $1, $3);
 	  }
 	| cast_expression
@@ -717,7 +716,7 @@ expr:
 
 /* K ???, C90 ???, C99 6.5.16, C11 ??? */
 assignment_expression:
-	  expr %prec T_ASSIGN
+	  expression %prec T_ASSIGN
 	;
 
 constant_expr_list_opt:		/* helper for gcc_attribute */
@@ -731,7 +730,7 @@ constant_expr_list:		/* helper for gcc_a
 	;
 
 

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

2021-07-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 14 16:51:57 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: remove references to C18

The standard is called C17, not C18, and furthermore the section
numbering didn't change between C11 and C17.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.320 -r1.321 src/usr.bin/xlint/lint1/cgram.y

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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.320 src/usr.bin/xlint/lint1/cgram.y:1.321
--- src/usr.bin/xlint/lint1/cgram.y:1.320	Mon Jul 12 22:02:44 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 14 16:51:57 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.320 2021/07/12 22:02:44 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.321 2021/07/14 16:51:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.320 2021/07/12 22:02:44 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.321 2021/07/14 16:51:57 rillig Exp $");
 #endif
 
 #include 
@@ -371,7 +371,7 @@ identifier_sym:			/* helper for struct/u
 	  }
 	;
 
-/* K ???, C90 ???, C99 6.4.2.1, C11 ???, C18 ??? */
+/* K ???, C90 ???, C99 6.4.2.1, C11 ??? */
 identifier:
 	  T_NAME {
 		$$ = $1;
@@ -405,7 +405,7 @@ string2:
 	  }
 	;
 
-/* K 7.1, C90 ???, C99 6.5.1, C11 6.5.1, C18 6.5.1 */
+/* K 7.1, C90 ???, C99 6.5.1, C11 6.5.1 */
 primary_expression:
 	  T_NAME {
 		/* XXX really necessary? */
@@ -432,7 +432,7 @@ primary_expression:
 	  }
 	;
 
-/* K ---, C90 ---, C99 ---, C11 6.5.1.1, C18 6.5.1.1 */
+/* K ---, C90 ---, C99 ---, C11 6.5.1.1 */
 generic_selection:
 	  T_GENERIC T_LPAREN assignment_expression T_COMMA
 	generic_assoc_list T_RPAREN {
@@ -442,7 +442,7 @@ generic_selection:
 	  }
 	;
 
-/* K ---, C90 ---, C99 ---, C11 6.5.1.1, C18 6.5.1.1 */
+/* K ---, C90 ---, C99 ---, C11 6.5.1.1 */
 generic_assoc_list:
 	  generic_association
 	| generic_assoc_list T_COMMA generic_association {
@@ -451,7 +451,7 @@ generic_assoc_list:
 	  }
 	;
 
-/* K ---, C90 ---, C99 ---, C11 6.5.1.1, C18 6.5.1.1 */
+/* K ---, C90 ---, C99 ---, C11 6.5.1.1 */
 generic_association:
 	  type_name T_COLON assignment_expression {
 		$$ = getblk(sizeof(*$$));
@@ -465,7 +465,7 @@ generic_association:
 	  }
 	;
 
-/* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2, C18 6.5.2 */
+/* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */
 postfix_expression:
 	  primary_expression
 	| postfix_expression T_LBRACK expr T_RBRACK {
@@ -577,7 +577,7 @@ point_or_arrow:			/* helper for 'postfix
 	  }
 	;
 
-/* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2, C18 6.5.2 */
+/* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */
 argument_expression_list:
 	  expr %prec T_COMMA {
 		$$ = new_function_argument_node(NULL, $1);
@@ -587,7 +587,7 @@ argument_expression_list:
 	  }
 	;
 
-/* K 7.2, C90 ???, C99 6.5.3, C11 6.5.3, C18 6.5.3 */
+/* K 7.2, C90 ???, C99 6.5.3, C11 6.5.3 */
 unary_expression:
 	  postfix_expression
 	| T_INCDEC unary_expression {
@@ -629,7 +629,7 @@ unary_expression:
 	| T_SIZEOF T_LPAREN type_name T_RPAREN {
 		$$ = build_sizeof($3);
 	  }
-	/* K ---, C90 ---, C99 ---, C11 6.5.3, C18 6.5.3 */
+	/* K ---, C90 ---, C99 ---, C11 6.5.3 */
 	| T_ALIGNOF T_LPAREN type_name T_RPAREN {
 		$$ = build_alignof($3);
 	  }
@@ -637,7 +637,7 @@ unary_expression:
 
 /* The rule 'unary_operator' is inlined into unary_expression. */
 
-/* K 7.2, C90 ???, C99 6.5.4, C11 6.5.4, C18 6.5.4 */
+/* K 7.2, C90 ???, C99 6.5.4, C11 6.5.4 */
 cast_expression:
 	  unary_expression
 	| T_LPAREN type_name T_RPAREN cast_expression {
@@ -665,7 +665,7 @@ expr_opt:
 /* 'expression' also implements 'conditional_expression'. */
 /* 'expression' also implements 'assignment_expression'. */
 /* TODO: rename to 'expression' */
-/* K ???, C90 ???, C99 6.5.5 to 6.5.17, C11 ???, C18 ??? */
+/* K ???, C90 ???, C99 6.5.5 to 6.5.17, C11 ??? */
 expr:
 	  expr T_ASTERISK expr {
 		$$ = build(MULT, $1, $3);
@@ -715,7 +715,7 @@ expr:
 	| cast_expression
 	;
 
-/* K ???, C90 ???, C99 6.5.16, C11 ???, C18 ??? */
+/* K ???, C90 ???, C99 6.5.16, C11 ??? */
 assignment_expression:
 	  expr %prec T_ASSIGN
 	;



CVS commit: src/sys/arch

2021-07-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 14 13:32:37 UTC 2021

Modified Files:
src/sys/arch/cobalt/conf: std.cobalt
src/sys/arch/pmax/conf: std.pmax std.pmax64

Log Message:
Enable VMSWAP_DEFAULT_PLAINTEXT as default.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/cobalt/conf/std.cobalt
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/pmax/conf/std.pmax
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/pmax/conf/std.pmax64

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/cobalt/conf/std.cobalt
diff -u src/sys/arch/cobalt/conf/std.cobalt:1.15 src/sys/arch/cobalt/conf/std.cobalt:1.16
--- src/sys/arch/cobalt/conf/std.cobalt:1.15	Sun Feb 20 07:54:10 2011
+++ src/sys/arch/cobalt/conf/std.cobalt	Wed Jul 14 13:32:37 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.cobalt,v 1.15 2011/02/20 07:54:10 matt Exp $
+#	$NetBSD: std.cobalt,v 1.16 2021/07/14 13:32:37 thorpej Exp $
 
 machine cobalt mips
 include		"conf/std"	# MI standard options
@@ -9,4 +9,7 @@ options 	MIPS3_ENABLE_CLOCK_INTR
 options 	EXEC_ELF32	# exec ELF32 binaries
 options 	EXEC_SCRIPT	# exec #! scripts
 
+options		VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)
+
 makeoptions	DEFTEXTADDR="0x80001000"

Index: src/sys/arch/pmax/conf/std.pmax
diff -u src/sys/arch/pmax/conf/std.pmax:1.18 src/sys/arch/pmax/conf/std.pmax:1.19
--- src/sys/arch/pmax/conf/std.pmax:1.18	Sun Dec 11 12:18:36 2005
+++ src/sys/arch/pmax/conf/std.pmax	Wed Jul 14 13:32:37 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.pmax,v 1.18 2005/12/11 12:18:36 christos Exp $
+#	$NetBSD: std.pmax,v 1.19 2021/07/14 13:32:37 thorpej Exp $
 # standard, required pmax info
 
 machine pmax mips
@@ -9,4 +9,7 @@ makeoptions	MACHINE_ARCH="mipsel"
 options 	EXEC_ELF32	# 32-bit ELF support (native format)
 options 	EXEC_SCRIPT	# exec of #! scripts
 
+options		VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)
+
 makeoptions	DEFTEXTADDR="0x8003"

Index: src/sys/arch/pmax/conf/std.pmax64
diff -u src/sys/arch/pmax/conf/std.pmax64:1.2 src/sys/arch/pmax/conf/std.pmax64:1.3
--- src/sys/arch/pmax/conf/std.pmax64:1.2	Mon Dec 14 00:46:10 2009
+++ src/sys/arch/pmax/conf/std.pmax64	Wed Jul 14 13:32:37 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.pmax64,v 1.2 2009/12/14 00:46:10 matt Exp $
+#	$NetBSD: std.pmax64,v 1.3 2021/07/14 13:32:37 thorpej Exp $
 # standard, required pmax info
 
 machine pmax mips
@@ -11,5 +11,8 @@ options 	EXEC_ELF32	# 32-bit ELF support
 options 	EXEC_SCRIPT	# exec of #! scripts
 options 	COMPAT_NETBSD32	# exec NetBSD 32-bit binaries
 
+options		VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)
+
 makeoptions	DEFTEXTADDR="0x8003"
 makeoptions	LP64="yes"



CVS commit: src/sys/arch

2021-07-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 14 13:28:40 UTC 2021

Modified Files:
src/sys/arch/alpha/conf: std.alpha
src/sys/arch/shark/conf: std.ofwgencfg std.shark

Log Message:
Enable VMSWAP_DEFAULT_PLAINTEXT as default.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/conf/std.alpha
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/shark/conf/std.ofwgencfg
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/shark/conf/std.shark

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/alpha/conf/std.alpha
diff -u src/sys/arch/alpha/conf/std.alpha:1.27 src/sys/arch/alpha/conf/std.alpha:1.28
--- src/sys/arch/alpha/conf/std.alpha:1.27	Sat Sep 19 03:27:42 2020
+++ src/sys/arch/alpha/conf/std.alpha	Wed Jul 14 13:28:40 2021
@@ -1,4 +1,4 @@
-# $NetBSD: std.alpha,v 1.27 2020/09/19 03:27:42 thorpej Exp $
+# $NetBSD: std.alpha,v 1.28 2021/07/14 13:28:40 thorpej Exp $
 #
 # Standard/required configuration info for NetBSD/alpha.
 
@@ -15,5 +15,9 @@ options 	EXEC_SCRIPT	# shell script supp
 
 options 	MULTIPROCESSOR		# include multiprocessor support
 
+# Don't encrypt swap by default.  The systems most likely to heavily use
+# swap space have slow CPUs by modern standards.
+options		VMSWAP_DEFAULT_PLAINTEXT
+
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"

Index: src/sys/arch/shark/conf/std.ofwgencfg
diff -u src/sys/arch/shark/conf/std.ofwgencfg:1.1 src/sys/arch/shark/conf/std.ofwgencfg:1.2
--- src/sys/arch/shark/conf/std.ofwgencfg:1.1	Sun Feb 10 01:57:04 2002
+++ src/sys/arch/shark/conf/std.ofwgencfg	Wed Jul 14 13:28:40 2021
@@ -1,7 +1,10 @@
-#	$NetBSD: std.ofwgencfg,v 1.1 2002/02/10 01:57:04 thorpej Exp $
+#	$NetBSD: std.ofwgencfg,v 1.2 2021/07/14 13:28:40 thorpej Exp $
 #
 # Configuration options for generic OpenFirmware configurations.
 #
 
+options		VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)
+
 # Pull in OFWGENCFG config definitions.
 include "arch/arm/ofw/files.ofwgencfg"

Index: src/sys/arch/shark/conf/std.shark
diff -u src/sys/arch/shark/conf/std.shark:1.11 src/sys/arch/shark/conf/std.shark:1.12
--- src/sys/arch/shark/conf/std.shark:1.11	Wed Jan 17 20:30:17 2018
+++ src/sys/arch/shark/conf/std.shark	Wed Jul 14 13:28:40 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.shark,v 1.11 2018/01/17 20:30:17 skrll Exp $
+#	$NetBSD: std.shark,v 1.12 2021/07/14 13:28:40 thorpej Exp $
 #
 # standard NetBSD/shark options
 
@@ -10,6 +10,9 @@ options 	EXEC_AOUT
 options 	EXEC_ELF32
 options 	EXEC_SCRIPT
 
+options		VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)
+
 # To support easy transit to ../arch/arm/arm32
 options 	ARM32
 options 	_ARM32_NEED_BUS_DMA_BOUNCE



CVS commit: src/external/gpl3/gcc/dist/gcc/ginclude

2021-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 14 13:24:59 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/ginclude: stddef.h

Log Message:
clang does not support __float128 in our configuration and i386


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h
diff -u src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h:1.9 src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h:1.10
--- src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h:1.9	Sat Apr 10 20:02:17 2021
+++ src/external/gpl3/gcc/dist/gcc/ginclude/stddef.h	Wed Jul 14 09:24:58 2021
@@ -420,7 +420,7 @@ typedef struct {
  use __float128 here; that is only available on some
  architectures, but only on i386 is extra alignment needed for
  __float128.  */
-#ifdef __i386__
+#if defined(__i386__) && !defined(__clang__)
   __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128;
 #endif
 } max_align_t;



CVS commit: src/usr.sbin/npf/npfctl

2021-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 14 09:15:01 UTC 2021

Modified Files:
src/usr.sbin/npf/npfctl: npfctl.c

Log Message:
PR/56307: Konrad Schroder: npfctl's error messages don't report the failing
filename.
Add the filename (but in quotes for consistency with other places in the file).
Also fix an err -> errx


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/npf/npfctl/npfctl.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/npf/npfctl/npfctl.c
diff -u src/usr.sbin/npf/npfctl/npfctl.c:1.64 src/usr.sbin/npf/npfctl/npfctl.c:1.65
--- src/usr.sbin/npf/npfctl/npfctl.c:1.64	Sat May 30 10:16:56 2020
+++ src/usr.sbin/npf/npfctl/npfctl.c	Wed Jul 14 05:15:01 2021
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npfctl.c,v 1.64 2020/05/30 14:16:56 rmind Exp $");
+__RCSID("$NetBSD: npfctl.c,v 1.65 2021/07/14 09:15:01 christos Exp $");
 
 #include 
 #include 
@@ -301,17 +301,18 @@ npfctl_import(const char *path)
 	 * just leaving this responsibility for the caller.
 	 */
 	if ((fd = open(path, O_RDONLY)) == -1) {
-		err(EXIT_FAILURE, "could not open `%s'", path);
+		err(EXIT_FAILURE, "open: '%s'", path);
 	}
 	if (fstat(fd, ) == -1) {
-		err(EXIT_FAILURE, "stat");
+		err(EXIT_FAILURE, "stat: '%s'", path);
 	}
 	if ((blen = sb.st_size) == 0) {
-		err(EXIT_FAILURE, "the binary configuration file is empty");
+		errx(EXIT_FAILURE,
+		"the binary configuration file '%s' is empty", path);
 	}
 	blob = mmap(NULL, blen, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0);
 	if (blob == MAP_FAILED) {
-		err(EXIT_FAILURE, "mmap");
+		err(EXIT_FAILURE, "mmap: '%s'", path);
 	}
 	ncf = npf_config_import(blob, blen);
 	munmap(blob, blen);
@@ -329,7 +330,7 @@ npfctl_load(int fd)
 	 */
 	ncf = npfctl_import(NPF_DB_PATH);
 	if (ncf == NULL) {
-		err(EXIT_FAILURE, "npf_config_import");
+		err(EXIT_FAILURE, "npf_config_import: '%s'", NPF_DB_PATH);
 	}
 	if ((errno = npf_config_submit(ncf, fd, )) != 0) {
 		npfctl_print_error();
@@ -345,7 +346,7 @@ npfctl_open_dev(const char *path)
 	int fd;
 
 	if (lstat(path, ) == -1) {
-		err(EXIT_FAILURE, "fstat");
+		err(EXIT_FAILURE, "fstat: '%s'", path);
 	}
 	if ((st.st_mode & S_IFMT) == S_IFSOCK) {
 		struct sockaddr_un addr;
@@ -358,11 +359,11 @@ npfctl_open_dev(const char *path)
 		strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
 
 		if (connect(fd, (struct sockaddr *), sizeof(addr)) == -1) {
-			err(EXIT_FAILURE, "connect");
+			err(EXIT_FAILURE, "connect: '%s'", path);
 		}
 	} else {
 		if ((fd = open(path, O_RDONLY)) == -1) {
-			err(EXIT_FAILURE, "cannot open '%s'", path);
+			err(EXIT_FAILURE, "open: '%s'", path);
 		}
 	}
 	return fd;
@@ -416,7 +417,8 @@ npfctl_debug(int argc, char **argv)
 		puts("Loading the active configuration");
 		fd = npfctl_open_dev(NPF_DEV_PATH);
 		if ((ncf = npf_config_retrieve(fd)) == NULL) {
-			err(EXIT_FAILURE, "npf_config_retrieve");
+			err(EXIT_FAILURE, "npf_config_retrieve: '%s'",
+			NPF_DEV_PATH);
 		}
 	}
 



CVS commit: src/tests/net/if_vlan

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 08:51:51 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
vlan: Added missing $HIJACKING before brconfig


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.22 src/tests/net/if_vlan/t_vlan.sh:1.23
--- src/tests/net/if_vlan/t_vlan.sh:1.22	Wed Jul 14 08:50:24 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jul 14 08:51:51 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.23 2021/07/14 08:51:51 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -723,7 +723,7 @@ vlan_bridge_body_common()
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
 	$atf_brconfig bridge0 add vlan0
-	$DEBUG && brconfig bridge0
+	$DEBUG && $HIJACKING /sbin/brconfig bridge0
 	atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0
 	$atf_brconfig bridge0 delete vlan0
 
@@ -734,13 +734,13 @@ vlan_bridge_body_common()
 	$atf_ifconfig vlan0 mtu 1495
 	$atf_brconfig bridge0 add vlan0
 
-	$DEBUG && brconfig bridge0
+	$DEBUG && $HIJACKING /sbin/brconfig bridge0
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 	$atf_brconfig bridge0 delete vlan0
 
 	$atf_ifconfig bridge0 mtu 1497
 	atf_check -s not-exit:0 -o ignore -e ignore \
-	/sbin/brconfig bridge0 add vlan0
+	$HIJACKING /sbin/brconfig bridge0 add vlan0
 
 	#
 	# Destroy a vlan interface that is bridge member



CVS commit: src/tests/net/if_vlan

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 08:50:24 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Added tests for adding vlan(4) to a bridge and deleting from it

- add vlan(4) that has no parent interface to a bridge member
   - the vlan(4) cannot be added to a bridge member
- detach the parent interface of vlan(4) that is in a bridge member
   - vlan(4) is deleted from a bridge member at the detaching


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.21 src/tests/net/if_vlan/t_vlan.sh:1.22
--- src/tests/net/if_vlan/t_vlan.sh:1.21	Wed Jul 14 06:35:59 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jul 14 08:50:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -681,8 +681,6 @@ vlan_bridge_body_common()
 	$atf_ifconfig shmif0 up
 
 	$atf_ifconfig vlan0 create
-	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
-	$atf_ifconfig vlan0 up
 	$DEBUG && rump.ifconfig vlan0
 
 	$atf_ifconfig bridge0 create
@@ -692,16 +690,36 @@ vlan_bridge_body_common()
 	# Add vlan to bridge member
 	#
 	$atf_ifconfig bridge0 mtu 1496
+
+	# vlan0 can not add to bridge member
+	# because it is not an ethernet device
+	atf_check -s not-exit:0 -e match:'Invalid argument' \
+	$HIJACKING /sbin/brconfig bridge0 add vlan0
+
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan0 up
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
+	# vlan0 becomes an ethernet device
+	# after attaching the parent interface
 	$atf_brconfig bridge0 add vlan0
-	$DEBUG && brconfig bridge0
+	$DEBUG && $HIJACKING /sbin/brconfig bridge0
+
 	$atf_brconfig bridge0 delete vlan0
 
+	$atf_brconfig bridge0 add vlan0
+	$atf_ifconfig vlan0 -vlanif
+	atf_check -s exit:0 -o not-match:'vlan0' \
+	$HIJACKING /sbin/brconfig bridge0
+	atf_check -s not-exit:0 -e match:'No such' \
+	$HIJACKING /sbin/brconfig bridge0 delete vlan0
+
 	#
 	# decrease MTU on adding to bridge member
 	#
 	$atf_ifconfig bridge0 mtu 1495
+	$atf_ifconfig vlan0 vlan 10 vlanif shmif0
+	$atf_ifconfig vlan0 up
 	atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0
 
 	$atf_brconfig bridge0 add vlan0



CVS commit: src/tests/net/altq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:33:47 UTC 2021

Modified Files:
src/tests/net/altq: t_cbq.sh

Log Message:
tests, altq: test new options


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/altq/t_cbq.sh

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

Modified files:

Index: src/tests/net/altq/t_cbq.sh
diff -u src/tests/net/altq/t_cbq.sh:1.1 src/tests/net/altq/t_cbq.sh:1.2
--- src/tests/net/altq/t_cbq.sh:1.1	Wed Jul 14 03:22:33 2021
+++ src/tests/net/altq/t_cbq.sh	Wed Jul 14 08:33:47 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cbq.sh,v 1.1 2021/07/14 03:22:33 ozaki-r Exp $
+#	$NetBSD: t_cbq.sh,v 1.2 2021/07/14 08:33:47 ozaki-r Exp $
 #
 # Copyright (c) 2021 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -40,6 +40,7 @@ IP_LOCAL1=10.0.0.1
 IP_LOCAL2=10.0.1.1
 IP_REMOTE11=10.0.0.2
 IP_REMOTE12=10.0.0.22
+IP_REMOTE13=10.0.0.23
 IP_REMOTE21=10.0.1.2
 IP_REMOTE22=10.0.1.22
 ALTQD_PIDFILE=./pid
@@ -312,6 +313,118 @@ test_altq_cbq_multi_ifaces_ipv4()
 	rump_server_destroy_ifaces
 }
 
+start_altqd_options()
+{
+
+	export RUMP_SERVER=$SOCK_LOCAL
+
+	$HIJACKING_ALTQ mkdir -p /rump/etc
+	$HIJACKING_ALTQ mkdir -p /rump/var/run
+
+	# - no-tbr and no-control are specified
+	# - root_class is the default class
+	cat > ./altq.conf <<-EOF
+	interface shmif0 cbq no-tbr no-control
+	class cbq shmif0 root_class NULL pbandwidth 100 default
+	class cbq shmif0 normal_class root_class pbandwidth 50
+	filter shmif0 normal_class $IP_REMOTE11 0 0 0 0
+	class cbq shmif0 drop_class root_class pbandwidth 0
+	filter shmif0 drop_class $IP_REMOTE12 0 0 0 0
+	EOF
+	$DEBUG && cat ./altq.conf
+	atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf
+	$HIJACKING_ALTQ test -f /rump/etc/altq.conf
+
+	$HIJACKING_ALTQ altqd
+
+	$HIJACKING_ALTQ test -f /var/run/altqd.pid
+	if [ $? != 0 ]; then
+		atf_check -s exit:0 $HIJACKING_ALTQ altqd -d
+		# Should abort
+	fi
+
+	$HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE
+
+	$DEBUG && $HIJACKING_ALTQ altqstat -s
+	$HIJACKING_ALTQ altqstat -c 1 >./out
+	$DEBUG && cat ./out
+	atf_check -s exit:0 \
+	-o match:"altqstat: cbq on interface shmif0" \
+	-o match:'Class 1 on Interface shmif0: root_class' \
+	-o match:'Class 2 on Interface shmif0: normal_class' \
+	-o match:'Class 3 on Interface shmif0: drop_class' \
+	cat ./out
+	atf_check -s exit:0 -o not-match:'shmif0: ctl_class' cat ./out
+
+	rm -f ./out
+}
+
+test_altq_cbq_options_ipv4()
+{
+	local ifconfig="atf_check -s exit:0 rump.ifconfig"
+	local ping="atf_check -s exit:0 -o ignore rump.ping"
+	local opts="-q -c 1 -w 1"
+
+	rump_server_fs_start $SOCK_LOCAL local altq
+	rump_server_start $SOCK_REMOTE
+
+	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
+	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	$ifconfig shmif0 inet $IP_LOCAL1/24
+	export RUMP_SERVER=$SOCK_REMOTE
+	$ifconfig shmif0 inet $IP_REMOTE11/24
+	$ifconfig shmif0 inet $IP_REMOTE12/24 alias
+	$ifconfig shmif0 inet $IP_REMOTE13/24 alias
+	$ifconfig -w 10
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	# Invoke ARP
+	$ping $opts $IP_REMOTE11
+	$ping $opts $IP_REMOTE12
+	$ping $opts $IP_REMOTE13
+
+	start_altqd_options
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	$ping $opts $IP_REMOTE11
+
+	$HIJACKING_ALTQ altqstat -c 1 >./out
+	$DEBUG && cat ./out
+
+	check_counter ./out normal 'pkts: 1'
+	check_counter ./out root   'pkts: 1'
+	check_counter ./out drop   'pkts: 0'
+
+	atf_check -s not-exit:0 -o ignore -e match:"No buffer space available" \
+	rump.ping $opts $IP_REMOTE12
+
+	$HIJACKING_ALTQ altqstat -c 1 >./out
+	$DEBUG && cat ./out
+
+	check_counter ./out drop   'drops: 1'
+	check_counter ./out drop   'pkts: 0'
+	check_counter ./out normal 'pkts: 1'
+	check_counter ./out root   'pkts: 1'
+
+	# The packet goes to the default class
+	$ping $opts $IP_REMOTE13
+
+	$HIJACKING_ALTQ altqstat -c 1 >./out
+	$DEBUG && cat ./out
+
+	check_counter ./out drop   'pkts: 0'
+	check_counter ./out normal 'pkts: 1'
+	check_counter ./out root   'pkts: 2'
+
+	rm -f ./out
+
+	shutdown_altqd
+
+	rump_server_destroy_ifaces
+}
+
 add_test_case()
 {
 	local algo=$1
@@ -344,4 +457,5 @@ atf_init_test_cases()
 
 	add_test_case cbq basicipv4
 	add_test_case cbq multi_ifaces ipv4
+	add_test_case cbq options  ipv4
 }



CVS commit: src/usr.sbin/altq/libaltq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:33:05 UTC 2021

Modified Files:
src/usr.sbin/altq/libaltq: parser.c

Log Message:
libaltq: allow longer config lines


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/altq/libaltq/parser.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/altq/libaltq/parser.c
diff -u src/usr.sbin/altq/libaltq/parser.c:1.11 src/usr.sbin/altq/libaltq/parser.c:1.12
--- src/usr.sbin/altq/libaltq/parser.c:1.11	Tue Aug 16 12:49:13 2011
+++ src/usr.sbin/altq/libaltq/parser.c	Wed Jul 14 08:33:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.11 2011/08/16 12:49:13 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.12 2021/07/14 08:33:05 ozaki-r Exp $	*/
 /*	$KAME: parser.c,v 1.16 2002/02/20 10:40:39 kjc Exp $	*/
 /*
  * Copyright (C) 1999-2002
@@ -76,7 +76,7 @@ static int conditioner_parser(char *);
 static int tc_action_parser(char *, char **, struct tc_action *);
 
 #define MAX_LINE	1024
-#define MAX_WORD	64
+#define MAX_WORD	128
 #define MAX_ARGS	64
 #define MAX_ACTIONS	16
 



CVS commit: src/usr.sbin/altq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:32:13 UTC 2021

Modified Files:
src/usr.sbin/altq/altqd: altq.conf.5
src/usr.sbin/altq/libaltq: qop_cbq.c qop_cbq.h

Log Message:
libaltq, cbq: add two options to interface

- no-control: don't create a control class automatically
- no-tbr: don't install TBR


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/altq/altqd/altq.conf.5
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/altq/libaltq/qop_cbq.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/altq/libaltq/qop_cbq.h

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/altq/altqd/altq.conf.5
diff -u src/usr.sbin/altq/altqd/altq.conf.5:1.18 src/usr.sbin/altq/altqd/altq.conf.5:1.19
--- src/usr.sbin/altq/altqd/altq.conf.5:1.18	Tue Apr  9 19:10:21 2019
+++ src/usr.sbin/altq/altqd/altq.conf.5	Wed Jul 14 08:32:13 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: altq.conf.5,v 1.18 2019/04/09 19:10:21 sevan Exp $
+.\"	$NetBSD: altq.conf.5,v 1.19 2021/07/14 08:32:13 ozaki-r Exp $
 .\"	$KAME: altq.conf.5,v 1.15 2002/11/17 02:51:49 kjc Exp $
 .\"
 .\" Copyright (C) 2000
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 9, 2019
+.Dd July 14, 2021
 .Dt ALTQ.CONF 5
 .Os
 .\"
@@ -281,6 +281,8 @@ excess bandwidth is available.
 .Op Cm tbrsize Ar bytes
 .Op Ar sched_type
 .Op Cm efficient
+.Op Cm no-control
+.Op Cm no-tbr
 .El
 .Bl -tag -width 8n -offset indent
 .It Ar if_name
@@ -310,6 +312,13 @@ By default, this mode is turned off.
 By adding the keyword
 .Cm efficient
 to the interface specification line, enables this mode.
+.It Cm no-control
+By default, the control class is automatically created when default class is
+created and one doesn't exist yet.
+This option suppresses the behavior on the interface.
+.It Cm no-tbr
+By default, a token bucket regulator is automatically created on each interface.
+This option suppresses the behavior on the interface.
 .El
 .Bl -tag -width class -offset indent
 .It Cm class

Index: src/usr.sbin/altq/libaltq/qop_cbq.c
diff -u src/usr.sbin/altq/libaltq/qop_cbq.c:1.10 src/usr.sbin/altq/libaltq/qop_cbq.c:1.11
--- src/usr.sbin/altq/libaltq/qop_cbq.c:1.10	Sat Oct 19 17:16:37 2013
+++ src/usr.sbin/altq/libaltq/qop_cbq.c	Wed Jul 14 08:32:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: qop_cbq.c,v 1.10 2013/10/19 17:16:37 christos Exp $	*/
+/*	$NetBSD: qop_cbq.c,v 1.11 2021/07/14 08:32:13 ozaki-r Exp $	*/
 /*	$KAME: qop_cbq.c,v 1.7 2002/05/31 06:03:35 kjc Exp $	*/
 /*
  * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
@@ -112,6 +112,8 @@ cbq_interface_parser(const char *ifname,
 	u_int	tbrsize = 0;
 	u_int	is_efficient = 0;
 	u_int	is_wrr = 1;	/* weighted round-robin is default */
+	bool	no_control = false;
+	bool	no_tbr = false;
 
 	/*
 	 * process options
@@ -133,6 +135,10 @@ cbq_interface_parser(const char *ifname,
 			is_wrr = 1;
 		} else if (EQUAL(*argv, "cbq-prr")) {
 			is_wrr = 0;
+		} else if (EQUAL(*argv, "no-tbr")) {
+			no_tbr = true;
+		} else if (EQUAL(*argv, "no-control")) {
+			no_control = true;
 		} else {
 			LOG(LOG_ERR, 0, "Unknown keyword '%s'", *argv);
 			return (0);
@@ -140,12 +146,15 @@ cbq_interface_parser(const char *ifname,
 		argc--; argv++;
 	}
 
-	if (qcmd_tbr_register(ifname, bandwidth, tbrsize) != 0)
-		return (0);
+	if (!no_tbr) {
+		if (qcmd_tbr_register(ifname, bandwidth, tbrsize) != 0)
+			return (0);
+	}
 
 	if (qcmd_cbq_add_if(ifname, bandwidth,
-			is_wrr, is_efficient) != 0)
+			is_wrr, is_efficient, no_control) != 0)
 		return (0);
+
 	return (1);
 }
 
@@ -296,11 +305,13 @@ cbq_class_parser(const char *ifname, con
  * qcmd api
  */
 int
-qcmd_cbq_add_if(const char *ifname, u_int bandwidth, int is_wrr, int efficient)
+qcmd_cbq_add_if(const char *ifname, u_int bandwidth, int is_wrr, int efficient,
+bool no_control)
 {
 	int error;
 	
-	error = qop_cbq_add_if(NULL, ifname, bandwidth, is_wrr, efficient);
+	error = qop_cbq_add_if(NULL, ifname, bandwidth, is_wrr, efficient,
+	no_control);
 	if (error != 0)
 		LOG(LOG_ERR, errno, "%s: can't add cbq on interface '%s'",
 		qoperror(error), ifname);
@@ -333,7 +344,7 @@ qcmd_cbq_add_class(const char *ifname, c
 	(borrow = clname2clinfo(ifinfo, borrow_name)) == NULL)
 		error = QOPERR_BADCLASS;
 
-	if (flags & CBQCLF_DEFCLASS) {
+	if (flags & CBQCLF_DEFCLASS && !cbq_ifinfo->no_control) {
 		/*
 		 * if this is a default class and no ctl_class is defined,
 		 * we will create a ctl_class.
@@ -464,7 +475,7 @@ qcmd_cbq_add_ctl_filters(const char *ifn
  */
 int 
 qop_cbq_add_if(struct ifinfo **rp, const char *ifname,
-	   u_int bandwidth, int is_wrr, int efficient)
+	   u_int bandwidth, int is_wrr, int efficient, bool no_control)
 {
 	struct ifinfo *ifinfo = NULL;
 	struct cbq_ifinfo *cbq_ifinfo = NULL;
@@ -477,6 +488,7 @@ qop_cbq_add_if(struct ifinfo **rp, const

CVS commit: src/sys/altq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:31:15 UTC 2021

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

Log Message:
altq, cbq: allow the root class to be default


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/altq/altq_cbq.c

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

Modified files:

Index: src/sys/altq/altq_cbq.c
diff -u src/sys/altq/altq_cbq.c:1.33 src/sys/altq/altq_cbq.c:1.34
--- src/sys/altq/altq_cbq.c:1.33	Wed Jul 14 08:27:59 2021
+++ src/sys/altq/altq_cbq.c	Wed Jul 14 08:31:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_cbq.c,v 1.33 2021/07/14 08:27:59 ozaki-r Exp $	*/
+/*	$NetBSD: altq_cbq.c,v 1.34 2021/07/14 08:31:15 ozaki-r Exp $	*/
 /*	$KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.33 2021/07/14 08:27:59 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.34 2021/07/14 08:31:15 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -363,31 +363,26 @@ cbq_add_queue(struct pf_altq *a)
 	/*
 	 * check parameters
 	 */
-	switch (opts->flags & CBQCLF_CLASSMASK) {
-	case CBQCLF_ROOTCLASS:
+	if ((opts->flags & CBQCLF_ROOTCLASS) != 0) {
 		if (parent != NULL)
 			return (EINVAL);
 		if (cbqp->ifnp.root_)
 			return (EINVAL);
-		break;
-	case CBQCLF_DEFCLASS:
+	}
+	if ((opts->flags & CBQCLF_DEFCLASS) != 0) {
 		if (cbqp->ifnp.default_)
 			return (EINVAL);
-		break;
-	case 0:
+	}
+	if ((opts->flags & CBQCLF_CLASSMASK) == 0) {
 		if (a->qid == 0)
 			return (EINVAL);
-		break;
-	default:
-		/* more than two flags bits set */
-		return (EINVAL);
 	}
 
 	/*
 	 * create a class.  if this is a root class, initialize the
 	 * interface.
 	 */
-	if ((opts->flags & CBQCLF_CLASSMASK) == CBQCLF_ROOTCLASS) {
+	if ((opts->flags & CBQCLF_ROOTCLASS) != 0) {
 		error = rmc_init(cbqp->ifnp.ifq_, >ifnp,
 		opts->ns_per_byte, cbqrestart, a->qlimit, RM_MAXQUEUED,
 		opts->maxidle, opts->minidle, opts->offtime,
@@ -412,7 +407,7 @@ cbq_add_queue(struct pf_altq *a)
 	/* save the allocated class */
 	cbqp->cbq_class_tbl[i] = cl;
 
-	if ((opts->flags & CBQCLF_CLASSMASK) == CBQCLF_DEFCLASS)
+	if ((opts->flags & CBQCLF_DEFCLASS) != 0)
 		cbqp->ifnp.default_ = cl;
 
 	return (0);
@@ -727,7 +722,7 @@ cbq_class_create(cbq_state_t *cbqp, stru
 	 * create a class.  if this is a root class, initialize the
 	 * interface.
 	 */
-	if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_ROOTCLASS) {
+	if ((spec->flags & CBQCLF_ROOTCLASS) != 0) {
 		error = rmc_init(cbqp->ifnp.ifq_, >ifnp,
 		spec->nano_sec_per_byte, cbqrestart, spec->maxq,
 		RM_MAXQUEUED, spec->maxidle, spec->minidle, spec->offtime,
@@ -754,9 +749,9 @@ cbq_class_create(cbq_state_t *cbqp, stru
 	/* save the allocated class */
 	cbqp->cbq_class_tbl[i] = cl;
 
-	if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_DEFCLASS)
+	if ((spec->flags & CBQCLF_CLASSMASK) != 0)
 		cbqp->ifnp.default_ = cl;
-	if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_CTLCLASS)
+	if ((spec->flags & CBQCLF_CTLCLASS) != 0)
 		cbqp->ifnp.ctl_ = cl;
 
 	return (0);



CVS commit: src/sys/altq

2021-07-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 14 08:27:59 UTC 2021

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

Log Message:
altq, cbq: allow no control class


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/altq/altq_cbq.c

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

Modified files:

Index: src/sys/altq/altq_cbq.c
diff -u src/sys/altq/altq_cbq.c:1.32 src/sys/altq/altq_cbq.c:1.33
--- src/sys/altq/altq_cbq.c:1.32	Thu Nov 15 10:23:55 2018
+++ src/sys/altq/altq_cbq.c	Wed Jul 14 08:27:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_cbq.c,v 1.32 2018/11/15 10:23:55 maxv Exp $	*/
+/*	$NetBSD: altq_cbq.c,v 1.33 2021/07/14 08:27:59 ozaki-r Exp $	*/
 /*	$KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.32 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.33 2021/07/14 08:27:59 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -836,14 +836,11 @@ cbq_set_enable(struct cbq_interface *ep,
 
 	switch (enable) {
 	case ENABLE:
-		if (cbqp->ifnp.root_ == NULL || cbqp->ifnp.default_ == NULL ||
-		cbqp->ifnp.ctl_ == NULL) {
+		if (cbqp->ifnp.root_ == NULL || cbqp->ifnp.default_ == NULL) {
 			if (cbqp->ifnp.root_ == NULL)
 printf("No Root Class for %s\n", ifacename);
 			if (cbqp->ifnp.default_ == NULL)
 printf("No Default Class for %s\n", ifacename);
-			if (cbqp->ifnp.ctl_ == NULL)
-printf("No Control Class for %s\n", ifacename);
 			error = EINVAL;
 		} else if ((error = altq_enable(cbqp->ifnp.ifq_)) == 0) {
 			cbqp->cbq_qlen = 0;



CVS commit: src/lib/libedit

2021-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 14 07:47:23 UTC 2021

Modified Files:
src/lib/libedit: tty.c

Log Message:
Via Jess Thrysoee, from Adrian Bunk: Fix libedit build on Linux/Alpha
Alpha is the only Linux architecture that has SIGINFO:
https://sources.debian.org/src/manpages/5.10-1/man7/signal.7/#L522

But even on Alpha Ctrl-T is not supported, and therefore no VSTATUS:
https://sources.debian.org/src/manpages/5.10-1/man3/termios.3/#L603-L608

For consistency check both signal existence and character existence


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/lib/libedit/tty.c

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

Modified files:

Index: src/lib/libedit/tty.c
diff -u src/lib/libedit/tty.c:1.69 src/lib/libedit/tty.c:1.70
--- src/lib/libedit/tty.c:1.69	Sun May 31 19:24:23 2020
+++ src/lib/libedit/tty.c	Wed Jul 14 03:47:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $	*/
+/*	$NetBSD: tty.c,v 1.70 2021/07/14 07:47:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)tty.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.70 2021/07/14 07:47:23 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1350,19 +1350,19 @@ tty_get_signal_character(EditLine *el, i
 		return -1;
 #endif
 	switch (sig) {
-#ifdef SIGINT
+#if defined(SIGINT) && defined(VINTR)
 	case SIGINT:
 		return el->el_tty.t_c[ED_IO][VINTR];
 #endif
-#ifdef SIGQUIT
+#if defined(SIGQUIT) && defined(VQUIT)
 	case SIGQUIT:
 		return el->el_tty.t_c[ED_IO][VQUIT];
 #endif
-#ifdef SIGINFO
+#if defined(SIGINFO) && defined(VSTATUS)
 	case SIGINFO:
 		return el->el_tty.t_c[ED_IO][VSTATUS];
 #endif
-#ifdef SIGTSTP
+#if defined(SIGTSTP) && defined(VSUSP)
 	case SIGTSTP:
 		return el->el_tty.t_c[ED_IO][VSUSP];
 #endif



CVS commit: src/sys/dev/usb

2021-07-14 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Jul 14 07:34:16 UTC 2021

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

Log Message:
The second REQ_RESET USB request by reset_chip() makes LCR, PRE and DIV
registers to have default values 8N1 and 19200 just as the first req does.
Nuke reset_chip() and rundandant set_dte_rate() to amend.
While here added some narrative about prescale/divisor calculation.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/uchcom.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/uchcom.c
diff -u src/sys/dev/usb/uchcom.c:1.37 src/sys/dev/usb/uchcom.c:1.38
--- src/sys/dev/usb/uchcom.c:1.37	Sat Apr 24 23:36:59 2021
+++ src/sys/dev/usb/uchcom.c	Wed Jul 14 07:34:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uchcom.c,v 1.37 2021/04/24 23:36:59 thorpej Exp $	*/
+/*	$NetBSD: uchcom.c,v 1.38 2021/07/14 07:34:16 nisimura Exp $	*/
 
 /*
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.37 2021/04/24 23:36:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.38 2021/07/14 07:34:16 nisimura Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -118,9 +118,6 @@ int	uchcomdebug = 0;
 #define UCHCOMIBUFSIZE 256
 #define UCHCOMOBUFSIZE 256
 
-#define UCHCOM_RESET_VALUE	0x501F
-#define UCHCOM_RESET_INDEX	0xD90A
-
 struct uchcom_softc
 {
 	device_t		sc_dev;
@@ -155,6 +152,7 @@ struct uchcom_divider
 	uint8_t		dv_div;
 };
 
+/* 0,1,2,3,7 are prescale factors for given 4x 1200 clock formula */
 static const uint32_t rates4x[8] = {
 	[0] = 4 * 1200 / 1024,
 	[1] = 4 * 1200 / 128,
@@ -618,6 +616,24 @@ set_break(struct uchcom_softc *sc, int o
 static int
 calc_divider_settings(struct uchcom_divider *dp, uint32_t rate)
 {
+/*
+ * combined with rates4x[] defined above, this routine generates,
+ *   1200: prescale = 1/0x1, divisor = 178/0xb2
+ *   2400: prescale = 1/0x1, divisor = 217/0xd9
+ *   4800: prescale = 2/0x2, divisor = 100/0x64
+ *   9600: prescale = 2/0x2, divisor = 178/0xb2
+ *  19200: prescale = 2/0x2, divisor = 217/0xd9
+ *  38400: prescale = 3/0x3, divisor = 100/0x64
+ *  57600: prescale = 2/0x2, divisor = 243/0xf3
+ * 115200: prescale = 3/0x3, divisor = 204/0xcc
+ * 921600: prescale = 7/0x7, divisor = 243/0xf3
+ * 50: prescale = 3/0x3, divisor = 244/0xf4
+ * 100: prescale = 3/0x3, divisor = 250/0xfa
+ * 150: prescale = 3/0x3, divisor = 252/0xfc
+ * 200: prescale = 3/0x3, divisor = 253/0xfd
+ * 250: unsupported
+ * 300: prescale = 3/0x3, divisor = 254/0xfe
+ */
 	size_t i;
 	uint32_t best, div, pre;
 	const uint32_t rate4x = rate * 4U;
@@ -652,7 +668,7 @@ calc_divider_settings(struct uchcom_divi
 		return -1;
 
 	dp->dv_prescaler = pre;
-	dp->dv_div = (uint8_t)-div;
+	dp->dv_div = 256 - div;
 
 	return 0;
 }
@@ -740,26 +756,12 @@ clear_chip(struct uchcom_softc *sc)
 		usbd_errstr(err));
 		return EIO;
 	}
-
-	return 0;
-}
-
-static int
-reset_chip(struct uchcom_softc *sc)
-{
-	usbd_status err;
-
-	err = generic_control_out(sc, UCHCOM_REQ_RESET,
-	UCHCOM_RESET_VALUE, UCHCOM_RESET_INDEX);
-	if (err)
-		goto failed;
-
+	/*
+	 * this REQ_RESET call ends up with
+	 * LCR=0xc0 (8N1)
+	 * PRE=0x02, DIV=0xb2 (19200)
+	 */
 	return 0;
-
-failed:
-	printf("%s: cannot reset: %s\n",
-	   device_xname(sc->sc_dev), usbd_errstr(err));
-	return EIO;
 }
 
 static int
@@ -787,14 +789,6 @@ setup_comm(struct uchcom_softc *sc)
 	if (ret)
 		return ret;
 
-	ret = reset_chip(sc);
-	if (ret)
-		return ret;
-
-	ret = set_dte_rate(sc, TTYDEF_SPEED); /* XXX */
-	if (ret)
-		return ret;
-
 	sc->sc_dtr = sc->sc_rts = 1;
 	ret = set_dtrrts(sc, sc->sc_dtr, sc->sc_rts);
 	if (ret)



CVS commit: src/sys/ufs/ffs

2021-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 14 07:24:14 UTC 2021

Modified Files:
src/sys/ufs/ffs: ffs_vnops.c

Log Message:
Hook up ffsext_strategy to fifos. Pointed out by dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/ufs/ffs/ffs_vnops.c

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

Modified files:

Index: src/sys/ufs/ffs/ffs_vnops.c
diff -u src/sys/ufs/ffs/ffs_vnops.c:1.134 src/sys/ufs/ffs/ffs_vnops.c:1.135
--- src/sys/ufs/ffs/ffs_vnops.c:1.134	Tue Jun 29 18:34:09 2021
+++ src/sys/ufs/ffs/ffs_vnops.c	Wed Jul 14 03:24:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vnops.c,v 1.134 2021/06/29 22:34:09 dholland Exp $	*/
+/*	$NetBSD: ffs_vnops.c,v 1.135 2021/07/14 07:24:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.134 2021/06/29 22:34:09 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.135 2021/07/14 07:24:14 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -261,7 +261,7 @@ const struct vnodeopv_entry_desc ffs_fif
 	{ _lock_desc, ufs_lock },			/* lock */
 	{ _unlock_desc, ufs_unlock },		/* unlock */
 	{ _bmap_desc, vn_fifo_bypass },		/* bmap */
-	{ _strategy_desc, vn_fifo_bypass },		/* strategy */
+	{ _strategy_desc, ffsext_strategy },	/* strategy */
 	{ _print_desc, ufs_print },			/* print */
 	{ _islocked_desc, ufs_islocked },		/* islocked */
 	{ _pathconf_desc, vn_fifo_bypass },		/* pathconf */



CVS commit: src/sys/net

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 06:50:22 UTC 2021

Modified Files:
src/sys/net: bpf.c if_vlan.c

Log Message:
unset IFF_PROMISC at bpf_detach()

Doing "d->bd_promisc = 0" is that bpf_detach() does not call
ifpromisc(ifp, 0). Currently, there is no reason for
this behavior so that it is removed.
In addition to the change, the workaround for it in vlan(4)
is also removed.


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/net/bpf.c
cvs rdiff -u -r1.158 -r1.159 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.240 src/sys/net/bpf.c:1.241
--- src/sys/net/bpf.c:1.240	Wed Jun  9 15:44:15 2021
+++ src/sys/net/bpf.c	Wed Jul 14 06:50:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.240 2021/06/09 15:44:15 martin Exp $	*/
+/*	$NetBSD: bpf.c,v 1.241 2021/07/14 06:50:22 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.240 2021/06/09 15:44:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.241 2021/07/14 06:50:22 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -2194,7 +2194,6 @@ _bpfdetach(struct ifnet *ifp)
 			 * Detach the descriptor from an interface now.
 			 * It will be free'ed later by close routine.
 			 */
-			d->bd_promisc = 0;	/* we can't touch device. */
 			bpf_detachd(d);
 			mutex_exit(d->bd_mtx);
 			goto again_d;

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.158 src/sys/net/if_vlan.c:1.159
--- src/sys/net/if_vlan.c:1.158	Wed Jul 14 06:23:06 2021
+++ src/sys/net/if_vlan.c	Wed Jul 14 06:50:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.158 2021/07/14 06:23:06 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.159 2021/07/14 06:50:22 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.158 2021/07/14 06:23:06 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.159 2021/07/14 06:50:22 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -701,8 +701,6 @@ vlan_unconfig_locked(struct ifvlan *ifv,
 	KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
 #endif
 
-	if ((ifp->if_flags & IFF_PROMISC) != 0)
-		vlan_safe_ifpromisc_locked(ifp, 0);
 	if_down_locked(ifp);
 	ifp->if_capabilities = 0;
 	mutex_enter(>ifv_lock);



CVS commit: src/tests/net/if_vlan

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 06:36:00 UTC 2021

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Added a test about clearing IFF_PROMISC at vlan_unconfig

This test is related to PR/49196


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.20 src/tests/net/if_vlan/t_vlan.sh:1.21
--- src/tests/net/if_vlan/t_vlan.sh:1.20	Fri Jul  9 05:54:11 2021
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Jul 14 06:35:59 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.20 2021/07/09 05:54:11 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -986,6 +986,27 @@ vlan_promisc_body()
 
 	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0
 	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig shmif0
+	$atf_ifconfig vlan0 -vlanif
+
+	#
+	# clear IFF_PROMISC after bpf_detach called from ether_ifdetach
+	#
+	$atf_ifconfig vlan0 vlan 1 vlanif shmif0
+	$atf_ifconfig vlan0 up
+
+	$bpfopen -r vlan0 &
+	pid=$!
+
+	atf_check -s exit:0 -o match:'PROMISC' rump.ifconfig vlan0
+	atf_check -s exit:0 -o match:'PROMISC' rump.ifconfig shmif0
+
+	$atf_ifconfig vlan0 -vlanif
+
+	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0
+	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig shmif0
+
+	kill -TERM $pid
+	atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0
 }
 
 vlan_promisc_cleanup()



CVS commit: src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl

2021-07-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 14 06:34:33 UTC 2021

Modified Files:
src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl:
Makefile

Log Message:
find libgbm in libgbm.old.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl/Makefile
diff -u src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl/Makefile:1.1 src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl/Makefile:1.2
--- src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl/Makefile:1.1	Tue Apr 16 21:21:51 2019
+++ src/external/mit/xorg/server/xorg-server/hw/xfree86/glamor_egl/Makefile	Wed Jul 14 06:34:33 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2019/04/16 21:21:51 mrg Exp $
+#	$NetBSD: Makefile,v 1.2 2021/07/14 06:34:33 mrg Exp $
 
 XMODULEDIR=	${X11USRLIBDIR}/modules
 
@@ -30,8 +30,10 @@ CPPFLAGS+=	\
 CPPFLAGS+=	\
 	-DGLAMOR_HAS_GBM
 
+.include "../../../../../lib/mesa-which.mk"
+
 LIBDPLIBS=	\
-	gbm	${.CURDIR}/../../../../../lib/libgbm
+	gbm	${.CURDIR}/../../../../../lib/libgbm${OLD_SUFFIX}
 
 .include 
 LIBDIR=	${XMODULEDIR}



CVS commit: src/sys/net

2021-07-14 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jul 14 06:23:06 UTC 2021

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

Log Message:
Make an mbuf writable before un-tagging


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.157 src/sys/net/if_vlan.c:1.158
--- src/sys/net/if_vlan.c:1.157	Tue Jul  6 02:39:46 2021
+++ src/sys/net/if_vlan.c	Wed Jul 14 06:23:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.157 2021/07/06 02:39:46 yamaguchi Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.158 2021/07/14 06:23:06 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.157 2021/07/06 02:39:46 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.158 2021/07/14 06:23:06 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1622,6 +1622,14 @@ vlan_input(struct ifnet *ifp, struct mbu
 			"dropping packet.\n", ifp->if_xname);
 			return;
 		}
+
+		if (m_makewritable(, 0,
+		sizeof(struct ether_vlan_header), M_DONTWAIT)) {
+			m_freem(m);
+			if_statinc(ifp, if_ierrors);
+			return;
+		}
+
 		evl = mtod(m, struct ether_vlan_header *);
 		KASSERT(ntohs(evl->evl_encap_proto) == ETHERTYPE_VLAN);