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

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:59:22 UTC 2018

Modified Files:
src/sys/arch/arm/imx: imx6_board.c

Log Message:
Rename a9tmr to arma9tmr.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_board.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/imx/imx6_board.c
diff -u src/sys/arch/arm/imx/imx6_board.c:1.9 src/sys/arch/arm/imx/imx6_board.c:1.10
--- src/sys/arch/arm/imx/imx6_board.c:1.9	Thu Nov  9 05:57:23 2017
+++ src/sys/arch/arm/imx/imx6_board.c	Wed Jun 20 05:59:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_board.c,v 1.9 2017/11/09 05:57:23 hkenken Exp $	*/
+/*	$NetBSD: imx6_board.c,v 1.10 2018/06/20 05:59:22 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.9 2017/11/09 05:57:23 hkenken Exp $");
+__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.10 2018/06/20 05:59:22 hkenken Exp $");
 
 #include "opt_imx.h"
 #include "arml2cc.h"
@@ -219,7 +219,8 @@ imx6_device_register(device_t self, void
 	 * We need to tell the A9 Global/Watchdog Timer
 	 * what frequency it runs at.
 	 */
-	if (device_is_a(self, "a9tmr") || device_is_a(self, "a9wdt")) {
+	if (device_is_a(self, "arma9tmr") ||
+	device_is_a(self, "a9wdt")) {
 		prop_dictionary_set_uint32(dict, "frequency",
 		   imx6_armrootclk() / IMX6_PERIPHCLK_N);
 		return;



CVS commit: src/sys/dev/fdt

2018-06-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jun 20 05:59:18 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
In fdtbus_print(), aprint_normal the path to the device (rather than
aprint_debug).  This info is every bit as useful as, say, PCI device
locations.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/fdtbus.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/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.17 src/sys/dev/fdt/fdtbus.c:1.18
--- src/sys/dev/fdt/fdtbus.c:1.17	Tue Jun 12 00:19:17 2018
+++ src/sys/dev/fdt/fdtbus.c	Wed Jun 20 05:59:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.17 2018/06/12 00:19:17 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.18 2018/06/20 05:59:17 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.17 2018/06/12 00:19:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.18 2018/06/20 05:59:17 thorpej Exp $");
 
 #include 
 #include 
@@ -336,7 +336,7 @@ fdtbus_print(void *aux, const char *pnp)
 			compat += (strlen(compat) + 1);
 		}
 	} else
-		aprint_debug(" (%s)", name);
+		aprint_normal(" (%s)", name);
 
 	return UNCONF;
 }



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

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:53:19 UTC 2018

Modified Files:
src/sys/arch/arm/imx: imx6_ahcisata.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx6_ahcisata.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/imx/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.7 src/sys/arch/arm/imx/imx6_ahcisata.c:1.8
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.7	Wed May 23 10:42:05 2018
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Wed Jun 20 05:53:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.7 2018/05/23 10:42:05 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.8 2018/06/20 05:53:19 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.7 2018/05/23 10:42:05 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.8 2018/06/20 05:53:19 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -59,7 +59,7 @@ static int imx6_ahcisata_match(device_t,
 static void imx6_ahcisata_attach(device_t, device_t, void *);
 static int imx6_ahcisata_detach(device_t, int);
 
-static int ixm6_ahcisata_init(struct imx_ahci_softc *);
+static int imx6_ahcisata_init(struct imx_ahci_softc *);
 static int imx6_ahcisata_phy_ctrl(struct imx_ahci_softc *, uint32_t, int);
 static int imx6_ahcisata_phy_addr(struct imx_ahci_softc *, uint32_t);
 static int imx6_ahcisata_phy_write(struct imx_ahci_softc *, uint32_t, uint16_t);
@@ -114,7 +114,7 @@ imx6_ahcisata_attach(device_t parent, de
 		return;
 	}
 
-	if (ixm6_ahcisata_init(sc) != 0) {
+	if (imx6_ahcisata_init(sc) != 0) {
 		aprint_error_dev(self, "couldn't init ahci\n");
 		return;
 	}
@@ -257,7 +257,7 @@ imx6_ahcisata_phy_read(struct imx_ahci_s
 }
 
 static int
-ixm6_ahcisata_init(struct imx_ahci_softc *sc)
+imx6_ahcisata_init(struct imx_ahci_softc *sc)
 {
 	uint32_t v;
 	int timeout, pllstat;



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

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:50:09 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Support Cortex-A9 (addr_d > addr_c).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/fdt/gic_fdt.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/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.9 src/sys/arch/arm/fdt/gic_fdt.c:1.10
--- src/sys/arch/arm/fdt/gic_fdt.c:1.9	Wed Jun  6 19:49:51 2018
+++ src/sys/arch/arm/fdt/gic_fdt.c	Wed Jun 20 05:50:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.9 2018/06/06 19:49:51 jakllsch Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.10 2018/06/20 05:50:09 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.9 2018/06/06 19:49:51 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.10 2018/06/20 05:50:09 hkenken Exp $");
 
 #include 
 #include 
@@ -140,8 +140,9 @@ gic_fdt_attach(device_t parent, device_t
 		return;
 	}
 
-	const bus_addr_t addr = addr_d;
-	const bus_size_t size = (addr_c + size_c) - addr_d;
+	const bus_addr_t addr = min(addr_d, addr_c);
+	const bus_size_t end = max(addr_d + size_d, addr_c + size_c);
+	const bus_size_t size = end - addr;
 
 	error = bus_space_map(faa->faa_bst, addr, size, 0, );
 	if (error) {
@@ -153,8 +154,8 @@ gic_fdt_attach(device_t parent, device_t
 		.mpcaa_name = "armgic",
 		.mpcaa_memt = faa->faa_bst,
 		.mpcaa_memh = bsh,
-		.mpcaa_off1 = 0,
-		.mpcaa_off2 = addr_c - addr_d
+		.mpcaa_off1 = addr_d - addr,
+		.mpcaa_off2 = addr_c - addr,
 	};
 
 	config_found(self, , NULL);



CVS commit: src/sys/dev/pci

2018-06-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jun 20 05:19:12 UTC 2018

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

Log Message:
 Style fix. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.581 -r1.582 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.581 src/sys/dev/pci/if_wm.c:1.582
--- src/sys/dev/pci/if_wm.c:1.581	Fri Jun  1 08:56:00 2018
+++ src/sys/dev/pci/if_wm.c	Wed Jun 20 05:19:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.581 2018/06/01 08:56:00 maxv Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.582 2018/06/20 05:19:12 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.581 2018/06/01 08:56:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.582 2018/06/20 05:19:12 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -193,7 +193,7 @@ static int wm_watchdog_timeout = WM_WATC
 /*
  * Transmit descriptor list size.  Due to errata, we can only have
  * 256 hardware descriptors in the ring on < 82544, but we use 4096
- * on >= 82544.  We tell the upper layers that they can queue a lot
+ * on >= 82544. We tell the upper layers that they can queue a lot
  * of packets, and we go ahead and manage up to 64 (16 for the i82547)
  * of them at a time.
  *
@@ -247,13 +247,13 @@ static int wm_watchdog_timeout = WM_WATC
 
 typedef union txdescs {
 	wiseman_txdesc_t sctxu_txdescs[WM_NTXDESC_82544];
-	nq_txdesc_t  sctxu_nq_txdescs[WM_NTXDESC_82544];
+	nq_txdesc_t	 sctxu_nq_txdescs[WM_NTXDESC_82544];
 } txdescs_t;
 
 typedef union rxdescs {
 	wiseman_rxdesc_t sctxu_rxdescs[WM_NRXDESC];
-	ext_rxdesc_t  sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
-	nq_rxdesc_t  sctxu_nq_rxdescs[WM_NRXDESC]; /* 82575 and newer */
+	ext_rxdesc_t	  sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
+	nq_rxdesc_t	 sctxu_nq_rxdescs[WM_NRXDESC]; /* 82575 and newer */
 } rxdescs_t;
 
 #define	WM_CDTXOFF(txq, x)	((txq)->txq_descsize * (x))
@@ -271,9 +271,9 @@ struct wm_txsoft {
 };
 
 /*
- * Software state for receive buffers.  Each descriptor gets a
- * 2k (MCLBYTES) buffer and a DMA map.  For packets which fill
- * more than one buffer, we chain them together.
+ * Software state for receive buffers. Each descriptor gets a 2k (MCLBYTES)
+ * buffer and a DMA map. For packets which fill more than one buffer, we chain
+ * them together.
  */
 struct wm_rxsoft {
 	struct mbuf *rxs_mbuf;		/* head of our mbuf chain */
@@ -333,7 +333,7 @@ struct wm_txqueue {
 	int txq_ndesc;			/* must be a power of two */
 	size_t txq_descsize;		/* a tx descriptor size */
 	txdescs_t *txq_descs_u;
-bus_dmamap_t txq_desc_dmamap;	/* control data DMA map */
+	bus_dmamap_t txq_desc_dmamap;	/* control data DMA map */
 	bus_dma_segment_t txq_desc_seg;	/* control data segment */
 	int txq_desc_rseg;		/* real number of control segment */
 #define	txq_desc_dma	txq_desc_dmamap->dm_segs[0].ds_addr
@@ -547,7 +547,7 @@ struct wm_softc {
 	/* Event counters. */
 	struct evcnt sc_ev_linkintr;	/* Link interrupts */
 
-/* WM_T_82542_2_1 only */
+	/* WM_T_82542_2_1 only */
 	struct evcnt sc_ev_tx_xoff;	/* Tx PAUSE(!0) frames */
 	struct evcnt sc_ev_tx_xon;	/* Tx PAUSE(0) frames */
 	struct evcnt sc_ev_rx_xoff;	/* Rx PAUSE(!0) frames */
@@ -669,7 +669,7 @@ static inline uint32_t wm_io_read(struct
 #endif
 static inline void wm_io_write(struct wm_softc *, int, uint32_t);
 static inline void wm_82575_write_8bit_ctlr_reg(struct wm_softc *, uint32_t,
-	uint32_t, uint32_t);
+uint32_t, uint32_t);
 static inline void wm_set_dma_addr(volatile wiseman_addr_t *, bus_addr_t);
 
 /*
@@ -878,7 +878,7 @@ static int	wm_nvm_valid_bank_detect_ich8
 static int32_t	wm_ich8_cycle_init(struct wm_softc *);
 static int32_t	wm_ich8_flash_cycle(struct wm_softc *, uint32_t);
 static int32_t	wm_read_ich8_data(struct wm_softc *, uint32_t, uint32_t,
-	uint32_t *);
+uint32_t *);
 static int32_t	wm_read_ich8_byte(struct wm_softc *, uint32_t, uint8_t *);
 static int32_t	wm_read_ich8_word(struct wm_softc *, uint32_t, uint16_t *);
 static int32_t	wm_read_ich8_dword(struct wm_softc *, uint32_t, uint32_t *);
@@ -1646,13 +1646,13 @@ wm_init_rxdesc(struct wm_rxqueue *rxq, i
 	if (sc->sc_type == WM_T_82574) {
 		ext_rxdesc_t *rxd = >rxq_ext_descs[start];
 		rxd->erx_data.erxd_addr =
-			htole64(rxs->rxs_dmamap->dm_segs[0].ds_addr + sc->sc_align_tweak);
+		htole64(rxs->rxs_dmamap->dm_segs[0].ds_addr + sc->sc_align_tweak);
 		rxd->erx_data.erxd_dd = 0;
 	} else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
 		nq_rxdesc_t *rxd = >rxq_nq_descs[start];
 
 		rxd->nqrx_data.nrxd_paddr =
-			htole64(rxs->rxs_dmamap->dm_segs[0].ds_addr + sc->sc_align_tweak);
+		htole64(rxs->rxs_dmamap->dm_segs[0].ds_addr + sc->sc_align_tweak);
 		/* Currently, 

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

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:01:40 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: a9tmr.c a9tmr_var.h

Log Message:
Use mpcaa_off1 parameter for mapping subregion.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/cortex/a9tmr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/cortex/a9tmr_var.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/arm/cortex/a9tmr.c
diff -u src/sys/arch/arm/cortex/a9tmr.c:1.15 src/sys/arch/arm/cortex/a9tmr.c:1.16
--- src/sys/arch/arm/cortex/a9tmr.c:1.15	Tue Jun  5 08:03:28 2018
+++ src/sys/arch/arm/cortex/a9tmr.c	Wed Jun 20 05:01:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9tmr.c,v 1.15 2018/06/05 08:03:28 hkenken Exp $	*/
+/*	$NetBSD: a9tmr.c,v 1.16 2018/06/20 05:01:39 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.15 2018/06/05 08:03:28 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.16 2018/06/20 05:01:39 hkenken Exp $");
 
 #include 
 #include 
@@ -147,12 +147,8 @@ a9tmr_attach(device_t parent, device_t s
 	evcnt_attach_dynamic(>sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "missing interrupts");
 
-	bus_space_subregion(sc->sc_memt, sc->sc_memh, 
-	TMR_GLOBAL_BASE, TMR_GLOBAL_SIZE, >sc_global_memh);
-	bus_space_subregion(sc->sc_memt, sc->sc_memh, 
-	TMR_PRIVATE_BASE, TMR_PRIVATE_SIZE, >sc_private_memh);
-	bus_space_subregion(sc->sc_memt, sc->sc_memh, 
-	TMR_WDOG_BASE, TMR_WDOG_SIZE, >sc_wdog_memh);
+	bus_space_subregion(sc->sc_memt, sc->sc_memh,
+	mpcaa->mpcaa_off1, TMR_GLOBAL_SIZE, >sc_global_memh);
 
 	if (mpcaa->mpcaa_irq != -1) {
 		sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK,

Index: src/sys/arch/arm/cortex/a9tmr_var.h
diff -u src/sys/arch/arm/cortex/a9tmr_var.h:1.5 src/sys/arch/arm/cortex/a9tmr_var.h:1.6
--- src/sys/arch/arm/cortex/a9tmr_var.h:1.5	Tue Jun  5 08:03:28 2018
+++ src/sys/arch/arm/cortex/a9tmr_var.h	Wed Jun 20 05:01:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr_var.h,v 1.5 2018/06/05 08:03:28 hkenken Exp $ */
+/* $NetBSD: a9tmr_var.h,v 1.6 2018/06/20 05:01:39 hkenken Exp $ */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,8 +36,6 @@ struct a9tmr_softc {
 	bus_space_tag_t sc_memt;
 	bus_space_handle_t sc_memh;
 	bus_space_handle_t sc_global_memh;
-	bus_space_handle_t sc_private_memh;
-	bus_space_handle_t sc_wdog_memh;
 	struct evcnt sc_ev_missing_ticks;
 	uint32_t sc_freq;
 	u_long sc_autoinc;



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

2018-06-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jun 20 04:04:50 UTC 2018

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

Log Message:
 Whitespace fix. No functional change.


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

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.84 src/usr.sbin/cpuctl/arch/i386.c:1.85
--- src/usr.sbin/cpuctl/arch/i386.c:1.84	Fri Mar 30 09:24:40 2018
+++ src/usr.sbin/cpuctl/arch/i386.c	Wed Jun 20 04:04:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.84 2018/03/30 09:24:40 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.85 2018/06/20 04:04:50 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.84 2018/03/30 09:24:40 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.85 2018/06/20 04:04:50 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -92,7 +92,7 @@ __RCSID("$NetBSD: i386.c,v 1.84 2018/03/
 
 struct cpu_info {
 	const char	*ci_dev;
-	int32_t		ci_cpu_type; /* for cpu's without cpuid */
+	int32_t		ci_cpu_type;	 /* for cpu's without cpuid */
 	int32_t		ci_cpuid_level;	 /* highest cpuid supported */
 	uint32_t	ci_cpuid_extlevel; /* highest cpuid extended func lv */
 	uint32_t	ci_signature;	 /* X86 cpuid type */
@@ -161,9 +161,9 @@ static const struct x86_cache_info intel
 static const char * const i386_intel_brand[] = {
 	"",		/* Unsupported */
 	"Celeron",	/* Intel (R) Celeron (TM) processor */
-	"Pentium III",  /* Intel (R) Pentium (R) III processor */
+	"Pentium III",	/* Intel (R) Pentium (R) III processor */
 	"Pentium III Xeon", /* Intel (R) Pentium (R) III Xeon (TM) processor */
-	"Pentium III",  /* Intel (R) Pentium (R) III processor */
+	"Pentium III",	/* Intel (R) Pentium (R) III processor */
 	"",		/* 0x05: Reserved */
 	"Mobile Pentium III",/* Mobile Intel (R) Pentium (R) III processor-M */
 	"Mobile Celeron",   /* Mobile Intel (R) Celeron (R) processor */
@@ -177,11 +177,11 @@ static const char * const i386_intel_bra
 	"Mobile Celeron",   /* Mobile Intel (R) Celeron (R) processor */
 	"",		/* 0x10: Reserved */
 	"Mobile Genuine",   /* Moblie Genuine Intel (R) processor */
-	"Celeron M",/* Intel (R) Celeron (R) M processor */
+	"Celeron M",	/* Intel (R) Celeron (R) M processor */
 	"Mobile Celeron",   /* Mobile Intel (R) Celeron (R) processor */
-	"Celeron",  /* Intel (R) Celeron (R) processor */
+	"Celeron",	/* Intel (R) Celeron (R) processor */
 	"Mobile Genuine",   /* Moblie Genuine Intel (R) processor */
-	"Pentium M",/* Intel (R) Pentium (R) M processor */
+	"Pentium M",	/* Intel (R) Pentium (R) M processor */
 	"Mobile Celeron",   /* Mobile Intel (R) Celeron (R) processor */
 };
 
@@ -215,8 +215,8 @@ static void	powernow_probe(struct cpu_in
 static void	intel_family_new_probe(struct cpu_info *);
 static void	via_cpu_probe(struct cpu_info *);
 /* (Cache) Info functions */
-static void 	intel_cpu_cacheinfo(struct cpu_info *);
-static void 	amd_cpu_cacheinfo(struct cpu_info *);
+static void	intel_cpu_cacheinfo(struct cpu_info *);
+static void	amd_cpu_cacheinfo(struct cpu_info *);
 static void	via_cpu_cacheinfo(struct cpu_info *);
 static void	tmx86_get_longrun_status(u_int *, u_int *, u_int *);
 static void	transmeta_cpu_info(struct cpu_info *);
@@ -251,7 +251,7 @@ const struct cpu_nocpuid_nameclass i386_
 	  NULL, NULL, NULL },			/* CPU_486DLC */
 	{ CPUVENDOR_CYRIX, "Cyrix", "6x86",	CPUCLASS_486,
 	  NULL, NULL, NULL },		/* CPU_6x86 */
-	{ CPUVENDOR_NEXGEN,"NexGen","586",  CPUCLASS_386,
+	{ CPUVENDOR_NEXGEN,"NexGen","586",	CPUCLASS_386,
 	  NULL, NULL, NULL },			/* CPU_NX586 */
 };
 
@@ -1684,7 +1684,7 @@ cpu_probe_base_features(struct cpu_info 
 
 	/* Additional flags (eg xsaveopt support) */
 	x86_cpuid2(0xd, 1, descs);
-	ci->ci_feat_val[8] = descs[0];   /* Actually 64 bits */
+	ci->ci_feat_val[8] = descs[0];	 /* Actually 64 bits */
 }
 
 static void
@@ -1928,7 +1928,7 @@ identifycpu(int fd, const char *cpuname)
 			cpufam = >cpu_family[family - CPU_MINFAMILY];
 			name = cpufam->cpu_models[ci->ci_model];
 			if (name == NULL || *name == '\0')
-			name = cpufam->cpu_model_default;
+name = cpufam->cpu_model_default;
 			class = cpufam->cpu_class;
 			ci->ci_info = cpufam->cpu_info;
 
@@ -1944,7 +1944,7 @@ identifycpu(int fd, const char *cpuname)
 __arraycount(i386_intel_brand) &&
 i386_intel_brand[ci->ci_brand_id])
 	name =
-	 i386_intel_brand[ci->ci_brand_id];
+	i386_intel_brand[ci->ci_brand_id];
 			}
 
 			if (cpu_vendor == CPUVENDOR_AMD) {
@@ -2049,7 +2049,7 @@ identifycpu(int fd, const char *cpuname)
 
 	if (ci->ci_max_xsave != 0) {
 		aprint_normal("%s: xsave area size: current %d, 

CVS commit: src

2018-06-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Jun 20 03:51:27 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libm: Makefile
Added Files:
src/tests/lib/libm: t_cabsl.cxx

Log Message:
Add test case for PR lib/50646.

Make sure that cabsl (aka __c99_cabsl) is usable from C++.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.787 -r1.788 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.43 -r1.44 src/tests/lib/libm/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_cabsl.cxx

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.251 src/distrib/sets/lists/debug/mi:1.252
--- src/distrib/sets/lists/debug/mi:1.251	Thu Jun 14 08:22:52 2018
+++ src/distrib/sets/lists/debug/mi	Wed Jun 20 03:51:27 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.251 2018/06/14 08:22:52 yamaguchi Exp $
+# $NetBSD: mi,v 1.252 2018/06/20 03:51:27 maya Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2174,6 +2174,7 @@
 ./usr/libdata/debug/usr/tests/lib/libm/t_acos.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_asin.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_atan.debug			tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libm/t_cabsl.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_casinh.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_cbrt.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug			tests-lib-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.787 src/distrib/sets/lists/tests/mi:1.788
--- src/distrib/sets/lists/tests/mi:1.787	Fri Jun 15 09:54:02 2018
+++ src/distrib/sets/lists/tests/mi	Wed Jun 20 03:51:27 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.787 2018/06/15 09:54:02 yamaguchi Exp $
+# $NetBSD: mi,v 1.788 2018/06/20 03:51:27 maya Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2994,6 +2994,7 @@
 ./usr/tests/lib/libm/t_acos			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_asin			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_atan			tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libm/t_cabsl			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_casinh			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_cbrt			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_ceil			tests-lib-tests		compattestfile,atf

Index: src/tests/lib/libm/Makefile
diff -u src/tests/lib/libm/Makefile:1.43 src/tests/lib/libm/Makefile:1.44
--- src/tests/lib/libm/Makefile:1.43	Mon Jun  4 09:13:47 2018
+++ src/tests/lib/libm/Makefile	Wed Jun 20 03:51:27 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.43 2018/06/04 09:13:47 maya Exp $
+# $NetBSD: Makefile,v 1.44 2018/06/20 03:51:27 maya Exp $
 
 .include 
 
@@ -42,6 +42,7 @@ TESTS_C+=	t_sinh
 TESTS_C+=	t_sqrt
 TESTS_C+=	t_tan
 TESTS_C+=	t_tanh
+TESTS_CXX+=	t_cabsl
 
 LDADD+=		-lm
 #COPTS+=	-Wfloat-equal

Added files:

Index: src/tests/lib/libm/t_cabsl.cxx
diff -u /dev/null src/tests/lib/libm/t_cabsl.cxx:1.1
--- /dev/null	Wed Jun 20 03:51:27 2018
+++ src/tests/lib/libm/t_cabsl.cxx	Wed Jun 20 03:51:27 2018
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Maya Rashish
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * 

CVS commit: src/share/mk

2018-06-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Jun 20 02:15:13 UTC 2018

Modified Files:
src/share/mk: sys.mk

Log Message:
Strip -Wsystem-headers from CXXFLAGS.

GCC's C++ headers are not clean (yet). They are trying, but haven't got there
yet.

Necessary for including  which uses .


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/share/mk/sys.mk

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

Modified files:

Index: src/share/mk/sys.mk
diff -u src/share/mk/sys.mk:1.131 src/share/mk/sys.mk:1.132
--- src/share/mk/sys.mk:1.131	Sun May 20 14:39:53 2018
+++ src/share/mk/sys.mk	Wed Jun 20 02:15:13 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: sys.mk,v 1.131 2018/05/20 14:39:53 christos Exp $
+#	$NetBSD: sys.mk,v 1.132 2018/06/20 02:15:13 maya Exp $
 #	@(#)sys.mk	8.2 (Berkeley) 3/21/94
 #
 # This file contains the basic rules for make(1) and is read first
@@ -50,7 +50,7 @@ CTFFLAGS	?=	-g -L VERSION
 CTFMFLAGS	?=	-t -g -L VERSION
 
 CXX?=		c++
-CXXFLAGS?=	${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu[0-9][0-9]:N-Wold-style-definition:N-Wno-format-zero-length}
+CXXFLAGS?=	${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu[0-9][0-9]:N-Wold-style-definition:N-Wno-format-zero-length:N-Wsystem-headers}
 
 __ALLSRC1=	${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
 __ALLSRC2=	${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}



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

2018-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 19 23:43:11 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Disable threshhold mode for TX/RX DMA and ignore tx_delay/rx_delay props
for now. Fixes GMAC on RK3328.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip/rk_gmac.c
diff -u src/sys/arch/arm/rockchip/rk_gmac.c:1.2 src/sys/arch/arm/rockchip/rk_gmac.c:1.3
--- src/sys/arch/arm/rockchip/rk_gmac.c:1.2	Sun Jun 17 00:33:05 2018
+++ src/sys/arch/arm/rockchip/rk_gmac.c	Tue Jun 19 23:43:11 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gmac.c,v 1.2 2018/06/17 00:33:05 jmcneill Exp $ */
+/* $NetBSD: rk_gmac.c,v 1.3 2018/06/19 23:43:11 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.2 2018/06/17 00:33:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.3 2018/06/19 23:43:11 jmcneill Exp $");
 
 #include 
 #include 
@@ -117,20 +117,25 @@ static void
 rk3328_gmac_set_mode_rgmii(struct dwc_gmac_softc *sc, u_int tx_delay, u_int rx_delay)
 {
 	struct rk_gmac_softc * const rk_sc = (struct rk_gmac_softc *)sc;
+	uint32_t write_mask, write_val;
 
-	const uint32_t write_mask =
-	(RK3328_GRF_MAC_CON1_MODE | RK3328_GRF_MAC_CON1_SEL |
-	 RK3328_GRF_MAC_CON1_RXDLY_EN | RK3328_GRF_MAC_CON1_TXDLY_EN) << 16;
-	const uint32_t write_val =
-	__SHIFTIN(RK3328_GRF_MAC_CON1_SEL_RGMII, RK3328_GRF_MAC_CON1_SEL) |
-	RK3328_GRF_MAC_CON1_RXDLY_EN | RK3328_GRF_MAC_CON1_TXDLY_EN;
+	write_mask = (RK3328_GRF_MAC_CON1_MODE | RK3328_GRF_MAC_CON1_SEL) << 16;
+	write_val = __SHIFTIN(RK3328_GRF_MAC_CON1_SEL_RGMII, RK3328_GRF_MAC_CON1_SEL);
+	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON1,
+	write_mask | write_val);
 
-	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON1, write_mask | write_val);
+#if notyet
+	write_mask = (RK3328_GRF_MAC_CON0_TXDLY | RK3328_GRF_MAC_CON0_RXDLY) << 16;
+	write_val = __SHIFTIN(tx_delay, RK3328_GRF_MAC_CON0_TXDLY) |
+		__SHIFTIN(rx_delay, RK3328_GRF_MAC_CON0_RXDLY);
 	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON0,
-	(RK3328_GRF_MAC_CON0_TXDLY << 16) |
-	(RK3328_GRF_MAC_CON0_RXDLY << 16) |
-	__SHIFTIN(tx_delay, RK3328_GRF_MAC_CON0_TXDLY) |
-	__SHIFTIN(rx_delay, RK3328_GRF_MAC_CON0_RXDLY));
+	write_mask | write_val);
+
+	write_mask = (RK3328_GRF_MAC_CON1_RXDLY_EN | RK3328_GRF_MAC_CON1_TXDLY_EN) << 16;
+	write_val = RK3328_GRF_MAC_CON1_RXDLY_EN | RK3328_GRF_MAC_CON1_TXDLY_EN;
+	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON1,
+	write_mask | write_val);
+#endif
 }
 
 static void
@@ -173,6 +178,7 @@ rk_gmac_setup_clocks(int phandle)
 		"aclk_mac",
 		"pclk_mac",
 		"mac_clk_tx",
+		"mac_clk_rx"
 #endif
 	};
 	static const char * const rstnames[] = {
@@ -282,8 +288,10 @@ rk_gmac_attach(device_t parent, device_t
 	if (rk_gmac_reset(phandle) != 0)
 		aprint_error_dev(self, "PHY reset failed\n");
 
+#if notyet
 	if (of_hasprop(phandle, "snps,force_thresh_dma_mode"))
 		sc->sc_flags |= DWC_GMAC_FORCE_THRESH_DMA_MODE;
+#endif
 
 	phy_mode = fdtbus_get_string(phandle, "phy-mode");
 	if (phy_mode == NULL) {



CVS commit: src/sys/dev/pckbport

2018-06-19 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jun 19 23:25:59 UTC 2018

Modified Files:
src/sys/dev/pckbport: alps.c

Log Message:
Make the error message from pms_alps_probe_init() an error again now
that we don't misidentify almost anything as an ALPS device.  Reset if
E6 check failed as well.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pckbport/alps.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/pckbport/alps.c
diff -u src/sys/dev/pckbport/alps.c:1.9 src/sys/dev/pckbport/alps.c:1.10
--- src/sys/dev/pckbport/alps.c:1.9	Tue Jun 19 23:03:28 2018
+++ src/sys/dev/pckbport/alps.c	Tue Jun 19 23:25:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: alps.c,v 1.9 2018/06/19 23:03:28 uwe Exp $ */
+/* $NetBSD: alps.c,v 1.10 2018/06/19 23:25:59 uwe Exp $ */
 
 /*-
  * Copyright (c) 2017 Ryo ONODERA 
@@ -30,7 +30,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.9 2018/06/19 23:03:28 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.10 2018/06/19 23:25:59 uwe Exp $");
 
 #include 
 #include 
@@ -169,7 +169,7 @@ pms_alps_e6sig(struct pms_softc *psc, ui
 	e6sig[1] != 0x00 ||
 	e6sig[2] != 0x64)
 	{
-		return ENODEV;
+		return ENODEV;	/* This is not an ALPS device */
 	}
 
 	aprint_debug_dev(psc->sc_dev,
@@ -219,7 +219,7 @@ pms_alps_e7sig(struct pms_softc *psc, ui
 		e7sig[0], e7sig[1], e7sig[2]);
 
 	if (e7sig[0] != 0x73)
-		return ENODEV;
+		return ENODEV;	/* This is not an ALPS device */
 
 	return 0;
 err:
@@ -701,7 +701,7 @@ pms_alps_probe_init(void *opaque)
 	pckbport_flush(psc->sc_kbctag, psc->sc_kbcslot);
 
 	if ((res = pms_alps_e6sig(psc, e6sig)) != 0)
-		return res; /* This is not ALPS device */
+		goto err;
 
 	if ((res = pms_alps_e7sig(psc, e7sig)) != 0)
 		goto err;
@@ -758,7 +758,7 @@ err:
 	(void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
 	cmd, 1, 2, NULL, 1);
 	if (res != ENODEV)
-		aprint_verbose_dev(psc->sc_dev, "Failed to initialize an ALPS device.\n");
+		aprint_error_dev(psc->sc_dev, "Failed to initialize an ALPS device.\n");
 	return res;
 }
 



CVS commit: src/sys/dev/pckbport

2018-06-19 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jun 19 23:03:28 UTC 2018

Modified Files:
src/sys/dev/pckbport: alps.c

Log Message:
Don't pass response buffer to the reset command since we are not
interested in it (pckbport_poll_cmd() is smart enough).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pckbport/alps.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/pckbport/alps.c
diff -u src/sys/dev/pckbport/alps.c:1.8 src/sys/dev/pckbport/alps.c:1.9
--- src/sys/dev/pckbport/alps.c:1.8	Tue Jun 19 22:53:17 2018
+++ src/sys/dev/pckbport/alps.c	Tue Jun 19 23:03:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: alps.c,v 1.8 2018/06/19 22:53:17 uwe Exp $ */
+/* $NetBSD: alps.c,v 1.9 2018/06/19 23:03:28 uwe Exp $ */
 
 /*-
  * Copyright (c) 2017 Ryo ONODERA 
@@ -30,7 +30,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.8 2018/06/19 22:53:17 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.9 2018/06/19 23:03:28 uwe Exp $");
 
 #include 
 #include 
@@ -690,7 +690,7 @@ pms_alps_probe_init(void *opaque)
 	uint8_t e7sig[3];
 	uint8_t ecsig[3];
 	int res;
-	u_char cmd[1], resp[3];
+	u_char cmd[1];
 
 	sc->last_x1 = 0;
 	sc->last_y1 = 0;
@@ -755,8 +755,8 @@ pms_alps_probe_init(void *opaque)
 
 err:
 	cmd[0] = PMS_RESET;
-	(void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd,
-	1, 2, resp, 1);
+	(void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
+	cmd, 1, 2, NULL, 1);
 	if (res != ENODEV)
 		aprint_verbose_dev(psc->sc_dev, "Failed to initialize an ALPS device.\n");
 	return res;



CVS commit: src/sys/dev/pckbport

2018-06-19 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jun 19 22:53:17 UTC 2018

Modified Files:
src/sys/dev/pckbport: alps.c

Log Message:
If the first byte of E7 signature is not 0x73, it's not an ALPS
device, so don't complain we failed to initialize it.  Still need a
reset, b/c the E7 check will be interpreted as normal commands by a
normal device.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pckbport/alps.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/pckbport/alps.c
diff -u src/sys/dev/pckbport/alps.c:1.7 src/sys/dev/pckbport/alps.c:1.8
--- src/sys/dev/pckbport/alps.c:1.7	Tue Jun 19 21:47:28 2018
+++ src/sys/dev/pckbport/alps.c	Tue Jun 19 22:53:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: alps.c,v 1.7 2018/06/19 21:47:28 uwe Exp $ */
+/* $NetBSD: alps.c,v 1.8 2018/06/19 22:53:17 uwe Exp $ */
 
 /*-
  * Copyright (c) 2017 Ryo ONODERA 
@@ -30,7 +30,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.7 2018/06/19 21:47:28 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.8 2018/06/19 22:53:17 uwe Exp $");
 
 #include 
 #include 
@@ -169,7 +169,7 @@ pms_alps_e6sig(struct pms_softc *psc, ui
 	e6sig[1] != 0x00 ||
 	e6sig[2] != 0x64)
 	{
-		return EINVAL;
+		return ENODEV;
 	}
 
 	aprint_debug_dev(psc->sc_dev,
@@ -218,6 +218,9 @@ pms_alps_e7sig(struct pms_softc *psc, ui
 		"ALPS PS/2 E7 signature: 0x%X 0x%X 0x%X\n",
 		e7sig[0], e7sig[1], e7sig[2]);
 
+	if (e7sig[0] != 0x73)
+		return ENODEV;
+
 	return 0;
 err:
 	aprint_error_dev(psc->sc_dev, "Failed to get E7 signature.\n");
@@ -754,7 +757,8 @@ err:
 	cmd[0] = PMS_RESET;
 	(void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd,
 	1, 2, resp, 1);
-	aprint_verbose_dev(psc->sc_dev, "Failed to initialize an ALPS device.\n");
+	if (res != ENODEV)
+		aprint_verbose_dev(psc->sc_dev, "Failed to initialize an ALPS device.\n");
 	return res;
 }
 



CVS commit: src/sys/dev

2018-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 19 22:44:33 UTC 2018

Modified Files:
src/sys/dev/fdt: dwcmmc_fdt.c
src/sys/dev/ic: dwc_mmc.c dwc_mmc_var.h

Log Message:
dwcmmc: set ciu clock rate rather than assuming fixed input rate


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/dwcmmc_fdt.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/dwc_mmc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/dwc_mmc_var.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/fdt/dwcmmc_fdt.c
diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.1 src/sys/dev/fdt/dwcmmc_fdt.c:1.2
--- src/sys/dev/fdt/dwcmmc_fdt.c:1.1	Sat Jun 16 00:19:04 2018
+++ src/sys/dev/fdt/dwcmmc_fdt.c	Tue Jun 19 22:44:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwcmmc_fdt.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */
+/* $NetBSD: dwcmmc_fdt.c,v 1.2 2018/06/19 22:44:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.2 2018/06/19 22:44:33 jmcneill Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ static int	dwcmmc_fdt_match(device_t, cf
 static void	dwcmmc_fdt_attach(device_t, device_t, void *);
 
 static int	dwcmmc_fdt_card_detect(struct dwc_mmc_softc *);
+static int	dwcmmc_fdt_bus_clock(struct dwc_mmc_softc *, int);
 
 struct dwcmmc_fdt_config {
 	u_int		ciu_div;
@@ -66,6 +67,7 @@ struct dwcmmc_fdt_softc {
 	struct clk		*sc_clk_ciu;
 	struct fdtbus_gpio_pin	*sc_pin_cd;
 	const struct dwcmmc_fdt_config *sc_conf;
+	u_int			sc_ciu_div;
 };
 
 CFATTACH_DECL_NEW(dwcmmc_fdt, sizeof(struct dwc_mmc_softc),
@@ -86,10 +88,10 @@ dwcmmc_fdt_attach(device_t parent, devic
 	struct dwc_mmc_softc *sc = >sc;
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
+	u_int fifo_depth, max_freq;
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
-	u_int fifo_depth;
 	int error;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -135,9 +137,14 @@ dwcmmc_fdt_attach(device_t parent, devic
 
 	const u_int ciu_div = esc->sc_conf->ciu_div > 0 ? esc->sc_conf->ciu_div : 1;
 
-	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (ciu_div + 1);
+	if (of_getprop_uint32(phandle, "max-frequency", _freq) == 0)
+		sc->sc_clock_freq = max_freq;
+	else
+		sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / ciu_div;
+
 	sc->sc_fifo_depth = fifo_depth;
 	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
+	sc->sc_bus_clock = dwcmmc_fdt_bus_clock;
 
 	esc->sc_pin_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",
 	GPIO_PIN_INPUT);
@@ -145,7 +152,7 @@ dwcmmc_fdt_attach(device_t parent, devic
 		sc->sc_card_detect = dwcmmc_fdt_card_detect;
 
 	aprint_naive("\n");
-	aprint_normal(": SD/MMC controller (%u Hz)\n", sc->sc_clock_freq);
+	aprint_normal(": DesignWare SD/MMC\n");
 
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error_dev(self, "failed to decode interrupt\n");
@@ -174,3 +181,25 @@ dwcmmc_fdt_card_detect(struct dwc_mmc_so
 
 	return fdtbus_gpio_read(esc->sc_pin_cd);
 }
+
+static int
+dwcmmc_fdt_bus_clock(struct dwc_mmc_softc *sc, int rate)
+{
+	struct dwcmmc_fdt_softc *esc = device_private(sc->sc_dev);
+const u_int ciu_div = esc->sc_conf->ciu_div > 0 ? esc->sc_conf->ciu_div : 1;
+	int error;
+
+	error = clk_set_rate(esc->sc_clk_ciu, 1000 * rate * ciu_div);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "failed to set rate to %u kHz: %d\n",
+		rate * ciu_div, error);
+		return error;
+	}
+
+	sc->sc_clock_freq = (clk_get_rate(esc->sc_clk_ciu) / ciu_div) / 1000;
+
+	aprint_debug_dev(sc->sc_dev, "set clock rate to %u kHz (target %u kHz)\n",
+	sc->sc_clock_freq, rate);
+
+	return 0;
+}

Index: src/sys/dev/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.12 src/sys/dev/ic/dwc_mmc.c:1.13
--- src/sys/dev/ic/dwc_mmc.c:1.12	Sun Jun 10 17:52:20 2018
+++ src/sys/dev/ic/dwc_mmc.c	Tue Jun 19 22:44:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.12 2018/06/10 17:52:20 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.13 2018/06/19 22:44:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.12 2018/06/10 17:52:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.13 2018/06/19 22:44:33 jmcneill Exp $");
 
 #include 
 #include 
@@ -355,7 +355,12 @@ static int
 dwc_mmc_set_clock(struct dwc_mmc_softc *sc, u_int freq)
 {
 	const u_int pll_freq = sc->sc_clock_freq / 1000;
-	const u_int clk_div = howmany(pll_freq, freq * 2);
+	u_int clk_div;
+
+	if (freq != pll_freq)
+		clk_div = howmany(pll_freq, freq);
+	else
+		clk_div = 0;
 
 	MMC_WRITE(sc, DWC_MMC_CLKDIV, clk_div);
 
@@ -374,6 +379,9 @@ dwc_mmc_bus_clock(sdmmc_chipset_handle_t
 		return 1;
 
 	if (freq) {
+		if (sc->sc_bus_clock && 

CVS commit: src/sys/dev/pckbport

2018-06-19 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jun 19 21:47:28 UTC 2018

Modified Files:
src/sys/dev/pckbport: alps.c

Log Message:
When E6 signature is checked, ignore pressed buttons.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pckbport/alps.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/pckbport/alps.c
diff -u src/sys/dev/pckbport/alps.c:1.6 src/sys/dev/pckbport/alps.c:1.7
--- src/sys/dev/pckbport/alps.c:1.6	Tue Jun 19 21:21:04 2018
+++ src/sys/dev/pckbport/alps.c	Tue Jun 19 21:47:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: alps.c,v 1.6 2018/06/19 21:21:04 uwe Exp $ */
+/* $NetBSD: alps.c,v 1.7 2018/06/19 21:47:28 uwe Exp $ */
 
 /*-
  * Copyright (c) 2017 Ryo ONODERA 
@@ -30,7 +30,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.6 2018/06/19 21:21:04 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.7 2018/06/19 21:47:28 uwe Exp $");
 
 #include 
 #include 
@@ -165,8 +165,10 @@ pms_alps_e6sig(struct pms_softc *psc, ui
 		goto err;
 
 	/* ALPS input device returns 00-00-64 as E6 signature */
-	if (e6sig[0] != 0x00 || e6sig[1] != 0x00 ||
-		e6sig[2] != 0x64) {
+	if ((e6sig[0] & ~0x07u) != 0x00 || /* ignore buttons */
+	e6sig[1] != 0x00 ||
+	e6sig[2] != 0x64)
+	{
 		return EINVAL;
 	}
 



CVS commit: src/sys/dev/pckbport

2018-06-19 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Jun 19 21:21:04 UTC 2018

Modified Files:
src/sys/dev/pckbport: alps.c

Log Message:
Use PMS_SEND_DEV_STATUS for E9 instead of PMS_GET_SCALE (also defined
as E9).  This is more readable and is congruent with other drivers.
Same object code is generated.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pckbport/alps.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/pckbport/alps.c
diff -u src/sys/dev/pckbport/alps.c:1.5 src/sys/dev/pckbport/alps.c:1.6
--- src/sys/dev/pckbport/alps.c:1.5	Sun Jun  3 15:02:56 2018
+++ src/sys/dev/pckbport/alps.c	Tue Jun 19 21:21:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: alps.c,v 1.5 2018/06/03 15:02:56 jakllsch Exp $ */
+/* $NetBSD: alps.c,v 1.6 2018/06/19 21:21:04 uwe Exp $ */
 
 /*-
  * Copyright (c) 2017 Ryo ONODERA 
@@ -30,7 +30,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.5 2018/06/03 15:02:56 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: alps.c,v 1.6 2018/06/19 21:21:04 uwe Exp $");
 
 #include 
 #include 
@@ -159,7 +159,7 @@ pms_alps_e6sig(struct pms_softc *psc, ui
 		goto err;
 	e6sig[0] = e6sig[1] = e6sig[2] = 0;
 	/* Get E6 signature */
-	cmd[0] = PMS_GET_SCALE; /* E9 */
+	cmd[0] = PMS_SEND_DEV_STATUS; /* E9 */
 	if ((res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
 	cmd, 1, 3, e6sig, 0)) != 0)
 		goto err;
@@ -207,7 +207,7 @@ pms_alps_e7sig(struct pms_softc *psc, ui
 	cmd, 1, 0, NULL, 0)) != 0)
 		goto err;
 	e7sig[0] = e7sig[1] = e7sig[2] = 0;
-	cmd[0] = PMS_GET_SCALE; /* E9 */
+	cmd[0] = PMS_SEND_DEV_STATUS; /* E9 */
 	if ((res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
 	cmd, 1, 3, e7sig, 0)) != 0)
 		goto err;
@@ -249,7 +249,7 @@ pms_alps_ecsig(struct pms_softc *psc, ui
 	cmd, 1, 0, NULL, 0)) != 0)
 		goto err;
 	ecsig[0] = ecsig[1] = ecsig[2] = 0;
-	cmd[0] = PMS_GET_SCALE; /* E9 */
+	cmd[0] = PMS_SEND_DEV_STATUS; /* E9 */
 	if ((res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
 	cmd, 1, 3, ecsig, 0)) != 0)
 		goto err;
@@ -288,7 +288,7 @@ pms_alps_start_command_mode(struct pms_s
 	cmd, 1, 0, NULL, 0)) != 0)
 		goto err;
 	resp[0] = resp[1] = resp[2] = 0;
-	cmd[0] = PMS_GET_SCALE; /* E9 */
+	cmd[0] = PMS_SEND_DEV_STATUS; /* E9 */
 	if ((res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
 	cmd, 1, 3, resp, 0)) != 0)
 		goto err;



CVS commit: src/doc

2018-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jun 19 19:57:45 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
actually Xen XSAVE support itself is bigger deal than the AVX alone, so mention
that more prominently


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2400 src/doc/CHANGES:1.2401
--- src/doc/CHANGES:1.2400	Tue Jun 19 19:53:42 2018
+++ src/doc/CHANGES	Tue Jun 19 19:57:45 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2400 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2401 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -164,5 +164,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	virtio(4): Add MMIO transport and fdt(4) attachment. [jakllsch 20180606]
 	arm: Add support for QEMU ARM Virtual Machine ("virt"). [jmcneill 20180614]
 	arm: Add support for Rockchip RK3328 SoC. [jmcneill 20180615]
-	xen: Enabled AVX support on hardware with proper XSAVE support,
-		PR kern/50332. [jdolecek 20180619]
+	xen: Enabled XSAVE and AVX support on hardware with proper XSAVE
+		support, PR kern/50332. [jdolecek 20180619]



CVS commit: src/doc

2018-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jun 19 19:53:42 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
note the Xen AVX fix


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2399 src/doc/CHANGES:1.2400
--- src/doc/CHANGES:1.2399	Sat Jun 16 00:19:42 2018
+++ src/doc/CHANGES	Tue Jun 19 19:53:42 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2399 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2400 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -164,3 +164,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	virtio(4): Add MMIO transport and fdt(4) attachment. [jakllsch 20180606]
 	arm: Add support for QEMU ARM Virtual Machine ("virt"). [jmcneill 20180614]
 	arm: Add support for Rockchip RK3328 SoC. [jmcneill 20180615]
+	xen: Enabled AVX support on hardware with proper XSAVE support,
+		PR kern/50332. [jdolecek 20180619]



CVS commit: src/sys/arch

2018-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jun 19 19:50:19 UTC 2018

Modified Files:
src/sys/arch/x86/include: fpu.h
src/sys/arch/x86/x86: cpu.c fpu.c identcpu.c
src/sys/arch/xen/x86: cpu.c

Log Message:
fix FPU initialization on Xen to allow e.g. AVX when supported by hardware;
only use XSAVE when the the CPUID OSXSAVE bit is set, as this seems to be
reliable indication

tested with Xen 4.2.6 DOM0/DOMU on Intel CPU, without and with no-xsave flag,
so should work also on those AMD CPUs, which have XSAVE disabled by default;
also tested with Xen DOM0 4.8.3

fixes PR kern/50332 by Torbjorn Granlund; sorry it took three years to address

XXX pullup netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/xen/x86/cpu.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/include/fpu.h
diff -u src/sys/arch/x86/include/fpu.h:1.9 src/sys/arch/x86/include/fpu.h:1.10
--- src/sys/arch/x86/include/fpu.h:1.9	Thu Jun 14 14:36:46 2018
+++ src/sys/arch/x86/include/fpu.h	Tue Jun 19 19:50:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.9 2018/06/14 14:36:46 maxv Exp $	*/
+/*	$NetBSD: fpu.h,v 1.10 2018/06/19 19:50:19 jdolecek Exp $	*/
 
 #ifndef	_X86_FPU_H_
 #define	_X86_FPU_H_
@@ -12,7 +12,7 @@ struct lwp;
 struct trapframe;
 
 void fpuinit(struct cpu_info *);
-void fpuinit_mxcsr_mask(void);
+void fpuinit_mxcsr_mask(uint32_t);
 void fpusave_lwp(struct lwp *, bool);
 void fpusave_cpu(bool);
 

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.155 src/sys/arch/x86/x86/cpu.c:1.156
--- src/sys/arch/x86/x86/cpu.c:1.155	Thu Apr  5 08:43:07 2018
+++ src/sys/arch/x86/x86/cpu.c	Tue Jun 19 19:50:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.155 2018/04/05 08:43:07 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.156 2018/06/19 19:50:19 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.155 2018/04/05 08:43:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.156 2018/06/19 19:50:19 jdolecek Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -638,7 +638,7 @@ cpu_init(struct cpu_info *ci)
 	}
 
 	if (x86_fpu_save >= FPU_SAVE_FXSAVE) {
-		fpuinit_mxcsr_mask();
+		fpuinit_mxcsr_mask(cr4);
 	}
 
 	/* If xsave is enabled, enable all fpu features */

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.39 src/sys/arch/x86/x86/fpu.c:1.40
--- src/sys/arch/x86/x86/fpu.c:1.39	Tue Jun 19 09:25:13 2018
+++ src/sys/arch/x86/x86/fpu.c	Tue Jun 19 19:50:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.39 2018/06/19 09:25:13 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.40 2018/06/19 19:50:19 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.39 2018/06/19 09:25:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.40 2018/06/19 19:50:19 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -237,9 +237,14 @@ fpuinit(struct cpu_info *ci)
  * Get the value of MXCSR_MASK supported by the CPU.
  */
 void
-fpuinit_mxcsr_mask(void)
+fpuinit_mxcsr_mask(uint32_t cr4)
 {
-#ifndef XEN
+
+	if ((cr4 & CR4_OSXSAVE) == 0) {
+		x86_fpu_mxcsr_mask = __INITIAL_MXCSR_MASK__;
+		return;
+	}
+
 	union savefpu fpusave __aligned(16);
 	u_long psl;
 
@@ -262,9 +267,6 @@ fpuinit_mxcsr_mask(void)
 	} else {
 		x86_fpu_mxcsr_mask = fpusave.sv_xmm.fx_mxcsr_mask;
 	}
-#else
-	x86_fpu_mxcsr_mask = __INITIAL_MXCSR_MASK__;
-#endif
 }
 
 static void

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.72 src/sys/arch/x86/x86/identcpu.c:1.73
--- src/sys/arch/x86/x86/identcpu.c:1.72	Sun Jun 17 07:13:02 2018
+++ src/sys/arch/x86/x86/identcpu.c	Tue Jun 19 19:50:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.72 2018/06/17 07:13:02 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.73 2018/06/19 19:50:19 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.72 2018/06/17 07:13:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.73 2018/06/19 19:50:19 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -819,12 +819,7 @@ cpu_probe_fpu(struct cpu_info *ci)
 	if (descs[2] > 512)
 		x86_fpu_save_size = descs[2];
 
-#ifdef XEN
-	/* Don't use xsave, force fxsave with x86_xsave_features = 0. */
-	x86_fpu_save = FPU_SAVE_FXSAVE;
-#else
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
-#endif
 }
 
 void

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.117 

CVS commit: src/distrib/utils/embedded/conf

2018-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 19 15:13:51 UTC 2018

Modified Files:
src/distrib/utils/embedded/conf: arm64.conf

Log Message:
Install RK3328 .dtb files to the correct location


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/conf/arm64.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/arm64.conf
diff -u src/distrib/utils/embedded/conf/arm64.conf:1.1 src/distrib/utils/embedded/conf/arm64.conf:1.2
--- src/distrib/utils/embedded/conf/arm64.conf:1.1	Sun Apr  1 04:35:02 2018
+++ src/distrib/utils/embedded/conf/arm64.conf	Tue Jun 19 15:13:51 2018
@@ -1,4 +1,4 @@
-# $NetBSD: arm64.conf,v 1.1 2018/04/01 04:35:02 ryo Exp $
+# $NetBSD: arm64.conf,v 1.2 2018/06/19 15:13:51 jmcneill Exp $
 # ARM64 customization script used by mkimage
 #
 board=arm64
@@ -40,6 +40,12 @@ populate_allwinner() {
 	mv "${mnt}"/boot/sun50i-*.dtb "${mnt}/boot/dtb/allwinner/"
 }
 
+populate_rockchip() {
+	# U-Boot expects 64-bit DTB files to live in a rockchip/ subdirectory
+	mkdir -p "${mnt}/boot/dtb/rockchip"
+	mv "${mnt}"/boot/rk3328-*.dtb "${mnt}/boot/dtb/rockchip/"
+}
+
 populate_rpi() {
 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
 	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
@@ -107,6 +113,7 @@ populate() {
 	# SoC specific configuration
 	populate_allwinner
 	populate_nvidia
+	populate_rockchip
 
 	# Board specific configuration
 	populate_rpi



CVS commit: src/distrib/utils/embedded/conf

2018-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 19 15:12:05 UTC 2018

Modified Files:
src/distrib/utils/embedded/conf: evbarm.conf

Log Message:
Increase reserved space at start of image from 4MB to 16MB to make room
for Rockchip bootloaders.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/distrib/utils/embedded/conf/evbarm.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/evbarm.conf
diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.27 src/distrib/utils/embedded/conf/evbarm.conf:1.28
--- src/distrib/utils/embedded/conf/evbarm.conf:1.27	Sat May 13 10:44:58 2017
+++ src/distrib/utils/embedded/conf/evbarm.conf	Tue Jun 19 15:12:05 2018
@@ -1,4 +1,4 @@
-# $NetBSD: evbarm.conf,v 1.27 2017/05/13 10:44:58 hubertf Exp $
+# $NetBSD: evbarm.conf,v 1.28 2018/06/19 15:12:05 jmcneill Exp $
 # evbarm shared config
 #
 image=$HOME/${board}.img
@@ -7,7 +7,7 @@ MACHINE=evbarm
 
 swap=256
 extra=48		# spare space
-init=8
+init=32
 boot=$((192 - ${init}))
 ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m
 



CVS commit: src/sys/dev/mii

2018-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 19 10:36:41 UTC 2018

Modified Files:
src/sys/dev/mii: rgephy.c rgephyreg.h

Log Message:
Use symbolic names for chip revision. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/mii/rgephy.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/mii/rgephyreg.h

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

Modified files:

Index: src/sys/dev/mii/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.42 src/sys/dev/mii/rgephy.c:1.43
--- src/sys/dev/mii/rgephy.c:1.42	Sat Feb  3 19:34:01 2018
+++ src/sys/dev/mii/rgephy.c	Tue Jun 19 10:36:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.42 2018/02/03 19:34:01 jmcneill Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.43 2018/06/19 10:36:41 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.42 2018/02/03 19:34:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.43 2018/06/19 10:36:41 jmcneill Exp $");
 
 
 /*
@@ -307,14 +307,14 @@ rgephy_service(struct mii_softc *sc, str
 		 * need to restart the autonegotiation process.  Read
 		 * the BMSR twice in case it's latched.
 		 */
-		if (sc->mii_mpd_rev >= 6) {
+		if (sc->mii_mpd_rev >= RGEPHY_8211F) {
 			/* RTL8211F */
 			reg = PHY_READ(sc, RGEPHY_MII_PHYSR);
 			if (reg & RGEPHY_PHYSR_LINK) {
 sc->mii_ticks = 0;
 break;
 			}
-		} else if (sc->mii_mpd_rev >= 2) {
+		} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
 			/* RTL8211B(L) */
 			reg = PHY_READ(sc, RGEPHY_MII_SSR);
 			if (reg & RGEPHY_SSR_LINK) {
@@ -368,11 +368,11 @@ rgephy_status(struct mii_softc *sc)
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
 
-	if (sc->mii_mpd_rev >= 6) {
+	if (sc->mii_mpd_rev >= RGEPHY_8211F) {
 		physr = PHY_READ(sc, RGEPHY_MII_PHYSR);
 		if (physr & RGEPHY_PHYSR_LINK)
 			mii->mii_media_status |= IFM_ACTIVE;
-	} else if (sc->mii_mpd_rev >= 2) {
+	} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
 		ssr = PHY_READ(sc, RGEPHY_MII_SSR);
 		if (ssr & RGEPHY_SSR_LINK)
 			mii->mii_media_status |= IFM_ACTIVE;
@@ -402,7 +402,7 @@ rgephy_status(struct mii_softc *sc)
 		}
 	}
 
-	if (sc->mii_mpd_rev >= 6) {
+	if (sc->mii_mpd_rev >= RGEPHY_8211F) {
 		physr = PHY_READ(sc, RGEPHY_MII_PHYSR);
 		switch (__SHIFTOUT(physr, RGEPHY_PHYSR_SPEED)) {
 		case RGEPHY_PHYSR_SPEED_1000:
@@ -423,7 +423,7 @@ rgephy_status(struct mii_softc *sc)
 			IFM_FDX;
 		else
 			mii->mii_media_active |= IFM_HDX;
-	} else if (sc->mii_mpd_rev >= 2) {
+	} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
 		ssr = PHY_READ(sc, RGEPHY_MII_SSR);
 		switch (ssr & RGEPHY_SSR_SPD_MASK) {
 		case RGEPHY_SSR_S1000:
@@ -493,7 +493,7 @@ rgephy_loop(struct mii_softc *sc)
 	int i;
 
 	if (sc->mii_mpd_model != MII_MODEL_REALTEK_RTL8251 &&
-	sc->mii_mpd_rev < 2) {
+	sc->mii_mpd_rev < RGEPHY_8211B) {
 		PHY_WRITE(sc, MII_BMCR, BMCR_PDOWN);
 		DELAY(1000);
 	}
@@ -528,7 +528,7 @@ rgephy_load_dspcode(struct mii_softc *sc
 	int val;
 
 	if (sc->mii_mpd_model == MII_MODEL_REALTEK_RTL8251 ||
-	sc->mii_mpd_rev >= 2)
+	sc->mii_mpd_rev >= RGEPHY_8211B)
 		return;
 
 #if 1
@@ -630,16 +630,16 @@ rgephy_reset(struct mii_softc *sc)
 	DELAY(1000);
 
 	if (sc->mii_mpd_model != MII_MODEL_REALTEK_RTL8251 &&
-	sc->mii_mpd_rev < 2) {
+	sc->mii_mpd_rev < RGEPHY_8211B) {
 		rgephy_load_dspcode(sc);
-	} else if (sc->mii_mpd_rev == 3) {
+	} else if (sc->mii_mpd_rev == RGEPHY_8211C) {
 		/* RTL8211C(L) */
 		ssr = PHY_READ(sc, RGEPHY_MII_SSR);
 		if ((ssr & RGEPHY_SSR_ALDPS) != 0) {
 			ssr &= ~RGEPHY_SSR_ALDPS;
 			PHY_WRITE(sc, RGEPHY_MII_SSR, ssr);
 		}
-	} else if (sc->mii_mpd_rev == 5) {
+	} else if (sc->mii_mpd_rev == RGEPHY_8211E) {
 		/* RTL8211E */
 		if (rsc->mii_no_rx_delay) {
 			/* Disable RX internal delay (undocumented) */
@@ -648,7 +648,7 @@ rgephy_reset(struct mii_softc *sc)
 			PHY_WRITE(sc, 0x1c, 0xb591);
 			PHY_WRITE(sc, 0x1f, 0x);
 		}
-	} else if (sc->mii_mpd_rev == 6) {
+	} else if (sc->mii_mpd_rev == RGEPHY_8211F) {
 		/* RTL8211F */
 		phycr1 = PHY_READ(sc, RGEPHY_MII_PHYCR1);
 		phycr1 &= ~RGEPHY_PHYCR1_MDI_MMCE;
@@ -671,7 +671,7 @@ rgephy_reset(struct mii_softc *sc)
 	/* NWay enable and Restart NWay */
 	PHY_WRITE(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);
 
-	if (sc->mii_mpd_rev == 6) {
+	if (sc->mii_mpd_rev == RGEPHY_8211F) {
 		/* RTL8211F */
 		delay(1);
 		/* disable EEE */

Index: src/sys/dev/mii/rgephyreg.h
diff -u src/sys/dev/mii/rgephyreg.h:1.9 src/sys/dev/mii/rgephyreg.h:1.10
--- src/sys/dev/mii/rgephyreg.h:1.9	Fri Aug 21 16:29:48 2015
+++ src/sys/dev/mii/rgephyreg.h	Tue Jun 19 10:36:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephyreg.h,v 1.9 2015/08/21 16:29:48 jmcneill Exp $	*/
+/*	$NetBSD: rgephyreg.h,v 1.10 2018/06/19 10:36:41 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -37,6 +37,11 @@
 #ifndef _DEV_MII_RGEPHYREG_H_
 #define	_DEV_MII_RGEPHYREG_H_
 
+#define	RGEPHY_8211B	

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

2018-06-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 19 09:25:13 UTC 2018

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

Log Message:
When using EagerFPU, create the fpu state in execve at IPL_HIGH.

A preemption could occur in the middle, and we don't want that to happen,
because the context switch would use the partially-constructed fpu state.

The procedure becomes:

splhigh
unbusy the current cpu's fpu
create a new fpu state in memory
install the state on the current cpu's fpu
splx

Disabling preemption also ensures that x86_fpu_eager doesn't change in
the middle.

In LazyFPU mode we drop IPL_HIGH right away.

Add more KASSERTs.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/x86/x86/fpu.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/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.38 src/sys/arch/x86/x86/fpu.c:1.39
--- src/sys/arch/x86/x86/fpu.c:1.38	Mon Jun 18 20:20:27 2018
+++ src/sys/arch/x86/x86/fpu.c	Tue Jun 19 09:25:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.38 2018/06/18 20:20:27 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.39 2018/06/19 09:25:13 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.38 2018/06/18 20:20:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.39 2018/06/19 09:25:13 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -624,10 +624,22 @@ fpu_save_area_clear(struct lwp *l, unsig
 {
 	union savefpu *fpu_save;
 	struct pcb *pcb;
+	int s;
 
-	fpusave_lwp(l, false);
+	KASSERT(l == curlwp);
+	KASSERT((l->l_flag & LW_SYSTEM) == 0);
 	fpu_save = process_fpframe(l);
 	pcb = lwp_getpcb(l);
+
+	s = splhigh();
+	if (x86_fpu_eager) {
+		KASSERT(pcb->pcb_fpcpu == NULL ||
+		pcb->pcb_fpcpu == curcpu());
+		fpusave_cpu(false);
+	} else {
+		splx(s);
+		fpusave_lwp(l, false);
+	}
 	KASSERT(pcb->pcb_fpcpu == NULL);
 
 	if (i386_use_fxsave) {
@@ -650,13 +662,9 @@ fpu_save_area_clear(struct lwp *l, unsig
 	}
 	pcb->pcb_fpu_dflt_cw = x87_cw;
 
-	/*
-	 * If using eager-switch, install the FPU state on the current
-	 * CPU.
-	 */
 	if (x86_fpu_eager) {
-		KASSERT(l == curlwp);
-		fpu_eagerswitch(NULL, l);
+		fpu_eagerrestore(l);
+		splx(s);
 	}
 }
 



CVS commit: src/tests

2018-06-19 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Jun 19 09:20:47 UTC 2018

Modified Files:
src/tests/fs/common: h_fsmacros.h
src/tests/lib/libc/gen: t_dir.c
src/tests/lib/libc/sys: t_posix_fadvise.c

Log Message:
No semicolon after macro do ... while (0) wrapper.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/tests/fs/common/h_fsmacros.h
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libc/gen/t_dir.c
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_posix_fadvise.c

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.41 src/tests/fs/common/h_fsmacros.h:1.42
--- src/tests/fs/common/h_fsmacros.h:1.41	Fri Jan 13 21:30:39 2017
+++ src/tests/fs/common/h_fsmacros.h	Tue Jun 19 09:20:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.41 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.42 2018/06/19 09:20:46 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@ do {	\
 		atf_tc_fail_errno("newfs failed");			\
 	if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0)	\
 		atf_tc_fail_errno("mount failed");			\
-} while (/*CONSTCOND*/0);
+} while (/*CONSTCOND*/0)
 
 #define FSTEST_CONSTRUCTOR_FSPRIV(_tc_, _fs_, _args_, _privargs_)	\
 do {	\
@@ -91,7 +91,7 @@ do {	\
 		atf_tc_fail_errno("newfs failed");			\
 	if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0)	\
 		atf_tc_fail_errno("mount failed");			\
-} while (/*CONSTCOND*/0);
+} while (/*CONSTCOND*/0)
 
 #define FSTEST_DESTRUCTOR(_tc_, _fs_, _args_)\
 do {	\
@@ -101,7 +101,7 @@ do {	\
 	}\
 	if (_fs_##_fstest_delfs(_tc_, _args_) != 0)			\
 		atf_tc_fail_errno("delfs failed");			\
-} while (/*CONSTCOND*/0);
+} while (/*CONSTCOND*/0)
 
 #define ATF_TC_FSADD(fs,type,func,desc)	\
 	ATF_TC(fs##_##func);		\

Index: src/tests/lib/libc/gen/t_dir.c
diff -u src/tests/lib/libc/gen/t_dir.c:1.10 src/tests/lib/libc/gen/t_dir.c:1.11
--- src/tests/lib/libc/gen/t_dir.c:1.10	Wed Jan 11 18:15:02 2017
+++ src/tests/lib/libc/gen/t_dir.c	Tue Jun 19 09:20:46 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dir.c,v 1.10 2017/01/11 18:15:02 christos Exp $ */
+/* $NetBSD: t_dir.c,v 1.11 2018/06/19 09:20:46 gson Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@ ATF_TC_BODY(seekdir_basic, tc)
 		"creat(%s, %x) failed: %s", (x), (m),		\
 		strerror(errno));	\
 		(void)close(_creat_fd);	\
-	} while(0);
+	} while (0)
 
 	ATF_REQUIRE_MSG(mkdir("t", 0755) == 0,
 	"mkdir failed: %s", strerror(errno));

Index: src/tests/lib/libc/sys/t_posix_fadvise.c
diff -u src/tests/lib/libc/sys/t_posix_fadvise.c:1.2 src/tests/lib/libc/sys/t_posix_fadvise.c:1.3
--- src/tests/lib/libc/sys/t_posix_fadvise.c:1.2	Fri Jan 13 21:30:41 2017
+++ src/tests/lib/libc/sys/t_posix_fadvise.c	Tue Jun 19 09:20:46 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
+/* $NetBSD: t_posix_fadvise.c,v 1.3 2018/06/19 09:20:46 gson Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
+__RCSID("$NetBSD: t_posix_fadvise.c,v 1.3 2018/06/19 09:20:46 gson Exp $");
 
 #include 
 
@@ -112,7 +112,7 @@ ATF_TC_BODY(posix_fadvise, tc)
 		ATF_CHECK_EQ_MSG(ret = (x), exp, "got: %d", ret); \
 		ATF_CHECK_EQ_MSG(errno, 999, "got: %s", strerror(errno)); \
 		errno = save; \
-	} while (0);
+	} while (0)
 
 	CE(posix_fadvise(fd, 0, 0, -1), EINVAL);
 	CE(posix_fadvise(pipe_fds[0], 0, 0, POSIX_FADV_NORMAL), ESPIPE);



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

2018-06-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 19 07:23:45 UTC 2018

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

Log Message:
Explicitly clear l2's pcb_fpcpu when forking.

A context switch (preemption) could occur between

fpusave_lwp(l1, true);
and
memcpy(pcb2, pcb1, sizeof(struct pcb));

In this case, l1's FPU state is re-installed on the current CPU, and
pcb1->pcb_fpcpu becomes non NULL. While it's fine to have l1's state
installed, we don't want to indicate l2's state is installed too.

With lazy fpu this was not a problem, because the context-switch would
not re-install the state, so pcb1->pcb_fpcpu was NULL.

Should fix PR/53383.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/x86/vm_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/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.33 src/sys/arch/x86/x86/vm_machdep.c:1.34
--- src/sys/arch/x86/x86/vm_machdep.c:1.33	Fri Mar 16 12:19:35 2018
+++ src/sys/arch/x86/x86/vm_machdep.c	Tue Jun 19 07:23:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.33 2018/03/16 12:19:35 maxv Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.34 2018/06/19 07:23:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.33 2018/03/16 12:19:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.34 2018/06/19 07:23:44 maxv Exp $");
 
 #include "opt_mtrr.h"
 
@@ -157,6 +157,10 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 
 	/* Copy the PCB from parent. */
 	memcpy(pcb2, pcb1, sizeof(struct pcb));
+
+	/* FPU state not installed. */
+	pcb2->pcb_fpcpu = NULL;
+
 	/* Copy any additional fpu state */
 	fpu_save_area_fork(pcb2, pcb1);