CVS commit: src/sys/dev/usb

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 21:37:07 UTC 2022

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

Log Message:
usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:

- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, 
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).

Proposed on tech-net:
https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/usbnet.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/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.43 src/sys/dev/usb/usbnet.c:1.44
--- src/sys/dev/usb/usbnet.c:1.43	Sat Dec 11 19:24:21 2021
+++ src/sys/dev/usb/usbnet.c	Sat Jan 29 21:37:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.43 2021/12/11 19:24:21 mrg Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.44 2022/01/29 21:37:07 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.43 2021/12/11 19:24:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.44 2022/01/29 21:37:07 riastradh Exp $");
 
 #include 
 #include 
@@ -72,6 +72,7 @@ struct usbnet_private {
 
 	struct ethercom		unp_ec;
 	struct mii_data		unp_mii;
+	struct usb_task		unp_mcasttask;
 	struct usb_task		unp_ticktask;
 	struct callout		unp_stat_ch;
 	struct usbd_pipe	*unp_ep[USBNET_ENDPT_MAX];
@@ -1035,12 +1036,64 @@ usbnet_if_ioctl(struct ifnet *ifp, u_lon
 		return uno_override_ioctl(un, ifp, cmd, data);
 
 	error = ether_ioctl(ifp, cmd, data);
-	if (error == ENETRESET)
-		error = uno_ioctl(un, ifp, cmd, data);
+	if (error == ENETRESET) {
+		switch (cmd) {
+		case SIOCADDMULTI:
+		case SIOCDELMULTI:
+			usb_add_task(un->un_udev, >unp_mcasttask,
+			USB_TASKQ_DRIVER);
+			error = 0;
+			break;
+		default:
+			error = uno_ioctl(un, ifp, cmd, data);
+		}
+	}
 
 	return error;
 }
 
+static void
+usbnet_mcast_task(void *arg)
+{
+	USBNETHIST_FUNC();
+	struct usbnet * const un = arg;
+	struct usbnet_private * const unp = un->un_pri;
+	struct ifnet * const ifp = usbnet_ifp(un);
+	bool dying;
+	struct ifreq ifr;
+
+	USBNETHIST_CALLARGSN(10, "%jd: enter", unp->unp_number, 0, 0, 0);
+
+	/*
+	 * If we're detaching, we must check unp_dying _before_
+	 * touching IFNET_LOCK -- the ifnet may have been detached by
+	 * the time this task runs.  This is racy -- unp_dying may be
+	 * set immediately after we test it -- but nevertheless safe,
+	 * because usbnet_detach waits for the task to complete before
+	 * issuing if_detach, and necessary, so that we don't touch
+	 * IFNET_LOCK after if_detach.  See usbnet_detach for details.
+	 */
+	mutex_enter(>unp_core_lock);
+	dying = unp->unp_dying;
+	mutex_exit(>unp_core_lock);
+	if (dying)
+		return;
+
+	/*
+	 * Pass a bogus ifr with SIOCDELMULTI -- the goal is to just
+	 * notify the driver to reprogram any hardware multicast
+	 * filter, according to what's already stored in the ethercom.
+	 * None of the drivers actually examine this argument, so it
+	 * doesn't change the ABI as far as they can tell.
+	 */
+	IFNET_LOCK(ifp);
+	if (ifp->if_flags & IFF_RUNNING) {
+		memset(, 0, sizeof(ifr));
+		(void)uno_ioctl(un, ifp, SIOCDELMULTI, );
+	}
+	IFNET_UNLOCK(ifp);
+}
+
 /*
  * Generic stop network function:
  *	- mark as stopping
@@ -1373,7 +1426,10 @@ 

CVS commit: src/sys/dev/usb

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 21:37:07 UTC 2022

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

Log Message:
usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:

- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, 
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).

Proposed on tech-net:
https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/usbnet.c

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



CVS commit: src/sys/dev/usb

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 21:36:12 UTC 2022

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

Log Message:
xhci(4): Fix handling of endpoint reset/stop.

Use the same asynchronous task resetting a stalled/halted endpoint
and stopping a running endpoint -- either way we need to put the
endpoint back into a known state and, if there are transfers waiting
to run, start them up again.

- xhci_abortx must not drop the pipe (bus) lock -- usbdi(9) requires
  this.  So arrange to stop the endpoint and empty the queue
  asynchronously.

- If the xhci softint claims an xfer for completion with
  usbd_xfer_trycomplete, it must call usb_transfer_complete without
  ever releasing the pipe (bus) lock -- it can't claim the xfer and
  then defer the usb_transfer_complete to a task.  So arrange to
  reset the endpoint asynchronously, hold up new transfers until the
  endpoint has been reset, and then do usb_transfer_complete
  immediately.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.154 src/sys/dev/usb/xhci.c:1.155
--- src/sys/dev/usb/xhci.c:1.154	Tue Jan 25 11:17:39 2022
+++ src/sys/dev/usb/xhci.c	Sat Jan 29 21:36:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.154 2022/01/25 11:17:39 msaitoh Exp $	*/
+/*	$NetBSD: xhci.c,v 1.155 2022/01/29 21:36:12 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.154 2022/01/25 11:17:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.155 2022/01/29 21:36:12 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -154,15 +154,18 @@ static usbd_status xhci_new_device(devic
 static int xhci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *,
 void *, int);
 
+static void xhci_pipe_async_task(void *);
+static void xhci_pipe_restart(struct usbd_pipe *);
+
 static usbd_status xhci_configure_endpoint(struct usbd_pipe *);
 //static usbd_status xhci_unconfigure_endpoint(struct usbd_pipe *);
-static usbd_status xhci_reset_endpoint(struct usbd_pipe *);
+static void xhci_reset_endpoint(struct usbd_pipe *);
 static usbd_status xhci_stop_endpoint_cmd(struct xhci_softc *,
 struct xhci_slot *, u_int, uint32_t);
 static usbd_status xhci_stop_endpoint(struct usbd_pipe *);
 
 static void xhci_host_dequeue(struct xhci_ring * const);
-static usbd_status xhci_set_dequeue(struct usbd_pipe *);
+static void xhci_set_dequeue(struct usbd_pipe *);
 
 static usbd_status xhci_do_command(struct xhci_softc * const,
 struct xhci_soft_trb * const, int);
@@ -1858,14 +1861,13 @@ xhci_unconfigure_endpoint(struct usbd_pi
 #endif
 
 /* 4.6.8, 6.4.3.7 */
-static usbd_status
-xhci_reset_endpoint_locked(struct usbd_pipe *pipe)
+static void
+xhci_reset_endpoint(struct usbd_pipe *pipe)
 {
 	struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 	struct xhci_soft_trb trb;
-	usbd_status err;
 
 	XHCIHIST_FUNC();
 	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
@@ -1878,21 +1880,10 @@ xhci_reset_endpoint_locked(struct usbd_p
 	XHCI_TRB_3_EP_SET(dci) |
 	XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_RESET_EP);
 
-	err = xhci_do_command_locked(sc, , USBD_DEFAULT_TIMEOUT);
-
-	return err;
-}
-
-static usbd_status
-xhci_reset_endpoint(struct usbd_pipe *pipe)
-{
-	struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
-
-	mutex_enter(>sc_lock);
-	usbd_status ret = xhci_reset_endpoint_locked(pipe);
-	mutex_exit(>sc_lock);
-
-	return ret;
+	if (xhci_do_command_locked(sc, , USBD_DEFAULT_TIMEOUT)) {
+		device_printf(sc->sc_dev, "%s: endpoint 0x%x: timed out\n",
+		__func__, pipe->up_endpoint->ue_edesc->bEndpointAddress);
+	}
 }
 
 /*
@@ -1947,15 +1938,14 @@ xhci_stop_endpoint(struct usbd_pipe *pip
  * EPSTATE of endpoint must be ERROR or STOPPED, otherwise CONTEXT_STATE
  * error will be generated.
  */
-static usbd_status
-xhci_set_dequeue_locked(struct usbd_pipe *pipe)
+static void
+xhci_set_dequeue(struct usbd_pipe *pipe)
 {
 	struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 	struct xhci_ring * const xr = xs->xs_xr[dci];
 	struct xhci_soft_trb trb;
-	usbd_status err;
 
 	XHCIHIST_FUNC();
 	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
@@ -1972,21 +1962,10 @@ xhci_set_dequeue_locked(struct usbd_pipe
 	XHCI_TRB_3_EP_SET(dci) |
 	XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_SET_TR_DEQUEUE);
 
-	err = xhci_do_command_locked(sc, , USBD_DEFAULT_TIMEOUT);
-
-	return err;
-}
-
-static usbd_status
-xhci_set_dequeue(struct usbd_pipe *pipe)
-{
-	struct xhci_softc * const sc = 

CVS commit: src/sys/dev/usb

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 21:36:12 UTC 2022

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

Log Message:
xhci(4): Fix handling of endpoint reset/stop.

Use the same asynchronous task resetting a stalled/halted endpoint
and stopping a running endpoint -- either way we need to put the
endpoint back into a known state and, if there are transfers waiting
to run, start them up again.

- xhci_abortx must not drop the pipe (bus) lock -- usbdi(9) requires
  this.  So arrange to stop the endpoint and empty the queue
  asynchronously.

- If the xhci softint claims an xfer for completion with
  usbd_xfer_trycomplete, it must call usb_transfer_complete without
  ever releasing the pipe (bus) lock -- it can't claim the xfer and
  then defer the usb_transfer_complete to a task.  So arrange to
  reset the endpoint asynchronously, hold up new transfers until the
  endpoint has been reset, and then do usb_transfer_complete
  immediately.


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

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



CVS commit: src/usr.bin/make

2022-01-29 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jan 29 20:54:58 UTC 2022

Modified Files:
src/usr.bin/make: make.1

Log Message:
Tweak description of local variable assignments


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/usr.bin/make/make.1

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/make/make.1
diff -u src/usr.bin/make/make.1:1.303 src/usr.bin/make/make.1:1.304
--- src/usr.bin/make/make.1:1.303	Sat Jan 29 07:42:10 2022
+++ src/usr.bin/make/make.1	Sat Jan 29 20:54:58 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.303 2022/01/29 07:42:10 sjg Exp $
+.\"	$NetBSD: make.1,v 1.304 2022/01/29 20:54:58 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -715,10 +715,11 @@ of those targets out-of-date.
 target local variable assignments behave differently in that;
 .Bl -tag -width Ds -offset indent
 .It Ic \&+=
-Only behaves as expected, if there is a previous
-local assignment for the same target and variable.
+Only appends to a previous local assignment
+for the same target and variable.
 .It Ic \&:=
-Is redundant since, the entire dependency line has already been expanded.
+Is redundant with respect to Global variables,
+which have already been expanded.
 .El
 .Pp
 The seven built-in local variables are as follows:



CVS commit: src/usr.bin/make

2022-01-29 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jan 29 20:54:58 UTC 2022

Modified Files:
src/usr.bin/make: make.1

Log Message:
Tweak description of local variable assignments


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/usr.bin/make/make.1

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



CVS commit: src/lib/libedit

2022-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 29 20:52:45 UTC 2022

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

Log Message:
Add more refreshes from Walter Lozano. The readline example in
http://www.mcld.co.uk/blog/2009/simple-gnu-readline-callback-style-example.html
still does not work, but it is better.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/lib/libedit/readline.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/readline.c
diff -u src/lib/libedit/readline.c:1.169 src/lib/libedit/readline.c:1.170
--- src/lib/libedit/readline.c:1.169	Tue Jan 11 13:30:15 2022
+++ src/lib/libedit/readline.c	Sat Jan 29 15:52:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.169 2022/01/11 18:30:15 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.170 2022/01/29 20:52:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.169 2022/01/11 18:30:15 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.170 2022/01/29 20:52:45 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -2149,6 +2149,7 @@ rl_callback_read_char(void)
 			wbuf = NULL;
 		(*(void (*)(const char *))rl_linefunc)(wbuf);
 	}
+	_rl_update_pos();
 }
 
 void
@@ -2176,6 +2177,7 @@ rl_redisplay(void)
 	a[0] = (char)e->el_tty.t_c[TS_IO][C_REPRINT];
 	a[1] = '\0';
 	el_push(e, a);
+	rl_forced_update_display();
 }
 
 int
@@ -2355,7 +2357,7 @@ rl_message(const char *format, ...)
 	va_end(args);
 
 	rl_set_prompt(msg);
-	rl_redisplay();
+	rl_forced_update_display();
 }
 
 void



CVS commit: src/lib/libedit

2022-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 29 20:52:45 UTC 2022

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

Log Message:
Add more refreshes from Walter Lozano. The readline example in
http://www.mcld.co.uk/blog/2009/simple-gnu-readline-callback-style-example.html
still does not work, but it is better.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/lib/libedit/readline.c

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



CVS commit: src/sys/kern

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 20:35:11 UTC 2022

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

Log Message:
pmf(9): Conditionalize pmflock_debug output on PMFLOCK_DEBUG.

This is really only helpful for debugging the software logic to
handle the trees of devices for suspend/resume, not for debugging the
drivers, which is most of what we need to do.  If anyone still finds
this useful they can make a sysctl knob for it or something, but for
now this substantially reduces the amount of debug output that's
getting in my way.


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

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

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.291 src/sys/kern/subr_autoconf.c:1.292
--- src/sys/kern/subr_autoconf.c:1.291	Fri Dec 31 14:19:57 2021
+++ src/sys/kern/subr_autoconf.c	Sat Jan 29 20:35:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.291 2021/12/31 14:19:57 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.292 2022/01/29 20:35:11 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.291 2021/12/31 14:19:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.292 2022/01/29 20:35:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2939,15 +2939,6 @@ device_pmf_driver_register(device_t dev,
 	return true;
 }
 
-static const char *
-curlwp_name(void)
-{
-	if (curlwp->l_name != NULL)
-		return curlwp->l_name;
-	else
-		return curlwp->l_proc->p_comm;
-}
-
 void
 device_pmf_driver_deregister(device_t dev)
 {
@@ -2992,11 +2983,19 @@ device_pmf_driver_set_child_register(dev
 static void
 pmflock_debug(device_t dev, const char *func, int line)
 {
+#ifdef PMFLOCK_DEBUG
 	device_lock_t dvl = device_getlock(dev);
+	const char *curlwp_name;
+
+	if (curlwp->l_name != NULL)
+		curlwp_name = curlwp->l_name;
+	else
+		curlwp_name = curlwp->l_proc->p_comm;
 
 	aprint_debug_dev(dev,
 	"%s.%d, %s dvl_nlock %d dvl_nwait %d dv_flags %x\n", func, line,
-	curlwp_name(), dvl->dvl_nlock, dvl->dvl_nwait, dev->dv_flags);
+	curlwp_name, dvl->dvl_nlock, dvl->dvl_nwait, dev->dv_flags);
+#endif	/* PMFLOCK_DEBUG */
 }
 
 static bool



CVS commit: src/sys/kern

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 20:35:11 UTC 2022

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

Log Message:
pmf(9): Conditionalize pmflock_debug output on PMFLOCK_DEBUG.

This is really only helpful for debugging the software logic to
handle the trees of devices for suspend/resume, not for debugging the
drivers, which is most of what we need to do.  If anyone still finds
this useful they can make a sysctl knob for it or something, but for
now this substantially reduces the amount of debug output that's
getting in my way.


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

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



CVS commit: [netbsd-9] src/doc

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:19:50 UTC 2022

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

Log Message:
Tickets #1407 - #1412


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.67 -r1.1.2.68 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.67 src/doc/CHANGES-9.3:1.1.2.68
--- src/doc/CHANGES-9.3:1.1.2.67	Thu Jan 20 11:46:24 2022
+++ src/doc/CHANGES-9.3	Sat Jan 29 17:19:50 2022
@@ -1,4 +1,4 @@
-29~# $NetBSD: CHANGES-9.3,v 1.1.2.67 2022/01/20 11:46:24 martin Exp $
+29~# $NetBSD: CHANGES-9.3,v 1.1.2.68 2022/01/29 17:19:50 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1199,3 +1199,63 @@ usr.sbin/sysinst/net.c1.37-1.40
 	sysinst(8): Add support for connecting to Wi-Fi networks.
 	[nia, ticket #1406]
 
+sys/dev/pci/ixgbe/ixgbe.c			1.298, 1.303 via patch
+
+	Add some missing error counters to ierror.
+	[msaitoh, ticket #1407]
+
+sys/dev/pci/ixgbe/ixgbe_vf.h			1.16-1.17 via patch
+sys/dev/pci/ixgbe/ixv.c1.176-1.177 via patch
+
+	Make ifconfig -z ixvN clear event counter.
+	[msaitoh, ticket #1408]
+
+sys/dev/mii/igphy.c1.37
+sys/dev/mii/ihphy.c1.19
+sys/dev/mii/makphy.c1.68
+
+	Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN
+	instead of LINK_STATE_DOWN.
+	[msaitoh, ticket #1409]
+
+sys/dev/mii/makphy.c1.67,1.69-1.72 (patch)
+sys/dev/mii/makphyvar.h1.3-1.4 (patch)
+
+	- Add I347-AT4 support.
+	- Add three workarounds for QEMU e1000:
+	  - QEMU sets BMSR_EXTSTAT but the access to register 15 fails.
+	Set EXTSR_1000TFDX and EXTSR_1000THDX if the access failed in the
+	attach function. It's just a cosmetic change.
+	  - Marvell 88E1[01]11 have the Fiber/Copper auto selection feature,
+	but QEMU doesn't implement it. If the register access failed,
+	the media is regarded as copper only. It's just a cosmetic change.
+	  - QEMU provides the PHY specific status register at 0x11 but the
+	link indication bit (PSSR_LINK) is always 1. It causes
+	"virsh domif-setlink xxx yyy down" doesn't work. To avoid this
+	problem, read the BMSR and check the BMSR_LINK bit. Add
+	MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR
+	doesn't exist because it's one of the case of QEMU.
+	- Reduce the number of access to the ESSR register. One of the reason
+	  is that the register is not implemented on QEMU. Another reason is
+	  that it's not required to access the register if the device is in
+	  the copper only mode.
+	[msaitoh, ticket #1410]
+
+sys/net/ppp_tty.c1.68
+sys/net/ppp_tty.c1.69
+
+	Use unsigned to avoid undefined behavior in pppasyncstart()
+	and pppinput().
+	[msaitoh, ticket #1411]
+
+sys/dev/pci/pci_subr.c1.232-1.239 via patch
+sys/dev/pci/pcireg.h1.62-1.63
+
+	- Decode link control2's Compliance Preset/De-emphasis more.
+	- Decode Physical Layer 16.0 GT/s extended capability.
+	- Decode Lane Margining at the Receiver extended capability.
+	- Print "reserved" instead of "unknown" when printing equalization
+	  preset. One of them is known to be the default value.
+	- Fix typo.
+	[msaitoh, ticket #1412]
+



CVS commit: [netbsd-9] src/doc

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:19:50 UTC 2022

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

Log Message:
Tickets #1407 - #1412


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

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:13:08 UTC 2022

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

Log Message:
Ticket #1724 - #1728


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.116 -r1.1.2.117 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.116 src/doc/CHANGES-8.3:1.1.2.117
--- src/doc/CHANGES-8.3:1.1.2.116	Sat Jan  8 13:27:31 2022
+++ src/doc/CHANGES-8.3	Sat Jan 29 17:13:08 2022
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.116 2022/01/08 13:27:31 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.117 2022/01/29 17:13:08 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -2371,3 +2371,40 @@ sys/conf/copyright1.20
 	Welcome to 2022!
 	[jnemeth, ticket #1723]
 
+sys/dev/pci/ixgbe/ixgbe.c			1.298, 1.303 via patch
+
+	Add some missing error counters to ierror.
+	[msaitoh, ticket #1724]
+
+sys/dev/pci/ixgbe/ixgbe_vf.h			1.16-1.17
+sys/dev/pci/ixgbe/ixv.c1.176-1.177
+
+	Make ifconfig -z ixvN clear event counter.
+	[msaitoh, ticket #1725]
+
+sys/dev/mii/igphy.c1.37
+sys/dev/mii/ihphy.c1.19
+sys/dev/mii/makphy.c1.68
+
+	Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN
+	instead of LINK_STATE_DOWN.
+	[msaitoh, ticket #1726]
+
+sys/net/ppp_tty.c1.68
+sys/net/ppp_tty.c1.69
+
+	Use unsigned to avoid undefined behavior in pppasyncstart()
+	and pppinput().
+	[msaitoh, ticket #1727]
+
+sys/dev/pci/pci_subr.c1.232-1.239 via patch
+sys/dev/pci/pcireg.h1.62-1.63
+
+	- Decode link control2's Compliance Preset/De-emphasis more.
+	- Decode Physical Layer 16.0 GT/s extended capability.
+	- Decode Lane Margining at the Receiver extended capability.
+	- Print "reserved" instead of "unknown" when printing equalization
+	  preset. One of them is known to be the default value.
+	- Fix typo.
+	[msaitoh, ticket #1728]
+



CVS commit: [netbsd-8] src/doc

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:13:08 UTC 2022

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

Log Message:
Ticket #1724 - #1728


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

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:11:22 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-8]: pci_subr.c pcireg.h

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

sys/dev/pci/pci_subr.c  1.232-1.239 via patch
sys/dev/pci/pcireg.h1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.13 -r1.183.2.14 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.183.2.13 src/sys/dev/pci/pci_subr.c:1.183.2.14
--- src/sys/dev/pci/pci_subr.c:1.183.2.13	Fri Dec  3 19:45:13 2021
+++ src/sys/dev/pci/pci_subr.c	Sat Jan 29 17:11:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.13 2021/12/03 19:45:13 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.14 2022/01/29 17:11:22 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.13 2021/12/03 19:45:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.14 2022/01/29 17:11:22 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1787,6 +1787,45 @@ pci_print_pcie_link_deemphasis(pcireg_t 
 	}
 }
 
+static const struct _pcie_link_preset_preshoot_deemphasis {
+	const char *preshoot;
+	const char *deemphasis;
+} pcie_link_preset_preshoot_deemphasis[] = {
+	{ "0.0",	"-6.0+-1.5" },	/* P0 */
+	{ "0.0",	"-3.5+-1" },	/* P1 */
+	{ "0.0",	"-4.4+-1.5" },	/* P2 */
+	{ "0.0",	"-2.5+-1" },	/* P3 */
+	{ "0.0",	"0.0" },	/* P4 */
+	{ "1.9+-1",	"0.0" },	/* P5 */
+	{ "2.5+-1",	"0.0" },	/* P6 */
+	{ "3.5+-1",	"-6.0+-1.5" },	/* P7 */
+	{ "3.5+-1",	"-3.5+-1" },	/* P8 */
+	{ "3.5+-1",	"0.0" },	/* P9 */
+	{ "0.0",	NULL }		/* P10 */
+};
+
+static void
+pci_print_pcie_link_preset_preshoot_deemphasis(pcireg_t val)
+{
+	const char *deemphasis;
+
+	if (val >= __arraycount(pcie_link_preset_preshoot_deemphasis)) {
+		/*
+		 * This may be printed because the default value of some
+		 * register fields is 0b.
+		 */
+		printf("reserved value (0x%x)", val);
+		return;
+	}
+
+	printf("Preshoot %sdB",
+	pcie_link_preset_preshoot_deemphasis[val].preshoot);
+	deemphasis = pcie_link_preset_preshoot_deemphasis[val].deemphasis;
+
+	if (deemphasis != NULL)
+		printf(", De-emphasis %sdB", deemphasis);
+}
+
 static void
 pci_conf_print_pcie_cap(const pcireg_t *regs, int capoff)
 {
@@ -2320,8 +2359,8 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		(unsigned int)__SHIFTOUT(reg,  PCIE_LCSR2_TX_MARGIN));
 		onoff("Enter Modified Compliance", reg, PCIE_LCSR2_EN_MCOMP);
 		onoff("Compliance SOS", reg, PCIE_LCSR2_COMP_SOS);
-		printf("  Compliance Present/De-emphasis: ");
-		pci_print_pcie_link_deemphasis(
+		printf("  Compliance Preset/De-emphasis: ");
+		pci_print_pcie_link_preset_preshoot_deemphasis(
 			__SHIFTOUT(reg, PCIE_LCSR2_COMP_DEEMP));
 		printf("\n");
 
@@ -3854,7 +3893,7 @@ pci_conf_print_sec_pcie_cap(const pcireg
 		reg = regs[o2i(pcie_capoff + PCIE_LCAP)];
 		maxlinkwidth = __SHIFTOUT(reg, PCIE_LCAP_MAX_WIDTH);
 	} else {
-		printf("error: falied to get PCIe capablity\n");
+		printf("error: failed to get PCIe capability\n");
 		return;
 	}
 	for (i = 0; i < maxlinkwidth; i++) {
@@ -4220,6 +4259,179 @@ pci_conf_print_dlf_cap(const pcireg_t *r
 	onoff("Remote DLF supported Valid", reg, PCI_DLF_STAT_RMTVALID);
 }
 
+static void
+pci_conf_print_pl16g_cap(const pcireg_t *regs, int extcapoff)
+{
+	pcireg_t reg, lwidth;
+	int pcie_capoff;
+	unsigned int i, j;
+
+	printf("\n  Physical Layer 16.0 GT/s\n");
+	reg = regs[o2i(extcapoff + PCI_PL16G_CAP)];
+	printf("Capability register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_CTL)];
+	printf("Control register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_STAT)];
+	printf("Status register: 0x%08x\n", reg);
+	onoff("Equalization 16.0 GT/s Complete", reg, PCI_PL16G_STAT_EQ_COMPL);
+	onoff("Equalization 16.0 GT/s Phase 1 Successful", reg,
+	PCI_PL16G_STAT_EQ_P1S);
+	onoff("Equalization 16.0 GT/s Phase 2 Successful", reg,
+	PCI_PL16G_STAT_EQ_P2S);
+	onoff("Equalization 16.0 GT/s Phase 3 Successful", reg,
+	PCI_PL16G_STAT_EQ_P3S);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_LDPMS)];
+	printf("Local Data Parity Mismatch Status register: 0x%08x\n",
+	reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_FRDPMS)];
+	printf("First Retimer Data Parity Mismatch 

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:11:22 UTC 2022

Modified Files:
src/sys/dev/pci [netbsd-8]: pci_subr.c pcireg.h

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

sys/dev/pci/pci_subr.c  1.232-1.239 via patch
sys/dev/pci/pcireg.h1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.13 -r1.183.2.14 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 src/sys/dev/pci/pcireg.h

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:08:33 UTC 2022

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

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

sys/dev/pci/pci_subr.c  1.232-1.239 via patch
sys/dev/pci/pcireg.h1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.215.2.5 -r1.215.2.6 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.147.4.3 -r1.147.4.4 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.215.2.5 src/sys/dev/pci/pci_subr.c:1.215.2.6
--- src/sys/dev/pci/pci_subr.c:1.215.2.5	Fri Dec  3 19:40:38 2021
+++ src/sys/dev/pci/pci_subr.c	Sat Jan 29 17:08:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.215.2.5 2021/12/03 19:40:38 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.215.2.6 2022/01/29 17:08:33 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.5 2021/12/03 19:40:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.6 2022/01/29 17:08:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1787,6 +1787,45 @@ pci_print_pcie_link_deemphasis(pcireg_t 
 	}
 }
 
+static const struct _pcie_link_preset_preshoot_deemphasis {
+	const char *preshoot;
+	const char *deemphasis;
+} pcie_link_preset_preshoot_deemphasis[] = {
+	{ "0.0",	"-6.0+-1.5" },	/* P0 */
+	{ "0.0",	"-3.5+-1" },	/* P1 */
+	{ "0.0",	"-4.4+-1.5" },	/* P2 */
+	{ "0.0",	"-2.5+-1" },	/* P3 */
+	{ "0.0",	"0.0" },	/* P4 */
+	{ "1.9+-1",	"0.0" },	/* P5 */
+	{ "2.5+-1",	"0.0" },	/* P6 */
+	{ "3.5+-1",	"-6.0+-1.5" },	/* P7 */
+	{ "3.5+-1",	"-3.5+-1" },	/* P8 */
+	{ "3.5+-1",	"0.0" },	/* P9 */
+	{ "0.0",	NULL }		/* P10 */
+};
+
+static void
+pci_print_pcie_link_preset_preshoot_deemphasis(pcireg_t val)
+{
+	const char *deemphasis;
+
+	if (val >= __arraycount(pcie_link_preset_preshoot_deemphasis)) {
+		/*
+		 * This may be printed because the default value of some
+		 * register fields is 0b.
+		 */
+		printf("reserved value (0x%x)", val);
+		return;
+	}
+
+	printf("Preshoot %sdB",
+	pcie_link_preset_preshoot_deemphasis[val].preshoot);
+	deemphasis = pcie_link_preset_preshoot_deemphasis[val].deemphasis;
+
+	if (deemphasis != NULL)
+		printf(", De-emphasis %sdB", deemphasis);
+}
+
 static void
 pci_conf_print_pcie_cap(const pcireg_t *regs, int capoff)
 {
@@ -2320,8 +2359,8 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		(unsigned int)__SHIFTOUT(reg,  PCIE_LCSR2_TX_MARGIN));
 		onoff("Enter Modified Compliance", reg, PCIE_LCSR2_EN_MCOMP);
 		onoff("Compliance SOS", reg, PCIE_LCSR2_COMP_SOS);
-		printf("  Compliance Present/De-emphasis: ");
-		pci_print_pcie_link_deemphasis(
+		printf("  Compliance Preset/De-emphasis: ");
+		pci_print_pcie_link_preset_preshoot_deemphasis(
 			__SHIFTOUT(reg, PCIE_LCSR2_COMP_DEEMP));
 		printf("\n");
 
@@ -3854,7 +3893,7 @@ pci_conf_print_sec_pcie_cap(const pcireg
 		reg = regs[o2i(pcie_capoff + PCIE_LCAP)];
 		maxlinkwidth = __SHIFTOUT(reg, PCIE_LCAP_MAX_WIDTH);
 	} else {
-		printf("error: falied to get PCIe capablity\n");
+		printf("error: failed to get PCIe capability\n");
 		return;
 	}
 	for (i = 0; i < maxlinkwidth; i++) {
@@ -4220,6 +4259,179 @@ pci_conf_print_dlf_cap(const pcireg_t *r
 	onoff("Remote DLF supported Valid", reg, PCI_DLF_STAT_RMTVALID);
 }
 
+static void
+pci_conf_print_pl16g_cap(const pcireg_t *regs, int extcapoff)
+{
+	pcireg_t reg, lwidth;
+	int pcie_capoff;
+	unsigned int i, j;
+
+	printf("\n  Physical Layer 16.0 GT/s\n");
+	reg = regs[o2i(extcapoff + PCI_PL16G_CAP)];
+	printf("Capability register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_CTL)];
+	printf("Control register: 0x%08x\n", reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_STAT)];
+	printf("Status register: 0x%08x\n", reg);
+	onoff("Equalization 16.0 GT/s Complete", reg, PCI_PL16G_STAT_EQ_COMPL);
+	onoff("Equalization 16.0 GT/s Phase 1 Successful", reg,
+	PCI_PL16G_STAT_EQ_P1S);
+	onoff("Equalization 16.0 GT/s Phase 2 Successful", reg,
+	PCI_PL16G_STAT_EQ_P2S);
+	onoff("Equalization 16.0 GT/s Phase 3 Successful", reg,
+	PCI_PL16G_STAT_EQ_P3S);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_LDPMS)];
+	printf("Local Data Parity Mismatch Status register: 0x%08x\n",
+	reg);
+
+	reg = regs[o2i(extcapoff + PCI_PL16G_FRDPMS)];
+	printf("First Retimer Data Parity Mismatch Status 

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:08:33 UTC 2022

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

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

sys/dev/pci/pci_subr.c  1.232-1.239 via patch
sys/dev/pci/pcireg.h1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.215.2.5 -r1.215.2.6 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.147.4.3 -r1.147.4.4 src/sys/dev/pci/pcireg.h

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:05:45 UTC 2022

Modified Files:
src/sys/net [netbsd-8]: ppp_tty.c

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

sys/net/ppp_tty.c: revision 1.68
sys/net/ppp_tty.c: revision 1.69

Use unsigned to avoid undefined behavior in pppasyncstart().

Use unsigned to avoid undefined behavior. Found by kUBSan.


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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:05:45 UTC 2022

Modified Files:
src/sys/net [netbsd-8]: ppp_tty.c

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

sys/net/ppp_tty.c: revision 1.68
sys/net/ppp_tty.c: revision 1.69

Use unsigned to avoid undefined behavior in pppasyncstart().

Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/net/ppp_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/sys/net/ppp_tty.c
diff -u src/sys/net/ppp_tty.c:1.63 src/sys/net/ppp_tty.c:1.63.8.1
--- src/sys/net/ppp_tty.c:1.63	Sun Oct  2 14:17:07 2016
+++ src/sys/net/ppp_tty.c	Sat Jan 29 17:05:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $	*/
+/*	$NetBSD: ppp_tty.c,v 1.63.8.1 2022/01/29 17:05:44 martin Exp $	*/
 /*	Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp 	*/
 
 /*
@@ -93,7 +93,7 @@
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63.8.1 2022/01/29 17:05:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -181,7 +181,7 @@ static void	pppdumpframe(struct ppp_soft
 /*
  * Does c need to be escaped?
  */
-#define ESCAPE_P(c)	(sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F)))
+#define ESCAPE_P(c)	(sc->sc_asyncmap[(c) >> 5] & (1U << ((c) & 0x1F)))
 
 /*
  * Procedures for using an async tty interface for PPP.
@@ -1012,7 +1012,7 @@ pppinput(int c, struct tty *tp)
 	sc->sc_flags |= SC_RCV_B7_1;
 else
 	sc->sc_flags |= SC_RCV_B7_0;
-if (paritytab[c >> 5] & (1 << (c & 0x1F)))
+if (paritytab[c >> 5] & (1U << (c & 0x1F)))
 	sc->sc_flags |= SC_RCV_ODDP;
 else
 	sc->sc_flags |= SC_RCV_EVNP;
@@ -1093,7 +1093,7 @@ pppinput(int c, struct tty *tp)
 	return 0;
 }
 
-if (c < 0x20 && (sc->sc_rasyncmap & (1 << c)))
+if (c < 0x20 && (sc->sc_rasyncmap & (1U << c)))
 	return 0;
 
 s = spltty();



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:03:53 UTC 2022

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

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

sys/net/ppp_tty.c: revision 1.68
sys/net/ppp_tty.c: revision 1.69

Use unsigned to avoid undefined behavior in pppasyncstart().

Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/net/ppp_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/sys/net/ppp_tty.c
diff -u src/sys/net/ppp_tty.c:1.65 src/sys/net/ppp_tty.c:1.65.4.1
--- src/sys/net/ppp_tty.c:1.65	Thu Jan 24 09:31:09 2019
+++ src/sys/net/ppp_tty.c	Sat Jan 29 17:03:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $	*/
+/*	$NetBSD: ppp_tty.c,v 1.65.4.1 2022/01/29 17:03:53 martin Exp $	*/
 /*	Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp 	*/
 
 /*
@@ -93,7 +93,7 @@
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65.4.1 2022/01/29 17:03:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -181,7 +181,7 @@ static void	pppdumpframe(struct ppp_soft
 /*
  * Does c need to be escaped?
  */
-#define ESCAPE_P(c)	(sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F)))
+#define ESCAPE_P(c)	(sc->sc_asyncmap[(c) >> 5] & (1U << ((c) & 0x1F)))
 
 /*
  * Procedures for using an async tty interface for PPP.
@@ -1021,7 +1021,7 @@ pppinput(int c, struct tty *tp)
 	sc->sc_flags |= SC_RCV_B7_1;
 else
 	sc->sc_flags |= SC_RCV_B7_0;
-if (paritytab[c >> 5] & (1 << (c & 0x1F)))
+if (paritytab[c >> 5] & (1U << (c & 0x1F)))
 	sc->sc_flags |= SC_RCV_ODDP;
 else
 	sc->sc_flags |= SC_RCV_EVNP;
@@ -1102,7 +1102,7 @@ pppinput(int c, struct tty *tp)
 	return 0;
 }
 
-if (c < 0x20 && (sc->sc_rasyncmap & (1 << c)))
+if (c < 0x20 && (sc->sc_rasyncmap & (1U << c)))
 	return 0;
 
 s = spltty();



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 17:03:53 UTC 2022

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

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

sys/net/ppp_tty.c: revision 1.68
sys/net/ppp_tty.c: revision 1.69

Use unsigned to avoid undefined behavior in pppasyncstart().

Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/net/ppp_tty.c

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:59:32 UTC 2022

Modified Files:
src/sys/dev/mii [netbsd-9]: makphy.c makphyvar.h

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1410:

sys/dev/mii/makphy.c1.67,1.69-1.72
sys/dev/mii/makphyvar.h 1.3-1.4

- Add I347-AT4 support.
- Add three workarounds for QEMU e1000:
  - QEMU sets BMSR_EXTSTAT but the access to register 15 fails.
Set EXTSR_1000TFDX and EXTSR_1000THDX if the access failed in the
attach function. It's just a cosmetic change.
  - Marvell 88E1[01]11 have the Fiber/Copper auto selection feature,
but QEMU doesn't implement it. If the register access failed,
the media is regarded as copper only. It's just a cosmetic change.
  - QEMU provides the PHY specific status register at 0x11 but the
link indication bit (PSSR_LINK) is always 1. It causes
"virsh domif-setlink xxx yyy down" doesn't work. To avoid this
problem, read the BMSR and check the BMSR_LINK bit. Add
MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR
doesn't exist because it's one of the case of QEMU.
- Reduce the number of access to the ESSR register. One of the reason
  is that the register is not implemented on QEMU. Another reason is
  that it's not required to access the register if the device is in
  the copper only mode.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/dev/mii/makphyvar.h

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

Modified files:

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.60.2.3 src/sys/dev/mii/makphy.c:1.60.2.4
--- src/sys/dev/mii/makphy.c:1.60.2.3	Sat Jan 29 16:54:42 2022
+++ src/sys/dev/mii/makphy.c	Sat Jan 29 16:59:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.60.2.3 2022/01/29 16:54:42 martin Exp $	*/
+/*	$NetBSD: makphy.c,v 1.60.2.4 2022/01/29 16:59:31 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60.2.3 2022/01/29 16:54:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60.2.4 2022/01/29 16:59:31 martin Exp $");
 
 #include 
 #include 
@@ -117,6 +117,7 @@ static const struct mii_phydesc makphys[
 	MII_PHY_DESC(xxMARVELL, E3016),
 	MII_PHY_DESC(xxMARVELL, E3082),
 	MII_PHY_DESC(xxMARVELL, PHYG65G),
+	MII_PHY_DESC(xxMARVELL, I347),
 	MII_PHY_END,
 };
 
@@ -159,6 +160,7 @@ makphyattach(device_t parent, device_t s
 	struct makphy_softc *maksc = (struct makphy_softc *)sc;
 	const char *name;
 	uint16_t reg, model;
+	int rv;
 
 	mpd = mii_phy_match(ma, makphys);
 	aprint_naive(": Media interface\n");
@@ -205,8 +207,22 @@ page0:
 
 	PHY_READ(sc, MII_BMSR, >mii_capabilities);
 	sc->mii_capabilities &= ma->mii_capmask;
-	if (sc->mii_capabilities & BMSR_EXTSTAT)
-		PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
+	if (sc->mii_capabilities & BMSR_EXTSTAT) {
+		rv = PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
+		if (rv != 0) {
+			aprint_verbose_dev(self, "Failed to read EXTSR. "
+			"Are you an emulator?. "
+			"Regard as 1000BASE-T.\n");
+			sc->mii_extcapabilities
+			|= EXTSR_1000TFDX | EXTSR_1000THDX;
+
+			/*
+			 * Also assume it doesn't support PSSR_LINK bit.
+			 * It's for QEMU.
+			 */
+			maksc->sc_flags |= MAKPHY_QUIRK_PSSR_LINK;
+		}
+	}
 
 	if (((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX))
 		!= 0)
@@ -219,8 +235,18 @@ page0:
 		case MII_MODEL_xxMARVELL_E1011:
 		case MII_MODEL_xxMARVELL_E:
 			/* These devices have ESSR register */
-			PHY_READ(sc, MAKPHY_ESSR, );
-			if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
+			rv = PHY_READ(sc, MAKPHY_ESSR, );
+			if (rv != 0) {
+/*
+ * XXX Emulator (e.g qemu) may not implement
+ * the ESSR register. If so, regard as copper
+ * media.
+ */
+copperonly = true;
+aprint_verbose_dev(self, "Failed to access "
+"ESSR. Are you an emulator? Regard as "
+"copper only media.\n");
+			} else if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
 switch (reg & ESSR_HWCFG_MODE) {
 case ESSR_RTBI_FIBER:
 case ESSR_RGMII_FIBER:
@@ -238,7 +264,8 @@ page0:
 default:
 	break;
 }
-			}
+			} else
+maksc->sc_flags |= MAKPHY_F_FICO_AUTOSEL;
 			break;
 		default:
 			break;
@@ -418,6 +445,7 @@ makphy_service(struct mii_softc *sc, str
 static void
 makphy_status(struct mii_softc *sc)
 {
+	struct makphy_softc *maksc = (struct makphy_softc *)sc;
 	struct mii_data *mii = sc->mii_pdata;
 	uint16_t bmcr, gsr, pssr, essr;
 
@@ -428,6 +456,23 @@ makphy_status(struct mii_softc *sc)
 	/* XXX FIXME: Use different page for Fiber on newer chips */
 	PHY_READ(sc, MAKPHY_PSSR, );
 
+	if ((maksc->sc_flags & MAKPHY_QUIRK_PSSR_LINK) != 0) {
+		uint16_t bmsr;
+

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:59:32 UTC 2022

Modified Files:
src/sys/dev/mii [netbsd-9]: makphy.c makphyvar.h

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1410:

sys/dev/mii/makphy.c1.67,1.69-1.72
sys/dev/mii/makphyvar.h 1.3-1.4

- Add I347-AT4 support.
- Add three workarounds for QEMU e1000:
  - QEMU sets BMSR_EXTSTAT but the access to register 15 fails.
Set EXTSR_1000TFDX and EXTSR_1000THDX if the access failed in the
attach function. It's just a cosmetic change.
  - Marvell 88E1[01]11 have the Fiber/Copper auto selection feature,
but QEMU doesn't implement it. If the register access failed,
the media is regarded as copper only. It's just a cosmetic change.
  - QEMU provides the PHY specific status register at 0x11 but the
link indication bit (PSSR_LINK) is always 1. It causes
"virsh domif-setlink xxx yyy down" doesn't work. To avoid this
problem, read the BMSR and check the BMSR_LINK bit. Add
MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR
doesn't exist because it's one of the case of QEMU.
- Reduce the number of access to the ESSR register. One of the reason
  is that the register is not implemented on QEMU. Another reason is
  that it's not required to access the register if the device is in
  the copper only mode.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/dev/mii/makphyvar.h

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:56:18 UTC 2022

Modified Files:
src/sys/dev/mii [netbsd-8]: igphy.c ihphy.c makphy.c

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

sys/dev/mii/igphy.c: revision 1.37
sys/dev/mii/ihphy.c: revision 1.19
sys/dev/mii/makphy.c: revision 1.68

  Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.26.10.2 -r1.26.10.3 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.10.8.3 -r1.10.8.4 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.42.8.5 -r1.42.8.6 src/sys/dev/mii/makphy.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/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.26.10.2 src/sys/dev/mii/igphy.c:1.26.10.3
--- src/sys/dev/mii/igphy.c:1.26.10.2	Wed Aug  5 17:22:46 2020
+++ src/sys/dev/mii/igphy.c	Sat Jan 29 16:56:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.26.10.2 2020/08/05 17:22:46 martin Exp $	*/
+/*	$NetBSD: igphy.c,v 1.26.10.3 2022/01/29 16:56:18 martin Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.26.10.2 2020/08/05 17:22:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.26.10.3 2022/01/29 16:56:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -443,7 +443,6 @@ igphy_status(struct mii_softc *sc)
 	bmcr = PHY_READ(sc, MII_BMCR);
 	if (bmcr & BMCR_ISO) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.10.8.3 src/sys/dev/mii/ihphy.c:1.10.8.4
--- src/sys/dev/mii/ihphy.c:1.10.8.3	Sat Nov 20 15:11:32 2021
+++ src/sys/dev/mii/ihphy.c	Sat Jan 29 16:56:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.10.8.3 2021/11/20 15:11:32 martin Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.10.8.4 2022/01/29 16:56:18 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.10.8.3 2021/11/20 15:11:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.10.8.4 2022/01/29 16:56:18 martin Exp $");
 
 #include 
 #include 
@@ -244,7 +244,6 @@ ihphy_status(struct mii_softc *sc)
 	bmcr = PHY_READ(sc, MII_BMCR);
 	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.42.8.5 src/sys/dev/mii/makphy.c:1.42.8.6
--- src/sys/dev/mii/makphy.c:1.42.8.5	Wed Aug  5 17:22:46 2020
+++ src/sys/dev/mii/makphy.c	Sat Jan 29 16:56:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.42.8.5 2020/08/05 17:22:46 martin Exp $	*/
+/*	$NetBSD: makphy.c,v 1.42.8.6 2022/01/29 16:56:18 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.42.8.5 2020/08/05 17:22:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.42.8.6 2022/01/29 16:56:18 martin Exp $");
 
 #include 
 #include 
@@ -475,9 +475,8 @@ makphy_status(struct mii_softc *sc)
 	if (bmcr & BMCR_LOOP)
 		mii->mii_media_active |= IFM_LOOP;
 
-	if (bmcr & BMCR_ISO) {
+	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:56:18 UTC 2022

Modified Files:
src/sys/dev/mii [netbsd-8]: igphy.c ihphy.c makphy.c

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

sys/dev/mii/igphy.c: revision 1.37
sys/dev/mii/ihphy.c: revision 1.19
sys/dev/mii/makphy.c: revision 1.68

  Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.26.10.2 -r1.26.10.3 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.10.8.3 -r1.10.8.4 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.42.8.5 -r1.42.8.6 src/sys/dev/mii/makphy.c

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:54:42 UTC 2022

Modified Files:
src/sys/dev/mii [netbsd-9]: igphy.c ihphy.c makphy.c

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

sys/dev/mii/igphy.c: revision 1.37
sys/dev/mii/ihphy.c: revision 1.19
sys/dev/mii/makphy.c: revision 1.68

  Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.1 -r1.31.4.2 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.14.4.2 -r1.14.4.3 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/mii/makphy.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/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.31.4.1 src/sys/dev/mii/igphy.c:1.31.4.2
--- src/sys/dev/mii/igphy.c:1.31.4.1	Wed Aug  5 15:14:18 2020
+++ src/sys/dev/mii/igphy.c	Sat Jan 29 16:54:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.31.4.1 2020/08/05 15:14:18 martin Exp $	*/
+/*	$NetBSD: igphy.c,v 1.31.4.2 2022/01/29 16:54:42 martin Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.31.4.1 2020/08/05 15:14:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.31.4.2 2022/01/29 16:54:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -433,7 +433,6 @@ igphy_status(struct mii_softc *sc)
 	PHY_READ(sc, MII_BMCR, );
 	if (bmcr & BMCR_ISO) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.14.4.2 src/sys/dev/mii/ihphy.c:1.14.4.3
--- src/sys/dev/mii/ihphy.c:1.14.4.2	Sat Nov 20 14:59:04 2021
+++ src/sys/dev/mii/ihphy.c	Sat Jan 29 16:54:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.14.4.2 2021/11/20 14:59:04 martin Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.14.4.3 2022/01/29 16:54:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.14.4.2 2021/11/20 14:59:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.14.4.3 2022/01/29 16:54:42 martin Exp $");
 
 #include 
 #include 
@@ -238,7 +238,6 @@ ihphy_status(struct mii_softc *sc)
 	PHY_READ(sc, MII_BMCR, );
 	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.60.2.2 src/sys/dev/mii/makphy.c:1.60.2.3
--- src/sys/dev/mii/makphy.c:1.60.2.2	Wed Aug  5 15:14:18 2020
+++ src/sys/dev/mii/makphy.c	Sat Jan 29 16:54:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.60.2.2 2020/08/05 15:14:18 martin Exp $	*/
+/*	$NetBSD: makphy.c,v 1.60.2.3 2022/01/29 16:54:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60.2.2 2020/08/05 15:14:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60.2.3 2022/01/29 16:54:42 martin Exp $");
 
 #include 
 #include 
@@ -434,9 +434,8 @@ makphy_status(struct mii_softc *sc)
 	if (bmcr & BMCR_LOOP)
 		mii->mii_media_active |= IFM_LOOP;
 
-	if (bmcr & BMCR_ISO) {
+	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:54:42 UTC 2022

Modified Files:
src/sys/dev/mii [netbsd-9]: igphy.c ihphy.c makphy.c

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

sys/dev/mii/igphy.c: revision 1.37
sys/dev/mii/ihphy.c: revision 1.19
sys/dev/mii/makphy.c: revision 1.68

  Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.1 -r1.31.4.2 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.14.4.2 -r1.14.4.3 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/mii/makphy.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/sys/dev/pci/ixgbe

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:45:49 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe_vf.h ixv.c

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1725:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.8.6.4 -r1.8.6.5 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.33 -r1.56.2.34 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_vf.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.4 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.5
--- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.4	Thu Sep 26 18:19:26 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.h	Sat Jan 29 16:45:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.8.6.4 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.8.6.5 2022/01/29 16:45:49 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -101,29 +101,17 @@ struct ixgbevf_hw_stats {
 	struct evcnt l4cs;
 	struct evcnt l4cs_bad;
 
-	u64 base_vfgprc;
-	u64 base_vfgptc;
-	u64 base_vfgorc;
-	u64 base_vfgotc;
-	u64 base_vfmprc;
-
-	u64 last_vfgprc;
-	u64 last_vfgptc;
+	u32 last_vfgprc;
+	u32 last_vfgptc;
 	u64 last_vfgorc;
 	u64 last_vfgotc;
-	u64 last_vfmprc;
+	u32 last_vfmprc;
 
 	struct evcnt vfgprc;
 	struct evcnt vfgptc;
 	struct evcnt vfgorc;
 	struct evcnt vfgotc;
 	struct evcnt vfmprc;
-
-	u64 saved_reset_vfgprc;
-	u64 saved_reset_vfgptc;
-	u64 saved_reset_vfgorc;
-	u64 saved_reset_vfgotc;
-	u64 saved_reset_vfmprc;
 };
 
 s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.33 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.34
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.33	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Sat Jan 29 16:45:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.56.2.33 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.33 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@ static void	ixv_unregister_vlan(void *, 
 #endif
 
 static void	ixv_add_device_sysctls(struct adapter *);
-static void	ixv_save_stats(struct adapter *);
 static void	ixv_init_stats(struct adapter *);
 static void	ixv_update_stats(struct adapter *);
 static void	ixv_add_stats_sysctls(struct adapter *);
@@ -550,7 +549,6 @@ ixv_attach(device_t parent, device_t dev
 	}
 
 	/* Do the stats setup */
-	ixv_save_stats(adapter);
 	ixv_init_stats(adapter);
 	ixv_add_stats_sysctls(adapter);
 
@@ -2269,34 +2267,11 @@ ixv_configure_ivars(struct adapter *adap
 
 
 /
- * ixv_save_stats
+ * ixv_init_stats
  *
  *   The VF stats registers never have a truly virgin
- *   starting point, so this routine tries to make an
- *   artificial one, marking ground zero on attach as
- *   it were.
- /
-static void
-ixv_save_stats(struct adapter *adapter)
-{
-	struct ixgbevf_hw_stats *stats = >stats.vf;
-
-	if (stats->vfgprc.ev_count || stats->vfgptc.ev_count) {
-		stats->saved_reset_vfgprc +=
-		stats->vfgprc.ev_count - stats->base_vfgprc;
-		stats->saved_reset_vfgptc +=
-		stats->vfgptc.ev_count - stats->base_vfgptc;
-		stats->saved_reset_vfgorc +=
-		stats->vfgorc.ev_count - stats->base_vfgorc;
-		stats->saved_reset_vfgotc +=
-		stats->vfgotc.ev_count - stats->base_vfgotc;
-		stats->saved_reset_vfmprc +=
-		stats->vfmprc.ev_count - stats->base_vfmprc;
-	}
-} /* ixv_save_stats */
-
-/
- * ixv_init_stats
+ *   starting point, so this routine save initial vaules to
+ *   last_.
  /
 static void
 ixv_init_stats(struct adapter *adapter)
@@ -2314,34 +2289,25 @@ ixv_init_stats(struct adapter *adapter)
 	(((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
 
 	adapter->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
-
-	adapter->stats.vf.base_vfgprc = adapter->stats.vf.last_vfgprc;
-	adapter->stats.vf.base_vfgorc = adapter->stats.vf.last_vfgorc;
-	adapter->stats.vf.base_vfgptc = adapter->stats.vf.last_vfgptc;
-	

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:45:49 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe_vf.h ixv.c

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1725:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.8.6.4 -r1.8.6.5 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.33 -r1.56.2.34 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:43:23 UTC 2022

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1408:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.13.8.1 -r1.13.8.2 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.125.2.13 -r1.125.2.14 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_vf.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13.8.1 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13.8.2
--- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13.8.1	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.h	Sat Jan 29 16:43:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.13.8.1 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.13.8.2 2022/01/29 16:43:23 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -101,29 +101,17 @@ struct ixgbevf_hw_stats {
 	struct evcnt l4cs;
 	struct evcnt l4cs_bad;
 
-	u64 base_vfgprc;
-	u64 base_vfgptc;
-	u64 base_vfgorc;
-	u64 base_vfgotc;
-	u64 base_vfmprc;
-
-	u64 last_vfgprc;
-	u64 last_vfgptc;
+	u32 last_vfgprc;
+	u32 last_vfgptc;
 	u64 last_vfgorc;
 	u64 last_vfgotc;
-	u64 last_vfmprc;
+	u32 last_vfmprc;
 
 	struct evcnt vfgprc;
 	struct evcnt vfgptc;
 	struct evcnt vfgorc;
 	struct evcnt vfgotc;
 	struct evcnt vfmprc;
-
-	u64 saved_reset_vfgprc;
-	u64 saved_reset_vfgptc;
-	u64 saved_reset_vfgorc;
-	u64 saved_reset_vfgotc;
-	u64 saved_reset_vfmprc;
 };
 
 s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.13 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.14
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.13	Sat Nov 20 15:16:53 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Sat Jan 29 16:43:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.125.2.13 2021/11/20 15:16:53 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.125.2.14 2022/01/29 16:43:23 martin Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.125.2.13 2021/11/20 15:16:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.125.2.14 2022/01/29 16:43:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@ static int	ixv_register_vlan(struct adap
 static int	ixv_unregister_vlan(struct adapter *, u16);
 
 static void	ixv_add_device_sysctls(struct adapter *);
-static void	ixv_save_stats(struct adapter *);
 static void	ixv_init_stats(struct adapter *);
 static void	ixv_update_stats(struct adapter *);
 static void	ixv_add_stats_sysctls(struct adapter *);
@@ -538,7 +537,6 @@ ixv_attach(device_t parent, device_t dev
 	}
 
 	/* Do the stats setup */
-	ixv_save_stats(adapter);
 	ixv_init_stats(adapter);
 	ixv_add_stats_sysctls(adapter);
 
@@ -2338,34 +2336,11 @@ ixv_configure_ivars(struct adapter *adap
 
 
 /
- * ixv_save_stats
+ * ixv_init_stats
  *
  *   The VF stats registers never have a truly virgin
- *   starting point, so this routine tries to make an
- *   artificial one, marking ground zero on attach as
- *   it were.
- /
-static void
-ixv_save_stats(struct adapter *adapter)
-{
-	struct ixgbevf_hw_stats *stats = >stats.vf;
-
-	if (stats->vfgprc.ev_count || stats->vfgptc.ev_count) {
-		stats->saved_reset_vfgprc +=
-		stats->vfgprc.ev_count - stats->base_vfgprc;
-		stats->saved_reset_vfgptc +=
-		stats->vfgptc.ev_count - stats->base_vfgptc;
-		stats->saved_reset_vfgorc +=
-		stats->vfgorc.ev_count - stats->base_vfgorc;
-		stats->saved_reset_vfgotc +=
-		stats->vfgotc.ev_count - stats->base_vfgotc;
-		stats->saved_reset_vfmprc +=
-		stats->vfmprc.ev_count - stats->base_vfmprc;
-	}
-} /* ixv_save_stats */
-
-/
- * ixv_init_stats
+ *   starting point, so this routine save initial vaules to
+ *   last_.
  /
 static void
 ixv_init_stats(struct adapter *adapter)
@@ -2383,34 +2358,25 @@ ixv_init_stats(struct adapter *adapter)
 	(((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
 
 	adapter->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
-
-	adapter->stats.vf.base_vfgprc = adapter->stats.vf.last_vfgprc;
-	adapter->stats.vf.base_vfgorc = adapter->stats.vf.last_vfgorc;
-	

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:43:23 UTC 2022

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1408:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.13.8.1 -r1.13.8.2 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.125.2.13 -r1.125.2.14 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:36:07 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:36:07 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.45 -r1.88.2.46 src/sys/dev/pci/ixgbe/ixgbe.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.46
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.45	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Jan 29 16:36:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1579,13 +1579,19 @@ ixgbe_update_stats_counters(struct adapt
 	struct ixgbe_hw_stats *stats = >stats.pf;
 	u32		  missed_rx = 0, bprc, lxon, lxoff, total;
 	u64		  total_missed_rx = 0;
-	uint64_t	  crcerrs, rlec;
+	uint64_t	  crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
 	unsigned int	  queue_counters;
 	int		  i;
 
-	crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
-	stats->crcerrs.ev_count += crcerrs;
-	stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
+#define READ_COPY_SET(hw, stats, regname, evname)		\
+	do {			\
+		(evname) = IXGBE_READ_REG((hw), regname);	\
+		(stats)->evname.ev_count += (evname);		\
+	} while (/*CONSTCOND*/0)
+	
+	READ_COPY_SET(hw, stats, IXGBE_CRCERRS, crcerrs);
+	READ_COPY_SET(hw, stats, IXGBE_ILLERRC, illerrc);
+
 	stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
 	stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
 	if (hw->mac.type >= ixgbe_mac_X550)
@@ -1643,8 +1649,7 @@ ixgbe_update_stats_counters(struct adapt
 		stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
 		stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
 	}
-	rlec = IXGBE_READ_REG(hw, IXGBE_RLEC);
-	stats->rlec.ev_count += rlec;
+	READ_COPY_SET(hw, stats, IXGBE_RLEC, rlec);
 
 	/* Hardware workaround, gprc counts missed packets */
 	stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
@@ -1696,10 +1701,13 @@ ixgbe_update_stats_counters(struct adapt
 	stats->mptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPTC) - total;
 	stats->ptc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PTC64) - total;
 
-	stats->ruc.ev_count += IXGBE_READ_REG(hw, IXGBE_RUC);
-	stats->rfc.ev_count += IXGBE_READ_REG(hw, IXGBE_RFC);
-	stats->roc.ev_count += IXGBE_READ_REG(hw, IXGBE_ROC);
-	stats->rjc.ev_count += IXGBE_READ_REG(hw, IXGBE_RJC);
+	READ_COPY_SET(hw, stats, IXGBE_RUC, ruc);
+	READ_COPY_SET(hw, stats, IXGBE_RFC, rfc);
+	READ_COPY_SET(hw, stats, IXGBE_ROC, roc);
+	READ_COPY_SET(hw, stats, IXGBE_RJC, rjc);
+
+#undef READ_COPY_SET
+
 	stats->mngprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPRC);
 	stats->mngpdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPDC);
 	stats->mngptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPTC);
@@ -1733,7 +1741,19 @@ ixgbe_update_stats_counters(struct adapt
 
 	/* Rx Errors */
 	ifp->if_iqdrops += total_missed_rx;
-	ifp->if_ierrors += crcerrs + rlec;
+
+	/*
+	 * Aggregate following types of errors as RX errors:
+	 * - CRC error count,
+	 * - illegal byte error count,
+	 * - length error count,
+	 * - undersized packets count,
+	 * - fragmented packets count,
+	 * - oversized packets count,
+	 * - jabber count.
+	 */
+	ifp->if_ierrors +=
+	crcerrs + illerrc + rlec + ruc + rfc + roc + rjc;
 } /* ixgbe_update_stats_counters */
 
 /



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:33:10 UTC 2022

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

Log Message:
Pullup the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.15 -r1.199.2.16 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:33:10 UTC 2022

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

Log Message:
Pullup the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.15 -r1.199.2.16 src/sys/dev/pci/ixgbe/ixgbe.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.15 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.16
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.15	Sat Nov 20 15:16:53 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Jan 29 16:33:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.15 2021/11/20 15:16:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.16 2022/01/29 16:33:10 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.15 2021/11/20 15:16:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.16 2022/01/29 16:33:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1571,13 +1571,19 @@ ixgbe_update_stats_counters(struct adapt
 	struct ixgbe_hw_stats *stats = >stats.pf;
 	u32		  missed_rx = 0, bprc, lxon, lxoff, total;
 	u64		  total_missed_rx = 0;
-	uint64_t	  crcerrs, rlec;
+	uint64_t	  crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
 	unsigned int	  queue_counters;
 	int		  i;
 
-	crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
-	stats->crcerrs.ev_count += crcerrs;
-	stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
+#define READ_COPY_SET(hw, stats, regname, evname)		\
+	do {			\
+		(evname) = IXGBE_READ_REG((hw), regname);	\
+		(stats)->evname.ev_count += (evname);		\
+	} while (/*CONSTCOND*/0)
+	
+	READ_COPY_SET(hw, stats, IXGBE_CRCERRS, crcerrs);
+	READ_COPY_SET(hw, stats, IXGBE_ILLERRC, illerrc);
+
 	stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
 	stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
 	if (hw->mac.type >= ixgbe_mac_X550)
@@ -1635,8 +1641,7 @@ ixgbe_update_stats_counters(struct adapt
 		stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
 		stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
 	}
-	rlec = IXGBE_READ_REG(hw, IXGBE_RLEC);
-	stats->rlec.ev_count += rlec;
+	READ_COPY_SET(hw, stats, IXGBE_RLEC, rlec);
 
 	/* Hardware workaround, gprc counts missed packets */
 	stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
@@ -1688,10 +1693,13 @@ ixgbe_update_stats_counters(struct adapt
 	stats->mptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPTC) - total;
 	stats->ptc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PTC64) - total;
 
-	stats->ruc.ev_count += IXGBE_READ_REG(hw, IXGBE_RUC);
-	stats->rfc.ev_count += IXGBE_READ_REG(hw, IXGBE_RFC);
-	stats->roc.ev_count += IXGBE_READ_REG(hw, IXGBE_ROC);
-	stats->rjc.ev_count += IXGBE_READ_REG(hw, IXGBE_RJC);
+	READ_COPY_SET(hw, stats, IXGBE_RUC, ruc);
+	READ_COPY_SET(hw, stats, IXGBE_RFC, rfc);
+	READ_COPY_SET(hw, stats, IXGBE_ROC, roc);
+	READ_COPY_SET(hw, stats, IXGBE_RJC, rjc);
+
+#undef READ_COPY_SET
+
 	stats->mngprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPRC);
 	stats->mngpdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPDC);
 	stats->mngptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPTC);
@@ -1725,7 +1733,19 @@ ixgbe_update_stats_counters(struct adapt
 
 	/* Rx Errors */
 	ifp->if_iqdrops += total_missed_rx;
-	ifp->if_ierrors += crcerrs + rlec;
+
+	/*
+	 * Aggregate following types of errors as RX errors:
+	 * - CRC error count,
+	 * - illegal byte error count,
+	 * - length error count,
+	 * - undersized packets count,
+	 * - fragmented packets count,
+	 * - oversized packets count,
+	 * - jabber count.
+	 */
+	ifp->if_ierrors +=
+	crcerrs + illerrc + rlec + ruc + rfc + roc + rjc;
 } /* ixgbe_update_stats_counters */
 
 /



CVS commit: src/usr.sbin/sysinst

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:01:21 UTC 2022

Modified Files:
src/usr.sbin/sysinst: defs.h install.c upgrade.c
src/usr.sbin/sysinst/arch/acorn32: md.c
src/usr.sbin/sysinst/arch/alpha: md.c
src/usr.sbin/sysinst/arch/amiga: md.c
src/usr.sbin/sysinst/arch/arc: md.c
src/usr.sbin/sysinst/arch/atari: md.c
src/usr.sbin/sysinst/arch/bebox: md.c
src/usr.sbin/sysinst/arch/cats: md.c
src/usr.sbin/sysinst/arch/cobalt: md.c
src/usr.sbin/sysinst/arch/dummy: md.c
src/usr.sbin/sysinst/arch/emips: md.c
src/usr.sbin/sysinst/arch/evbarm: md.c
src/usr.sbin/sysinst/arch/evbmips: md.c
src/usr.sbin/sysinst/arch/evbppc: md.c
src/usr.sbin/sysinst/arch/evbsh3: md.c
src/usr.sbin/sysinst/arch/ews4800mips: md.c
src/usr.sbin/sysinst/arch/hp300: md.c
src/usr.sbin/sysinst/arch/hpcarm: md.c
src/usr.sbin/sysinst/arch/hpcmips: md.c
src/usr.sbin/sysinst/arch/hpcsh: md.c
src/usr.sbin/sysinst/arch/hppa: md.c
src/usr.sbin/sysinst/arch/i386: md.c
src/usr.sbin/sysinst/arch/landisk: md.c
src/usr.sbin/sysinst/arch/luna68k: md.c
src/usr.sbin/sysinst/arch/mac68k: md.c
src/usr.sbin/sysinst/arch/macppc: md.c
src/usr.sbin/sysinst/arch/mipsco: md.c
src/usr.sbin/sysinst/arch/mvme68k: md.c
src/usr.sbin/sysinst/arch/news68k: md.c
src/usr.sbin/sysinst/arch/newsmips: md.c
src/usr.sbin/sysinst/arch/ofppc: md.c
src/usr.sbin/sysinst/arch/playstation2: md.c
src/usr.sbin/sysinst/arch/pmax: md.c
src/usr.sbin/sysinst/arch/prep: md.c
src/usr.sbin/sysinst/arch/sandpoint: md.c
src/usr.sbin/sysinst/arch/sgimips: md.c
src/usr.sbin/sysinst/arch/shark: md.c
src/usr.sbin/sysinst/arch/sparc: md.c
src/usr.sbin/sysinst/arch/sparc64: md.c
src/usr.sbin/sysinst/arch/vax: md.c
src/usr.sbin/sysinst/arch/x68k: md.c
src/usr.sbin/sysinst/arch/zaurus: md.c

Log Message:
When upgrading, update the boot code post extraction from
the updated target file system.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/install.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/sysinst/upgrade.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/acorn32/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/alpha/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/amiga/md.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/arch/arc/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/atari/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/bebox/md.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/arch/cats/md.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/arch/cobalt/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/dummy/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/emips/md.c
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/arch/evbarm/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/evbmips/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/evbppc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/evbsh3/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/ews4800mips/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/hp300/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/hpcarm/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/hpcmips/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/hpcsh/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/hppa/md.c
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/arch/i386/md.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/arch/landisk/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/luna68k/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/mac68k/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/macppc/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/mipsco/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/mvme68k/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/news68k/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/newsmips/md.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/sysinst/arch/ofppc/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/playstation2/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/pmax/md.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/arch/prep/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/sandpoint/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/sgimips/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/shark/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sparc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sparc64/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/vax/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/x68k/md.c
cvs rdiff -u -r1.11 -r1.12 

CVS commit: src/usr.sbin/sysinst

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:01:21 UTC 2022

Modified Files:
src/usr.sbin/sysinst: defs.h install.c upgrade.c
src/usr.sbin/sysinst/arch/acorn32: md.c
src/usr.sbin/sysinst/arch/alpha: md.c
src/usr.sbin/sysinst/arch/amiga: md.c
src/usr.sbin/sysinst/arch/arc: md.c
src/usr.sbin/sysinst/arch/atari: md.c
src/usr.sbin/sysinst/arch/bebox: md.c
src/usr.sbin/sysinst/arch/cats: md.c
src/usr.sbin/sysinst/arch/cobalt: md.c
src/usr.sbin/sysinst/arch/dummy: md.c
src/usr.sbin/sysinst/arch/emips: md.c
src/usr.sbin/sysinst/arch/evbarm: md.c
src/usr.sbin/sysinst/arch/evbmips: md.c
src/usr.sbin/sysinst/arch/evbppc: md.c
src/usr.sbin/sysinst/arch/evbsh3: md.c
src/usr.sbin/sysinst/arch/ews4800mips: md.c
src/usr.sbin/sysinst/arch/hp300: md.c
src/usr.sbin/sysinst/arch/hpcarm: md.c
src/usr.sbin/sysinst/arch/hpcmips: md.c
src/usr.sbin/sysinst/arch/hpcsh: md.c
src/usr.sbin/sysinst/arch/hppa: md.c
src/usr.sbin/sysinst/arch/i386: md.c
src/usr.sbin/sysinst/arch/landisk: md.c
src/usr.sbin/sysinst/arch/luna68k: md.c
src/usr.sbin/sysinst/arch/mac68k: md.c
src/usr.sbin/sysinst/arch/macppc: md.c
src/usr.sbin/sysinst/arch/mipsco: md.c
src/usr.sbin/sysinst/arch/mvme68k: md.c
src/usr.sbin/sysinst/arch/news68k: md.c
src/usr.sbin/sysinst/arch/newsmips: md.c
src/usr.sbin/sysinst/arch/ofppc: md.c
src/usr.sbin/sysinst/arch/playstation2: md.c
src/usr.sbin/sysinst/arch/pmax: md.c
src/usr.sbin/sysinst/arch/prep: md.c
src/usr.sbin/sysinst/arch/sandpoint: md.c
src/usr.sbin/sysinst/arch/sgimips: md.c
src/usr.sbin/sysinst/arch/shark: md.c
src/usr.sbin/sysinst/arch/sparc: md.c
src/usr.sbin/sysinst/arch/sparc64: md.c
src/usr.sbin/sysinst/arch/vax: md.c
src/usr.sbin/sysinst/arch/x68k: md.c
src/usr.sbin/sysinst/arch/zaurus: md.c

Log Message:
When upgrading, update the boot code post extraction from
the updated target file system.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/install.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/sysinst/upgrade.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/acorn32/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/alpha/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/amiga/md.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/arch/arc/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/atari/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/bebox/md.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/arch/cats/md.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/arch/cobalt/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/dummy/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/emips/md.c
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/arch/evbarm/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/evbmips/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/evbppc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/evbsh3/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/ews4800mips/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/hp300/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/hpcarm/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/hpcmips/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/hpcsh/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/hppa/md.c
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/arch/i386/md.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/arch/landisk/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/luna68k/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/mac68k/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/macppc/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/mipsco/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/mvme68k/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/news68k/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/newsmips/md.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/sysinst/arch/ofppc/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/playstation2/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/pmax/md.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/arch/prep/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/sandpoint/md.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/sgimips/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/shark/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sparc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sparc64/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/vax/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/x68k/md.c
cvs rdiff -u -r1.11 -r1.12 

CVS commit: src/usr.sbin/sysinst

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 15:32:49 UTC 2022

Modified Files:
src/usr.sbin/sysinst: defs.h gpt.c target.c util.c

Log Message:
Try to get rid of all wedges we created (after unmounting).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/gpt.c
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/sysinst/target.c
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.76 src/usr.sbin/sysinst/defs.h:1.77
--- src/usr.sbin/sysinst/defs.h:1.76	Sun Dec  5 02:52:17 2021
+++ src/usr.sbin/sysinst/defs.h	Sat Jan 29 15:32:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.76 2021/12/05 02:52:17 msaitoh Exp $	*/
+/*	$NetBSD: defs.h,v 1.77 2022/01/29 15:32:49 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -927,6 +927,7 @@ int	target_dir_exists_p(const char *);
 int	target_file_exists_p(const char *);
 int	target_symlink_exists_p(const char *);
 void	unwind_mounts(void);
+void	register_post_umount_delwedge(const char *disk, const char *wedge);
 int	target_mounted(void);
 void	umount_root(void);
 

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.26 src/usr.sbin/sysinst/gpt.c:1.27
--- src/usr.sbin/sysinst/gpt.c:1.26	Sat Jul 17 19:27:22 2021
+++ src/usr.sbin/sysinst/gpt.c	Sat Jan 29 15:32:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.26 2021/07/17 19:27:22 martin Exp $	*/
+/*	$NetBSD: gpt.c,v 1.27 2022/01/29 15:32:49 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1680,6 +1680,9 @@ gpt_free(struct disk_partitions *arg)
 
 	assert(parts != NULL);
 	for (p = parts->partitions; p != NULL; p = n) {
+		if (p->gp_flags & GPEF_WEDGE)
+			register_post_umount_delwedge(parts->dp.disk,
+			p->gp_dev_name);
 		free(__UNCONST(p->last_mounted));
 		n = p->gp_next;
 		free(p);

Index: src/usr.sbin/sysinst/target.c
diff -u src/usr.sbin/sysinst/target.c:1.15 src/usr.sbin/sysinst/target.c:1.16
--- src/usr.sbin/sysinst/target.c:1.15	Sun Jan 31 22:45:47 2021
+++ src/usr.sbin/sysinst/target.c	Sat Jan 29 15:32:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: target.c,v 1.15 2021/01/31 22:45:47 rillig Exp $	*/
+/*	$NetBSD: target.c,v 1.16 2022/01/29 15:32:49 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -71,7 +71,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.15 2021/01/31 22:45:47 rillig Exp $");
+__RCSID("$NetBSD: target.c,v 1.16 2022/01/29 15:32:49 martin Exp $");
 #endif
 
 /*
@@ -83,6 +83,7 @@ __RCSID("$NetBSD: target.c,v 1.15 2021/0
 
 #include 			/* XXX vm_param.h always defines TRUE*/
 #include 
+#include 
 #include 
 #include 			/* stat() */
 #include 			/* statfs() */
@@ -93,7 +94,7 @@ __RCSID("$NetBSD: target.c,v 1.15 2021/0
 #include 
 #include 			/* defines TRUE, but checks  */
 #include 
-
+#include 
 
 #include "defs.h"
 #include "md.h"
@@ -119,6 +120,13 @@ struct unwind_mount {
 	char um_mountpoint[4];		/* Allocated longer... */
 };
 
+/* Record a wedge for later deletion after all file systems have been unmounted */
+struct umount_delwedge {
+	struct umount_delwedge *next;
+	char disk[MAXPATHLEN], wedge[MAXPATHLEN];
+};
+struct umount_delwedge *post_umount_dwlist = NULL;
+
 /* Unwind-mount stack */
 struct unwind_mount *unwind_mountlist = NULL;
 
@@ -519,6 +527,35 @@ target_mount(const char *opts, const cha
 	return target_mount_do(opts, from, on);
 }
 
+static bool
+delete_wedge(const char *disk, const char *wedge)
+{
+	struct dkwedge_info dkw;
+	char diskpath[MAXPATHLEN];
+	int fd, error;
+
+	fd = opendisk(disk, O_RDWR, diskpath, sizeof(diskpath), 0);
+	if (fd < 0)
+		return false;
+	memset(, 0, sizeof(dkw));
+	strlcpy(dkw.dkw_devname, wedge, sizeof(dkw.dkw_devname));
+	error = ioctl(fd, DIOCDWEDGE, );
+	close(fd);
+	return error == 0;
+}
+
+void
+register_post_umount_delwedge(const char *disk, const char *wedge)
+{
+	struct umount_delwedge *dw;
+
+	dw = calloc(1, sizeof(*dw));
+	dw->next = post_umount_dwlist;
+	strlcpy(dw->disk, disk, sizeof(dw->disk));
+	strlcpy(dw->wedge, wedge, sizeof(dw->wedge));
+	post_umount_dwlist = dw;
+}
+
 /*
  * unwind the mount stack, unmounting mounted filesystems.
  * For now, ignore any errors in unmount.
@@ -529,6 +566,7 @@ void
 unwind_mounts(void)
 {
 	struct unwind_mount *m;
+	struct umount_delwedge *dw;
 	static volatile int unwind_in_progress = 0;
 
 	/* signal safety */
@@ -547,6 +585,11 @@ unwind_mounts(void)
 			target_prefix(), m->um_mountpoint);
 		free(m);
 	}
+	while ((dw = post_umount_dwlist) != NULL) {
+		post_umount_dwlist = dw->next;
+		delete_wedge(dw->disk, dw->wedge);
+		free(dw);
+	}
 	unwind_in_progress = 0;
 }
 

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.63 src/usr.sbin/sysinst/util.c:1.64

CVS commit: src/usr.sbin/sysinst

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 15:32:49 UTC 2022

Modified Files:
src/usr.sbin/sysinst: defs.h gpt.c target.c util.c

Log Message:
Try to get rid of all wedges we created (after unmounting).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/gpt.c
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/sysinst/target.c
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/sysinst/util.c

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



CVS commit: src/sys/dev/ic

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 12:27:30 UTC 2022

Modified Files:
src/sys/dev/ic: tpm.c tpmreg.h

Log Message:
tpm(4): Nix TPM_BE16/TPM_BE32.  Just use sys/endian.h.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/tpm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/tpmreg.h

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

Modified files:

Index: src/sys/dev/ic/tpm.c
diff -u src/sys/dev/ic/tpm.c:1.24 src/sys/dev/ic/tpm.c:1.25
--- src/sys/dev/ic/tpm.c:1.24	Sun Jan 16 20:24:34 2022
+++ src/sys/dev/ic/tpm.c	Sat Jan 29 12:27:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpm.c,v 1.24 2022/01/16 20:24:34 riastradh Exp $	*/
+/*	$NetBSD: tpm.c,v 1.25 2022/01/29 12:27:30 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.24 2022/01/16 20:24:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.25 2022/01/29 12:27:30 riastradh Exp $");
 
 #include 
 #include 
@@ -205,14 +205,14 @@ tpm12_suspend(struct tpm_softc *sc)
 	/*
 	 * Verify the response looks reasonable.
 	 */
-	if (TPM_BE16(response.tag) != TPM_TAG_RSP_COMMAND ||
-	TPM_BE32(response.length) != sizeof(response) ||
-	TPM_BE32(response.code) != 0) {
+	if (be16toh(response.tag) != TPM_TAG_RSP_COMMAND ||
+	be32toh(response.length) != sizeof(response) ||
+	be32toh(response.code) != 0) {
 		device_printf(sc->sc_dev,
 		"TPM_ORD_SaveState failed: tag=0x%x length=0x%x code=0x%x",
-		TPM_BE16(response.tag),
-		TPM_BE32(response.length),
-		TPM_BE32(response.code));
+		be16toh(response.tag),
+		be32toh(response.length),
+		be32toh(response.code));
 		error = EIO;
 		goto out;
 	}
@@ -303,14 +303,14 @@ tpm20_suspend(struct tpm_softc *sc)
 	/*
 	 * Verify the response looks reasonable.
 	 */
-	if (TPM_BE16(response.tag) != TPM2_ST_NO_SESSIONS ||
-	TPM_BE32(response.length) != sizeof(response) ||
-	TPM_BE32(response.code) != TPM2_RC_SUCCESS) {
+	if (be16toh(response.tag) != TPM2_ST_NO_SESSIONS ||
+	be32toh(response.length) != sizeof(response) ||
+	be32toh(response.code) != TPM2_RC_SUCCESS) {
 		device_printf(sc->sc_dev,
 		"TPM_CC_Shutdown failed: tag=0x%x length=0x%x code=0x%x",
-		TPM_BE16(response.tag),
-		TPM_BE32(response.length),
-		TPM_BE32(response.code));
+		be16toh(response.tag),
+		be32toh(response.length),
+		be32toh(response.code));
 		error = EIO;
 		goto out;
 	}
@@ -1084,7 +1084,7 @@ tpmread(dev_t dev, struct uio *uio, int 
 		rv = EIO;
 		goto out;
 	}
-	len = TPM_BE32(hdr.length);
+	len = be32toh(hdr.length);
 	if (len > MIN(sizeof(buf), uio->uio_resid) || len < sizeof(hdr)) {
 		rv = EIO;
 		goto out;

Index: src/sys/dev/ic/tpmreg.h
diff -u src/sys/dev/ic/tpmreg.h:1.10 src/sys/dev/ic/tpmreg.h:1.11
--- src/sys/dev/ic/tpmreg.h:1.10	Sun Nov 14 21:18:30 2021
+++ src/sys/dev/ic/tpmreg.h	Sat Jan 29 12:27:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpmreg.h,v 1.10 2021/11/14 21:18:30 riastradh Exp $	*/
+/*	$NetBSD: tpmreg.h,v 1.11 2022/01/29 12:27:30 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -37,14 +37,6 @@
 #include 
 #include 
 
-#if (_BYTE_ORDER == _LITTLE_ENDIAN)
-#define TPM_BE16(a)	bswap16(a)
-#define TPM_BE32(a)	bswap32(a)
-#else
-#define TPM_BE16(a)	(a)
-#define TPM_BE32(a)	(a)
-#endif
-
 struct tpm_header {
 	uint16_t tag;
 	uint32_t length;



CVS commit: src/sys/dev/ic

2022-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 29 12:27:30 UTC 2022

Modified Files:
src/sys/dev/ic: tpm.c tpmreg.h

Log Message:
tpm(4): Nix TPM_BE16/TPM_BE32.  Just use sys/endian.h.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/tpm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/tpmreg.h

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



CVS commit: src/sys/dev/scsipi

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 11:20:30 UTC 2022

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

Log Message:
In some cases the gcc optimizer is not smart enough to figure out why
the luns and nluns variables are never actually used when they are not
initialized - so initialize them always.


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

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



CVS commit: src/sys/dev/scsipi

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 11:20:30 UTC 2022

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

Log Message:
In some cases the gcc optimizer is not smart enough to figure out why
the luns and nluns variables are never actually used when they are not
initialized - so initialize them always.


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

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

Modified files:

Index: src/sys/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.296 src/sys/dev/scsipi/scsiconf.c:1.297
--- src/sys/dev/scsipi/scsiconf.c:1.296	Fri Jan 28 18:23:28 2022
+++ src/sys/dev/scsipi/scsiconf.c	Sat Jan 29 11:20:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.296 2022/01/28 18:23:28 christos Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.297 2022/01/29 11:20:30 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.296 2022/01/28 18:23:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.297 2022/01/29 11:20:30 martin Exp $");
 
 #include 
 #include 
@@ -477,8 +477,8 @@ end2:
 static void
 scsi_discover_luns(struct scsibus_softc *sc, int target, int minlun, int maxlun)
 {
-	uint16_t *luns;
-	size_t nluns;
+	uint16_t *luns = NULL;	/* XXX gcc */
+	size_t nluns = 0;	/* XXX gcc */
 
 	if (scsi_report_luns(sc, target, , ) == 0) {
 		for (size_t i = 0; i < nluns; i++)



CVS commit: src/usr.bin/make

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:44:40 UTC 2022

Modified Files:
src/usr.bin/make: test-variants.sh

Log Message:
tests/make: clean up variants that are tested

Since main.c 1.373 from 2020-10-18, make does not use iovec anymore, so
remove that test variant.

Document the details of why generating the test coverage took so long on
NetBSD < 10.

Add another test variant with optimization for binary size (-Os), since
with that option, GCC 10 does not perform the same data flow analysis as
with -O2, in particular it gets confused about whether local variables
are correctly initialized across function calls.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/test-variants.sh

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



CVS commit: src/usr.bin/make

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:44:40 UTC 2022

Modified Files:
src/usr.bin/make: test-variants.sh

Log Message:
tests/make: clean up variants that are tested

Since main.c 1.373 from 2020-10-18, make does not use iovec anymore, so
remove that test variant.

Document the details of why generating the test coverage took so long on
NetBSD < 10.

Add another test variant with optimization for binary size (-Os), since
with that option, GCC 10 does not perform the same data flow analysis as
with -O2, in particular it gets confused about whether local variables
are correctly initialized across function calls.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/test-variants.sh

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/make/test-variants.sh
diff -u src/usr.bin/make/test-variants.sh:1.14 src/usr.bin/make/test-variants.sh:1.15
--- src/usr.bin/make/test-variants.sh:1.14	Thu Dec  9 20:47:33 2021
+++ src/usr.bin/make/test-variants.sh	Sat Jan 29 10:44:40 2022
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.14 2021/12/09 20:47:33 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.15 2022/01/29 10:44:40 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -108,6 +108,10 @@ testcase USER_CPPFLAGS="-DNO_REGEX"
 #
 testcase USER_CFLAGS="-O3"
 
+# When optimizing for small code size, GCC gets confused by the initialization
+# status of local variables in some cases.
+testcase USER_CFLAGS="-Os"
+
 testcase USER_CFLAGS="-O0 -ggdb"
 
 # The make source code is _intended_ to be compatible with C90.
@@ -142,9 +146,6 @@ testcase USER_CFLAGS="-std=c90" USER_CPP
 # Is expected to fail with " is included in pre-C99 mode".
 testcase USER_CFLAGS="-ansi" USER_CPPFLAGS="-Dinline="
 
-# config.h does not allow overriding these features
-#testcase USER_CPPFLAGS="-UUSE_IOVEC"
-
 # Ensure that there are only side-effect-free conditions in the assert
 # macro, or at least none that affect the outcome of the tests.
 #
@@ -156,18 +157,17 @@ testcase USER_CPPFLAGS="-DNDEBUG"
 # -x and -v flags from echoing the commands from profile files.
 testcase USER_CPPFLAGS="-UMAKE_NATIVE -DHAVE_STRERROR -DHAVE_SETENV -DHAVE_VSNPRINTF"
 
-# Running the code coverage using gcov takes a long time.  Most of this
-# time is spent in gcov_read_unsigned because gcov_open sets the .gcda
-# file to unbuffered, which means that every single byte needs its own
-# system call to be read.
+# Running the code coverage using gcov took a long time on NetBSD < 10, due to
+# https://gnats.netbsd.org/55808.
 #
 # Combining USE_COVERAGE with USE_GCC10 or HAVE_LLVM does not work since
 # these fail to link with the coverage library.
 #
-# Turning the optimization off is required because of:
+# Turning the optimization off is required because gcov does not work on the
+# source code level but on the intermediate code after optimization:
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622
 #
-#testcase USE_COVERAGE="yes" USER_CFLAGS="-O0 -ggdb"
+testcase USE_COVERAGE="yes" USER_CFLAGS="-O0 -ggdb"
 
 testcase USE_FORT="yes"
 



CVS commit: src/usr.bin/make/unit-tests

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:21:26 UTC 2022

Modified Files:
src/usr.bin/make/unit-tests: var-recursive.mk

Log Message:
tests/make: sync comment in test for recursive variable


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-recursive.mk

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/make/unit-tests/var-recursive.mk
diff -u src/usr.bin/make/unit-tests/var-recursive.mk:1.3 src/usr.bin/make/unit-tests/var-recursive.mk:1.4
--- src/usr.bin/make/unit-tests/var-recursive.mk:1.3	Sat Jan 29 10:09:37 2022
+++ src/usr.bin/make/unit-tests/var-recursive.mk	Sat Jan 29 10:21:26 2022
@@ -1,4 +1,4 @@
-# $NetBSD: var-recursive.mk,v 1.3 2022/01/29 10:09:37 rillig Exp $
+# $NetBSD: var-recursive.mk,v 1.4 2022/01/29 10:21:26 rillig Exp $
 #
 # Tests for variable expressions that refer to themselves and thus
 # cannot be evaluated.
@@ -46,8 +46,8 @@ V=	$V
 
 # If a recursive variable is accessed in a command of a target, the makefiles
 # are not parsed anymore, so there is no location information from the
-# .includes and .for directives.  TODO: In such a case, use the target
-# definition to provide at least a hint to the location.
+# .includes and .for directives.  In such a case, use the location of the last
+# command of the target to provide at least a hint to the location.
 VAR=	${VAR}
 target:
 	: OK



CVS commit: src/usr.bin/make/unit-tests

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:21:26 UTC 2022

Modified Files:
src/usr.bin/make/unit-tests: var-recursive.mk

Log Message:
tests/make: sync comment in test for recursive variable


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-recursive.mk

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



CVS commit: src/usr.bin/make

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:19:49 UTC 2022

Modified Files:
src/usr.bin/make: make.h parse.c var.c
src/usr.bin/make/unit-tests: var-recursive.exp

Log Message:
make: for recursive variables in commands, print location

Print the approximate location based on the last command that has been
defined for the target.  It would be possible to get more detailed
location information by counting the number of commands of the target,
but that would get messy due to .USEBEFORE, .USE and .DEFAULT, and
still, this is an edge case, so don't waste too much code for it now.
Having this hint about the location is more helpful than just a plain
"Variable X is recursive" without any further details.


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/make.h
cvs rdiff -u -r1.659 -r1.660 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1007 -r1.1008 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/var-recursive.exp

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/make/make.h
diff -u src/usr.bin/make/make.h:1.293 src/usr.bin/make/make.h:1.294
--- src/usr.bin/make/make.h:1.293	Sat Jan 29 09:38:26 2022
+++ src/usr.bin/make/make.h	Sat Jan 29 10:19:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.293 2022/01/29 09:38:26 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.294 2022/01/29 10:19:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -832,6 +832,7 @@ bool GetBooleanExpr(const char *, bool);
 void Parse_Init(void);
 void Parse_End(void);
 
+void PrintLocation(FILE *, bool, const char *, size_t);
 void PrintStackTrace(bool);
 void Parse_Error(ParseErrorLevel, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 bool Parse_VarAssign(const char *, bool, GNode *) MAKE_ATTR_USE;

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.659 src/usr.bin/make/parse.c:1.660
--- src/usr.bin/make/parse.c:1.659	Sat Jan 29 09:38:26 2022
+++ src/usr.bin/make/parse.c	Sat Jan 29 10:19:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.659 2022/01/29 09:38:26 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.660 2022/01/29 10:19:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.659 2022/01/29 09:38:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.660 2022/01/29 10:19:49 rillig Exp $");
 
 /*
  * A file being read.
@@ -435,7 +435,7 @@ FindKeyword(const char *str)
 	return -1;
 }
 
-static void
+void
 PrintLocation(FILE *f, bool useVars, const char *fname, size_t lineno)
 {
 	char dirbuf[MAXPATHLEN + 1];

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1007 src/usr.bin/make/var.c:1.1008
--- src/usr.bin/make/var.c:1.1007	Sat Jan 29 01:07:31 2022
+++ src/usr.bin/make/var.c	Sat Jan 29 10:19:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1007 2022/01/29 01:07:31 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1008 2022/01/29 10:19:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1007 2022/01/29 01:07:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1008 2022/01/29 10:19:49 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4520,8 +4520,14 @@ Var_Parse(const char **pp, GNode *scope,
 	}
 
 	expr.name = v->name.str;
-	if (v->inUse)
+	if (v->inUse) {
+		if (scope->fname != NULL) {
+			fprintf(stderr, "In a command near ");
+			PrintLocation(stderr, false,
+			scope->fname, scope->lineno);
+		}
 		Fatal("Variable %s is recursive.", v->name.str);
+	}
 
 	/*
 	 * XXX: This assignment creates an alias to the current value of the

Index: src/usr.bin/make/unit-tests/var-recursive.exp
diff -u src/usr.bin/make/unit-tests/var-recursive.exp:1.4 src/usr.bin/make/unit-tests/var-recursive.exp:1.5
--- src/usr.bin/make/unit-tests/var-recursive.exp:1.4	Sat Jan 29 10:09:37 2022
+++ src/usr.bin/make/unit-tests/var-recursive.exp	Sat Jan 29 10:19:49 2022
@@ -13,7 +13,7 @@ Variable V is recursive.
 
 make: stopped in unit-tests
 : OK
-Variable VAR is recursive.
+In a command near "var-recursive.mk" line 55: Variable VAR is recursive.
 
 make: stopped in unit-tests
 exit status 0



CVS commit: src/usr.bin/make

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:19:49 UTC 2022

Modified Files:
src/usr.bin/make: make.h parse.c var.c
src/usr.bin/make/unit-tests: var-recursive.exp

Log Message:
make: for recursive variables in commands, print location

Print the approximate location based on the last command that has been
defined for the target.  It would be possible to get more detailed
location information by counting the number of commands of the target,
but that would get messy due to .USEBEFORE, .USE and .DEFAULT, and
still, this is an edge case, so don't waste too much code for it now.
Having this hint about the location is more helpful than just a plain
"Variable X is recursive" without any further details.


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/make.h
cvs rdiff -u -r1.659 -r1.660 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1007 -r1.1008 src/usr.bin/make/var.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/var-recursive.exp

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



CVS commit: src/usr.bin/make/unit-tests

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:09:37 UTC 2022

Modified Files:
src/usr.bin/make/unit-tests: var-recursive.exp var-recursive.mk

Log Message:
tests/make: demonstrate recursive variable in target


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-recursive.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-recursive.mk

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



CVS commit: src/usr.bin/make/unit-tests

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 10:09:37 UTC 2022

Modified Files:
src/usr.bin/make/unit-tests: var-recursive.exp var-recursive.mk

Log Message:
tests/make: demonstrate recursive variable in target


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-recursive.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-recursive.mk

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/make/unit-tests/var-recursive.exp
diff -u src/usr.bin/make/unit-tests/var-recursive.exp:1.3 src/usr.bin/make/unit-tests/var-recursive.exp:1.4
--- src/usr.bin/make/unit-tests/var-recursive.exp:1.3	Sat Jan 29 09:38:27 2022
+++ src/usr.bin/make/unit-tests/var-recursive.exp	Sat Jan 29 10:09:37 2022
@@ -12,4 +12,8 @@ Variable V is recursive.
 	in var-recursive.mk:43
 
 make: stopped in unit-tests
+: OK
+Variable VAR is recursive.
+
+make: stopped in unit-tests
 exit status 0

Index: src/usr.bin/make/unit-tests/var-recursive.mk
diff -u src/usr.bin/make/unit-tests/var-recursive.mk:1.2 src/usr.bin/make/unit-tests/var-recursive.mk:1.3
--- src/usr.bin/make/unit-tests/var-recursive.mk:1.2	Sat Oct 31 13:45:00 2020
+++ src/usr.bin/make/unit-tests/var-recursive.mk	Sat Jan 29 10:09:37 2022
@@ -1,9 +1,9 @@
-# $NetBSD: var-recursive.mk,v 1.2 2020/10/31 13:45:00 rillig Exp $
+# $NetBSD: var-recursive.mk,v 1.3 2022/01/29 10:09:37 rillig Exp $
 #
 # Tests for variable expressions that refer to themselves and thus
 # cannot be evaluated.
 
-TESTS=	direct indirect conditional short
+TESTS=	direct indirect conditional short target
 
 # Since make exits immediately when it detects a recursive expression,
 # the actual tests are run in sub-makes.
@@ -42,6 +42,18 @@ CONDITIONAL=	${1:?ok:${CONDITIONAL}}
 V=	$V
 .  info $V
 
+.elif ${TEST} == target
+
+# If a recursive variable is accessed in a command of a target, the makefiles
+# are not parsed anymore, so there is no location information from the
+# .includes and .for directives.  TODO: In such a case, use the target
+# definition to provide at least a hint to the location.
+VAR=	${VAR}
+target:
+	: OK
+	: ${VAR}
+	: OK
+
 .else
 .  error Unknown test "${TEST}"
 .endif



CVS commit: src/usr.bin/make

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 09:38:27 UTC 2022

Modified Files:
src/usr.bin/make: main.c make.h parse.c
src/usr.bin/make/unit-tests: var-recursive.exp

Log Message:
make: print stack trace on fatal errors

The only fatal error that occurs while the makefiles are read in is the
one about recursive variables, which didn't give any hint about the
location before.

If a recursive variable is detected while evaluating the commands of a
target to be made, there is no location information, as before.


To generate a diff of this commit:
cvs rdiff -u -r1.576 -r1.577 src/usr.bin/make/main.c
cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/make.h
cvs rdiff -u -r1.658 -r1.659 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-recursive.exp

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/make/main.c
diff -u src/usr.bin/make/main.c:1.576 src/usr.bin/make/main.c:1.577
--- src/usr.bin/make/main.c:1.576	Thu Jan 27 06:02:59 2022
+++ src/usr.bin/make/main.c	Sat Jan 29 09:38:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.576 2022/01/27 06:02:59 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.577 2022/01/29 09:38:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.576 2022/01/27 06:02:59 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.577 2022/01/29 09:38:26 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1828,6 +1828,7 @@ Fatal(const char *fmt, ...)
 	va_end(ap);
 	(void)fprintf(stderr, "\n");
 	(void)fflush(stderr);
+	PrintStackTrace(true);
 
 	PrintOnError(NULL, "\n");
 

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.292 src/usr.bin/make/make.h:1.293
--- src/usr.bin/make/make.h:1.292	Sat Jan 29 01:07:31 2022
+++ src/usr.bin/make/make.h	Sat Jan 29 09:38:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.292 2022/01/29 01:07:31 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.293 2022/01/29 09:38:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -832,6 +832,7 @@ bool GetBooleanExpr(const char *, bool);
 void Parse_Init(void);
 void Parse_End(void);
 
+void PrintStackTrace(bool);
 void Parse_Error(ParseErrorLevel, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 bool Parse_VarAssign(const char *, bool, GNode *) MAKE_ATTR_USE;
 void Parse_AddIncludeDir(const char *);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.658 src/usr.bin/make/parse.c:1.659
--- src/usr.bin/make/parse.c:1.658	Sat Jan 29 01:07:31 2022
+++ src/usr.bin/make/parse.c	Sat Jan 29 09:38:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.658 2022/01/29 01:07:31 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.659 2022/01/29 09:38:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.658 2022/01/29 01:07:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.659 2022/01/29 09:38:26 rillig Exp $");
 
 /*
  * A file being read.
@@ -348,8 +348,14 @@ loadfile(const char *path, int fd)
 	return buf;		/* may not be null-terminated */
 }
 
-static void
-PrintStackTrace(void)
+/*
+ * Print the current chain of .include and .for directives.  In Parse_Fatal
+ * or other functions that already print the location, includingInnermost
+ * would be redundant, but in other cases like Error or Fatal it needs to be
+ * included.
+ */
+void
+PrintStackTrace(bool includingInnermost)
 {
 	const IncludedFile *entries;
 	size_t i, n;
@@ -359,7 +365,7 @@ PrintStackTrace(void)
 	if (n == 0)
 		return;
 
-	if (entries[n - 1].forLoop == NULL)
+	if (!includingInnermost && entries[n - 1].forLoop == NULL)
 		n--;		/* already in the diagnostic */
 
 	for (i = n; i-- > 0;) {
@@ -484,7 +490,7 @@ ParseVErrorInternal(FILE *f, bool useVar
 	}
 
 	if (DEBUG(PARSE))
-		PrintStackTrace();
+		PrintStackTrace(false);
 }
 
 static void MAKE_ATTR_PRINTFLIKE(4, 5)

Index: src/usr.bin/make/unit-tests/var-recursive.exp
diff -u src/usr.bin/make/unit-tests/var-recursive.exp:1.2 src/usr.bin/make/unit-tests/var-recursive.exp:1.3
--- src/usr.bin/make/unit-tests/var-recursive.exp:1.2	Sat Oct 31 13:45:00 2020
+++ src/usr.bin/make/unit-tests/var-recursive.exp	Sat Jan 29 09:38:27 2022
@@ -1,12 +1,15 @@
 make: "var-recursive.mk" line 20: still there
 Variable DIRECT is recursive.
+	in var-recursive.mk:21
 
 make: stopped in unit-tests
 Variable INDIRECT1 is recursive.
+	in var-recursive.mk:28
 
 make: stopped in unit-tests
 make: "var-recursive.mk" line 35: ok
 Variable V is recursive.
+	in var-recursive.mk:43
 
 make: stopped in unit-tests
 exit status 0



CVS commit: src/usr.bin/make

2022-01-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 29 09:38:27 UTC 2022

Modified Files:
src/usr.bin/make: main.c make.h parse.c
src/usr.bin/make/unit-tests: var-recursive.exp

Log Message:
make: print stack trace on fatal errors

The only fatal error that occurs while the makefiles are read in is the
one about recursive variables, which didn't give any hint about the
location before.

If a recursive variable is detected while evaluating the commands of a
target to be made, there is no location information, as before.


To generate a diff of this commit:
cvs rdiff -u -r1.576 -r1.577 src/usr.bin/make/main.c
cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/make.h
cvs rdiff -u -r1.658 -r1.659 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-recursive.exp

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



CVS commit: src/usr.sbin/cpuctl/arch

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:20:45 UTC 2022

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.sbin/cpuctl/arch/i386.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/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.126 src/usr.sbin/cpuctl/arch/i386.c:1.127
--- src/usr.sbin/cpuctl/arch/i386.c:1.126	Thu Jan 27 09:53:43 2022
+++ src/usr.sbin/cpuctl/arch/i386.c	Sat Jan 29 08:20:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.126 2022/01/27 09:53:43 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.127 2022/01/29 08:20:45 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.126 2022/01/27 09:53:43 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.127 2022/01/29 08:20:45 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -2257,6 +2257,18 @@ identifycpu(int fd, const char *cpuname)
 			print_bits(cpuname, "Perfmon-edx",
 			CPUID_PERF_FLAGS3, descs[3]);
 		}
+		if (ci->ci_max_cpuid >= 0x1a) {
+			x86_cpuid(0x1a, descs);
+			if (descs[0] != 0) {
+aprint_verbose("%s: Hybrid: Core type %02x, "
+"Native Model ID %07x\n",
+cpuname,
+(uint8_t)__SHIFTOUT(descs[0],
+	CPUID_HYBRID_CORETYPE),
+(uint32_t)__SHIFTOUT(descs[0],
+	CPUID_HYBRID_NATIVEID));
+			}
+		}
 	}
 
 #ifdef INTEL_ONDEMAND_CLOCKMOD



CVS commit: src/usr.sbin/cpuctl/arch

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:20:45 UTC 2022

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
Decode Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.sbin/cpuctl/arch/i386.c

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



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

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:18:22 UTC 2022

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
Add Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.187 src/sys/arch/x86/include/specialreg.h:1.188
--- src/sys/arch/x86/include/specialreg.h:1.187	Mon Jan 17 20:56:02 2022
+++ src/sys/arch/x86/include/specialreg.h	Sat Jan 29 08:18:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.187 2022/01/17 20:56:02 andvar Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.188 2022/01/29 08:18:22 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -650,6 +650,15 @@
 #define CPUID_DATP_FULLASSOC	__BIT(8)	/* Full associative */
 #define CPUID_DATP_SHAREING	__BITS(25, 14)	/* shareing */
 
+/*
+ * Intel Hybrid Information Enumeration.
+ * CPUID Fn_001a
+ */
+/* %eax */
+#define CPUID_HYBRID_NATIVEID	__BITS(23, 0)	/* Native model ID */
+#define CPUID_HYBRID_CORETYPE	__BITS(31, 24)	/* Core type */
+#define   CPUID_HYBRID_CORETYPE_ATOM	0x20		/* Atom */
+#define   CPUID_HYBRID_CORETYPE_CORE	0x40		/* Core */
 
 /*
  * Intel extended features.



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

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:18:22 UTC 2022

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
Add Intel Hybrid Information Enumeration (CPUID Fn_001a).


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/x86/include/specialreg.h

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



CVS commit: src/sys/dev/ic

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:17:04 UTC 2022

Modified Files:
src/sys/dev/ic: spdmem.c

Log Message:
Add code for DDR5 a little. I have no datasheet.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/spdmem.c

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.36 src/sys/dev/ic/spdmem.c:1.37
--- src/sys/dev/ic/spdmem.c:1.36	Sat Jan 29 08:14:24 2022
+++ src/sys/dev/ic/spdmem.c	Sat Jan 29 08:17:03 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.36 2022/01/29 08:14:24 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.37 2022/01/29 08:17:03 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.36 2022/01/29 08:14:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.37 2022/01/29 08:17:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -269,6 +269,14 @@ spdmem_common_probe(struct spdmem_softc 
 		 * it some other time.
 		 */
 		return 1;
+	} else if (spd_type == SPDMEM_MEMTYPE_DDR5SDRAM) {
+		/* XXX Need Datasheet. */
+		(sc->sc_read)(sc, 0, );
+		spd_len = val & 0x0f;
+		if ((unsigned int)spd_len >= __arraycount(spd_rom_sizes))
+			return 0;
+		aprint_verbose("DDR5 SPD ROM?\n");
+		return 0;
 	}
 
 	/* For unrecognized memory types, don't match at all */



CVS commit: src/sys/dev/ic

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:17:04 UTC 2022

Modified Files:
src/sys/dev/ic: spdmem.c

Log Message:
Add code for DDR5 a little. I have no datasheet.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/spdmem.c

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



CVS commit: src/sys/dev/ic

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:14:24 UTC 2022

Modified Files:
src/sys/dev/ic: spdmem.c spdmemreg.h

Log Message:
Add LPDDR4X and DDR5. Not decoded yet.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/spdmemreg.h

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.35 src/sys/dev/ic/spdmem.c:1.36
--- src/sys/dev/ic/spdmem.c:1.35	Tue Mar 24 03:47:39 2020
+++ src/sys/dev/ic/spdmem.c	Sat Jan 29 08:14:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.35 2020/03/24 03:47:39 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.36 2022/01/29 08:14:24 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.35 2020/03/24 03:47:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.36 2022/01/29 08:14:24 msaitoh Exp $");
 
 #include 
 #include 
@@ -82,6 +82,8 @@ static const char* const spdmem_basic_ty
 	"DDR4E SDRAM",
 	"LPDDR3 SDRAM",
 	"LPDDR4 SDRAM"
+	"LPDDR4X SDRAM",
+	"DDR5 SDRAM",
 };
 
 static const char* const spdmem_ddr4_module_types[] = {

Index: src/sys/dev/ic/spdmemreg.h
diff -u src/sys/dev/ic/spdmemreg.h:1.4 src/sys/dev/ic/spdmemreg.h:1.5
--- src/sys/dev/ic/spdmemreg.h:1.4	Thu Dec 24 14:16:18 2015
+++ src/sys/dev/ic/spdmemreg.h	Sat Jan 29 08:14:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemreg.h,v 1.4 2015/12/24 14:16:18 msaitoh Exp $ */
+/* $NetBSD: spdmemreg.h,v 1.5 2022/01/29 08:14:24 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -44,6 +44,8 @@
 #define	SPDMEM_MEMTYPE_DDR4ESDRAM	0x0E
 #define	SPDMEM_MEMTYPE_LPDDR3SDRAM	0x0F
 #define	SPDMEM_MEMTYPE_LPDDR4SDRAM	0x10
+#define	SPDMEM_MEMTYPE_LPDDR4XSDRAM	0x11
+#define	SPDMEM_MEMTYPE_DDR5SDRAM	0x12
 
 #define	SPDMEM_MEMTYPE_RAMBUS		0x11
 #define	SPDMEM_MEMTYPE_DIRECTRAMBUS	0x01



CVS commit: src/sys/dev/ic

2022-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 29 08:14:24 UTC 2022

Modified Files:
src/sys/dev/ic: spdmem.c spdmemreg.h

Log Message:
Add LPDDR4X and DDR5. Not decoded yet.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/spdmemreg.h

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