CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 05:22:57 UTC 2021

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

Log Message:
Fix the wrong timeout event handler for PAP

sppp_auth_to_event() is a implementation of TO+/TO- event for
authentication protocol and it drops TO+ event in Ack-rcvd state.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.256 src/sys/net/if_spppsubr.c:1.257
--- src/sys/net/if_spppsubr.c:1.256	Tue Jun  1 05:16:46 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 05:22:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.256 2021/06/01 05:16:46 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.257 2021/06/01 05:22:57 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.256 2021/06/01 05:16:46 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.257 2021/06/01 05:22:57 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -538,7 +538,7 @@ static const struct cp ipv6cp = {
 static const struct cp pap = {
 	PPP_PAP, IDX_PAP, CP_AUTH, "pap",
 	sppp_up_event, sppp_down_event, sppp_open_event,
-	sppp_close_event, sppp_to_event,
+	sppp_close_event, sppp_auth_to_event,
 	sppp_pap_tlu, sppp_null, sppp_tls, sppp_tlf,
 	sppp_pap_scr, sppp_auth_screply,
 	NULL, NULL, NULL



CVS commit: src/tests/net/if_pppoe

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 05:18:33 UTC 2021

Modified Files:
src/tests/net/if_pppoe: t_pppoe.sh

Log Message:
Update test case.
The state of IPCP and IPv6CP is Closed when those are disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/net/if_pppoe/t_pppoe.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_pppoe/t_pppoe.sh
diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.32 src/tests/net/if_pppoe/t_pppoe.sh:1.33
--- src/tests/net/if_pppoe/t_pppoe.sh:1.32	Thu May 13 03:37:58 2021
+++ src/tests/net/if_pppoe/t_pppoe.sh	Tue Jun  1 05:18:33 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_pppoe.sh,v 1.32 2021/05/13 03:37:58 yamaguchi Exp $
+#	$NetBSD: t_pppoe.sh,v 1.33 2021/06/01 05:18:33 yamaguchi Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -743,7 +743,7 @@ pppoe_params_body()
 	atf_pppoectl pppoe0 noipv6cp
 	atf_ifconfig pppoe0 up
 	wait_for_opened "IPCP"
-	atf_check -s exit:0 -o match:'IPv6CP state: initial' \
+	atf_check -s exit:0 -o match:'IPv6CP state: closed' \
 	-x "$HIJACKING pppoectl -dd pppoe0"
 
 	atf_ifconfig pppoe0 down
@@ -755,7 +755,7 @@ pppoe_params_body()
 	atf_pppoectl pppoe0 noipcp ipv6cp
 	atf_ifconfig pppoe0 up
 	wait_for_opened "IPv6CP"
-	atf_check -s exit:0 -o match:'IPCP state: initial' \
+	atf_check -s exit:0 -o match:'IPCP state: closed' \
 	-x "$HIJACKING pppoectl -dd pppoe0"
 }
 



CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 05:16:46 UTC 2021

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

Log Message:
Send Up event in tlu action of LCP

When LCP is stopping, the layer send Down event and Close event
(Down -> Close). To align the sequence, Up event is moved
before Open event.


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.255 src/sys/net/if_spppsubr.c:1.256
--- src/sys/net/if_spppsubr.c:1.255	Tue Jun  1 05:11:22 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 05:16:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.255 2021/06/01 05:11:22 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.256 2021/06/01 05:16:46 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.255 2021/06/01 05:11:22 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.256 2021/06/01 05:16:46 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1898,6 +1898,7 @@ sppp_open_event(struct sppp *sp, void *x
 		break;
 	case STATE_CLOSED:
 		sp->scp[cp->protoidx].rst_counter = sp->lcp.max_configure;
+		sp->lcp.protos |= (1 << cp->protoidx);
 		(cp->scr)(sp);
 		sppp_cp_change_state(cp, sp, STATE_REQ_SENT);
 		break;
@@ -3114,6 +3115,7 @@ static void
 sppp_lcp_tlu(struct sppp *sp)
 {
 	struct ifnet *ifp;
+	struct sppp_cp *scp;
 	int i;
 	bool going_up;
 
@@ -3160,26 +3162,28 @@ sppp_lcp_tlu(struct sppp *sp)
 	else
 		sppp_change_phase(sp, SPPP_PHASE_NETWORK);
 
-	/*
-	 * Open all authentication protocols.  This is even required
-	 * if we already proceeded to network phase, since it might be
-	 * that remote wants us to authenticate, so we might have to
-	 * send a PAP request.  Undesired authentication protocols
-	 * don't do anything when they get an Open event.
-	 */
-	for (i = 0; i < IDX_COUNT; i++)
-		if ((cps[i])->flags & CP_AUTH) {
-			sppp_wq_add(sp->wq_cp,
-			&sp->scp[(cps[i])->protoidx].work_open);
-		}
 
-	if (sp->pp_phase == SPPP_PHASE_NETWORK) {
-		/* Notify all NCPs. */
-		for (i = 0; i < IDX_COUNT; i++)
-			if ((cps[i])->flags & CP_NCP) {
-			sppp_wq_add(sp->wq_cp,
-			&sp->scp[(cps[i])->protoidx].work_open);
-			}
+	for (i = 0; i < IDX_COUNT; i++) {
+		scp = &sp->scp[(cps[i])->protoidx];
+
+		if (((cps[i])->flags & CP_LCP) == 0)
+			sppp_wq_add(sp->wq_cp, &scp->work_up);
+
+		/*
+		 * Open all authentication protocols.  This is even required
+		 * if we already proceeded to network phase, since it might be
+		 * that remote wants us to authenticate, so we might have to
+		 * send a PAP request.  Undesired authentication protocols
+		 * don't do anything when they get an Open event.
+		 */
+		if ((cps[i])->flags & CP_AUTH)
+			sppp_wq_add(sp->wq_cp, &scp->work_open);
+
+		/* Open all NCPs. */
+		if (sp->pp_phase == SPPP_PHASE_NETWORK &&
+		((cps[i])->flags & CP_NCP) != 0) {
+			sppp_wq_add(sp->wq_cp, &scp->work_open);
+		}
 	}
 
 	/* notify low-level driver of state change */
@@ -3190,7 +3194,8 @@ static void
 sppp_lcp_tld(struct sppp *sp)
 {
 	struct ifnet *ifp;
-	int i, pi, phase;
+	struct sppp_cp *scp;
+	int i, phase;
 
 	KASSERT(SPPP_WLOCKED(sp));
 
@@ -3221,15 +3226,19 @@ sppp_lcp_tld(struct sppp *sp)
 	 * describes it.
 	 */
 	for (i = 0; i < IDX_COUNT; i++) {
-		pi = (cps[i])->protoidx;
-		if (((cps[i])->flags & CP_LCP) == 0) {
-			/* skip if ncp was not started */
-			if (phase != SPPP_PHASE_NETWORK &&
-			((cps[i])->flags & CP_NCP) != 0)
-continue;
+		scp = &sp->scp[(cps[i])->protoidx];
 
-			sppp_wq_add(sp->wq_cp, &sp->scp[pi].work_down);
-			sppp_wq_add(sp->wq_cp, &sp->scp[pi].work_close);
+		if (((cps[i])->flags & CP_LCP) == 0)
+			sppp_wq_add(sp->wq_cp, &scp->work_down);
+
+		if ((cps[i])->flags & CP_AUTH) {
+			sppp_wq_add(sp->wq_cp, &scp->work_close);
+		}
+
+		/* Close all NCPs. */
+		if (phase == SPPP_PHASE_NETWORK &&
+		((cps[i])->flags & CP_NCP) != 0) {
+			sppp_wq_add(sp->wq_cp, &scp->work_close);
 		}
 	}
 }
@@ -6510,11 +6519,10 @@ static void
 sppp_tls(const struct cp *cp, struct sppp *sp)
 {
 
+	SPPP_DLOG(sp, "%s tls\n", cp->name);
+
 	/* notify lcp that is lower layer */
 	sp->lcp.protos |= (1 << cp->protoidx);
-
-	if (sp->scp[IDX_LCP].state == STATE_OPENED)
-		sppp_wq_add(sp->wq_cp, &sp->scp[cp->protoidx].work_up);
 }
 
 static void



CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 05:11:22 UTC 2021

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

Log Message:
Added logs when IPCP and IPv6CP are up or down


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.254 src/sys/net/if_spppsubr.c:1.255
--- src/sys/net/if_spppsubr.c:1.254	Tue Jun  1 05:08:46 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 05:11:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.254 2021/06/01 05:08:46 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.255 2021/06/01 05:11:22 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.254 2021/06/01 05:08:46 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.255 2021/06/01 05:11:22 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3897,6 +3897,7 @@ sppp_ipcp_tlu(struct sppp *sp)
 
 	KASSERT(SPPP_WLOCKED(sp));
 
+	SPPP_LOG(sp, LOG_INFO, "IPCP layer up\n");
 	ifp = &sp->pp_if;
 	if ((sp->ipcp.flags & IPCP_MYADDR_DYN) &&
 	((sp->ipcp.flags & IPCP_MYADDR_SEEN) == 0)) {
@@ -3920,6 +3921,7 @@ sppp_ipcp_tld(struct sppp *sp)
 
 	KASSERT(SPPP_WLOCKED(sp));
 
+	SPPP_LOG(sp, LOG_INFO, "IPCP layer down\n");
 	ifp = &sp->pp_if;
 	rt_ifmsg(ifp);
 #endif
@@ -4464,6 +4466,7 @@ sppp_ipv6cp_tlu(struct sppp *sp)
 
 	KASSERT(SPPP_WLOCKED(sp));
 
+	SPPP_LOG(sp, LOG_INFO, "IPv6CP layer up\n");
 	ifp = &sp->pp_if;
 	/* we are up - notify isdn daemon */
 	sppp_notify_con_wlocked(sp);
@@ -4477,6 +4480,7 @@ sppp_ipv6cp_tld(struct sppp *sp)
 
 	KASSERT(SPPP_WLOCKED(sp));
 
+	SPPP_LOG(sp, LOG_INFO, "IPv6CP layer down\n");
 	ifp = &sp->pp_if;
 	rt_ifmsg(ifp);
 }



CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 05:08:46 UTC 2021

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

Log Message:
Added SPPP_LOG() for refactoring around log


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.253 src/sys/net/if_spppsubr.c:1.254
--- src/sys/net/if_spppsubr.c:1.253	Tue Jun  1 05:04:06 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 05:08:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.253 2021/06/01 05:04:06 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.254 2021/06/01 05:08:46 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.253 2021/06/01 05:04:06 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.254 2021/06/01 05:08:46 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -319,6 +319,17 @@ static unsigned int sppp_keepalive_cnt =
 #define SPPP_DOWNGRADE(_sp)	rw_downgrade(&(_sp)->pp_lock)
 #define SPPP_WQ_SET(_wk, _func, _arg)	\
 	sppp_wq_set((_wk), (_func), __UNCONST((_arg)))
+#define SPPP_LOG(_sp, _lvl, _fmt, _args...)	do {		\
+	if (__predict_true((_sp) != NULL)) {			\
+		log((_lvl), "%s: ", (_sp)->pp_if.if_xname);	\
+	}			\
+	addlog((_fmt), ##_args);\
+} while (0)
+#define SPPP_DLOG(_sp, _fmt, _args...)	do {	\
+	if (!sppp_debug_enabled(_sp))			\
+		break;	\
+	SPPP_LOG(_sp, LOG_DEBUG, _fmt, ##_args);	\
+} while (0)
 
 #ifdef INET
 #ifndef SPPPSUBR_MPSAFE
@@ -339,10 +350,8 @@ static u_short interactive_ports[8] = {
 #endif
 
 /* almost every function needs these */
-#define STDDCL			\
-	struct ifnet *ifp = &sp->pp_if;\
-	int debug = ifp->if_flags & IFF_DEBUG
 
+static bool sppp_debug_enabled(struct sppp *sp);
 static int sppp_output(struct ifnet *, struct mbuf *,
 		   const struct sockaddr *, const struct rtentry *);
 
@@ -580,13 +589,28 @@ sppp_authproto2proto(u_int authproto)
 	return PPP_NOPROTO;
 }
 
+static inline bool
+sppp_debug_enabled(struct sppp *sp)
+{
+
+	if (__predict_false(sp == NULL))
+		return false;
+
+	if ((sp->pp_if.if_flags & IFF_DEBUG) == 0)
+		return false;
+
+	return true;
+}
+
 static void
 sppp_change_phase(struct sppp *sp, int phase)
 {
-	STDDCL;
+	struct ifnet *ifp;
 
 	KASSERT(SPPP_WLOCKED(sp));
 
+	ifp = &sp->pp_if;
+
 	if (sp->pp_phase == phase)
 		return;
 
@@ -597,11 +621,8 @@ sppp_change_phase(struct sppp *sp, int p
 	else
 		if_link_state_change(ifp, LINK_STATE_DOWN);
 
-	if (debug)
-	{
-		log(LOG_INFO, "%s: phase %s\n", ifp->if_xname,
-			sppp_phase_name(sp->pp_phase));
-	}
+	SPPP_DLOG(sp, "phase %s\n",
+	sppp_phase_name(sp->pp_phase));
 }
 
 /*
@@ -619,7 +640,6 @@ sppp_input(struct ifnet *ifp, struct mbu
 	struct ifqueue *inq = NULL;
 	uint16_t protocol;
 	struct sppp *sp = (struct sppp *)ifp;
-	int debug = ifp->if_flags & IFF_DEBUG;
 	int isr = 0;
 
 	SPPP_LOCK(sp, RW_READER);
@@ -633,10 +653,8 @@ sppp_input(struct ifnet *ifp, struct mbu
 
 	if (m->m_pkthdr.len <= PPP_HEADER_LEN) {
 		/* Too small packet, drop it. */
-		if (debug)
-			log(LOG_DEBUG,
-			"%s: input packet is too small, %d bytes\n",
-			ifp->if_xname, m->m_pkthdr.len);
+		SPPP_DLOG(sp, "input packet is too small, "
+		"%d bytes\n", m->m_pkthdr.len);
 		goto drop;
 	}
 
@@ -658,21 +676,15 @@ sppp_input(struct ifnet *ifp, struct mbu
 		case CISCO_MULTICAST:
 		case CISCO_UNICAST:
 			/* Don't check the control field here (RFC 1547). */
-			if (debug)
-log(LOG_DEBUG,
-"%s: Cisco packet in PPP mode "
-"\n",
-ifp->if_xname,
-h->address, h->control, ntohs(h->protocol));
+			SPPP_DLOG(sp, "Cisco packet in PPP mode "
+			"\n",
+			h->address, h->control, ntohs(h->protocol));
 			goto drop;
 		default:/* Invalid PPP packet. */
 		  invalid:
-			if (debug)
-log(LOG_DEBUG,
-"%s: invalid input packet "
-"\n",
-ifp->if_xname,
-h->address, h->control, ntohs(h->protocol));
+			SPPP_DLOG(sp, "invalid input packet "
+			"\n",
+			h->address, h->control, ntohs(h->protocol));
 			goto drop;
 		}
 		protocol = ntohs(h->protocol);
@@ -692,11 +704,8 @@ sppp_input(struct ifnet *ifp, struct mbu
 		if_statinc(ifp, if_noproto);
 		goto drop;
 	default:
-		if (debug) {
-			log(LOG_DEBUG,
-			"%s: invalid input protocol "
-			"\n", ifp->if_xname, protocol);
-		}
+		SPPP_DLOG(sp, "invalid input protocol "
+		"\n", protocol);
 		goto reject_protocol;
 	case PPP_LCP:
 		SPPP_UNLOCK(sp);
@@ -720,9 +729,8 @@ sppp_input(struct ifnet *ifp, struct mbu
 #ifdef INET
 	case PPP_IPCP:
 		if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPCP)) {
-			log(LOG_INFO, "%s: reject IPCP packet "
-			"because IPCP is disabled\n",
-			ifp->if_xname);
+			SPPP_LOG(sp

CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 05:04:06 UTC 2021

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

Log Message:
Send RTM_IFINFO when a network configuration protocol
is up or down


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.252 src/sys/net/if_spppsubr.c:1.253
--- src/sys/net/if_spppsubr.c:1.252	Tue Jun  1 04:59:50 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 05:04:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.252 2021/06/01 04:59:50 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.253 2021/06/01 05:04:06 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.252 2021/06/01 04:59:50 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.253 2021/06/01 05:04:06 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -417,6 +417,7 @@ static enum cp_rcr_type
 static void sppp_ipcp_confrej(struct sppp *, struct lcp_header *, int);
 static void sppp_ipcp_confnak(struct sppp *, struct lcp_header *, int);
 static void sppp_ipcp_tlu(struct sppp *);
+static void sppp_ipcp_tld(struct sppp *);
 static void sppp_ipcp_scr(struct sppp *);
 
 static void sppp_ipv6cp_init(struct sppp *);
@@ -427,6 +428,7 @@ static enum cp_rcr_type
 static void sppp_ipv6cp_confrej(struct sppp *, struct lcp_header *, int);
 static void sppp_ipv6cp_confnak(struct sppp *, struct lcp_header *, int);
 static void sppp_ipv6cp_tlu(struct sppp *);
+static void sppp_ipv6cp_tld(struct sppp *);
 static void sppp_ipv6cp_scr(struct sppp *);
 
 static void sppp_pap_input(struct sppp *, struct mbuf *);
@@ -504,7 +506,7 @@ static const struct cp ipcp = {
 	"ipcp",
 	sppp_up_event, sppp_down_event, sppp_ipcp_open,
 	sppp_ipcp_close, sppp_to_event,
-	sppp_ipcp_tlu, sppp_null, sppp_tls,
+	sppp_ipcp_tlu, sppp_ipcp_tld, sppp_tls,
 	sppp_tlf, sppp_ipcp_scr, sppp_screply,
 	sppp_ipcp_confreq, sppp_ipcp_confrej, sppp_ipcp_confnak,
 };
@@ -519,7 +521,7 @@ static const struct cp ipv6cp = {
 	"ipv6cp",
 	sppp_up_event, sppp_down_event, sppp_ipv6cp_open,
 	sppp_close_event, sppp_to_event,
-	sppp_ipv6cp_tlu, sppp_null, sppp_tls,
+	sppp_ipv6cp_tlu, sppp_ipv6cp_tld, sppp_tls,
 	sppp_tlf, sppp_ipv6cp_scr, sppp_screply,
 	sppp_ipv6cp_confreq, sppp_ipv6cp_confrej, sppp_ipv6cp_confnak,
 };
@@ -3936,8 +3938,9 @@ sppp_ipcp_tlu(struct sppp *sp)
 #ifdef INET
 	struct ifnet *ifp;
 
-	ifp = &sp->pp_if;
 	KASSERT(SPPP_WLOCKED(sp));
+
+	ifp = &sp->pp_if;
 	if ((sp->ipcp.flags & IPCP_MYADDR_DYN) &&
 	((sp->ipcp.flags & IPCP_MYADDR_SEEN) == 0)) {
 		log(LOG_WARNING, "%s: no IP address, closing IPCP\n",
@@ -3947,11 +3950,25 @@ sppp_ipcp_tlu(struct sppp *sp)
 	} else {
 		/* we are up. Set addresses and notify anyone interested */
 		sppp_set_ip_addrs(sp);
+		rt_ifmsg(ifp);
 	}
 #endif
 }
 
 static void
+sppp_ipcp_tld(struct sppp *sp)
+{
+#ifdef INET
+	struct ifnet *ifp;
+
+	KASSERT(SPPP_WLOCKED(sp));
+
+	ifp = &sp->pp_if;
+	rt_ifmsg(ifp);
+#endif
+}
+
+static void
 sppp_ipcp_scr(struct sppp *sp)
 {
 	uint8_t opt[6 /* compression */ + 6 /* address */ + 12 /* dns addresses */];
@@ -4483,10 +4500,25 @@ end:
 static void
 sppp_ipv6cp_tlu(struct sppp *sp)
 {
+	struct ifnet *ifp;
 
 	KASSERT(SPPP_WLOCKED(sp));
+
+	ifp = &sp->pp_if;
 	/* we are up - notify isdn daemon */
 	sppp_notify_con_wlocked(sp);
+	rt_ifmsg(ifp);
+}
+
+static void
+sppp_ipv6cp_tld(struct sppp *sp)
+{
+	struct ifnet *ifp;
+
+	KASSERT(SPPP_WLOCKED(sp));
+
+	ifp = &sp->pp_if;
+	rt_ifmsg(ifp);
 }
 
 static void



CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 04:59:50 UTC 2021

Modified Files:
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
Drop the Open event of LCP to stop the interface
even a reconnection is scheduled

The queue for events in if_spppsubr.c is not possible
to enqueue the same event. So, The close event caused
while a close event and open event are enqueued for
reconnection is not possible to stop interface.
To solve this issue, The open event after
"ifconfig pppoe? down" is dropped.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.41 -r1.42 src/sys/net/if_spppvar.h

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.251 src/sys/net/if_spppsubr.c:1.252
--- src/sys/net/if_spppsubr.c:1.251	Tue Jun  1 04:55:55 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 04:59:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.252 2021/06/01 04:59:50 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.252 2021/06/01 04:59:50 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1256,6 +1256,12 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 			ifp->if_flags &= ~IFF_AUTO;
 		}
 
+		if (ifp->if_flags & IFF_UP) {
+			sp->pp_flags |= PP_ADMIN_UP;
+		} else {
+			sp->pp_flags &= ~PP_ADMIN_UP;
+		}
+
 		if (going_up || going_down) {
 			sp->lcp.reestablish = false;
 			sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_close);
@@ -2571,6 +2577,10 @@ sppp_lcp_open(struct sppp *sp, void *xcp
 	sp->lcp.reestablish = false;
 	sp->scp[IDX_LCP].fail_counter = 0;
 
+	/* the interface was down while waiting for reconnection */
+	if ((sp->pp_flags & PP_ADMIN_UP) == 0)
+		return;
+
 	if (sp->pp_if.if_mtu < PP_MTU) {
 		sp->lcp.mru = sp->pp_if.if_mtu;
 		SET(sp->lcp.opts, SPPP_LCP_OPT_MRU);

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.41 src/sys/net/if_spppvar.h:1.42
--- src/sys/net/if_spppvar.h:1.41	Tue Jun  1 04:55:55 2021
+++ src/sys/net/if_spppvar.h	Tue Jun  1 04:59:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.41 2021/06/01 04:55:55 yamaguchi Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.42 2021/06/01 04:59:50 yamaguchi Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -214,6 +214,7 @@ struct sppp {
 #define PP_LOOPBACK		0x40	/* in line loopback mode */
 #define PP_LOOPBACK_IFDOWN	0x80	/* if_down() when loopback detected */
 #define PP_KEEPALIVE_IFDOWN	0x100	/* if_down() when no ECHO_REPLY received */
+#define PP_ADMIN_UP		0x200	/* the interface is up */
 
 
 #define PP_MTU  1500/* default/minimal MRU */



CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 04:55:56 UTC 2021

Modified Files:
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
remove PP_CISCO that was used in obsoleted drivers e.g. lmc(4)


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.40 -r1.41 src/sys/net/if_spppvar.h

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.250 src/sys/net/if_spppsubr.c:1.251
--- src/sys/net/if_spppsubr.c:1.250	Tue Jun  1 04:45:22 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 04:55:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.250 2021/06/01 04:45:22 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.250 2021/06/01 04:45:22 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -346,9 +346,6 @@ static u_short interactive_ports[8] = {
 static int sppp_output(struct ifnet *, struct mbuf *,
 		   const struct sockaddr *, const struct rtentry *);
 
-static void sppp_cisco_send(struct sppp *, int, int32_t, int32_t);
-static void sppp_cisco_input(struct sppp *, struct mbuf *);
-
 static void sppp_cp_init(const struct cp *, struct sppp *);
 static void sppp_cp_fini(const struct cp *, struct sppp *);
 static void sppp_cp_input(const struct cp *, struct sppp *,
@@ -655,49 +652,17 @@ sppp_input(struct ifnet *ifp, struct mbu
 		case PPP_ALLSTATIONS:
 			if (h->control != PPP_UI)
 goto invalid;
-			if (sp->pp_flags & PP_CISCO) {
-if (debug)
-	log(LOG_DEBUG,
-	"%s: PPP packet in Cisco mode "
-	"\n",
-	ifp->if_xname,
-	h->address, h->control, ntohs(h->protocol));
-goto drop;
-			}
 			break;
 		case CISCO_MULTICAST:
 		case CISCO_UNICAST:
 			/* Don't check the control field here (RFC 1547). */
-			if (! (sp->pp_flags & PP_CISCO)) {
-if (debug)
-	log(LOG_DEBUG,
-	"%s: Cisco packet in PPP mode "
-	"\n",
-	ifp->if_xname,
-	h->address, h->control, ntohs(h->protocol));
-goto drop;
-			}
-			switch (ntohs(h->protocol)) {
-			default:
-if_statinc(ifp, if_noproto);
-goto invalid;
-			case CISCO_KEEPALIVE:
-SPPP_UNLOCK(sp);
-sppp_cisco_input((struct sppp *) ifp, m);
-m_freem(m);
-return;
-#ifdef INET
-			case ETHERTYPE_IP:
-pktq = ip_pktq;
-break;
-#endif
-#ifdef INET6
-			case ETHERTYPE_IPV6:
-pktq = ip6_pktq;
-break;
-#endif
-			}
-			goto queue_pkt;
+			if (debug)
+log(LOG_DEBUG,
+"%s: Cisco packet in PPP mode "
+"\n",
+ifp->if_xname,
+h->address, h->control, ntohs(h->protocol));
+			goto drop;
 		default:/* Invalid PPP packet. */
 		  invalid:
 			if (debug)
@@ -799,7 +764,6 @@ sppp_input(struct ifnet *ifp, struct mbu
 #endif
 	}
 
-queue_pkt:
 	if ((ifp->if_flags & IFF_UP) == 0 || (!inq && !pktq)) {
 		goto drop;
 	}
@@ -979,74 +943,61 @@ sppp_output(struct ifnet *ifp, struct mb
 		 * (albeit due to the implementation it's always enough)
 		 */
 		h = mtod(m, struct ppp_header *);
-		if (sp->pp_flags & PP_CISCO) {
-			h->address = CISCO_UNICAST;/* unicast address */
-			h->control = 0;
-		} else {
-			h->address = PPP_ALLSTATIONS;/* broadcast address */
-			h->control = PPP_UI; /* Unnumbered Info */
-		}
+		h->address = PPP_ALLSTATIONS;/* broadcast address */
+		h->control = PPP_UI; /* Unnumbered Info */
 	}
 
 	switch (dst->sa_family) {
 #ifdef INET
 	case AF_INET:   /* Internet Protocol */
-		if (sp->pp_flags & PP_CISCO)
-			protocol = htons(ETHERTYPE_IP);
-		else {
-			/*
-			 * Don't choke with an ENETDOWN early.  It's
-			 * possible that we just started dialing out,
-			 * so don't drop the packet immediately.  If
-			 * we notice that we run out of buffer space
-			 * below, we will however remember that we are
-			 * not ready to carry IP packets, and return
-			 * ENETDOWN, as opposed to ENOBUFS.
-			 */
-			protocol = htons(PPP_IP);
-			if (sp->scp[IDX_IPCP].state != STATE_OPENED) {
-if (ifp->if_flags & IFF_AUTO) {
-	error = ENETDOWN;
-} else {
-	IF_DROP(&ifp->if_snd);
-	SPPP_UNLOCK(sp);
-	splx(s);
-
-	m_freem(m);
-	if_statinc(ifp, if_oerrors);
-	return (ENETDOWN);
-}
+		/*
+		 * Don't choke with an ENETDOWN early.  It's
+		 * possible that we just started dialing out,
+		 * so don't drop the packet immediately.  If
+		 * we notice that we run out of buffer space
+		 * below, we will however remember that we are
+		 * not ready to carry IP packets, and return
+		 * ENETDOWN, as opposed to ENOBUFS.
+		 */
+		protocol = h

CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 04:45:22 UTC 2021

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

Log Message:
Remove open event on tlf of PAP/CHAP when retry of them is over
to prevent that LCP stops at Starting state.

And also remove retry counter check on tls of LCP because of
unnecessary.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.249 src/sys/net/if_spppsubr.c:1.250
--- src/sys/net/if_spppsubr.c:1.249	Tue Jun  1 04:19:57 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 04:45:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.249 2021/06/01 04:19:57 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.250 2021/06/01 04:45:22 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.249 2021/06/01 04:19:57 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.250 2021/06/01 04:45:22 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3477,16 +3477,6 @@ sppp_lcp_tls(const struct cp *cp __unuse
 
 	KASSERT(SPPP_WLOCKED(sp));
 
-	if (sp->pp_max_auth_fail != 0 && sp->pp_auth_failures >= sp->pp_max_auth_fail) {
-		printf("%s: authentication failed %d times, not retrying again\n",
-		sp->pp_if.if_xname, sp->pp_auth_failures);
-
-		SPPP_UNLOCK(sp);
-		if_down(&sp->pp_if);
-		SPPP_LOCK(sp, RW_WRITER);
-		return;
-	}
-
 	sppp_change_phase(sp, SPPP_PHASE_ESTABLISH);
 
 	/* Notify lower layer if desired. */
@@ -3597,7 +3587,18 @@ sppp_lcp_check_and_close(struct sppp *sp
 		return;
 
 	sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_close);
-	sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_open);
+
+	if (sp->pp_max_auth_fail != 0 &&
+	sp->pp_auth_failures >= sp->pp_max_auth_fail) {
+		printf("%s: authentication failed %d times, "
+		"not retrying again\n",
+		sp->pp_if.if_xname, sp->pp_auth_failures);
+
+		sppp_wq_add(sp->wq_cp, &sp->work_ifdown);
+		sp->pp_if.if_flags &= ~IFF_RUNNING;
+	} else {
+		sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_open);
+	}
 }
 
 /*



CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 04:19:57 UTC 2021

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

Log Message:
Do not if_down() when a down event of the lower layer of LCP is happened
since the layer try to reconnect.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/net/if_spppsubr.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_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.248 src/sys/net/if_spppsubr.c:1.249
--- src/sys/net/if_spppsubr.c:1.248	Tue Jun  1 03:51:33 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 04:19:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.248 2021/06/01 03:51:33 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.249 2021/06/01 04:19:57 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.248 2021/06/01 03:51:33 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.249 2021/06/01 04:19:57 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2746,29 +2746,16 @@ sppp_lcp_down(struct sppp *sp, void *xcp
 		sp->lcp.tlf_sent = false;
 	}
 
-	/*
-	 * If this is neither a dial-on-demand nor a passive
-	 * interface, simulate an ``ifconfig down'' action, so the
-	 * administrator can force a redial by another ``ifconfig
-	 * up''.  XXX For leased line operation, should we immediately
-	 * try to reopen the connection here?
-	 */
-	if ((ifp->if_flags & (IFF_AUTO | IFF_PASSIVE)) == 0) {
-		if (debug)
-			log(LOG_INFO,
-			"%s: Down event (carrier loss), taking interface down.\n",
-			ifp->if_xname);
-		SPPP_UNLOCK(sp);
-		if_down(ifp);
-		SPPP_LOCK(sp, RW_WRITER);
+	if (debug) {
+		log(LOG_DEBUG,
+		"%s: Down event (carrier loss)\n",
+		ifp->if_xname);
+	}
 
+	if ((ifp->if_flags & (IFF_AUTO | IFF_PASSIVE)) == 0) {
 		if (sp->lcp.reestablish)
 			sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_open);
 	} else {
-		if (debug)
-			log(LOG_DEBUG,
-			"%s: Down event (carrier loss)\n",
-			ifp->if_xname);
 
 		sp->pp_flags &= ~PP_CALLIN;
 		if (sp->scp[pidx].state != STATE_INITIAL)



CVS commit: src/sys

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 03:51:33 UTC 2021

Modified Files:
src/sys/conf: files
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
Fix not to do if_down() before reconnect

Almost network interface do not use if_down() even when there is no
connectivity. So, pppoe(4) is also made be not used it.
This behavior can be rollbacked by SPPP_IFDOWN_RECONNECT option.


To generate a diff of this commit:
cvs rdiff -u -r1.1285 -r1.1286 src/sys/conf/files
cvs rdiff -u -r1.247 -r1.248 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.39 -r1.40 src/sys/net/if_spppvar.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/conf/files
diff -u src/sys/conf/files:1.1285 src/sys/conf/files:1.1286
--- src/sys/conf/files:1.1285	Sat May 29 12:03:34 2021
+++ src/sys/conf/files	Tue Jun  1 03:51:33 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1285 2021/05/29 12:03:34 simonb Exp $
+#	$NetBSD: files,v 1.1286 2021/06/01 03:51:33 yamaguchi Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -292,6 +292,7 @@ defflag	opt_ppp.h		PPP_DEFLATE PPP_BSDCO
 defflag opt_pppoe.h		PPPOE_SERVER PPPOE_DEBUG
 defparam opt_pppoe.h		PPPOE_DEQUEUE_MAXLEN
 
+defflag opt_sppp.h		SPPP_IFDOWN_RECONNECT
 defparam opt_sppp.h		SPPP_KEEPALIVE_INTERVAL
 SPPP_NORECV_TIME
 SPPP_ALIVE_INTERVAL

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.247 src/sys/net/if_spppsubr.c:1.248
--- src/sys/net/if_spppsubr.c:1.247	Tue Jun  1 03:27:23 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 03:51:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.247 2021/06/01 03:27:23 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.248 2021/06/01 03:51:33 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.247 2021/06/01 03:27:23 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.248 2021/06/01 03:51:33 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1136,6 +1136,9 @@ sppp_attach(struct ifnet *ifp)
 	sp->pp_up = sppp_notify_up;
 	sp->pp_down = sppp_notify_down;
 	sp->pp_ncpflags = SPPP_NCP_IPCP | SPPP_NCP_IPV6CP;
+#ifdef SPPP_IFDOWN_RECONNECT
+	sp->pp_flags |= PP_LOOPBACK_IFDOWN | PP_KEEPALIVE_IFDOWN;
+#endif
 	sppp_wq_set(&sp->work_ifdown, sppp_ifdown, NULL);
 	memset(sp->scp, 0, sizeof(sp->scp));
 	rw_init(&sp->pp_lock);
@@ -1481,9 +1484,11 @@ sppp_cisco_input(struct sppp *sp, struct
 	ifp->if_xname);
 sp->pp_loopcnt = 0;
 
-sp->pp_flags |= PP_LOOPBACK;
-sppp_wq_add(sp->wq_cp,
-&sp->work_ifdown);
+if (sp->pp_flags & PP_LOOPBACK_IFDOWN) {
+	sp->pp_flags |= PP_LOOPBACK;
+	sppp_wq_add(sp->wq_cp,
+	&sp->work_ifdown);
+}
 
 sppp_wq_add(sp->wq_cp,
 &sp->scp[IDX_LCP].work_close);
@@ -1951,9 +1956,11 @@ sppp_cp_input(const struct cp *cp, struc
 			/* Line loopback mode detected. */
 			printf("%s: loopback\n", ifp->if_xname);
 
-			sp->pp_flags |= PP_LOOPBACK;
-			sppp_wq_add(sp->wq_cp,
-			&sp->work_ifdown);
+			if (sp->pp_flags & PP_LOOPBACK_IFDOWN) {
+sp->pp_flags |= PP_LOOPBACK;
+sppp_wq_add(sp->wq_cp,
+&sp->work_ifdown);
+			}
 
 			/* Shut down the PPP link. */
 			sppp_wq_add(sp->wq_cp,
@@ -3001,9 +3008,11 @@ sppp_lcp_confreq(struct sppp *sp, struct
 	ifp->if_xname);
 sp->pp_loopcnt = 0;
 
-sp->pp_flags |= PP_LOOPBACK;
-sppp_wq_add(sp->wq_cp,
-&sp->work_ifdown);
+if (sp->pp_flags & PP_LOOPBACK_IFDOWN) {
+	sp->pp_flags |= PP_LOOPBACK;
+	sppp_wq_add(sp->wq_cp,
+	&sp->work_ifdown);
+}
 
 sppp_wq_add(sp->wq_cp,
 &sp->scp[IDX_LCP].work_close);
@@ -5768,7 +5777,8 @@ sppp_keepalive(void *dummy)
 
 		if (sp->pp_alivecnt >= sp->pp_maxalive) {
 			/* No keepalive packets got.  Stop the interface. */
-			sppp_wq_add(sp->wq_cp, &sp->work_ifdown);
+			if (sp->pp_flags & PP_KEEPALIVE_IFDOWN)
+sppp_wq_add(sp->wq_cp, &sp->work_ifdown);
 
 			if (! (sp->pp_flags & PP_CISCO)) {
 printf("%s: LCP keepalive timed out, going to restart the connection\n",

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.39 src/sys/net/if_spppvar.h:1.40
--- src/sys/net/if_spppvar.h:1.39	Tue Jun  1 03:27:23 2021
+++ src/sys/net/if_spppvar.h	Tue Jun  1 03:51:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.39 2021/06/01 03:27:23 yamaguchi Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.40 2021/06/01 03:51:33 yamaguchi Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -203,15 +203,17 @@ struct sppp {
 	void	(*pp_chg)(struct sppp *, int);
 };
 
-#define PP_KEEPALIVE	0x01	/* use keepalive protocol */
-#define PP_CISCO	0x02	/* use Cisco protocol instead of PPP */
-/* 0x04 was PP_TIMO */
-#define PP_CALLIN	0x08	/* we are being called */
-#define PP_NEEDAUTH	0x10	/* remote requested authentication */
-#defi

CVS commit: src/sys/net

2021-05-31 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Jun  1 03:27:23 UTC 2021

Modified Files:
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
restart LCP when loopback packets are detected

In if_spppsubr.c down and up do not mean that LCP is stopping
or running, but mean that the lower layer of LCP is up or down.
And, restarting of LCP is had to use close event and open event.


To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.38 -r1.39 src/sys/net/if_spppvar.h

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.246 src/sys/net/if_spppsubr.c:1.247
--- src/sys/net/if_spppsubr.c:1.246	Wed May 19 02:14:19 2021
+++ src/sys/net/if_spppsubr.c	Tue Jun  1 03:27:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.246 2021/05/19 02:14:19 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.247 2021/06/01 03:27:23 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.246 2021/05/19 02:14:19 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.247 2021/06/01 03:27:23 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1480,15 +1480,18 @@ sppp_cisco_input(struct sppp *sp, struct
 printf ("%s: loopback\n",
 	ifp->if_xname);
 sp->pp_loopcnt = 0;
-if (ifp->if_flags & IFF_UP) {
-	SPPP_UNLOCK(sp);
-	if_down(ifp);
-	SPPP_LOCK(sp, RW_WRITER);
 
-	IF_PURGE(&sp->pp_cpq);
-}
+sp->pp_flags |= PP_LOOPBACK;
+sppp_wq_add(sp->wq_cp,
+&sp->work_ifdown);
+
+sppp_wq_add(sp->wq_cp,
+&sp->scp[IDX_LCP].work_close);
+sppp_wq_add(sp->wq_cp,
+&sp->scp[IDX_LCP].work_open);
+			} else {
+++sp->pp_loopcnt;
 			}
-			++sp->pp_loopcnt;
 
 			/* Generate new local sequence number */
 			sp->scp[IDX_LCP].seq = cprng_fast32();
@@ -1500,6 +1503,7 @@ sppp_cisco_input(struct sppp *sp, struct
 			SPPP_UNLOCK(sp);
 			if_up(ifp);
 			SPPP_LOCK(sp, RW_WRITER);
+			sp->pp_flags &= ~PP_LOOPBACK;
 		}
 		break;
 	case CISCO_ADDR_REQ:
@@ -1946,20 +1950,16 @@ sppp_cp_input(const struct cp *cp, struc
 		if (ntohl(u32) == sp->lcp.magic) {
 			/* Line loopback mode detected. */
 			printf("%s: loopback\n", ifp->if_xname);
-			/*
-			 * There is no change for items of sp->scp[cp->protoidx]
-			 * while if_down() even without SPPP_LOCK
-			 */
-			SPPP_UNLOCK(sp);
-			if_down(ifp);
-			SPPP_LOCK(sp, RW_WRITER);
 
-			IF_PURGE(&sp->pp_cpq);
+			sp->pp_flags |= PP_LOOPBACK;
+			sppp_wq_add(sp->wq_cp,
+			&sp->work_ifdown);
 
 			/* Shut down the PPP link. */
-			/* XXX */
-			sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_down);
-			sppp_wq_add(sp->wq_cp, &sp->scp[IDX_LCP].work_up);
+			sppp_wq_add(sp->wq_cp,
+			&sp->scp[IDX_LCP].work_close);
+			sppp_wq_add(sp->wq_cp,
+			&sp->scp[IDX_LCP].work_open);
 			break;
 		}
 		u32 = htonl(sp->lcp.magic);
@@ -3000,21 +3000,20 @@ sppp_lcp_confreq(struct sppp *sp, struct
 printf ("%s: loopback\n",
 	ifp->if_xname);
 sp->pp_loopcnt = 0;
-if (ifp->if_flags & IFF_UP) {
-	SPPP_UNLOCK(sp);
-	if_down(ifp);
-	SPPP_LOCK(sp, RW_WRITER);
 
-	IF_PURGE(&sp->pp_cpq);
-	/* XXX ? */
-	sppp_wq_add(sp->wq_cp,
-	&sp->scp[IDX_LCP].work_down);
-	sppp_wq_add(sp->wq_cp,
-	&sp->scp[IDX_LCP].work_up);
-}
-			} else if (debug)
-addlog(" [glitch]");
-			++sp->pp_loopcnt;
+sp->pp_flags |= PP_LOOPBACK;
+sppp_wq_add(sp->wq_cp,
+&sp->work_ifdown);
+
+sppp_wq_add(sp->wq_cp,
+&sp->scp[IDX_LCP].work_close);
+sppp_wq_add(sp->wq_cp,
+&sp->scp[IDX_LCP].work_open);
+			} else {
+if (debug)
+	addlog(" [glitch]");
+++sp->pp_loopcnt;
+			}
 			/*
 			 * We negate our magic here, and NAK it.  If
 			 * we see it later in an NAK packet, we
@@ -3351,22 +3350,34 @@ sppp_lcp_tlu(struct sppp *sp)
 {
 	STDDCL;
 	int i;
+	bool going_up;
 
 	KASSERT(SPPP_WLOCKED(sp));
 
 	/* unlock for IFNET_LOCK and if_up() */
 	SPPP_UNLOCK(sp);
 
-	/* XXX ? */
 	if (! (ifp->if_flags & IFF_UP) &&
 	(ifp->if_flags & IFF_RUNNING)) {
 		/* Coming out of loopback mode. */
+		going_up = true;
 		if_up(ifp);
+	} else {
+		going_up = false;
 	}
 
 	IFNET_LOCK(ifp);
 	SPPP_LOCK(sp, RW_WRITER);
 
+	if (going_up) {
+		if ((sp->pp_flags & PP_LOOPBACK) == 0) {
+			log(LOG_DEBUG, "%s: interface is going up, "
+			"but no loopback packet is deteted\n",
+			ifp->if_xname);
+		}
+		sp->pp_flags &= ~PP_LOOPBACK;
+	}
+
 	if (ifp->if_mtu > sp->lcp.their_mru) {
 		sp->pp_saved_mtu = ifp->if_mtu;
 		ifp->if_mtu = sp->lcp.their_mru;

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.38 src/sys/net/if_spppvar.h:1.39
--- src/sys/net/if_spppvar.h:1.38	Fri May 14 08:41:25 2021
+++ src/sys/net/if_spppvar.h	Tue Ju

CVS commit: src/lib/libcurses

2021-05-31 Thread Michael Forney
Module Name:src
Committed By:   mcf
Date:   Tue Jun  1 00:59:02 UTC 2021

Modified Files:
src/lib/libcurses: newwin.c

Log Message:
Fix initial line hash calculation for subwindows

lp->hash is not initialized at this point. Since the hash is
calculated in chunks using __hash_more(), it needs to be initialized
to 0 first (just as in doupdate()).

Detected with valgrind while running python's test suite when
debugging an unrelated issue.

ok uwe@


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/lib/libcurses/newwin.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/libcurses/newwin.c
diff -u src/lib/libcurses/newwin.c:1.59 src/lib/libcurses/newwin.c:1.60
--- src/lib/libcurses/newwin.c:1.59	Sat May 15 11:06:07 2021
+++ src/lib/libcurses/newwin.c	Tue Jun  1 00:59:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: newwin.c,v 1.59 2021/05/15 11:06:07 uwe Exp $	*/
+/*	$NetBSD: newwin.c,v 1.60 2021/06/01 00:59:01 mcf Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)newwin.c	8.3 (Berkeley) 7/27/94";
 #else
-__RCSID("$NetBSD: newwin.c,v 1.59 2021/05/15 11:06:07 uwe Exp $");
+__RCSID("$NetBSD: newwin.c,v 1.60 2021/06/01 00:59:01 mcf Exp $");
 #endif
 #endif/* not lint */
 
@@ -252,6 +252,7 @@ __set_subwin(WINDOW *orig, WINDOW *win)
 		lp->hash = __hash((char *)(void *)lp->line,
   (size_t)(win->maxx * __LDATASIZE));
 #else
+		lp->hash = 0;
 		for (cp = lp->line, j = 0; j < win->maxx; j++, cp++) {
 			lp->hash = __hash_more( &cp->ch,
 			sizeof( wchar_t ), lp->hash );



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

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun  1 00:30:22 UTC 2021

Modified Files:
src/sys/arch/arm/vfp: vfp_init.c

Log Message:
PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/arm/vfp/vfp_init.c

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

Modified files:

Index: src/sys/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.73 src/sys/arch/arm/vfp/vfp_init.c:1.74
--- src/sys/arch/arm/vfp/vfp_init.c:1.73	Tue Jun  1 00:13:19 2021
+++ src/sys/arch/arm/vfp/vfp_init.c	Tue Jun  1 00:30:22 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $ */
+/*  $NetBSD: vfp_init.c,v 1.74 2021/06/01 00:30:22 rin Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.74 2021/06/01 00:30:22 rin Exp $");
 
 #include 
 #include 
@@ -423,6 +423,7 @@ static int
 vfp_handler(u_int address, u_int insn, trapframe_t *frame, int fault_code)
 {
 	struct cpu_info * const ci = curcpu();
+	uint32_t fpexc;
 
 	/* This shouldn't ever happen.  */
 	if (fault_code != FAULT_USER &&
@@ -436,12 +437,19 @@ vfp_handler(u_int address, u_int insn, t
 
 	/* 
 	 * If we already own the FPU and it's enabled (and no exception), raise
-	 * SIGILL.  If there is an exception, drop through to raise a SIGFPE.
+	 * SIGILL.  If there is an exception, raise SIGFPE.
 	 */
-	if (curlwp->l_pcu_cpu[PCU_FPU] == ci
-	&& (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN) {
+	if (curlwp->l_pcu_cpu[PCU_FPU] == ci) {
 		KASSERT(ci->ci_pcu_curlwp[PCU_FPU] == curlwp);
-		return 1;
+
+		fpexc = armreg_fpexc_read();
+		if (fpexc & VFP_FPEXC_EN) {
+			if ((fpexc & VFP_FPEXC_EX) == 0) {
+return 1;	/* SIGILL */
+			} else {
+goto fpe;	/* SIGFPE; skip pcu_load(9) */
+			}
+		}
 	}
 
 	/*
@@ -449,11 +457,12 @@ vfp_handler(u_int address, u_int insn, t
 	 */
 	pcu_load(&arm_vfp_ops);
 
-	uint32_t fpexc = armreg_fpexc_read();
+	fpexc = armreg_fpexc_read();
 	if (fpexc & VFP_FPEXC_EX) {
 		ksiginfo_t ksi;
 		KASSERT(fpexc & VFP_FPEXC_EN);
 
+fpe:
 		curcpu()->ci_vfp_evs[2].ev_count++;
 
 		/*



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

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun  1 00:13:19 UTC 2021

Modified Files:
src/sys/arch/arm/vfp: vfp_init.c

Log Message:
PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/arm/vfp/vfp_init.c

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

Modified files:

Index: src/sys/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.72 src/sys/arch/arm/vfp/vfp_init.c:1.73
--- src/sys/arch/arm/vfp/vfp_init.c:1.72	Fri Oct 30 18:54:37 2020
+++ src/sys/arch/arm/vfp/vfp_init.c	Tue Jun  1 00:13:19 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfp_init.c,v 1.72 2020/10/30 18:54:37 skrll Exp $ */
+/*  $NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.72 2020/10/30 18:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $");
 
 #include 
 #include 
@@ -438,9 +438,11 @@ vfp_handler(u_int address, u_int insn, t
 	 * If we already own the FPU and it's enabled (and no exception), raise
 	 * SIGILL.  If there is an exception, drop through to raise a SIGFPE.
 	 */
-	if (curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp
-	&& (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN)
+	if (curlwp->l_pcu_cpu[PCU_FPU] == ci
+	&& (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN) {
+		KASSERT(ci->ci_pcu_curlwp[PCU_FPU] == curlwp);
 		return 1;
+	}
 
 	/*
 	 * Make sure we own the FP.



CVS commit: src

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 22:33:19 UTC 2021

Modified Files:
src/doc: HACKS
src/external/gpl3/gdb.old/lib/libgdb: Makefile
src/external/gpl3/gdb/lib/libgdb: Makefile

Log Message:
PR toolchain/55837

Get rid of -O0 hack for GDB for hard-float arm. This was necessary because
libunwind did not support s0-s31. Note that for *most* cases (not all!),
-O0 stops using VFP registers for general purposes.

Also note that this hack was incomplete. We had to compile every functions
with -O0, that can be unwinded. Otherwise, GDB crashed every time exceptions
were raised.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/doc/HACKS
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gdb.old/lib/libgdb/Makefile
cvs rdiff -u -r1.30 -r1.31 src/external/gpl3/gdb/lib/libgdb/Makefile

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.217 src/doc/HACKS:1.218
--- src/doc/HACKS:1.217	Sat May  8 12:27:21 2021
+++ src/doc/HACKS	Mon May 31 22:33:19 2021
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.217 2021/05/08 12:27:21 christos Exp $
+# $NetBSD: HACKS,v 1.218 2021/05/31 22:33:19 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -975,19 +975,6 @@ descr	Disable optimization on tc.c, loge
 	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"
 kcah
 
-port	arm
-hack	compile gdb/dwarf2{expr,loc}.c with -O0 for GCC[89] (PR/54820, 54877)
-cdate	Wed Apr 29 11:04:58 UTC 2020
-mdate	Thu Oct  8 17:00:00 JST 2020
-who	rin
-file	src/external/gpl3/gdb/lib/libgdb/Makefile: 1.22
-descr	For earmv7hf{,eb}, GCC 8.4 and 9.3 miscompile dwarf2expr.c with -O[21].
-	For earmv5hf{,eb}, GCC 9.3 miscompiles dwarf2{expr,loc}.c with -O2
-	(GCC9 -O1 and GCC8 -O2 work fine). These result in GDB crash with
-	``gdb_exception_RETURN_MASK_ERROR''. For everyone's safety, compile
-	these files with -O0 for all arm variants with GCC >= 8.
-kcah
-
 port	m68k
 hack	compile aes_ccm_tag() with -O0 for GCC8 and GCC9
 cdate	Mon Aug 10 06:27:29 UTC 2020

Index: src/external/gpl3/gdb.old/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.12 src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.13
--- src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.12	Fri May  7 12:19:48 2021
+++ src/external/gpl3/gdb.old/lib/libgdb/Makefile	Mon May 31 22:33:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2021/05/07 12:19:48 rin Exp $
+#	$NetBSD: Makefile,v 1.13 2021/05/31 22:33:19 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -54,16 +54,6 @@ CFLAGS:=		${CXXFLAGS} -std=gnu++11 -Wno-
 
 ada-exp.c: ada-lex.c
 
-.if ${MACHINE_CPU} == "arm"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-# GCC 8.4/9.3 miscompile this with -O[21] for earmv7hf{,eb}.
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.dwarf2expr.c+=	-O0
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.dwarf2loc.c+=	-O0
-. endif
-.endif
-
 # These are generated by implicit rules and are not easy to generate
 CLEANDIRFILES+= \
 	ada-exp.c ada-lex.c \

Index: src/external/gpl3/gdb/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb/lib/libgdb/Makefile:1.30 src/external/gpl3/gdb/lib/libgdb/Makefile:1.31
--- src/external/gpl3/gdb/lib/libgdb/Makefile:1.30	Sun May 30 02:23:25 2021
+++ src/external/gpl3/gdb/lib/libgdb/Makefile	Mon May 31 22:33:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2021/05/30 02:23:25 joerg Exp $
+#	$NetBSD: Makefile,v 1.31 2021/05/31 22:33:19 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -59,17 +59,6 @@ CFLAGS:=		${CXXFLAGS} -std=gnu++17 -Wno-
 
 ada-exp.c: ada-lex.c
 
-.if ${MACHINE_CPU} == "arm"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-# XXX taken from GDB 8.3; not tested for GDB 11:
-# GCC 8.4/9.3 miscompile this with -O[21] for earmv7hf{,eb}.
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.expr.c+=	-O0
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.loc.c+=	-O0
-. endif
-.endif
-
 .if ${MACHINE} == "vax"
 . if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
 COPTS.read.c+=	-O0



CVS commit: src/external/mit/xorg/server/drivers

2021-05-31 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 31 21:45:41 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers: Makefile.xf86-driver
src/external/mit/xorg/server/drivers/xf86-video-amdgpu: Makefile

Log Message:
Stop using -fcommon, xsrc should be fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 \
src/external/mit/xorg/server/drivers/Makefile.xf86-driver
cvs rdiff -u -r1.2 -r1.3 \
src/external/mit/xorg/server/drivers/xf86-video-amdgpu/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/drivers/Makefile.xf86-driver
diff -u src/external/mit/xorg/server/drivers/Makefile.xf86-driver:1.27 src/external/mit/xorg/server/drivers/Makefile.xf86-driver:1.28
--- src/external/mit/xorg/server/drivers/Makefile.xf86-driver:1.27	Mon Apr 12 03:57:06 2021
+++ src/external/mit/xorg/server/drivers/Makefile.xf86-driver	Mon May 31 21:45:41 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.xf86-driver,v 1.27 2021/04/12 03:57:06 mrg Exp $
+#	$NetBSD: Makefile.xf86-driver,v 1.28 2021/05/31 21:45:41 joerg Exp $
 
 LIBISMODULE=	yes
 SHLIB_MAJOR=	${PACKAGE_MAJOR}
@@ -49,9 +49,6 @@ CPPFLAGS+=	-DPACKAGE_VERSION_MINOR=${PAC
 CPPFLAGS+=	-DPACKAGE_VERSION_PATCHLEVEL=${PACKAGE_PATCH}
 CPPFLAGS+=	-DXORG_VERSION_CURRENT=${XORG_VERSION_CURRENT}
 
-# IOPortBase is particularly annoying to fix
-COPTS+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -fcommon :}
-
 .PATH:	${X11SRCDIR.${DRIVER}}/src
 .PATH:	${X11SRCDIR.${DRIVER}}/man
 .PATH:	${X11SRCDIR.${DRIVER}}

Index: src/external/mit/xorg/server/drivers/xf86-video-amdgpu/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-amdgpu/Makefile:1.2 src/external/mit/xorg/server/drivers/xf86-video-amdgpu/Makefile:1.3
--- src/external/mit/xorg/server/drivers/xf86-video-amdgpu/Makefile:1.2	Sun May 30 22:24:35 2021
+++ src/external/mit/xorg/server/drivers/xf86-video-amdgpu/Makefile	Mon May 31 21:45:41 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2021/05/30 22:24:35 joerg Exp $
+#	$NetBSD: Makefile,v 1.3 2021/05/31 21:45:41 joerg Exp $
 
 .include 
 
@@ -26,6 +26,5 @@ CPPFLAGS+=	-I${DESTDIR}${X11INCDIR}/X11 
 
 # XXX
 COPTS+=		-Wno-error
-COPTS+=		-fcommon
 
 .include "../Makefile.xf86-driver"



CVS commit: xsrc/external/mit

2021-05-31 Thread Joerg Sonnenberger
Module Name:xsrc
Committed By:   joerg
Date:   Mon May 31 21:44:20 UTC 2021

Modified Files:
xsrc/external/mit/xf86-video-amdgpu/dist/src: drmmode_display.h
xsrc/external/mit/xf86-video-ati-kms/dist/src: drmmode_display.h
xsrc/external/mit/xf86-video-chips/dist/util: AsmMacros.h
xsrc/external/mit/xf86-video-geode/dist/src: geode.h gx_video.c
lx_driver.c panel.c
xsrc/external/mit/xf86-video-geode/dist/src/panel: panel.c
xsrc/external/mit/xf86-video-intel-2014/dist/src/legacy/i810: i810.h
xsrc/external/mit/xf86-video-intel/dist/src/legacy/i810: i810.h
xsrc/external/mit/xf86-video-openchrome/dist/src: via_driver.h
via_sii164.h via_vt1632.h
xsrc/external/mit/xorg-server.old/dist/hw/xfree86/common: compiler.h
xsrc/external/mit/xorg-server/dist/hw/xfree86/common: compiler.h

Log Message:
Avoid multiple definitions of the same variable.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.7 -r1.2 \
xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h
cvs rdiff -u -r1.1.1.9 -r1.2 \
xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xf86-video-chips/dist/util/AsmMacros.h
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-geode/dist/src/geode.h \
xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-geode/dist/src/gx_video.c \
xsrc/external/mit/xf86-video-geode/dist/src/panel.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xf86-video-geode/dist/src/panel/panel.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xf86-video-intel-2014/dist/src/legacy/i810/i810.h
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xf86-video-intel/dist/src/legacy/i810/i810.h
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_sii164.h
cvs rdiff -u -r1.1.1.3 -r1.2 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_vt1632.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/hw/xfree86/common/compiler.h
cvs rdiff -u -r1.16 -r1.17 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/compiler.h

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

Modified files:

Index: xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h
diff -u xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h:1.1.1.7 xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h:1.2
--- xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h:1.1.1.7	Sat Jun  1 06:38:21 2019
+++ xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h	Mon May 31 21:44:19 2021
@@ -289,7 +289,7 @@ Bool drmmode_wait_vblank(xf86CrtcPtr crt
 			 uint64_t *ust, uint32_t *result_seq);
 
 
-miPointerSpriteFuncRec drmmode_sprite_funcs;
+extern miPointerSpriteFuncRec drmmode_sprite_funcs;
 
 
 #endif

Index: xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h
diff -u xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h:1.1.1.9 xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h:1.2
--- xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h:1.1.1.9	Sat Jun  1 07:24:16 2019
+++ xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h	Mon May 31 21:44:19 2021
@@ -262,7 +262,7 @@ Bool drmmode_wait_vblank(xf86CrtcPtr crt
 			 uint64_t *ust, uint32_t *result_seq);
 
 
-miPointerSpriteFuncRec drmmode_sprite_funcs;
+extern miPointerSpriteFuncRec drmmode_sprite_funcs;
 
 
 #endif

Index: xsrc/external/mit/xf86-video-chips/dist/util/AsmMacros.h
diff -u xsrc/external/mit/xf86-video-chips/dist/util/AsmMacros.h:1.1.1.2 xsrc/external/mit/xf86-video-chips/dist/util/AsmMacros.h:1.2
--- xsrc/external/mit/xf86-video-chips/dist/util/AsmMacros.h:1.1.1.2	Wed Jun 10 00:46:36 2009
+++ xsrc/external/mit/xf86-video-chips/dist/util/AsmMacros.h	Mon May 31 21:44:19 2021
@@ -129,7 +129,7 @@ unsigned long port;
 }
 #else
 #ifdef __arm32__
-unsigned int IOPortBase;  /* Memory mapped I/O port area */
+extern unsigned int IOPortBase;  /* Memory mapped I/O port area */
 
 static __inline__ void
 outb(port, val)

Index: xsrc/external/mit/xf86-video-geode/dist/src/geode.h
diff -u xsrc/external/mit/xf86-video-geode/dist/src/geode.h:1.6 xsrc/external/mit/xf86-video-geode/dist/src/geode.h:1.7
--- xsrc/external/mit/xf86-video-geode/dist/src/geode.h:1.6	Tue Jan  1 00:34:52 2019
+++ xsrc/external/mit/xf86-video-geode/dist/src/geode.h	Mon May 31 21:44:19 2021
@@ -343,7 +343,7 @@ typedef struct _geodeRec {
 
 /* option flags are self-explanatory */
 #ifdef HAVE_LX
-enum {
+enum LX_GeodeOpts {
 LX_OPTION_SW_CURSOR,
 LX_OPTION_HW_CURSOR,
 LX_OPTION_NOCOMPRESSION,
@@ -357,11 +357,11 @@ enum {
 LX_OPTION_FBSIZE,
 LX_OPTION_PANEL_MODE,

CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 21:31:34 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Stop using enum for flags, as per request from joerg.

#define constants and #undef after use.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.27 src/sys/lib/libunwind/Registers.hpp:1.28
--- src/sys/lib/libunwind/Registers.hpp:1.27	Mon May 31 12:12:24 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 21:31:33 2021
@@ -332,6 +332,11 @@ enum {
   REGNO_ARM32_S31 = 80,
 };
 
+#define	FLAGS_VFPV2_USED		0x1
+#define	FLAGS_VFPV3_USED		0x2
+#define	FLAGS_LEGACY_VFPV2_REGNO	0x4
+#define	FLAGS_EXTENDED_VFPV2_REGNO	0x8
+
 class Registers_arm32 {
 public:
   enum {
@@ -438,15 +443,13 @@ private:
   uint32_t reg[REGNO_ARM32_SPSR + 1];
   uint32_t flags;
   uint64_t fpreg[32];
-
-  enum {
-FLAGS_VFPV2_USED = 0x1,
-FLAGS_VFPV3_USED = 0x2,
-FLAGS_LEGACY_VFPV2_REGNO = 0x4,
-FLAGS_EXTENDED_VFPV2_REGNO = 0x8,
-  };
 };
 
+#undef	FLAGS_VFPV2_USED
+#undef	FLAGS_VFPV3_USED
+#undef	FLAGS_LEGACY_VFPV2_REGNO
+#undef	FLAGS_EXTENDED_VFPV2_REGNO
+
 enum {
   DWARF_VAX_R0 = 0,
   DWARF_VAX_R15 = 15,



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

2021-05-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 31 17:22:45 UTC 2021

Modified Files:
src/sys/arch/alpha/include: pmap.h

Log Message:
Additional comment about the range (0-1025) that's needed for the PT page
reference count, and thus now many bits we need to scare up.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/alpha/include/pmap.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/alpha/include/pmap.h
diff -u src/sys/arch/alpha/include/pmap.h:1.97 src/sys/arch/alpha/include/pmap.h:1.98
--- src/sys/arch/alpha/include/pmap.h:1.97	Mon May 31 17:16:05 2021
+++ src/sys/arch/alpha/include/pmap.h	Mon May 31 17:22:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.97 2021/05/31 17:16:05 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.98 2021/05/31 17:22:44 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -360,6 +360,10 @@ struct vm_page_md {
 	 * XXX These fields are only needed for pages that are used
 	 * as PT pages.  It would be nice to find safely-unused fields
 	 * in the vm_page structure that could be used instead.
+	 *
+	 * (Only 11 bits are needed ... we need to be able to count from
+	 * 0-1025 ... 1025 because sometimes we need to take an extra
+	 * reference temporarily in pmap_enter().)
 	 */
 	unsigned int pvh_physpgrefs;	/* # refs as a PT page */
 	unsigned int pvh_spare0;	/* XXX spare field */



CVS commit: src/sys/arch/alpha

2021-05-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 31 17:16:05 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: pmap.c
src/sys/arch/alpha/include: pmap.h

Log Message:
After a comment by joerg@, go back to using a dedicated field for the
PT page reference count, but add an XXX comment stating the desire to
find a safely-unused field in the vm_page structure when pages are in-
use as PT pages, so that we can save the 8 bytes per page needed for
this.


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/arch/alpha/alpha/pmap.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/alpha/include/pmap.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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.292 src/sys/arch/alpha/alpha/pmap.c:1.293
--- src/sys/arch/alpha/alpha/pmap.c:1.292	Sun May 30 19:50:23 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Mon May 31 17:16:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.292 2021/05/30 19:50:23 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.293 2021/05/31 17:16:04 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.292 2021/05/30 19:50:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.293 2021/05/31 17:16:04 thorpej Exp $");
 
 #include 
 #include 
@@ -507,8 +507,8 @@ pmap_pagelist_free(struct pmap_pagelist 
 
 	while ((pg = LIST_FIRST(list)) != NULL) {
 		LIST_REMOVE(pg, pageq.list);
-		/* Zap any fields we used internally. */
-		atomic_store_relaxed(&pg->loan_count, 0);
+		/* Fix up ref count; it's not always 0 when we get here. */
+		PHYSPAGE_REFCNT_SET(pg, 0);
 		uvm_pagefree(pg);
 	}
 }
@@ -1893,7 +1893,7 @@ pmap_remove_all(pmap_t pmap)
 
 	/* Fix up the reference count on the lev1map page. */
 	pg = PHYS_TO_VM_PAGE(ALPHA_K0SEG_TO_PHYS((vaddr_t)lev1map));
-	atomic_store_relaxed(&pg->loan_count, 0);
+	PHYSPAGE_REFCNT_SET(pg, 0);
 
 	/* Step 3 */
 	while ((pv = LIST_FIRST(&pmap->pm_pvents)) != NULL) {
@@ -3470,15 +3470,6 @@ pmap_pv_page_free(struct pool *pp, void 
 / misc. functions /
 
 /*
- * Pages that are in-use as page table pages should never be part
- * of a UVM loan, so we'll use that field for our PT page reference
- * count.
- */
-#define	PHYSPAGE_REFCNT(pg)	atomic_load_relaxed(&(pg)->loan_count)
-#define	PHYSPAGE_REFCNT_INC(pg)	atomic_inc_uint_nv(&(pg)->loan_count)
-#define	PHYSPAGE_REFCNT_DEC(pg)	atomic_dec_uint_nv(&(pg)->loan_count)
-
-/*
  * pmap_physpage_alloc:
  *
  *	Allocate a single page from the VM system and return the

Index: src/sys/arch/alpha/include/pmap.h
diff -u src/sys/arch/alpha/include/pmap.h:1.96 src/sys/arch/alpha/include/pmap.h:1.97
--- src/sys/arch/alpha/include/pmap.h:1.96	Sun May 30 19:41:59 2021
+++ src/sys/arch/alpha/include/pmap.h	Mon May 31 17:16:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.96 2021/05/30 19:41:59 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.97 2021/05/31 17:16:05 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -355,9 +355,26 @@ do {	\
  */
 #define	__HAVE_VM_PAGE_MD
 struct vm_page_md {
-	uintptr_t pvh_listx;			/* pv_entry list + attrs */
+	uintptr_t pvh_listx;		/* pv_entry list + attrs */
+	/*
+	 * XXX These fields are only needed for pages that are used
+	 * as PT pages.  It would be nice to find safely-unused fields
+	 * in the vm_page structure that could be used instead.
+	 */
+	unsigned int pvh_physpgrefs;	/* # refs as a PT page */
+	unsigned int pvh_spare0;	/* XXX spare field */
 };
 
+/* Reference counting for page table pages. */
+#define	PHYSPAGE_REFCNT(pg)		\
+	atomic_load_relaxed(&(pg)->mdpage.pvh_physpgrefs)
+#define	PHYSPAGE_REFCNT_SET(pg, v)	\
+	atomic_store_relaxed(&(pg)->mdpage.pvh_physpgrefs, (v))
+#define	PHYSPAGE_REFCNT_INC(pg)		\
+	atomic_inc_uint_nv(&(pg)->mdpage.pvh_physpgrefs)
+#define	PHYSPAGE_REFCNT_DEC(pg)		\
+	atomic_dec_uint_nv(&(pg)->mdpage.pvh_physpgrefs)
+
 #define	VM_MDPAGE_PVS(pg)		\
 	((struct pv_entry *)((pg)->mdpage.pvh_listx & ~3UL))
 



CVS commit: src/sys/arch

2021-05-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 31 14:38:57 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: param.h
src/sys/arch/alpha/include: param.h
src/sys/arch/cats/include: param.h
src/sys/arch/hppa/include: param.h
src/sys/arch/i386/include: param.h
src/sys/arch/ia64/include: param.h
src/sys/arch/m68k/include: param.h
src/sys/arch/macppc/include: param.h
src/sys/arch/mips/include: mips_param.h
src/sys/arch/powerpc/include: param.h
src/sys/arch/powerpc/include/ibm4xx: cpu.h
src/sys/arch/riscv/include: param.h
src/sys/arch/sgimips/include: param.h
src/sys/arch/sh3/include: param.h
src/sys/arch/sparc64/include: param.h
src/sys/arch/sun2/include: param.h
src/sys/arch/sun3/include: param.h
src/sys/arch/vax/include: param.h
src/sys/arch/x68k/include: param.h

Log Message:
Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include .


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/include/param.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/cats/include/param.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/hppa/include/param.h
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/i386/include/param.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/include/param.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/include/param.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/include/param.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/include/param.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/include/ibm4xx/cpu.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/include/param.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sgimips/include/param.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sh3/include/param.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sparc64/include/param.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sun2/include/param.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sun3/include/param.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/vax/include/param.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x68k/include/param.h

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

Modified files:

Index: src/sys/arch/aarch64/include/param.h
diff -u src/sys/arch/aarch64/include/param.h:1.15 src/sys/arch/aarch64/include/param.h:1.16
--- src/sys/arch/aarch64/include/param.h:1.15	Sun Jan 24 12:51:32 2021
+++ src/sys/arch/aarch64/include/param.h	Mon May 31 14:38:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.15 2021/01/24 12:51:32 jmcneill Exp $ */
+/* $NetBSD: param.h,v 1.16 2021/05/31 14:38:57 simonb Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_cputypes.h"
+#include "opt_param.h"
 #endif
 
 /*

Index: src/sys/arch/alpha/include/param.h
diff -u src/sys/arch/alpha/include/param.h:1.47 src/sys/arch/alpha/include/param.h:1.48
--- src/sys/arch/alpha/include/param.h:1.47	Sat Oct 10 21:59:03 2020
+++ src/sys/arch/alpha/include/param.h	Mon May 31 14:38:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.47 2020/10/10 21:59:03 thorpej Exp $ */
+/* $NetBSD: param.h,v 1.48 2021/05/31 14:38:55 simonb Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -38,6 +38,10 @@
  *	@(#)param.h	8.1 (Berkeley) 6/10/93
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
+
 /*
  * Machine dependent constants for the Alpha.
  */

Index: src/sys/arch/cats/include/param.h
diff -u src/sys/arch/cats/include/param.h:1.8 src/sys/arch/cats/include/param.h:1.9
--- src/sys/arch/cats/include/param.h:1.8	Wed Dec  1 06:47:16 2010
+++ src/sys/arch/cats/include/param.h	Mon May 31 14:38:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.8 2010/12/01 06:47:16 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.9 2021/05/31 14:38:55 simonb Exp $	*/
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
@@ -35,6 +35,10 @@
 #ifndef	_CATS_PARAM_H_
 #define	_CATS_PARAM_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
+
 /*
  * Machine dependent constants for ARM6+ processors
  */

Index: src/sys/arch/hppa/include/param.h
diff -u src/sys/arch/hppa/include/param.h:1.28 src/sys/arch/hppa/include/param.h:1.29
--- src/sys/arch/hppa/include/param.h:1.28	Sat May  8 13:10:29 2021
+++ src/sys/arch/hppa/include/param.h	Mon May 31 14:38:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.28 2021/05/08 13:10:29 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.29 2021/05/31 14:38:55 simonb Exp $	*/
 
 /*	$OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $	*/
 
@@ -27,6 +27,9 @@
 
 #ifdef _KERNEL
 #include 
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
 #endif
 
 /*

Index: src/sys/arch/i386/include/param.h
diff -u src/sys/arch/i386/include/param.h:1.87 src/sys/arch/i386/include/param.h:1.88
--- src/sys/arc

CVS commit: src/share/man/man9

2021-05-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 31 12:24:15 UTC 2021

Modified Files:
src/share/man/man9: delay.9

Log Message:
Use  in the synopsis rather than ; an MI
interface should be pulled in via .


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/delay.9

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

Modified files:

Index: src/share/man/man9/delay.9
diff -u src/share/man/man9/delay.9:1.7 src/share/man/man9/delay.9:1.8
--- src/share/man/man9/delay.9:1.7	Wed Jul 20 05:20:54 2011
+++ src/share/man/man9/delay.9	Mon May 31 12:24:15 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: delay.9,v 1.7 2011/07/20 05:20:54 jruoho Exp $
+.\" $NetBSD: delay.9,v 1.8 2021/05/31 12:24:15 simonb Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .Nm DELAY
 .Nd microsecond delay
 .Sh SYNOPSIS
-.In machine/param.h
+.In sys/param.h
 .Ft void
 .Fn delay "unsigned int us"
 .Ft void



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 12:12:24 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Bump LAST_REGISTER and LAST_RESTORE_REG to REGNO_ARM32_S31 for arm.

There are two numbering schemes for VFPv2 registers: s0-s31 and d0-d15.
The former is used by GCC, and the latter is by LLVM. Since libunwind was
derived from LLVM, it has never supported the former. This results in
crashes for GCC-compiled binaries in exception handler of C++, if it
encounters VFPv2 registers when unwinding frames.

This commit adds support for s0-s31 numbering to libunwind. I choose an
implementation in which VFPv2 registers are ``double-counted'' as s0-s31
AND d0-d15. This does not cause real problems, since the former is only
used by GCC, and the later is by LLVM. That is, different numbering
schemes cannot appear in a same frame. To make sure, assertions are added
in order to check this.

I've confirmed that no regression for ATF both for GCC- and LLVM-compiled
userlands.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.26 src/sys/lib/libunwind/Registers.hpp:1.27
--- src/sys/lib/libunwind/Registers.hpp:1.26	Mon May 31 11:57:28 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 12:12:24 2021
@@ -335,8 +335,8 @@ enum {
 class Registers_arm32 {
 public:
   enum {
-LAST_REGISTER = REGNO_ARM32_D31,
-LAST_RESTORE_REG = REGNO_ARM32_D31,
+LAST_REGISTER = REGNO_ARM32_S31,
+LAST_RESTORE_REG = REGNO_ARM32_S31,
 RETURN_OFFSET = 0,
 RETURN_MASK = 0,
   };
@@ -385,6 +385,14 @@ public:
 assert(validFloatVectorRegister(num));
 const void *addr = reinterpret_cast(addr_);
 if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
+  /*
+   * XXX
+   * There are two numbering schemes for VFPv2 registers: s0-s31
+   * (used by GCC) and d0-d15 (used by LLVM). We won't support both
+   * schemes simultaneously in a same frame.
+   */
+  assert((flags & FLAGS_EXTENDED_VFPV2_REGNO) == 0);
+  flags |= FLAGS_LEGACY_VFPV2_REGNO;
   if ((flags & FLAGS_VFPV2_USED) == 0) {
 lazyVFPv2();
 flags |= FLAGS_VFPV2_USED;
@@ -402,6 +410,12 @@ public:
 addr, sizeof(fpreg[0]) / 2);
 } else {
   if (num <= REGNO_ARM32_D15) {
+	/*
+	 * XXX
+	 * See XXX comment above.
+	 */
+assert((flags & FLAGS_LEGACY_VFPV2_REGNO) == 0);
+flags |= FLAGS_EXTENDED_VFPV2_REGNO;
 if ((flags & FLAGS_VFPV2_USED) == 0) {
   lazyVFPv2();
   flags |= FLAGS_VFPV2_USED;
@@ -428,6 +442,8 @@ private:
   enum {
 FLAGS_VFPV2_USED = 0x1,
 FLAGS_VFPV3_USED = 0x2,
+FLAGS_LEGACY_VFPV2_REGNO = 0x4,
+FLAGS_EXTENDED_VFPV2_REGNO = 0x8,
   };
 };
 



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:57:28 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Fix logic error in copyFloatVectorRegister() for arm; copy s0-s31 or
d0-d31, not both.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.25 src/sys/lib/libunwind/Registers.hpp:1.26
--- src/sys/lib/libunwind/Registers.hpp:1.25	Mon May 31 11:54:01 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:57:28 2021
@@ -400,19 +400,20 @@ public:
 #endif
   memcpy((uint8_t *)(fpreg + dnum) + part * sizeof(fpreg[0]) / 2,
 addr, sizeof(fpreg[0]) / 2);
-}
-if (num <= REGNO_ARM32_D15) {
-  if ((flags & FLAGS_VFPV2_USED) == 0) {
-lazyVFPv2();
-flags |= FLAGS_VFPV2_USED;
-  }
 } else {
-  if ((flags & FLAGS_VFPV3_USED) == 0) {
-lazyVFPv3();
-flags |= FLAGS_VFPV3_USED;
+  if (num <= REGNO_ARM32_D15) {
+if ((flags & FLAGS_VFPV2_USED) == 0) {
+  lazyVFPv2();
+  flags |= FLAGS_VFPV2_USED;
+}
+  } else {
+if ((flags & FLAGS_VFPV3_USED) == 0) {
+  lazyVFPv3();
+  flags |= FLAGS_VFPV3_USED;
+}
   }
+  memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
 }
-memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
   }
 
   __dso_hidden void lazyVFPv2();



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:54:01 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Fix pointer arithmetic when copying s0-s31 registers for arm.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.24 src/sys/lib/libunwind/Registers.hpp:1.25
--- src/sys/lib/libunwind/Registers.hpp:1.24	Mon May 31 11:50:43 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:54:01 2021
@@ -398,7 +398,7 @@ public:
 #if _BYTE_ORDER == _BIG_ENDIAN
   part = 1 - part;
 #endif
-  memcpy(fpreg + dnum + part * sizeof(fpreg[0]) / 2,
+  memcpy((uint8_t *)(fpreg + dnum) + part * sizeof(fpreg[0]) / 2,
 addr, sizeof(fpreg[0]) / 2);
 }
 if (num <= REGNO_ARM32_D15) {



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:50:43 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Fix DWARF/internal register numbers of s31 for arm.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.23 src/sys/lib/libunwind/Registers.hpp:1.24
--- src/sys/lib/libunwind/Registers.hpp:1.23	Mon May 31 11:44:06 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:50:43 2021
@@ -318,7 +318,7 @@ enum {
   DWARF_ARM32_R15 = 15,
   DWARF_ARM32_SPSR = 128,
   DWARF_ARM32_S0 = 64,
-  DWARF_ARM32_S31 = 91,
+  DWARF_ARM32_S31 = 95,
   DWARF_ARM32_D0 = 256,
   DWARF_ARM32_D31 = 287,
   REGNO_ARM32_R0 = 0,
@@ -329,7 +329,7 @@ enum {
   REGNO_ARM32_D15 = 32,
   REGNO_ARM32_D31 = 48,
   REGNO_ARM32_S0 = 49,
-  REGNO_ARM32_S31 = 70,
+  REGNO_ARM32_S31 = 80,
 };
 
 class Registers_arm32 {



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:47:18 UTC 2021

Modified Files:
src/sys/lib/libunwind: unwind_registers.S

Log Message:
PR toolchain/55837

Fix for jumpto() armeb; use word-wise load for flags, instead of byte-wise one.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libunwind/unwind_registers.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/lib/libunwind/unwind_registers.S
diff -u src/sys/lib/libunwind/unwind_registers.S:1.19 src/sys/lib/libunwind/unwind_registers.S:1.20
--- src/sys/lib/libunwind/unwind_registers.S:1.19	Mon May 31 11:41:22 2021
+++ src/sys/lib/libunwind/unwind_registers.S	Mon May 31 11:47:18 2021
@@ -380,7 +380,7 @@ END(_ZN7_Unwind15Registers_arm329lazyVFP
 
 	.hidden _ZNK7_Unwind15Registers_arm326jumptoEv
 ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv)
-	ldrb	r1, [r0, #68]	/* flags */
+	ldr	r1, [r0, #68]	/* flags */
 	tst	r1, #1
 	beq	.Lnovfpv2
 	add	r2, r0, #72



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:44:07 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

copyFloatVectorRegister(): Assert register number is valid to make sure.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.22 src/sys/lib/libunwind/Registers.hpp:1.23
--- src/sys/lib/libunwind/Registers.hpp:1.22	Mon May 31 11:41:22 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:44:06 2021
@@ -382,6 +382,7 @@ public:
   }
 
   void copyFloatVectorRegister(int num, uint64_t addr_) {
+assert(validFloatVectorRegister(num));
 const void *addr = reinterpret_cast(addr_);
 if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
   if ((flags & FLAGS_VFPV2_USED) == 0) {



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:41:22 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp unwind_registers.S

Log Message:
PR toolchain/55837

Misc style fixes for clarity:

- Rename lazyVFP1() and lazyVFP3() to lazyVFPv2() and lazyVFPv3(),
  respectively. Note that VFPv1 was obsoleted and replaced by VFPv2.

- Introduce enum for flags.

- Add few comments.

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/lib/libunwind/Registers.hpp
cvs rdiff -u -r1.18 -r1.19 src/sys/lib/libunwind/unwind_registers.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/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.21 src/sys/lib/libunwind/Registers.hpp:1.22
--- src/sys/lib/libunwind/Registers.hpp:1.21	Tue Feb 23 15:09:27 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:41:22 2021
@@ -350,9 +350,8 @@ public:
   return REGNO_ARM32_SPSR;
 if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31)
   return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0);
-if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31) {
+if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31)
   return REGNO_ARM32_S0 + (num - DWARF_ARM32_S0);
-}
 return LAST_REGISTER + 1;
   }
 
@@ -385,9 +384,9 @@ public:
   void copyFloatVectorRegister(int num, uint64_t addr_) {
 const void *addr = reinterpret_cast(addr_);
 if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
-  if ((flags & 1) == 0) {
-lazyVFP1();
-flags |= 1;
+  if ((flags & FLAGS_VFPV2_USED) == 0) {
+lazyVFPv2();
+flags |= FLAGS_VFPV2_USED;
   }
   /*
* Emulate single precision register as half of the
@@ -402,27 +401,32 @@ public:
 addr, sizeof(fpreg[0]) / 2);
 }
 if (num <= REGNO_ARM32_D15) {
-  if ((flags & 1) == 0) {
-lazyVFP1();
-flags |= 1;
+  if ((flags & FLAGS_VFPV2_USED) == 0) {
+lazyVFPv2();
+flags |= FLAGS_VFPV2_USED;
   }
 } else {
-  if ((flags & 2) == 0) {
-lazyVFP3();
-flags |= 2;
+  if ((flags & FLAGS_VFPV3_USED) == 0) {
+lazyVFPv3();
+flags |= FLAGS_VFPV3_USED;
   }
 }
 memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
   }
 
-  __dso_hidden void lazyVFP1();
-  __dso_hidden void lazyVFP3();
+  __dso_hidden void lazyVFPv2();
+  __dso_hidden void lazyVFPv3();
   __dso_hidden void jumpto() const __dead;
 
 private:
   uint32_t reg[REGNO_ARM32_SPSR + 1];
   uint32_t flags;
   uint64_t fpreg[32];
+
+  enum {
+FLAGS_VFPV2_USED = 0x1,
+FLAGS_VFPV3_USED = 0x2,
+  };
 };
 
 enum {

Index: src/sys/lib/libunwind/unwind_registers.S
diff -u src/sys/lib/libunwind/unwind_registers.S:1.18 src/sys/lib/libunwind/unwind_registers.S:1.19
--- src/sys/lib/libunwind/unwind_registers.S:1.18	Tue Feb 23 15:09:27 2021
+++ src/sys/lib/libunwind/unwind_registers.S	Mon May 31 11:41:22 2021
@@ -360,37 +360,37 @@ ARM_ENTRY(_ZN7_Unwind15Registers_arm32C1
 	mrs	r1, cpsr
 	str	r1, [r0, #64]	/* CPSR */
 	mov	r1, #0
-	str	r1, [r0, #68]
+	str	r1, [r0, #68]	/* flags */
 	RET
 END(_ZN7_Unwind15Registers_arm32C1Ev)
 
-	.hidden _ZN7_Unwind15Registers_arm328lazyVFP1Ev
-ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
+	.hidden _ZN7_Unwind15Registers_arm329lazyVFPv2Ev
+ARM_ENTRY(_ZN7_Unwind15Registers_arm329lazyVFPv2Ev)
 	add	r0, #72
 	vstmia	r0, {d0-d15}
 	RET
-END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
+END(_ZN7_Unwind15Registers_arm329lazyVFPv2Ev)
 
-	.hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev
-ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
+	.hidden _ZN7_Unwind15Registers_arm329lazyVFPv3Ev
+ARM_ENTRY(_ZN7_Unwind15Registers_arm329lazyVFPv3Ev)
 	add	r0, #200
 	vstmia	r0, {d16-d31}
 	RET
-END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
+END(_ZN7_Unwind15Registers_arm329lazyVFPv3Ev)
 
 	.hidden _ZNK7_Unwind15Registers_arm326jumptoEv
 ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv)
-	ldrb	r1, [r0, #68]
+	ldrb	r1, [r0, #68]	/* flags */
 	tst	r1, #1
-	beq	.Lnovfp1
+	beq	.Lnovfpv2
 	add	r2, r0, #72
 	vldmia	r2, {d0-d15}
-.Lnovfp1:
+.Lnovfpv2:
 	tst	r1, #2
-	beq	.Lnovfp3
+	beq	.Lnovfpv3
 	add	r2, r0, #200
 	vldmia	r2, {d16-d31}
-.Lnovfp3:
+.Lnovfpv3:
 	ldr	r1, [r0, #64]
 	msr	cpsr_sxc, r1
 	ldmia	r0, {r0-r15}



CVS commit: src/sys/stand/efiboot

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:12:42 UTC 2021

Modified Files:
src/sys/stand/efiboot: boot.c

Log Message:
Generalize boot.cfg workaround for ISO9660; fallback to default_device
whenever efi_file_path() fails (due to broken firmware), in addition to
the case of ISO9660 (for which efi_file_path() succeeds but does not
work correctly).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/boot.c

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

Modified files:

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.29 src/sys/stand/efiboot/boot.c:1.30
--- src/sys/stand/efiboot/boot.c:1.29	Sat Nov 28 14:02:09 2020
+++ src/sys/stand/efiboot/boot.c	Mon May 31 11:12:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.29 2020/11/28 14:02:09 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.30 2021/05/31 11:12:42 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -132,22 +132,18 @@ const struct boot_command commands[] = {
 static int
 bootcfg_path(char *pathbuf, size_t pathbuflen)
 {
-	/*
-	 * Special handling of boot.cfg on ISO9660 because fs protocol doesn't
-	 * seem to work.
-	 */
-	if (default_fstype == FS_ISO9660) {
-		snprintf(pathbuf, pathbuflen, "%s:%s", default_device, BOOTCFG_FILENAME);
-		return 0;
-	}
 
 	/*
-	 * Fall back to fs protocol for loading boot.cfg
+	 * Fallback to default_device
+	 * - for ISO9660 (efi_file_path() succeeds but does not work correctly)
+	 * - or whenever efi_file_path() fails (due to broken firmware)
 	 */
-	if (efi_bootdp == NULL)
-		return ENXIO;
+	if (default_fstype == FS_ISO9660 || efi_bootdp == NULL ||
+	efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, pathbuflen))
+		snprintf(pathbuf, pathbuflen, "%s:%s", default_device,
+		BOOTCFG_FILENAME);
 
-	return efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, pathbuflen);
+	return 0;
 }
 
 void



CVS commit: src/sys/uvm

2021-05-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 31 10:57:02 UTC 2021

Modified Files:
src/sys/uvm: uvm_extern.h

Log Message:
uvm: Make uvm_extern.h (more) self-contained, needs sys/types.h.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/sys/uvm/uvm_extern.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/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.231 src/sys/uvm/uvm_extern.h:1.232
--- src/sys/uvm/uvm_extern.h:1.231	Fri Aug 14 09:06:15 2020
+++ src/sys/uvm/uvm_extern.h	Mon May 31 10:57:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.231 2020/08/14 09:06:15 chs Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.232 2021/05/31 10:57:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -72,6 +72,8 @@
  * NOTE: vm system calls are prototyped in syscallargs.h
  */
 
+#include 
+
 /*
  * defines
  */



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

2021-05-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 31 10:33:04 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/include/asm: processor.h
src/sys/external/bsd/drm2/include/linux: delay.h

Log Message:
drm: sys/param.h, not machine/param.h, for DELAY.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/asm/processor.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/delay.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/processor.h
diff -u src/sys/external/bsd/drm2/include/asm/processor.h:1.3 src/sys/external/bsd/drm2/include/asm/processor.h:1.4
--- src/sys/external/bsd/drm2/include/asm/processor.h:1.3	Wed Sep 17 15:46:57 2014
+++ src/sys/external/bsd/drm2/include/asm/processor.h	Mon May 31 10:33:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: processor.h,v 1.3 2014/09/17 15:46:57 riastradh Exp $	*/
+/*	$NetBSD: processor.h,v 1.4 2021/05/31 10:33:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #ifndef _ASM_PROCESSOR_H_
 #define _ASM_PROCESSOR_H_
 
-#include 
+#include 
 
 #define	cpu_relax()	DELAY(1)	/* XXX */
 

Index: src/sys/external/bsd/drm2/include/linux/delay.h
diff -u src/sys/external/bsd/drm2/include/linux/delay.h:1.6 src/sys/external/bsd/drm2/include/linux/delay.h:1.7
--- src/sys/external/bsd/drm2/include/linux/delay.h:1.6	Fri Feb 14 09:35:40 2020
+++ src/sys/external/bsd/drm2/include/linux/delay.h	Mon May 31 10:33:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: delay.h,v 1.6 2020/02/14 09:35:40 riastradh Exp $	*/
+/*	$NetBSD: delay.h,v 1.7 2021/05/31 10:33:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,8 +36,6 @@
 #include 
 #include 
 
-#include 
-
 #define	MAX_UDELAY_MS	5
 
 static inline void



CVS commit: src/distrib/i386/installimage

2021-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 31 07:59:02 UTC 2021

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

Log Message:
bump slightly harder


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

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

Modified files:

Index: src/distrib/i386/installimage/Makefile
diff -u src/distrib/i386/installimage/Makefile:1.20 src/distrib/i386/installimage/Makefile:1.21
--- src/distrib/i386/installimage/Makefile:1.20	Sun May 30 09:54:56 2021
+++ src/distrib/i386/installimage/Makefile	Mon May 31 07:59:02 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.20 2021/05/30 09:54:56 martin Exp $
+#	$NetBSD: Makefile,v 1.21 2021/05/31 07:59:02 martin Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-i386-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	2000			# for all installation binaries
+INSTIMAGEMB?=	2100			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot