CVS commit: src/lib/libc

2017-10-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Oct  5 04:38:08 UTC 2017

Modified Files:
src/lib/libc: shlib_version

Log Message:
One of the things we should do when bumping libc is to boot the
obsolete cryptographic hashes out of libc, either entirely or to
some "insecure" library.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/lib/libc/shlib_version

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

Modified files:

Index: src/lib/libc/shlib_version
diff -u src/lib/libc/shlib_version:1.276 src/lib/libc/shlib_version:1.277
--- src/lib/libc/shlib_version:1.276	Wed Aug 16 21:32:23 2017
+++ src/lib/libc/shlib_version	Thu Oct  5 04:38:08 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.276 2017/08/16 21:32:23 joerg Exp $
+#	$NetBSD: shlib_version,v 1.277 2017/10/05 04:38:08 dholland Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -8,6 +8,7 @@
 # - libc/net: resolver update to BIND8/9?
 # - md2, md4, md5, rmd160 & sha1 functions should take the same arguments AFAP
 # - Crypto hashes have name overlap with libcrypto, rename them
+# - obsolete crypto hashes shold be booted out of libc
 # - libc/gen/setproctitle.c: remove __ps_strings hack
 # - libc/gen/assert.c: __{diag,}assert13() -> __{diag,}assert()
 # - lib/libc/net/iso_addr.c: remove



CVS commit: src/libexec/httpd

2017-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Oct  5 04:22:41 UTC 2017

Modified Files:
src/libexec/httpd: cgi-bozo.c

Log Message:
s/u_int/unsigned/.

from Jan Danielsson.  increases/fixes portability.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/libexec/httpd/cgi-bozo.c

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

Modified files:

Index: src/libexec/httpd/cgi-bozo.c
diff -u src/libexec/httpd/cgi-bozo.c:1.37 src/libexec/httpd/cgi-bozo.c:1.38
--- src/libexec/httpd/cgi-bozo.c:1.37	Tue Jan 31 14:36:09 2017
+++ src/libexec/httpd/cgi-bozo.c	Thu Oct  5 04:22:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgi-bozo.c,v 1.37 2017/01/31 14:36:09 mrg Exp $	*/
+/*	$NetBSD: cgi-bozo.c,v 1.38 2017/10/05 04:22:41 mrg Exp $	*/
 
 /*	$eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -517,8 +517,8 @@ bozo_process_cgi(bozo_httpreq_t *request
 		strcpy(t, "HTTP_");
 		t += strlen(t);
 		for (s2 = headp->h_header; *s2; t++, s2++)
-			if (islower((u_int)*s2))
-*t = toupper((u_int)*s2);
+			if (islower((unsigned)*s2))
+*t = toupper((unsigned)*s2);
 			else if (*s2 == '-')
 *t = '_';
 			else



CVS commit: src/sys/netinet6

2017-10-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Oct  5 03:42:14 UTC 2017

Modified Files:
src/sys/netinet6: nd6.c

Log Message:
Add missing NULL check

PR kern/52554


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/netinet6/nd6.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/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.235 src/sys/netinet6/nd6.c:1.236
--- src/sys/netinet6/nd6.c:1.235	Thu Jun 22 09:24:02 2017
+++ src/sys/netinet6/nd6.c	Thu Oct  5 03:42:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.235 2017/06/22 09:24:02 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.236 2017/10/05 03:42:14 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.235 2017/06/22 09:24:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.236 2017/10/05 03:42:14 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2321,6 +2321,11 @@ nd6_resolve(struct ifnet *ifp, const str
 		created = true;
 	}
 
+	if (ln == NULL) {
+		m_freem(m);
+		return ENETDOWN; /* better error? */
+	}
+
 	LLE_WLOCK_ASSERT(ln);
 
 	/* We don't have to do link-layer address resolution on a p2p link. */



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

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  5 03:24:40 UTC 2017

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

Log Message:
- Use per cpu ci->ci_max_cupid instead of global "cpuid_level" variable.
- Print AMD specific cpuid leafs:
0x8008 ebx
0x800a edx
0x8007 ebx


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/x86/procfs_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/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.17 src/sys/arch/x86/x86/procfs_machdep.c:1.18
--- src/sys/arch/x86/x86/procfs_machdep.c:1.17	Thu Sep 28 10:59:38 2017
+++ src/sys/arch/x86/x86/procfs_machdep.c	Thu Oct  5 03:24:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.17 2017/09/28 10:59:38 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.18 2017/10/05 03:24:40 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.17 2017/09/28 10:59:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.18 2017/10/05 03:24:40 msaitoh Exp $");
 
 #include 
 #include 
@@ -55,6 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_machd
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /*
  *  The feature table. The order is the same as Linux's
@@ -280,14 +282,14 @@ procfs_getonecpufeatures(struct cpu_info
 	left);
 	diff = last - *left;
 
-	if (cpuid_level >= 0x0d) {
+	if (ci->ci_max_cpuid >= 0x0d) {
 		x86_cpuid2(0x0d, 1, descs);
 		procfs_getonefeatreg(descs[0], x86_features[10], p + diff,
 		left);
 		diff = last - *left;
 	}
 
-	if (cpuid_level >= 0x0f) {
+	if (ci->ci_max_cpuid >= 0x0f) {
 		x86_cpuid2(0x0f, 0, descs);
 		procfs_getonefeatreg(descs[3], x86_features[11], p + diff,
 		left);
@@ -299,22 +301,40 @@ procfs_getonecpufeatures(struct cpu_info
 		diff = last - *left;
 	}
 
-	/* (13) 0x8008 ebx */
+	if ((cpu_vendor == CPUVENDOR_AMD)
+	&& (ci->ci_max_ext_cpuid >= 0x8008)) {
+		x86_cpuid(0x8008, descs);
+		procfs_getonefeatreg(descs[1], x86_features[13], p + diff,
+		left);
+		diff = last - *left;
+	}
 
-	if (cpuid_level >= 0x06) {
+	if (ci->ci_max_cpuid >= 0x06) {
 		x86_cpuid(0x06, descs);
 		procfs_getonefeatreg(descs[0], x86_features[14], p + diff,
 		left);
 		diff = last - *left;
 	}
 
-	/* (15) 0x800a edx */
+	if ((cpu_vendor == CPUVENDOR_AMD)
+	&& (ci->ci_max_ext_cpuid >= 0x800a)) {
+		x86_cpuid(0x800a, descs);
+		procfs_getonefeatreg(descs[3], x86_features[15], p + diff,
+		left);
+		diff = last - *left;
+	}
 
 	procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff,
 	left);
 	diff = last - *left;
 
-	/* (17) 0x8007 ebx */
+	if ((cpu_vendor == CPUVENDOR_AMD)
+	&& (ci->ci_max_ext_cpuid >= 0x8007)) {
+		x86_cpuid(0x8007, descs);
+		procfs_getonefeatreg(descs[1], x86_features[17], p + diff,
+		left);
+		diff = last - *left;
+	}
 
 	return 0; /* XXX */
 }
@@ -410,7 +430,7 @@ procfs_getonecpu(int xcpu, struct cpu_in
 	i386_fpu_fdivbug ? "yes" : "no",	/* an old pentium */
 #endif
 	i386_fpu_present ? "yes" : "no",	/* not a 486SX */
-	cpuid_level,
+	ci->ci_max_cpuid,
 	(rcr0() & CR0_WP) ? "yes" : "no",
 	featurebuf,
 	ci->ci_cflush_lsize



CVS commit: src/sys/lib/libsa

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  5 02:59:21 UTC 2017

Modified Files:
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
try a different style of __used.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.42 src/sys/lib/libsa/loadfile_elf32.c:1.43
--- src/sys/lib/libsa/loadfile_elf32.c:1.42	Wed Oct  4 18:00:40 2017
+++ src/sys/lib/libsa/loadfile_elf32.c	Wed Oct  4 22:59:21 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.42 2017/10/04 22:00:40 christos Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.43 2017/10/05 02:59:21 christos Exp $ */
 
 /*
  * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -489,7 +489,7 @@ int
 ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
 {
 	Elf_Phdr *phdr;
-	int i, first __used;
+	int i, first;
 	ssize_t sz;
 	Elf_Addr minp = ~0, maxp = 0, pos = 0, elfp = 0;
 	u_long offset = marks[MARK_START];
@@ -497,6 +497,8 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e
 
 	/* some ports dont use the offset */
 	(void)
+	/* for ports that define progress to nothing */
+	(void)
 
 	/* have not seen a data segment so far */
 	marks[MARK_DATA] = 0;



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

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:32:47 UTC 2017

Modified Files:
src/sys/arch/arm/dts: sun8i-h3.dtsi

Log Message:
add thermal sensor controller


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/sun8i-h3.dtsi

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/dts/sun8i-h3.dtsi
diff -u src/sys/arch/arm/dts/sun8i-h3.dtsi:1.4 src/sys/arch/arm/dts/sun8i-h3.dtsi:1.5
--- src/sys/arch/arm/dts/sun8i-h3.dtsi:1.4	Tue Oct  3 23:42:35 2017
+++ src/sys/arch/arm/dts/sun8i-h3.dtsi	Thu Oct  5 01:32:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3.dtsi,v 1.4 2017/10/03 23:42:35 jmcneill Exp $ */
+/* $NetBSD: sun8i-h3.dtsi,v 1.5 2017/10/05 01:32:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -75,6 +75,16 @@
 			compatible = "allwinner,sun8i-h3-sid";
 			reg = <0x01c14000 0x400>;
 		};
+
+		rtp: rtp@1c25000 {
+			compatible = "allwinner,sun8i-h3-ts";
+			reg = <0x01c25000 0x400>;
+			interrupts = ;
+			clocks = < CLK_BUS_THS>, < CLK_THS>;
+			clock-names = "ahb", "ths";
+			resets = < RST_BUS_THS>;
+			#thermal-sensor-cells = <0>;
+		};
 	};
 };
 



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

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:30:45 UTC 2017

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

Log Message:
enable sunxisid and sunxithermal


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/SUNXI

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/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.33 src/sys/arch/evbarm/conf/SUNXI:1.34
--- src/sys/arch/evbarm/conf/SUNXI:1.33	Mon Oct  2 22:50:29 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Oct  5 01:30:45 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.33 2017/10/02 22:50:29 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.34 2017/10/05 01:30:45 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -159,6 +159,12 @@ sy8106a*	at iic?			# Silergy SY81061 reg
 # RTC
 sunxirtc*	at fdt?			# RTC
 
+# Security ID EFUSE
+sunxisid*	at fdt?	pass 4		# SID
+
+# Thermal sensor
+sunxithermal*	at fdt?			# Thermal sensor controller
+
 # Audio
 sunxicodec*	at fdt?			# Audio codec
 h3codec*	at fdt?			# H3 audio codec (analog part)



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

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:30:26 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
Added Files:
src/sys/arch/arm/sunxi: sunxi_thermal.c

Log Message:
Add driver for thermal sensor controller found in Allwinner H3, A64, and
A83T SoCs.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_thermal.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/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.25 src/sys/arch/arm/sunxi/files.sunxi:1.26
--- src/sys/arch/arm/sunxi/files.sunxi:1.25	Tue Oct  3 23:42:17 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Thu Oct  5 01:30:26 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.25 2017/10/03 23:42:17 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.26 2017/10/05 01:30:26 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -174,6 +174,11 @@ device	sunxisid
 attach	sunxisid at fdt with sunxi_sid
 file	arch/arm/sunxi/sunxi_sid.c		sunxi_sid
 
+# Thermal sensor controller
+device	sunxithermal: sysmon_envsys, sysmon_taskq
+attach	sunxithermal at fdt with sunxi_thermal
+file	arch/arm/sunxi/sunxi_thermal.c		sunxi_thermal
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN5I: SOC_SUNXI

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_thermal.c
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_thermal.c:1.1
--- /dev/null	Thu Oct  5 01:30:26 2017
+++ src/sys/arch/arm/sunxi/sunxi_thermal.c	Thu Oct  5 01:30:26 2017
@@ -0,0 +1,572 @@
+/* $NetBSD: sunxi_thermal.c,v 1.1 2017/10/05 01:30:26 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2016-2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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 INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Allwinner thermal sensor controller
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.1 2017/10/05 01:30:26 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	THS_CTRL0		0x00
+#define	THS_CTRL1		0x04
+#define	 ADC_CALI_EN		(1 << 17)
+#define	THS_CTRL2		0x40
+#define	 SENSOR_ACQ1_SHIFT	16
+#define	 SENSOR2_EN		(1 << 2)
+#define	 SENSOR1_EN		(1 << 1)
+#define	 SENSOR0_EN		(1 << 0)
+#define	THS_INTC		0x44
+#define	THS_INTS		0x48
+#define	 THS2_DATA_IRQ_STS	(1 << 10)
+#define	 THS1_DATA_IRQ_STS	(1 << 9)
+#define	 THS0_DATA_IRQ_STS	(1 << 8)
+#define	 SHUT_INT2_STS		(1 << 6)
+#define	 SHUT_INT1_STS		(1 << 5)
+#define	 SHUT_INT0_STS		(1 << 4)
+#define	 ALARM_INT2_STS		(1 << 2)
+#define	 ALARM_INT1_STS		(1 << 1)
+#define	 ALARM_INT0_STS		(1 << 0)
+#define	THS_ALARM0_CTRL		0x50
+#define	 ALARM_T_HOT_MASK	0xfff
+#define	 ALARM_T_HOT_SHIFT	16
+#define	 ALARM_T_HYST_MASK	0xfff
+#define	 ALARM_T_HYST_SHIFT	0
+#define	THS_SHUTDOWN0_CTRL	0x60
+#define	 SHUT_T_HOT_MASK	0xfff
+#define	 SHUT_T_HOT_SHIFT	16
+#define	THS_FILTER		0x70
+#define	THS_CALIB0		0x74
+#define	THS_CALIB1		0x78
+#define	THS_DATA0		0x80
+#define	THS_DATA1		0x84
+#define	THS_DATA2		0x88
+#define	 DATA_MASK		0xfff
+
+#define	A83T_ADC_ACQUIRE_TIME	0x17
+#define	A83T_FILTER		0x4
+#define	A83T_INTC		0x1000
+#define	A83T_TEMP_BASE		2719000
+#define	A83T_TEMP_MUL		1000
+#define	A83T_TEMP_DIV		14186
+#define	A83T_CLK_RATE		2400
+
+#define	A64_ADC_ACQUIRE_TIME	0x190
+#define	A64_FILTER		0x6
+#define	A64_INTC		0x18000
+#define	A64_TEMP_BASE		217
+#define	A64_TEMP_MUL		1000
+#define	A64_TEMP_DIV		8560
+#define	A64_CLK_RATE		400
+
+#define	H3_ADC_ACQUIRE_TIME	0x3f
+#define	H3_FILTER		0x6
+#define	H3_INTC			0x191000
+#define	H3_TEMP_BASE		217

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

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:29:49 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sun8i_h3_ccu.c

Log Message:
Add thermal sensor clocks


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sunxi/sun8i_h3_ccu.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/sunxi/sun8i_h3_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.12 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.13
--- src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.12	Sat Sep 16 21:47:02 2017
+++ src/sys/arch/arm/sunxi/sun8i_h3_ccu.c	Thu Oct  5 01:29:49 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.12 2017/09/16 21:47:02 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.13 2017/10/05 01:29:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.12 2017/09/16 21:47:02 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.13 2017/10/05 01:29:49 jmcneill Exp $");
 
 #include 
 #include 
@@ -53,6 +53,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu
 #define	BUS_CLK_GATING_REG2	0x068
 #define	BUS_CLK_GATING_REG3	0x06c
 #define	BUS_CLK_GATING_REG4	0x070
+#define	THS_CLK_REG		0x074
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
 #define	SDMMC2_CLK_REG		0x090
@@ -144,6 +145,7 @@ static const char *ahb2_parents[] = { "a
 static const char *apb1_parents[] = { "ahb1" };
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph0" };
 static const char *mod_parents[] = { "hosc", "pll_periph0", "pll_periph1" };
+static const char *ths_parents[] = { "hosc" };
 
 static const struct sunxi_ccu_nkmp_tbl sun8i_h3_cpux_table[] = {
 	{ 6000, 9, 0, 0, 2 },
@@ -286,6 +288,13 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	0,			/* enable */
 	SUNXI_CCU_NM_POWER_OF_TWO),
 
+	SUNXI_CCU_DIV_GATE(H3_CLK_THS, "ths", ths_parents,
+	THS_CLK_REG,	/* reg */
+	__BITS(1,0),	/* div */
+	__BITS(25,24),	/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_DIV_TIMES_TWO),
+
 	SUNXI_CCU_NM(H3_CLK_MMC0, "mmc0", mod_parents,
 	SDMMC0_CLK_REG, __BITS(17, 16), __BITS(3,0), __BITS(25, 24), __BIT(31),
 	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
@@ -344,6 +353,8 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	BUS_CLK_GATING_REG2, 0),
 	SUNXI_CCU_GATE(H3_CLK_BUS_PIO, "bus-pio", "apb1",
 	BUS_CLK_GATING_REG2, 5),
+	SUNXI_CCU_GATE(H3_CLK_BUS_THS, "bus-ths", "apb2",
+	BUS_CLK_GATING_REG2, 8),
 
 	SUNXI_CCU_GATE(H3_CLK_BUS_I2C0, "bus-i2c0", "apb2",
 	BUS_CLK_GATING_REG3, 0),



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

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:29:25 UTC 2017

Added Files:
src/sys/arch/arm/sunxi: sunxi_sid.h

Log Message:
export sunxi_sid_read_tscalib


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_sid.h

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

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_sid.h
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_sid.h:1.1
--- /dev/null	Thu Oct  5 01:29:25 2017
+++ src/sys/arch/arm/sunxi/sunxi_sid.h	Thu Oct  5 01:29:25 2017
@@ -0,0 +1,34 @@
+/* $NetBSD: sunxi_sid.h,v 1.1 2017/10/05 01:29:25 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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 INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _ARM_SUNXI_SID_H
+#define	_ARM_SUNXI_SID_H
+
+int	sunxi_sid_read_tscalib(uint32_t *);
+
+#endif /* !_ARM_SUNXI_SID_H */



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

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:28:47 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_ccu.h sunxi_ccu_div.c

Log Message:
Add support for gated dividers and /1,/2,/4,/6 style divider fields.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sunxi_ccu.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_ccu_div.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/sunxi/sunxi_ccu.h
diff -u src/sys/arch/arm/sunxi/sunxi_ccu.h:1.11 src/sys/arch/arm/sunxi/sunxi_ccu.h:1.12
--- src/sys/arch/arm/sunxi/sunxi_ccu.h:1.11	Sat Sep 30 12:48:58 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu.h	Thu Oct  5 01:28:47 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.h,v 1.11 2017/09/30 12:48:58 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.h,v 1.12 2017/10/05 01:28:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -200,11 +200,15 @@ struct sunxi_ccu_div {
 	u_int		nparents;
 	uint32_t	div;
 	uint32_t	sel;
+	uint32_t	enable;
 	uint32_t	flags;
 #define	SUNXI_CCU_DIV_POWER_OF_TWO	__BIT(0)
 #define	SUNXI_CCU_DIV_ZERO_IS_ONE	__BIT(1)
+#define	SUNXI_CCU_DIV_TIMES_TWO		__BIT(2)
 };
 
+int	sunxi_ccu_div_enable(struct sunxi_ccu_softc *,
+			 struct sunxi_ccu_clk *, int);
 u_int	sunxi_ccu_div_get_rate(struct sunxi_ccu_softc *,
 			   struct sunxi_ccu_clk *);
 int	sunxi_ccu_div_set_rate(struct sunxi_ccu_softc *,
@@ -217,6 +221,11 @@ const char *sunxi_ccu_div_get_parent(str
 
 #define	SUNXI_CCU_DIV(_id, _name, _parents, _reg, _div,		\
 		  _sel, _flags)\
+	SUNXI_CCU_DIV_GATE(_id, _name, _parents, _reg, _div,	\
+			   _sel, 0, _flags)
+
+#define	SUNXI_CCU_DIV_GATE(_id, _name, _parents, _reg, _div,	\
+		  _sel, _enable, _flags)			\
 	[_id] = {		\
 		.type = SUNXI_CCU_DIV,\
 		.base.name = (_name),\
@@ -225,7 +234,9 @@ const char *sunxi_ccu_div_get_parent(str
 		.u.div.nparents = __arraycount(_parents),	\
 		.u.div.div = (_div),\
 		.u.div.sel = (_sel),\
+		.u.div.enable = (_enable),			\
 		.u.div.flags = (_flags),			\
+		.enable = sunxi_ccu_div_enable,			\
 		.get_rate = sunxi_ccu_div_get_rate,		\
 		.set_rate = sunxi_ccu_div_set_rate,		\
 		.set_parent = sunxi_ccu_div_set_parent,		\

Index: src/sys/arch/arm/sunxi/sunxi_ccu_div.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_div.c:1.2 src/sys/arch/arm/sunxi/sunxi_ccu_div.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_ccu_div.c:1.2	Fri Aug 25 00:07:03 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu_div.c	Thu Oct  5 01:28:47 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_div.c,v 1.2 2017/08/25 00:07:03 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_div.c,v 1.3 2017/10/05 01:28:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_div.c,v 1.2 2017/08/25 00:07:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_div.c,v 1.3 2017/10/05 01:28:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -36,6 +36,28 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_di
 
 #include 
 
+int
+sunxi_ccu_div_enable(struct sunxi_ccu_softc *sc, struct sunxi_ccu_clk *clk,
+int enable)
+{
+	struct sunxi_ccu_div *div = >u.div;
+	uint32_t val;
+
+	KASSERT(clk->type == SUNXI_CCU_DIV);
+
+	if (!div->enable)
+		return enable ? 0 : EINVAL;
+
+	val = CCU_READ(sc, div->reg);
+	if (enable)
+		val |= div->enable;
+	else
+		val &= ~div->enable;
+	CCU_WRITE(sc, div->reg, val);
+
+	return 0;
+}
+
 u_int
 sunxi_ccu_div_get_rate(struct sunxi_ccu_softc *sc,
 struct sunxi_ccu_clk *clk)
@@ -66,7 +88,11 @@ sunxi_ccu_div_get_rate(struct sunxi_ccu_
 		ratio = 1;
 	if (div->flags & SUNXI_CCU_DIV_POWER_OF_TWO)
 		ratio = 1 << ratio;
-	else
+	else if (div->flags & SUNXI_CCU_DIV_TIMES_TWO) {
+		ratio = ratio << 1;
+		if (ratio == 0)
+			ratio = 1;
+	} else
 		ratio++;
 
 	return rate / ratio;
@@ -76,7 +102,39 @@ int
 sunxi_ccu_div_set_rate(struct sunxi_ccu_softc *sc,
 struct sunxi_ccu_clk *clk, u_int new_rate)
 {
-	return EINVAL;
+	struct sunxi_ccu_div *div = >u.div;
+	struct clk *clkp, *clkp_parent;
+	uint32_t val, raw_div;
+	int ratio;
+
+	KASSERT(clk->type == SUNXI_CCU_DIV);
+
+	clkp = >base;
+	clkp_parent = clk_get_parent(clkp);
+	if (clkp_parent == NULL)
+		return ENXIO;
+
+	if (div->div == 0)
+		return ENXIO;
+
+	val = CCU_READ(sc, div->reg);
+
+	if ((div->flags & SUNXI_CCU_DIV_TIMES_TWO) != 0) {
+		ratio = howmany(clk_get_rate(clkp_parent), new_rate);
+		if (ratio > 1 && (ratio & 1) != 0)
+			ratio++;
+		raw_div = ratio >> 1;
+		if (raw_div > __SHIFTOUT_MASK(div->div))
+			return ERANGE;
+	} else {
+		return EINVAL;
+	}
+
+	val &= ~div->div;
+	val |= __SHIFTIN(raw_div, div->div);
+	CCU_WRITE(sc, div->reg, val);
+
+	return 0;
 }
 
 int



CVS commit: src/sys/dev/fdt

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:28:02 UTC 2017

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

Log Message:
Listen for PMFE_THROTTLE_* events and limit CPU frequency when throttling
is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/cpufreq_dt.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/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.1 src/sys/dev/fdt/cpufreq_dt.c:1.2
--- src/sys/dev/fdt/cpufreq_dt.c:1.1	Mon Oct  2 22:49:38 2017
+++ src/sys/dev/fdt/cpufreq_dt.c	Thu Oct  5 01:28:01 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.1 2017/10/02 22:49:38 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.2 2017/10/05 01:28:01 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.1 2017/10/02 22:49:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.2 2017/10/05 01:28:01 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,6 +55,9 @@ struct cpufreq_dt_softc {
 	ssize_t			sc_nopp;
 	int			sc_latency;
 
+	u_int			sc_freq_target;
+	bool			sc_freq_throttle;
+
 	u_int			sc_busy;
 
 	char			*sc_freq_available;
@@ -77,6 +80,7 @@ cpufreq_dt_set_rate(struct cpufreq_dt_so
 {
 	struct cpufreq_dt_opp *opp = NULL;
 	u_int old_rate, new_rate, old_uv, new_uv;
+	uint64_t xc;
 	int error;
 	ssize_t n;
 
@@ -117,25 +121,86 @@ cpufreq_dt_set_rate(struct cpufreq_dt_so
 			return error;
 	}
 
+	if (error == 0) {
+		xc = xc_broadcast(0, cpufreq_dt_change_cb, sc, NULL);
+		xc_wait(xc);
+
+		pmf_event_inject(NULL, PMFE_SPEED_CHANGED);
+	}
+
 	return 0;
 }
 
+static void
+cpufreq_dt_throttle_enable(device_t dev)
+{
+	struct cpufreq_dt_softc * const sc = device_private(dev);
+
+	if (sc->sc_freq_throttle)
+		return;
+
+	const u_int freq_khz = sc->sc_opp[sc->sc_nopp - 1].freq_khz;
+
+	while (atomic_cas_uint(>sc_busy, 0, 1) != 0)
+		kpause("throttle", false, 1, NULL);
+
+	if (cpufreq_dt_set_rate(sc, freq_khz) == 0) {
+		aprint_debug_dev(sc->sc_dev, "throttle enabled (%u.%03u MHz)\n",
+		freq_khz / 1000, freq_khz % 1000);
+		sc->sc_freq_throttle = true;
+		if (sc->sc_freq_target == 0)
+			sc->sc_freq_target = clk_get_rate(sc->sc_clk) / 100;
+	}
+
+	atomic_dec_uint(>sc_busy);
+}
+
+static void
+cpufreq_dt_throttle_disable(device_t dev)
+{
+	struct cpufreq_dt_softc * const sc = device_private(dev);
+
+	if (!sc->sc_freq_throttle)
+		return;
+
+	while (atomic_cas_uint(>sc_busy, 0, 1) != 0)
+		kpause("throttle", false, 1, NULL);
+
+	const u_int freq_khz = sc->sc_freq_target * 1000;
+
+	if (cpufreq_dt_set_rate(sc, freq_khz) == 0) {
+		aprint_debug_dev(sc->sc_dev, "throttle disabled (%u.%03u MHz)\n",
+		freq_khz / 1000, freq_khz % 1000);
+		sc->sc_freq_throttle = false;
+	}
+
+	atomic_dec_uint(>sc_busy);
+}
+
 static int
 cpufreq_dt_sysctl_helper(SYSCTLFN_ARGS)
 {
 	struct cpufreq_dt_softc * const sc = rnode->sysctl_data;
 	struct sysctlnode node;
 	u_int fq, oldfq = 0;
-	uint64_t xc;
-	int error;
+	int error, n;
 
 	node = *rnode;
 	node.sysctl_data = 
 
-	fq = clk_get_rate(sc->sc_clk) / 100;
+	if (rnode->sysctl_num == sc->sc_node_target) {
+		if (sc->sc_freq_target == 0)
+			sc->sc_freq_target = clk_get_rate(sc->sc_clk) / 100;
+		fq = sc->sc_freq_target;
+	} else
+		fq = clk_get_rate(sc->sc_clk) / 100;
+
 	if (rnode->sysctl_num == sc->sc_node_target)
 		oldfq = fq;
 
+	if (sc->sc_freq_target == 0)
+		sc->sc_freq_target = fq;
+
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
@@ -143,16 +208,21 @@ cpufreq_dt_sysctl_helper(SYSCTLFN_ARGS)
 	if (fq == oldfq || rnode->sysctl_num != sc->sc_node_target)
 		return 0;
 
+	for (n = 0; n < sc->sc_nopp; n++)
+		if (sc->sc_opp[n].freq_khz / 1000 == fq)
+			break;
+	if (n == sc->sc_nopp)
+		return EINVAL;
+
 	if (atomic_cas_uint(>sc_busy, 0, 1) != 0)
 		return EBUSY;
 
-	error = cpufreq_dt_set_rate(sc, fq * 1000);
-	if (error == 0) {
-		xc = xc_broadcast(0, cpufreq_dt_change_cb, sc, NULL);
-		xc_wait(xc);
+	sc->sc_freq_target = fq;
 
-		pmf_event_inject(NULL, PMFE_SPEED_CHANGED);
-	}
+	if (sc->sc_freq_throttle)
+		error = 0;
+	else
+		error = cpufreq_dt_set_rate(sc, fq * 1000);
 
 	atomic_dec_uint(>sc_busy);
 
@@ -308,6 +378,9 @@ cpufreq_dt_attach(device_t parent, devic
 	aprint_naive("\n");
 	aprint_normal("\n");
 
+	pmf_event_register(self, PMFE_THROTTLE_ENABLE, cpufreq_dt_throttle_enable, true);
+	pmf_event_register(self, PMFE_THROTTLE_DISABLE, cpufreq_dt_throttle_disable, true);
+
 	config_interrupts(self, cpufreq_dt_init);
 }
 



CVS commit: src/sys/sys

2017-10-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  5 01:26:53 UTC 2017

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

Log Message:
Add PMFE_THROTTLE_ENABLE / PMFE_THROTTLE_DISABLE events.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/pmf.h

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

Modified files:

Index: src/sys/sys/pmf.h
diff -u src/sys/sys/pmf.h:1.21 src/sys/sys/pmf.h:1.22
--- src/sys/sys/pmf.h:1.21	Tue Aug  6 06:10:57 2013
+++ src/sys/sys/pmf.h	Thu Oct  5 01:26:53 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pmf.h,v 1.21 2013/08/06 06:10:57 matt Exp $ */
+/* $NetBSD: pmf.h,v 1.22 2017/10/05 01:26:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -51,7 +51,9 @@ typedef enum {
 	PMFE_RADIO_OFF,
 	PMFE_RADIO_TOGGLE,
 	PMFE_POWER_CHANGED,
-	PMFE_SPEED_CHANGED
+	PMFE_SPEED_CHANGED,
+	PMFE_THROTTLE_ENABLE,
+	PMFE_THROTTLE_DISABLE
 } pmf_generic_event_t;
 
 struct pmf_qual {



CVS commit: src

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 23:54:33 UTC 2017

Modified Files:
src: Makefile

Log Message:
Add NOBINARIES, useful to build tools are libraries which is what's needed
for mknative.


To generate a diff of this commit:
cvs rdiff -u -r1.318 -r1.319 src/Makefile

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.318 src/Makefile:1.319
--- src/Makefile:1.318	Tue Apr 11 10:04:15 2017
+++ src/Makefile	Wed Oct  4 19:54:33 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.318 2017/04/11 14:04:15 christos Exp $
+#	$NetBSD: Makefile,v 1.319 2017/10/04 23:54:33 christos Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -30,6 +30,7 @@
 #   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
 #	of the `make build'.
 #   NOINCLUDES will avoid the `make includes' usually done by `make build'.
+#   NOBINARIES will not build binaries, only includes and libraries
 #
 #   See mk.conf(5) for more details.
 #
@@ -234,6 +235,7 @@ BUILDTARGETS+=	includes
 .endif
 BUILDTARGETS+=	do-lib
 BUILDTARGETS+=	do-compat-lib
+.if !defined(NOBINARIES)
 .if ${MKX11} != "no"
 BUILDTARGETS+=	do-x11
 .endif
@@ -242,6 +244,7 @@ BUILDTARGETS+=	do-build
 BUILDTARGETS+=	do-extsrc
 .endif
 BUILDTARGETS+=	do-obsolete
+.endif
 
 #
 # Enforce proper ordering of some rules.



CVS commit: src/distrib/sets/lists/comp

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 23:44:38 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
add stdatomic.h


To generate a diff of this commit:
cvs rdiff -u -r1.2147 -r1.2148 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2147 src/distrib/sets/lists/comp/mi:1.2148
--- src/distrib/sets/lists/comp/mi:1.2147	Tue Sep 26 12:01:58 2017
+++ src/distrib/sets/lists/comp/mi	Wed Oct  4 19:44:38 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2147 2017/09/26 16:01:58 maya Exp $
+#	$NetBSD: mi,v 1.2148 2017/10/04 23:44:38 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -1991,6 +1991,7 @@
 ./usr/include/gcc-4.8/omp.h			comp-gcc-include	gcc=48
 ./usr/include/gcc-5/omp.h			comp-gcc-include	gcc=53
 ./usr/include/gcc-5/openacc.h			comp-gcc-include	gcc=53
+./usr/include/gcc-5/stdatomic.h			comp-gcc-include	gcc=53
 ./usr/include/gelf.hcomp-c-include
 ./usr/include/getopt.hcomp-c-include
 ./usr/include/glob.hcomp-c-include



CVS commit: src/external/gpl3/gcc.old/usr.bin/include

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 23:43:23 UTC 2017

Modified Files:
src/external/gpl3/gcc.old/usr.bin/include: Makefile

Log Message:
Add stdatomic.h


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc.old/usr.bin/include/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.old/usr.bin/include/Makefile
diff -u src/external/gpl3/gcc.old/usr.bin/include/Makefile:1.5 src/external/gpl3/gcc.old/usr.bin/include/Makefile:1.6
--- src/external/gpl3/gcc.old/usr.bin/include/Makefile:1.5	Sat Jul 22 21:12:23 2017
+++ src/external/gpl3/gcc.old/usr.bin/include/Makefile	Wed Oct  4 19:43:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2017/07/23 01:12:23 mrg Exp $
+#	$NetBSD: Makefile,v 1.6 2017/10/04 23:43:23 christos Exp $
 
 .include "../Makefile.inc"
 
@@ -8,6 +8,9 @@
 
 INCS= ${G_EXTRA_HEADERS:T}
 
+# Part of the standard headers, the rest of wich we replace.
+INCS+=	stdatomic.h
+
 # XXX missed some how
 .if ${GCC_MACHINE_ARCH} == "i386" || ${GCC_MACHINE_ARCH} == "x86_64"
 INCS+=	mm_malloc.h



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

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 23:04:42 UTC 2017

Modified Files:
src/sys/arch/hppa/include: mutex.h

Log Message:
const me harder!


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/include/mutex.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/hppa/include/mutex.h
diff -u src/sys/arch/hppa/include/mutex.h:1.12 src/sys/arch/hppa/include/mutex.h:1.13
--- src/sys/arch/hppa/include/mutex.h:1.12	Sun Sep 24 03:39:28 2017
+++ src/sys/arch/hppa/include/mutex.h	Wed Oct  4 19:04:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.12 2017/09/24 07:39:28 christos Exp $	*/
+/*	$NetBSD: mutex.h,v 1.13 2017/10/04 23:04:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -141,13 +141,13 @@ MUTEX_DEBUG_P(const volatile struct kmut
 }
 
 static inline int
-MUTEX_SPIN_P(volatile struct kmutex *mtx)
+MUTEX_SPIN_P(const volatile struct kmutex *mtx)
 {
 	return mtx->mtx_owner == MUTEX_SPIN_FLAG;
 }
 
 static inline int
-MUTEX_ADAPTIVE_P(volatile struct kmutex *mtx)
+MUTEX_ADAPTIVE_P(const volatile struct kmutex *mtx)
 {
 	return mtx->mtx_owner != MUTEX_SPIN_FLAG;
 }



CVS commit: src/sys/lib/libsa

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 22:00:40 UTC 2017

Modified Files:
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
mark first as used for platforms that define PROGRESS to nothing (mvme68k)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.41 src/sys/lib/libsa/loadfile_elf32.c:1.42
--- src/sys/lib/libsa/loadfile_elf32.c:1.41	Mon Sep 25 16:39:21 2017
+++ src/sys/lib/libsa/loadfile_elf32.c	Wed Oct  4 18:00:40 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.41 2017/09/25 20:39:21 maxv Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.42 2017/10/04 22:00:40 christos Exp $ */
 
 /*
  * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -489,7 +489,7 @@ int
 ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
 {
 	Elf_Phdr *phdr;
-	int i, first;
+	int i, first __used;
 	ssize_t sz;
 	Elf_Addr minp = ~0, maxp = 0, pos = 0, elfp = 0;
 	u_long offset = marks[MARK_START];



CVS commit: src/tools/gcc

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 21:42:20 UTC 2017

Modified Files:
src/tools/gcc: mknative-gcc mknative-gcc.old

Log Message:
use the variable for the source dir instead of duplicating it.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/tools/gcc/mknative-gcc
cvs rdiff -u -r1.4 -r1.5 src/tools/gcc/mknative-gcc.old

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

Modified files:

Index: src/tools/gcc/mknative-gcc
diff -u src/tools/gcc/mknative-gcc:1.89 src/tools/gcc/mknative-gcc:1.90
--- src/tools/gcc/mknative-gcc:1.89	Wed Oct  5 15:25:49 2016
+++ src/tools/gcc/mknative-gcc	Wed Oct  4 17:42:20 2017
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mknative-gcc,v 1.89 2016/10/05 19:25:49 christos Exp $
+#	$NetBSD: mknative-gcc,v 1.90 2017/10/04 21:42:20 christos Exp $
 #
 # Shell script for generating all the constants needed for a native
 # platform build of gcc.
@@ -380,7 +380,7 @@ __EOF__
 
 	# special transforms
 	for f in gtyp-input.list; do
-		sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f
+		sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f
 	done
 
 	# special platforms

Index: src/tools/gcc/mknative-gcc.old
diff -u src/tools/gcc/mknative-gcc.old:1.4 src/tools/gcc/mknative-gcc.old:1.5
--- src/tools/gcc/mknative-gcc.old:1.4	Wed Oct  4 17:29:43 2017
+++ src/tools/gcc/mknative-gcc.old	Wed Oct  4 17:42:20 2017
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mknative-gcc.old,v 1.4 2017/10/04 21:29:43 christos Exp $
+#	$NetBSD: mknative-gcc.old,v 1.5 2017/10/04 21:42:20 christos Exp $
 #
 # Shell script for generating all the constants needed for a native
 # platform build of gcc.
@@ -380,7 +380,7 @@ __EOF__
 
 	# special transforms
 	for f in gtyp-input.list; do
-		sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f
+		sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f
 	done
 
 	# special platforms



CVS commit: src/tools/gcc

2017-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct  4 21:29:43 UTC 2017

Modified Files:
src/tools/gcc: Makefile mknative-gcc.old

Log Message:
- gcc.old == gcc-5.3, so copy mknative-gcc{,.old} and adjust
- disable dual libstdc++ abi per joerg
  (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html)
  will require a major libstdc++ major bump.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/tools/gcc/Makefile
cvs rdiff -u -r1.3 -r1.4 src/tools/gcc/mknative-gcc.old

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

Modified files:

Index: src/tools/gcc/Makefile
diff -u src/tools/gcc/Makefile:1.82 src/tools/gcc/Makefile:1.83
--- src/tools/gcc/Makefile:1.82	Tue Aug 22 05:17:50 2017
+++ src/tools/gcc/Makefile	Wed Oct  4 17:29:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.82 2017/08/22 09:17:50 mrg Exp $
+#	$NetBSD: Makefile,v 1.83 2017/10/04 21:29:43 christos Exp $
 
 .include 
 
@@ -8,7 +8,7 @@ MODULE=			gcc4
 GCCDIST=	${.CURDIR}/../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/dist
 GNUHOSTDIST=	${GCCDIST}
 
-.if ${HAVE_GCC} == 48
+.if ${HAVE_GCC} == 53
 MKNATIVE=		${.CURDIR}/mknative-gcc.old
 .endif
 
@@ -35,6 +35,7 @@ COMMON_CONFIGURE_ARGS=	--target=${MACHIN
 			--with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
 			--with-pkgversion="NetBSD ${NETBSD_GCC_VERSION}" \
 			--with-system-zlib \
+			--disable-libstdcxx-dual-abi \
 			--enable-__cxa_atexit \
 			--enable-libstdcxx-time=rt \
 			--enable-libstdcxx-threads
@@ -190,6 +191,7 @@ NATIVE_CONFIGURE_ARGS+=	\
 			--disable-multilib \
 			--disable-symvers \
 			--disable-libstdcxx-pch \
+			--disable-libstdcxx-dual-abi \
 			--build=`${GCCDIST}/config.guess` \
 			--host=${MACHINE_GNU_PLATFORM} \
 			--with-sysroot=${DESTDIR}

Index: src/tools/gcc/mknative-gcc.old
diff -u src/tools/gcc/mknative-gcc.old:1.3 src/tools/gcc/mknative-gcc.old:1.4
--- src/tools/gcc/mknative-gcc.old:1.3	Thu Apr 21 03:22:15 2016
+++ src/tools/gcc/mknative-gcc.old	Wed Oct  4 17:29:43 2017
@@ -1,10 +1,10 @@
 #!/bin/sh
-#	$NetBSD: mknative-gcc.old,v 1.3 2016/04/21 07:22:15 mrg Exp $
+#	$NetBSD: mknative-gcc.old,v 1.4 2017/10/04 21:29:43 christos Exp $
 #
 # Shell script for generating all the constants needed for a native
 # platform build of gcc.
 #
-# This version is for GCC 4.8.
+# This version is for GCC 5.3
 
 # initialise
 
@@ -37,19 +37,6 @@ sanitise_includes () {
 		-e "s,-I/usr/include/[^ 	]*,,"
 }
 
-# lib/crtstuff #
-
-get_crtstuff () {
-	_subdir="$1"
-	mkdir -p $_OUTDIR/lib/$_subdir/arch
-
-	getvars gcc/Makefile \
-		INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS CRTSTUFF_T_CFLAGS_S \
-		tm_defines xm_file xm_defines \
-		| sanitise_includes \
-		| write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk
-}
-
 # lib/libg2c #
 
 get_libg2c () {
@@ -121,7 +108,10 @@ get_libgcov () {
 
 	{
 		getvars $_mf \
-			LIBGCOV
+			LIBGCOV_MERGE \
+			LIBGCOV_PROFILER \
+			LIBGCOV_INTERFACE \
+			LIBGCOV_DRIVER
 	} | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
 
 	write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \
@@ -245,9 +235,13 @@ get_libstdcxx_v3 () {
 		getvars $_PLATFORM/libstdc++-v3/src/Makefile \
 			libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/'
 		getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \
-			libc__11convenience_la_SOURCES | sed 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/'
+			libc__11convenience_la_SOURCES | \
+			sed -e 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' \
+			-e 's/codecvt.cc/c11-codecvt.cc/'
 		getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \
-			libc__98convenience_la_SOURCES | sed 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/'
+			GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \
+			sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' \
+			-e 's/codecvt.cc/c98-codecvt.cc/'
 		getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \
 			BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \
 			CCTYPE_CC  CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \
@@ -277,6 +271,11 @@ get_gcc_bootstrap () {
 	for f in auto-host tm config; do
 		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
 	done
+	# XXXGCC5 don't really want to copy insn-modes as we build
+	# it but libgcc needs to too early yet
+	for f in insn-modes; do
+		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
+	done
 }
 
 get_gcc () {
@@ -307,6 +306,7 @@ get_gcc () {
 			GCC_OBJS GCOV_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \
 			INCLUDES md_file OBJC_OBJS OBJS out_file version \
 			BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \
+			GGC_H \
 			GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \
 			GTFILES GTFILES_LANG_DIR_NAMES NOEXCEPTION_FLAGS \
 			NATIVE_SYSTEM_HEADER_DIR \
@@ -380,13 +380,17 @@ __EOF__
 
 	# 

CVS commit: src/usr.bin/pmap

2017-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Oct  4 11:33:01 UTC 2017

Modified Files:
src/usr.bin/pmap: pmap.c

Log Message:
pmap: Refresh debugging facilities

Print vm_aslr_delta_mmap from 'struct vmspace'.
Print the WANTVA bit of 'flags' from 'struct vm_map'.
Replace %x with %#x, this improves readability of hex vs dec numbers.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/pmap/pmap.c

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

Modified files:

Index: src/usr.bin/pmap/pmap.c
diff -u src/usr.bin/pmap/pmap.c:1.52 src/usr.bin/pmap/pmap.c:1.53
--- src/usr.bin/pmap/pmap.c:1.52	Mon Dec 14 03:15:10 2015
+++ src/usr.bin/pmap/pmap.c	Wed Oct  4 11:33:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.52 2015/12/14 03:15:10 christos Exp $ */
+/*	$NetBSD: pmap.c,v 1.53 2017/10/04 11:33:01 kamil Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: pmap.c,v 1.52 2015/12/14 03:15:10 christos Exp $");
+__RCSID("$NetBSD: pmap.c,v 1.53 2017/10/04 11:33:01 kamil Exp $");
 #endif
 
 #include 
@@ -127,8 +127,10 @@ dump_vm_map(kvm_t *kd, struct kinfo_proc
 		printf(" vm_daddr = %p,\n", D(vmspace, vmspace)->vm_daddr);
 		printf("vm_maxsaddr = %p,",
 		   D(vmspace, vmspace)->vm_maxsaddr);
-		printf(" vm_minsaddr = %p }\n",
+		printf(" vm_minsaddr = %p,\n",
 		   D(vmspace, vmspace)->vm_minsaddr);
+		printf("vm_aslr_delta_mmap = %#zx }\n",
+		   D(vmspace, vmspace)->vm_aslr_delta_mmap);
 	}
 
 	if (debug & PRINT_VM_MAP) {
@@ -144,7 +146,7 @@ dump_vm_map(kvm_t *kd, struct kinfo_proc
 		   D(vm_map, vm_map)->hint);
 		printf("%*sfirst_free = %p,", indent(2), "",
 		   D(vm_map, vm_map)->first_free);
-		printf(" flags = %x <%s%s%s%s >,\n", D(vm_map, vm_map)->flags,
+		printf(" flags = %#x <%s%s%s%s%s >,\n", D(vm_map, vm_map)->flags,
 		   D(vm_map, vm_map)->flags & VM_MAP_PAGEABLE ? " PAGEABLE" : "",
 		   D(vm_map, vm_map)->flags & VM_MAP_WIREFUTURE ? " WIREFUTURE" : "",
 #ifdef VM_MAP_DYING
@@ -154,6 +156,10 @@ dump_vm_map(kvm_t *kd, struct kinfo_proc
 #ifdef VM_MAP_TOPDOWN
 		   D(vm_map, vm_map)->flags & VM_MAP_TOPDOWN ? " TOPDOWN" :
 #endif
+		   "",
+#ifdef VM_MAP_WANTVA
+		   D(vm_map, vm_map)->flags & VM_MAP_WANTVA ? " WANTVA" :
+#endif
 		   "");
 		printf("%*stimestamp = %u }\n", indent(2), "",
 		 D(vm_map, vm_map)->timestamp);
@@ -165,7 +171,7 @@ dump_vm_map(kvm_t *kd, struct kinfo_proc
 		   recurse < 2 ? "MAP" : "SUBMAP", P(vm_map),
 		   vm_map_min(D(vm_map, vm_map)),
 		   vm_map_max(D(vm_map, vm_map)));
-		printf("\t%*s#ent=%d, sz=%"PRIxVSIZE", ref=%d, version=%d, flags=0x%x\n",
+		printf("\t%*s#ent=%d, sz=%"PRIxVSIZE", ref=%d, version=%d, flags=%#x\n",
 		   indent(2), "", D(vm_map, vm_map)->nentries,
 		   D(vm_map, vm_map)->size, D(vm_map, vm_map)->ref_count,
 		   D(vm_map, vm_map)->timestamp, D(vm_map, vm_map)->flags);
@@ -289,20 +295,20 @@ dump_vm_map_entry(kvm_t *kd, struct kinf
 		printf(" object.uvm_obj/sub_map = %p,\n", vme->object.uvm_obj);
 		printf("%*soffset = %" PRIx64 ",", indent(2), "",
 		   vme->offset);
-		printf(" etype = %x <%s%s%s%s >,", vme->etype,
+		printf(" etype = %#x <%s%s%s%s >,", vme->etype,
 		   UVM_ET_ISOBJ(vme) ? " OBJ" : "",
 		   UVM_ET_ISSUBMAP(vme) ? " SUBMAP" : "",
 		   UVM_ET_ISCOPYONWRITE(vme) ? " COW" : "",
 		   UVM_ET_ISNEEDSCOPY(vme) ? " NEEDSCOPY" : "");
-		printf(" protection = %x,\n", vme->protection);
-		printf("%*smax_protection = %x,", indent(2), "",
+		printf(" protection = %#x,\n", vme->protection);
+		printf("%*smax_protection = %#x,", indent(2), "",
 		   vme->max_protection);
 		printf(" inheritance = %d,", vme->inheritance);
 		printf(" wired_count = %d,\n", vme->wired_count);
-		printf("%*saref = { ar_pageoff = %x, ar_amap = %p },",
+		printf("%*saref = { ar_pageoff = %#x, ar_amap = %p },",
 		   indent(2), "", vme->aref.ar_pageoff, vme->aref.ar_amap);
 		printf(" advice = %d,\n", vme->advice);
-		printf("%*sflags = %x <%s%s%s > }\n", indent(2), "",
+		printf("%*sflags = %#x <%s%s%s > }\n", indent(2), "",
 		   vme->flags,
 		   vme->flags & UVM_MAP_KERNEL ? " KERNEL" : "",
 		   vme->flags & UVM_MAP_STATIC ? " STATIC" : "",
@@ -425,7 +431,7 @@ dump_vm_map_entry(kvm_t *kd, struct kinf
 	}
 
 	if (print_ddb) {
-		printf("%*s - %p: %#"PRIxVADDR"->%#"PRIxVADDR": obj=%p/0x%" PRIx64 ", amap=%p/%d\n",
+		printf("%*s - %p: %#"PRIxVADDR"->%#"PRIxVADDR": obj=%p/%#" PRIx64 ", amap=%p/%d\n",
 		   indent(2), "",
 		   P(vm_map_entry), vme->start, vme->end,
 		   vme->object.uvm_obj, vme->offset,
@@ -541,7 +547,7 @@ dump_amap(kvm_t *kd, struct kbit *amap)
 	}
 
 	printf("%*s  amap %p = { am_ref = %d, "
-	   "am_flags = %x,\n"
+	   "am_flags = %#x,\n"
 	   "%*s  

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

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  4 11:03:21 UTC 2017

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

Log Message:
- ixv_enableintr(): Fix a bug that ixv_enable_queue() is called with incorrect
  argument. This bug was added in rev. 1.68.
- Don't check neither VTEICR nor VTEICS same as Linux. It seems that both
  registers can't be used to check which MSI-X vector is triggered. A bit is
  set on very low probability and the bit location is incorrect. Is this an
  errata?


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 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.68 src/sys/dev/pci/ixgbe/ixv.c:1.69
--- src/sys/dev/pci/ixgbe/ixv.c:1.68	Tue Oct  3 03:12:29 2017
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Oct  4 11:03:20 2017
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.68 2017/10/03 03:12:29 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.69 2017/10/04 11:03:20 msaitoh Exp $*/
 
 /**
 
@@ -912,20 +912,13 @@ ixv_msix_mbx(void *arg)
 {
 	struct adapter	*adapter = arg;
 	struct ixgbe_hw *hw = >hw;
-	u32		reg;
 
 	++adapter->link_irq.ev_count;
-
-	/* First get the cause */
-	reg = IXGBE_READ_REG(hw, IXGBE_VTEICR);
-#if 0	/* NetBSD: We use auto-clear, so it's not required to write VTEICR */
-	/* Clear interrupt with write */
-	IXGBE_WRITE_REG(hw, IXGBE_VTEICR, (1 << adapter->vector));
-#endif
+	/* NetBSD: We use auto-clear, so it's not required to write VTEICR */
 
 	/* Link status change */
-	if (reg & (1 << adapter->vector))
-		softint_schedule(adapter->link_si);
+	hw->mac.get_link_status = TRUE;
+	softint_schedule(adapter->link_si);
 
 	IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, (1 << adapter->vector));
 
@@ -1865,6 +1858,7 @@ ixv_enable_intr(struct adapter *adapter)
 
 	/* For VTEIMS */
 	IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, (1 << adapter->vector));
+	que = adapter->queues;
 	for (i = 0; i < adapter->num_queues; i++, que++)
 		ixv_enable_queue(adapter, que->msix);
 



CVS commit: src/sys/sys

2017-10-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Oct  4 09:59:24 UTC 2017

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

Log Message:
Use do {...} while 0; construct for KERNHIST_LINK_STATIC()

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/kernhist.h

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

Modified files:

Index: src/sys/sys/kernhist.h
diff -u src/sys/sys/kernhist.h:1.19 src/sys/sys/kernhist.h:1.20
--- src/sys/sys/kernhist.h:1.19	Wed Oct  4 09:10:37 2017
+++ src/sys/sys/kernhist.h	Wed Oct  4 09:59:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernhist.h,v 1.19 2017/10/04 09:10:37 skrll Exp $	*/
+/*	$NetBSD: kernhist.h,v 1.20 2017/10/04 09:59:24 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -148,8 +148,10 @@ extern	struct kern_history_head kern_his
 #define KERNHIST_DEFINE(NAME) struct kern_history NAME
 
 #define KERNHIST_LINK_STATIC(NAME) \
+do { \
 	LIST_INSERT_HEAD(_histories, &(NAME), list); \
-	sysctl_kernhist_new(&(NAME));
+	sysctl_kernhist_new(&(NAME)); \
+} while (/*CONSTCOND*/ 0)
 
 #define KERNHIST_INIT(NAME,N) \
 do { \
@@ -160,7 +162,7 @@ do { \
 	(NAME).e = (struct kern_history_ent *) \
 		kmem_zalloc(sizeof(struct kern_history_ent) * (N), KM_SLEEP); \
 	(NAME).s = 0; \
-	KERNHIST_LINK_STATIC(NAME) \
+	KERNHIST_LINK_STATIC(NAME); \
 } while (/*CONSTCOND*/ 0)
 
 #define KERNHIST_INITIALIZER(NAME,BUF) \
@@ -183,7 +185,7 @@ do { \
 	(NAME).e = (struct kern_history_ent *) (BUF); \
 	(NAME).s = 0; \
 	memset((NAME).e, 0, sizeof(struct kern_history_ent) * (NAME).n); \
-	KERNHIST_LINK_STATIC(NAME) \
+	KERNHIST_LINK_STATIC(NAME); \
 } while (/*CONSTCOND*/ 0)
 
 #ifndef KERNHIST_DELAY



CVS commit: src/sys/arch/amiga/dev

2017-10-04 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Wed Oct  4 09:44:09 UTC 2017

Modified Files:
src/sys/arch/amiga/dev: mntva.c mntvareg.h mntvavar.h zbus.c

Log Message:
Update driver to support firmware v1.5+.

>From Lukas F. Hartmann. With hopeful style fixes from me.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amiga/dev/mntva.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amiga/dev/mntvareg.h \
src/sys/arch/amiga/dev/mntvavar.h
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/amiga/dev/zbus.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/amiga/dev/mntva.c
diff -u src/sys/arch/amiga/dev/mntva.c:1.2 src/sys/arch/amiga/dev/mntva.c:1.3
--- src/sys/arch/amiga/dev/mntva.c:1.2	Sun Oct 23 18:40:52 2016
+++ src/sys/arch/amiga/dev/mntva.c	Wed Oct  4 09:44:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mntva.c,v 1.2 2016/10/23 18:40:52 phx Exp $	*/
+/*	$NetBSD: mntva.c,v 1.3 2017/10/04 09:44:09 rkujawa Exp $	*/
 
 /*
  * Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.		
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mntva.c,v 1.2 2016/10/23 18:40:52 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mntva.c,v 1.3 2017/10/04 09:44:09 rkujawa Exp $");
 
 #include 
 #include 
@@ -147,7 +147,7 @@ mntva_attach(device_t parent, device_t s
 	sc->sc_isconsole = true;
 #endif /* MNTVA_CONSOLE */
 
-	printf(": MNTMN VA2000");
+	printf(": MNT VA2000");
 
 	if(sc->sc_isconsole)
 		printf(" (console)");
@@ -161,16 +161,16 @@ mntva_attach(device_t parent, device_t s
 	sc->sc_bst.absm = _bus_stride_1;
 	sc->sc_iot = >sc_bst;
 
-	if (bus_space_map(sc->sc_iot, MNTVA_OFF_FB, sc->sc_memsize + 0x1000,
-	BUS_SPACE_MAP_LINEAR, >sc_fbh)) {
-		aprint_error_dev(sc->sc_dev, "mapping framebuffer failed\n");
-		return;
-	}
 	if (bus_space_map(sc->sc_iot, MNTVA_OFF_REG, MNTVA_REG_SIZE , 0,
 	>sc_regh)) {
 		aprint_error_dev(sc->sc_dev, "mapping registers failed\n");
 		return;
 	}
+	if (bus_space_map(sc->sc_iot, MNTVA_OFF_FB, sc->sc_memsize,
+	BUS_SPACE_MAP_LINEAR, >sc_fbh)) {
+		aprint_error_dev(sc->sc_dev, "mapping framebuffer failed\n");
+		return;
+	}
 
 	sc->sc_regpa = (bus_addr_t) kvtop((void*) sc->sc_regh);
 	sc->sc_fbpa = (bus_addr_t) kvtop((void*) sc->sc_fbh);
@@ -223,13 +223,13 @@ mntva_attach(device_t parent, device_t s
 		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
 
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
-defattr);
+		 defattr);
 		vcons_replay_msgbuf(>sc_console_screen);
 	} else {
-		if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
+		if (sc->sc_console_screen.scr_ri.ri_rows == 0)
 			vcons_init_screen(>vd, >sc_console_screen, 1,
-	);
-		} else
+			);
+		else
 			(*ri->ri_ops.allocattr)(ri, 0, 0, 0, );
 	}
 
@@ -298,9 +298,25 @@ mntva_init_screen(void *cookie, struct v
 static bool
 mntva_mode_set(struct mntva_softc *sc)
 {
+	mntva_reg_write(sc, MNTVA_CAPTURE_MODE, 0);
+	
+	mntva_reg_write(sc, MNTVA_H_SYNC_START, 1390);
+	mntva_reg_write(sc, MNTVA_H_SYNC_END, 1430);
+	mntva_reg_write(sc, MNTVA_H_MAX, 1650);
+	mntva_reg_write(sc, MNTVA_V_SYNC_START, 725);
+	mntva_reg_write(sc, MNTVA_V_SYNC_END, 730);
+	mntva_reg_write(sc, MNTVA_V_MAX, 750);
+	mntva_reg_write(sc, MNTVA_PIXEL_CLK_SEL, MNTVA_CLK_75MHZ);
+	
 	mntva_reg_write(sc, MNTVA_SCALEMODE, 0);
 	mntva_reg_write(sc, MNTVA_SCREENW, sc->sc_width);
 	mntva_reg_write(sc, MNTVA_SCREENH, sc->sc_height);
+	mntva_reg_write(sc, MNTVA_ROW_PITCH, 2048);
+	mntva_reg_write(sc, MNTVA_ROW_PITCH_SHIFT, 11);
+	mntva_reg_write(sc, MNTVA_BLITTER_ROW_PITCH, 2048);
+	mntva_reg_write(sc, MNTVA_BLITTER_ROW_PITCH_SHIFT, 11);
+	mntva_reg_write(sc, MNTVA_MARGIN_X, 8);
+	mntva_reg_write(sc, MNTVA_SAFE_X, 0x50);
 
 	if (sc->sc_bpp == 8)
 		mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE8);
@@ -314,9 +330,6 @@ mntva_mode_set(struct mntva_softc *sc)
 	mntva_reg_write(sc, MNTVA_BLITTERBASEHI, 0);
 	mntva_reg_write(sc, MNTVA_BLITTERBASELO, 0);
 	
-	/* XXX: should rectfill with bg color taken from wscons? */
-	mntva_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height, 0x);
-
 	return true;
 }
 
@@ -577,7 +590,7 @@ mntva_mmap(void *v, void *vs, off_t offs
 
 	if (offset >= 0 && offset < sc->sc_memsize) {
 		pa = bus_space_mmap(sc->sc_iot, sc->sc_fbpa, offset, prot,
-			BUS_SPACE_MAP_LINEAR);
+		 BUS_SPACE_MAP_LINEAR);
 		return pa;
 	}	
 

Index: src/sys/arch/amiga/dev/mntvareg.h
diff -u src/sys/arch/amiga/dev/mntvareg.h:1.1 src/sys/arch/amiga/dev/mntvareg.h:1.2
--- src/sys/arch/amiga/dev/mntvareg.h:1.1	Mon Oct  3 14:26:02 2016
+++ src/sys/arch/amiga/dev/mntvareg.h	Wed Oct  4 09:44:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mntvareg.h,v 1.1 2016/10/03 14:26:02 rkujawa Exp $  */
+/*	$NetBSD: mntvareg.h,v 1.2 2017/10/04 09:44:09 rkujawa Exp $  */
 
 /*
  * Copyright (c) 2012, 2016 The NetBSD Foundation, Inc. 
@@ -34,10 +34,10 @@
 #define MNTVA2000REG_H
 
 /* address space */
-#define MNTVA_OFF_REG		0x5f	/* 

CVS commit: src/sys/sys

2017-10-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct  4 09:10:37 UTC 2017

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

Log Message:
Call sysctl_kernhist_new for KERNHIST_LINK_STATIC.  I can get usbhist from
vmstat(1) again.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/sys/kernhist.h

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

Modified files:

Index: src/sys/sys/kernhist.h
diff -u src/sys/sys/kernhist.h:1.18 src/sys/sys/kernhist.h:1.19
--- src/sys/sys/kernhist.h:1.18	Tue Jan 10 00:50:57 2017
+++ src/sys/sys/kernhist.h	Wed Oct  4 09:10:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernhist.h,v 1.18 2017/01/10 00:50:57 pgoyette Exp $	*/
+/*	$NetBSD: kernhist.h,v 1.19 2017/10/04 09:10:37 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -147,6 +147,10 @@ extern	struct kern_history_head kern_his
 #define KERNHIST_DECL(NAME) extern struct kern_history NAME
 #define KERNHIST_DEFINE(NAME) struct kern_history NAME
 
+#define KERNHIST_LINK_STATIC(NAME) \
+	LIST_INSERT_HEAD(_histories, &(NAME), list); \
+	sysctl_kernhist_new(&(NAME));
+
 #define KERNHIST_INIT(NAME,N) \
 do { \
 	(NAME).name = __STRING(NAME); \
@@ -156,8 +160,7 @@ do { \
 	(NAME).e = (struct kern_history_ent *) \
 		kmem_zalloc(sizeof(struct kern_history_ent) * (N), KM_SLEEP); \
 	(NAME).s = 0; \
-	LIST_INSERT_HEAD(_histories, &(NAME), list); \
-	sysctl_kernhist_new(&(NAME)); \
+	KERNHIST_LINK_STATIC(NAME) \
 } while (/*CONSTCOND*/ 0)
 
 #define KERNHIST_INITIALIZER(NAME,BUF) \
@@ -171,9 +174,6 @@ do { \
 	/* BUF will inititalized to zeroes by being in .bss */ \
 }
 
-#define KERNHIST_LINK_STATIC(NAME) \
-	LIST_INSERT_HEAD(_histories, &(NAME), list)
-
 #define KERNHIST_INIT_STATIC(NAME,BUF) \
 do { \
 	(NAME).name = __STRING(NAME); \
@@ -183,8 +183,7 @@ do { \
 	(NAME).e = (struct kern_history_ent *) (BUF); \
 	(NAME).s = 0; \
 	memset((NAME).e, 0, sizeof(struct kern_history_ent) * (NAME).n); \
-	KERNHIST_LINK_STATIC(NAME); \
-	sysctl_kernhist_new(&(NAME)); \
+	KERNHIST_LINK_STATIC(NAME) \
 } while (/*CONSTCOND*/ 0)
 
 #ifndef KERNHIST_DELAY



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

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  4 08:47:26 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_type.h ixgbe_x540.c

Log Message:
 Add 2.5GBASE-T and 5GBASE-T support. (forgotten in the last commit)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_x540.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.28 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.29
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.28	Tue Oct  3 02:55:37 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Wed Oct  4 08:47:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.28 2017/10/03 02:55:37 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.29 2017/10/04 08:47:26 msaitoh Exp $ */
 
 /**
 
@@ -3424,6 +3424,8 @@ typedef u64 ixgbe_physical_layer;
 #define IXGBE_PHYSICAL_LAYER_1000BASE_SX	0x04000
 #define IXGBE_PHYSICAL_LAYER_10BASE_T		0x08000
 #define IXGBE_PHYSICAL_LAYER_2500BASE_KX	0x1
+#define IXGBE_PHYSICAL_LAYER_2500BASE_T		0x2
+#define IXGBE_PHYSICAL_LAYER_5GBASE_T		0x4
 
 /* Flow Control Data Sheet defined values
  * Calculation and defines taken from 802.1bb Annex O

Index: src/sys/dev/pci/ixgbe/ixgbe_x540.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.10 src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.11
--- src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.10	Wed Aug 30 08:49:18 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c	Wed Oct  4 08:47:26 2017
@@ -350,6 +350,11 @@ u64 ixgbe_get_supported_physical_layer_X
 	if (ext_ability & IXGBE_MDIO_PHY_100BASETX_ABILITY)
 		physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
 
+	if (hw->mac.type == ixgbe_mac_X550) {
+		physical_layer |= IXGBE_PHYSICAL_LAYER_2500BASE_T
+		| IXGBE_PHYSICAL_LAYER_5GBASE_T;
+	}
+
 	return physical_layer;
 }
 



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

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  4 07:13:00 UTC 2017

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

Log Message:
- Remove half-duplex setting for more than 1000Mbps in ixgbe_add_media_types()
  because those medias are not in the spec.
- Add 2.5GBASE-T and 5GBASE-T support. Tested with X550-T1.

Example:
ixg0: flags=0x8843 mtu 1500
capabilities=fff80
capabilities=fff80
capabilities=fff80
enabled=7ff80
enabled=7ff80
enabled=7ff80
ec_capabilities=7
ec_enabled=7
address: a0:36:9f:b0:f5:b0
media: Ethernet 2.5GBASE-T full-duplex
status: active
supported Ethernet media:
media 10Gbase-T
media 10Gbase-T mediaopt full-duplex
media 1000baseT
media 1000baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media 2.5GBASE-T mediaopt full-duplex
media 5GBASE-T mediaopt full-duplex
media autoselect
inet 172.16.0.1/24 broadcast 172.16.0.255 flags 0x0
inet6 fe80::a236:9fff:feb0:f5b0%ixg0/64 flags 0x0 scopeid 0x1


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.102 src/sys/dev/pci/ixgbe/ixgbe.c:1.103
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.102	Wed Oct  4 06:19:47 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Oct  4 07:13:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.102 2017/10/04 06:19:47 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.103 2017/10/04 07:13:00 msaitoh Exp $ */
 
 /**
 
@@ -1303,7 +1303,6 @@ ixgbe_add_media_types(struct adapter *ad
 
 	/* Media types with matching NetBSD media defines */
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) {
-		ADD(IFM_10G_T, 0);
 		ADD(IFM_10G_T | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T) {
@@ -1321,54 +1320,43 @@ ixgbe_add_media_types(struct adapter *ad
 
 	if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU ||
 	layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA) {
-		ADD(IFM_10G_TWINAX, 0);
 		ADD(IFM_10G_TWINAX | IFM_FDX, 0);
 	}
 
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LR) {
-		ADD(IFM_10G_LR, 0);
 		ADD(IFM_10G_LR | IFM_FDX, 0);
 		if (hw->phy.multispeed_fiber) {
-			ADD(IFM_1000_LX, 0);
 			ADD(IFM_1000_LX | IFM_FDX, 0);
 		}
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR) {
-		ADD(IFM_10G_SR, 0);
 		ADD(IFM_10G_SR | IFM_FDX, 0);
 		if (hw->phy.multispeed_fiber) {
-			ADD(IFM_1000_SX, 0);
 			ADD(IFM_1000_SX | IFM_FDX, 0);
 		}
 	} else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) {
-		ADD(IFM_1000_SX, 0);
 		ADD(IFM_1000_SX | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4) {
-		ADD(IFM_10G_CX4, 0);
 		ADD(IFM_10G_CX4 | IFM_FDX, 0);
 	}
 
 #ifdef IFM_ETH_XTYPE
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
-		ADD(IFM_10G_KR, 0);
 		ADD(IFM_10G_KR | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
-		ADD(AIFM_10G_KX4, 0);
 		ADD(AIFM_10G_KX4 | IFM_FDX, 0);
 	}
 #else
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
 		device_printf(dev, "Media supported: 10GbaseKR\n");
 		device_printf(dev, "10GbaseKR mapped to 10GbaseSR\n");
-		ADD(IFM_10G_SR, 0);
 		ADD(IFM_10G_SR | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
 		device_printf(dev, "Media supported: 10GbaseKX4\n");
 		device_printf(dev, "10GbaseKX4 mapped to 10GbaseCX4\n");
-		ADD(IFM_10G_CX4, 0);
 		ADD(IFM_10G_CX4 | IFM_FDX, 0);
 	}
 #endif
@@ -1377,9 +1365,14 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_1000_KX | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX) {
-		ADD(IFM_2500_KX, 0);
 		ADD(IFM_2500_KX | IFM_FDX, 0);
 	}
+	if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_T) {
+		ADD(IFM_2500_T | IFM_FDX, 0);
+	}
+	if (layer & IXGBE_PHYSICAL_LAYER_5GBASE_T) {
+		ADD(IFM_5000_T | IFM_FDX, 0);
+	}
 	if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
 		device_printf(dev, "Media supported: 1000baseBX\n");
 	/* XXX no ifmedia_set? */
@@ -2490,6 +2483,8 @@ ixgbe_media_status(struct ifnet *ifp, st
 	layer = adapter->phy_layer;
 
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T ||
+	layer & IXGBE_PHYSICAL_LAYER_5GBASE_T ||
+	layer & IXGBE_PHYSICAL_LAYER_2500BASE_T ||
 	layer & IXGBE_PHYSICAL_LAYER_1000BASE_T ||
 	

CVS commit: src/sys/net

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  4 07:08:01 UTC 2017

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

Log Message:
 Add 2.5GBASE-T and 5GBASE-T.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/net/if_media.h

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

Modified files:

Index: src/sys/net/if_media.h
diff -u src/sys/net/if_media.h:1.60 src/sys/net/if_media.h:1.61
--- src/sys/net/if_media.h:1.60	Wed Oct  4 07:07:16 2017
+++ src/sys/net/if_media.h	Wed Oct  4 07:08:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.h,v 1.60 2017/10/04 07:07:16 msaitoh Exp $	*/
+/*	$NetBSD: if_media.h,v 1.61 2017/10/04 07:08:01 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -224,6 +224,8 @@
 #define	IFM_10G_T	26		/* 10GBase-T - RJ45 */
 #define	IFM_1000_KX	27		/* 1000base-KX backplane */
 #define	IFM_2500_KX	28		/* 2500base-KX backplane */
+#define	IFM_2500_T	29		/* 2500base-T - RJ45 */
+#define	IFM_5000_T	30		/* 5Gbase-T - RJ45 */
 /* IFM_OMASK bits */
 #define	IFM_ETH_MASTER	0x0100	/* master mode (1000baseT) */
 #define	IFM_ETH_RXPAUSE	0x0200	/* receive PAUSE frames */
@@ -394,6 +396,10 @@ struct ifmedia_description {
 	{ IFM_ETHER | IFM_HPNA_1,	"HPNA1" },			\
 	{ IFM_ETHER | IFM_2500_KX | IFM_FDX,	"2500BASE-KX" },	\
 	{ IFM_ETHER | IFM_2500_KX | IFM_FDX,	"2500baseKX" },		\
+	{ IFM_ETHER | IFM_2500_T | IFM_FDX,	"2.5GBASE-T" },		\
+	{ IFM_ETHER | IFM_2500_T | IFM_FDX,	"2500baseT" },		\
+	{ IFM_ETHER | IFM_5000_T | IFM_FDX,	"5GBASE-T" },		\
+	{ IFM_ETHER | IFM_5000_T | IFM_FDX,	"5GbaseT" },		\
 	{ IFM_ETHER | IFM_10G_LR | IFM_FDX,	"10GbaseLR" },		\
 	{ IFM_ETHER | IFM_10G_LR | IFM_FDX,	"10GLR" },		\
 	{ IFM_ETHER | IFM_10G_LR | IFM_FDX,	"10GBASE-LR" },		\
@@ -549,6 +555,8 @@ struct ifmedia_baudrate {
 	{ IFM_ETHER | IFM_10G_T,	IF_Gbps(10) },			\
 	{ IFM_ETHER | IFM_1000_KX,	IF_Mbps(1000ULL) },		\
 	{ IFM_ETHER | IFM_2500_KX,	IF_Mbps(2500ULL) },		\
+	{ IFM_ETHER | IFM_2500_T,	IF_Mbps(2500ULL) },		\
+	{ IFM_ETHER | IFM_5000_T,	IF_Mbps(5000ULL) },		\
 	\
 	{ IFM_TOKEN | IFM_TOK_STP4,	IF_Mbps(4) },			\
 	{ IFM_TOKEN | IFM_TOK_STP16,	IF_Mbps(16) },			\



CVS commit: src/sys/net

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  4 07:07:16 UTC 2017

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

Log Message:
 All Ethernet media more than 1000Mbps don't support half duplex.
For the convinience, ifconfig without "mediaopt fullduplex" sets IFM_FDX
automatically for those medias. Without this change, "ifconfig xxN mediaopt
10Gbase-T" (without "mediaopt fullduplex") returns EINVAL if a
driver doesn't call ifmedia_add() without IFM_FDX because ifmedia_match()
returns NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/net/if_media.h

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

Modified files:

Index: src/sys/net/if_media.h
diff -u src/sys/net/if_media.h:1.59 src/sys/net/if_media.h:1.60
--- src/sys/net/if_media.h:1.59	Thu Jun  8 02:27:30 2017
+++ src/sys/net/if_media.h	Wed Oct  4 07:07:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.h,v 1.59 2017/06/08 02:27:30 msaitoh Exp $	*/
+/*	$NetBSD: if_media.h,v 1.60 2017/10/04 07:07:16 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -392,23 +392,23 @@ struct ifmedia_description {
 	{ IFM_ETHER | IFM_1000_T,	"1000BASE-T" },			\
 	{ IFM_ETHER | IFM_HPNA_1,	"HomePNA1" },			\
 	{ IFM_ETHER | IFM_HPNA_1,	"HPNA1" },			\
-	{ IFM_ETHER | IFM_2500_KX,	"2500BASE-KX" },		\
-	{ IFM_ETHER | IFM_2500_KX,	"2500baseKX" },			\
-	{ IFM_ETHER | IFM_10G_LR,	"10GbaseLR" },			\
-	{ IFM_ETHER | IFM_10G_LR,	"10GLR" },			\
-	{ IFM_ETHER | IFM_10G_LR,	"10GBASE-LR" },			\
-	{ IFM_ETHER | IFM_10G_SR,	"10GbaseSR" },			\
-	{ IFM_ETHER | IFM_10G_SR,	"10GSR" },			\
-	{ IFM_ETHER | IFM_10G_SR,	"10GBASE-SR" },			\
-	{ IFM_ETHER | IFM_10G_LRM,	"10Gbase-LRM" },		\
-	{ IFM_ETHER | IFM_10G_TWINAX,	"10Gbase-Twinax" },		\
-	{ IFM_ETHER | IFM_10G_TWINAX_LONG,	"10Gbase-Twinax-Long" },\
-	{ IFM_ETHER | IFM_10G_T,	"10Gbase-T" },			\
-	{ IFM_ETHER | IFM_10G_CX4,	"10GbaseCX4" },			\
-	{ IFM_ETHER | IFM_10G_CX4,	"10GCX4" },			\
-	{ IFM_ETHER | IFM_10G_CX4,	"10GBASE-CX4" },		\
-	{ IFM_ETHER | IFM_2500_SX,	"2500baseSX" },			\
-	{ IFM_ETHER | IFM_2500_SX,	"2500SX" },			\
+	{ IFM_ETHER | IFM_2500_KX | IFM_FDX,	"2500BASE-KX" },	\
+	{ IFM_ETHER | IFM_2500_KX | IFM_FDX,	"2500baseKX" },		\
+	{ IFM_ETHER | IFM_10G_LR | IFM_FDX,	"10GbaseLR" },		\
+	{ IFM_ETHER | IFM_10G_LR | IFM_FDX,	"10GLR" },		\
+	{ IFM_ETHER | IFM_10G_LR | IFM_FDX,	"10GBASE-LR" },		\
+	{ IFM_ETHER | IFM_10G_SR | IFM_FDX,	"10GbaseSR" },		\
+	{ IFM_ETHER | IFM_10G_SR | IFM_FDX,	"10GSR" },		\
+	{ IFM_ETHER | IFM_10G_SR | IFM_FDX,	"10GBASE-SR" },		\
+	{ IFM_ETHER | IFM_10G_LRM | IFM_FDX,	"10Gbase-LRM" },	\
+	{ IFM_ETHER | IFM_10G_TWINAX | IFM_FDX,	"10Gbase-Twinax" }, 	\
+	{ IFM_ETHER | IFM_10G_TWINAX_LONG | IFM_FDX, "10Gbase-Twinax-Long" },\
+	{ IFM_ETHER | IFM_10G_T | IFM_FDX,	"10Gbase-T" },		\
+	{ IFM_ETHER | IFM_10G_CX4 | IFM_FDX,	"10GbaseCX4" },		\
+	{ IFM_ETHER | IFM_10G_CX4 | IFM_FDX,	"10GCX4" },		\
+	{ IFM_ETHER | IFM_10G_CX4 | IFM_FDX,	"10GBASE-CX4" }, 	\
+	{ IFM_ETHER | IFM_2500_SX | IFM_FDX,	"2500baseSX" },		\
+	{ IFM_ETHER | IFM_2500_SX | IFM_FDX,	"2500SX" },		\
 	\
 	{ IFM_TOKEN | IFM_TOK_STP4,	"DB9/4Mbit" },			\
 	{ IFM_TOKEN | IFM_TOK_STP4,	"4STP" },			\



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

2017-10-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct  4 06:19:47 UTC 2017

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

Log Message:
 Fix a bug that X550EM (Denverton) can't force 10BaseT.


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

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.101 src/sys/dev/pci/ixgbe/ixgbe.c:1.102
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.101	Wed Sep 27 10:31:29 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Oct  4 06:19:47 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.101 2017/09/27 10:31:29 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.102 2017/10/04 06:19:47 msaitoh Exp $ */
 
 /**
 
@@ -2691,7 +2691,7 @@ ixgbe_media_change(struct ifnet *ifp)
 		if ((speed & IXGBE_LINK_SPEED_100_FULL) != 0)
 			adapter->advertise |= 1 << 0;
 		if ((speed & IXGBE_LINK_SPEED_10_FULL) != 0)
-			adapter->advertise |= 1 << 4;
+			adapter->advertise |= 1 << 3;
 	}
 
 	return (0);