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

2020-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  2 07:55:11 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.383 -r1.384 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.383 src/sys/arch/arm/arm32/pmap.c:1.384
--- src/sys/arch/arm/arm32/pmap.c:1.383	Sun Feb  2 07:47:51 2020
+++ src/sys/arch/arm/arm32/pmap.c	Sun Feb  2 07:55:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.383 2020/02/02 07:47:51 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.384 2020/02/02 07:55:11 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -197,20 +197,22 @@
 #define _INTR_PRIVATE
 #endif
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.384 2020/02/02 07:55:11 skrll Exp $");
+
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
-#include 
+#include 
+#include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
@@ -221,8 +223,6 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.383 2020/02/02 07:47:51 skrll Exp $");
-
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
 



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

2020-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  2 07:47:51 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Fix comment


To generate a diff of this commit:
cvs rdiff -u -r1.382 -r1.383 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.382 src/sys/arch/arm/arm32/pmap.c:1.383
--- src/sys/arch/arm/arm32/pmap.c:1.382	Sat Jan 25 16:19:29 2020
+++ src/sys/arch/arm/arm32/pmap.c	Sun Feb  2 07:47:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.382 2020/01/25 16:19:29 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.383 2020/02/02 07:47:51 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -221,7 +221,7 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.382 2020/01/25 16:19:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.383 2020/02/02 07:47:51 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -614,7 +614,7 @@ struct l1_ttable {
 /*
  * L1 Page Tables are tracked using a Least Recently Used list.
  *  - New L1s are allocated from the HEAD.
- *  - Freed L1s are added to the TAIl.
+ *  - Freed L1s are added to the TAIL.
  *  - Recently accessed L1s (where an 'access' is some change to one of
  *the userland pmaps which owns this L1) are moved to the TAIL.
  */



CVS commit: src/sys/dev/i2c

2020-02-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb  2 06:43:14 UTC 2020

Modified Files:
src/sys/dev/i2c: pcagpio.c

Log Message:
break long lines


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/pcagpio.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/i2c/pcagpio.c
diff -u src/sys/dev/i2c/pcagpio.c:1.2 src/sys/dev/i2c/pcagpio.c:1.3
--- src/sys/dev/i2c/pcagpio.c:1.2	Sun Feb  2 06:41:27 2020
+++ src/sys/dev/i2c/pcagpio.c	Sun Feb  2 06:43:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pcagpio.c,v 1.2 2020/02/02 06:41:27 macallan Exp $ */
+/* $NetBSD: pcagpio.c,v 1.3 2020/02/02 06:43:14 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.2 2020/02/02 06:41:27 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.3 2020/02/02 06:43:14 macallan Exp $");
 
 #include 
 #include 
@@ -77,7 +77,8 @@ struct pcagpio_softc {
 
 static void 	pcagpio_writereg(struct pcagpio_softc *, int, uint32_t);
 static uint32_t pcagpio_readreg(struct pcagpio_softc *, int);
-static void	pcagpio_attach_led(struct pcagpio_softc *, char *, int, int, int);
+static void	pcagpio_attach_led(
+			struct pcagpio_softc *, char *, int, int, int);
 static int	pcagpio_get(void *);
 static void	pcagpio_set(void *, int);
 
@@ -172,10 +173,12 @@ pcagpio_attach(device_t parent, device_t
 		for (i = 0; i < prop_array_count(pins); i++) {
 			nptr = NULL;
 			pin = prop_array_get(pins, i);
-			ok &= prop_dictionary_get_cstring_nocopy(pin, "name", );
+			ok &= prop_dictionary_get_cstring_nocopy(pin, "name",
+			);
 			strncpy(name, nptr, 31);
 			ok &= prop_dictionary_get_uint32(pin, "pin", );
-			ok &= prop_dictionary_get_bool(pin, "active_high", );
+			ok &= prop_dictionary_get_bool(
+			pin, "active_high", );
 			/* optional default state */
 			def = -1;
 			prop_dictionary_get_int32(pin, "default_state", );
@@ -244,7 +247,8 @@ pcagpio_attach_led(struct pcagpio_softc 
 	l->v_off = act ? 0 : l->mask;
 	led_attach(n, l, pcagpio_get, pcagpio_set);
 	if (def != -1) pcagpio_set(l, def);
-	DPRINTF("%s: %04x %04x %04x def %d\n", __func__, l->mask, l->v_on, l->v_off, def);
+	DPRINTF("%s: %04x %04x %04x def %d\n",
+	__func__, l->mask, l->v_on, l->v_off, def);
 	sc->sc_nleds++;
 }
 



CVS commit: src/sys/dev/i2c

2020-02-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb  2 06:41:27 UTC 2020

Modified Files:
src/sys/dev/i2c: files.i2c pcagpio.c

Log Message:
attach LEDs according to info passed as device properties


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/pcagpio.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/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.109 src/sys/dev/i2c/files.i2c:1.110
--- src/sys/dev/i2c/files.i2c:1.109	Wed Jan 29 05:27:05 2020
+++ src/sys/dev/i2c/files.i2c	Sun Feb  2 06:41:27 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.109 2020/01/29 05:27:05 macallan Exp $
+#	$NetBSD: files.i2c,v 1.110 2020/02/02 06:41:27 macallan Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -387,6 +387,6 @@ attach	cwfg at iic
 file	dev/i2c/cwfg.ccwfg
 
 # Philips PCA955x GPIO
-device	pcagpio
+device	pcagpio: leds
 attach	pcagpio at iic
 file	dev/i2c/pcagpio.c			pcagpio

Index: src/sys/dev/i2c/pcagpio.c
diff -u src/sys/dev/i2c/pcagpio.c:1.1 src/sys/dev/i2c/pcagpio.c:1.2
--- src/sys/dev/i2c/pcagpio.c:1.1	Wed Jan 29 05:27:05 2020
+++ src/sys/dev/i2c/pcagpio.c	Sun Feb  2 06:41:27 2020
@@ -1,7 +1,7 @@
-/* $NetBSD: pcagpio.c,v 1.1 2020/01/29 05:27:05 macallan Exp $ */
+/* $NetBSD: pcagpio.c,v 1.2 2020/02/02 06:41:27 macallan Exp $ */
 
 /*-
- * Copyright (c) 2018 Michael Lorenz
+ * Copyright (c) 2020 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.1 2020/01/29 05:27:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.2 2020/02/02 06:41:27 macallan Exp $");
 
 #include 
 #include 
@@ -40,6 +40,13 @@ __KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 
 #include 
 
 #include 
+#include 
+
+#ifdef PCAGPIO_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
 
 /* commands */
 #define PCAGPIO_INPUT	0x00	/* line status */
@@ -50,17 +57,29 @@ __KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 
 static int	pcagpio_match(device_t, cfdata_t, void *);
 static void	pcagpio_attach(device_t, device_t, void *);
 
+/* we can only pass one cookie to led_attach() but we need several values... */
+struct pcagpio_led {
+	void *cookie;
+	uint32_t mask, v_on, v_off;
+};
+
 struct pcagpio_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
 	i2c_addr_t	sc_addr;
 
 	int		sc_is_16bit;
+	uint32_t	sc_state;
+	struct pcagpio_led sc_leds[16];
+	int		sc_nleds;
 };
 
 
 static void 	pcagpio_writereg(struct pcagpio_softc *, int, uint32_t);
 static uint32_t pcagpio_readreg(struct pcagpio_softc *, int);
+static void	pcagpio_attach_led(struct pcagpio_softc *, char *, int, int, int);
+static int	pcagpio_get(void *);
+static void	pcagpio_set(void *, int);
 
 CFATTACH_DECL_NEW(pcagpio, sizeof(struct pcagpio_softc),
 pcagpio_match, pcagpio_attach, NULL, NULL);
@@ -85,6 +104,7 @@ pcagpio_match(device_t parent, cfdata_t 
 	return 0;
 }
 
+#ifdef PCAGPIO_DEBUG
 static void
 printdir(uint32_t val, uint32_t mask, char letter)
 {
@@ -103,6 +123,7 @@ printdir(uint32_t val, uint32_t mask, ch
 	printf("dir: %s\n", flags);
 	printf("lvl: %s\n", bits);
 }	
+#endif
 
 static void
 pcagpio_attach(device_t parent, device_t self, void *aux)
@@ -110,11 +131,14 @@ pcagpio_attach(device_t parent, device_t
 	struct pcagpio_softc *sc = device_private(self);
 	struct i2c_attach_args *ia = aux;
 	const struct device_compatible_entry *dce;
-	uint32_t dir, in, out;
+	prop_dictionary_t dict = device_properties(self);
+	prop_array_t pins;
+	prop_dictionary_t pin;
 
 	sc->sc_dev = self;
 	sc->sc_i2c = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
+	sc->sc_nleds = 0;
 
 	aprint_naive("\n");
 	sc->sc_is_16bit = 0;
@@ -123,17 +147,43 @@ pcagpio_attach(device_t parent, device_t
 
 	aprint_normal(": %s\n", sc->sc_is_16bit ? "PCA9555" : "PCA9556");
 
-	if (sc->sc_addr == 0x38) pcagpio_writereg(sc, 1, 0xff & ~0x10);
-	
-	dir = pcagpio_readreg(sc, 3);
-	in = pcagpio_readreg(sc, 0);
-	out = pcagpio_readreg(sc, 1);
+	sc->sc_state = pcagpio_readreg(sc, PCAGPIO_OUTPUT);
+
+#ifdef PCAGPIO_DEBUG
+	uint32_t dir, in, out;
+	dir = pcagpio_readreg(sc, PCAGPIO_CONFIG);
+	in = pcagpio_readreg(sc, PCAGPIO_INPUT);
+	out = sc->sc_state;
 
 	out &= ~dir;
 	in &= dir;
 	
 	printdir(in, dir, 'I');
 	printdir(out, ~dir, 'O');
+#endif
+
+	pins = prop_dictionary_get(dict, "pins");
+	if (pins != NULL) {
+		int i, num, def;
+		char name[32];
+		const char *nptr;
+		bool ok = TRUE, act;
+
+		for (i = 0; i < prop_array_count(pins); i++) {
+			nptr = NULL;
+			pin = prop_array_get(pins, i);
+			ok &= prop_dictionary_get_cstring_nocopy(pin, "name", );
+			strncpy(name, nptr, 31);
+			ok &= prop_dictionary_get_uint32(pin, "pin", );
+			ok &= prop_dictionary_get_bool(pin, "active_high", );
+			/* optional default state */
+			def = 

CVS commit: src/sys/arch/sparc64/sparc64

2020-02-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb  2 06:38:24 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
pass pin info to pcagpio instances, so far for front panel LEDs on
Sun Fire v210 only


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/arch/sparc64/sparc64/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/arch/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.215 src/sys/arch/sparc64/sparc64/autoconf.c:1.216
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.215	Sat Jan  5 15:46:02 2019
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Feb  2 06:38:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.215 2019/01/05 15:46:02 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.215 2019/01/05 15:46:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1046,6 +1046,48 @@ device_setofnode(device_t dev, int node)
 	device_xname(dev), node));
 }
 
+static void
+add_gpio_LED(prop_array_t pins, const char *name, int num, int act, int def)
+{
+	prop_dictionary_t pin = prop_dictionary_create();
+	prop_dictionary_set_cstring(pin, "name", name);
+	prop_dictionary_set_uint32(pin, "type", 0);	/* 0 for LED, for now */
+	prop_dictionary_set_uint32(pin, "pin", num);
+	prop_dictionary_set_bool(pin, "active_high", act);
+	if (def != -1)
+		prop_dictionary_set_int32(pin, "default_state", def);
+	prop_array_add(pins, pin);
+	prop_object_release(pin);
+}
+	
+static void
+add_gpio_props_v210(device_t dev, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+	prop_dictionary_t dict = device_properties(dev);
+	prop_array_t pins;
+
+	switch (ia->ia_addr) {
+		case 0x38:	/* front panel LEDs */
+			pins = prop_array_create();
+			add_gpio_LED(pins, "indicator", 7, 0, -1);
+			add_gpio_LED(pins, "fault", 5, 0, 0);
+			add_gpio_LED(pins, "power", 4, 0, 1);
+			prop_dictionary_set(dict, "pins", pins);
+			prop_object_release(pins);
+			break;
+		case 0x23:	/* drive bay LEDs */
+			pins = prop_array_create();
+			add_gpio_LED(pins, "bay0_fault", 10, 0, 0);
+			add_gpio_LED(pins, "bay1_fault", 11, 0, 0);
+			add_gpio_LED(pins, "bay0_remove", 12, 0, 0);
+			add_gpio_LED(pins, "bay1_remove", 13, 0, 0);
+			prop_dictionary_set(dict, "pins", pins);
+			prop_object_release(pins);
+			break;
+	}
+}
+
 /*
  * Called back during autoconfiguration for each device found
  */
@@ -1090,6 +1132,11 @@ device_register(device_t dev, void *aux)
 			return;
 
 		ofnode = (int)ia->ia_cookie;
+		if (device_is_a(dev, "pcagpio")) {
+			if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
+add_gpio_props_v210(dev, aux);
+			}
+		} 
 	} else if (device_is_a(dev, "sd") || device_is_a(dev, "cd")) {
 		struct scsipibus_attach_args *sa = aux;
 		struct scsipi_periph *periph = sa->sa_periph;



CVS commit: src/sys/dev/pcmcia

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb  2 05:56:42 UTC 2020

Modified Files:
src/sys/dev/pcmcia: if_xi.c

Log Message:
- Adopt .
- Use ifmedia_fini().


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pcmcia/if_xi.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/pcmcia/if_xi.c
diff -u src/sys/dev/pcmcia/if_xi.c:1.93 src/sys/dev/pcmcia/if_xi.c:1.94
--- src/sys/dev/pcmcia/if_xi.c:1.93	Mon Jan  6 07:15:03 2020
+++ src/sys/dev/pcmcia/if_xi.c	Sun Feb  2 05:56:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xi.c,v 1.93 2020/01/06 07:15:03 msaitoh Exp $ */
+/*	$NetBSD: if_xi.c,v 1.94 2020/02/02 05:56:42 thorpej Exp $ */
 /*	OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp 	*/
 
 /*
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.93 2020/01/06 07:15:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.94 2020/02/02 05:56:42 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -259,9 +259,9 @@ xi_detach(device_t self, int flags)
 	rnd_detach_source(>sc_rnd_source);
 
 	mii_detach(>sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
-	ifmedia_delete_instance(>sc_mii.mii_media, IFM_INST_ANY);
 	ether_ifdetach(ifp);
 	if_detach(ifp);
+	ifmedia_fini(>sc_mii.mii_media);
 
 	return 0;
 }
@@ -323,7 +323,7 @@ xi_intr(void *arg)
 		if (recvcount > MAX_BYTES_INTR) {
 			DPRINTF(XID_INTR,
 			("xi: too many bytes this interrupt\n"));
-			ifp->if_iqdrops++;
+			if_statinc(ifp, if_iqdrops);
 			/* Drop packet. */
 			bus_space_write_2(sc->sc_bst, sc->sc_bsh, DO0,
 			DO_SKIP_RX_PKT);
@@ -336,25 +336,25 @@ xi_intr(void *arg)
 
 	/* Packet too long? */
 	if (rsr & RSR_TOO_LONG) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		DPRINTF(XID_INTR, ("xi: packet too long\n"));
 	}
 
 	/* CRC error? */
 	if (rsr & RSR_CRCERR) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		DPRINTF(XID_INTR, ("xi: CRC error detected\n"));
 	}
 
 	/* Alignment error? */
 	if (rsr & RSR_ALIGNERR) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		DPRINTF(XID_INTR, ("xi: alignment error detected\n"));
 	}
 
 	/* Check for rx overrun. */
 	if (rx_status & RX_OVERRUN) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		bus_space_write_1(sc->sc_bst, sc->sc_bsh, CR, CLR_RX_OVERRUN);
 		DPRINTF(XID_INTR, ("xi: overrun cleared\n"));
 	}
@@ -363,14 +363,14 @@ xi_intr(void *arg)
 	if_schedule_deferred_start(ifp);
 
 	/* Detected excessive collisions? */
-	if ((tx_status & EXCESSIVE_COLL) && ifp->if_opackets > 0) {
+	if ((tx_status & EXCESSIVE_COLL) /* XXX && ifp->if_opackets > 0 */) {
 		DPRINTF(XID_INTR, ("xi: excessive collisions\n"));
 		bus_space_write_1(sc->sc_bst, sc->sc_bsh, CR, RESTART_TX);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 
-	if ((tx_status & TX_ABORT) && ifp->if_opackets > 0)
-		ifp->if_oerrors++;
+	if ((tx_status & TX_ABORT) /* && XXX ifp->if_opackets > 0 */)
+		if_statinc(ifp, if_oerrors);
 
 	/* have handled the interrupt */
 	rnd_add_uint32(>sc_rnd_source, tx_status);
@@ -645,7 +645,7 @@ xi_watchdog(struct ifnet *ifp)
 	struct xi_softc *sc = ifp->if_softc;
 
 	printf("%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	xi_reset(sc);
 }
@@ -824,7 +824,7 @@ xi_start(struct ifnet *ifp)
 	splx(s);
 
 	ifp->if_timer = 5;
-	++ifp->if_opackets;
+	if_statinc(ifp, if_opackets);
 }
 
 STATIC int



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

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb  2 05:27:21 UTC 2020

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
- Adopt .
- Use ifmedia_fini().


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/pci/if_vmx.c

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

Modified files:

Index: src/sys/arch/x86/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.56 src/sys/arch/x86/pci/if_vmx.c:1.57
--- src/sys/arch/x86/pci/if_vmx.c:1.56	Wed Jan 29 08:43:30 2020
+++ src/sys/arch/x86/pci/if_vmx.c	Sun Feb  2 05:27:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.56 2020/01/29 08:43:30 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.57 2020/02/02 05:27:21 thorpej Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.56 2020/01/29 08:43:30 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.57 2020/02/02 05:27:21 thorpej Exp $");
 
 #include 
 #include 
@@ -179,9 +179,11 @@ struct vmxnet3_comp_ring {
 };
 
 struct vmxnet3_txq_stats {
+#if 0
 	uint64_t vmtxs_opackets;	/* if_opackets */
 	uint64_t vmtxs_obytes;		/* if_obytes */
 	uint64_t vmtxs_omcasts;		/* if_omcasts */
+#endif
 	uint64_t vmtxs_csum;
 	uint64_t vmtxs_tso;
 	uint64_t vmtxs_full;
@@ -211,12 +213,14 @@ struct vmxnet3_txqueue {
 	struct evcnt vxtxq_defrag_failed;
 };
 
+#if 0
 struct vmxnet3_rxq_stats {
 	uint64_t vmrxs_ipackets;	/* if_ipackets */
 	uint64_t vmrxs_ibytes;		/* if_ibytes */
 	uint64_t vmrxs_iqdrops;		/* if_iqdrops */
 	uint64_t vmrxs_ierrors;		/* if_ierrors */
 };
+#endif
 
 struct vmxnet3_rxqueue {
 	kmutex_t *vxrxq_mtx;
@@ -225,7 +229,9 @@ struct vmxnet3_rxqueue {
 	struct mbuf *vxrxq_mtail;
 	struct vmxnet3_rxring vxrxq_cmd_ring[VMXNET3_RXRINGS_PERQ];
 	struct vmxnet3_comp_ring vxrxq_comp_ring;
+#if 0
 	struct vmxnet3_rxq_stats vxrxq_stats;
+#endif
 	struct vmxnet3_rxq_shared *vxrxq_rs;
 	char vxrxq_name[16];
 
@@ -670,10 +676,9 @@ vmxnet3_detach(device_t self, int flags)
 		callout_destroy(>vmx_tick);
 		VMXNET3_CORE_UNLOCK(sc);
 
-		ifmedia_delete_instance(>vmx_media, IFM_INST_ANY);
-
 		ether_ifdetach(ifp);
 		if_detach(ifp);
+		ifmedia_fini(>vmx_media);
 	}
 
 	vmxnet3_teardown_stats(sc);
@@ -2109,6 +2114,7 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *
 	struct vmxnet3_comp_ring *txc;
 	struct vmxnet3_txcompdesc *txcd;
 	struct vmxnet3_txbuf *txb;
+	struct ifnet *ifp;
 	struct mbuf *m;
 	u_int sop;
 	bool more = false;
@@ -2116,9 +2122,11 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *
 	sc = txq->vxtxq_sc;
 	txr = >vxtxq_cmd_ring;
 	txc = >vxtxq_comp_ring;
+	ifp = >vmx_ethercom.ec_if;
 
 	VMXNET3_TXQ_LOCK_ASSERT(txq);
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	for (;;) {
 		if (limit-- == 0) {
 			more = true;
@@ -2144,10 +2152,10 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *
 			BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->vmx_dmat, txb->vtxb_dmamap);
 
-			txq->vxtxq_stats.vmtxs_opackets++;
-			txq->vxtxq_stats.vmtxs_obytes += m->m_pkthdr.len;
+			if_statinc_ref(nsr, if_opackets);
+			if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 			if (m->m_flags & M_MCAST)
-txq->vxtxq_stats.vmtxs_omcasts++;
+if_statinc_ref(nsr, if_omcasts);
 
 			m_freem(m);
 			txb->vtxb_m = NULL;
@@ -2155,6 +2163,7 @@ vmxnet3_txq_eof(struct vmxnet3_txqueue *
 
 		txr->vxtxr_next = (txcd->eop_idx + 1) % txr->vxtxr_ndesc;
 	}
+	IF_STAT_PUTREF(ifp);
 
 	if (txr->vxtxr_head == txr->vxtxr_next)
 		txq->vxtxq_watchdog = 0;
@@ -2310,7 +2319,7 @@ vmxnet3_rxq_input(struct vmxnet3_rxqueue
 	ifp = >vmx_ethercom.ec_if;
 
 	if (rxcd->error) {
-		rxq->vxrxq_stats.vmrxs_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		m_freem(m);
 		return;
 	}
@@ -2320,8 +2329,10 @@ vmxnet3_rxq_input(struct vmxnet3_rxqueue
 	if (rxcd->vlan)
 		vlan_set_tag(m, rxcd->vtag);
 
-	rxq->vxrxq_stats.vmrxs_ipackets++;
-	rxq->vxrxq_stats.vmrxs_ibytes += m->m_pkthdr.len;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statinc_ref(nsr, if_ipackets);
+	if_statadd_ref(nsr, if_ibytes, m->m_pkthdr.len);
+	IF_STAT_PUTREF(ifp);
 
 	if_percpuq_enqueue(ifp->if_percpuq, m);
 }
@@ -2412,7 +2423,7 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *
 			}
 
 			if (vmxnet3_newbuf(sc, rxq, rxr) != 0) {
-rxq->vxrxq_stats.vmrxs_iqdrops++;
+if_statinc(ifp, if_iqdrops);
 vmxnet3_rxq_eof_discard(rxq, rxr, idx);
 if (!rxcd->eop)
 	vmxnet3_rxq_discard_chain(rxq);
@@ -2431,7 +2442,7 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue *
 			KASSERT(m_head != NULL);
 
 			if (vmxnet3_newbuf(sc, rxq, rxr) != 0) {
-rxq->vxrxq_stats.vmrxs_iqdrops++;
+if_statinc(ifp, if_iqdrops);
 vmxnet3_rxq_eof_discard(rxq, rxr, idx);
 if (!rxcd->eop)
 	vmxnet3_rxq_discard_chain(rxq);
@@ -3385,45 +3396,7 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long 
 		}
 		break;
 	}
-	case SIOCGIFDATA:
-	case SIOCZIFDATA:
-		ifp->if_ipackets = 0;
-		ifp->if_ibytes = 0;
-		

CVS commit: src/usr.bin/netstat

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Feb  2 03:41:12 UTC 2020

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
Update for per-cpu interface statistics.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/netstat/if.c

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

Modified files:

Index: src/usr.bin/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.95 src/usr.bin/netstat/if.c:1.96
--- src/usr.bin/netstat/if.c:1.95	Wed Jul 11 07:46:20 2018
+++ src/usr.bin/netstat/if.c	Sun Feb  2 03:41:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.95 2018/07/11 07:46:20 msaitoh Exp $	*/
+/*	$NetBSD: if.c,v 1.96 2020/02/02 03:41:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.95 2018/07/11 07:46:20 msaitoh Exp $");
+__RCSID("$NetBSD: if.c,v 1.96 2020/02/02 03:41:12 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -289,9 +289,34 @@ union ifaddr_u {
 };
 
 static void
+ifnet_to_ifdata_kvm(const struct ifnet * const ifp, struct if_data * const ifd)
+{
+
+	/*
+	 * Interface statistics are no longer kept in struct ifnet,
+	 * and thus an if_data is no longer embedded in struct ifnet.
+	 * We cannot read stats via kvm without chasing per-cpu data,
+	 * and maybe someday we could do that.  But for now, this is
+	 * what we have.
+	 *
+	 * Just copy the fields that do exist.
+	 */
+	memset(ifd, 0, sizeof(*ifd));
+	ifd->ifi_type = ifp->if_type;
+	ifd->ifi_addrlen = ifp->if_addrlen;
+	ifd->ifi_hdrlen = ifp->if_hdrlen;
+	ifd->ifi_link_state = ifp->if_link_state;
+	ifd->ifi_mtu = ifp->if_mtu;
+	ifd->ifi_metric = ifp->if_metric;
+	ifd->ifi_baudrate = ifp->if_baudrate;
+	ifd->ifi_lastchange = ifp->if_lastchange;
+}
+
+static void
 intpr_kvm(u_long ifnetaddr, void (*pfunc)(const char *))
 {
 	struct ifnet ifnet;
+	struct if_data ifd;
 	union ifaddr_u ifaddr;
 	u_long ifaddraddr;
 	struct ifnet_head ifhead;	/* TAILQ_HEAD */
@@ -358,8 +383,9 @@ intpr_kvm(u_long ifnetaddr, void (*pfunc
 			cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
 			CP();
 			sa = (struct sockaddr *)cp;
+			ifnet_to_ifdata_kvm(, );
 			print_addr(ifnet.if_index, sa, (void *),
-			_data, );
+			, );
 		}
 		ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
 	}
@@ -787,6 +813,7 @@ sidewaysintpr_kvm(unsigned interval, u_l
 	sigset_t emptyset;
 	sigset_t noalrm;
 	struct ifnet ifnet;
+	struct if_data ifd;
 	u_long firstifnet;
 	struct iftot *ip, *total;
 	unsigned line;
@@ -906,53 +933,54 @@ loop:
 			off = 0;
 			continue;
 		}
+		ifnet_to_ifdata_kvm(, );
 		if (ip == interesting) {
 			if (bflag) {
 char humbuf[HUMBUF_SIZE];
 
 if (hflag && humanize_number(humbuf,
 sizeof(humbuf),
-ifnet.if_ibytes - ip->ift_ib, "",
+ifd.ifi_ibytes - ip->ift_ib, "",
 HN_AUTOSCALE, HN_NOSPACE | HN_B) > 0)
 	printf("%10s %8.8s ", humbuf, " ");
 else
 	printf("%10llu %8.8s ", 
 	(unsigned long long)
-	(ifnet.if_ibytes-ip->ift_ib), " ");
+	(ifd.ifi_ibytes-ip->ift_ib), " ");
 
 if (hflag && humanize_number(humbuf,
 sizeof(humbuf),
-ifnet.if_obytes - ip->ift_ob, "",
+ifd.ifi_obytes - ip->ift_ob, "",
 HN_AUTOSCALE, HN_NOSPACE | HN_B) > 0)
 	printf("%10s %5.5s", humbuf, " ");
 else
 	printf("%10llu %5.5s", 
 	(unsigned long long)
-	(ifnet.if_obytes-ip->ift_ob), " ");
+	(ifd.ifi_obytes-ip->ift_ob), " ");
 			} else {
 printf("%8llu %5llu %8llu %5llu %5llu",
 (unsigned long long)
-	(ifnet.if_ipackets - ip->ift_ip),
+	(ifd.ifi_ipackets - ip->ift_ip),
 (unsigned long long)
-	(ifnet.if_ierrors - ip->ift_ie),
+	(ifd.ifi_ierrors - ip->ift_ie),
 (unsigned long long)
-	(ifnet.if_opackets - ip->ift_op),
+	(ifd.ifi_opackets - ip->ift_op),
 (unsigned long long)
-	(ifnet.if_oerrors - ip->ift_oe),
+	(ifd.ifi_oerrors - ip->ift_oe),
 (unsigned long long)
-	(ifnet.if_collisions - ip->ift_co));
+	(ifd.ifi_collisions - ip->ift_co));
 			}
 			if (dflag)
 printf(" %5" PRIu64,
 	ifnet.if_snd.ifq_drops - ip->ift_dr);
 		}
-		ip->ift_ip = ifnet.if_ipackets;
-		ip->ift_ib = ifnet.if_ibytes;
-		ip->ift_ie = ifnet.if_ierrors;
-		ip->ift_op = ifnet.if_opackets;
-		ip->ift_ob = ifnet.if_obytes;
-		ip->ift_oe = ifnet.if_oerrors;
-		ip->ift_co = ifnet.if_collisions;
+		ip->ift_ip = ifd.ifi_ipackets;
+		ip->ift_ib = ifd.ifi_ibytes;
+		ip->ift_ie = ifd.ifi_ierrors;
+		ip->ift_op = ifd.ifi_opackets;
+		ip->ift_ob = ifd.ifi_obytes;
+		ip->ift_oe = ifd.ifi_oerrors;
+		ip->ift_co = ifd.ifi_collisions;
 		ip->ift_dr = ifnet.if_snd.ifq_drops;
 		sum->ift_ip += ip->ift_ip;
 		sum->ift_ib += ip->ift_ib;



CVS commit: src/sys/rump/net/lib/libvirtif

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 22:45:02 UTC 2020

Modified Files:
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/rump/net/lib/libvirtif/if_virt.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/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.57 src/sys/rump/net/lib/libvirtif/if_virt.c:1.58
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.57	Tue Jun 26 06:48:03 2018
+++ src/sys/rump/net/lib/libvirtif/if_virt.c	Sat Feb  1 22:45:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_virt.c,v 1.57 2018/06/26 06:48:03 msaitoh Exp $	*/
+/*	$NetBSD: if_virt.c,v 1.58 2020/02/01 22:45:01 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.57 2018/06/26 06:48:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.58 2020/02/01 22:45:01 thorpej Exp $");
 
 #include 
 #include 
@@ -325,7 +325,7 @@ virtif_start(struct ifnet *ifp)
 		VIFHYPER_SEND(sc->sc_viu, io, i);
 
 		m_freem(m0);
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 	}
 
 	ifp->if_flags &= ~IFF_OACTIVE;



CVS commit: src/sys/rump/net/lib/libshmif

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 22:38:31 UTC 2020

Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/rump/net/lib/libshmif/if_shmem.c

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

Modified files:

Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.76 src/sys/rump/net/lib/libshmif/if_shmem.c:1.77
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.76	Wed Dec 12 01:51:32 2018
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Sat Feb  1 22:38:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_shmem.c,v 1.76 2018/12/12 01:51:32 rin Exp $	*/
+/*	$NetBSD: if_shmem.c,v 1.77 2020/02/01 22:38:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.76 2018/12/12 01:51:32 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.77 2020/02/01 22:38:31 thorpej Exp $");
 
 #include 
 #include 
@@ -561,7 +561,7 @@ shmif_start(struct ifnet *ifp)
 
 		m = ether_sw_offload_tx(ifp, m);
 		if (m == NULL) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 
@@ -630,7 +630,7 @@ shmif_snd(struct ifnet *ifp, struct mbuf
 	shmif_unlockbus(busmem);
 
 	m_freem(m0);
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	DPRINTF(("shmif_start: send %d bytes at off %d\n", pktsize,
 	busmem->shm_last));



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

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 22:38:05 UTC 2020

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

Log Message:
Fix abuse of TAILQ_CONCAT.

Other parts of this expect that the entries will be on wq->wq_queue
or wq->wq_dqueue, so we can't just move a batch of entries onto a
temporary queue.  Instead, use a marker node to delimit when the
batch ends.

XXX pullup


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

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

Modified files:

Index: src/sys/external/bsd/common/linux/linux_work.c
diff -u src/sys/external/bsd/common/linux/linux_work.c:1.44 src/sys/external/bsd/common/linux/linux_work.c:1.45
--- src/sys/external/bsd/common/linux/linux_work.c:1.44	Tue Mar 19 08:17:46 2019
+++ src/sys/external/bsd/common/linux/linux_work.c	Sat Feb  1 22:38:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.44 2019/03/19 08:17:46 ryo Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.45 2020/02/01 22:38:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.44 2019/03/19 08:17:46 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.45 2020/02/01 22:38:05 riastradh Exp $");
 
 #include 
 #include 
@@ -348,8 +348,8 @@ static void __dead
 linux_workqueue_thread(void *cookie)
 {
 	struct workqueue_struct *const wq = cookie;
-	struct work_head queue, dqueue;
-	struct work_head *const q[2] = { ,  };
+	struct work_head *const q[2] = { >wq_queue, >wq_dqueue };
+	struct work_struct marker, *work;
 	unsigned i;
 
 	lwp_setspecific(workqueue_key, wq);
@@ -368,22 +368,22 @@ linux_workqueue_thread(void *cookie)
 			continue;
 		}
 
-		/* Grab a batch of work off the queue.  */
+		/*
+		 * Start a batch of work.  Use a marker to delimit when
+		 * the batch ends so we can advance the generation
+		 * after the batch.
+		 */
 		SDT_PROBE1(sdt, linux, work, batch__start,  wq);
-		TAILQ_INIT();
-		TAILQ_INIT();
-		TAILQ_CONCAT(, >wq_queue, work_entry);
-		TAILQ_CONCAT(, >wq_dqueue, work_entry);
-
-		/* Process each work item in the batch.  */
 		for (i = 0; i < 2; i++) {
-			while (!TAILQ_EMPTY(q[i])) {
-struct work_struct *work = TAILQ_FIRST(q[i]);
+			if (TAILQ_EMPTY(q[i]))
+continue;
+			TAILQ_INSERT_TAIL(q[i], , work_entry);
+			while ((work = TAILQ_FIRST(q[i])) != ) {
 void (*func)(struct work_struct *);
 
 KASSERT(work_queue(work) == wq);
 KASSERT(work_claimed(work, wq));
-KASSERTMSG((q[i] !=  ||
+KASSERTMSG((q[i] != >wq_dqueue ||
 	container_of(work, struct delayed_work,
 	work)->dw_state ==
 	DELAYED_WORK_IDLE),
@@ -407,6 +407,7 @@ linux_workqueue_thread(void *cookie)
 wq->wq_current_work = NULL;
 cv_broadcast(>wq_cv);
 			}
+			TAILQ_REMOVE(q[i], , work_entry);
 		}
 
 		/* Notify flush that we've completed a batch of work.  */



CVS commit: src/sys/net

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 21:59:40 UTC 2020

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

Log Message:
Make if_stats competely opaque to user-space.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/net/if.h

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

Modified files:

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.279 src/sys/net/if.h:1.280
--- src/sys/net/if.h:1.279	Sat Feb  1 21:11:10 2020
+++ src/sys/net/if.h	Sat Feb  1 21:59:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.279 2020/02/01 21:11:10 thorpej Exp $	*/
+/*	$NetBSD: if.h,v 1.280 2020/02/01 21:59:39 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -291,7 +291,11 @@ typedef struct ifnet {
 	uint64_t	if_metric;	/* :? routing metric (external only) */
 	uint64_t	if_baudrate;	/* :? linespeed */
 	struct timespec	if_lastchange;	/* :? last operational state change */
+#ifdef _KERNEL
 	percpu_t	*if_stats;	/* :: statistics */
+#else
+	void		*if_stats;	/* opaque to user-space */
+#endif /* _KERNEL */
 #else /* ! __IF_STATS_PERCPU */
 	struct if_data	if_data;	/* ?: statistics and other data */
 #endif /* __IF_STATS_PERCPU */



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

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 21:46:49 UTC 2020

Modified Files:
src/sys/arch/arm/gemini: if_gmc.c

Log Message:
Adopt .


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

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

Modified files:

Index: src/sys/arch/arm/gemini/if_gmc.c
diff -u src/sys/arch/arm/gemini/if_gmc.c:1.12 src/sys/arch/arm/gemini/if_gmc.c:1.13
--- src/sys/arch/arm/gemini/if_gmc.c:1.12	Tue May 28 08:59:33 2019
+++ src/sys/arch/arm/gemini/if_gmc.c	Sat Feb  1 21:46:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gmc.c,v 1.12 2019/05/28 08:59:33 msaitoh Exp $ */
+/* $NetBSD: if_gmc.c,v 1.13 2020/02/01 21:46:49 thorpej Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,7 +47,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.12 2019/05/28 08:59:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.13 2020/02/01 21:46:49 thorpej Exp $");
 
 #define	MAX_TXSEG	32
 
@@ -134,7 +134,7 @@ gmc_txqueue(struct gmc_softc *sc, gmac_h
 		error);
 		gmac_mapcache_put(hwq->hwq_hqm->hqm_mc, map);
 		m_freem(m);
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 		return true;
 	}
 	KASSERT(map->dm_nsegs > 0);
@@ -702,7 +702,7 @@ gmc_intr(void *arg)
 			gmac_swfree_min_update(psc);
 		}
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 	}
 	if (status & INT4_RGMII_STSCHG) {
 		mii_pollstat(>sc_mii);



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

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 21:45:11 UTC 2020

Modified Files:
src/sys/arch/arm/gemini: if_gpn.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/gemini/if_gpn.c

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

Modified files:

Index: src/sys/arch/arm/gemini/if_gpn.c
diff -u src/sys/arch/arm/gemini/if_gpn.c:1.13 src/sys/arch/arm/gemini/if_gpn.c:1.14
--- src/sys/arch/arm/gemini/if_gpn.c:1.13	Wed Oct 30 10:12:37 2019
+++ src/sys/arch/arm/gemini/if_gpn.c	Sat Feb  1 21:45:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gpn.c,v 1.13 2019/10/30 10:12:37 msaitoh Exp $ */
+/* $NetBSD: if_gpn.c,v 1.14 2020/02/01 21:45:11 thorpej Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include "opt_gemini.h"
 
-__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.13 2019/10/30 10:12:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.14 2020/02/01 21:45:11 thorpej Exp $");
 
 #include 
 #include 
@@ -252,12 +252,12 @@ gpn_process_data(struct gpn_softc *sc, c
 	bool ok;
 
 	if ((subtype & GPN_SOF) == 0 && sc->sc_rxmbuf == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto out;
 	}
 
 	if ((subtype & GPN_SOF) && sc->sc_rxmbuf != NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		m_freem(sc->sc_rxmbuf);
 		sc->sc_rxmbuf = NULL;
 	}
@@ -266,13 +266,13 @@ gpn_process_data(struct gpn_softc *sc, c
 		struct mbuf *m;
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto out;
 		}
 		if (pktlen > MHLEN - 2) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 m_free(m);
 goto out;
 			}
@@ -287,7 +287,7 @@ gpn_process_data(struct gpn_softc *sc, c
 	if (ok && gd->gd_addr2 && gd->gd_len2)
 		ok = gpn_add_data(sc, gd->gd_addr2, gd->gd_len2);
 	if (!ok) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		m_freem(sc->sc_rxmbuf);
 		sc->sc_rxmbuf = NULL;
 		goto out;
@@ -411,6 +411,7 @@ gpn_ifstart(struct ifnet *ifp)
 		gd.gd_tag = IPM_TAG_GPN;
 		gd.gd_subtype = GPN_SOF;
 		gd.gd_pktlen64 = (m->m_pkthdr.len + 63) >> 6;
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		for (; m != NULL; m = m0) {
 			struct gpn_txinfo *ti;
 			bus_dmamap_t map;
@@ -442,7 +443,7 @@ gpn_ifstart(struct ifnet *ifp)
 			mtod(m, void *), m->m_len, NULL,
 			BUS_DMA_READ | BUS_DMA_NOWAIT);
 			if (error) {
-ifp->if_oerrors++;
+if_statinc_ref(nsr, if_oerrors);
 m_freem(m);
 break;
 			}
@@ -465,9 +466,10 @@ gpn_ifstart(struct ifnet *ifp)
 			gd.gd_txid = id;
 			ti->ti_mbuf = m;
 			last_gd = 
-			ifp->if_obytes += m->m_len;
+			if_statadd_ref(nsr, if_obytes, m->m_len);
 		}
-		ifp->if_opackets++;
+		if_statinc_ref(nsr, if_opackets);
+		IF_STAT_PUTREF(ifp);
 
 		/*
 		 * XXX XXX 'last_gd' could be NULL
@@ -608,8 +610,6 @@ gpn_ifstop(struct ifnet *ifp, int disabl
 static int
 gpn_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-	struct gpn_softc * const sc = ifp->if_softc;
-	struct ifreq * const ifr = data;
 	struct ifaliasreq * const ifra = data;
 	int s, error;
 



CVS commit: src/doc

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 21:14:45 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note per-cpu network interface statistics.


To generate a diff of this commit:
cvs rdiff -u -r1.2646 -r1.2647 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2646 src/doc/CHANGES:1.2647
--- src/doc/CHANGES:1.2646	Wed Jan 29 19:04:12 2020
+++ src/doc/CHANGES	Sat Feb  1 21:14:44 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2646 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2647 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -139,3 +139,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd(8): Import dhcpcd-8.1.6 [roy 20200127]
 	openresolv(8): Import openresolv-3.10.0 [roy 20200127]
 	urio(4): Removed from the tree. [maya 20200129]
+	Collect network interface statistics using per-cpu counters
+		that are collated when they are queried. [thorpej 20200201]



CVS commit: src/sys/sys

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 21:12:13 UTC 2020

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 9.99.45 -- struct ifnet changed, per-cpu ifnet stats.


To generate a diff of this commit:
cvs rdiff -u -r1.647 -r1.648 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.647 src/sys/sys/param.h:1.648
--- src/sys/sys/param.h:1.647	Wed Jan 29 05:50:34 2020
+++ src/sys/sys/param.h	Sat Feb  1 21:12:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.647 2020/01/29 05:50:34 thorpej Exp $	*/
+/*	$NetBSD: param.h,v 1.648 2020/02/01 21:12:13 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999004400	/* NetBSD 9.99.44 */
+#define	__NetBSD_Version__	999004500	/* NetBSD 9.99.45 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/net

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 21:11:10 UTC 2020

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

Log Message:
Flip the switch to the per-cpu implementation in .  Leave
the conditional in place for a time in case serious problems are discovered,
so that the Old Way can be re-enabled quickly.  After some time, the Old
Way will be removed completely.


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/net/if.h

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

Modified files:

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.278 src/sys/net/if.h:1.279
--- src/sys/net/if.h:1.278	Wed Jan 29 03:16:28 2020
+++ src/sys/net/if.h	Sat Feb  1 21:11:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.278 2020/01/29 03:16:28 thorpej Exp $	*/
+/*	$NetBSD: if.h,v 1.279 2020/02/01 21:11:10 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -63,6 +63,12 @@
 #ifndef _NET_IF_H_
 #define _NET_IF_H_
 
+/*
+ * Temporary, to allow for a quick disable if problems are discovered
+ * during a transition period.
+ */
+#define	__IF_STATS_PERCPU
+
 #if !defined(_KERNEL) && !defined(_STANDALONE)
 #include 
 #endif



CVS commit: src/sys/net

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 20:56:17 UTC 2020

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

Log Message:
- Add an ifmedia_fini() routine, to free resources assocated with
  an ifmedia.  Currently calls ifmedia_removeall().  All drivers
  that call ifmedia_init() and support detach should call this
  routine.
- In ifmedia_delete_instance(), set ifm->ifm_cur to NULL and
  ifm->ifm_media to IFM_NONE when removing / freeing that entry,
  not simply when we've been asked to delete every media instance.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/net/if_media.c
cvs rdiff -u -r1.68 -r1.69 src/sys/net/if_media.h

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

Modified files:

Index: src/sys/net/if_media.c
diff -u src/sys/net/if_media.c:1.50 src/sys/net/if_media.c:1.51
--- src/sys/net/if_media.c:1.50	Fri Jan 31 00:49:18 2020
+++ src/sys/net/if_media.c	Sat Feb  1 20:56:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.c,v 1.50 2020/01/31 00:49:18 thorpej Exp $	*/
+/*	$NetBSD: if_media.c,v 1.51 2020/02/01 20:56:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.50 2020/01/31 00:49:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.51 2020/02/01 20:56:16 thorpej Exp $");
 
 #include 
 #include 
@@ -122,6 +122,16 @@ ifmedia_init(struct ifmedia *ifm, int do
 	ifm->ifm_status = status_callback;
 }
 
+/*
+ * Free resources associated with an ifmedia.
+ */
+void
+ifmedia_fini(struct ifmedia *ifm)
+{
+
+	ifmedia_removeall(ifm);
+}
+
 int
 ifmedia_change(struct ifmedia *ifm, struct ifnet *ifp)
 {
@@ -423,14 +433,14 @@ ifmedia_delete_instance(struct ifmedia *
 	TAILQ_FOREACH_SAFE(ife, >ifm_list, ifm_list, nife) {
 		if (inst == IFM_INST_ANY ||
 		inst == IFM_INST(ife->ifm_media)) {
+			if (ifm->ifm_cur == ife) {
+ifm->ifm_cur = NULL;
+ifm->ifm_media = IFM_NONE;
+			}
 			TAILQ_REMOVE(>ifm_list, ife, ifm_list);
 			kmem_free(ife, sizeof(*ife));
 		}
 	}
-	if (inst == IFM_INST_ANY) {
-		ifm->ifm_cur = NULL;
-		ifm->ifm_media = IFM_NONE;
-	}
 }
 
 void

Index: src/sys/net/if_media.h
diff -u src/sys/net/if_media.h:1.68 src/sys/net/if_media.h:1.69
--- src/sys/net/if_media.h:1.68	Thu Dec  5 05:29:27 2019
+++ src/sys/net/if_media.h	Sat Feb  1 20:56:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.h,v 1.68 2019/12/05 05:29:27 msaitoh Exp $	*/
+/*	$NetBSD: if_media.h,v 1.69 2020/02/01 20:56:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -900,6 +900,9 @@ struct ifmedia {
 /* Initialize an interface's struct if_media field. */
 void	ifmedia_init(struct ifmedia *, int, ifm_change_cb_t, ifm_stat_cb_t);
 
+/* Release resourecs associated with an ifmedia. */
+void	ifmedia_fini(struct ifmedia *);
+
 int	ifmedia_change(struct ifmedia *, struct ifnet *);
 
 /* Add one supported medium to a struct ifmedia. */



CVS commit: src/sys/dev/acpi

2020-02-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Feb  1 20:11:24 UTC 2020

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

Log Message:
fix build


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

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

Modified files:

Index: src/sys/dev/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.13 src/sys/dev/acpi/sdhc_acpi.c:1.14
--- src/sys/dev/acpi/sdhc_acpi.c:1.13	Sat Feb  1 19:11:59 2020
+++ src/sys/dev/acpi/sdhc_acpi.c	Sat Feb  1 20:11:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.13 2020/02/01 19:11:59 christos Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.14 2020/02/01 20:11:24 tnn Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.13 2020/02/01 19:11:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.14 2020/02/01 20:11:24 tnn Exp $");
 
 #include 
 #include 
@@ -91,7 +91,7 @@ static const struct sdhc_acpi_slot {
 	{ .hid = "INT344D",		 .type = SLOT_TYPE_SD },
 	{ .hid = "NXP0003",  .uid = "0", .type = SLOT_TYPE_SD,
 	 .flags = SDHC_ESDHC_FLAGS },
-	{ .hid = "NXP0003",  .uid = "1", .type SLOT_TYPE_EMMC,
+	{ .hid = "NXP0003",  .uid = "1", .type = SLOT_TYPE_EMMC,
 	 .flags = SDHC_ESDHC_FLAGS },
 
 	/* Generic IDs last */



CVS commit: src

2020-02-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  1 19:41:50 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: ad.m68k
src/sys/arch/amiga/include: vmparam.h
src/sys/arch/atari/include: vmparam.h
src/sys/arch/cesfic/include: vmparam.h
src/sys/arch/hp300/include: vmparam.h
src/sys/arch/luna68k/include: vmparam.h
src/sys/arch/m68k/include: Makefile
src/sys/arch/mac68k/include: vmparam.h
src/sys/arch/mvme68k/include: vmparam.h
src/sys/arch/news68k/include: vmparam.h
src/sys/arch/next68k/include: vmparam.h
src/sys/arch/sun3/include: vmparam.h
src/sys/arch/x68k/include: vmparam.h
Added Files:
src/sys/arch/m68k/include: vmparam.h

Log Message:
Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
  but each port uses different PAGE_SIZE value (4096 or 8192)
  due to historical reasons.
- Currently module(7) binaries are built per each port so
  all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI  assumes that the port supports a variable
  PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
  are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
  src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
  for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
  among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
  support m68k ports where PAGE_SIZE==8192.
  (though this would affect only if static binaries built on
   4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.
For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in  only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
 https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
 https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/distrib/sets/lists/comp/ad.m68k
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amiga/include/vmparam.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/atari/include/vmparam.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/cesfic/include/vmparam.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/hp300/include/vmparam.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/luna68k/include/vmparam.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/vmparam.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mac68k/include/vmparam.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mvme68k/include/vmparam.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/news68k/include/vmparam.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sun3/include/vmparam.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x68k/include/vmparam.h

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

Modified files:

Index: src/distrib/sets/lists/comp/ad.m68k
diff -u src/distrib/sets/lists/comp/ad.m68k:1.62 src/distrib/sets/lists/comp/ad.m68k:1.63
--- src/distrib/sets/lists/comp/ad.m68k:1.62	Thu Oct  3 00:59:50 2019
+++ src/distrib/sets/lists/comp/ad.m68k	Sat Feb  1 19:41:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ad.m68k,v 1.62 2019/10/03 00:59:50 mrg Exp $
+# $NetBSD: ad.m68k,v 1.63 2020/02/01 19:41:48 tsutsui Exp $
 ./usr/bin/elf2aoutcomp-sysutil-bin
 ./usr/include/gcc-4.5/math-68881.h		comp-c-include		obsolete
 ./usr/include/gcc-4.5/tgmath.h			comp-c-include		obsolete
@@ -70,6 +70,7 @@
 ./usr/include/m68k/trap.h			comp-c-include
 ./usr/include/m68k/types.h			comp-c-include
 ./usr/include/m68k/varargs.h			comp-obsolete		obsolete
+./usr/include/m68k/vmparam.h			comp-c-include
 ./usr/include/m68k/wchar_limits.h		comp-c-include
 ./usr/lib/libm68k.acomp-c-lib
 ./usr/lib/libm68k_p.acomp-c-lib		profile

Index: src/sys/arch/amiga/include/vmparam.h
diff -u src/sys/arch/amiga/include/vmparam.h:1.47 src/sys/arch/amiga/include/vmparam.h:1.48
--- src/sys/arch/amiga/include/vmparam.h:1.47	Wed Mar 27 17:15:29 2019
+++ src/sys/arch/amiga/include/vmparam.h	Sat Feb  1 19:41:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.47 2019/03/27 17:15:29 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.48 2020/02/01 19:41:48 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -46,12 +46,9 @@
  */
 
 /*
- * We use 8K pages on the Amiga.  Override the PAGE_* definitions
- * to be compie-time constants.
+ * Use common m68k definitions to define PAGE_SIZE and related constants.
  */
-#define	PAGE_SHIFT	PGSHIFT
-#define	

CVS commit: src/sys/kern

2020-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  1 19:29:27 UTC 2020

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

Log Message:
fix incorrect type


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/kern_sleepq.c

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

Modified files:

Index: src/sys/kern/kern_sleepq.c
diff -u src/sys/kern/kern_sleepq.c:1.59 src/sys/kern/kern_sleepq.c:1.60
--- src/sys/kern/kern_sleepq.c:1.59	Sun Jan 26 14:01:56 2020
+++ src/sys/kern/kern_sleepq.c	Sat Feb  1 14:29:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sleepq.c,v 1.59 2020/01/26 19:01:56 ad Exp $	*/
+/*	$NetBSD: kern_sleepq.c,v 1.60 2020/02/01 19:29:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.59 2020/01/26 19:01:56 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.60 2020/02/01 19:29:27 christos Exp $");
 
 #include 
 #include 
@@ -189,7 +189,7 @@ sleepq_insert(sleepq_t *sq, lwp_t *l, sy
 
 	if ((sobj->sobj_flag & SOBJ_SLEEPQ_SORTED) != 0) {
 		lwp_t *l2;
-		const int pri = lwp_eprio(l);
+		const pri_t pri = lwp_eprio(l);
 
 		TAILQ_FOREACH(l2, sq, l_sleepchain) {
 			if (lwp_eprio(l2) < pri) {



CVS commit: src/sys/dev/acpi

2020-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  1 19:11:59 UTC 2020

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

Log Message:
use designated initializers


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

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

Modified files:

Index: src/sys/dev/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.12 src/sys/dev/acpi/sdhc_acpi.c:1.13
--- src/sys/dev/acpi/sdhc_acpi.c:1.12	Sat Feb  1 13:24:24 2020
+++ src/sys/dev/acpi/sdhc_acpi.c	Sat Feb  1 14:11:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.12 2020/02/01 18:24:24 jmcneill Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.13 2020/02/01 19:11:59 christos Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.12 2020/02/01 18:24:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.13 2020/02/01 19:11:59 christos Exp $");
 
 #include 
 #include 
@@ -78,22 +78,25 @@ static const struct sdhc_acpi_slot {
 #define	SLOT_TYPE_EMMC	1	/* eMMC */
 	uint32_t flags;
 } sdhc_acpi_slot_map[] = {
-	{ "80865ACA",	NULL,	SLOT_TYPE_SD,	0 },
-	{ "80865ACC",	NULL,	SLOT_TYPE_EMMC,	0 },
-	{ "80865AD0",	NULL,	SLOT_TYPE_SD,	0 },
-	{ "80860F14",   "1",	SLOT_TYPE_EMMC,	0 },
-	{ "80860F14",   "3",	SLOT_TYPE_SD,	0 },
-	{ "80860F16",   NULL,	SLOT_TYPE_SD,	0 },
-	{ "INT33BB",	"2",	SLOT_TYPE_SD,	0 },
-	{ "INT33BB",	"3",	SLOT_TYPE_SD,	0 },
-	{ "INT33C6",	NULL,	SLOT_TYPE_SD,	0 },
-	{ "INT3436",	NULL,	SLOT_TYPE_SD,	0 },
-	{ "INT344D",	NULL,	SLOT_TYPE_SD,	0 },
-	{ "NXP0003",	"0",	SLOT_TYPE_SD,	SDHC_ESDHC_FLAGS },
-	{ "NXP0003",	"1",	SLOT_TYPE_EMMC,	SDHC_ESDHC_FLAGS },
+	{ .hid = "80865ACA",		 .type = SLOT_TYPE_SD },
+	{ .hid = "80865ACC",		 .type = SLOT_TYPE_EMMC },
+	{ .hid = "80865AD0",		 .type = SLOT_TYPE_SD },
+	{ .hid = "80860F14", .uid = "1", .type = SLOT_TYPE_EMMC },
+	{ .hid = "80860F14", .uid = "3", .type = SLOT_TYPE_SD },
+	{ .hid = "80860F16",   		 .type = SLOT_TYPE_SD },
+	{ .hid = "INT33BB",  .uid = "2", .type = SLOT_TYPE_SD },
+	{ .hid = "INT33BB",  .uid = "3", .type = SLOT_TYPE_SD },
+	{ .hid = "INT33C6",		 .type = SLOT_TYPE_SD },
+	{ .hid = "INT3436",		 .type = SLOT_TYPE_SD },
+	{ .hid = "INT344D",		 .type = SLOT_TYPE_SD },
+	{ .hid = "NXP0003",  .uid = "0", .type = SLOT_TYPE_SD,
+	 .flags = SDHC_ESDHC_FLAGS },
+	{ .hid = "NXP0003",  .uid = "1", .type SLOT_TYPE_EMMC,
+	 .flags = SDHC_ESDHC_FLAGS },
+
 	/* Generic IDs last */
-	{ "PNP0D40",	NULL,	SLOT_TYPE_SD,	0 },
-	{ "PNP0FFF",	"3",	SLOT_TYPE_SD,	0 },
+	{ .hid = "PNP0D40",		 .type = SLOT_TYPE_SD },
+	{ .hid = "PNP0FFF",  .uid = "3", .type = SLOT_TYPE_SD },
 };
 
 static const struct sdhc_acpi_slot *



CVS commit: src/sys/dev/acpi

2020-02-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb  1 18:24:24 UTC 2020

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

Log Message:
appease -Werror=missing-field-initializers


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

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

Modified files:

Index: src/sys/dev/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.11 src/sys/dev/acpi/sdhc_acpi.c:1.12
--- src/sys/dev/acpi/sdhc_acpi.c:1.11	Sat Feb  1 13:40:55 2020
+++ src/sys/dev/acpi/sdhc_acpi.c	Sat Feb  1 18:24:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.11 2020/02/01 13:40:55 jmcneill Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.12 2020/02/01 18:24:24 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.11 2020/02/01 13:40:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.12 2020/02/01 18:24:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -78,22 +78,22 @@ static const struct sdhc_acpi_slot {
 #define	SLOT_TYPE_EMMC	1	/* eMMC */
 	uint32_t flags;
 } sdhc_acpi_slot_map[] = {
-	{ "80865ACA",	NULL,	SLOT_TYPE_SD },
-	{ "80865ACC",	NULL,	SLOT_TYPE_EMMC },
-	{ "80865AD0",	NULL,	SLOT_TYPE_SD },
-	{ "80860F14",   "1",	SLOT_TYPE_EMMC },
-	{ "80860F14",   "3",	SLOT_TYPE_SD },
-	{ "80860F16",   NULL,	SLOT_TYPE_SD },
-	{ "INT33BB",	"2",	SLOT_TYPE_SD },
-	{ "INT33BB",	"3",	SLOT_TYPE_SD },
-	{ "INT33C6",	NULL,	SLOT_TYPE_SD },
-	{ "INT3436",	NULL,	SLOT_TYPE_SD },
-	{ "INT344D",	NULL,	SLOT_TYPE_SD },
+	{ "80865ACA",	NULL,	SLOT_TYPE_SD,	0 },
+	{ "80865ACC",	NULL,	SLOT_TYPE_EMMC,	0 },
+	{ "80865AD0",	NULL,	SLOT_TYPE_SD,	0 },
+	{ "80860F14",   "1",	SLOT_TYPE_EMMC,	0 },
+	{ "80860F14",   "3",	SLOT_TYPE_SD,	0 },
+	{ "80860F16",   NULL,	SLOT_TYPE_SD,	0 },
+	{ "INT33BB",	"2",	SLOT_TYPE_SD,	0 },
+	{ "INT33BB",	"3",	SLOT_TYPE_SD,	0 },
+	{ "INT33C6",	NULL,	SLOT_TYPE_SD,	0 },
+	{ "INT3436",	NULL,	SLOT_TYPE_SD,	0 },
+	{ "INT344D",	NULL,	SLOT_TYPE_SD,	0 },
 	{ "NXP0003",	"0",	SLOT_TYPE_SD,	SDHC_ESDHC_FLAGS },
 	{ "NXP0003",	"1",	SLOT_TYPE_EMMC,	SDHC_ESDHC_FLAGS },
 	/* Generic IDs last */
-	{ "PNP0D40",	NULL,	SLOT_TYPE_SD },
-	{ "PNP0FFF",	"3",	SLOT_TYPE_SD },
+	{ "PNP0D40",	NULL,	SLOT_TYPE_SD,	0 },
+	{ "PNP0FFF",	"3",	SLOT_TYPE_SD,	0 },
 };
 
 static const struct sdhc_acpi_slot *



CVS commit: src/lib

2020-02-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb  1 18:14:16 UTC 2020

Modified Files:
src/lib/libc/gen: pthread_atfork.c
src/lib/libpthread: pthread_mutex.c

Log Message:
Revert previous

'git grep' breaks now.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gen/pthread_atfork.c
cvs rdiff -u -r1.73 -r1.74 src/lib/libpthread/pthread_mutex.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/libc/gen/pthread_atfork.c
diff -u src/lib/libc/gen/pthread_atfork.c:1.11 src/lib/libc/gen/pthread_atfork.c:1.12
--- src/lib/libc/gen/pthread_atfork.c:1.11	Sat Feb  1 15:38:46 2020
+++ src/lib/libc/gen/pthread_atfork.c	Sat Feb  1 18:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_atfork.c,v 1.11 2020/02/01 15:38:46 kamil Exp $	*/
+/*	$NetBSD: pthread_atfork.c,v 1.12 2020/02/01 18:14:16 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,17 +31,15 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_atfork.c,v 1.11 2020/02/01 15:38:46 kamil Exp $");
+__RCSID("$NetBSD: pthread_atfork.c,v 1.12 2020/02/01 18:14:16 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include "reentrant.h"
 
 #ifdef __weak_alias
@@ -75,22 +73,11 @@ static struct atfork_callback_q childq =
 static struct atfork_callback *
 af_alloc(void)
 {
-	void *arena;
-	size_t sz;
 
 	if (atfork_builtin.fn == NULL)
 		return _builtin;
 
-	/*
-	 * Avoid using here malloc() as this function is used on early init
-	 * and can prematuraly initialize the malloc library.
-	 * malloc() allocations here also confuse the LLVM Leak Sanitizer.
-	 */
-	sz = sizeof(atfork_builtin);
-	arena = mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
-	if (arena == MAP_FAILED)
-		return NULL;
-	return arena;
+	return malloc(sizeof(atfork_builtin));
 }
 
 static void
@@ -98,7 +85,7 @@ af_free(struct atfork_callback *af)
 {
 
 	if (af != _builtin)
-		munmap(af, sizeof(atfork_builtin));
+		free(af);
 }
 
 int

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.73 src/lib/libpthread/pthread_mutex.c:1.74
--- src/lib/libpthread/pthread_mutex.c:1.73	Sat Feb  1 15:39:56 2020
+++ src/lib/libpthread/pthread_mutex.c	Sat Feb  1 18:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.73 2020/02/01 15:39:56 kamil Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.74 2020/02/01 18:14:16 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.73 2020/02/01 15:39:56 kamil Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.74 2020/02/01 18:14:16 kamil Exp $");
 
 #include 
 #include 
@@ -122,12 +122,14 @@ pthread_mutex_init(pthread_mutex_t *ptm,
 {
 	uintptr_t type, proto, val, ceil;
 
+#if 0
 	/*
 	 * Always initialize the mutex structure, maybe be used later
 	 * and the cost should be minimal.
 	 */
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_init_stub(ptm, attr);
+#endif
 
 	pthread__error(EINVAL, "Invalid mutes attribute",
 	attr == NULL || attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
@@ -617,9 +619,10 @@ pthread__mutex_wakeup(pthread_t self, pt
 int
 pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
-
+#if 0
 	if (__predict_false(__uselibcstub))
 		return __libc_mutexattr_init_stub(attr);
+#endif
 
 	attr->ptma_magic = _PT_MUTEXATTR_MAGIC;
 	attr->ptma_private = (void *)PTHREAD_MUTEX_DEFAULT;



CVS commit: src/lib/libpthread

2020-02-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb  1 15:39:56 UTC 2020

Modified Files:
src/lib/libpthread: pthread_mutex.c

Log Message:
Remove 'ifdef 0' hacks

It is no longer needed as the proper fix avoiding premature malloc()
landed the sources.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/lib/libpthread/pthread_mutex.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/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.72 src/lib/libpthread/pthread_mutex.c:1.73
--- src/lib/libpthread/pthread_mutex.c:1.72	Fri Jan 31 17:52:14 2020
+++ src/lib/libpthread/pthread_mutex.c	Sat Feb  1 15:39:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.72 2020/01/31 17:52:14 kamil Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.73 2020/02/01 15:39:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.72 2020/01/31 17:52:14 kamil Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.73 2020/02/01 15:39:56 kamil Exp $");
 
 #include 
 #include 
@@ -122,14 +122,12 @@ pthread_mutex_init(pthread_mutex_t *ptm,
 {
 	uintptr_t type, proto, val, ceil;
 
-#if 0
 	/*
 	 * Always initialize the mutex structure, maybe be used later
 	 * and the cost should be minimal.
 	 */
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_init_stub(ptm, attr);
-#endif
 
 	pthread__error(EINVAL, "Invalid mutes attribute",
 	attr == NULL || attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
@@ -619,10 +617,9 @@ pthread__mutex_wakeup(pthread_t self, pt
 int
 pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
-#if 0
+
 	if (__predict_false(__uselibcstub))
 		return __libc_mutexattr_init_stub(attr);
-#endif
 
 	attr->ptma_magic = _PT_MUTEXATTR_MAGIC;
 	attr->ptma_private = (void *)PTHREAD_MUTEX_DEFAULT;



CVS commit: src/lib/libc/gen

2020-02-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb  1 15:38:46 UTC 2020

Modified Files:
src/lib/libc/gen: pthread_atfork.c

Log Message:
Switch atform allocations from malloc()+free() to mmap()+munmap()

This avoid bootstrapping malloc too early when libc+libpthread are not
ready. It is called through pthread__init() -> _pthread_atfork().

This also helps LLVM Leak Sanitizer to pacify false positive reports.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gen/pthread_atfork.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/libc/gen/pthread_atfork.c
diff -u src/lib/libc/gen/pthread_atfork.c:1.10 src/lib/libc/gen/pthread_atfork.c:1.11
--- src/lib/libc/gen/pthread_atfork.c:1.10	Tue Jan 20 18:31:25 2015
+++ src/lib/libc/gen/pthread_atfork.c	Sat Feb  1 15:38:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_atfork.c,v 1.10 2015/01/20 18:31:25 christos Exp $	*/
+/*	$NetBSD: pthread_atfork.c,v 1.11 2020/02/01 15:38:46 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,15 +31,17 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_atfork.c,v 1.10 2015/01/20 18:31:25 christos Exp $");
+__RCSID("$NetBSD: pthread_atfork.c,v 1.11 2020/02/01 15:38:46 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
 #include "reentrant.h"
 
 #ifdef __weak_alias
@@ -73,11 +75,22 @@ static struct atfork_callback_q childq =
 static struct atfork_callback *
 af_alloc(void)
 {
+	void *arena;
+	size_t sz;
 
 	if (atfork_builtin.fn == NULL)
 		return _builtin;
 
-	return malloc(sizeof(atfork_builtin));
+	/*
+	 * Avoid using here malloc() as this function is used on early init
+	 * and can prematuraly initialize the malloc library.
+	 * malloc() allocations here also confuse the LLVM Leak Sanitizer.
+	 */
+	sz = sizeof(atfork_builtin);
+	arena = mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
+	if (arena == MAP_FAILED)
+		return NULL;
+	return arena;
 }
 
 static void
@@ -85,7 +98,7 @@ af_free(struct atfork_callback *af)
 {
 
 	if (af != _builtin)
-		free(af);
+		munmap(af, sizeof(atfork_builtin));
 }
 
 int



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

2020-02-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb  1 15:33:48 UTC 2020

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
Use kmem_zalloc for its state, fixes possible crash if a driver tries to
set affinity before a CPU is online.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/cortex/gicv3_its.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.24 src/sys/arch/arm/cortex/gicv3_its.c:1.25
--- src/sys/arch/arm/cortex/gicv3_its.c:1.24	Fri Jan 17 13:54:47 2020
+++ src/sys/arch/arm/cortex/gicv3_its.c	Sat Feb  1 15:33:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.24 2020/01/17 13:54:47 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.25 2020/02/01 15:33:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.24 2020/01/17 13:54:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.25 2020/02/01 15:33:48 jmcneill Exp $");
 
 #include 
 #include 
@@ -846,7 +846,7 @@ gicv3_its_init(struct gicv3_softc *sc, b
 	if ((typer & GITS_TYPER_Physical) == 0)
 		return ENXIO;
 
-	its = kmem_alloc(sizeof(*its), KM_SLEEP);
+	its = kmem_zalloc(sizeof(*its), KM_SLEEP);
 	its->its_id = its_id;
 	its->its_bst = sc->sc_bst;
 	its->its_bsh = bsh;



CVS commit: src/sys/dev/ic

2020-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb  1 15:24:04 UTC 2020

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

Log Message:
Use designated initializers


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/dev/ic/com.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/com.c
diff -u src/sys/dev/ic/com.c:1.356 src/sys/dev/ic/com.c:1.357
--- src/sys/dev/ic/com.c:1.356	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/com.c	Sat Feb  1 15:24:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.356 2019/11/10 21:16:35 chs Exp $ */
+/* $NetBSD: com.c,v 1.357 2020/02/01 15:24:04 skrll Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.356 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.357 2020/02/01 15:24:04 skrll Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -192,8 +192,11 @@ static struct comcons_info comcons_info;
  * Following are all routines needed for COM to act as console
  */
 static struct consdev comcons = {
-	NULL, NULL, comcngetc, comcnputc, comcnpollc, NULL, NULL, NULL,
-	NODEV, CN_NORMAL
+	.cn_getc = comcngetc,
+	.cn_putc = comcnputc,
+	.cn_pollc = comcnpollc,
+	.cn_dev = NODEV,
+	.cn_pri = CN_NORMAL
 };
 
 



CVS commit: src/sys/opencrypto

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 13:48:09 UTC 2020

Modified Files:
src/sys/opencrypto: crypto.c

Log Message:
softint_disestablish does xc_barrier(0) for us already.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/opencrypto/crypto.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.111 src/sys/opencrypto/crypto.c:1.112
--- src/sys/opencrypto/crypto.c:1.111	Sat Feb  1 12:54:30 2020
+++ src/sys/opencrypto/crypto.c	Sat Feb  1 13:48:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.111 2020/02/01 12:54:30 riastradh Exp $ */
+/*	$NetBSD: crypto.c,v 1.112 2020/02/01 13:48:08 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.111 2020/02/01 12:54:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.112 2020/02/01 13:48:08 riastradh Exp $");
 
 #include 
 #include 
@@ -644,10 +644,7 @@ crypto_destroy(bool exit_kthread)
 		 * prohibit touch crypto_drivers[] and each element after here.
 		 */
 
-		/*
-		 * Ensure cryptoret_softint() is never scheduled and then wait
-		 * for last softint_execute().
-		 */
+		/* Ensure cryptoret_softint() is never scheduled again.  */
 		for (i = 0; i < ncpu; i++) {
 			struct crypto_crp_ret_qs *qs;
 			struct cpu_info *ci = cpu_lookup(i);
@@ -656,7 +653,6 @@ crypto_destroy(bool exit_kthread)
 			qs->crp_ret_q_exit_flag = true;
 			crypto_put_crp_ret_qs(ci);
 		}
-		xc_barrier(0);
 	}
 
 	if (sysctl_opencrypto_clog != NULL)



CVS commit: src/sys/dev/pci/qat

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 13:48:18 UTC 2020

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

Log Message:
opencrypto orders new_session -> process for us.

No need for membar_producer.

Discussed with hikaru@.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/qat/qat.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/qat/qat.c
diff -u src/sys/dev/pci/qat/qat.c:1.3 src/sys/dev/pci/qat/qat.c:1.4
--- src/sys/dev/pci/qat/qat.c:1.3	Wed Dec  4 01:06:28 2019
+++ src/sys/dev/pci/qat/qat.c	Sat Feb  1 13:48:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: qat.c,v 1.3 2019/12/04 01:06:28 hikaru Exp $	*/
+/*	$NetBSD: qat.c,v 1.4 2020/02/01 13:48:18 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.3 2019/12/04 01:06:28 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.4 2020/02/01 13:48:18 riastradh Exp $");
 
 #include 
 #include 
@@ -1969,8 +1969,6 @@ qat_crypto_new_session(void *arg, uint32
 	qcy->qcy_sc->sc_hw.qhw_crypto_setup_desc(qcy, qs, >qs_dec_desc, crie, cria);
 	qcy->qcy_sc->sc_hw.qhw_crypto_setup_desc(qcy, qs, >qs_enc_desc, crie, cria);
 
-	membar_producer();
-
 	return 0;
 fail:
 	if (qs != NULL) {



CVS commit: src/sys/dev/acpi

2020-02-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb  1 13:40:55 UTC 2020

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

Log Message:
Add NXP/Freescale ESDHC specific support


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/sdhc_acpi.c

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

Modified files:

Index: src/sys/dev/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.10 src/sys/dev/acpi/sdhc_acpi.c:1.11
--- src/sys/dev/acpi/sdhc_acpi.c:1.10	Sat Feb  1 13:09:08 2020
+++ src/sys/dev/acpi/sdhc_acpi.c	Sat Feb  1 13:40:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.10 2020/02/01 13:09:08 jmcneill Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.11 2020/02/01 13:40:55 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.10 2020/02/01 13:09:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.11 2020/02/01 13:40:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,6 +41,10 @@ __KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,
 #include 
 #include 
 
+/* Freescale ESDHC */
+#define	SDHC_ESDHC_FLAGS	\
+(SDHC_FLAG_HAVE_DVS|SDHC_FLAG_NO_PWR0|SDHC_FLAG_32BIT_ACCESS|SDHC_FLAG_ENHANCED)
+
 #define _COMPONENT	ACPI_RESOURCE_COMPONENT
 ACPI_MODULE_NAME	("sdhc_acpi")
 
@@ -72,6 +76,7 @@ static const struct sdhc_acpi_slot {
 	int type;
 #define	SLOT_TYPE_SD	0	/* SD or SDIO */
 #define	SLOT_TYPE_EMMC	1	/* eMMC */
+	uint32_t flags;
 } sdhc_acpi_slot_map[] = {
 	{ "80865ACA",	NULL,	SLOT_TYPE_SD },
 	{ "80865ACC",	NULL,	SLOT_TYPE_EMMC },
@@ -84,6 +89,9 @@ static const struct sdhc_acpi_slot {
 	{ "INT33C6",	NULL,	SLOT_TYPE_SD },
 	{ "INT3436",	NULL,	SLOT_TYPE_SD },
 	{ "INT344D",	NULL,	SLOT_TYPE_SD },
+	{ "NXP0003",	"0",	SLOT_TYPE_SD,	SDHC_ESDHC_FLAGS },
+	{ "NXP0003",	"1",	SLOT_TYPE_EMMC,	SDHC_ESDHC_FLAGS },
+	/* Generic IDs last */
 	{ "PNP0D40",	NULL,	SLOT_TYPE_SD },
 	{ "PNP0FFF",	"3",	SLOT_TYPE_SD },
 };
@@ -192,6 +200,8 @@ sdhc_acpi_attach(device_t parent, device
 
 	sc->sc.sc_host = kmem_zalloc(sizeof(struct sdhc_host *), KM_SLEEP);
 
+	sc->sc.sc_flags |= slot->flags;
+
 	/* Enable DMA transfer */
 	sc->sc.sc_flags |= SDHC_FLAG_USE_DMA;
 



CVS commit: src/share/man/man9

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 13:35:12 UTC 2020

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

Log Message:
Redocument xc_barrier.

Be more clearer, and more correcter, about what it does.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man9/xcall.9

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

Modified files:

Index: src/share/man/man9/xcall.9
diff -u src/share/man/man9/xcall.9:1.16 src/share/man/man9/xcall.9:1.17
--- src/share/man/man9/xcall.9:1.16	Sat Nov 30 02:22:23 2019
+++ src/share/man/man9/xcall.9	Sat Feb  1 13:35:11 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: xcall.9,v 1.16 2019/11/30 02:22:23 riastradh Exp $
+.\" $NetBSD: xcall.9,v 1.17 2020/02/01 13:35:11 riastradh Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 29, 2019
+.Dd February 1, 2020
 .Dt XCALL 9
 .Os
 .Sh NAME
@@ -97,7 +97,7 @@ Functions being called should be relativ
 They may block on locks, but carefully and minimally, to not interfere
 with other cross calls in the system.
 .Sh FUNCTIONS
-.Bl -tag -width Fn
+.Bl -tag -width abcd
 .It Fn xc_broadcast "flags" "func" "arg1" "arg2"
 Call
 .Pf (* Fa func\| ) Ns Fo ""
@@ -147,19 +147,33 @@ for the corresponding cross-call to comp
 .Fn xc_wait
 should be called from a thread context.
 .It Fn xc_barrier "flags"
-Issue a broadcast cross-call that does nothing, using
-.Fa flags ,
+Issue a broadcast cross-call that does nothing,
 and wait for it to complete.
-This has two effects:
+.Pp
+This functions like a memory barrier that forces all prior operations
+in program order to globally happen before all subsequent operations in
+program order, as witnessed by every CPU.
+.Pp
+This additionally waits for all higher-priority activity on the CPU to
+complete, according to
+.Fa flags :
 .Bl -dash -compact
 .It
-This waits for the interrupt priority level to transition to
+.Fo xc_barrier
+.Li 0
+.Fc
+waits for any pending
+.Xr kpreempt_disable 9
+sections or activity at interrupt priority level above
 .Dv IPL_NONE
-at least once on all CPUs.
+to finish on all CPUs.
 .It
-This functions like a memory barrier that forces all prior operations
-in program order to globally happen before all subsequent operations in
-program order, as witnessed by every CPU.
+.Fo xc_barrier
+.Dv XC_HIGHPRI_IPL\| Ns Fn "" ipl
+.Fc
+waits for any pending activity at the software interrupt priority level
+.Fa ipl
+or higher to finish on all CPUs.
 .El
 .Pp
 .Fn xc_barrier



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

2020-02-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb  1 13:26:43 UTC 2020

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c acpi_pci_machdep.h files.acpi
Added Files:
src/sys/arch/arm/acpi: acpi_pci_layerscape_gen4.c

Log Message:
Add support for NXP Layerscape PCIe Gen4 (not ECAM compliant)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/acpi/acpi_pci_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/acpi/acpi_pci_machdep.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/acpi/files.acpi

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_pci_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.14 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.15
--- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.14	Thu Jan 23 11:59:37 2020
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.c	Sat Feb  1 13:26:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.14 2020/01/23 11:59:37 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.15 2020/02/01 13:26:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.14 2020/01/23 11:59:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.15 2020/02/01 13:26:43 jmcneill Exp $");
 
 #include 
 #include 
@@ -101,6 +101,7 @@ static const struct acpi_pci_quirk acpi_
 	{ "AMAZON",	"GRAVITON",	0,		-1,	acpi_pci_graviton_init },
 	{ "ARMLTD",	"ARMN1SDP",	0x20181101,	0,	acpi_pci_n1sdp_init },
 	{ "ARMLTD",	"ARMN1SDP",	0x20181101,	1,	acpi_pci_n1sdp_init },
+	{ "NXP   ", "LX2160  ", 0,  -1,	acpi_pci_layerscape_gen4_init },
 };
 
 pci_chipset_tag_t acpi_pci_md_get_chipset_tag(struct acpi_softc *, int, int);

Index: src/sys/arch/arm/acpi/acpi_pci_machdep.h
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.6 src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.7
--- src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.6	Fri Jan 17 17:06:33 2020
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.h	Sat Feb  1 13:26:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.h,v 1.6 2020/01/17 17:06:33 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.h,v 1.7 2020/02/01 13:26:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -43,6 +43,7 @@ struct acpi_pci_context {
 	bus_space_handle_t ap_conf_bsh;
 	int (*ap_conf_read)(pci_chipset_tag_t, pcitag_t, int, pcireg_t *);
 	int (*ap_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
+	void *ap_conf_priv;
 	int ap_pciflags_clear;
 };
 
@@ -57,6 +58,7 @@ struct acpi_pci_quirk {
 const struct acpi_pci_quirk *	acpi_pci_md_find_quirk(int);
 
 void	acpi_pci_graviton_init(struct acpi_pci_context *);
+void	acpi_pci_layerscape_gen4_init(struct acpi_pci_context *);
 void	acpi_pci_n1sdp_init(struct acpi_pci_context *);
 
 #endif /* !_ARM_ACPI_PCI_MACHDEP_H */

Index: src/sys/arch/arm/acpi/files.acpi
diff -u src/sys/arch/arm/acpi/files.acpi:1.9 src/sys/arch/arm/acpi/files.acpi:1.10
--- src/sys/arch/arm/acpi/files.acpi:1.9	Fri Jan 17 17:06:33 2020
+++ src/sys/arch/arm/acpi/files.acpi	Sat Feb  1 13:26:43 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.9 2020/01/17 17:06:33 jmcneill Exp $
+#	$NetBSD: files.acpi,v 1.10 2020/02/01 13:26:43 jmcneill Exp $
 #
 # Configuration info for ACPI compliant ARM boards.
 #
@@ -14,6 +14,7 @@ file	arch/arm/acpi/acpi_iort.c		acpi
 file	arch/arm/acpi/acpi_machdep.c		acpi
 file	arch/arm/acpi/acpi_pci_machdep.c	acpi & pci
 file	arch/arm/acpi/acpi_pci_graviton.c	acpi & pci
+file	arch/arm/acpi/acpi_pci_layerscape_gen4.c	acpi & pci
 file	arch/arm/acpi/acpi_pci_n1sdp.c		acpi & pci
 file	arch/arm/acpi/acpi_platform.c		acpi
 file	arch/arm/acpi/acpi_simplefb.c		acpi & wsdisplay & genfb

Added files:

Index: src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c
diff -u /dev/null src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c:1.1
--- /dev/null	Sat Feb  1 13:26:43 2020
+++ src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c	Sat Feb  1 13:26:43 2020
@@ -0,0 +1,277 @@
+/* $NetBSD: acpi_pci_layerscape_gen4.c,v 1.1 2020/02/01 13:26:43 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jared McNeill .
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the 

CVS commit: src/sys/dev/acpi

2020-02-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb  1 13:09:09 UTC 2020

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

Log Message:
Use acpi_match_hid to match both _HID and _CID


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/sdhc_acpi.c

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

Modified files:

Index: src/sys/dev/acpi/sdhc_acpi.c
diff -u src/sys/dev/acpi/sdhc_acpi.c:1.9 src/sys/dev/acpi/sdhc_acpi.c:1.10
--- src/sys/dev/acpi/sdhc_acpi.c:1.9	Sun Dec 29 12:46:43 2019
+++ src/sys/dev/acpi/sdhc_acpi.c	Sat Feb  1 13:09:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_acpi.c,v 1.9 2019/12/29 12:46:43 jmcneill Exp $	*/
+/*	$NetBSD: sdhc_acpi.c,v 1.10 2020/02/01 13:09:08 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.9 2019/12/29 12:46:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_acpi.c,v 1.10 2020/02/01 13:09:08 jmcneill Exp $");
 
 #include 
 #include 
@@ -103,7 +103,8 @@ sdhc_acpi_find_slot(ACPI_DEVICE_INFO *ad
 
 	for (i = 0; i < __arraycount(sdhc_acpi_slot_map); i++) {
 		slot = _acpi_slot_map[i];
-		if (strcmp(hid, slot->hid) == 0) {
+		const char * const slot_id[] = { slot->hid, NULL };
+		if (acpi_match_hid(ad, slot_id)) {
 			if (slot->uid == NULL ||
 			((ad->Valid & ACPI_VALID_UID) != 0 &&
 			 uid != NULL &&



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

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:55:26 UTC 2020

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Reduce some ifdefs.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/arm/pic/pic.c

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.54 src/sys/arch/arm/pic/pic.c:1.55
--- src/sys/arch/arm/pic/pic.c:1.54	Sat Feb  1 12:55:13 2020
+++ src/sys/arch/arm/pic/pic.c	Sat Feb  1 12:55:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.54 2020/02/01 12:55:13 riastradh Exp $	*/
+/*	$NetBSD: pic.c,v 1.55 2020/02/01 12:55:26 riastradh Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.54 2020/02/01 12:55:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.55 2020/02/01 12:55:26 riastradh Exp $");
 
 #include 
 #include 
@@ -81,8 +81,20 @@ static void
 
 #ifdef MULTIPROCESSOR
 percpu_t *pic_pending_percpu;
+static struct pic_pending *
+pic_pending_get(void)
+{
+	return percpu_getref(pic_pending_percpu);
+}
+static void
+pic_pending_put(struct pic_pending *pend)
+{
+	percpu_putref(pic_pending_percpu);
+}
 #else
 struct pic_pending pic_pending;
+#define	pic_pending_get()	(_pending)
+#define	pic_pending_put(pend)	__nothing
 #endif /* MULTIPROCESSOR */
 #endif /* __HAVE_PIC_PENDING_INTRS */
 
@@ -244,16 +256,10 @@ pic_mark_pending_source(struct pic_softc
 	__BIT(is->is_irq & 0x1f));
 
 	atomic_or_32(>pic_pending_ipls, ipl_mask);
-#ifdef MULTIPROCESSOR
-	struct pic_pending *pend = percpu_getref(pic_pending_percpu);
-#else
-	struct pic_pending *pend = _pending;
-#endif
+	struct pic_pending *pend = pic_pending_get();
 	atomic_or_32(>pending_ipls, ipl_mask);
 	atomic_or_32(>pending_pics, __BIT(pic->pic_id));
-#ifdef MULTIPROCESSOR
-	percpu_putref(pic_pending_percpu);
-#endif
+	pic_pending_put(pend);
 }
 
 void
@@ -296,16 +302,10 @@ pic_mark_pending_sources(struct pic_soft
 	}
 
 	atomic_or_32(>pic_pending_ipls, ipl_mask);
-#ifdef MULTIPROCESSOR
-	struct pic_pending *pend = percpu_getref(pic_pending_percpu);
-#else
-	struct pic_pending *pend = _pending;
-#endif
+	struct pic_pending *pend = pic_pending_get();
 	atomic_or_32(>pending_ipls, ipl_mask);
 	atomic_or_32(>pending_pics, __BIT(pic->pic_id));
-#ifdef MULTIPROCESSOR
-	percpu_putref(pic_pending_percpu);
-#endif
+	pic_pending_put(pend);
 	return ipl_mask;
 }
 
@@ -553,11 +553,7 @@ pic_do_pending_ints(register_t psw, int 
 		return;
 	}
 #if defined(__HAVE_PIC_PENDING_INTRS)
-#ifdef MULTIPROCESSOR
-	struct pic_pending *pend = percpu_getref(pic_pending_percpu);
-#else
-	struct pic_pending *pend = _pending;
-#endif
+	struct pic_pending *pend = pic_pending_get();
 	while ((pend->pending_ipls & ~__BIT(newipl)) > __BIT(newipl)) {
 		KASSERT(pend->pending_ipls < __BIT(NIPL));
 		for (;;) {
@@ -571,9 +567,7 @@ pic_do_pending_ints(register_t psw, int 
 			pic_list_unblock_irqs(pend);
 		}
 	}
-#ifdef MULTIPROCESSOR
-	percpu_putref(pic_pending_percpu);
-#endif
+	pic_pending_put(pend);
 #endif /* __HAVE_PIC_PENDING_INTRS */
 #ifdef __HAVE_PREEMPTION
 	if (newipl == IPL_NONE && (ci->ci_astpending & __BIT(1))) {



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

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:55:03 UTC 2020

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Switch arm pic allocation and initialization to percpu_create.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/arm/pic/pic.c

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.52 src/sys/arch/arm/pic/pic.c:1.53
--- src/sys/arch/arm/pic/pic.c:1.52	Tue Dec 24 20:40:09 2019
+++ src/sys/arch/arm/pic/pic.c	Sat Feb  1 12:55:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.52 2019/12/24 20:40:09 skrll Exp $	*/
+/*	$NetBSD: pic.c,v 1.53 2020/02/01 12:55:02 riastradh Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.52 2019/12/24 20:40:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.53 2020/02/01 12:55:02 riastradh Exp $");
 
 #include 
 #include 
@@ -647,12 +647,8 @@ pic_add(struct pic_softc *pic, int irqba
 
 #if defined(__HAVE_PIC_PENDING_INTRS) && defined(MULTIPROCESSOR)
 	if (__predict_false(pic_pending_percpu == NULL)) {
-		pic_pending_percpu = percpu_alloc(sizeof(struct pic_pending));
-
-		/*
-		 * Now zero the per-cpu pending data.
-		 */
-		percpu_foreach(pic_pending_percpu, pic_pending_zero, NULL);
+		pic_pending_percpu = percpu_create(sizeof(struct pic_pending),
+		pic_pending_zero, NULL, NULL);
 	}
 #endif /* __HAVE_PIC_PENDING_INTRS && MULTIPROCESSOR */
 
@@ -702,12 +698,8 @@ pic_add(struct pic_softc *pic, int irqba
 	 * corrupt the pointers in the evcnts themselves.  Remember, any
 	 * problem can be solved with sufficient indirection.
 	 */
-	pic->pic_percpu = percpu_alloc(sizeof(struct pic_percpu));
-
-	/*
-	 * Now allocate the per-cpu evcnts.
-	 */
-	percpu_foreach(pic->pic_percpu, pic_percpu_allocate, pic);
+	pic->pic_percpu = percpu_create(sizeof(struct pic_percpu),
+	pic_percpu_allocate, NULL, pic);
 
 	pic->pic_sources = _sources[sourcebase];
 	pic->pic_irqbase = irqbase;



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

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:55:13 UTC 2020

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
pic_pending_zero is unnecessary; percpu_alloc already zeroes.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/arm/pic/pic.c

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.53 src/sys/arch/arm/pic/pic.c:1.54
--- src/sys/arch/arm/pic/pic.c:1.53	Sat Feb  1 12:55:02 2020
+++ src/sys/arch/arm/pic/pic.c	Sat Feb  1 12:55:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.53 2020/02/01 12:55:02 riastradh Exp $	*/
+/*	$NetBSD: pic.c,v 1.54 2020/02/01 12:55:13 riastradh Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.53 2020/02/01 12:55:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.54 2020/02/01 12:55:13 riastradh Exp $");
 
 #include 
 #include 
@@ -616,15 +616,6 @@ pic_percpu_allocate(void *v0, void *v1, 
 #endif
 }
 
-#if defined(__HAVE_PIC_PENDING_INTRS) && defined(MULTIPROCESSOR)
-static void
-pic_pending_zero(void *v0, void *v1, struct cpu_info *ci)
-{
-	struct pic_pending * const p = v0;
-	memset(p, 0, sizeof(*p));
-}
-#endif /* __HAVE_PIC_PENDING_INTRS && MULTIPROCESSOR */
-
 static int
 pic_init(void)
 {
@@ -646,10 +637,8 @@ pic_add(struct pic_softc *pic, int irqba
 	KASSERT(strlen(pic->pic_name) > 0);
 
 #if defined(__HAVE_PIC_PENDING_INTRS) && defined(MULTIPROCESSOR)
-	if (__predict_false(pic_pending_percpu == NULL)) {
-		pic_pending_percpu = percpu_create(sizeof(struct pic_pending),
-		pic_pending_zero, NULL, NULL);
-	}
+	if (__predict_false(pic_pending_percpu == NULL))
+		pic_pending_percpu = percpu_alloc(sizeof(struct pic_pending));
 #endif /* __HAVE_PIC_PENDING_INTRS && MULTIPROCESSOR */
 
 	mutex_enter(_lock);



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

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:55:35 UTC 2020

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
KNF


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

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.55 src/sys/arch/arm/pic/pic.c:1.56
--- src/sys/arch/arm/pic/pic.c:1.55	Sat Feb  1 12:55:26 2020
+++ src/sys/arch/arm/pic/pic.c	Sat Feb  1 12:55:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.55 2020/02/01 12:55:26 riastradh Exp $	*/
+/*	$NetBSD: pic.c,v 1.56 2020/02/01 12:55:35 riastradh Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,20 +33,20 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.55 2020/02/01 12:55:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.56 2020/02/01 12:55:35 riastradh Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 
 #include 
 #include 
@@ -366,7 +366,6 @@ pic_dispatch(struct intrsource *is, void
 #endif
 		(void)(*func)(arg);
 
-
 	struct pic_percpu * const pcpu = percpu_getref(is->is_pic->pic_percpu);
 	KASSERT(pcpu->pcpu_magic == PICPERCPU_MAGIC);
 	pcpu->pcpu_evs[is->is_irq].ev_count++;
@@ -509,7 +508,6 @@ pic_list_unblock_irqs(struct pic_pending
 	}
 }
 
-
 struct pic_softc *
 pic_list_find_pic_by_pending_ipl(struct pic_pending *pend, uint32_t ipl_mask)
 {



CVS commit: src/sys/dev/pci/ixgbe

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 12:55:23 UTC 2020

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

Log Message:
Adopt .

XXX This driver needs some work in this regard (practually no
stats are reported).


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 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.221 src/sys/dev/pci/ixgbe/ixgbe.c:1.222
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.221	Tue Jan 21 14:55:55 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Feb  1 12:55:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.221 2020/01/21 14:55:55 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.222 2020/02/01 12:55:22 thorpej Exp $ */
 
 /**
 
@@ -1701,11 +1701,13 @@ ixgbe_update_stats_counters(struct adapt
 	 * adapter->stats counters. It's required to make ifconfig -z
 	 * (SOICZIFDATA) work.
 	 */
-	ifp->if_collisions = 0;
+	/* XXX Actually, just fill in the per-cpu stats, please !!! */
 
 	/* Rx Errors */
-	ifp->if_iqdrops += total_missed_rx;
-	ifp->if_ierrors += crcerrs + rlec;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statadd_ref(nsr, if_iqdrops, total_missed_rx);
+	if_statadd_ref(nsr, if_ierrors, crcerrs + rlec);
+	IF_STAT_PUTREF(ifp);
 } /* ixgbe_update_stats_counters */
 
 /



CVS commit: src/sys

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:54:51 UTC 2020

Modified Files:
src/sys/net: if.c if_l2tp.c route.c
src/sys/netinet: wqinput.c

Log Message:
Switch sys/net to percpu_create.


To generate a diff of this commit:
cvs rdiff -u -r1.469 -r1.470 src/sys/net/if.c
cvs rdiff -u -r1.42 -r1.43 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.226 -r1.227 src/sys/net/route.c
cvs rdiff -u -r1.6 -r1.7 src/sys/netinet/wqinput.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.469 src/sys/net/if.c:1.470
--- src/sys/net/if.c:1.469	Wed Jan 29 03:16:28 2020
+++ src/sys/net/if.c	Sat Feb  1 12:54:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.469 2020/01/29 03:16:28 thorpej Exp $	*/
+/*	$NetBSD: if.c,v 1.470 2020/02/01 12:54:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.469 2020/01/29 03:16:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.470 2020/02/01 12:54:50 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2916,17 +2916,6 @@ if_tunnel_ro_init_pc(void *p, void *arg 
 	tro->tr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 }
 
-percpu_t *
-if_tunnel_alloc_ro_percpu(void)
-{
-	percpu_t *ro_percpu;
-
-	ro_percpu = percpu_alloc(sizeof(struct tunnel_ro));
-	percpu_foreach(ro_percpu, if_tunnel_ro_init_pc, NULL);
-
-	return ro_percpu;
-}
-
 static void
 if_tunnel_ro_fini_pc(void *p, void *arg __unused, struct cpu_info *ci __unused)
 {
@@ -2938,11 +2927,18 @@ if_tunnel_ro_fini_pc(void *p, void *arg 
 	mutex_obj_free(tro->tr_lock);
 }
 
+percpu_t *
+if_tunnel_alloc_ro_percpu(void)
+{
+
+	return percpu_create(sizeof(struct tunnel_ro),
+	if_tunnel_ro_init_pc, if_tunnel_ro_fini_pc, NULL);
+}
+
 void
 if_tunnel_free_ro_percpu(percpu_t *ro_percpu)
 {
 
-	percpu_foreach(ro_percpu, if_tunnel_ro_fini_pc, NULL);
 	percpu_free(ro_percpu, sizeof(struct tunnel_ro));
 }
 

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.42 src/sys/net/if_l2tp.c:1.43
--- src/sys/net/if_l2tp.c:1.42	Sat Feb  1 02:58:05 2020
+++ src/sys/net/if_l2tp.c	Sat Feb  1 12:54:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.42 2020/02/01 02:58:05 riastradh Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.43 2020/02/01 12:54:50 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.42 2020/02/01 02:58:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.43 2020/02/01 12:54:50 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -267,8 +267,8 @@ l2tp_clone_create(struct if_clone *ifc, 
 
 	sc->l2tp_ro_percpu = if_tunnel_alloc_ro_percpu();
 
-	sc->l2tp_ifq_percpu = percpu_alloc(sizeof(struct ifqueue *));
-	percpu_foreach(sc->l2tp_ifq_percpu, l2tp_ifq_init_pc, NULL);
+	sc->l2tp_ifq_percpu = percpu_create(sizeof(struct ifqueue *),
+	l2tp_ifq_init_pc, l2tp_ifq_fini_pc, NULL);
 	sc->l2tp_si = softint_establish(si_flags, l2tpintr_softint, sc);
 
 	mutex_enter(_softcs.lock);
@@ -367,7 +367,6 @@ l2tp_clone_destroy(struct ifnet *ifp)
 	mutex_exit(>l2tp_lock);
 
 	softint_disestablish(sc->l2tp_si);
-	percpu_foreach(sc->l2tp_ifq_percpu, l2tp_ifq_fini_pc, NULL);
 	percpu_free(sc->l2tp_ifq_percpu, sizeof(struct ifqueue *));
 
 	mutex_enter(_softcs.lock);

Index: src/sys/net/route.c
diff -u src/sys/net/route.c:1.226 src/sys/net/route.c:1.227
--- src/sys/net/route.c:1.226	Wed Nov 13 02:51:22 2019
+++ src/sys/net/route.c	Sat Feb  1 12:54:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.226 2019/11/13 02:51:22 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.227 2020/02/01 12:54:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.226 2019/11/13 02:51:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.227 2020/02/01 12:54:50 riastradh Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -2231,12 +2231,9 @@ rtcache_percpu_init_cpu(void *p, void *a
 percpu_t *
 rtcache_percpu_alloc(void)
 {
-	percpu_t *pc;
 
-	pc = percpu_alloc(sizeof(struct route *));
-	percpu_foreach(pc, rtcache_percpu_init_cpu, NULL);
-
-	return pc;
+	return percpu_create(sizeof(struct route *),
+	rtcache_percpu_init_cpu, NULL, NULL);
 }
 
 const struct sockaddr *

Index: src/sys/netinet/wqinput.c
diff -u src/sys/netinet/wqinput.c:1.6 src/sys/netinet/wqinput.c:1.7
--- src/sys/netinet/wqinput.c:1.6	Thu Sep 19 04:09:34 2019
+++ src/sys/netinet/wqinput.c	Sat Feb  1 12:54:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wqinput.c,v 1.6 2019/09/19 04:09:34 ozaki-r Exp $	*/
+/*	$NetBSD: wqinput.c,v 1.7 2020/02/01 12:54:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -188,8 +188,8 @@ wqinput_create(const char *name, void 

CVS commit: src/sys/opencrypto

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:54:30 UTC 2020

Modified Files:
src/sys/opencrypto: crypto.c

Log Message:
Switch opencrypto to percpu_create.

Can't sleep for allocation in percpu_foreach.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/opencrypto/crypto.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.110 src/sys/opencrypto/crypto.c:1.111
--- src/sys/opencrypto/crypto.c:1.110	Sun Oct  6 15:11:17 2019
+++ src/sys/opencrypto/crypto.c	Sat Feb  1 12:54:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.110 2019/10/06 15:11:17 uwe Exp $ */
+/*	$NetBSD: crypto.c,v 1.111 2020/02/01 12:54:30 riastradh Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.110 2019/10/06 15:11:17 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.111 2020/02/01 12:54:30 riastradh Exp $");
 
 #include 
 #include 
@@ -562,8 +562,8 @@ crypto_init0(void)
 	cryptkop_cache = pool_cache_init(sizeof(struct cryptkop),
 	coherency_unit, 0, 0, "cryptkop", NULL, IPL_NET, NULL, NULL, NULL);
 
-	crypto_crp_qs_percpu = percpu_alloc(sizeof(struct crypto_crp_qs));
-	percpu_foreach(crypto_crp_qs_percpu, crypto_crp_qs_init_pc, NULL);
+	crypto_crp_qs_percpu = percpu_create(sizeof(struct crypto_crp_qs),
+	crypto_crp_qs_init_pc, /*XXX*/NULL, NULL);
 
 	crypto_crp_ret_qs_init();
 



CVS commit: src/sys/kern

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:53:41 UTC 2020

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

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/kern/subr_percpu.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_percpu.c
diff -u src/sys/kern/subr_percpu.c:1.22 src/sys/kern/subr_percpu.c:1.23
--- src/sys/kern/subr_percpu.c:1.22	Sat Feb  1 12:51:18 2020
+++ src/sys/kern/subr_percpu.c	Sat Feb  1 12:53:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_percpu.c,v 1.22 2020/02/01 12:51:18 riastradh Exp $	*/
+/*	$NetBSD: subr_percpu.c,v 1.23 2020/02/01 12:53:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c)2007,2008 YAMAMOTO Takashi,
@@ -31,12 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.22 2020/02/01 12:51:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.23 2020/02/01 12:53:41 riastradh Exp $");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/kern

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:51:19 UTC 2020

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

Log Message:
Use __read_mostly and gather related __cacheline_aligned together.

Should save a few bytes of kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_percpu.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_percpu.c
diff -u src/sys/kern/subr_percpu.c:1.21 src/sys/kern/subr_percpu.c:1.22
--- src/sys/kern/subr_percpu.c:1.21	Sat Feb  1 12:49:02 2020
+++ src/sys/kern/subr_percpu.c	Sat Feb  1 12:51:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_percpu.c,v 1.21 2020/02/01 12:49:02 riastradh Exp $	*/
+/*	$NetBSD: subr_percpu.c,v 1.22 2020/02/01 12:51:18 riastradh Exp $	*/
 
 /*-
  * Copyright (c)2007,2008 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.21 2020/02/01 12:49:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.22 2020/02/01 12:51:18 riastradh Exp $");
 
 #include 
 #include 
@@ -55,9 +55,11 @@ struct percpu {
 };
 
 static krwlock_t	percpu_swap_lock	__cacheline_aligned;
-static kmutex_t		percpu_allocation_lock	__cacheline_aligned;
-static vmem_t *		percpu_offset_arena	__cacheline_aligned;
-static unsigned int	percpu_nextoff		__cacheline_aligned;
+static vmem_t *		percpu_offset_arena	__read_mostly;
+static struct {
+	kmutex_t	lock;
+	unsigned int	nextoff;
+} percpu_allocation __cacheline_aligned;
 
 static percpu_cpu_t *
 cpu_percpu(struct cpu_info *ci)
@@ -71,7 +73,7 @@ percpu_offset(percpu_t *pc)
 {
 	const unsigned int off = pc->pc_offset;
 
-	KASSERT(off < percpu_nextoff);
+	KASSERT(off < percpu_allocation.nextoff);
 	return off;
 }
 
@@ -172,10 +174,10 @@ percpu_backend_alloc(vmem_t *dummy, vmem
 		return ENOMEM;
 
 	size = roundup(size, PERCPU_IMPORT_SIZE);
-	mutex_enter(_allocation_lock);
-	offset = percpu_nextoff;
-	percpu_nextoff = nextoff = percpu_nextoff + size;
-	mutex_exit(_allocation_lock);
+	mutex_enter(_allocation.lock);
+	offset = percpu_allocation.nextoff;
+	percpu_allocation.nextoff = nextoff = percpu_allocation.nextoff + size;
+	mutex_exit(_allocation.lock);
 
 	percpu_cpu_enlarge(nextoff);
 
@@ -213,8 +215,8 @@ percpu_init(void)
 
 	ASSERT_SLEEPABLE();
 	rw_init(_swap_lock);
-	mutex_init(_allocation_lock, MUTEX_DEFAULT, IPL_NONE);
-	percpu_nextoff = PERCPU_QUANTUM_SIZE;
+	mutex_init(_allocation.lock, MUTEX_DEFAULT, IPL_NONE);
+	percpu_allocation.nextoff = PERCPU_QUANTUM_SIZE;
 
 	percpu_offset_arena = vmem_xcreate("percpu", 0, 0, PERCPU_QUANTUM_SIZE,
 	percpu_backend_alloc, NULL, NULL, PERCPU_QCACHE_MAX, VM_SLEEP,
@@ -231,7 +233,7 @@ void
 percpu_init_cpu(struct cpu_info *ci)
 {
 	percpu_cpu_t * const pcc = cpu_percpu(ci);
-	size_t size = percpu_nextoff; /* XXX racy */
+	size_t size = percpu_allocation.nextoff; /* XXX racy */
 
 	ASSERT_SLEEPABLE();
 	pcc->pcc_size = size;



CVS commit: src

2020-02-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb  1 12:49:02 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile percpu.9
src/sys/kern: subr_percpu.c
src/sys/sys: percpu.h

Log Message:
New function percpu_create.

Associates a constructor and destructor with the percpu.  Currently
the constructor runs immediately, but in principle we could use the
same API for future CPU hotplug support.

This lets you sleep for allocation or draining users before
deallocation when setting up or tearing down a percpu -- currently we
have many abuses of percpu_foreach in tree for that purpose.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2020/01/30/msg026036.html


To generate a diff of this commit:
cvs rdiff -u -r1.2307 -r1.2308 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.445 -r1.446 src/share/man/man9/Makefile
cvs rdiff -u -r1.12 -r1.13 src/share/man/man9/percpu.9
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_percpu.c
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/percpu.h

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2307 src/distrib/sets/lists/comp/mi:1.2308
--- src/distrib/sets/lists/comp/mi:1.2307	Wed Jan 29 18:39:04 2020
+++ src/distrib/sets/lists/comp/mi	Sat Feb  1 12:49:02 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2307 2020/01/29 18:39:04 maya Exp $
+#	$NetBSD: mi,v 1.2308 2020/02/01 12:49:02 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -11570,6 +11570,7 @@
 ./usr/share/man/cat9/pcu_used_p.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/percpu.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/percpu_alloc.0		comp-sys-catman		.cat
+./usr/share/man/cat9/percpu_create.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/percpu_foreach.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/percpu_free.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/percpu_getref.0		comp-sys-catman		.cat
@@ -19498,6 +19499,7 @@
 ./usr/share/man/html9/pcu_used_p.html		comp-sys-htmlman	html
 ./usr/share/man/html9/percpu.html		comp-sys-htmlman	html
 ./usr/share/man/html9/percpu_alloc.html		comp-sys-htmlman	html
+./usr/share/man/html9/percpu_create.html	comp-sys-htmlman	html
 ./usr/share/man/html9/percpu_foreach.html	comp-sys-htmlman	html
 ./usr/share/man/html9/percpu_free.html		comp-sys-htmlman	html
 ./usr/share/man/html9/percpu_getref.html	comp-sys-htmlman	html
@@ -27585,6 +27587,7 @@
 ./usr/share/man/man9/pcu_used_p.9		comp-sys-man		.man
 ./usr/share/man/man9/percpu.9			comp-sys-man		.man
 ./usr/share/man/man9/percpu_alloc.9		comp-sys-man		.man
+./usr/share/man/man9/percpu_create.9		comp-sys-man		.man
 ./usr/share/man/man9/percpu_foreach.9		comp-sys-man		.man
 ./usr/share/man/man9/percpu_free.9		comp-sys-man		.man
 ./usr/share/man/man9/percpu_getref.9		comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.445 src/share/man/man9/Makefile:1.446
--- src/share/man/man9/Makefile:1.445	Mon Jan 20 18:38:18 2020
+++ src/share/man/man9/Makefile	Sat Feb  1 12:49:02 2020
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.445 2020/01/20 18:38:18 thorpej Exp $
+#   $NetBSD: Makefile,v 1.446 2020/02/01 12:49:02 riastradh Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -663,6 +663,7 @@ MLINKS+=pcmcia.9 pcmcia_function_init.9 
 	pcmcia.9 pcmcia_cis_read_n.9 \
 	pcmcia.9 pcmcia_scan_cis.9
 MLINKS+=percpu.9 percpu_alloc.9 \
+	percpu.9 percpu_create.9 \
 	percpu.9 percpu_free.9 \
 	percpu.9 percpu_getref.9 \
 	percpu.9 percpu_putref.9 \

Index: src/share/man/man9/percpu.9
diff -u src/share/man/man9/percpu.9:1.12 src/share/man/man9/percpu.9:1.13
--- src/share/man/man9/percpu.9:1.12	Wed May 31 23:54:17 2017
+++ src/share/man/man9/percpu.9	Sat Feb  1 12:49:02 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: percpu.9,v 1.12 2017/05/31 23:54:17 chs Exp $
+.\" $NetBSD: percpu.9,v 1.13 2020/02/01 12:49:02 riastradh Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,12 +27,13 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 31, 2017
+.Dd January 29, 2020
 .Dt PERCPU 9
 .Os
 .Sh NAME
 .Nm percpu ,
 .Nm percpu_alloc ,
+.Nm percpu_create ,
 .Nm percpu_free ,
 .Nm percpu_getref ,
 .Nm percpu_putref ,
@@ -43,6 +44,8 @@
 .Vt typedef void (*percpu_callback_t)(void *, void *, struct cpu_info *);
 .Ft percpu_t *
 .Fn percpu_alloc "size_t size"
+.Ft percpu_t *
+.Fn percpu_create "size_t size" "percpu_callback_t ctor" "percpu_callback_t dtor" "void *arg"
 .Ft void
 .Fn percpu_free "percpu_t *pc" "size_t size"
 .Ft void *
@@ -85,6 +88,30 @@ The storage is initialized with zeroes.
 Treat this as an expensive operation.
 .Fn percpu_alloc
 returns a handle 

CVS commit: src/sys/dev/pci

2020-02-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  1 12:45:05 UTC 2020

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

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_ixl.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/if_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.34 src/sys/dev/pci/if_ixl.c:1.35
--- src/sys/dev/pci/if_ixl.c:1.34	Fri Jan 31 03:30:37 2020
+++ src/sys/dev/pci/if_ixl.c	Sat Feb  1 12:45:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.34 2020/01/31 03:30:37 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.35 2020/02/01 12:45:05 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -434,11 +434,6 @@ struct ixl_tx_ring {
 	pcq_t			*txr_intrq;
 	void			*txr_si;
 
-	uint64_t		 txr_oerrors;	/* if_oerrors */
-	uint64_t		 txr_opackets;	/* if_opackets */
-	uint64_t		 txr_obytes;	/* if_obytes */
-	uint64_t		 txr_omcasts;	/* if_omcasts */
-
 	struct evcnt		 txr_defragged;
 	struct evcnt		 txr_defrag_failed;
 	struct evcnt		 txr_pcqdrop;
@@ -467,11 +462,6 @@ struct ixl_rx_ring {
 	bus_size_t		 rxr_tail;
 	unsigned int		 rxr_qid;
 
-	uint64_t		 rxr_ipackets;	/* if_ipackets */
-	uint64_t		 rxr_ibytes;	/* if_ibytes */
-	uint64_t		 rxr_iqdrops;	/* iqdrops */
-	uint64_t		 rxr_ierrors;	/* if_ierrors */
-
 	struct evcnt		 rxr_mgethdr_failed;
 	struct evcnt		 rxr_mgetcl_failed;
 	struct evcnt		 rxr_mbuf_load_failed;
@@ -1842,12 +1832,10 @@ ixl_ioctl(struct ifnet *ifp, u_long cmd,
 {
 	struct ifreq *ifr = (struct ifreq *)data;
 	struct ixl_softc *sc = (struct ixl_softc *)ifp->if_softc;
-	struct ixl_tx_ring *txr;
-	struct ixl_rx_ring *rxr;
 	const struct sockaddr *sa;
 	uint8_t addrhi[ETHER_ADDR_LEN], addrlo[ETHER_ADDR_LEN];
 	int s, error = 0;
-	unsigned int i, nmtu;
+	unsigned int nmtu;
 
 	switch (cmd) {
 	case SIOCSIFMTU:
@@ -1891,45 +1879,6 @@ ixl_ioctl(struct ifnet *ifp, u_long cmd,
 		}
 		break;
 
-	case SIOCGIFDATA:
-	case SIOCZIFDATA:
-		ifp->if_ipackets = 0;
-		ifp->if_ibytes = 0;
-		ifp->if_iqdrops = 0;
-		ifp->if_ierrors = 0;
-		ifp->if_opackets = 0;
-		ifp->if_obytes = 0;
-		ifp->if_omcasts = 0;
-
-		for (i = 0; i < sc->sc_nqueue_pairs_max; i++) {
-			txr = sc->sc_qps[i].qp_txr;
-			rxr = sc->sc_qps[i].qp_rxr;
-
-			mutex_enter(>rxr_lock);
-			ifp->if_ipackets += rxr->rxr_ipackets;
-			ifp->if_ibytes += rxr->rxr_ibytes;
-			ifp->if_iqdrops += rxr->rxr_iqdrops;
-			ifp->if_ierrors += rxr->rxr_ierrors;
-			if (cmd == SIOCZIFDATA) {
-rxr->rxr_ipackets = 0;
-rxr->rxr_ibytes = 0;
-rxr->rxr_iqdrops = 0;
-rxr->rxr_ierrors = 0;
-			}
-			mutex_exit(>rxr_lock);
-
-			mutex_enter(>txr_lock);
-			ifp->if_opackets += txr->txr_opackets;
-			ifp->if_obytes += txr->txr_obytes;
-			ifp->if_omcasts += txr->txr_omcasts;
-			if (cmd == SIOCZIFDATA) {
-txr->txr_opackets = 0;
-txr->txr_obytes = 0;
-txr->txr_omcasts = 0;
-			}
-			mutex_exit(>txr_lock);
-		}
-		/* FALLTHROUGH */
 	default:
 		s = splnet();
 		error = ether_ioctl(ifp, cmd, data);
@@ -2787,7 +2736,7 @@ ixl_tx_common_locked(struct ifnet *ifp, 
 		map = txm->txm_map;
 
 		if (ixl_load_mbuf(sc->sc_dmat, map, , txr) != 0) {
-			txr->txr_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m);
 			continue;
 		}
@@ -2870,6 +2819,8 @@ ixl_txeof(struct ixl_softc *sc, struct i
 	ring = IXL_DMA_KVA(>txr_mem);
 	mask = sc->sc_tx_ring_ndescs - 1;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	do {
 		if (txlimit-- <= 0) {
 			more = 1;
@@ -2892,10 +2843,10 @@ ixl_txeof(struct ixl_softc *sc, struct i
 
 		m = txm->txm_m;
 		if (m != NULL) {
-			txr->txr_opackets++;
-			txr->txr_obytes += m->m_pkthdr.len;
+			if_statinc_ref(nsr, if_opackets);
+			if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 			if (ISSET(m->m_flags, M_MCAST))
-txr->txr_omcasts++;
+if_statinc_ref(nsr, if_omcasts);
 			m_freem(m);
 		}
 
@@ -2907,6 +2858,8 @@ ixl_txeof(struct ixl_softc *sc, struct i
 		done = 1;
 	} while (cons != prod);
 
+	IF_STAT_PUTREF(ifp);
+
 	bus_dmamap_sync(sc->sc_dmat, IXL_DMA_MAP(>txr_mem),
 	0, IXL_DMA_LEN(>txr_mem), BUS_DMASYNC_PREREAD);
 
@@ -3260,6 +3213,8 @@ ixl_rxeof(struct ixl_softc *sc, struct i
 	ring = IXL_DMA_KVA(>rxr_mem);
 	mask = sc->sc_rx_ring_ndescs - 1;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	do {
 		if (rxlimit-- <= 0) {
 			more = 1;
@@ -3310,11 +3265,12 @@ ixl_rxeof(struct ixl_softc *sc, struct i
 			if (!ISSET(word,
 			IXL_RX_DESC_RXE | IXL_RX_DESC_OVERSIZE)) {
 m_set_rcvif(m, ifp);
-rxr->rxr_ipackets++;
-rxr->rxr_ibytes += m->m_pkthdr.len;
+if_statinc_ref(nsr, if_ipackets);
+if_statadd_ref(nsr, if_ibytes,
+m->m_pkthdr.len);
 if_percpuq_enqueue(ifp->if_percpuq, m);
 			} else {
-rxr->rxr_ierrors++;
+if_statinc_ref(nsr, if_ierrors);
 m_freem(m);
 			}
 
@@ -3331,9 +3287,11 @@ ixl_rxeof(struct ixl_softc *sc, struct i
 	if (done) {
 		rxr->rxr_cons = cons;
 	

CVS commit: src/sys/arch

2020-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb  1 09:21:49 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: param.h
src/sys/arch/arm/include/arm32: param.h

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/include/arm32/param.h

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

Modified files:

Index: src/sys/arch/aarch64/include/param.h
diff -u src/sys/arch/aarch64/include/param.h:1.13 src/sys/arch/aarch64/include/param.h:1.14
--- src/sys/arch/aarch64/include/param.h:1.13	Sun Nov 24 04:08:36 2019
+++ src/sys/arch/aarch64/include/param.h	Sat Feb  1 09:21:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.13 2019/11/24 04:08:36 rin Exp $ */
+/* $NetBSD: param.h,v 1.14 2020/02/01 09:21:49 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -164,8 +164,6 @@ void delay(unsigned int);
 /* compatibility for arm */
 #define arm_btop(x)		aarch64_btop(x)
 #define arm_ptob(x)		aarch64_ptob(x)
-#define arm_trunc_page(x)	aarch64_trunc_page(x)
-#define arm_round_page(x)	aarch64_round_page(x)
 
 #elif defined(__arm__)
 

Index: src/sys/arch/arm/include/arm32/param.h
diff -u src/sys/arch/arm/include/arm32/param.h:1.28 src/sys/arch/arm/include/arm32/param.h:1.29
--- src/sys/arch/arm/include/arm32/param.h:1.28	Sat Jan 18 14:40:04 2020
+++ src/sys/arch/arm/include/arm32/param.h	Sat Feb  1 09:21:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.28 2020/01/18 14:40:04 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.29 2020/02/01 09:21:49 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
@@ -92,7 +92,6 @@
 
 #define arm_btop(x)			((unsigned)(x) >> PGSHIFT)
 #define arm_ptob(x)			((unsigned)(x) << PGSHIFT)
-#define arm_trunc_page(x)		((unsigned)(x) & ~PGOFSET)
 
 #ifdef _KERNEL
 #ifndef _LOCORE



CVS commit: src/sys/arch/x68k/stand/mboot

2020-02-01 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  1 08:08:15 UTC 2020

Modified Files:
src/sys/arch/x68k/stand/mboot: Makefile

Log Message:
Make it output 68000 binary.
CFLAGS already has -m68000 but AFLAGS didn't.

This change makes it proceed to next stage1 even if MPU is 68000.
All stage1 bootloader displays an error message if MPU is 68000.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/stand/mboot/Makefile

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/x68k/stand/mboot/Makefile
diff -u src/sys/arch/x68k/stand/mboot/Makefile:1.17 src/sys/arch/x68k/stand/mboot/Makefile:1.18
--- src/sys/arch/x68k/stand/mboot/Makefile:1.17	Fri Aug  8 15:19:51 2014
+++ src/sys/arch/x68k/stand/mboot/Makefile	Sat Feb  1 08:08:15 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2014/08/08 15:19:51 isaki Exp $
+#	$NetBSD: Makefile,v 1.18 2020/02/01 08:08:15 isaki Exp $
 
 NOMAN=		# defined
 .include 
@@ -24,6 +24,7 @@ CPPFLAGS+=	-I${.CURDIR}/../libiocs
 CPPFLAGS+=	-DTEXTADDR="0x${TEXT}" 
 CPPFLAGS+=	-DBOOT=\"${BOOT}\" -DBOOT_VERS=\"${VERSION}\"
 CFLAGS=		-Wno-main -Os -m68000
+AFLAGS+=	-m68000
 
 LINKFLAGS=	-N -static -Ttext ${TEXT}
 LIBIOCS!=	cd ${.CURDIR}/../libiocs && ${PRINTOBJDIR}