CVS commit: src/sys/dev/pci

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  3 04:56:59 UTC 2018

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

Log Message:
- Print Power Management Control/status register in 32bit.
- Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/pci/pci_subr.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.201 src/sys/dev/pci/pci_subr.c:1.202
--- src/sys/dev/pci/pci_subr.c:1.201	Wed May  9 03:50:51 2018
+++ src/sys/dev/pci/pci_subr.c	Tue Jul  3 04:56:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.201 2018/05/09 03:50:51 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.202 2018/07/03 04:56:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.201 2018/05/09 03:50:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.202 2018/07/03 04:56:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1172,11 +1172,9 @@ static void
 pci_conf_print_pcipm_cap(const pcireg_t *regs, int capoff)
 {
 	uint16_t caps, pmcsr;
-	pcireg_t reg;
 
 	caps = regs[o2i(capoff)] >> PCI_PMCR_SHIFT;
-	reg = regs[o2i(capoff + PCI_PMCSR)];
-	pmcsr = reg & 0x;
+	pmcsr = regs[o2i(capoff + PCI_PMCSR)];
 
 	printf("\n  PCI Power Management Capabilities Register\n");
 
@@ -1195,7 +1193,7 @@ pci_conf_print_pcipm_cap(const pcireg_t 
 	onoff("PME# support D3 hot", caps, PCI_PMCR_PME_D3HOT);
 	onoff("PME# support D3 cold", caps, PCI_PMCR_PME_D3COLD);
 
-	printf("Control/status register: 0x%04x\n", pmcsr);
+	printf("Control/status register: 0x%08x\n", pmcsr);
 	printf("  Power state: D%d\n", pmcsr & PCI_PMCSR_STATE_MASK);
 	onoff("PCI Express reserved", (pmcsr >> 2), 1);
 	onoff("No soft reset", pmcsr, PCI_PMCSR_NO_SOFTRST);
@@ -1207,11 +1205,11 @@ pci_conf_print_pcipm_cap(const pcireg_t 
 	__SHIFTOUT(pmcsr, PCI_PMCSR_DATASCL_MASK));
 	onoff("PME# status", pmcsr, PCI_PMCSR_PME_STS);
 	printf("Bridge Support Extensions register: 0x%02x\n",
-	(reg >> 16) & 0xff);
-	onoff("B2/B3 support", reg, PCI_PMCSR_B2B3_SUPPORT);
-	onoff("Bus Power/Clock Control Enable", reg, PCI_PMCSR_BPCC_EN);
-	printf("Data register: 0x%02x\n", __SHIFTOUT(reg, PCI_PMCSR_DATA));
-	
+	(pmcsr >> 16) & 0xff);
+	onoff("B2/B3 support", pmcsr, PCI_PMCSR_B2B3_SUPPORT);
+	onoff("Bus Power/Clock Control Enable", pmcsr, PCI_PMCSR_BPCC_EN);
+	printf("Data register: 0x%02x\n",
+	   __SHIFTOUT(pmcsr, PCI_PMCSR_DATA));
 }
 
 /* XXX pci_conf_print_vpd_cap */



CVS commit: src/sys/dev/pci

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  3 04:56:59 UTC 2018

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

Log Message:
- Print Power Management Control/status register in 32bit.
- Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/pci/pci_subr.c

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



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

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  3 04:02:07 UTC 2018

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

Log Message:
 Remove nmbclusters check. We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.

 The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 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.161 src/sys/dev/pci/ixgbe/ixgbe.c:1.162
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.161	Wed Jun  6 20:02:31 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Jul  3 04:02:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.161 2018/06/06 20:02:31 kamil Exp $ */
+/* $NetBSD: ixgbe.c,v 1.162 2018/07/03 04:02:06 msaitoh Exp $ */
 
 /**
 
@@ -394,9 +394,6 @@ static int ixgbe_enable_rss = 1;
 SYSCTL_INT(_hw_ix, OID_AUTO, enable_rss, CTLFLAG_RDTUN, _enable_rss, 0,
 "Enable Receive-Side Scaling (RSS)");
 
-/* Keep running tab on them for sanity check */
-static int ixgbe_total_ports;
-
 #if 0
 static int (*ixgbe_start_locked)(struct ifnet *, struct tx_ring *);
 static int (*ixgbe_ring_empty)(struct ifnet *, pcq_t *);
@@ -931,21 +928,6 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_tx_desc = ixgbe_txd;
 
-	/*
-	 * With many RX rings it is easy to exceed the
-	 * system mbuf allocation. Tuning nmbclusters
-	 * can alleviate this.
-	 */
-	if (nmbclusters > 0) {
-		int s;
-		s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports;
-		if (s > nmbclusters) {
-			aprint_error_dev(dev, "RX Descriptors exceed "
-			"system mbuf max, using default instead!\n");
-			ixgbe_rxd = DEFAULT_RXD;
-		}
-	}
-
 	if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
 	ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) {
 		aprint_error_dev(dev, "RXD config issue, using default!\n");
@@ -5958,7 +5940,6 @@ ixgbe_lookup(const struct pci_attach_arg
 			(ent->subvendor_id == 0)) &&
 		((PCI_SUBSYS_ID(subid) == ent->subdevice_id) ||
 			(ent->subdevice_id == 0))) {
-			++ixgbe_total_ports;
 			return ent;
 		}
 	}



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

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  3 04:02:07 UTC 2018

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

Log Message:
 Remove nmbclusters check. We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.

 The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.


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

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



CVS commit: src/sbin/gpt

2018-07-02 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Tue Jul  3 03:41:24 UTC 2018

Modified Files:
src/sbin/gpt: add.c gpt.c gpt.h label.c migrate.c recover.c remove.c
resize.c restore.c type.c

Log Message:
Not all things that write to the disk do something that dk(4) will
be interested in.  Let individual commands decide if ioctl(DIOCMWEDGES)
should be done.  I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sbin/gpt/add.c
cvs rdiff -u -r1.74 -r1.75 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.37 -r1.38 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.28 -r1.29 src/sbin/gpt/label.c
cvs rdiff -u -r1.32 -r1.33 src/sbin/gpt/migrate.c
cvs rdiff -u -r1.17 -r1.18 src/sbin/gpt/recover.c src/sbin/gpt/restore.c
cvs rdiff -u -r1.21 -r1.22 src/sbin/gpt/remove.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/gpt/resize.c
cvs rdiff -u -r1.14 -r1.15 src/sbin/gpt/type.c

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

Modified files:

Index: src/sbin/gpt/add.c
diff -u src/sbin/gpt/add.c:1.43 src/sbin/gpt/add.c:1.44
--- src/sbin/gpt/add.c:1.43	Tue Dec 29 16:45:04 2015
+++ src/sbin/gpt/add.c	Tue Jul  3 03:41:23 2018
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.43 2015/12/29 16:45:04 christos Exp $");
+__RCSID("$NetBSD: add.c,v 1.44 2018/07/03 03:41:23 jnemeth Exp $");
 #endif
 
 #include 
@@ -62,7 +62,7 @@ struct gpt_cmd c_add = {
 	"add",
 	cmd_add,
 	addhelp, __arraycount(addhelp),
-	0,
+	GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, _add)

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.74 src/sbin/gpt/gpt.c:1.75
--- src/sbin/gpt/gpt.c:1.74	Tue Feb 13 00:34:11 2018
+++ src/sbin/gpt/gpt.c	Tue Jul  3 03:41:23 2018
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.74 2018/02/13 00:34:11 sevan Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.75 2018/07/03 03:41:23 jnemeth Exp $");
 #endif
 
 #include 
@@ -587,7 +587,7 @@ void
 gpt_close(gpt_t gpt)
 {
 
-	if (!(gpt->flags & GPT_MODIFIED))
+	if (!(gpt->flags & GPT_MODIFIED) || !(gpt->flags & GPT_SYNC))
 		goto out;
 
 	if (!(gpt->flags & GPT_NOSYNC)) {

Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.37 src/sbin/gpt/gpt.h:1.38
--- src/sbin/gpt/gpt.h:1.37	Mon Mar 19 09:06:20 2018
+++ src/sbin/gpt/gpt.h	Tue Jul  3 03:41:23 2018
@@ -81,6 +81,7 @@ gpt_t	gpt_open(const char *, int, int, o
 #define GPT_NOSYNC	0x08
 #define GPT_FILE	0x10
 #define GPT_TIMESTAMP	0x20
+#define GPT_SYNC	0x40
 #define GPT_OPTDEV  0x8000
 
 void*	gpt_read(gpt_t, off_t, size_t);

Index: src/sbin/gpt/label.c
diff -u src/sbin/gpt/label.c:1.28 src/sbin/gpt/label.c:1.29
--- src/sbin/gpt/label.c:1.28	Fri Dec  4 01:47:48 2015
+++ src/sbin/gpt/label.c	Tue Jul  3 03:41:24 2018
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.28 2015/12/04 01:47:48 christos Exp $");
+__RCSID("$NetBSD: label.c,v 1.29 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include 
@@ -62,7 +62,7 @@ struct gpt_cmd c_label = {
 	"label",
 	cmd_label,
 	labelhelp, __arraycount(labelhelp),
-	0,
+	GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, _label)

Index: src/sbin/gpt/migrate.c
diff -u src/sbin/gpt/migrate.c:1.32 src/sbin/gpt/migrate.c:1.33
--- src/sbin/gpt/migrate.c:1.32	Thu Jun  9 19:04:43 2016
+++ src/sbin/gpt/migrate.c	Tue Jul  3 03:41:24 2018
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: migrate.c,v 1.32 2016/06/09 19:04:43 christos Exp $");
+__RCSID("$NetBSD: migrate.c,v 1.33 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include 
@@ -88,7 +88,7 @@ struct gpt_cmd c_migrate = {
 	"migrate",
 	cmd_migrate,
 	migratehelp, __arraycount(migratehelp),
-	0,
+	GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, _migrate)

Index: src/sbin/gpt/recover.c
diff -u src/sbin/gpt/recover.c:1.17 src/sbin/gpt/recover.c:1.18
--- src/sbin/gpt/recover.c:1.17	Wed Mar 22 19:59:16 2017
+++ src/sbin/gpt/recover.c	Tue Jul  3 03:41:24 2018
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: recover.c,v 1.17 2017/03/22 19:59:16 martin Exp $");
+__RCSID("$NetBSD: recover.c,v 1.18 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include 
@@ -59,7 +59,7 @@ struct gpt_cmd c_recover = {
 	"recover",
 	cmd_recover,
 	recoverhelp, __arraycount(recoverhelp),
-	0,
+	GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, _recover)
Index: src/sbin/gpt/restore.c
diff -u src/sbin/gpt/restore.c:1.17 src/sbin/gpt/restore.c:1.18
--- src/sbin/gpt/restore.c:1.17	Thu Sep  7 10:23:33 

CVS commit: src/sbin/gpt

2018-07-02 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Tue Jul  3 03:41:24 UTC 2018

Modified Files:
src/sbin/gpt: add.c gpt.c gpt.h label.c migrate.c recover.c remove.c
resize.c restore.c type.c

Log Message:
Not all things that write to the disk do something that dk(4) will
be interested in.  Let individual commands decide if ioctl(DIOCMWEDGES)
should be done.  I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sbin/gpt/add.c
cvs rdiff -u -r1.74 -r1.75 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.37 -r1.38 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.28 -r1.29 src/sbin/gpt/label.c
cvs rdiff -u -r1.32 -r1.33 src/sbin/gpt/migrate.c
cvs rdiff -u -r1.17 -r1.18 src/sbin/gpt/recover.c src/sbin/gpt/restore.c
cvs rdiff -u -r1.21 -r1.22 src/sbin/gpt/remove.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/gpt/resize.c
cvs rdiff -u -r1.14 -r1.15 src/sbin/gpt/type.c

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



CVS commit: src/sys

2018-07-02 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jul  3 03:37:04 UTC 2018

Modified Files:
src/sys/kern: init_main.c
src/sys/net: if.c if.h
src/sys/rump/net/lib/libnet: net_component.c

Log Message:
Fix net.inet6.ip6.ifq node doesn't exist

The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.

sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@


To generate a diff of this commit:
cvs rdiff -u -r1.497 -r1.498 src/sys/kern/init_main.c
cvs rdiff -u -r1.428 -r1.429 src/sys/net/if.c
cvs rdiff -u -r1.263 -r1.264 src/sys/net/if.h
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/net/lib/libnet/net_component.c

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

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.497 src/sys/kern/init_main.c:1.498
--- src/sys/kern/init_main.c:1.497	Mon Apr 16 14:51:59 2018
+++ src/sys/kern/init_main.c	Tue Jul  3 03:37:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.497 2018/04/16 14:51:59 kamil Exp $	*/
+/*	$NetBSD: init_main.c,v 1.498 2018/07/03 03:37:03 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.497 2018/04/16 14:51:59 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.498 2018/07/03 03:37:03 ozaki-r Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -572,6 +572,7 @@ main(void)
 	lltableinit();
 #endif
 	domaininit(true);
+	ifinit_post();
 	if_attachdomain();
 	splx(s);
 

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.428 src/sys/net/if.c:1.429
--- src/sys/net/if.c:1.428	Tue Jun 26 06:48:02 2018
+++ src/sys/net/if.c	Tue Jul  3 03:37:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.428 2018/06/26 06:48:02 msaitoh Exp $	*/
+/*	$NetBSD: if.c,v 1.429 2018/07/03 03:37:03 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.428 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.429 2018/07/03 03:37:03 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -279,8 +279,6 @@ void
 ifinit(void)
 {
 
-	if_sysctl_setup(NULL);
-
 #if (defined(INET) || defined(INET6))
 	encapinit();
 #endif
@@ -323,6 +321,14 @@ ifinit1(void)
 #endif
 }
 
+/* XXX must be after domaininit() */
+void
+ifinit_post(void)
+{
+
+	if_sysctl_setup(NULL);
+}
+
 ifnet_t *
 if_alloc(u_char type)
 {

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.263 src/sys/net/if.h:1.264
--- src/sys/net/if.h:1.263	Thu Jun 21 10:37:49 2018
+++ src/sys/net/if.h	Tue Jul  3 03:37:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.263 2018/06/21 10:37:49 knakahara Exp $	*/
+/*	$NetBSD: if.h,v 1.264 2018/07/03 03:37:03 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1090,6 +1090,7 @@ void	if_link_state_change_softint(struct
 void	if_up(struct ifnet *);
 void	ifinit(void);
 void	ifinit1(void);
+void	ifinit_post(void);
 int	ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *);
 extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *);
 int	ifioctl_common(struct ifnet *, u_long, void *);

Index: src/sys/rump/net/lib/libnet/net_component.c
diff -u src/sys/rump/net/lib/libnet/net_component.c:1.9 src/sys/rump/net/lib/libnet/net_component.c:1.10
--- src/sys/rump/net/lib/libnet/net_component.c:1.9	Thu Feb 16 08:39:10 2017
+++ src/sys/rump/net/lib/libnet/net_component.c	Tue Jul  3 03:37:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_component.c,v 1.9 2017/02/16 08:39:10 knakahara Exp $	*/
+/*	$NetBSD: net_component.c,v 1.10 2018/07/03 03:37:03 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_component.c,v 1.9 2017/02/16 08:39:10 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_component.c,v 1.10 2018/07/03 03:37:03 ozaki-r Exp $");
 
 #include 
 #include 
@@ -65,5 +65,6 @@ RUMP_COMPONENT(RUMP_COMPONENT_NET_ROUTE)
 RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
 {
 
+	ifinit_post();
 	loopinit();
 }



CVS commit: src/sys

2018-07-02 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jul  3 03:37:04 UTC 2018

Modified Files:
src/sys/kern: init_main.c
src/sys/net: if.c if.h
src/sys/rump/net/lib/libnet: net_component.c

Log Message:
Fix net.inet6.ip6.ifq node doesn't exist

The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.

sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@


To generate a diff of this commit:
cvs rdiff -u -r1.497 -r1.498 src/sys/kern/init_main.c
cvs rdiff -u -r1.428 -r1.429 src/sys/net/if.c
cvs rdiff -u -r1.263 -r1.264 src/sys/net/if.h
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/net/lib/libnet/net_component.c

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



CVS commit: src/usr.bin/printf

2018-07-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul  3 01:56:39 UTC 2018

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

Log Message:
Avoid printing error messages twice when an invalid
escape sequence (\ sequence) is present in an arg to a %b
conversion.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/printf/printf.c

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



CVS commit: src/usr.bin/printf

2018-07-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul  3 01:56:39 UTC 2018

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

Log Message:
Avoid printing error messages twice when an invalid
escape sequence (\ sequence) is present in an arg to a %b
conversion.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/printf/printf.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/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.38 src/usr.bin/printf/printf.c:1.39
--- src/usr.bin/printf/printf.c:1.38	Tue Jul  3 01:54:42 2018
+++ src/usr.bin/printf/printf.c	Tue Jul  3 01:56:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.38 2018/07/03 01:54:42 kre Exp $	*/
+/*	$NetBSD: printf.c,v 1.39 2018/07/03 01:56:39 kre Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.38 2018/07/03 01:54:42 kre Exp $");
+__RCSID("$NetBSD: printf.c,v 1.39 2018/07/03 01:56:39 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -65,8 +65,8 @@ __RCSID("$NetBSD: printf.c,v 1.38 2018/0
 #define ESCAPE 033
 #endif
 
-static void	 conv_escape_str(char *, void (*)(int));
-static char	*conv_escape(char *, char *);
+static void	 conv_escape_str(char *, void (*)(int), int);
+static char	*conv_escape(char *, char *, int);
 static char	*conv_expand(const char *);
 static char	 getchr(void);
 static double	 getdouble(void);
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
 		for (fmt = format; (ch = *fmt++) != '\0';) {
 			if (ch == '\\') {
 char c_ch;
-fmt = conv_escape(fmt, _ch);
+fmt = conv_escape(fmt, _ch, 0);
 putchar(c_ch);
 continue;
 			}
@@ -241,7 +241,7 @@ int main(int argc, char *argv[])
 t = NULL;
 /* Count number of bytes we want to output */
 b_length = 0;
-conv_escape_str(cp, b_count);
+conv_escape_str(cp, b_count, 0);
 t = malloc(b_length + 1);
 if (t == NULL)
 	goto out;
@@ -254,7 +254,7 @@ int main(int argc, char *argv[])
 	goto out;
 b_fmt = a;
 /* Output leading spaces and data bytes */
-conv_escape_str(cp, b_output);
+conv_escape_str(cp, b_output, 1);
 /* Add any trailing spaces */
 printf("%s", b_fmt);
 break;
@@ -357,7 +357,7 @@ b_output(int ch)
  *	Halts processing string if a \c escape is encountered.
  */
 static void
-conv_escape_str(char *str, void (*do_putchar)(int))
+conv_escape_str(char *str, void (*do_putchar)(int), int quiet)
 {
 	int value;
 	int ch;
@@ -415,7 +415,7 @@ conv_escape_str(char *str, void (*do_put
 		}
 
 		/* Finally test for sequences valid in the format string */
-		str = conv_escape(str - 1, );
+		str = conv_escape(str - 1, , quiet);
 		do_putchar(c);
 	}
 }
@@ -424,7 +424,7 @@ conv_escape_str(char *str, void (*do_put
  * Print "standard" escape characters 
  */
 static char *
-conv_escape(char *str, char *conv_ch)
+conv_escape(char *str, char *conv_ch, int quiet)
 {
 	char value;
 	char ch;
@@ -434,7 +434,8 @@ conv_escape(char *str, char *conv_ch)
 
 	switch (ch) {
 	case '\0':
-		warnx("incomplete escape sequence");
+		if (!quiet)
+			warnx("incomplete escape sequence");
 		rval = 1;
 		value = '\\';
 		--str;
@@ -477,7 +478,8 @@ conv_escape(char *str, char *conv_ch)
 	case 'v':	value = '\v';	break;	/* vertical-tab */
 
 	default:
-		warnx("unknown escape sequence `\\%c'", ch);
+		if (!quiet)
+			warnx("unknown escape sequence `\\%c'", ch);
 		rval = 1;
 		value = ch;
 		break;



CVS commit: src/usr.bin/printf

2018-07-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul  3 01:54:42 UTC 2018

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

Log Message:
>From leot@ on tech-userlevel:

Avoid running off into oblivion when a format string,
or arg to a %b conversion ends in an unescaped backslash.

Patch from Leo slightly modified by me.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/printf/printf.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/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.37 src/usr.bin/printf/printf.c:1.38
--- src/usr.bin/printf/printf.c:1.37	Tue Jun 16 22:54:10 2015
+++ src/usr.bin/printf/printf.c	Tue Jul  3 01:54:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.37 2015/06/16 22:54:10 christos Exp $	*/
+/*	$NetBSD: printf.c,v 1.38 2018/07/03 01:54:42 kre Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.37 2015/06/16 22:54:10 christos Exp $");
+__RCSID("$NetBSD: printf.c,v 1.38 2018/07/03 01:54:42 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -433,6 +433,13 @@ conv_escape(char *str, char *conv_ch)
 	ch = *str++;
 
 	switch (ch) {
+	case '\0':
+		warnx("incomplete escape sequence");
+		rval = 1;
+		value = '\\';
+		--str;
+		break;
+
 	case '0': case '1': case '2': case '3':
 	case '4': case '5': case '6': case '7':
 		num_buf[0] = ch;



CVS commit: src/usr.bin/printf

2018-07-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul  3 01:54:42 UTC 2018

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

Log Message:
>From leot@ on tech-userlevel:

Avoid running off into oblivion when a format string,
or arg to a %b conversion ends in an unescaped backslash.

Patch from Leo slightly modified by me.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/printf/printf.c

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:54:53 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c exynos_var.h

Log Message:
Make the pinctrl driver actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/samsung/exynos_gpio.c \
src/sys/arch/arm/samsung/exynos_var.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.23 src/sys/arch/arm/samsung/exynos_gpio.c:1.24
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.23	Thu Dec 31 03:50:34 2015
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Mon Jul  2 23:54:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.24 2018/07/02 23:54:52 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.24 2018/07/02 23:54:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -262,24 +262,46 @@ exynos_gpio_pin_ctl(void *cookie, int pi
 	exynos_gpio_update_cfg_regs(bank, );
 }
 
-void exynos_gpio_pin_ctl_read(const struct exynos_gpio_bank *bank,
-			  struct exynos_gpio_pin_cfg *cfg)
-{
-	cfg->cfg = GPIO_READ(bank, EXYNOS_GPIO_CON);
-	cfg->pud = GPIO_READ(bank, EXYNOS_GPIO_PUD);
-	cfg->drv = GPIO_READ(bank, EXYNOS_GPIO_DRV);
-	cfg->conpwd = GPIO_READ(bank, EXYNOS_GPIO_CONPWD);
-	cfg->pudpwd = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD);
-}
-
 void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *bank,
-			   const struct exynos_gpio_pin_cfg *cfg)
+			   const struct exynos_gpio_pin_cfg *cfg,
+			   int pin)
 {
-		GPIO_WRITE(bank, EXYNOS_GPIO_CON, cfg->cfg);
-		GPIO_WRITE(bank, EXYNOS_GPIO_PUD, cfg->pud);
-		GPIO_WRITE(bank, EXYNOS_GPIO_DRV, cfg->drv);
-		GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, cfg->conpwd);
-		GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, cfg->pudpwd);
+	uint32_t val;
+
+	if (cfg->cfg_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_CON);
+		val &= ~(0xf << (pin * 4));
+		val |= (cfg->cfg << (pin * 4));
+		GPIO_WRITE(bank, EXYNOS_GPIO_CON, val);
+	}
+
+	if (cfg->pud_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_PUD);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->pud << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_PUD, val);
+	}
+
+	if (cfg->drv_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_DRV);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->drv << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_DRV, val);
+	}
+
+	if (cfg->conpwd_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_CONPWD);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->conpwd << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, val);
+	}
+
+	if (cfg->pudpwd_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->pudpwd << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, val);
+	}
 }
 
 struct exynos_gpio_softc *
Index: src/sys/arch/arm/samsung/exynos_var.h
diff -u src/sys/arch/arm/samsung/exynos_var.h:1.23 src/sys/arch/arm/samsung/exynos_var.h:1.24
--- src/sys/arch/arm/samsung/exynos_var.h:1.23	Wed Dec 30 04:30:27 2015
+++ src/sys/arch/arm/samsung/exynos_var.h	Mon Jul  2 23:54:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_var.h,v 1.23 2015/12/30 04:30:27 marty Exp $	*/
+/*	$NetBSD: exynos_var.h,v 1.24 2018/07/02 23:54:52 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -106,10 +106,15 @@ struct exynos_gpio_pindata {
 
 struct exynos_gpio_pin_cfg {
 	uint32_t cfg;
+	int cfg_valid;
 	uint32_t pud;
+	int pud_valid;
 	uint32_t drv;
+	int drv_valid;
 	uint32_t conpwd;
+	int conpwd_valid;
 	uint32_t pudpwd;
+	int pudpwd_valid;
 };
 
 struct exynos_gpio_softc {
@@ -170,10 +175,9 @@ extern void exynos_gpio_pinset_release(c
 extern void exynos_gpio_pinset_to_pindata(const struct exynos_gpio_pinset *,
 	int pinnr, struct exynos_gpio_pindata *);
 extern bool exynos_gpio_pin_reserve(const char *, struct exynos_gpio_pindata *);
-extern void exynos_gpio_pin_ctl_read(const struct exynos_gpio_bank *,
- struct exynos_gpio_pin_cfg *);
 extern void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *,
-  const struct exynos_gpio_pin_cfg *);
+  const struct exynos_gpio_pin_cfg *,
+  int);
 static inline void
 exynos_gpio_pindata_write(const struct exynos_gpio_pindata *pd, int value)
 {

Index: src/sys/arch/arm/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.12 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.13
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.12	Sun Jul  2 18:21:52 2017
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Mon Jul  2 23:54:52 2018
@@ -1,4 +1,4 @@
-/*	

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:54:53 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c exynos_var.h

Log Message:
Make the pinctrl driver actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/samsung/exynos_gpio.c \
src/sys/arch/arm/samsung/exynos_var.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_pinctrl.c

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:52:54 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
No need to use hold reg when updating clocks, and auto-discover some values.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.6 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.7
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.6	Mon Jul  2 20:28:24 2018
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Mon Jul  2 23:52:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_dwcmm
 #include 
 #include 
 
-#define	FIFO_REG	0x200
 #define	MPS_BEGIN	0x200
 #define	MPS_END		0x204
 #define	MPS_CTRL	0x20c
@@ -94,7 +93,6 @@ exynos_dwcmmc_attach(device_t parent, de
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
-	u_int fifo_depth;
 	int error;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -102,9 +100,6 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
-	if (of_getprop_uint32(phandle, "fifo-depth", _depth)) {
-		fifo_depth = 64;
-	}
 	if (of_getprop_uint32(phandle, "samsung,dw-mshc-ciu-div", >sc_ciu_div)) {
 		aprint_error(": missing samsung,dw-mshc-ciu-div property\n");
 		return;
@@ -143,9 +138,8 @@ exynos_dwcmmc_attach(device_t parent, de
 	}
 
 	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (esc->sc_ciu_div + 1);
-	sc->sc_fifo_depth = fifo_depth;
-	sc->sc_fifo_reg = FIFO_REG;
-	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
+	of_getprop_uint32(phandle, "fifo-depth", >sc_fifo_depth);
+	sc->sc_flags = DWC_MMC_F_DMA;
 	sc->sc_bus_clock = exynos_dwcmmc_bus_clock;
 
 	esc->sc_pin_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:52:54 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
No need to use hold reg when updating clocks, and auto-discover some values.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_dwcmmc.c

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:28:24 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Set module clock on rate changes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.5 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.6
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.5	Thu Jun 22 06:42:38 2017
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Mon Jul  2 20:28:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.5 2017/06/22 06:42:38 skrll Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.5 2017/06/22 06:42:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -56,12 +56,14 @@ static int	exynos_dwcmmc_match(device_t,
 static void	exynos_dwcmmc_attach(device_t, device_t, void *);
 
 static int	exynos_dwcmmc_card_detect(struct dwc_mmc_softc *);
+static int	exynos_dwcmmc_bus_clock(struct dwc_mmc_softc *, int);
 
 struct exynos_dwcmmc_softc {
 	struct dwc_mmc_softc	sc;
 	struct clk		*sc_clk_biu;
 	struct clk		*sc_clk_ciu;
 	struct fdtbus_gpio_pin	*sc_pin_cd;
+	u_int			sc_ciu_div;
 };
 
 CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(struct dwc_mmc_softc),
@@ -92,7 +94,7 @@ exynos_dwcmmc_attach(device_t parent, de
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
-	u_int ciu_div, fifo_depth;
+	u_int fifo_depth;
 	int error;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -100,13 +102,10 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
-	//if (of_getprop_uint32(phandle, "bus-width", _width)) {
-	//	bus_width = 4;
-	//}
 	if (of_getprop_uint32(phandle, "fifo-depth", _depth)) {
 		fifo_depth = 64;
 	}
-	if (of_getprop_uint32(phandle, "samsung,dw-mshc-ciu-div", _div)) {
+	if (of_getprop_uint32(phandle, "samsung,dw-mshc-ciu-div", >sc_ciu_div)) {
 		aprint_error(": missing samsung,dw-mshc-ciu-div property\n");
 		return;
 	}
@@ -143,10 +142,11 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
-	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (ciu_div + 1);
+	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (esc->sc_ciu_div + 1);
 	sc->sc_fifo_depth = fifo_depth;
 	sc->sc_fifo_reg = FIFO_REG;
 	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
+	sc->sc_bus_clock = exynos_dwcmmc_bus_clock;
 
 	esc->sc_pin_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",
 	GPIO_PIN_INPUT);
@@ -193,3 +193,25 @@ exynos_dwcmmc_card_detect(struct dwc_mmc
 
 	return fdtbus_gpio_read(esc->sc_pin_cd);
 }
+
+static int
+exynos_dwcmmc_bus_clock(struct dwc_mmc_softc *sc, int rate)
+{
+	struct exynos_dwcmmc_softc *esc = device_private(sc->sc_dev);
+	const int ciu_div = esc->sc_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 Hz: %d\n",
+		rate * ciu_div * 1000, error);
+		return error;
+	}
+
+	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / ciu_div;
+
+	aprint_debug_dev(sc->sc_dev, "set clock rate to %u Hz (target %u Hz)\n",
+	sc->sc_clock_freq, rate * 1000);
+
+	return 0;
+}



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:28:24 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Set module clock on rate changes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_dwcmmc.c

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:24:55 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c

Log Message:
Fix a stupid bug in exynos*_clock_set_rate_div


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5410_clock.c
diff -u src/sys/arch/arm/samsung/exynos5410_clock.c:1.2 src/sys/arch/arm/samsung/exynos5410_clock.c:1.3
--- src/sys/arch/arm/samsung/exynos5410_clock.c:1.2	Tue Jun 20 17:43:51 2017
+++ src/sys/arch/arm/samsung/exynos5410_clock.c	Mon Jul  2 20:24:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5410_clock.c,v 1.2 2017/06/20 17:43:51 skrll Exp $ */
+/* $NetBSD: exynos5410_clock.c,v 1.3 2018/07/02 20:24:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.2 2017/06/20 17:43:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.3 2018/07/02 20:24:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -669,7 +669,7 @@ exynos5410_clock_set_rate_div(struct exy
 	clk_parent = exynos5410_clock_get_parent(sc, >base);
 	const u_int parent_rate = exynos5410_clock_get_rate(sc, clk_parent);
 
-	for (tmp_div = 0; tmp_div < popcount32(ediv->bits); tmp_div++) {
+	for (tmp_div = 0; tmp_div < __SHIFTOUT_MASK(ediv->bits); tmp_div++) {
 		tmp_rate = parent_rate / (tmp_div + 1);
 		if (tmp_rate <= rate) {
 			new_div = tmp_div;

Index: src/sys/arch/arm/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.6 src/sys/arch/arm/samsung/exynos5422_clock.c:1.7
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.6	Mon Jun 19 21:59:55 2017
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Mon Jul  2 20:24:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.6 2017/06/19 21:59:55 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.6 2017/06/19 21:59:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -747,7 +747,7 @@ exynos5422_clock_set_rate_div(struct exy
 	clk_parent = exynos5422_clock_get_parent(sc, >base);
 	const u_int parent_rate = exynos5422_clock_get_rate(sc, clk_parent);
 
-	for (tmp_div = 0; tmp_div < popcount32(ediv->bits); tmp_div++) {
+	for (tmp_div = 0; tmp_div < __SHIFTOUT_MASK(ediv->bits); tmp_div++) {
 		tmp_rate = parent_rate / (tmp_div + 1);
 		if (tmp_rate <= rate) {
 			new_div = tmp_div;



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:24:55 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c

Log Message:
Fix a stupid bug in exynos*_clock_set_rate_div


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos5422_clock.c

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



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 17:50:02 UTC 2018

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

Log Message:
When searching for interrupt parent, stop as soon as we see an
interrupt-controller property on a node other than the starting node.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/fdt_intr.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/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.14 src/sys/dev/fdt/fdt_intr.c:1.15
--- src/sys/dev/fdt/fdt_intr.c:1.14	Mon Jul  2 16:06:50 2018
+++ src/sys/dev/fdt/fdt_intr.c	Mon Jul  2 17:50:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.14 2018/07/02 16:06:50 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.15 2018/07/02 17:50:02 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.14 2018/07/02 16:06:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.15 2018/07/02 17:50:02 jmcneill Exp $");
 
 #include 
 #include 
@@ -56,18 +56,42 @@ struct fdtbus_interrupt_cookie {
 static u_int *	get_specifier_by_index(int, int, int *);
 static u_int *	get_specifier_from_map(int, const u_int *, int *);
 
+/*
+ * Find the interrupt controller for a given node. This function will either
+ * return the phandle of the interrupt controller for this node, or the phandle
+ * of a node containing an interrupt-map table that can be used to find the
+ * real interrupt controller.
+ */
 static int
 fdtbus_get_interrupt_parent(int phandle)
 {
 	int iparent = phandle;
 
 	do {
+		/*
+		 * If the node is an interrupt-controller, we are done. Note that
+		 * a node cannot be an interrupt-controller for itself, so we skip
+		 * the leaf node here.
+		 */
+		if (phandle != iparent && of_hasprop(iparent, "interrupt-controller"))
+			return iparent;
+
+		/*
+		 * If the node has an explicit interrupt-parent, follow the reference.
+		 */
 		if (of_hasprop(iparent, "interrupt-parent"))
 			return fdtbus_get_phandle(iparent, "interrupt-parent");
-		else if (of_hasprop(iparent, "interrupt-controller"))
-			return iparent;
-		else if (of_hasprop(iparent, "interrupt-map"))
+
+		/*
+		 * If the node has an interrupt-map, use it. The caller is responsible
+		 * for parsing the interrupt-map and finding the real interrupt parent.
+		 */
+		if (of_hasprop(iparent, "interrupt-map"))
 			return iparent;
+
+		/*
+		 * Continue searching up the tree.
+		 */
 		iparent = OF_parent(iparent);
 	} while (iparent > 0);
 



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 17:50:02 UTC 2018

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

Log Message:
When searching for interrupt parent, stop as soon as we see an
interrupt-controller property on a node other than the starting node.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/fdt_intr.c

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



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

2018-07-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jul  2 17:13:16 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
catch up to upstream dts changes/additions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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/sun50i-h5-nanopi-neo-plus2.dts
diff -u src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.2 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.3
--- src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.2	Sun Jan 28 18:31:41 2018
+++ src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts	Mon Jul  2 17:13:15 2018
@@ -1,76 +1,12 @@
-/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.2 2018/01/28 18:31:41 jmcneill Exp $ */
-
-/*
- *  and _mdio portions lifted from
- * src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
- * which is ..
- */
-
-/*
- * Copyright (C) 2017 Icenowy Zheng 
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This file is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
+/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.3 2018/07/02 17:13:15 jakllsch Exp $ */
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts"
 #include "sun50i-h5.dtsi"
 
- {
-	pinctrl-names = "default";
-	pinctrl-0 = <_rgmii_pins>;
-	phy-supply = <_gmac_3v3>;
-	phy-handle = <_rgmii_phy>;
-	phy-mode = "rgmii";
-	status = "okay";
-};
-
-_mdio {
-	ext_rgmii_phy: ethernet-phy@7 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <7>;
-	};
-};
-
 / {
 	cpus {
 		cpu@0 {
-			cpu-supply = <_cpux>;
+			cpu-supply = <_cpux>;
 			operating-points = <
 /* kHz	  uV */
 1152000	110
@@ -81,11 +17,4 @@
 >;
 		};
 	};
-
-	vcc_cpux: reg_vcc_cpux {
-		compatible = "regulator-fixed";
-		regulator-name = "cpux-1v1";
-		regulator-min-microvolt = <110>;
-		regulator-max-microvolt = <110>;
-	};
 };



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

2018-07-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jul  2 17:13:16 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
catch up to upstream dts changes/additions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 16:36:50 UTC 2018

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

Log Message:
Attach cpufreq scaling provider to ourself, as cpus doesn't do this anymore


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/fdt/cpu_fdt.c

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 16:36:50 UTC 2018

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

Log Message:
Attach cpufreq scaling provider to ourself, as cpus doesn't do this anymore


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/fdt/cpu_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/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.7 src/sys/arch/arm/fdt/cpu_fdt.c:1.8
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.7	Fri Jun 22 23:46:04 2018
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Mon Jul  2 16:36:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.7 2018/06/22 23:46:04 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.8 2018/07/02 16:36:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.7 2018/06/22 23:46:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.8 2018/07/02 16:36:49 jmcneill Exp $");
 
 #include 
 #include 
@@ -146,4 +146,7 @@ cpu_fdt_attach(device_t parent, device_t
 
 	/* Attach the CPU */
 	cpu_attach(self, cpuid);
+
+	/* Attach CPU frequency scaling provider */
+	config_found(self, faa, NULL);
 }



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 16:06:50 UTC 2018

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

Log Message:
Fix a regression with interrupt-map handling in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/fdt/fdt_intr.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/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.13 src/sys/dev/fdt/fdt_intr.c:1.14
--- src/sys/dev/fdt/fdt_intr.c:1.13	Mon Jul  2 12:17:05 2018
+++ src/sys/dev/fdt/fdt_intr.c	Mon Jul  2 16:06:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.13 2018/07/02 12:17:05 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.14 2018/07/02 16:06:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.13 2018/07/02 12:17:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.14 2018/07/02 16:06:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -59,29 +59,19 @@ static u_int *	get_specifier_from_map(in
 static int
 fdtbus_get_interrupt_parent(int phandle)
 {
-	u_int interrupt_parent;
+	int iparent = phandle;
 
-	while (phandle >= 0) {
-		if (of_getprop_uint32(phandle, "interrupt-parent",
-		_parent) == 0) {
-			break;
-		}
-		if (phandle == 0) {
-			return -1;
-		}
-		phandle = OF_parent(phandle);
-	}
-	if (phandle < 0) {
-		return -1;
-	}
-
-	const void *data = fdtbus_get_data();
-	const int off = fdt_node_offset_by_phandle(data, interrupt_parent);
-	if (off < 0) {
-		return -1;
-	}
+	do {
+		if (of_hasprop(iparent, "interrupt-parent"))
+			return fdtbus_get_phandle(iparent, "interrupt-parent");
+		else if (of_hasprop(iparent, "interrupt-controller"))
+			return iparent;
+		else if (of_hasprop(iparent, "interrupt-map"))
+			return iparent;
+		iparent = OF_parent(iparent);
+	} while (iparent > 0);
 
-	return fdtbus_offset2phandle(off);
+	return 0;
 }
 
 static struct fdtbus_interrupt_controller *



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 16:06:50 UTC 2018

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

Log Message:
Fix a regression with interrupt-map handling in previous.


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

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



CVS commit: src/usr.sbin/postinstall

2018-07-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jul  2 15:10:43 UTC 2018

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
Remove dhclient references.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.216 src/usr.sbin/postinstall/postinstall:1.217
--- src/usr.sbin/postinstall/postinstall:1.216	Mon Jul 10 00:27:32 2017
+++ src/usr.sbin/postinstall/postinstall	Mon Jul  2 15:10:43 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.216 2017/07/10 00:27:32 simonb Exp $
+# $NetBSD: postinstall,v 1.217 2018/07/02 15:10:43 roy Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -41,8 +41,7 @@
 #
 # checks to add:
 #	- sysctl(8) renames (net.inet6.ip6.bindv6only -> net.inet6.ip6.v6only)
-#	- de* -> tlp* migration (/etc/ifconfig.de*, $ifconfig_de*,
-#	  dhclient.conf, ...) ?
+#	- de* -> tlp* migration (/etc/ifconfig.de*, $ifconfig_de*, ...) ?
 #	- support quiet/verbose mode ?
 #	- differentiate between failures caused by missing source
 #	  and real failures
@@ -1375,7 +1374,6 @@ cgd
 cleartmp
 cron
 devpubd
-dhclient
 dhcpcd
 dhcpd
 dhcrelay



CVS commit: src/usr.sbin/postinstall

2018-07-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jul  2 15:10:43 UTC 2018

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
Remove dhclient references.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.sbin/postinstall/postinstall

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



CVS commit: [netbsd-6-0] src/doc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:40:25 UTC 2018

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
Ticket #1551


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.147 -r1.1.2.148 src/doc/CHANGES-6.0.7

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-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.147 src/doc/CHANGES-6.0.7:1.1.2.148
--- src/doc/CHANGES-6.0.7:1.1.2.147	Sat Jun 30 11:45:14 2018
+++ src/doc/CHANGES-6.0.7	Mon Jul  2 14:40:25 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.147 2018/06/30 11:45:14 martin Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.148 2018/07/02 14:40:25 martin Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -15501,3 +15501,8 @@ xsrc/xfree/xc/programs/mkfontscale/ident
 	Pass gzFile, not gzFile * to gzio functions.
 	[mrg, ticket #1550]
 
+gnu/dist/gcc4/gcc/toplev.h			(apply patch)
+
+	Avoid redefining functions.
+	[mrg, ticket #1551]
+



CVS commit: [netbsd-6-0] src/doc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:40:25 UTC 2018

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
Ticket #1551


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.147 -r1.1.2.148 src/doc/CHANGES-6.0.7

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



CVS commit: [netbsd-6-0] src/gnu/dist/gcc4/gcc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:39:53 UTC 2018

Modified Files:
src/gnu/dist/gcc4/gcc [netbsd-6-0]: toplev.h

Log Message:
Apply patch, requested by mrg in ticket #1551:

Avoid redefining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.50.1 src/gnu/dist/gcc4/gcc/toplev.h

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

Modified files:

Index: src/gnu/dist/gcc4/gcc/toplev.h
diff -u src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1 src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1.50.1
--- src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1	Thu Apr 20 10:19:17 2006
+++ src/gnu/dist/gcc4/gcc/toplev.h	Mon Jul  2 14:39:53 2018
@@ -158,6 +158,7 @@ extern int exact_log2  (
 /* Return floor of log2, with -1 for zero.  */
 extern int floor_log2  (unsigned HOST_WIDE_INT);
 
+#if 0 /* these are not valid, and break in GCC 5. */
 /* Inline versions of the above for speed.  */
 #if GCC_VERSION >= 3004
 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
@@ -183,6 +184,7 @@ exact_log2 (unsigned HOST_WIDE_INT x)
   return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
 }
 #endif /* GCC_VERSION >= 3004 */
+#endif
 
 /* Functions used to get and set GCC's notion of in what directory
compilation was started.  */



CVS commit: [netbsd-6-0] src/gnu/dist/gcc4/gcc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:39:53 UTC 2018

Modified Files:
src/gnu/dist/gcc4/gcc [netbsd-6-0]: toplev.h

Log Message:
Apply patch, requested by mrg in ticket #1551:

Avoid redefining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.50.1 src/gnu/dist/gcc4/gcc/toplev.h

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



CVS commit: [netbsd-6-1] src/doc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:39:15 UTC 2018

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
Ticket #1551


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.145 -r1.1.2.146 src/doc/CHANGES-6.1.6

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-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.145 src/doc/CHANGES-6.1.6:1.1.2.146
--- src/doc/CHANGES-6.1.6:1.1.2.145	Sat Jun 30 11:43:53 2018
+++ src/doc/CHANGES-6.1.6	Mon Jul  2 14:39:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.145 2018/06/30 11:43:53 martin Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.146 2018/07/02 14:39:15 martin Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -15175,3 +15175,8 @@ xsrc/xfree/xc/programs/mkfontscale/ident
 	Pass gzFile, not gzFile * to gzio functions.
 	[mrg, ticket #1550]
 
+gnu/dist/gcc4/gcc/toplev.h			(apply patch)
+
+	Avoid redefining functions.
+	[mrg, ticket #1551]
+



CVS commit: [netbsd-6-1] src/doc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:39:15 UTC 2018

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
Ticket #1551


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.145 -r1.1.2.146 src/doc/CHANGES-6.1.6

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



CVS commit: [netbsd-6-1] src/gnu/dist/gcc4/gcc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:38:41 UTC 2018

Modified Files:
src/gnu/dist/gcc4/gcc [netbsd-6-1]: toplev.h

Log Message:
Apply patch, requested by mrg in ticket #1551:

Avoid redefining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.58.1 src/gnu/dist/gcc4/gcc/toplev.h

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

Modified files:

Index: src/gnu/dist/gcc4/gcc/toplev.h
diff -u src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1 src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1.58.1
--- src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1	Thu Apr 20 10:19:17 2006
+++ src/gnu/dist/gcc4/gcc/toplev.h	Mon Jul  2 14:38:41 2018
@@ -158,6 +158,7 @@ extern int exact_log2  (
 /* Return floor of log2, with -1 for zero.  */
 extern int floor_log2  (unsigned HOST_WIDE_INT);
 
+#if 0 /* these are not valid, and break in GCC 5. */
 /* Inline versions of the above for speed.  */
 #if GCC_VERSION >= 3004
 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
@@ -183,6 +184,7 @@ exact_log2 (unsigned HOST_WIDE_INT x)
   return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
 }
 #endif /* GCC_VERSION >= 3004 */
+#endif
 
 /* Functions used to get and set GCC's notion of in what directory
compilation was started.  */



CVS commit: [netbsd-6-1] src/gnu/dist/gcc4/gcc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:38:41 UTC 2018

Modified Files:
src/gnu/dist/gcc4/gcc [netbsd-6-1]: toplev.h

Log Message:
Apply patch, requested by mrg in ticket #1551:

Avoid redefining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.58.1 src/gnu/dist/gcc4/gcc/toplev.h

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



CVS commit: [netbsd-6] src/doc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:37:59 UTC 2018

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1551


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.342 -r1.1.2.343 src/doc/CHANGES-6.2

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-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.342 src/doc/CHANGES-6.2:1.1.2.343
--- src/doc/CHANGES-6.2:1.1.2.342	Sat Jun 30 11:42:34 2018
+++ src/doc/CHANGES-6.2	Mon Jul  2 14:37:59 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.342 2018/06/30 11:42:34 martin Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.343 2018/07/02 14:37:59 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -21286,3 +21286,9 @@ xsrc/xfree/xc/programs/mkfontscale/ident
 	Pass gzFile, not gzFile * to gzio functions.
 	[mrg, ticket #1550]
 
+gnu/dist/gcc4/gcc/toplev.h			(apply patch)
+
+	Avoid redefining functions.
+	[mrg, ticket #1551]
+
+



CVS commit: [netbsd-6] src/doc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:37:59 UTC 2018

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1551


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.342 -r1.1.2.343 src/doc/CHANGES-6.2

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



CVS commit: [netbsd-6] src/gnu/dist/gcc4/gcc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:36:42 UTC 2018

Modified Files:
src/gnu/dist/gcc4/gcc [netbsd-6]: toplev.h

Log Message:
Apply patch, requested by mrg in ticket #1551:

Avoid redefining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.44.1 src/gnu/dist/gcc4/gcc/toplev.h

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

Modified files:

Index: src/gnu/dist/gcc4/gcc/toplev.h
diff -u src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1 src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1.44.1
--- src/gnu/dist/gcc4/gcc/toplev.h:1.1.1.1	Thu Apr 20 10:19:17 2006
+++ src/gnu/dist/gcc4/gcc/toplev.h	Mon Jul  2 14:36:42 2018
@@ -158,6 +158,7 @@ extern int exact_log2  (
 /* Return floor of log2, with -1 for zero.  */
 extern int floor_log2  (unsigned HOST_WIDE_INT);
 
+#if 0 /* these are not valid, and break in GCC 5. */
 /* Inline versions of the above for speed.  */
 #if GCC_VERSION >= 3004
 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
@@ -183,6 +184,7 @@ exact_log2 (unsigned HOST_WIDE_INT x)
   return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
 }
 #endif /* GCC_VERSION >= 3004 */
+#endif
 
 /* Functions used to get and set GCC's notion of in what directory
compilation was started.  */



CVS commit: [netbsd-6] src/gnu/dist/gcc4/gcc

2018-07-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  2 14:36:42 UTC 2018

Modified Files:
src/gnu/dist/gcc4/gcc [netbsd-6]: toplev.h

Log Message:
Apply patch, requested by mrg in ticket #1551:

Avoid redefining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.44.1 src/gnu/dist/gcc4/gcc/toplev.h

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



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 13:45:24 UTC 2018

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

Log Message:
sc_clock_freq is in Hz, not kHz


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/dwcmmc_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/dev/fdt/dwcmmc_fdt.c
diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.4 src/sys/dev/fdt/dwcmmc_fdt.c:1.5
--- src/sys/dev/fdt/dwcmmc_fdt.c:1.4	Sun Jul  1 21:21:56 2018
+++ src/sys/dev/fdt/dwcmmc_fdt.c	Mon Jul  2 13:45:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwcmmc_fdt.c,v 1.4 2018/07/01 21:21:56 jmcneill Exp $ */
+/* $NetBSD: dwcmmc_fdt.c,v 1.5 2018/07/02 13:45:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.4 2018/07/01 21:21:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.5 2018/07/02 13:45:23 jmcneill Exp $");
 
 #include 
 #include 
@@ -193,7 +193,7 @@ dwcmmc_fdt_bus_clock(struct dwc_mmc_soft
 		return error;
 	}
 
-	sc->sc_clock_freq = (clk_get_rate(esc->sc_clk_ciu) / ciu_div) / 1000;
+	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / ciu_div;
 
 	aprint_debug_dev(sc->sc_dev, "set clock rate to %u kHz (target %u kHz)\n",
 	sc->sc_clock_freq, rate);



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 13:45:24 UTC 2018

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

Log Message:
sc_clock_freq is in Hz, not kHz


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/dwcmmc_fdt.c

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



CVS commit: src/sys/arch

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:53:51 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
src/sys/arch/evbarm/conf: EXYNOS

Log Message:
Attach mct early. Do not attach gtmr to mct.

XXX gtmr still needed for setstatclock symbol


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/files.exynos
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/conf/EXYNOS

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



CVS commit: src/sys/arch

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:53:51 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
src/sys/arch/evbarm/conf: EXYNOS

Log Message:
Attach mct early. Do not attach gtmr to mct.

XXX gtmr still needed for setstatclock symbol


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/files.exynos
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/conf/EXYNOS

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/samsung/files.exynos
diff -u src/sys/arch/arm/samsung/files.exynos:1.26 src/sys/arch/arm/samsung/files.exynos:1.27
--- src/sys/arch/arm/samsung/files.exynos:1.26	Sun Jul  1 23:28:40 2018
+++ src/sys/arch/arm/samsung/files.exynos	Mon Jul  2 12:53:51 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.exynos,v 1.26 2018/07/01 23:28:40 jmcneill Exp $
+#	$NetBSD: files.exynos,v 1.27 2018/07/02 12:53:51 jmcneill Exp $
 #
 # Configuration info for Samsung Exynos SoC ARM Peripherals
 #
@@ -56,7 +56,7 @@ attach  exyortc at fdt with exynos_rtc
 filearch/arm/samsung/exynos_rtc.c		exynos_rtc
 
 # Multi Core timer
-device	mct { } : fdtbus, mpcorebus
+device	mct
 attach	mct at fdt with exyo_mct
 file	arch/arm/samsung/mct.c		exyo_mct
 

Index: src/sys/arch/evbarm/conf/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.26 src/sys/arch/evbarm/conf/EXYNOS:1.27
--- src/sys/arch/evbarm/conf/EXYNOS:1.26	Sun Jul  1 23:27:43 2018
+++ src/sys/arch/evbarm/conf/EXYNOS	Mon Jul  2 12:53:51 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.26 2018/07/01 23:27:43 jmcneill Exp $
+#	$NetBSD: EXYNOS,v 1.27 2018/07/02 12:53:51 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -49,8 +49,9 @@ fregulator*	at fdt? pass 4
 gpiokeys*	at fdt?
 
 # Timer
-mct*		at fdt?			# Exynos Multi Core Timer (MCT)
-armgtmr0	at mct?			# ARM Generic Timer
+mct*		at fdt? pass 2		# Exynos Multi Core Timer (MCT)
+gtmr*		at fdt? pass 2
+armgtmr0	at gtmr?
 
 # Interrupt controller
 exyointr*	at fdt? pass 1



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:49:37 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c mct.c mct_var.h

Log Message:
Add a proper MCT driver rather than relying on ARM Generic Timer (which
may not be functional or even present).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/mct.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/mct_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.9 src/sys/arch/arm/samsung/exynos_platform.c:1.10
--- src/sys/arch/arm/samsung/exynos_platform.c:1.9	Sat Mar 17 18:34:09 2018
+++ src/sys/arch/arm/samsung/exynos_platform.c	Mon Jul  2 12:49:37 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.9 2018/03/17 18:34:09 ryo Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.10 2018/07/02 12:49:37 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -33,7 +33,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.9 2018/03/17 18:34:09 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.10 2018/07/02 12:49:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,11 +50,10 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_platf
 
 #include 
 #include 
+#include 
 
 #include 
 
-#include 
-
 #include 
 
 #define	EXYNOS5_SWRESET_REG	0x10040400
@@ -123,12 +122,6 @@ exynos5_platform_reset(void)
 	bus_space_write_4(bst, bsh, 0, 1);
 }
 
-static void
-exynos_platform_delay(u_int us)
-{
-	gtmr_delay(us);
-}
-
 static u_int
 exynos_platform_uart_freq(void)
 {
@@ -142,7 +135,7 @@ static const struct arm_platform exynos5
 	.early_putchar = exynos_platform_early_putchar,
 	.device_register = exynos_platform_device_register,
 	.reset = exynos5_platform_reset,
-	.delay = exynos_platform_delay,
+	.delay = mct_delay,
 	.uart_freq = exynos_platform_uart_freq,
 };
 

Index: src/sys/arch/arm/samsung/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.13 src/sys/arch/arm/samsung/mct.c:1.14
--- src/sys/arch/arm/samsung/mct.c:1.13	Sun Jul  1 23:21:43 2018
+++ src/sys/arch/arm/samsung/mct.c	Mon Jul  2 12:49:37 2018
@@ -1,11 +1,11 @@
-/*	$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $	*/
+/*	$NetBSD: mct.c,v 1.14 2018/07/02 12:49:37 jmcneill Exp $	*/
 
 /*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2014-2018 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Reinoud Zandijk.
+ * by Reinoud Zandijk and Jared McNeill.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.14 2018/07/02 12:49:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,16 +50,25 @@ __KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.13
 #include 
 #include 
 
-#include 
-#include 
-#include 
-
 #include 
 #include 
 
+static struct mct_softc mct_sc;
+
 static int  mct_match(device_t, cfdata_t, void *);
 static void mct_attach(device_t, device_t, void *);
 
+static u_int mct_get_timecount(struct timecounter *);
+
+static struct timecounter mct_timecounter = {
+	.tc_get_timecount = mct_get_timecount,
+	.tc_counter_mask = ~0u,
+	.tc_frequency = EXYNOS_F_IN_FREQ,
+	.tc_name = "MCT",
+	.tc_quality = 500,
+	.tc_priv = _sc,
+};
+
 CFATTACH_DECL_NEW(exyo_mct, 0, mct_match, mct_attach, NULL, NULL);
 
 static inline uint32_t
@@ -85,20 +94,31 @@ mct_write_global(struct mct_softc *sc, b
 		wreg = MCT_G_CNT_WSTAT;
 		bit  = (o == MCT_G_CNT_L) ? G_CNT_WSTAT_L : G_CNT_WSTAT_U;
 	} else {
-		wreg = MCT_G_WSTAT;
 		switch (o) {
 		case MCT_G_COMP0_L:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_COMP0_L;
 			break;
 		case MCT_G_COMP0_U:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_COMP0_U;
 			break;
 		case MCT_G_COMP0_ADD_INCR:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_ADD_INCR;
 			break;
 		case MCT_G_TCON:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_TCON;
 			break;
+		case MCT_G_CNT_L:
+			wreg = MCT_G_CNT_WSTAT;
+			bit  = G_CNT_WSTAT_L;
+			break;
+		case MCT_G_CNT_U:
+			wreg = MCT_G_CNT_WSTAT;
+			bit  = G_CNT_WSTAT_U;
+			break;
 		default:
 			/* all other registers */
 			return;
@@ -120,7 +140,69 @@ mct_write_global(struct mct_softc *sc, b
 static void
 mct_fdt_cpu_hatch(void *priv, struct cpu_info *ci)
 {
-	gtmr_init_cpu_clock(ci);
+	panic("%s: not implemented", __func__);
+}
+
+static int
+mct_intr(void *arg)
+{
+	struct mct_softc * const sc = _sc;
+	struct clockframe *frame = arg;
+
+	mct_write_global(sc, MCT_G_INT_CSTAT, G_INT_CSTAT_CLEAR);
+
+	hardclock(frame);
+
+	return 1;
+}
+
+static 

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:49:37 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c mct.c mct_var.h

Log Message:
Add a proper MCT driver rather than relying on ARM Generic Timer (which
may not be functional or even present).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/mct.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/mct_var.h

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



CVS commit: src/sys/dev/ic

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:47:19 UTC 2018

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

Log Message:
Reduce 10 second timeouts to 2 seconds.


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

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

Modified files:

Index: src/sys/dev/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.13 src/sys/dev/ic/dwc_mmc.c:1.14
--- src/sys/dev/ic/dwc_mmc.c:1.13	Tue Jun 19 22:44:33 2018
+++ src/sys/dev/ic/dwc_mmc.c	Mon Jul  2 12:47:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.13 2018/06/19 22:44:33 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.14 2018/07/02 12:47:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.13 2018/06/19 22:44:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.14 2018/07/02 12:47:19 jmcneill Exp $");
 
 #include 
 #include 
@@ -316,7 +316,7 @@ dwc_mmc_update_clock(struct dwc_mmc_soft
 		cmd |= DWC_MMC_CMD_USE_HOLD_REG;
 	MMC_WRITE(sc, DWC_MMC_ARG, 0);
 	MMC_WRITE(sc, DWC_MMC_CMD, cmd);
-	retry = 0xf;
+	retry = 20;
 	while (--retry > 0) {
 		if (!(MMC_READ(sc, DWC_MMC_CMD) & DWC_MMC_CMD_START))
 			break;
@@ -556,7 +556,7 @@ dwc_mmc_exec_command(sdmmc_chipset_handl
 {
 	struct dwc_mmc_softc *sc = sch;
 	uint32_t cmdval = DWC_MMC_CMD_START;
-	int retry = 0xf;
+	int retry = 20;
 
 #ifdef DWC_MMC_DEBUG
 	aprint_normal_dev(sc->sc_dev,



CVS commit: src/sys/dev/ic

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:47:19 UTC 2018

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

Log Message:
Reduce 10 second timeouts to 2 seconds.


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

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



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:18:32 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c

Log Message:
Cleanup of combiner driver and make it work (at least for MCT).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_combiner.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/samsung/exynos_combiner.c
diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.7 src/sys/arch/arm/samsung/exynos_combiner.c:1.8
--- src/sys/arch/arm/samsung/exynos_combiner.c:1.7	Sun Jun 11 16:19:27 2017
+++ src/sys/arch/arm/samsung/exynos_combiner.c	Mon Jul  2 12:18:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_combiner.c,v 1.7 2017/06/11 16:19:27 jmcneill Exp $ */
+/*	$NetBSD: exynos_combiner.c,v 1.8 2018/07/02 12:18:32 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.7 2017/06/11 16:19:27 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.8 2018/07/02 12:18:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,14 +50,13 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_combi
 
 #include 
 
-#define COMBINER_IESR_OFFSET   0x00
-#define COMBINER_IECR_OFFSET   0x04
-#define COMBINER_ISTR_OFFSET   0x08
-#define COMBINER_IMSR_OFFSET   0x0C
-#define COMBINER_GROUP_SIZE0x10
-#define COMBINER_IRQS_PER_BLOCK   8
-#define COMBINER_BLOCKS_PER_GROUP 4
-#define COMBINER_N_BLOCKS32
+#define	COMBINER_GROUP_BASE(group)	(((group) / 4) * 0x10)
+#define	COMBINER_GROUP_MASK(group)	(0xff << (((group) % 4) * 8))
+
+#define	COMBINER_IESR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x00)
+#define	COMBINER_IECR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x04)
+#define	COMBINER_ISTR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x08)
+#define	COMBINER_IMSR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x0c)
 
 struct exynos_combiner_softc;
 
@@ -69,12 +68,13 @@ struct exynos_combiner_irq_entry {
 	boolirq_mpsafe;
 };
 
-struct exynos_combiner_irq_block {
-	int irq_block_no;
+struct exynos_combiner_irq_group {
+	int irq_group_no;
 	struct exynos_combiner_softc	*irq_sc;
 	struct exynos_combiner_irq_entry *irq_entries;
-	struct exynos_combiner_irq_block *irq_block_next;
+	struct exynos_combiner_irq_group *irq_group_next;
 	void *irq_ih;
+	int irq_ipl;
 };
 
 struct exynos_combiner_softc {
@@ -82,7 +82,7 @@ struct exynos_combiner_softc {
 	bus_space_tag_t		sc_bst;
 	bus_space_handle_t	sc_bsh;
 	int			sc_phandle;
-	struct exynos_combiner_irq_block *irq_blocks;
+	struct exynos_combiner_irq_group *irq_groups;
 };
 
 static int exynos_combiner_match(device_t, cfdata_t, void *);
@@ -129,7 +129,6 @@ exynos_combiner_attach(device_t parent, 
 	sc->sc_dev = self;
 	sc->sc_phandle = faa->faa_phandle;
 	sc->sc_bst = faa->faa_bst;
-	sc->irq_blocks = NULL;
 
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh);
 	if (error) {
@@ -145,53 +144,53 @@ exynos_combiner_attach(device_t parent, 
 		return;
 	}
 
-	aprint_normal(" @ 0x%08x: interrupt combiner", (uint)addr);
 	aprint_naive("\n");
-	aprint_normal("\n");
+	aprint_normal(" @ 0x%08x: interrupt combiner\n", (uint)addr);
 
 }
 
-static struct exynos_combiner_irq_block *
-exynos_combiner_new_block(struct exynos_combiner_softc *sc, int block_no)
+static struct exynos_combiner_irq_group *
+exynos_combiner_new_group(struct exynos_combiner_softc *sc, int group_no)
 {
-	struct exynos_combiner_irq_block *n = kmem_zalloc(sizeof(*n),
+	struct exynos_combiner_irq_group *n = kmem_zalloc(sizeof(*n),
 			  KM_SLEEP);
-	n->irq_block_no = block_no;
-	n->irq_block_next = sc->irq_blocks;
-	sc->irq_blocks = n;
+	n->irq_group_no = group_no;
+	n->irq_group_next = sc->irq_groups;
+	n->irq_sc = sc;
+	sc->irq_groups = n;
 	return n;
 }
 			  
-static struct exynos_combiner_irq_block *
-exynos_combiner_get_block(struct exynos_combiner_softc *sc, int block)
+static struct exynos_combiner_irq_group *
+exynos_combiner_get_group(struct exynos_combiner_softc *sc, int group_no)
 {
-	for (struct exynos_combiner_irq_block *b = sc->irq_blocks;
-	 b; b = b->irq_block_next) {
-		if (b->irq_block_no == block)
-			return b;
+	for (struct exynos_combiner_irq_group *g = sc->irq_groups;
+	 g; g = g->irq_group_next) {
+		if (g->irq_group_no == group_no)
+			return g;
 	}
 	return NULL;
 }
 
 static struct exynos_combiner_irq_entry *
-exynos_combiner_new_irq(struct exynos_combiner_irq_block *block,
+exynos_combiner_new_irq(struct exynos_combiner_irq_group *group,
 			int irq, bool mpsafe, int (*func)(void *), void *arg)
 {
 	struct exynos_combiner_irq_entry * n = kmem_zalloc(sizeof(*n),
 			   KM_SLEEP);
 	n->irq_no = irq;
 	n->irq_handler = func;
-	n->irq_next = block->irq_entries;
+	n->irq_next = group->irq_entries;
 	n->irq_arg = arg;
 	n->irq_mpsafe = mpsafe;
-	block->irq_entries = n;
+	

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:18:32 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c

Log Message:
Cleanup of combiner driver and make it work (at least for MCT).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_combiner.c

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



CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:17:05 UTC 2018

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

Log Message:
interrupt-map bug fixes


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/fdt_intr.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/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.12 src/sys/dev/fdt/fdt_intr.c:1.13
--- src/sys/dev/fdt/fdt_intr.c:1.12	Sat Jun 30 20:34:43 2018
+++ src/sys/dev/fdt/fdt_intr.c	Mon Jul  2 12:17:05 2018
@@ -1,7 +1,7 @@
-/* $NetBSD: fdt_intr.c,v 1.12 2018/06/30 20:34:43 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.13 2018/07/02 12:17:05 jmcneill Exp $ */
 
 /*-
- * Copyright (c) 2015 Jared D. McNeill 
+ * Copyright (c) 2015-2018 Jared McNeill 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.12 2018/06/30 20:34:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.13 2018/07/02 12:17:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -53,9 +53,8 @@ struct fdtbus_interrupt_cookie {
 	void *c_ih;
 };
 
-static bool	has_interrupt_map(int);
 static u_int *	get_specifier_by_index(int, int, int *);
-static u_int *	get_specifier_from_map(int, int, int *);
+static u_int *	get_specifier_from_map(int, const u_int *, int *);
 
 static int
 fdtbus_get_interrupt_parent(int phandle)
@@ -168,17 +167,6 @@ fdtbus_intr_str(int phandle, u_int index
 }
 
 static int
-find_interrupt_map(int phandle)
-{
-	while (phandle > 0) {
-		if (of_hasprop(phandle, "interrupt-map"))
-			return phandle;
-		phandle = OF_parent(phandle);
-	}
-	return -1;
-}
-
-static int
 find_address_cells(int phandle)
 {
 	uint32_t cells;
@@ -202,49 +190,21 @@ find_interrupt_cells(int phandle)
 	return 0;
 }
 
-static bool
-has_interrupt_map(int phandle)
-{
-	return find_interrupt_map(OF_parent(phandle)) != -1;
-}
-
 static u_int *
-get_specifier_from_map(int phandle, int pindex, int *piphandle)
+get_specifier_from_map(int phandle, const u_int *interrupt_spec, int *piphandle)
 {
-	const u_int *node_specifier = NULL;
 	u_int *result = NULL;
 	int len, resid;
 
-	const u_int interrupt_cells = find_interrupt_cells(phandle);
-	if (interrupt_cells < 1)
-		return NULL;
-
-	node_specifier = fdt_getprop(fdtbus_get_data(), fdtbus_phandle2offset(phandle),
-	"interrupts", );
-	if (node_specifier == NULL)
-		return NULL;
-
-	const u_int spec_length = len / 4;
-	const u_int nintr = spec_length / interrupt_cells;
-	if (pindex >= nintr)
+	const u_int *data = fdtbus_get_prop(phandle, "interrupt-map", );
+	if (data == NULL || len <= 0)
 		return NULL;
-
-	node_specifier += (interrupt_cells * pindex);
-
-	const int nexus_phandle = find_interrupt_map(OF_parent(phandle));
-
-	const u_int *data = fdt_getprop(fdtbus_get_data(), fdtbus_phandle2offset(nexus_phandle),
-	"interrupt-map", );
-	if (data == NULL || len <= 0) {
-		printf("%s: can't get property interrupt-map.\n", __func__);
-		return NULL;
-	}
 	resid = len;
 
 	/* child unit address: #address-cells prop of child bus node */
-	const int cua_cells = find_address_cells(nexus_phandle);
+	const int cua_cells = find_address_cells(phandle);
 	/* child interrupt specifier: #interrupt-cells of the nexus node */
-	const int cis_cells = find_interrupt_cells(nexus_phandle);
+	const int cis_cells = find_interrupt_cells(phandle);
 
 	/* Offset (in cells) from map entry to child unit address specifier */
 	const u_int cua_off = 0;
@@ -255,17 +215,6 @@ get_specifier_from_map(int phandle, int 
 	/* Offset (in cells) from map entry to parent unit specifier */
 	const u_int pus_off = ip_off + 1;
 
-#ifdef FDT_INTR_DEBUG
-	printf("%s: phandle=%s nexus_phandle=%s\n", __func__,
-	fdt_get_name(fdtbus_get_data(), fdtbus_phandle2offset(phandle), NULL),
-	fdt_get_name(fdtbus_get_data(), fdtbus_phandle2offset(nexus_phandle), NULL));
-	printf("cua_cells: %d, cis_cells: %d, ip_off = %d\n", cua_cells, cis_cells, ip_off);
-	printf("searching for interrupt in map (data %p, len %d):", data, len);
-	for (int i = 0; i < interrupt_cells; i++)
-		printf(" %08x", node_specifier[i]);
-	printf("\n");
-#endif
-
 	const u_int *p = (const u_int *)data;
 	while (resid > 0) {
 		/* Interrupt parent phandle */
@@ -286,7 +235,7 @@ get_specifier_from_map(int phandle, int 
 		printf("\n");
 #endif
 
-		if (cis_cells == interrupt_cells && memcmp([cis_off], node_specifier, interrupt_cells * 4) == 0) {
+		if (memcmp([cis_off], interrupt_spec, cis_cells * 4) == 0) {
 			const int slen = pus_cells + pis_cells;
 #ifdef FDT_INTR_DEBUG
 			printf(" intr map match iparent %08x slen %d:", iparent, slen);
@@ -318,20 +267,16 @@ get_specifier_by_index(int phandle, int 
 	u_int *specifier;
 	int interrupt_parent, interrupt_cells, len;
 
-	if (has_interrupt_map(phandle))
-		return get_specifier_from_map(phandle, 

CVS commit: src/sys/dev/fdt

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:17:05 UTC 2018

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

Log Message:
interrupt-map bug fixes


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

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



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:27:18 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/mii/miidevs_data.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/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.133 src/sys/dev/mii/miidevs.h:1.134
--- src/sys/dev/mii/miidevs.h:1.133	Mon Jul  2 09:02:18 2018
+++ src/sys/dev/mii/miidevs.h	Mon Jul  2 09:27:18 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.133 2018/07/02 09:02:18 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.134 2018/07/02 09:27:18 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.130 2018/07/02 09:01:59 msaitoh Exp
+ *	NetBSD: miidevs,v 1.131 2018/07/02 09:26:48 msaitoh Exp
  */
 
 /*-
@@ -110,6 +110,7 @@
 #define	MII_OUI_xxXAQTI	0xace000	/* XaQti Corp. */
 
 /* Don't know what's going on here. */
+#define	MII_OUI_xxASIX	0x000674	/* Asix Semiconductor */
 #define	MII_OUI_xxPMCSIERRA	0x0009c0	/* PMC-Sierra */
 #define	MII_OUI_xxPMCSIERRA2	0x009057	/* PMC-Sierra */
 
@@ -125,6 +126,10 @@
 #define	MII_MODEL_AGERE_ET1011	0x0004
 #define	MII_STR_AGERE_ET1011	"Agere ET1011 10/100/1000baseT PHY"
 
+/* Asix semiconductor PHYs */
+#define	MII_MODEL_xxASIX_AX88X9X	0x0031
+#define	MII_STR_xxASIX_AX88X9X	"Ax88x9x internal PHY"
+
 /* Atheros PHYs */
 #define	MII_MODEL_ATHEROS_F1	0x0001
 #define	MII_STR_ATHEROS_F1	"F1 10/100/1000 PHY"
@@ -448,7 +453,7 @@
 #define	MII_MODEL_xxNATSEMI_DP83843	0x0001
 #define	MII_STR_xxNATSEMI_DP83843	"DP83843 10/100 media interface"
 #define	MII_MODEL_xxNATSEMI_DP83815	0x0002
-#define	MII_STR_xxNATSEMI_DP83815	"DP83815 10/100 media interface"
+#define	MII_STR_xxNATSEMI_DP83815	"DP83815/DP83846A 10/100 media interface"
 #define	MII_MODEL_xxNATSEMI_DP83847	0x0003
 #define	MII_STR_xxNATSEMI_DP83847	"DP83847 10/100 media interface"
 #define	MII_MODEL_xxNATSEMI_DP83891	0x0005

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.121 src/sys/dev/mii/miidevs_data.h:1.122
--- src/sys/dev/mii/miidevs_data.h:1.121	Mon Jul  2 09:02:18 2018
+++ src/sys/dev/mii/miidevs_data.h	Mon Jul  2 09:27:18 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.121 2018/07/02 09:02:18 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.122 2018/07/02 09:27:18 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.130 2018/07/02 09:01:59 msaitoh Exp
+ *	NetBSD: miidevs,v 1.131 2018/07/02 09:26:48 msaitoh Exp
  */
 
 /*-
@@ -38,6 +38,7 @@
  */
 struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_AGERE, MII_MODEL_AGERE_ET1011, MII_STR_AGERE_ET1011 },
+ { MII_OUI_xxASIX, MII_MODEL_xxASIX_AX88X9X, MII_STR_xxASIX_AX88X9X },
  { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_F1, MII_STR_ATHEROS_F1 },
  { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_F2, MII_STR_ATHEROS_F2 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L1, MII_STR_ATTANSIC_L1 },



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:27:18 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/mii/miidevs_data.h

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



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:26:48 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
- Add ASIX Ax88x9x
- Add description for DP83846A.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/mii/miidevs

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



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:26:48 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
- Add ASIX Ax88x9x
- Add description for DP83846A.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/mii/miidevs

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/miidevs
diff -u src/sys/dev/mii/miidevs:1.130 src/sys/dev/mii/miidevs:1.131
--- src/sys/dev/mii/miidevs:1.130	Mon Jul  2 09:01:59 2018
+++ src/sys/dev/mii/miidevs	Mon Jul  2 09:26:48 2018
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.130 2018/07/02 09:01:59 msaitoh Exp $
+$NetBSD: miidevs,v 1.131 2018/07/02 09:26:48 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -103,6 +103,7 @@ oui xxLEVEL1			0x782000	Level 1
 oui xxXAQTI			0xace000	XaQti Corp.
 
 /* Don't know what's going on here. */
+oui xxASIX			0x000674	Asix Semiconductor
 oui xxPMCSIERRA			0x0009c0	PMC-Sierra
 oui xxPMCSIERRA2		0x009057	PMC-Sierra
 
@@ -117,6 +118,9 @@ oui yyREALTEK			0x04	Realtek
  */
 model AGERE ET1011		0x0004 Agere ET1011 10/100/1000baseT PHY
 
+/* Asix semiconductor PHYs */
+model xxASIX AX88X9X		0x0031 Ax88x9x internal PHY
+
 /* Atheros PHYs */
 model ATHEROS F1		0x0001 F1 10/100/1000 PHY
 model ATHEROS F2		0x0002 F2 10/100 PHY
@@ -296,7 +300,7 @@ model MYSON MTD803		0x MTD803 3-in-1
 /* National Semiconductor PHYs */
 model xxNATSEMI DP83840		0x DP83840 10/100 media interface
 model xxNATSEMI DP83843		0x0001 DP83843 10/100 media interface
-model xxNATSEMI DP83815		0x0002 DP83815 10/100 media interface
+model xxNATSEMI DP83815		0x0002 DP83815/DP83846A 10/100 media interface
 model xxNATSEMI DP83847		0x0003 DP83847 10/100 media interface
 model xxNATSEMI DP83891		0x0005 DP83891 1000BASE-T media interface
 model xxNATSEMI DP83861		0x0006 DP83861 1000BASE-T media interface



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:02:18 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/mii/miidevs_data.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/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.132 src/sys/dev/mii/miidevs.h:1.133
--- src/sys/dev/mii/miidevs.h:1.132	Tue Jun 19 05:14:36 2018
+++ src/sys/dev/mii/miidevs.h	Mon Jul  2 09:02:18 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.132 2018/06/19 05:14:36 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.133 2018/07/02 09:02:18 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.129 2018/06/19 05:14:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.130 2018/07/02 09:01:59 msaitoh Exp
  */
 
 /*-
@@ -56,36 +56,36 @@
  * Use "make -f Makefile.miidevs" to regenerate miidevs.h and miidevs_data.h
  */
 
+#define	MII_OUI_AMD	0x1a	/* Advanced Micro Devices */
+#define	MII_OUI_CICADA	0x0003f1	/* Cicada Semiconductor */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
+#define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
+#define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
+#define	MII_OUI_MICREL	0x0010a1	/* Micrel */
 #define	MII_OUI_ALTIMA	0x0010a9	/* Altima Communications */
-#define	MII_OUI_AMD	0x1a	/* Advanced Micro Devices */
+#define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
 #define	MII_OUI_ATHEROS	0x001374	/* Atheros */
-#define	MII_OUI_ATTANSIC	0x00c82e	/* Attansic Technology */
-#define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
-#define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
 #define	MII_OUI_BROADCOM3	0x001be9	/* Broadcom Corporation */
-#define	MII_OUI_CICADA	0x0003F1	/* Cicada Semiconductor */
+#define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
+#define	MII_OUI_MARVELL	0x005043	/* Marvell Semiconductor */
+#define	MII_OUI_QUALSEMI	0x006051	/* Quality Semiconductor */
 #define	MII_OUI_DAVICOM	0x00606e	/* Davicom Semiconductor */
-#define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
+#define	MII_OUI_SMSC	0x00800f	/* SMSC */
 #define	MII_OUI_ICPLUS	0x0090c3	/* IC Plus Corp. */
+#define	MII_OUI_SEEQ	0x00a07d	/* Seeq */
 #define	MII_OUI_ICS	0x00a0be	/* Integrated Circuit Systems */
 #define	MII_OUI_INTEL	0x00aa00	/* Intel */
-#define	MII_OUI_JMICRON	0x00d831	/* JMicron */
-#define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
-#define	MII_OUI_MARVELL	0x005043	/* Marvell Semiconductor */
-#define	MII_OUI_MICREL	0x0010a1	/* Micrel */
+#define	MII_OUI_TSC	0x00c039	/* TDK Semiconductor */
 #define	MII_OUI_MYSON	0x00c0b4	/* Myson Technology */
-#define	MII_OUI_NATSEMI	0x080017	/* National Semiconductor */
-#define	MII_OUI_PMCSIERRA	0x00e004	/* PMC-Sierra */
+#define	MII_OUI_ATTANSIC	0x00c82e	/* Attansic Technology */
 #define	MII_OUI_RDC	0x00d02d	/* RDC Semiconductor */
-#define	MII_OUI_REALTEK	0x00e04c	/* RealTek */
-#define	MII_OUI_QUALSEMI	0x006051	/* Quality Semiconductor */
-#define	MII_OUI_SEEQ	0x00a07d	/* Seeq */
+#define	MII_OUI_JMICRON	0x00d831	/* JMicron */
+#define	MII_OUI_PMCSIERRA	0x00e004	/* PMC-Sierra */
 #define	MII_OUI_SIS	0x00e006	/* Silicon Integrated Systems */
-#define	MII_OUI_SMSC	0x00800f	/* SMSC */
-#define	MII_OUI_TI	0x080028	/* Texas Instruments */
-#define	MII_OUI_TSC	0x00c039	/* TDK Semiconductor */
+#define	MII_OUI_REALTEK	0x00e04c	/* RealTek */
 #define	MII_OUI_XAQTI	0x00e0ae	/* XaQti Corp. */
+#define	MII_OUI_NATSEMI	0x080017	/* National Semiconductor */
+#define	MII_OUI_TI	0x080028	/* Texas Instruments */
 
 /* Some Intel 82553's use an alternative OUI. */
 #define	MII_OUI_xxINTEL	0x001f00	/* Intel */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.120 src/sys/dev/mii/miidevs_data.h:1.121
--- src/sys/dev/mii/miidevs_data.h:1.120	Tue Jun 19 05:14:36 2018
+++ src/sys/dev/mii/miidevs_data.h	Mon Jul  2 09:02:18 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.120 2018/06/19 05:14:36 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.121 2018/07/02 09:02:18 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.129 2018/06/19 05:14:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.130 2018/07/02 09:01:59 msaitoh Exp
  */
 
 /*-



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:02:18 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/mii/miidevs_data.h

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



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:01:59 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Sort OUI by number. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/mii/miidevs

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



CVS commit: src/sys/dev/mii

2018-07-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 09:01:59 UTC 2018

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Sort OUI by number. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/mii/miidevs

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/miidevs
diff -u src/sys/dev/mii/miidevs:1.129 src/sys/dev/mii/miidevs:1.130
--- src/sys/dev/mii/miidevs:1.129	Tue Jun 19 05:14:16 2018
+++ src/sys/dev/mii/miidevs	Mon Jul  2 09:01:59 2018
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.129 2018/06/19 05:14:16 msaitoh Exp $
+$NetBSD: miidevs,v 1.130 2018/07/02 09:01:59 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -49,36 +49,36 @@ $NetBSD: miidevs,v 1.129 2018/06/19 05:1
  * Use "make -f Makefile.miidevs" to regenerate miidevs.h and miidevs_data.h
  */
 
+oui AMD0x1a	Advanced Micro Devices
+oui CICADA			0x0003f1	Cicada Semiconductor
 oui AGERE			0x00053d	Agere
+oui BROADCOM2			0x000af7	Broadcom Corporation
+oui BROADCOM			0x001018	Broadcom Corporation
+oui MICREL			0x0010a1	Micrel
 oui ALTIMA			0x0010a9	Altima Communications
-oui AMD0x1a	Advanced Micro Devices
+oui ENABLESEMI			0x0010dd	Enable Semiconductor
 oui ATHEROS			0x001374	Atheros
-oui ATTANSIC			0x00c82e	Attansic Technology
-oui BROADCOM			0x001018	Broadcom Corporation
-oui BROADCOM2			0x000af7	Broadcom Corporation
 oui BROADCOM3			0x001be9	Broadcom Corporation
-oui CICADA			0x0003F1	Cicada Semiconductor
+oui LEVEL1			0x00207b	Level 1
+oui MARVELL			0x005043	Marvell Semiconductor
+oui QUALSEMI			0x006051	Quality Semiconductor
 oui DAVICOM			0x00606e	Davicom Semiconductor
-oui ENABLESEMI			0x0010dd	Enable Semiconductor
+oui SMSC			0x00800f	SMSC
 oui ICPLUS			0x0090c3	IC Plus Corp.
+oui SEEQ			0x00a07d	Seeq
 oui ICS0x00a0be	Integrated Circuit Systems
 oui INTEL			0x00aa00	Intel
-oui JMICRON			0x00d831	JMicron
-oui LEVEL1			0x00207b	Level 1
-oui MARVELL			0x005043	Marvell Semiconductor
-oui MICREL			0x0010a1	Micrel
+oui TSC0x00c039	TDK Semiconductor
 oui MYSON			0x00c0b4	Myson Technology
-oui NATSEMI			0x080017	National Semiconductor
-oui PMCSIERRA			0x00e004	PMC-Sierra
+oui ATTANSIC			0x00c82e	Attansic Technology
 oui RDC0x00d02d	RDC Semiconductor
-oui REALTEK			0x00e04c	RealTek
-oui QUALSEMI			0x006051	Quality Semiconductor
-oui SEEQ			0x00a07d	Seeq
+oui JMICRON			0x00d831	JMicron
+oui PMCSIERRA			0x00e004	PMC-Sierra
 oui SIS0x00e006	Silicon Integrated Systems
-oui SMSC			0x00800f	SMSC
-oui TI0x080028	Texas Instruments
-oui TSC0x00c039	TDK Semiconductor
+oui REALTEK			0x00e04c	RealTek
 oui XAQTI			0x00e0ae	XaQti Corp.
+oui NATSEMI			0x080017	National Semiconductor
+oui TI0x080028	Texas Instruments
 
 /* Some Intel 82553's use an alternative OUI. */
 oui xxINTEL			0x001f00	Intel



CVS commit: src/sys/dev/pci

2018-07-02 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jul  2 06:03:13 UTC 2018

Modified Files:
src/sys/dev/pci: if_msk.c if_mskvar.h

Log Message:
sync OpenBSD if_msk.c revs 1.66-1.79 skipping framework changes and already
present changes:
- Make Yukon-2 FE+ (88E8040, 88E8042) work
- 88E8057 is a Yukon 2 Ultra 2, and this might make it work on a little
  shiny green box in Japan
- Prevent null pointer dereference that could happen when we process an RX
  interrupt that was queued while stopping the interface.
- Remove holdover XMAC II writes/reads inherited from sk as
  they aren't required and cause problems like the 88E8072
  hard locking a system when enabling macsec bypass.
- Bypass macsec on extreme/supreme based chips.
  Makes my 88E8072 work.
- Add detach support to a few more drivers, and in others do the neccessary
  operations in the detach function in the right order.

towards resolution of PR kern/53301 but will need more work

tested by John Halfpenny on another 8040/Yukon-2 FE+ and reported
improving behaviour (system hang to stall) so committing as stopgap; also
tested on my SK-9E22 (Yukon-2 XL), there works without any issues both before
and after


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/if_mskvar.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.67 src/sys/dev/pci/if_msk.c:1.68
--- src/sys/dev/pci/if_msk.c:1.67	Tue Jun 26 06:48:01 2018
+++ src/sys/dev/pci/if_msk.c	Mon Jul  2 06:03:13 2018
@@ -1,5 +1,5 @@
-/* $NetBSD: if_msk.c,v 1.67 2018/06/26 06:48:01 msaitoh Exp $ */
-/*	$OpenBSD: if_msk.c,v 1.65 2008/09/10 14:01:22 blambert Exp $ */
+/* $NetBSD: if_msk.c,v 1.68 2018/07/02 06:03:13 jdolecek Exp $ */
+/*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.67 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.68 2018/07/02 06:03:13 jdolecek Exp $");
 
 #include 
 #include 
@@ -106,7 +106,7 @@ int mskcprint(void *, const char *);
 int msk_intr(void *);
 void msk_intr_yukon(struct sk_if_softc *);
 void msk_rxeof(struct sk_if_softc *, u_int16_t, u_int32_t);
-void msk_txeof(struct sk_if_softc *, int);
+void msk_txeof(struct sk_if_softc *);
 int msk_encap(struct sk_if_softc *, struct mbuf *, u_int32_t *);
 void msk_start(struct ifnet *);
 int msk_ioctl(struct ifnet *, u_long, void *);
@@ -114,12 +114,13 @@ int msk_init(struct ifnet *);
 void msk_init_yukon(struct sk_if_softc *);
 void msk_stop(struct ifnet *, int);
 void msk_watchdog(struct ifnet *);
-int msk_newbuf(struct sk_if_softc *, int, struct mbuf *, bus_dmamap_t);
+int msk_newbuf(struct sk_if_softc *, struct mbuf *, bus_dmamap_t);
 int msk_alloc_jumbo_mem(struct sk_if_softc *);
 void *msk_jalloc(struct sk_if_softc *);
 void msk_jfree(struct mbuf *, void *, size_t, void *);
 int msk_init_rx_ring(struct sk_if_softc *);
 int msk_init_tx_ring(struct sk_if_softc *);
+void msk_fill_rx_ring(struct sk_if_softc *);
 
 void msk_update_int_mod(struct sk_softc *, int);
 
@@ -419,17 +420,11 @@ msk_init_rx_ring(struct sk_if_softc *sc_
 		cd->sk_rx_chain[i].sk_next = >sk_rx_chain[nexti];
 	}
 
-	for (i = 0; i < MSK_RX_RING_CNT; i++) {
-		if (msk_newbuf(sc_if, i, NULL,
-		sc_if->sk_cdata.sk_rx_jumbo_map) == ENOBUFS) {
-			aprint_error_dev(sc_if->sk_dev, "failed alloc of %dth mbuf\n", i);
-			return (ENOBUFS);
-		}
-	}
-
-	sc_if->sk_cdata.sk_rx_prod = MSK_RX_RING_CNT - 1;
+	sc_if->sk_cdata.sk_rx_prod = 0;
 	sc_if->sk_cdata.sk_rx_cons = 0;
+	sc_if->sk_cdata.sk_rx_cnt = 0;
 
+	msk_fill_rx_ring(sc_if);
 	return (0);
 }
 
@@ -478,7 +473,7 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 }
 
 int
-msk_newbuf(struct sk_if_softc *sc_if, int i, struct mbuf *m,
+msk_newbuf(struct sk_if_softc *sc_if, struct mbuf *m,
 	  bus_dmamap_t dmamap)
 {
 	struct mbuf		*m_new = NULL;
@@ -516,7 +511,7 @@ msk_newbuf(struct sk_if_softc *sc_if, in
 	}
 	m_adj(m_new, ETHER_ALIGN);
 
-	c = _if->sk_cdata.sk_rx_chain[i];
+	c = _if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
 	r = c->sk_le;
 	c->sk_mbuf = m_new;
 	r->sk_addr = htole32(dmamap->dm_segs[0].ds_addr +
@@ -526,7 +521,11 @@ msk_newbuf(struct sk_if_softc *sc_if, in
 	r->sk_ctl = 0;
 	r->sk_opcode = SK_Y2_RXOPC_PACKET | SK_Y2_RXOPC_OWN;
 
-	MSK_CDRXSYNC(sc_if, i, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+	MSK_CDRXSYNC(sc_if, sc_if->sk_cdata.sk_rx_prod,
+	BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+
+	SK_INC(sc_if->sk_cdata.sk_rx_prod, MSK_RX_RING_CNT);
+	sc_if->sk_cdata.sk_rx_cnt++;
 
 	return (0);
 }
@@ -765,6 +764,9 @@ msk_update_int_mod(struct sk_softc *sc, 
 	case SK_YUKON_FE:
 		imtimer_ticks = SK_IMTIMER_TICKS_YUKON_FE;
 		break;
+	case SK_YUKON_FE_P:
+		imtimer_ticks = 

CVS commit: src/sys/dev/pci

2018-07-02 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jul  2 06:03:13 UTC 2018

Modified Files:
src/sys/dev/pci: if_msk.c if_mskvar.h

Log Message:
sync OpenBSD if_msk.c revs 1.66-1.79 skipping framework changes and already
present changes:
- Make Yukon-2 FE+ (88E8040, 88E8042) work
- 88E8057 is a Yukon 2 Ultra 2, and this might make it work on a little
  shiny green box in Japan
- Prevent null pointer dereference that could happen when we process an RX
  interrupt that was queued while stopping the interface.
- Remove holdover XMAC II writes/reads inherited from sk as
  they aren't required and cause problems like the 88E8072
  hard locking a system when enabling macsec bypass.
- Bypass macsec on extreme/supreme based chips.
  Makes my 88E8072 work.
- Add detach support to a few more drivers, and in others do the neccessary
  operations in the detach function in the right order.

towards resolution of PR kern/53301 but will need more work

tested by John Halfpenny on another 8040/Yukon-2 FE+ and reported
improving behaviour (system hang to stall) so committing as stopgap; also
tested on my SK-9E22 (Yukon-2 XL), there works without any issues both before
and after


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/if_mskvar.h

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