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

2017-09-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 23 23:58:04 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra210_car.c

Log Message:
Add APBDMA clock


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/nvidia/tegra210_car.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/nvidia/tegra210_car.c
diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.7 src/sys/arch/arm/nvidia/tegra210_car.c:1.8
--- src/sys/arch/arm/nvidia/tegra210_car.c:1.7	Sat Sep 23 23:21:35 2017
+++ src/sys/arch/arm/nvidia/tegra210_car.c	Sat Sep 23 23:58:04 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra210_car.c,v 1.7 2017/09/23 23:21:35 jmcneill Exp $ */
+/* $NetBSD: tegra210_car.c,v 1.8 2017/09/23 23:58:04 jmcneill Exp $ */
 #define TEGRA210_CAR_DEBUG
 
 /*-
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.7 2017/09/23 23:21:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.8 2017/09/23 23:58:04 jmcneill Exp $");
 
 #include 
 #include 
@@ -559,6 +559,7 @@ static struct tegra_clk tegra210_car_clo
 	CLK_GATE_H("FUSE", "CLK_M", CAR_DEV_H_FUSE),
 	CLK_GATE_Y("USB2_TRK", "UBS2_HSIC_TRK", CAR_DEV_Y_USB2_TRK),
 	CLK_GATE_Y("HSIC_TRK", "USB2_HSIC_TRK", CAR_DEV_Y_HSIC_TRK),
+	CLK_GATE_H("APBDMA", "CLK_M", CAR_DEV_H_APBDMA),
 };
 
 struct tegra210_init_parent {



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

2017-09-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 23 23:58:32 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra210_car.c

Log Message:
Disable debug


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/nvidia/tegra210_car.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/nvidia/tegra210_car.c
diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.8 src/sys/arch/arm/nvidia/tegra210_car.c:1.9
--- src/sys/arch/arm/nvidia/tegra210_car.c:1.8	Sat Sep 23 23:58:04 2017
+++ src/sys/arch/arm/nvidia/tegra210_car.c	Sat Sep 23 23:58:31 2017
@@ -1,5 +1,4 @@
-/* $NetBSD: tegra210_car.c,v 1.8 2017/09/23 23:58:04 jmcneill Exp $ */
-#define TEGRA210_CAR_DEBUG
+/* $NetBSD: tegra210_car.c,v 1.9 2017/09/23 23:58:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -28,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.8 2017/09/23 23:58:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.9 2017/09/23 23:58:31 jmcneill Exp $");
 
 #include 
 #include 



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

2017-09-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 23 23:58:18 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra_apbdma.c

Log Message:
Match nvidia,tegra210-apbdma


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/nvidia/tegra_apbdma.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/nvidia/tegra_apbdma.c
diff -u src/sys/arch/arm/nvidia/tegra_apbdma.c:1.3 src/sys/arch/arm/nvidia/tegra_apbdma.c:1.4
--- src/sys/arch/arm/nvidia/tegra_apbdma.c:1.3	Wed May  3 13:13:12 2017
+++ src/sys/arch/arm/nvidia/tegra_apbdma.c	Sat Sep 23 23:58:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_apbdma.c,v 1.3 2017/05/03 13:13:12 jakllsch Exp $ */
+/* $NetBSD: tegra_apbdma.c,v 1.4 2017/09/23 23:58:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_apbdma.c,v 1.3 2017/05/03 13:13:12 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_apbdma.c,v 1.4 2017/09/23 23:58:18 jmcneill Exp $");
 
 #include 
 #include 
@@ -94,7 +94,11 @@ CFATTACH_DECL_NEW(tegra_apbdma, sizeof(s
 static int
 tegra_apbdma_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = { "nvidia,tegra124-apbdma", NULL };
+	const char * const compatible[] = {
+		"nvidia,tegra210-apbdma",
+		"nvidia,tegra124-apbdma",
+		NULL
+	};
 	struct fdt_attach_args * const faa = aux;
 
 	return of_match_compatible(faa->faa_phandle, compatible);



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

2017-09-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 23 23:54:55 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: TEGRA

Log Message:
add wskbd at gpiokeys


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbarm/conf/TEGRA

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/evbarm/conf/TEGRA
diff -u src/sys/arch/evbarm/conf/TEGRA:1.31 src/sys/arch/evbarm/conf/TEGRA:1.32
--- src/sys/arch/evbarm/conf/TEGRA:1.31	Fri Sep 22 18:13:16 2017
+++ src/sys/arch/evbarm/conf/TEGRA	Sat Sep 23 23:54:54 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: TEGRA,v 1.31 2017/09/22 18:13:16 jmcneill Exp $
+#	$NetBSD: TEGRA,v 1.32 2017/09/23 23:54:54 jmcneill Exp $
 #
 #	NVIDIA Tegra family SoCs
 #
@@ -58,6 +58,7 @@ tegra124cpu*	at cpu?
 fclock*		at fdt? pass 4
 fregulator*	at fdt? pass 5
 gpiokeys*	at fdt?
+wskbd*		at gpiokeys? console ? mux 1
 
 # Timer
 gtmr*		at fdt? pass 1		# ARM Generic Timer



CVS commit: src/sys/dev/fdt

2017-09-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 23 23:54:30 UTC 2017

Modified Files:
src/sys/dev/fdt: files.fdt gpiokeys.c

Log Message:
For known Linux keycodes, report key press events through a wskbd device
instead of using sysmon pswitch hotkey events.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/gpiokeys.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/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.20 src/sys/dev/fdt/files.fdt:1.21
--- src/sys/dev/fdt/files.fdt:1.20	Sun Aug 13 18:27:31 2017
+++ src/sys/dev/fdt/files.fdt	Sat Sep 23 23:54:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.20 2017/08/13 18:27:31 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.21 2017/09/23 23:54:30 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -26,7 +26,7 @@ device	ffclock: clk
 attach	ffclock at fdt
 file	dev/fdt/fixedfactorclock.c		ffclock
 
-device	gpiokeys: sysmon_envsys, sysmon_power
+device	gpiokeys: sysmon_envsys, sysmon_power, wskbddev, linux_keymap
 attach	gpiokeys at fdt
 file	dev/fdt/gpiokeys.c			gpiokeys
 

Index: src/sys/dev/fdt/gpiokeys.c
diff -u src/sys/dev/fdt/gpiokeys.c:1.4 src/sys/dev/fdt/gpiokeys.c:1.5
--- src/sys/dev/fdt/gpiokeys.c:1.4	Thu Jul  6 14:26:00 2017
+++ src/sys/dev/fdt/gpiokeys.c	Sat Sep 23 23:54:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiokeys.c,v 1.4 2017/07/06 14:26:00 jmcneill Exp $ */
+/* $NetBSD: gpiokeys.c,v 1.5 2017/09/23 23:54:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.4 2017/07/06 14:26:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.5 2017/09/23 23:54:30 jmcneill Exp $");
 
 #include 
 #include 
@@ -40,6 +40,12 @@ __KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 
 #define GPIOKEYS_POLL_INTERVAL	mstohz(200)
@@ -53,15 +59,23 @@ static void	gpiokeys_attach(device_t, de
 static void	gpiokeys_tick(void *);
 static void	gpiokeys_task(void *);
 
+extern const struct wscons_keydesc ukbd_keydesctab[];
+static const struct wskbd_mapdata gpiokeys_keymapdata = {
+	ukbd_keydesctab,
+	KB_US,
+};
+
 struct gpiokeys_softc;
 
 struct gpiokeys_key {
+	struct gpiokeys_softc	*key_sc;
 	int			key_phandle;
 	char	 		*key_label;
 	struct fdtbus_gpio_pin	*key_pin;
 	u_int			key_debounce;
 	u_int			key_code;
 	struct sysmon_pswitch	key_pswitch;
+	uint8_t			key_usbcode;
 	u_int			key_state;
 
 	struct gpiokeys_key	*key_next;
@@ -77,12 +91,48 @@ struct gpiokeys_softc {
 
 	struct gpiokeys_key *sc_keys;
 	callout_t	sc_tick;
+
+	device_t	sc_wskbddev;
+	int		sc_enabled;
 };
 
 CFATTACH_DECL_NEW(gpiokeys, sizeof(struct gpiokeys_softc),
 gpiokeys_match, gpiokeys_attach, NULL, NULL);
 
 static int
+gpiokeys_enable(void *v, int on)
+{
+	struct gpiokeys_softc * const sc = v;
+
+	sc->sc_enabled = on;
+
+	return 0;
+}
+
+static void
+gpiokeys_set_leds(void *v, int leds)
+{
+}
+
+static int
+gpiokeys_ioctl(void *v, u_long cmd, void *data, int flag, lwp_t *l)
+{
+	switch (cmd) {
+	case WSKBDIO_GTYPE:
+		*(int *)data = WSKBD_TYPE_USB;
+		return 0;
+	}
+
+	return EPASSTHROUGH;
+}
+
+static const struct wskbd_accessops gpiokeys_accessops = {
+	.enable = gpiokeys_enable,
+	.set_leds = gpiokeys_set_leds,
+	.ioctl = gpiokeys_ioctl
+};
+
+static int
 gpiokeys_match(device_t parent, cfdata_t cf, void *aux)
 {
 	const char * const compatible[] = { "gpio-keys", NULL };
@@ -98,8 +148,9 @@ gpiokeys_attach(device_t parent, device_
 	const struct fdt_attach_args *faa = aux;
 	const int phandle = faa->faa_phandle;
 	struct gpiokeys_key *key;
-	int child, len;
 	u_int debounce, code;
+	int use_wskbddev = 0;
+	int child, len;
 
 	sc->sc_dev = self;
 	sc->sc_phandle = phandle;
@@ -117,6 +168,7 @@ gpiokeys_attach(device_t parent, device_
 			continue;
 		}
 		key = kmem_zalloc(sizeof(*key), KM_SLEEP);
+		key->key_sc = sc;
 		key->key_phandle = child;
 		key->key_code = code;
 		key->key_label = kmem_zalloc(len, KM_SLEEP);
@@ -131,20 +183,28 @@ gpiokeys_attach(device_t parent, device_
 		if (key->key_pin)
 			key->key_state = fdtbus_gpio_read(key->key_pin);
 
-		key->key_pswitch.smpsw_name = key->key_label;
 		switch (code) {
 		case KEY_POWER:
+			key->key_pswitch.smpsw_name = key->key_label;
 			key->key_pswitch.smpsw_type = PSWITCH_TYPE_POWER;
 			break;
 		case KEY_SLEEP:
+			key->key_pswitch.smpsw_name = key->key_label;
 			key->key_pswitch.smpsw_type = PSWITCH_TYPE_SLEEP;
 			break;
 		default:
-			key->key_pswitch.smpsw_type = PSWITCH_TYPE_HOTKEY;
+			key->key_usbcode = linux_key_to_usb(code);
+			if (key->key_usbcode != 0) {
+use_wskbddev++;
+			} else {
+key->key_pswitch.smpsw_name = key->key_label;
+key->key_pswitch.smpsw_type = PSWITCH_TYPE_HOTKEY;
+			

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

2017-09-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 23 23:21:35 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra210_car.c tegra210_carreg.h
tegra210_xusbpad.c

Log Message:
More XUSB init stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/nvidia/tegra210_car.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra210_carreg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nvidia/tegra210_xusbpad.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/nvidia/tegra210_car.c
diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.6 src/sys/arch/arm/nvidia/tegra210_car.c:1.7
--- src/sys/arch/arm/nvidia/tegra210_car.c:1.6	Fri Sep 22 10:54:44 2017
+++ src/sys/arch/arm/nvidia/tegra210_car.c	Sat Sep 23 23:21:35 2017
@@ -1,4 +1,5 @@
-/* $NetBSD: tegra210_car.c,v 1.6 2017/09/22 10:54:44 jmcneill Exp $ */
+/* $NetBSD: tegra210_car.c,v 1.7 2017/09/23 23:21:35 jmcneill Exp $ */
+#define TEGRA210_CAR_DEBUG
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.6 2017/09/22 10:54:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.7 2017/09/23 23:21:35 jmcneill Exp $");
 
 #include 
 #include 
@@ -738,31 +739,58 @@ tegra210_car_utmip_init(struct tegra210_
 	bus_space_tag_t bst = sc->sc_bst;
 	bus_space_handle_t bsh = sc->sc_bsh;
 
-	const u_int enable_dly_count = 5;
-	const u_int stable_count = 150;
-	const u_int active_dly_count = 24;
-	const u_int xtal_freq_count = 385;
+	/*
+	 * Set up the UTMI PLL.
+	 */
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG3_REG,
+	0, CAR_UTMIP_PLL_CFG3_REF_SRC_SEL);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG3_REG,
+	0, CAR_UTMIP_PLL_CFG3_REF_DIS);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIPLL_HW_PWRDN_CFG0_REG,
+	0, CAR_UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE);
+	delay(10);
+	/* TODO UTMIP_PLL_CFG0 */
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG,
+	CAR_UTMIP_PLL_CFG2_PHY_XTAL_CLOCKEN, 0);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG,
+	0, CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT);	/* Don't care */
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG,
+	0, CAR_UTMIP_PLL_CFG2_STABLE_COUNT);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG,
+	0, CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG,
+	0x3, CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT);
+
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, CAR_DEV_W_XUSB);
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_Y_CLR_REG, CAR_DEV_Y_PEX_USB_UPHY);
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_Y_CLR_REG, CAR_DEV_Y_SATA_USB_UPHY);
 
 	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG,
-	__SHIFTIN(stable_count, CAR_UTMIP_PLL_CFG2_STABLE_COUNT) |
-	__SHIFTIN(active_dly_count, CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT),
+	CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERUP |
+	CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERUP |
+	CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERUP,
 	CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERDOWN |
 	CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERDOWN |
-	CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERDOWN |
-	CAR_UTMIP_PLL_CFG2_STABLE_COUNT |
-	CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT);
-
-tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG,
-	__SHIFTIN(enable_dly_count, CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT) |
-	__SHIFTIN(xtal_freq_count, CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT),
-	CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT |
-	CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT);
-
-	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG,
-	0,
-	CAR_UTMIP_PLL_CFG1_PLLU_POWERDOWN |
-	CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERDOWN);
+	CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERDOWN);
 
+	/*
+	 * Set up UTMI PLL under hardware control
+	 */
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG, 0,
+	CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERUP | CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERDOWN);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIPLL_HW_PWRDN_CFG0_REG,
+	0, CAR_UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIPLL_HW_PWRDN_CFG0_REG,
+	CAR_UTMIPLL_HW_PWRDN_CFG0_IDDQ_PD_INCLUDE, 0);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIPLL_HW_PWRDN_CFG0_REG,
+	0, CAR_UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIPLL_HW_PWRDN_CFG0_REG,
+	CAR_UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET, 0);
+	tegra_reg_set_clear(bst, bsh, CLK_RST_CONTROLLER_XUSB_PLL_CFG0_REG,
+	0, CLK_RST_CONTROLLER_XUSB_PLL_CFG0_UTMIPLL_LOCK_DLY);
+	delay(1);
+	tegra_reg_set_clear(bst, bsh, CAR_UTMIPLL_HW_PWRDN_CFG0_REG,
+	CAR_UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE, 0);
 }
 
 static void
@@ -781,6 +809,11 @@ tegra210_car_xusb_init(struct tegra210_c
 	tegra_reg_set_clear(bst, bsh, CAR_PLLU_OUTA_REG, 0, CAR_PLLU_OUTA_OUT1_RSTN);
 	tegra_reg_set_clear(bst, bsh, CAR_PLLU_OUTA_REG, 0, 

CVS commit: [netbsd-8] src/doc

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 18:27:21 UTC 2017

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

Log Message:
tickets 172, 275, 276, 278-292


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.58 -r1.1.2.59 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.58 src/doc/CHANGES-8.0:1.1.2.59
--- src/doc/CHANGES-8.0:1.1.2.58	Mon Sep 11 05:45:46 2017
+++ src/doc/CHANGES-8.0	Sat Sep 23 18:27:21 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.58 2017/09/11 05:45:46 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.59 2017/09/23 18:27:21 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -5903,3 +5903,150 @@ sys/dev/audio.c	1.379, 1.380, 1.385,
 	- bigger_type is sufficient for product and result.
 	[isaki, ticket #274]
 
+distrib/amiga/miniroot/install.md		1.28
+distrib/miniroot/install.sub			1.46
+distrib/notes/amiga/install			1.36
+sys/arch/amiga/amiga/disksubr.c			1.68
+
+	amiga:
+	- Support installing from a CD9660 formatted disk partition
+	- Fix check of AmigaDOS environment vector for nonstandard
+	  disklabel values.  Don't set a default fsize for CD9660
+	  partitions, the CD9660 filesystem interprets it as a
+	  session offset
+	- Ask for the boot command
+	- Mention the installer question for the boot command
+	[mlelstv, ticket #275]
+
+external/bsd/nvi/dist/cl/cl_main.c		1.6
+external/bsd/nvi/dist/cl/cl_screen.c		1.6
+
+	nvi: Fix an issue where resizing caused a corrupted display.
+	[mlelstv, ticket #276]
+
+sys/dev/audio.c	1.381, 1.390, 1.391, 1.393
+sys/dev/audio.c	1.394 via patch
+sys/dev/audiovar.h1.61-1.62
+sys/dev/audiovar.h1.63 via patch
+
+	audio(4):
+	- Use do .. while (0) for macros.
+	- Introduce audio_destroy_pfilters()/audio_destroy_rfilters()
+	  and use it.
+	- Remove dead code.
+	- Move defines to the appropriate place.
+	- Remove mixer chan from sc_audiochan.
+	- Mixer chan's list is not necessary.
+	- Split the first special element from sc_audiochan list.
+	[isaki, ticket #278]
+
+share/man/man8/afterboot.8			1.59-1.60
+
+	Update packages link. suggest https. bump date
+	Update wifi guide to reflect dhcpcd no longer invoking
+	wpa_supplicant
+	[maya, ticket #279]
+
+usr.sbin/syslogd/syslogd.c			1.124
+
+	Use looked up remote host for remote message without a hostname
+	[ginsbach, ticket #280]
+
+sys/dev/sysmon/sysmon_envsys.c			1.140-1.141
+sys/dev/sysmon/sysmon_envsys_events.c		1.120-1.121
+sys/dev/sysmon/sysmonvar.h			1.50
+
+	- Fix a problem that some drivers (e.g. acpitz(4) or
+	  coretemp(5)) which use sysmon_envsys sleep waiting at "rndsrc"
+	  when "drvctl -d".
+	- Improve tracking of the state of an event's callout, and protect
+	  all queries or modifications of the state with the sme_mtx mutex.
+	- Detach the rndsrc before re-attaching it
+	- Clean up some lock-ordering issues.
+	- KNF
+	PR kern/52533
+	[pgoyette, ticket #281]
+
+regress/sys/arch/i386/ldt/testldt.c		1.17
+
+	Don't test call gates, they are not supported anymore.
+	[maxv, ticket #282]
+
+sys/external/bsd/ipf/netinet/fil.c		1.21
+
+	Revert changing the byte order of fi->fi_addr.  It's already correct.
+	[christos, ticket #283]
+
+external/gpl3/gcc/usr.bin/backend/Makefile	1.38
+
+	Replicate fix from the old gcc.old: alpha.d needs pass-instances.def.
+	[he, ticket #284]
+
+sys/dev/audio.c	1.399-1.402, 1.404-1.405
+sys/dev/audio.c	1.406 via patch
+sys/dev/audiovar.h1.64
+
+	Make MI audio to be able to support devices which has different
+	precision than MI intermediate buffer's precision like vs(4)
+	(4bit ADPCM).
+	[isaki, ticket #285]
+
+sys/arch/m68k/include/fenv.h			1.7
+
+	The __fgetenv() macro operates on a fenv_t, not on a fenv_t *.
+	Fixes a segfault in fegetenv() and feholdexcept().
+	[phx, ticket #286]
+
+share/man/man8/veriexec.8			1.5-1.6
+
+	The bogus number police.
+	Add missing VERIFIED_EXEC_FP_SHA384 option.
+	[sevan, ticket #287]
+
+sys/dev/pci/ixgbe/ixv.c1.59 and 1.62 via patch
+
+	- Use cprng_strong64() instead of cprng_fast64() to prevent panic.
+	- Set get_link_status to true before calling ixv_config_link() in
+	  ixv_init_locked() to get the first link status correctly.
+	[msaitoh, ticket #288]
+
+distrib/sets/lists/base/mi			1.1161
+external/cddl/Makefile1.4
+external/cddl/dtracetoolkit/Makefile		1.1
+external/cddl/dtracetoolkit/dist/Makefile	1.1
+
+	Include scripts from the DTrace Toolkit if DTrace support
+	is enabled.  The following scripts are installed:
+	dtruss- a DTrace version of truss.
+	execsnoop - snoop process execution as it occurs.
+	opensnoop - snoop file opens as they occur.
+	procsystime - print process system call time details.
+	[sevan, ticket #289]
+
+sys/arch/x68k/dev/dmacvar.h			1.11-1.12
+sys/arch/x68k/dev/fd.c1.120
+sys/arch/x68k/dev/intio_dmac.c	

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

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 18:16:20 UTC 2017

Modified Files:
src/sys/arch/x68k/dev [netbsd-8]: vs.c vsvar.h

Log Message:
Pull up following revision(s) (requested by isaki in ticket #172):
sys/arch/x68k/dev/vs.c: 1.38-1.39, 1.41-1.44, 1.47-1.48 via patch
sys/arch/x68k/dev/vsvar.h: 1.12-1.15 via patch
Avoid panic when the device is closed when not playing.
Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary.  The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.
For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.
Update confused vs_set_params().
play and rec are identical but pfil and rfil are independent.
XXX I introduce VS_USE_PREC8 option for debugging purposes
temporarily.  I'll remove it if the problem is solved.
Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).
vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me.  So vs(4) uses local conversion to/from
ADPCM instead of it.  But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
Merge prate and rrate.  These can not be separated.
- Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method.  trigger method is not suitable for
  x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running.  This solves the noise.
  From Y.Sugahara.
- Cache dmac xfer.
- Finally MI audio supports 4bit precision format without null_filter hack!
- Fix reusing play/rec argument as local variables.  It is in/out parameter.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.1 -r1.37.2.2 src/sys/arch/x68k/dev/vs.c
cvs rdiff -u -r1.11 -r1.11.42.1 src/sys/arch/x68k/dev/vsvar.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/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.37.2.1 src/sys/arch/x68k/dev/vs.c:1.37.2.2
--- src/sys/arch/x68k/dev/vs.c:1.37.2.1	Sat Sep 23 17:55:13 2017
+++ src/sys/arch/x68k/dev/vs.c	Sat Sep 23 18:16:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.37.2.1 2017/09/23 17:55:13 snj Exp $	*/
+/*	$NetBSD: vs.c,v 1.37.2.2 2017/09/23 18:16:20 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.37.2.1 2017/09/23 17:55:13 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.37.2.2 2017/09/23 18:16:20 snj Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -78,10 +78,10 @@ static void vs_close(void *);
 static int  vs_query_encoding(void *, struct audio_encoding *);
 static int  vs_set_params(void *, int, int, audio_params_t *,
 	audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
-static int  vs_trigger_output(void *, void *, void *, int,
-	void (*)(void *), void *, const audio_params_t *);
-static int  vs_trigger_input(void *, void *, void *, int,
-	void (*)(void *), void *, const audio_params_t *);
+static int  vs_init_output(void *, void *, int);
+static int  vs_init_input(void *, void *, int);
+static int  vs_start_input(void *, void *, int, void (*)(void *), void *);
+static int  vs_start_output(void *, void *, int, void (*)(void *), void *);
 static int  vs_halt_output(void *);
 static int  vs_halt_input(void *);
 static int  vs_allocmem(struct vs_softc *, size_t, size_t, size_t,
@@ -117,10 +117,10 @@ static const struct audio_hw_if vs_hw_if
 	vs_set_params,
 	NULL,			/* round_blocksize */
 	NULL,			/* commit_settings */
-	NULL,			/* init_output */
-	NULL,			/* init_input */
-	NULL,			/* start_output */
-	NULL,			/* start_input */
+	vs_init_output,
+	vs_init_input,
+	vs_start_output,
+	vs_start_input,
 	vs_halt_output,
 	vs_halt_input,
 	NULL,			/* speaker_ctl */
@@ -134,8 +134,8 @@ static const struct audio_hw_if vs_hw_if
 	vs_round_buffersize,
 	NULL,			/* mappage */
 	vs_get_props,
-	vs_trigger_output,
-	vs_trigger_input,
+	NULL,			/* trigger_output */
+	NULL,			/* trigger_input */
 	NULL,
 	vs_get_locks,
 };
@@ -160,19 +160,6 @@ struct {
 
 #define NUM_RATE	(sizeof(vs_l2r)/sizeof(vs_l2r[0]))
 
-struct {
-	const char *name;
-	int	encoding;
-	int	precision;
-} vs_encodings[] = {
-	{AudioEadpcm,  AUDIO_ENCODING_ADPCM,   4},
-	{AudioEslinear,AUDIO_ENCODING_SLINEAR, 8},
-	{AudioEulinear,AUDIO_ENCODING_ULINEAR, 8},
-	{AudioEmulaw,  AUDIO_ENCODING_ULAW,	   8},
-	{AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16},
-	{AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16},
-};
-
 static int
 vs_match(device_t parent, cfdata_t cf, 

CVS commit: [netbsd-8] src/sys/fs/msdosfs

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:58:25 UTC 2017

Modified Files:
src/sys/fs/msdosfs [netbsd-8]: msdosfs_vfsops.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #292):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.128
Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.
Does fix PR 52485.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.4.1 src/sys/fs/msdosfs/msdosfs_vfsops.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/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.127 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.127.4.1
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.127	Mon Apr 17 08:32:00 2017
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Sat Sep 23 17:58:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.127 2017/04/17 08:32:00 hannken Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.127.4.1 2017/09/23 17:58:25 snj Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.127 2017/04/17 08:32:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.127.4.1 2017/09/23 17:58:25 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -467,6 +467,7 @@ msdosfs_mountfs(struct vnode *devvp, str
 	int	ronly, error, BlkPerSec;
 	uint64_t psize;
 	unsigned secsize;
+	u_long fatbytes, fatblocksecs;
 
 	/* Flush out any old buffers remaining from a previous use. */
 	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
@@ -710,12 +711,40 @@ msdosfs_mountfs(struct vnode *devvp, str
 			pmp->pm_fatdiv = 1;
 		}
 	}
-	if (FAT12(pmp))
-		pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
-	else
+
+	/* validate cluster count against FAT */
+	if ((pmp->pm_maxcluster & pmp->pm_fatmask) != pmp->pm_maxcluster) {
+		DPRINTF("maxcluster %lu outside of mask %#lx\n",
+			pmp->pm_maxcluster, pmp->pm_fatmask);
+		error = EINVAL;
+		goto error_exit;
+	}
+
+	/* validate FAT size */
+	fatbytes = (pmp->pm_maxcluster+1) * pmp->pm_fatmult / pmp->pm_fatdiv;
+	fatblocksecs = howmany(fatbytes, pmp->pm_BytesPerSec);
+
+	if (pmp->pm_FATsecs != fatblocksecs) {
+		DPRINTF("FATsecs %lu != real %lu\n", pmp->pm_FATsecs,
+			fatblocksecs);
+		error = EINVAL;
+		goto error_exit;
+	}
+
+	if (FAT12(pmp)) {
+		/*
+		 * limit block size to what is needed to read a FAT block
+		 * to not exceed MAXBSIZE
+		 */
+		pmp->pm_fatblocksec = min(3, fatblocksecs);
+		pmp->pm_fatblocksize = pmp->pm_fatblocksec
+			* pmp->pm_BytesPerSec;
+	} else {
 		pmp->pm_fatblocksize = MAXBSIZE;
+		pmp->pm_fatblocksec = pmp->pm_fatblocksize
+			/ pmp->pm_BytesPerSec;
+	}
 
-	pmp->pm_fatblocksec = pmp->pm_fatblocksize / pmp->pm_BytesPerSec;
 	pmp->pm_bnshift = ffs(pmp->pm_BytesPerSec) - 1;
 
 	/*



CVS commit: [netbsd-8] src/sys/arch/powerpc/include

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:56:31 UTC 2017

Modified Files:
src/sys/arch/powerpc/include [netbsd-8]: fenv.h

Log Message:
Pull up following revision(s) (requested by phx in ticket #291):
sys/arch/powerpc/include/fenv.h: revision 1.4
Fixed feholdexcept() by copying the actual contents of FPSCR to the fenv_t
instead of a double precision floating point representation of it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/powerpc/include/fenv.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/powerpc/include/fenv.h
diff -u src/sys/arch/powerpc/include/fenv.h:1.3 src/sys/arch/powerpc/include/fenv.h:1.3.6.1
--- src/sys/arch/powerpc/include/fenv.h:1.3	Wed Mar 22 23:11:09 2017
+++ src/sys/arch/powerpc/include/fenv.h	Sat Sep 23 17:56:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.3 2017/03/22 23:11:09 chs Exp $	*/
+/*	$NetBSD: fenv.h,v 1.3.6.1 2017/09/23 17:56:31 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004-2005 David Schultz 
@@ -242,7 +242,7 @@ feholdexcept(fenv_t *__envp)
 	uint32_t msr;
 
 	__mffs(&__r.__d);
-	*__envp = __r.__d;
+	*__envp = __r.__bits.__reg;
 	__r.__bits.__reg &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
 	__mtfsf(__r.__d);
 	__updatemsr(__r.__bits.__reg);



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

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:55:13 UTC 2017

Modified Files:
src/sys/arch/x68k/dev [netbsd-8]: dmacvar.h fd.c intio_dmac.c vs.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #290):
sys/arch/x68k/dev/dmacvar.h: revision 1.11-1.12 via patch
sys/arch/x68k/dev/intio_dmac.c: revision 1.36-1.37 via patch
sys/arch/x68k/dev/fd.c: revision 1.120 via patch
sys/arch/x68k/dev/vs.c: revision 1.45-1.46 via patch
Use dmac_prepare_xfer().
>From Y.Sugahara.
--
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
>From Y.Suhagara and it was found by XM6i.
--
Fix a Continue Operation.
Patch from Y.Sugahara.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.76.1 src/sys/arch/x68k/dev/dmacvar.h
cvs rdiff -u -r1.119 -r1.119.8.1 src/sys/arch/x68k/dev/fd.c
cvs rdiff -u -r1.35 -r1.35.22.1 src/sys/arch/x68k/dev/intio_dmac.c
cvs rdiff -u -r1.37 -r1.37.2.1 src/sys/arch/x68k/dev/vs.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/x68k/dev/dmacvar.h
diff -u src/sys/arch/x68k/dev/dmacvar.h:1.10 src/sys/arch/x68k/dev/dmacvar.h:1.10.76.1
--- src/sys/arch/x68k/dev/dmacvar.h:1.10	Wed Jun 25 13:30:24 2008
+++ src/sys/arch/x68k/dev/dmacvar.h	Sat Sep 23 17:55:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmacvar.h,v 1.10 2008/06/25 13:30:24 isaki Exp $	*/
+/*	$NetBSD: dmacvar.h,v 1.10.76.1 2017/09/23 17:55:13 snj Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -55,8 +55,6 @@ struct dmac_dma_xfer {
 	struct dmac_sg_array *dx_array;	/* DMAC array chain */
 	int		dx_done;
 #endif
-	int		dx_nextoff;	/* for continued operation */
-	int		dx_nextsize;
 };
 
 /*
@@ -99,9 +97,14 @@ struct dmac_softc {
 #define DMAC_MAXSEGSZ	0xff00
 #define DMAC_BOUNDARY	0
 
-struct dmac_channel_stat *dmac_alloc_channel(device_t, int, const char *,
-	int, dmac_intr_handler_t, void *, int, dmac_intr_handler_t, void *);
-		/* ch, name, normalv, normal, errorv, error */
+struct dmac_channel_stat *dmac_alloc_channel(device_t,
+	int,		/* ch */
+	const char *,	/* name */
+	int, dmac_intr_handler_t, void *,	/* normal handler */
+	int, dmac_intr_handler_t, void *,	/* error handler */
+	uint8_t,	/* dcr */
+	uint8_t		/* ocr */
+);
 int dmac_free_channel(device_t, int, void *);
 		/* ch, channel */
 struct dmac_dma_xfer *dmac_alloc_xfer(struct dmac_channel_stat *,

Index: src/sys/arch/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.119 src/sys/arch/x68k/dev/fd.c:1.119.8.1
--- src/sys/arch/x68k/dev/fd.c:1.119	Thu Jan 12 14:24:53 2017
+++ src/sys/arch/x68k/dev/fd.c	Sat Sep 23 17:55:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $	*/
+/*	$NetBSD: fd.c,v 1.119.8.1 2017/09/23 17:55:13 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.119.8.1 2017/09/23 17:55:13 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -487,7 +487,10 @@ fdcattach(device_t parent, device_t self
 	/* Initialize DMAC channel */
 	fdc->sc_dmachan = dmac_alloc_channel(parent, ia->ia_dma, "fdc",
 	ia->ia_dmaintr, fdcdmaintr, fdc,
-	ia->ia_dmaintr + 1, fdcdmaerrintr, fdc);
+	ia->ia_dmaintr + 1, fdcdmaerrintr, fdc,
+	(DMAC_DCR_XRM_CSWH | DMAC_DCR_OTYP_EASYNC | DMAC_DCR_OPS_8BIT),
+	(DMAC_OCR_SIZE_BYTE | DMAC_OCR_REQG_EXTERNAL));
+
 	if (bus_dmamap_create(fdc->sc_dmat, FDC_MAXIOSIZE, 1, DMAC_MAXSEGSZ,
 	0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, >sc_dmamap)) {
 		aprint_error_dev(self, "can't set up intio DMA map\n");

Index: src/sys/arch/x68k/dev/intio_dmac.c
diff -u src/sys/arch/x68k/dev/intio_dmac.c:1.35 src/sys/arch/x68k/dev/intio_dmac.c:1.35.22.1
--- src/sys/arch/x68k/dev/intio_dmac.c:1.35	Wed Mar 26 08:17:59 2014
+++ src/sys/arch/x68k/dev/intio_dmac.c	Sat Sep 23 17:55:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio_dmac.c,v 1.35 2014/03/26 08:17:59 christos Exp $	*/
+/*	$NetBSD: intio_dmac.c,v 1.35.22.1 2017/09/23 17:55:13 snj Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.35 2014/03/26 08:17:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.35.22.1 2017/09/23 17:55:13 snj Exp $");
 
 #include 
 #include 
@@ -159,9 +159,10 @@ dmac_init_channels(struct dmac_softc *sc
  * Channel initialization/deinitialization per user device.
  */
 struct dmac_channel_stat *
-dmac_alloc_channel(device_t self, int ch, const char *name, int normalv,
-dmac_intr_handler_t normal, void *normalarg, int errorv,
-dmac_intr_handler_t error, void *errorarg)
+dmac_alloc_channel(device_t self, int ch, const char 

CVS commit: [netbsd-8] src

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:50:43 UTC 2017

Modified Files:
src/distrib/sets/lists/base [netbsd-8]: mi
src/external/cddl [netbsd-8]: Makefile
Added Files:
src/external/cddl/dtracetoolkit [netbsd-8]: Makefile
src/external/cddl/dtracetoolkit/dist [netbsd-8]: Makefile

Log Message:
Pull up following revision(s) (requested by sevan in ticket #289):
distrib/sets/lists/base/mi: revision 1.1161
external/cddl/Makefile: revision 1.4
external/cddl/dtracetoolkit/Makefile: revision 1.1
external/cddl/dtracetoolkit/dist/Makefile: revision 1.1
Include scripts from the DTrace Toolkit if DTrace support is enabled.
The following scripts are installed:
dtruss- a DTrace version of truss.
execsnoop - snoop process execution as it occurs.
opensnoop - snoop file opens as they occur.
procsystime - print process system call time details.
ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.1158 -r1.1158.2.1 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.3 -r1.3.18.1 src/external/cddl/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/external/cddl/dtracetoolkit/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/external/cddl/dtracetoolkit/dist/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1158 src/distrib/sets/lists/base/mi:1.1158.2.1
--- src/distrib/sets/lists/base/mi:1.1158	Sat May 27 21:02:54 2017
+++ src/distrib/sets/lists/base/mi	Sat Sep 23 17:50:43 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1158 2017/05/27 21:02:54 bouyer Exp $
+# $NetBSD: mi,v 1.1158.2.1 2017/09/23 17:50:43 snj Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1645,6 +1645,7 @@
 ./usr/sbin/download-vulnerability-list		base-pkgutil-bin
 ./usr/sbin/dtmfdecodebase-isdn-bin
 ./usr/sbin/dtracebase-debug-bin		dtrace
+./usr/sbin/dtrussbase-debug-bin		dtrace
 ./usr/sbin/dumpfsbase-sysutil-bin
 ./usr/sbin/dumplfsbase-sysutil-bin
 ./usr/sbin/eaytestbase-obsolete		obsolete
@@ -1654,6 +1655,7 @@
 ./usr/sbin/eshconfigbase-sysutil-bin
 ./usr/sbin/etcupdatebase-sysutil-bin
 ./usr/sbin/extattrctlbase-sysutil-bin
+./usr/sbin/execsnoopbase-debug-bin		dtrace
 ./usr/sbin/faithdbase-router-bin		inet6
 ./usr/sbin/fixmountbase-nfsclient-bin
 ./usr/sbin/flashctlbase-sysutil-bin
@@ -1802,6 +1804,7 @@
 ./usr/sbin/ntptimesetbase-obsolete		obsolete
 ./usr/sbin/ntptracebase-ntp-bin
 ./usr/sbin/omshellbase-dhcpd-bin
+./usr/sbin/opensnoopbase-debug-bin		dtrace
 ./usr/sbin/pac	base-sysutil-bin
 ./usr/sbin/paxctlbase-sysutil-bin
 ./usr/sbin/pcictlbase-sysutil-bin
@@ -1837,6 +1840,7 @@
 ./usr/sbin/pppoectlbase-obsolete		obsolete
 ./usr/sbin/pppstatsbase-ppp-bin
 ./usr/sbin/praliasesbase-obsolete		obsolete
+./usr/sbin/procsystimebase-debug-bin		dtrace
 ./usr/sbin/psrsetbase-sysutil-bin
 ./usr/sbin/pstatbase-sysutil-bin
 ./usr/sbin/pvcsifbase-netutil-bin

Index: src/external/cddl/Makefile
diff -u src/external/cddl/Makefile:1.3 src/external/cddl/Makefile:1.3.18.1
--- src/external/cddl/Makefile:1.3	Tue Mar 25 09:52:55 2014
+++ src/external/cddl/Makefile	Sat Sep 23 17:50:43 2017
@@ -1,8 +1,12 @@
-#	$NetBSD: Makefile,v 1.3 2014/03/25 09:52:55 ozaki-r Exp $
+#	$NetBSD: Makefile,v 1.3.18.1 2017/09/23 17:50:43 snj Exp $
 .include 
 
 # We need more modular flag e.g. we can add dtrace to osnet later
 
+.if (${MKDTRACE} != "no")
+SUBDIR+= dtracetoolkit
+.endif
+
 .if ( ${MKZFS} != "no" || ${MKDTRACE} != "no" || ${MKCTF} != "no")
 SUBDIR+= osnet
 .endif

Added files:

Index: src/external/cddl/dtracetoolkit/Makefile
diff -u /dev/null src/external/cddl/dtracetoolkit/Makefile:1.1.2.2
--- /dev/null	Sat Sep 23 17:50:43 2017
+++ src/external/cddl/dtracetoolkit/Makefile	Sat Sep 23 17:50:43 2017
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1.2.2 2017/09/23 17:50:43 snj Exp $
+
+SUBDIR= 	dist
+
+.include 

Index: src/external/cddl/dtracetoolkit/dist/Makefile
diff -u /dev/null src/external/cddl/dtracetoolkit/dist/Makefile:1.1.2.2
--- /dev/null	Sat Sep 23 17:50:43 2017
+++ src/external/cddl/dtracetoolkit/dist/Makefile	Sat Sep 23 17:50:43 2017
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.1.2.2 2017/09/23 17:50:43 snj Exp $
+
+.include 
+
+.if (${MKDTRACE} != "no")
+FILES= 	dtruss
+FILES+= 	execsnoop
+FILES+= 	opensnoop
+FILES+= 	procsystime
+
+FILESDIR= 	/usr/sbin
+FILESMODE= 	555
+.endif
+
+.include 
+.include 



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

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:47:34 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #288):
sys/dev/pci/ixgbe/ixv.c: 1.59 and 1.62 via patch
- Use cprng_strong64() instead of cprng_fast64() to prevent panic.
- Set get_link_status to true before calling ixv_config_link() in
  ixv_init_locked() to get the first link status correctly.


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.1
--- src/sys/dev/pci/ixgbe/ixv.c:1.56	Fri May 26 09:17:32 2017
+++ src/sys/dev/pci/ixgbe/ixv.c	Sat Sep 23 17:47:34 2017
@@ -31,7 +31,7 @@
 
 **/
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixv.c,v 1.56 2017/05/26 09:17:32 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.1 2017/09/23 17:47:34 snj Exp $*/
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -430,7 +430,7 @@ ixv_attach(device_t parent, device_t dev
 	/* If no mac address was assigned, make a random one */
 	if (!ixv_check_ether_addr(hw->mac.addr)) {
 		u8 addr[ETHER_ADDR_LEN];
-		uint64_t rndval = cprng_fast64();
+		uint64_t rndval = cprng_strong64();
 
 		memcpy(addr, , sizeof(addr));
 		addr[0] &= 0xFE;
@@ -820,8 +820,8 @@ ixv_init_locked(struct adapter *adapter)
 	ixv_init_stats(adapter);
 
 	/* Config/Enable Link */
-	ixv_config_link(adapter);
 	hw->mac.get_link_status = TRUE;
+	ixv_config_link(adapter);
 
 	/* Start watchdog */
 	callout_reset(>timer, hz, ixv_local_timer, adapter);



CVS commit: [netbsd-8] src/share/man/man8

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:44:58 UTC 2017

Modified Files:
src/share/man/man8 [netbsd-8]: veriexec.8

Log Message:
Pull up following revision(s) (requested by sevan in ticket #287):
share/man/man8/veriexec.8: revision 1.5-1.6
The bogus number police
Add missing VERIFIED_EXEC_FP_SHA384 option.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.18.1 src/share/man/man8/veriexec.8

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/man8/veriexec.8
diff -u src/share/man/man8/veriexec.8:1.4 src/share/man/man8/veriexec.8:1.4.18.1
--- src/share/man/man8/veriexec.8:1.4	Tue Mar 18 18:20:40 2014
+++ src/share/man/man8/veriexec.8	Sat Sep 23 17:44:58 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: veriexec.8,v 1.4 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: veriexec.8,v 1.4.18.1 2017/09/23 17:44:58 snj Exp $
 .\"
 .\" Copyright (c) 2008 Elad Efrat 
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 18, 2008
+.Dd September 13, 2017
 .Dt VERIEXEC 8
 .Os
 .Sh NAME
@@ -67,12 +67,13 @@ below), this list can be loaded manually
 .Em Veriexec
 requires a pseudo-device to run:
 .Bd -literal -offset indent
-pseudo-device veriexec 1
+pseudo-device veriexec
 .Ed
 .Pp
 Additionally, one or more options for digital fingerprint algorithm support:
 .Bd -literal -offset indent
 options VERIFIED_EXEC_FP_SHA256
+options VERIFIED_EXEC_FP_SHA384
 options VERIFIED_EXEC_FP_SHA512
 .Ed
 .Pp



CVS commit: [netbsd-8] src/sys/arch/m68k/include

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:43:15 UTC 2017

Modified Files:
src/sys/arch/m68k/include [netbsd-8]: fenv.h

Log Message:
Pull up following revision(s) (requested by phx in ticket #286):
sys/arch/m68k/include/fenv.h: revision 1.7
The __fgetenv() macro operates on a fenv_t, not on a fenv_t *.
Fixes a segfault in fegetenv() and feholdexcept().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.6.1 src/sys/arch/m68k/include/fenv.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/m68k/include/fenv.h
diff -u src/sys/arch/m68k/include/fenv.h:1.6 src/sys/arch/m68k/include/fenv.h:1.6.6.1
--- src/sys/arch/m68k/include/fenv.h:1.6	Wed Mar 22 23:11:09 2017
+++ src/sys/arch/m68k/include/fenv.h	Sat Sep 23 17:43:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.6 2017/03/22 23:11:09 chs Exp $	*/
+/*	$NetBSD: fenv.h,v 1.6.6.1 2017/09/23 17:43:15 snj Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -210,7 +210,7 @@ fesetround(int __round)
 __fenv_static inline int
 fegetenv(fenv_t *__envp)
 {
-	__fgetenv(__envp);
+	__fgetenv(*__envp);
 
 	return 0;
 }
@@ -220,7 +220,7 @@ feholdexcept(fenv_t *__envp)
 {
 	fexcept_t __fpcr, __fpsr;
 
-	__fgetenv(__envp);
+	__fgetenv(*__envp);
 	__fpsr = __envp->fpsr & ~FE_ALL_EXCEPT;
 	__set_fpsr(__fpsr);	/* clear all */
 	__fpcr = __envp->fpcr & ~(FE_ALL_EXCEPT << 6);



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

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:39:34 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: audio.c audiovar.h

Log Message:
Pull up following revision(s) (requested by isaki in ticket #285):
sys/dev/audiovar.h: 1.64
sys/dev/audio.c: 1.399-1.402, 1.404-1.405
sys/dev/audio.c: 1.406 via patch
Clean up mix_write().
--
Fix typo. sc_mrr -> sc_mpr for play buffer.
--
Remove goto in mix_write()
--
Remove meaningless sc_blkset.
audio_calc_blksize() checks whether sc_blkset is set but
it seems to be always cleared before calling audio_calc_blksize().
--
Don't assign sc->sc_pr/rr.blksize in audio_initbufs().
For hwvc, it is calculated in audiosetinfno().  And the user vc should
not change sc->sc_pr/rr.blksize.  In addition, this assignments appear twice.
--
Remove duplicated code.
For hwvc, audio_calc_blksize() appears soon again.
For user vc, the userland format and HW format are separeted, so
audio_calc_blksize() here is no longer necessary.  In addition,
vc->sc_mpr.blksize is already initialized in audio_open().
--
Separete sc->sc_pr/rr (mix ring) block size and hwvc->sc_mpr/mrr (hw ring)
block size.  Now MI audio supports(revives) device with different precision
than mix ring's precision like vs(4) (4bit ADPCM).


To generate a diff of this commit:
cvs rdiff -u -r1.357.2.8 -r1.357.2.9 src/sys/dev/audio.c
cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/dev/audiovar.h

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.357.2.8 src/sys/dev/audio.c:1.357.2.9
--- src/sys/dev/audio.c:1.357.2.8	Sat Sep 23 17:13:10 2017
+++ src/sys/dev/audio.c	Sat Sep 23 17:39:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.357.2.8 2017/09/23 17:13:10 snj Exp $	*/
+/*	$NetBSD: audio.c,v 1.357.2.9 2017/09/23 17:39:34 snj Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.8 2017/09/23 17:13:10 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.9 2017/09/23 17:39:34 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -275,7 +275,7 @@ int	mix_write(void *);
 int	mix_read(void *);
 int	audio_check_params(struct audio_params *);
 
-void	audio_calc_blksize(struct audio_softc *, int, struct virtual_channel *);
+int	audio_calc_blksize(struct audio_softc *, const audio_params_t *);
 void	audio_fill_silence(struct audio_params *, uint8_t *, int);
 int	audio_silence_copyout(struct audio_softc *, int, struct uio *);
 
@@ -2025,11 +2025,8 @@ audio_initbufs(struct audio_softc *sc, s
 	const struct audio_hw_if *hw;
 	int error;
 
-	if (vc == NULL) {
+	if (vc == NULL)
 		vc = sc->sc_hwvc;
-		sc->sc_pr.blksize = vc->sc_mrr.blksize;
-		sc->sc_rr.blksize = vc->sc_mrr.blksize;
-	}
 
 	DPRINTF(("audio_initbufs: mode=0x%x\n", vc->sc_mode));
 	hw = sc->hw_if;
@@ -2045,8 +2042,6 @@ audio_initbufs(struct audio_softc *sc, s
 return error;
 		}
 	}
-	if (vc == sc->sc_hwvc)
-		sc->sc_rr.blksize = vc->sc_mrr.blksize;
 
 	if (audio_can_playback(sc) &&
 		((vc->sc_open & AUOPEN_WRITE) || vc == sc->sc_hwvc)) {
@@ -2061,8 +2056,6 @@ audio_initbufs(struct audio_softc *sc, s
 return error;
 		}
 	}
-	if (vc == sc->sc_hwvc)
-		sc->sc_pr.blksize = vc->sc_mpr.blksize;
 
 #ifdef AUDIO_INTR_TIME
 	if (audio_can_playback(sc)) {
@@ -2154,7 +2147,6 @@ audio_open(dev_t dev, struct audio_softc
 	sizeof(vc->sc_pfilters));
 	vc->sc_draining = false;
 	vc->sc_pbus = false;
-	vc->sc_blkset = false;
 	vc->sc_lastinfovalid = false;
 	vc->sc_swvol = 255;
 	vc->sc_recswvol = 255;
@@ -2632,32 +2624,14 @@ audio_clear_intr_unlocked(struct audio_s
 	mutex_exit(sc->sc_intr_lock);
 }
 
-void
-audio_calc_blksize(struct audio_softc *sc, int mode,
-		   struct virtual_channel *vc)
+int
+audio_calc_blksize(struct audio_softc *sc, const audio_params_t *parm)
 {
-	const audio_params_t *parm;
-	struct audio_stream *rb;
-	int *blksize;
-
-	if (vc->sc_blkset)
-		return;
-
-	if (mode == AUMODE_PLAY) {
-		rb = vc->sc_pustream;
-		parm = >param;
-		blksize = >sc_mpr.blksize;
-	} else {
-		rb = vc->sc_rustream;
-		parm = >param;
-		blksize = >sc_mrr.blksize;
-	}
+	int blksize;
 
-	*blksize = parm->sample_rate * audio_blk_ms / 1000 *
+	blksize = parm->sample_rate * audio_blk_ms / 1000 *
 	 parm->channels * parm->precision / NBBY;
-
-	DPRINTF(("audio_calc_blksize: %s blksize=%d\n",
-		 mode == AUMODE_PLAY ? "play" : "record", *blksize));
+	return blksize;
 }
 
 void
@@ -4098,7 +4072,6 @@ audio_set_vchan_defaults(struct audio_so
 	/* default parameters */
 	vc->sc_rparams = sc->sc_vchan_params;
 	vc->sc_pparams = sc->sc_vchan_params;
-	vc->sc_blkset = false;
 
 	AUDIO_INITINFO();
 	ai.record.sample_rate = sc->sc_frequency;
@@ -4139,7 +4112,6 @@ audio_set_defaults(struct audio_softc *s
 	/* default parameters */
 	vc->sc_rparams = audio_default;
 	vc->sc_pparams = 

CVS commit: [netbsd-8] src/external/gpl3/gcc/usr.bin/backend

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:30:55 UTC 2017

Modified Files:
src/external/gpl3/gcc/usr.bin/backend [netbsd-8]: Makefile

Log Message:
Pull up following revision(s) (requested by he in ticket #284):
external/gpl3/gcc/usr.bin/backend/Makefile: revision 1.38
Replicate fix from the old gcc.old: alpha.d needs pass-instances.def.


To generate a diff of this commit:
cvs rdiff -u -r1.36.4.1 -r1.36.4.2 \
src/external/gpl3/gcc/usr.bin/backend/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/backend/Makefile
diff -u src/external/gpl3/gcc/usr.bin/backend/Makefile:1.36.4.1 src/external/gpl3/gcc/usr.bin/backend/Makefile:1.36.4.2
--- src/external/gpl3/gcc/usr.bin/backend/Makefile:1.36.4.1	Wed Jul  5 15:56:58 2017
+++ src/external/gpl3/gcc/usr.bin/backend/Makefile	Sat Sep 23 17:30:55 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.36.4.1 2017/07/05 15:56:58 martin Exp $
+#	$NetBSD: Makefile,v 1.36.4.2 2017/09/23 17:30:55 snj Exp $
 
 LIBISPRIVATE=	yes
 
@@ -445,6 +445,7 @@ final.o: target-hooks-def.h c-family/c-t
 
 .if ${GCC_MACHINE_ARCH} == "alpha"
 alpha.d alpha.o: tm-constrs.h tm_p.h insn-opinit.h target-hooks-def.h
+alpha.d: pass-instances.def
 .endif
 
 .if ${MACHINE_CPU} == "arm"



CVS commit: [netbsd-8] src/sys/external/bsd/ipf/netinet

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:28:41 UTC 2017

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-8]: fil.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #283):
sys/external/bsd/ipf/netinet/fil.c: revision 1.21
Revert changing the byte order of fi->fi_addr. It is already correct. From
Timo Buhrmester


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/external/bsd/ipf/netinet/fil.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/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.20 src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.1
--- src/sys/external/bsd/ipf/netinet/fil.c:1.20	Sun Apr 23 20:47:22 2017
+++ src/sys/external/bsd/ipf/netinet/fil.c	Sat Sep 23 17:28:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.20 2017/04/23 20:47:22 christos Exp $	*/
+/*	$NetBSD: fil.c,v 1.20.4.1 2017/09/23 17:28:41 snj Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.20 2017/04/23 20:47:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.20.4.1 2017/09/23 17:28:41 snj Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -1709,7 +1709,7 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
 	fin->fin_crc += fi->fi_saddr;
 	fi->fi_daddr = ip->ip_dst.s_addr;
 	fin->fin_crc += fi->fi_daddr;
-	if (IN_CLASSD(ntohl(fi->fi_daddr)))
+	if (IN_CLASSD(fi->fi_daddr))
 		fin->fin_flx |= FI_MULTICAST|FI_MBCAST;
 
 	/*



CVS commit: [netbsd-8] src/regress/sys/arch/i386/ldt

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:27:02 UTC 2017

Modified Files:
src/regress/sys/arch/i386/ldt [netbsd-8]: testldt.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #282):
regress/sys/arch/i386/ldt/testldt.c: revision 1.17
Don't test call gates, they are not supported anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.6.1 src/regress/sys/arch/i386/ldt/testldt.c

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

Modified files:

Index: src/regress/sys/arch/i386/ldt/testldt.c
diff -u src/regress/sys/arch/i386/ldt/testldt.c:1.16 src/regress/sys/arch/i386/ldt/testldt.c:1.16.6.1
--- src/regress/sys/arch/i386/ldt/testldt.c:1.16	Sat Sep  3 08:47:38 2016
+++ src/regress/sys/arch/i386/ldt/testldt.c	Sat Sep 23 17:27:02 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: testldt.c,v 1.16 2016/09/03 08:47:38 maxv Exp $	*/
+/*	$NetBSD: testldt.c,v 1.16.6.1 2017/09/23 17:27:02 snj Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1993 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -53,15 +53,6 @@ get_fs_byte(const char *addr)
 	return _v;
 }
 
-static unsigned short
-get_cs(void)
-{
-	unsigned short _v;
-
-	__asm ("movw %%cs,%0": "=r" (_v));
-	return _v;
-}
-
 static int
 check_desc(int desc)
 {
@@ -70,15 +61,6 @@ check_desc(int desc)
 	return get_fs_byte((char *)0);
 }
 
-static void
-gated_call(void)
-{
-	printf("Called from call gate...");
-	__asm volatile("movl %ebp,%esp");
-	__asm volatile("popl %ebp");
-	__asm volatile(".byte 0xcb");
-}
-
 static union descriptor *
 make_sd(void *basep, unsigned limit, int type, int dpl, int seg32, int inpgs)
 {
@@ -99,23 +81,6 @@ make_sd(void *basep, unsigned limit, int
 	return 
 }
 
-static union descriptor *
-make_gd(void *func, unsigned int sel, unsigned stkcpy, int type, int dpl)
-{
-	static union descriptor d;
-	unsigned long offset = (unsigned long)func;
-
-	d.gd.gd_looffset = offset & 0x;
-	d.gd.gd_selector = sel & 0x;
-	d.gd.gd_stkcpy   = stkcpy & 0x1ff;
-	d.gd.gd_type = type & 0x1ff;
-	d.gd.gd_dpl  = dpl & 0x3;
-	d.gd.gd_p= 1;
-	d.gd.gd_hioffset = (offset & 0x) >> 16;
-
-	return 
-}
-
 static const char *
 seg_type_name[] = {
 	"SYSNULL", "SYS286TSS", "SYSLDT", "SYS286BSY",
@@ -206,9 +171,8 @@ main(int argc, char *argv[])
 	union descriptor ldt[MAX_USER_LDT];
 	int n, ch;
 	int num;
-	unsigned int cs = get_cs();
 	unsigned char *data;
-	union descriptor *sd, *gd;
+	union descriptor *sd;
 	unsigned char one = 1, two = 2, val;
 	struct sigaction segv_act;
 	int verbose = 0;
@@ -229,10 +193,8 @@ main(int argc, char *argv[])
 	}
 
 	printf("Testing i386_get_ldt\n");
-	if ((num = i386_get_ldt(0, ldt, MAX_USER_LDT)) < 0)
-		err(2, "get_ldt");
-	if (num == 0)
-		errx(1, "i386_get_ldt() returned empty initial LDT");
+	if ((num = i386_get_ldt(0, ldt, MAX_USER_LDT)) >= 0)
+		err(2, "get_ldt succeeded");
 
 	if (verbose) {
 		printf("Got %d (initial) LDT entries\n", num);
@@ -275,39 +237,6 @@ main(int argc, char *argv[])
 		"expected 0x97, got 0x%x", check_desc(num));
 
 	/*
-	 * Test a Call Gate
-	 */
-	printf("Making call gate\n");
-	fflush(stdout);
-
-	gd = make_gd((void *)gated_call, cs, 0, SDT_SYS386CGT, SEL_UPL);
-	if ((num = i386_set_ldt(4095, gd, 1)) < 0)
-		err(1, "set_ldt: call gate");
-
-	if (verbose) {
-		printf("setldt returned: %d\n", num);
-		printf("Call gate sel = 0x%x\n", LSEL(num, SEL_UPL));
-	}
-
-	if ((n = i386_get_ldt(num, ldt, 1)) < 0)
-		err(1, "get_ldt");
-
-	if (verbose) {
-		printf("Entry %d: ", num);
-		print_ldt([0]);
-	}
-
-	printf("Testing call gate...");
-	fflush(stdout);
-	/*
-	 * Long call to call gate.
-	 * Only the selector matters; offset is irrelevant.
-	 */
-	__asm volatile("lcall $0x7fff,$0x0");
-
-	printf("Gated call returned\n");
-
-	/*
 	 * Test multiple sets.
 	 */
 



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

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:22:49 UTC 2017

Modified Files:
src/sys/dev/sysmon [netbsd-8]: sysmon_envsys.c sysmon_envsys_events.c
sysmonvar.h

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #281):
sys/dev/sysmon/sysmon_envsys.c: 1.140-1.141
sys/dev/sysmon/sysmon_envsys_events.c: 1.120-1.121
sys/dev/sysmon/sysmonvar.h: 1.50
Fixes a problem that some driver(e.g. acpitz(4) or coretemp(5)) which
use sysmon_envsys sleep waiting at "rndsrc" when "drvctl -d".
Don't call rnd_detach_source() in sme_remove_event() which is called
from sme_event_unregister_all(). Instead, call rnd_detach_source() in
sysmon_envsys_sensor_detach() and call sysmon_envsys_sensor_detach()
before sme_event_unregister_sensor(). Each sensor(envsys_data) has each
rnd_src, but some sme_events point to the same rnd_src in a sensor.
Calling rnd_detach_souce() twice with the same rnd_src brokes a reference
count in rnd_src. OK'd by pgoyette@.
--
Improve tracking of the state of an event's callout, and protect all
queries or modifications of the state with the sme_mtx mutex.
Detach the rndsrc before re-attaching it (with potentially new values).
Clean up some lock-ordering issues.
And a couple of KNF issues for good measure!
Should address PR kern/52533


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.139.10.1 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.119 -r1.119.2.1 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.49 -r1.49.10.1 src/sys/dev/sysmon/sysmonvar.h

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

Modified files:

Index: src/sys/dev/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.139 src/sys/dev/sysmon/sysmon_envsys.c:1.139.10.1
--- src/sys/dev/sysmon/sysmon_envsys.c:1.139	Mon Dec 14 01:08:47 2015
+++ src/sys/dev/sysmon/sysmon_envsys.c	Sat Sep 23 17:22:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.139 2015/12/14 01:08:47 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.139.10.1 2017/09/23 17:22:48 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.139 2015/12/14 01:08:47 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.139.10.1 2017/09/23 17:22:48 snj Exp $");
 
 #include 
 #include 
@@ -525,6 +525,8 @@ sysmon_envsys_create(void)
 {
 	struct sysmon_envsys *sme;
 
+	CTASSERT(SME_CALLOUT_INVALID == 0);
+
 	sme = kmem_zalloc(sizeof(*sme), KM_SLEEP);
 	TAILQ_INIT(>sme_sensors_list);
 	LIST_INIT(>sme_events_list);
@@ -650,9 +652,12 @@ sysmon_envsys_sensor_detach(struct sysmo
 	/*
 	 * remove it, unhook from rnd(4), and decrement the sensors count.
 	 */
+	if (oedata->flags & ENVSYS_FHAS_ENTROPY)
+		rnd_detach_source(>rnd_src);
 	sme_event_unregister_sensor(sme, edata);
 	if (LIST_EMPTY(>sme_events_list)) {
-		sme_events_halt_callout(sme);
+		if (sme->sme_callout_state == SME_CALLOUT_READY)
+			sme_events_halt_callout(sme);
 		destroy = true;
 	}
 	TAILQ_REMOVE(>sme_sensors_list, edata, sensors_head);
@@ -970,6 +975,7 @@ sysmon_envsys_unregister(struct sysmon_e
 {
 	prop_array_t array;
 	struct sysmon_envsys *osme;
+	envsys_data_t *edata;
 
 	KASSERT(sme != NULL);
 
@@ -987,6 +993,10 @@ sysmon_envsys_unregister(struct sysmon_e
 	LIST_REMOVE(sme, sme_list);
 	mutex_exit(_global_mtx);
 
+	TAILQ_FOREACH(edata, >sme_sensors_list, sensors_head) {
+		sysmon_envsys_sensor_detach(sme, edata);
+	}
+
 	/*
 	 * Unregister all events associated with device.
 	 */
@@ -1262,15 +1272,23 @@ sme_remove_userprops(void)
 			}
 
 			/*
-			 * Finally, remove any old limits event, then
-			 * install a new event (which will update the
-			 * dictionary)
+			 * If the sensor is providing entropy data,
+			 * get rid of the rndsrc;  we'll provide a new
+			 * one shortly.
+			 */
+			if (edata->flags & ENVSYS_FHAS_ENTROPY)
+rnd_detach_source(>rnd_src);
+
+			/*
+			 * Remove the old limits event, if any
 			 */
 			sme_event_unregister(sme, edata->desc,
 			PENVSYS_EVENT_LIMITS);
 
 			/*
-			 * Find the correct units for this sensor.
+			 * Create and install a new event (which will
+			 * update the dictionary) with the correct
+			 * units.
 			 */
 			sdt_units = sme_find_table_entry(SME_DESC_UNITS,
 			edata->units);
@@ -1283,6 +1301,11 @@ sme_remove_userprops(void)
 , props, PENVSYS_EVENT_LIMITS,
 sdt_units->crittype);
 			}
+
+			/* Finally, if the sensor provides entropy,
+			 * create an additional event entry and attach
+			 * the rndsrc
+			 */
 			if (edata->flags & ENVSYS_FHAS_ENTROPY) {
 sme_event_register(sdict, edata, sme,
 , props, PENVSYS_EVENT_NULL,
@@ -1301,8 +1324,17 @@ sme_remove_userprops(void)
 		 * Restore default timeout value.
 		 */
 		sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT;
+
+		/*
+		 * Note that we need to hold the sme_mtx 

CVS commit: [netbsd-8] src/usr.sbin/syslogd

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:20:13 UTC 2017

Modified Files:
src/usr.sbin/syslogd [netbsd-8]: syslogd.c

Log Message:
Pull up following revision(s) (requested by ginsbach in ticket #280):
usr.sbin/syslogd/syslogd.c: revision 1.124
Use looked up remote host for remote message without a hostname
An incoming remote message may not necessarily have a hostname
between the timestamp and the message. The the source of the remote
sender is already looked up so use that hostname/IP address rather
than the local hostname.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.123.8.1 src/usr.sbin/syslogd/syslogd.c

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

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.123 src/usr.sbin/syslogd/syslogd.c:1.123.8.1
--- src/usr.sbin/syslogd/syslogd.c:1.123	Sat Jun 11 16:55:10 2016
+++ src/usr.sbin/syslogd/syslogd.c	Sat Sep 23 17:20:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.123.8.1 2017/09/23 17:20:13 snj Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.123.8.1 2017/09/23 17:20:13 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -1277,7 +1277,7 @@ printline_bsdsyslog(const char *hname, c
 		} else if (*p == '[' || (*p == ':'
 			&& (*(p+1) == ' ' || *(p+1) == '\0'))) {
 			/* no host in message */
-			buffer->host = LocalFQDN;
+			buffer->host = strdup(hname);
 			buffer->prog = strndup(start, p - start);
 			break;
 		} else {



CVS commit: [netbsd-8] src/share/man/man8

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:18:44 UTC 2017

Modified Files:
src/share/man/man8 [netbsd-8]: afterboot.8

Log Message:
Pull up following revision(s) (requested by maya in ticket #279):
share/man/man8/afterboot.8: 1.59-1.60
Update packages link. suggest https. bump date
Update wifi guide to reflect dhcpcd no longer invoking wpa_supplicant


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.4.1 src/share/man/man8/afterboot.8

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/man8/afterboot.8
diff -u src/share/man/man8/afterboot.8:1.57 src/share/man/man8/afterboot.8:1.57.4.1
--- src/share/man/man8/afterboot.8:1.57	Wed Mar 15 11:22:15 2017
+++ src/share/man/man8/afterboot.8	Sat Sep 23 17:18:44 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: afterboot.8,v 1.57 2017/03/15 11:22:15 wiz Exp $
+.\"	$NetBSD: afterboot.8,v 1.57.4.1 2017/09/23 17:18:44 snj Exp $
 .\"	$OpenBSD: afterboot.8,v 1.72 2002/02/22 02:02:33 miod Exp $
 .\"
 .\" Originally created by Marshall M. Midden -- 1997-10-20, m...@umn.edu
@@ -59,7 +59,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 14, 2017
+.Dd September 10, 2017
 .Dt AFTERBOOT 8
 .Os
 .Sh NAME
@@ -403,21 +403,26 @@ Then, to make the system use it, put the
 nameserver 127.0.0.1
 .Ed
 .Ss Wireless networking
-You may scan for nearby wireless networks using:
+You can scan for nearby wireless networks using:
 .Bd -literal -offset indent
 .Ic ifconfig iwm0 up list scan
 .Ic ifconfig iwm0 down
 .Ed
 .Pp
-To connect to a network using WPA, you may use:
+To connect to a wireless network using WPA and DHCP:
 .Bd -literal -offset indent
-.Ic echo ctrl_interface=/var/run/wpa_supplicant > /etc/wpa_supplicant.conf
-.Ic wpa_passphrase networkname password >> /etc/wpa_supplicant.conf
+.Ic wpa_passphrase networkname password > /etc/wpa_supplicant.conf
+.Ic wpa_supplicant -i iwm0 -c /etc/wpa_supplicant.conf &
+.Ic dhcpcd iwm0
 .Ed
 .Pp
-After creating /etc/wpa_supplicant.conf, using
-.Xr dhcpcd 8
-on the wireless interface will connect to the network.
+To automatically connect at boot, add the following flags to
+.Pa /etc/rc.conf :
+.Pp
+.Dl dhcpcd=YES
+.Dl dhcpcd_flags="-b"
+.Dl wpa_supplicant=YES
+.Dl wpa_supplicant_flags="-i iwm0 -c /etc/wpa_supplicant.conf"
 .Ss RPC-based network services
 Several services depend on the RPC portmapper
 .Xr rpcbind 8
@@ -861,11 +866,11 @@ The
 .Nx
 packages collection, pkgsrc, includes a large set of third-party software.
 A lot of it is available as binary packages that you can download from
-.Lk ftp://ftp.NetBSD.org/pub/NetBSD/packages/
+.Lk https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/
 or a mirror, and install using
 .Xr pkg_add 1 .
 See
-.Lk http://www.NetBSD.org/docs/pkgsrc/
+.Lk https://www.NetBSD.org/docs/pkgsrc/
 and
 .Pa pkgsrc/doc/pkgsrc.txt
 for more details.



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

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:13:10 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: audio.c audiovar.h

Log Message:
Pull up following revision(s) (requested by isaki in ticket #278):
sys/dev/audiovar.h: revision 1.61-1.62
sys/dev/audiovar.h: revision 1.63 via patch
sys/dev/audio.c: revision 1.381, 1.390, 1.391, 1.393
sys/dev/audio.c: revision 1.394 via patch
Use do .. while (0) for macros.
--
Introduce audio_destroy_pfilters()/audio_destroy_rfilters()
and use it.
--
Remove dead codes. chan will never be NULL in SIMPLEQ_FOREACH.
--
Move defines to the appropriate place.
--
Remove mixer chan from sc_audiochan.
Now sc_audiochan contains opened audio chan (and first special
element) only.
First I splitted sc_audiochan into sc_audiochan which has
audio chan (and first special element) and sc_mixerchan
which has mixer chan only.  However nobody else refers this
sc_mixerchan except additions to list and deletions from
list.  So mixer chan's list is not necessary.
--
Split the first special element from sc_audiochan list.
- This makes sc_audiochan a list of only open audio chan.
- "SIMPLEQ_FIRST(>sc_audiochan)->vc" is now "sc->hwvc".
No functional changes (except one debug message).


To generate a diff of this commit:
cvs rdiff -u -r1.357.2.7 -r1.357.2.8 src/sys/dev/audio.c
cvs rdiff -u -r1.55.2.2 -r1.55.2.3 src/sys/dev/audiovar.h

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.357.2.7 src/sys/dev/audio.c:1.357.2.8
--- src/sys/dev/audio.c:1.357.2.7	Mon Sep 11 05:33:23 2017
+++ src/sys/dev/audio.c	Sat Sep 23 17:13:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.357.2.7 2017/09/11 05:33:23 snj Exp $	*/
+/*	$NetBSD: audio.c,v 1.357.2.8 2017/09/23 17:13:10 snj Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.7 2017/09/11 05:33:23 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.8 2017/09/23 17:13:10 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -214,11 +214,15 @@ int	audiodebug = AUDIO_DEBUG;
 int	audio_idle_timeout = 30;
 #endif
 
-#define HW_LOCK(x)	if ((x) == SIMPLEQ_FIRST(>sc_audiochan)->vc) \
-mutex_enter(sc->sc_intr_lock);
-
-#define HW_UNLOCK(x)	if ((x) == SIMPLEQ_FIRST(>sc_audiochan)->vc) \
-mutex_exit(sc->sc_intr_lock);
+#define HW_LOCK(x)	do { \
+	if ((x) == sc->sc_hwvc) \
+		mutex_enter(sc->sc_intr_lock); \
+} while (0)
+
+#define HW_UNLOCK(x)	do { \
+	if ((x) == sc->sc_hwvc) \
+		mutex_exit(sc->sc_intr_lock); \
+} while (0)
 
 int	audio_blk_ms = AUDIO_BLK_MS;
 
@@ -280,7 +284,7 @@ void	audio_init_ringbuffer(struct audio_
 			  struct audio_ringbuffer *, int);
 int	audio_initbufs(struct audio_softc *, struct virtual_channel *);
 void	audio_calcwater(struct audio_softc *, struct virtual_channel *);
-int	audio_drain(struct audio_softc *, struct audio_chan *);
+int	audio_drain(struct audio_softc *, struct virtual_channel *);
 void	audio_clear(struct audio_softc *, struct virtual_channel *);
 void	audio_clear_intr_unlocked(struct audio_softc *sc,
   struct virtual_channel *);
@@ -294,6 +298,8 @@ static int audio_setup_pfilters(struct a
 			  stream_filter_list_t *, struct virtual_channel *);
 static int audio_setup_rfilters(struct audio_softc *, const audio_params_t *,
 			  stream_filter_list_t *, struct virtual_channel *);
+static void audio_destroy_pfilters(struct virtual_channel *);
+static void audio_destroy_rfilters(struct virtual_channel *);
 static void audio_stream_dtor(audio_stream_t *);
 static int audio_stream_ctor(audio_stream_t *, const audio_params_t *, int);
 static void stream_filter_list_append(stream_filter_list_t *,
@@ -476,7 +482,6 @@ audioattach(device_t parent, device_t se
 	struct audio_softc *sc;
 	struct audio_attach_args *sa;
 	struct virtual_channel *vc;
-	struct audio_chan *chan;
 	const struct audio_hw_if *hwp;
 	const struct sysctlnode *node;
 	void *hdlp;
@@ -522,11 +527,10 @@ audioattach(device_t parent, device_t se
 	sc->sc_trigger_started = false;
 	sc->sc_rec_started = false;
 	sc->sc_dying = false;
-	chan = kmem_zalloc(sizeof(struct audio_chan), KM_SLEEP);
-	vc = kmem_zalloc(sizeof(struct virtual_channel), KM_SLEEP);
-	chan->vc = vc;
 	SIMPLEQ_INIT(>sc_audiochan);
-	SIMPLEQ_INSERT_HEAD(>sc_audiochan, chan, entries);
+
+	vc = kmem_zalloc(sizeof(struct virtual_channel), KM_SLEEP);
+	sc->sc_hwvc = vc;
 	vc->sc_open = 0;
 	vc->sc_mode = 0;
 	vc->sc_npfilters = 0;
@@ -869,7 +873,7 @@ audiodetach(device_t self, int flags)
 {
 	struct audio_softc *sc;
 	struct audio_chan *chan;
-	int maj, mn, i, rc;
+	int maj, mn, rc;
 
 	sc = device_private(self);
 	DPRINTF(("audio_detach: sc=%p flags=%d\n", sc, flags));
@@ -930,38 +934,19 @@ audiodetach(device_t self, int flags)
 
 	/* free resources */
 	

CVS commit: [netbsd-8] src/external/bsd/nvi/dist/cl

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:04:40 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl [netbsd-8]: cl_main.c cl_screen.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #276):
external/bsd/nvi/dist/cl/cl_main.c: revision 1.6
external/bsd/nvi/dist/cl/cl_screen.c: revision 1.6
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.
The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.
Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.
This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.8.1 src/external/bsd/nvi/dist/cl/cl_main.c \
src/external/bsd/nvi/dist/cl/cl_screen.c

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

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.5 src/external/bsd/nvi/dist/cl/cl_main.c:1.5.8.1
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.5	Wed Nov 25 20:25:20 2015
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Sat Sep 23 17:04:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.5 2015/11/25 20:25:20 christos Exp $ */
+/*	$NetBSD: cl_main.c,v 1.5.8.1 2017/09/23 17:04:40 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.5 2015/11/25 20:25:20 christos Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.5.8.1 2017/09/23 17:04:40 snj Exp $");
 #endif
 
 #include 
@@ -311,6 +311,10 @@ h_winch(int signo)
 		continue;
 
 	F_SET(clp, CL_SIGWINCH);
+
+	/* If there was a previous handler, call that. */
+	if (clp->oact[INDX_WINCH].sa_handler)
+		clp->oact[INDX_WINCH].sa_handler(signo);
 }
 #undef	GLOBAL_CLP
 
Index: src/external/bsd/nvi/dist/cl/cl_screen.c
diff -u src/external/bsd/nvi/dist/cl/cl_screen.c:1.5 src/external/bsd/nvi/dist/cl/cl_screen.c:1.5.8.1
--- src/external/bsd/nvi/dist/cl/cl_screen.c:1.5	Wed Nov 25 20:25:20 2015
+++ src/external/bsd/nvi/dist/cl/cl_screen.c	Sat Sep 23 17:04:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_screen.c,v 1.5 2015/11/25 20:25:20 christos Exp $ */
+/*	$NetBSD: cl_screen.c,v 1.5.8.1 2017/09/23 17:04:40 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp  (Berkeley) Date: 2002/05/03 19:59:44 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_screen.c,v 1.5 2015/11/25 20:25:20 christos Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.5.8.1 2017/09/23 17:04:40 snj Exp $");
 #endif
 
 #include 
@@ -430,7 +430,7 @@ cl_vi_end(GS *gp)
 	 * Move to the bottom of the window (some endwin implementations don't
 	 * do this for you).
 	 */
-	if (!F_ISSET(clp, CL_IN_EX)) {
+	if (!F_ISSET(clp, CL_IN_EX) && !F_ISSET(gp, G_SRESTART)) {
 		(void)move(0, 0);
 		(void)deleteln();
 		(void)move(LINES - 1, 0);



CVS commit: [netbsd-8] src

2017-09-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 23 17:02:00 UTC 2017

Modified Files:
src/distrib/amiga/miniroot [netbsd-8]: install.md
src/distrib/miniroot [netbsd-8]: install.sub
src/distrib/notes/amiga [netbsd-8]: install
src/sys/arch/amiga/amiga [netbsd-8]: disksubr.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #275):
distrib/amiga/miniroot/install.md: revision 1.28
distrib/miniroot/install.sub: revision 1.46
distrib/notes/amiga/install: revision 1.36
sys/arch/amiga/amiga/disksubr.c: revision 1.68
Support installing from a CD9660 formatted disk partition.
--
Fix check of AmigaDOS environment vector for nonstandard disklabel values.
Don't set a default fsize for CD9660 partitions, the CD9660 filesystem
interprets it as a session offset.
--
Ask for the boot command. It's necessary for some hardware
configurations and also to enable a serial console in the installed
system.
--
Mention the installer question for the boot command.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.40.1 src/distrib/amiga/miniroot/install.md
cvs rdiff -u -r1.45 -r1.45.56.1 src/distrib/miniroot/install.sub
cvs rdiff -u -r1.35 -r1.35.40.1 src/distrib/notes/amiga/install
cvs rdiff -u -r1.67 -r1.67.6.1 src/sys/arch/amiga/amiga/disksubr.c

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

Modified files:

Index: src/distrib/amiga/miniroot/install.md
diff -u src/distrib/amiga/miniroot/install.md:1.27 src/distrib/amiga/miniroot/install.md:1.27.40.1
--- src/distrib/amiga/miniroot/install.md:1.27	Sun May 24 22:59:18 2009
+++ src/distrib/amiga/miniroot/install.md	Sat Sep 23 17:01:59 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: install.md,v 1.27 2009/05/24 22:59:18 mlelstv Exp $
+#	$NetBSD: install.md,v 1.27.40.1 2017/09/23 17:01:59 snj Exp $
 #
 #
 # Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -90,8 +90,10 @@ md_installboot() {
 		getresp "y"
 		case "$resp" in
 			y*|Y*)
+echo -n "Boot command? [netbsd -ASn2] "
+getresp "netbsd -ASn2"
 echo "Installing boot block..."
-chroot /mnt /usr/sbin/installboot /dev/r${1}a /usr/mdec/bootxx_ffs
+chroot /mnt /usr/sbin/installboot -o command="$resp" /dev/r${1}a /usr/mdec/bootxx_ffs
 cp -p /mnt/usr/mdec/boot.amiga /mnt/
 ;;
 			*)

Index: src/distrib/miniroot/install.sub
diff -u src/distrib/miniroot/install.sub:1.45 src/distrib/miniroot/install.sub:1.45.56.1
--- src/distrib/miniroot/install.sub:1.45	Wed Apr 30 13:10:48 2008
+++ src/distrib/miniroot/install.sub	Sat Sep 23 17:01:59 2017
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: install.sub,v 1.45 2008/04/30 13:10:48 martin Exp $
+#	$NetBSD: install.sub,v 1.45.56.1 2017/09/23 17:01:59 snj Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1045,11 +1045,12 @@ mount_a_disk() {
 
 The following filesystem types are supported:
 	1) ffs
+	2) cd9660
 __mount_a_disk_2
 	_md_fstype=`md_native_fstype`
 	_md_fsopts=`md_native_fsopts`
 	if [ ! -z "$_md_fstype" ]; then
-		echo "	2) $_md_fstype"
+		echo "	3) $_md_fstype"
 	else
 		_md_fstype="_undefined_"
 	fi
@@ -1058,7 +1059,7 @@ __mount_a_disk_2
 		echo -n "Which filesystem type? [ffs] "
 		getresp "ffs"
 		case "$resp" in
-			ffs)
+			ffs|cd9660)
 _fstype=$resp
 _fsopts="ro"
 ;;

Index: src/distrib/notes/amiga/install
diff -u src/distrib/notes/amiga/install:1.35 src/distrib/notes/amiga/install:1.35.40.1
--- src/distrib/notes/amiga/install:1.35	Thu Apr 23 01:56:48 2009
+++ src/distrib/notes/amiga/install	Sat Sep 23 17:01:59 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.35 2009/04/23 01:56:48 snj Exp $
+.\"	$NetBSD: install,v 1.35.40.1 2017/09/23 17:01:59 snj Exp $
 .\"
 .\" Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -290,7 +290,7 @@ kern.tgz distribution set, this is an ol
 If you did install the kern.tgz kernel, you normally should answer "n".
 .Pp
 Finally, the installer asks you if you want to install the bootblock
-code on your root disk.
+code on your root disk and, if yes, what boot command it should execute.
 This is a matter of personal choice and can also be done from a running
 .Nx
 system.

Index: src/sys/arch/amiga/amiga/disksubr.c
diff -u src/sys/arch/amiga/amiga/disksubr.c:1.67 src/sys/arch/amiga/amiga/disksubr.c:1.67.6.1
--- src/sys/arch/amiga/amiga/disksubr.c:1.67	Sun Mar 12 21:02:47 2017
+++ src/sys/arch/amiga/amiga/disksubr.c	Sat Sep 23 17:02:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.67 2017/03/12 21:02:47 mlelstv Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.67.6.1 2017/09/23 17:02:00 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.67 2017/03/12 21:02:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.67.6.1 2017/09/23 17:02:00 snj Exp $");
 
 #include 
 

CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-09-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Sep 23 14:53:26 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: ata.c

Log Message:
note to previous: the KASSERT() insisted actually there is at most one
active xfer, which is false during NCQ error recovery


To generate a diff of this commit:
cvs rdiff -u -r1.132.8.35 -r1.132.8.36 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.35 src/sys/dev/ata/ata.c:1.132.8.36
--- src/sys/dev/ata/ata.c:1.132.8.35	Sat Sep 23 13:13:19 2017
+++ src/sys/dev/ata/ata.c	Sat Sep 23 14:53:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.35 2017/09/23 13:13:19 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.36 2017/09/23 14:53:26 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.35 2017/09/23 13:13:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.36 2017/09/23 14:53:26 jdolecek Exp $");
 
 #include "opt_ata.h"
 



CVS commit: src/sys/dev/usb

2017-09-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 23 14:27:44 UTC 2017

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

Log Message:
PR/52553 Panic on "ifconfig athn0 up"

Don't race for a transfer in athn_usb_init on the free list for beacons.
Instead pre-assign a transfer to beacons in athn_usb_alloc_tx_list


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/if_athn_usb.c

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

Modified files:

Index: src/sys/dev/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.22 src/sys/dev/usb/if_athn_usb.c:1.23
--- src/sys/dev/usb/if_athn_usb.c:1.22	Thu Jun  1 02:45:11 2017
+++ src/sys/dev/usb/if_athn_usb.c	Sat Sep 23 14:27:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.22 2017/06/01 02:45:11 chs Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.23 2017/09/23 14:27:44 skrll Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.22 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.23 2017/09/23 14:27:44 skrll Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -728,9 +728,15 @@ athn_usb_alloc_tx_list(struct athn_usb_s
 		/* Append this Tx buffer to our free list. */
 		TAILQ_INSERT_TAIL(>usc_tx_free_list, data, next);
 	}
-	if (error != 0)
+	if (error == 0) {
+		/* Steal one buffer for beacons. */
+		usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list);
+		TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next);
+	} else {
 		athn_usb_free_tx_list(usc);
+	}
 	mutex_exit(>usc_tx_mtx);
+
 	return error;
 }
 
@@ -749,6 +755,10 @@ athn_usb_free_tx_list(struct athn_usb_so
 		if (xfer != NULL)
 			usbd_destroy_xfer(xfer);
 	}
+	if (usc->usc_tx_bcn) {
+		usbd_destroy_xfer(usc->usc_tx_bcn->xfer);
+		usc->usc_tx_bcn = NULL;
+	}
 }
 
 Static int
@@ -2756,12 +2766,6 @@ athn_usb_init_locked(struct ifnet *ifp)
 	usc->usc_cmdq.cur = usc->usc_cmdq.next = usc->usc_cmdq.queued = 0;
 	mutex_spin_exit(>usc_task_mtx);
 
-	/* Steal one buffer for beacons. */
-	mutex_enter(>usc_tx_mtx);
-	usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list);
-	TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next);
-	mutex_exit(>usc_tx_mtx);
-
 	curchan = ic->ic_curchan;
 	extchan = NULL;
 



CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-09-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Sep 23 13:13:19 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: ata.c

Log Message:
remove ata_queue_get_active_xfer() KASSERT() about having at least one
active xfer; it can happen we get interrupt while no longer having the cmd
active e.g. during recovery, and all callers handle getting NULL as result

fixes panic in mvsata(4) during error recovery


To generate a diff of this commit:
cvs rdiff -u -r1.132.8.34 -r1.132.8.35 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.34 src/sys/dev/ata/ata.c:1.132.8.35
--- src/sys/dev/ata/ata.c:1.132.8.34	Wed Sep 20 19:39:36 2017
+++ src/sys/dev/ata/ata.c	Sat Sep 23 13:13:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.34 2017/09/20 19:39:36 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.35 2017/09/23 13:13:19 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.34 2017/09/20 19:39:36 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.35 2017/09/23 13:13:19 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -244,10 +244,7 @@ ata_queue_get_active_xfer(struct ata_cha
 	struct ata_xfer *xfer = NULL;
 
 	ata_channel_lock(chp);
-
-	KASSERT(chp->ch_queue->queue_active <= 1);
 	xfer = ata_queue_get_active_xfer_locked(chp);
-
 	ata_channel_unlock(chp);
 
 	return xfer;



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

2017-09-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Sep 23 11:01:32 UTC 2017

Modified Files:
src/sys/arch/x86/x86: x86_machdep.c

Log Message:
Make MTRR_GET privileged, the structures are not always zeroed (thereby
leaking information), and beyond that we are not particularly interested
in letting userland know how the kernel uses its MTRRs.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/x86/x86_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.93 src/sys/arch/x86/x86/x86_machdep.c:1.94
--- src/sys/arch/x86/x86/x86_machdep.c:1.93	Wed Jun 14 12:27:24 2017
+++ src/sys/arch/x86/x86/x86_machdep.c	Sat Sep 23 11:01:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.93 2017/06/14 12:27:24 maxv Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.94 2017/09/23 11:01:32 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.93 2017/06/14 12:27:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.94 2017/09/23 11:01:32 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -1039,9 +1039,7 @@ x86_listener_cb(kauth_cred_t cred, kauth
 	case KAUTH_MACHDEP_IOPERM_GET:
 	case KAUTH_MACHDEP_LDT_GET:
 	case KAUTH_MACHDEP_LDT_SET:
-	case KAUTH_MACHDEP_MTRR_GET:
 		result = KAUTH_RESULT_ALLOW;
-
 		break;
 
 	default:



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

2017-09-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Sep 23 10:38:59 UTC 2017

Modified Files:
src/sys/arch/x86/acpi: acpi_wakeup.c

Log Message:
Initialize the errata MSRs when waking up, otherwise they are clear and
we're re-enabling certain CPU bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/acpi/acpi_wakeup.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/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.48 src/sys/arch/x86/acpi/acpi_wakeup.c:1.49
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.48	Sat Sep 23 10:00:00 2017
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Sat Sep 23 10:38:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.48 2017/09/23 10:00:00 maxv Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.49 2017/09/23 10:38:59 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.48 2017/09/23 10:00:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.49 2017/09/23 10:38:59 maxv Exp $");
 
 #include 
 #include 
@@ -274,6 +274,7 @@ acpi_cpu_sleep(struct cpu_info *ci)
 	if (rcr4() & CR4_OSXSAVE)
 		wrxcr(0, xcr0);
 	pat_init(ci);
+	x86_errata();
 #if NLAPIC > 0
 	lapic_enable();
 	lapic_set_lvt();
@@ -346,6 +347,7 @@ acpi_md_sleep(int state)
 	if (rcr4() & CR4_OSXSAVE)
 		wrxcr(0, xcr0);
 	pat_init(_info_primary);
+	x86_errata();
 	i8259_reinit();
 #if NLAPIC > 0
 	lapic_enable();



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

2017-09-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Sep 23 10:18:49 UTC 2017

Modified Files:
src/sys/arch/amd64/acpi: acpi_wakeup_low.S

Log Message:
Make sure %edx is clear.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/acpi/acpi_wakeup_low.S

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

Modified files:

Index: src/sys/arch/amd64/acpi/acpi_wakeup_low.S
diff -u src/sys/arch/amd64/acpi/acpi_wakeup_low.S:1.5 src/sys/arch/amd64/acpi/acpi_wakeup_low.S:1.6
--- src/sys/arch/amd64/acpi/acpi_wakeup_low.S:1.5	Sun Jul 24 13:04:58 2016
+++ src/sys/arch/amd64/acpi/acpi_wakeup_low.S	Sat Sep 23 10:18:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup_low.S,v 1.5 2016/07/24 13:04:58 maxv Exp $	*/
+/*	$NetBSD: acpi_wakeup_low.S,v 1.6 2017/09/23 10:18:49 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger 
@@ -52,6 +52,7 @@ acpi_md_sleep_exit:
 
 	movl	$MSR_EFER,%ecx
 	movl	ACPI_SUSPEND_EFER(%r8),%eax
+	movl	$0,%edx
 	wrmsr
 
 	movl	$MSR_FSBASE,%ecx



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

2017-09-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Sep 23 10:00:00 UTC 2017

Modified Files:
src/sys/arch/x86/acpi: acpi_wakeup.c

Log Message:
Reinitialize the PAT MSR when waking up, otherwise the write-combined
pages become write-through.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/acpi/acpi_wakeup.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/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.47 src/sys/arch/x86/acpi/acpi_wakeup.c:1.48
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.47	Tue Sep 19 01:22:14 2017
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Sat Sep 23 10:00:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.47 2017/09/19 01:22:14 maya Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.48 2017/09/23 10:00:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.47 2017/09/19 01:22:14 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.48 2017/09/23 10:00:00 maxv Exp $");
 
 #include 
 #include 
@@ -141,7 +141,6 @@ acpi_md_sleep_patch(struct cpu_info *ci)
 
 	tmp_pdir = pmap_init_tmp_pgtbl(acpi_wakeup_paddr);
 
-	/* Execute Sleep */
 	memcpy((void *)acpi_wakeup_vaddr, wakecode, sizeof(wakecode));
 
 	if (CPU_IS_PRIMARY(ci)) {
@@ -260,15 +259,21 @@ acpi_cpu_sleep(struct cpu_info *ci)
 	if (rcr4() & CR4_OSXSAVE)
 		xcr0 = rdxcr(0);
 
+	/* Go get some sleep */
 	if (acpi_md_sleep_prepare(-1))
 		goto out;
 
-	/* Execute Wakeup */
+	/*
+	 * Sleeping and having bad nightmares about what could go wrong
+	 * when waking up.
+	 */
+
+	/* We just woke up (cpuN), execution is resumed here */
 	cpu_init_msrs(ci, false);
 	fpuinit(ci);
 	if (rcr4() & CR4_OSXSAVE)
 		wrxcr(0, xcr0);
-
+	pat_init(ci);
 #if NLAPIC > 0
 	lapic_enable();
 	lapic_set_lvt();
@@ -326,14 +331,21 @@ acpi_md_sleep(int state)
 	if (rcr4() & CR4_OSXSAVE)
 		xcr0 = rdxcr(0);
 
+	/* Go get some sleep */
 	if (acpi_md_sleep_prepare(state))
 		goto out;
 
-	/* Execute Wakeup */
+	/*
+	 * Sleeping and having bad nightmares about what could go wrong
+	 * when waking up.
+	 */
+
+	/* We just woke up (cpu0), execution is resumed here */
 	cpu_init_msrs(_info_primary, false);
 	fpuinit(_info_primary);
 	if (rcr4() & CR4_OSXSAVE)
 		wrxcr(0, xcr0);
+	pat_init(_info_primary);
 	i8259_reinit();
 #if NLAPIC > 0
 	lapic_enable();
@@ -373,6 +385,7 @@ acpi_md_sleep(int state)
 out:
 
 #ifdef MULTIPROCESSOR
+	/* Wake up the secondary CPUs */
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		if (CPU_IS_PRIMARY(ci))
 			continue;