CVS commit: src/sys/dev/pci

2018-07-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 04:04:08 UTC 2018

Modified Files:
src/sys/dev/pci: ppbreg.h

Log Message:
 VGA 16 bit decode bit is not bit 3 but bit 4.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/ppbreg.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/ppbreg.h
diff -u src/sys/dev/pci/ppbreg.h:1.8 src/sys/dev/pci/ppbreg.h:1.9
--- src/sys/dev/pci/ppbreg.h:1.8	Mon Dec 18 04:48:28 2017
+++ src/sys/dev/pci/ppbreg.h	Mon Jul  2 04:04:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppbreg.h,v 1.8 2017/12/18 04:48:28 msaitoh Exp $	*/
+/*	$NetBSD: ppbreg.h,v 1.9 2018/07/02 04:04:08 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -100,7 +100,7 @@
 #define PPB_BC_SERR_ENABLE (1U << (1 + PPB_BC_BITBASE))
 #define PPB_BC_ISA_ENABLE  (1U << (2 + PPB_BC_BITBASE))
 #define PPB_BC_VGA_ENABLE  (1U << (3 + PPB_BC_BITBASE))
-#define PPB_BC_VGA16_ENABLE(1U << (3 + PPB_BC_BITBASE))
+#define PPB_BC_VGA16_ENABLE(1U << (4 + PPB_BC_BITBASE))
 #define PPB_BC_MASTER_ABORT_MODE   (1U << (5 + PPB_BC_BITBASE))
 #define PPB_BC_SECONDARY_RESET (1U << (6 + PPB_BC_BITBASE))
 #define	PPB_BC_FAST_B2B_ENABLE		   (1U << (7 + PPB_BC_BITBASE))



CVS commit: src/sys/dev/pci

2018-07-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  2 03:52:32 UTC 2018

Modified Files:
src/sys/dev/pci: pcireg.h

Log Message:
 VGA 16 bit decode bit is not bit 3 but bit 4.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/pci/pcireg.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/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.138 src/sys/dev/pci/pcireg.h:1.139
--- src/sys/dev/pci/pcireg.h:1.138	Wed May  9 03:50:51 2018
+++ src/sys/dev/pci/pcireg.h	Mon Jul  2 03:52:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.138 2018/05/09 03:50:51 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.139 2018/07/02 03:52:32 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1327,7 +1327,7 @@ typedef u_int8_t pci_intr_line_t;
 #define   PCI_BRIDGE_CONTROL_SERR		(1 <<  1)
 #define   PCI_BRIDGE_CONTROL_ISA		(1 <<  2)
 #define   PCI_BRIDGE_CONTROL_VGA		(1 <<  3)
-#define   PCI_BRIDGE_CONTROL_VGA16		(1 <<  3)
+#define   PCI_BRIDGE_CONTROL_VGA16		(1 <<  4)
 #define   PCI_BRIDGE_CONTROL_MABRT		(1 <<  5)
 #define   PCI_BRIDGE_CONTROL_SECBR		(1 <<  6)
 #define   PCI_BRIDGE_CONTROL_SECFASTB2B		(1 <<  7)



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:41:37 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: std.exynos

Log Message:
add options __HAVE_GENERIC_CPU_INITCLOCKS


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/std.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/evbarm/conf/std.exynos
diff -u src/sys/arch/evbarm/conf/std.exynos:1.5 src/sys/arch/evbarm/conf/std.exynos:1.6
--- src/sys/arch/evbarm/conf/std.exynos:1.5	Wed Jul  5 01:08:44 2017
+++ src/sys/arch/evbarm/conf/std.exynos	Sun Jul  1 23:41:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.exynos,v 1.5 2017/07/05 01:08:44 jmcneill Exp $
+#	$NetBSD: std.exynos,v 1.6 2018/07/01 23:41:37 jmcneill Exp $
 #
 
 machine	evbarm arm
@@ -27,6 +27,7 @@ options 	FPU_VFP
 options 	PCI_NETBSD_CONFIGURE
 options 	__HAVE_PCI_CONF_HOOK
 options 	__BUS_SPACE_HAS_STREAM_METHODS
+options 	__HAVE_GENERIC_CPU_INITCLOCKS
 
 makeoptions	KERNEL_BASE_PHYS="0x4000"
 makeoptions	KERNEL_BASE_VIRT="0x8000"



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:28:40 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
Removed Files:
src/sys/arch/arm/samsung: exynos_chipid.c exynos_sysmmu.c

Log Message:
Delete chipid and sysmmu drivers, they don't do anything but print that
they are not implemented at attach time.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/samsung/exynos_chipid.c \
src/sys/arch/arm/samsung/exynos_sysmmu.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/files.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.25 src/sys/arch/arm/samsung/files.exynos:1.26
--- src/sys/arch/arm/samsung/files.exynos:1.25	Sat Mar 17 18:34:09 2018
+++ src/sys/arch/arm/samsung/files.exynos	Sun Jul  1 23:28:40 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.exynos,v 1.25 2018/03/17 18:34:09 ryo Exp $
+#	$NetBSD: files.exynos,v 1.26 2018/07/01 23:28:40 jmcneill Exp $
 #
 # Configuration info for Samsung Exynos SoC ARM Peripherals
 #
@@ -50,16 +50,6 @@ device  exyointr
 attach  exyointr at fdt with exynos_intr
 file	arch/arm/samsung/exynos_combiner.c	exynos_intr
 
-# CHIP ID register
-device	chipid : fdtbus
-attach	chipid at fdt with exynos_chipid
-file	arch/arm/samsung/exynos_chipid.c	exynos_chipid
-
-# SYSMMU
-device	sysmmu : fdtbus
-attach	sysmmu at fdt with exynos_sysmmu
-file	arch/arm/samsung/exynos_sysmmu.c	exynos_sysmmu
-
 # real time clock
 device  exyortc : fdtbus
 attach  exyortc at fdt with exynos_rtc



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:27:43 UTC 2018

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

Log Message:
Remove chipid and sysmmu drivers


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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/evbarm/conf/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.25 src/sys/arch/evbarm/conf/EXYNOS:1.26
--- src/sys/arch/evbarm/conf/EXYNOS:1.25	Sat Jun 30 16:48:49 2018
+++ src/sys/arch/evbarm/conf/EXYNOS	Sun Jul  1 23:27:43 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.25 2018/06/30 16:48:49 jmcneill Exp $
+#	$NetBSD: EXYNOS,v 1.26 2018/07/01 23:27:43 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -65,10 +65,6 @@ exy5422clk*	at fdt? pass 3		# Exynos5422
 exyopctl*	at fdt? pass 2		# GPIO
 gpio*		at gpiobus?
 
-# Exynos SoC support
-chipid*		at fdt?
-sysmmu*		at fdt?
-
 # UART
 sscom*		at fdt?			# UART
 



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:21:43 UTC 2018

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

Log Message:
Add missing call to arm_fdt_timer_register


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/mct.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/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.12 src/sys/arch/arm/samsung/mct.c:1.13
--- src/sys/arch/arm/samsung/mct.c:1.12	Sun Jun 11 16:21:41 2017
+++ src/sys/arch/arm/samsung/mct.c	Sun Jul  1 23:21:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mct.c,v 1.12 2017/06/11 16:21:41 jmcneill Exp $	*/
+/*	$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.12 2017/06/11 16:21:41 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $");
 
 #include 
 #include 
@@ -176,4 +176,5 @@ mct_attach(device_t parent, device_t sel
 	config_found(self, , NULL);
 
 	arm_fdt_cpu_hatch_register(self, mct_fdt_cpu_hatch);
+	arm_fdt_timer_register(gtmr_cpu_initclocks);
 }



CVS commit: src/share/man/man4

2018-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  1 22:27:43 UTC 2018

Modified Files:
src/share/man/man4: route.4

Log Message:
Add more message types.
XXX: Need more updates to the doc


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/share/man/man4/route.4

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

Modified files:

Index: src/share/man/man4/route.4
diff -u src/share/man/man4/route.4:1.31 src/share/man/man4/route.4:1.32
--- src/share/man/man4/route.4:1.31	Mon Jul  3 17:30:58 2017
+++ src/share/man/man4/route.4	Sun Jul  1 18:27:43 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: route.4,v 1.31 2017/07/03 21:30:58 wiz Exp $
+.\"	$NetBSD: route.4,v 1.32 2018/07/01 22:27:43 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)route.4	8.6 (Berkeley) 4/19/94
 .\"
-.Dd April 11, 2017
+.Dd July 11, 2018
 .Dt ROUTE 4
 .Os
 .Sh NAME
@@ -213,11 +213,22 @@ The messages are:
 #define	RTM_LOSING	0x5/* Kernel Suspects Partitioning */
 #define	RTM_REDIRECT	0x6/* Told to use different route */
 #define	RTM_MISS	0x7/* Lookup failed on this address */
+#define RTM_LOCK	0x8	/* fix specified metrics */
+#define RTM_OLDADD	0x9	/* caused by SIOCADDRT */
+#define RTM_OLDDEL	0xa	/* caused by SIOCDELRT */
 #define	RTM_ONEWADDR	0xc/* Old (pre-8.0) RTM_NEWADDR message */
+// #define RTM_RESOLVE	0xb	/* req to resolve dst to LL addr */
 #define	RTM_ODELADDR	0xd/* Old (pre-8.0) RTM_DELADDR message */
 #define	RTM_OOIFINFO	0xe/* Old (pre-1.5) RTM_IFINFO message */
 #define	RTM_OIFINFO	0xf/* Old (pre-6.0) RTM_IFINFO message */
 #define	RTM_IFANNOUNCE	0x10   /* iface arrival/departure */
+#define	RTM_IEEE80211	0x11	/* IEEE80211 wireless event */
+#define	RTM_SETGATE	0x12	/* set prototype gateway for clones
+ * (see example in arp_rtrequest).
+ */
+#define	RTM_LLINFO_UPD	0x13	/* indication to ARP/NDP/etc. that link-layer
+ * address has changed
+ */
 #define	RTM_IFINFO	0x14   /* iface/link going up/down etc. */
 #define	RTM_OCHGADDR	0x15   /* Old (pre-8.0) RTM_CHGADDR message */
 #define	RTM_NEWADDR	0x16   /* address being added to iface */



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:23:17 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_bsc.c

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm2835_bsc.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/broadcom/bcm2835_bsc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.12 src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.13
--- src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.12	Thu Jun  7 05:07:28 2018
+++ src/sys/arch/arm/broadcom/bcm2835_bsc.c	Sun Jul  1 21:23:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_bsc.c,v 1.12 2018/06/07 05:07:28 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_bsc.c,v 1.13 2018/07/01 21:23:16 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.12 2018/06/07 05:07:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.13 2018/07/01 21:23:16 jmcneill Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_kernhist.h"
@@ -102,9 +102,6 @@ bsciic_attach(device_t parent, device_t 
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 	prop_dictionary_t prop = device_properties(self);
-	prop_dictionary_t devs;
-	uint32_t address_cells;
-	struct i2cbus_attach_args iba;
 	bool disable = false;
 
 	static ONCE_DECL(control);
@@ -172,20 +169,7 @@ bsciic_attach(device_t parent, device_t 
 	sc->sc_i2c.ic_release_bus = bsciic_release_bus;
 	sc->sc_i2c.ic_exec = bsciic_exec;
 
-	devs = prop_dictionary_create();
-	if (of_getprop_uint32(phandle, "#address-cells", _cells))
-		address_cells = 1;
-
-	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_i2c;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	config_found_ia(self, "i2cbus", , iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, >sc_i2c, iicbus_print);
 }
 
 void



CVS commit: src/sys/dev/fdt

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:21:56 UTC 2018

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

Log Message:
Fix 32-bit build


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/sys/dev/fdt/dwcmmc_fdt.c:1.4
--- src/sys/dev/fdt/dwcmmc_fdt.c:1.3	Fri Jun 22 10:17:04 2018
+++ src/sys/dev/fdt/dwcmmc_fdt.c	Sun Jul  1 21:21:56 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwcmmc_fdt.c,v 1.3 2018/06/22 10:17:04 jmcneill Exp $ */
+/* $NetBSD: dwcmmc_fdt.c,v 1.4 2018/07/01 21:21:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.3 2018/06/22 10:17:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.4 2018/07/01 21:21:56 jmcneill Exp $");
 
 #include 
 #include 
@@ -133,7 +133,7 @@ dwcmmc_fdt_attach(device_t parent, devic
 		(uint64_t)addr, error);
 		return;
 	}
-	esc->sc_conf = of_search_compatible(phandle, compat_data)->data;
+	esc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data;
 
 
 	if (of_getprop_uint32(phandle, "max-frequency", >sc_clock_freq) != 0)



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:22:16 UTC 2018

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

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_i2c.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_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.14 src/sys/arch/arm/samsung/exynos_i2c.c:1.15
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.14	Wed May  9 02:53:00 2018
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Sun Jul  1 21:22:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.14 2018/05/09 02:53:00 thorpej Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.15 2018/07/01 21:22:16 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.14 2018/05/09 02:53:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.15 2018/07/01 21:22:16 jmcneill Exp $");
 
 #include 
 #include 
@@ -67,7 +67,6 @@ struct exynos_i2c_softc {
 	struct i2c_controller 	sc_ic;
 	kmutex_t		sc_lock;
 	kcondvar_t		sc_cv;
-	device_t		sc_i2cdev;
 };
 
 static int	exynos_i2c_intr(void *);
@@ -137,9 +136,6 @@ exynos_i2c_attach(device_t parent, devic
 struct exynos_i2c_softc * const sc =  device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	struct i2cbus_attach_args iba;
-	prop_dictionary_t devs;
-	uint32_t address_cells;
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
@@ -188,19 +184,7 @@ exynos_i2c_attach(device_t parent, devic
 
 	fdtbus_register_i2c_controller(self, phandle, _i2c_funcs);
 
-	devs = prop_dictionary_create();
-	if (of_getprop_uint32(phandle, "#address-cells", _cells))
-		address_cells = 1;
-	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_ic;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices != NULL)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	sc->sc_i2cdev = config_found_ia(self, "i2cbus", , iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, >sc_ic, iicbus_print);
 }
 
 static i2c_tag_t



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:18:00 UTC 2018

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

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/nvidia/tegra_i2c.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_i2c.c
diff -u src/sys/arch/arm/nvidia/tegra_i2c.c:1.17 src/sys/arch/arm/nvidia/tegra_i2c.c:1.18
--- src/sys/arch/arm/nvidia/tegra_i2c.c:1.17	Wed May  9 02:53:00 2018
+++ src/sys/arch/arm/nvidia/tegra_i2c.c	Sun Jul  1 21:18:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_i2c.c,v 1.17 2018/05/09 02:53:00 thorpej Exp $ */
+/* $NetBSD: tegra_i2c.c,v 1.18 2018/07/01 21:18:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.17 2018/05/09 02:53:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.18 2018/07/01 21:18:00 jmcneill Exp $");
 
 #include 
 #include 
@@ -65,7 +65,6 @@ struct tegra_i2c_softc {
 	struct i2c_controller	sc_ic;
 	kmutex_t		sc_lock;
 	kcondvar_t		sc_cv;
-	device_t		sc_i2cdev;
 };
 
 static void	tegra_i2c_init(struct tegra_i2c_softc *);
@@ -112,12 +111,9 @@ tegra_i2c_attach(device_t parent, device
 	struct tegra_i2c_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	struct i2cbus_attach_args iba;
-	prop_dictionary_t devs;
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
-	u_int address_cells;
 	int error;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -189,21 +185,7 @@ tegra_i2c_attach(device_t parent, device
 
 	fdtbus_register_i2c_controller(self, phandle, _i2c_funcs);
 
-	devs = prop_dictionary_create();
-
-	if (of_getprop_uint32(phandle, "#address-cells", _cells))
-		address_cells = 1;
-
-	of_enter_i2c_devs(devs, faa->faa_phandle, address_cells * 4, 0);
-
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_ic;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices != NULL)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	sc->sc_i2cdev = config_found_ia(self, "i2cbus", , iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, >sc_ic, iicbus_print);
 }
 
 static i2c_tag_t



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:16:19 UTC 2018

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

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_twi.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_twi.c
diff -u src/sys/arch/arm/sunxi/sunxi_twi.c:1.9 src/sys/arch/arm/sunxi/sunxi_twi.c:1.10
--- src/sys/arch/arm/sunxi/sunxi_twi.c:1.9	Wed May  9 02:53:00 2018
+++ src/sys/arch/arm/sunxi/sunxi_twi.c	Sun Jul  1 21:16:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_twi.c,v 1.9 2018/05/09 02:53:00 thorpej Exp $ */
+/* $NetBSD: sunxi_twi.c,v 1.10 2018/07/01 21:16:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.9 2018/05/09 02:53:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.10 2018/07/01 21:16:19 jmcneill Exp $");
 
 #include 
 #include 
@@ -161,12 +161,9 @@ sunxi_twi_attach(device_t parent, device
 	struct gttwsi_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const struct sunxi_twi_config *conf;
-	struct i2cbus_attach_args iba;
 	const int phandle = faa->faa_phandle;
 	bus_space_tag_t bst = faa->faa_bst;
 	bus_space_handle_t bsh;
-	prop_dictionary_t devs;
-	uint32_t address_cells;
 	struct fdtbus_reset *rst;
 	struct clk *clk;
 	char intrstr[128];
@@ -225,18 +222,5 @@ sunxi_twi_attach(device_t parent, device
 
 	fdtbus_register_i2c_controller(self, phandle, _twi_funcs);
 
-	devs = prop_dictionary_create();
-	if (of_getprop_uint32(phandle, "#address-cells", _cells))
-		address_cells = 1;
-
-	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_i2c;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	config_found_ia(self, "i2cbus", , iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, >sc_i2c, iicbus_print);
 }



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:15:02 UTC 2018

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

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_rsb.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_rsb.c
diff -u src/sys/arch/arm/sunxi/sunxi_rsb.c:1.2 src/sys/arch/arm/sunxi/sunxi_rsb.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_rsb.c:1.2	Wed May  9 02:53:00 2018
+++ src/sys/arch/arm/sunxi/sunxi_rsb.c	Sun Jul  1 21:15:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_rsb.c,v 1.2 2018/05/09 02:53:00 thorpej Exp $ */
+/* $NetBSD: sunxi_rsb.c,v 1.3 2018/07/01 21:15:02 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_rsb.c,v 1.2 2018/05/09 02:53:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_rsb.c,v 1.3 2018/07/01 21:15:02 jmcneill Exp $");
 
 #include 
 #include 
@@ -141,9 +141,6 @@ sunxi_rsb_attach(device_t parent, device
 	struct sunxi_rsb_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	struct i2cbus_attach_args iba;
-	prop_dictionary_t devs;
-	uint32_t address_cells;
 	struct fdtbus_reset *rst;
 	struct clk *clk;
 	char intrstr[128];
@@ -209,20 +206,7 @@ sunxi_rsb_attach(device_t parent, device
 
 	fdtbus_register_i2c_controller(self, phandle, _rsb_funcs);
 
-	devs = prop_dictionary_create();
-	if (of_getprop_uint32(phandle, "#address-cells", _cells))
-		address_cells = 1;
-
-	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_ic;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	sc->sc_i2cdev = config_found_ia(self, "i2cbus", , iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, >sc_ic, iicbus_print);
 }
 
 static int



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 18:18:18 UTC 2018

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

Log Message:
Add rkiic


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.24 src/sys/arch/evbarm/conf/GENERIC64:1.25
--- src/sys/arch/evbarm/conf/GENERIC64:1.24	Sun Jul  1 15:33:29 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Jul  1 18:18:18 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.24 2018/07/01 15:33:29 skrll Exp $
+#	$NetBSD: GENERIC64,v 1.25 2018/07/01 18:18:18 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -220,6 +220,7 @@ plcom*		at fdt?			# ARM PL011 UART
 
 # I2C controllers
 bsciic*		at fdt?			# Broadcom BCM283x Serial Control
+rkiic*		at fdt?			# Rockchip I2C
 sunxirsb*	at fdt?			# Allwinner RSB
 sunxitwi*	at fdt?			# Allwinner TWI
 tegrai2c*	at fdt? pass 4		# NVIDIA Tegra I2C



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 18:16:58 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: files.rockchip
Added Files:
src/sys/arch/arm/rockchip: rk_i2c.c

Log Message:
Add driver for Rockchip I2C controller.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/rockchip/rk_i2c.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/files.rockchip
diff -u src/sys/arch/arm/rockchip/files.rockchip:1.13 src/sys/arch/arm/rockchip/files.rockchip:1.14
--- src/sys/arch/arm/rockchip/files.rockchip:1.13	Sat Jun 16 00:19:04 2018
+++ src/sys/arch/arm/rockchip/files.rockchip	Sun Jul  1 18:16:58 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rockchip,v 1.13 2018/06/16 00:19:04 jmcneill Exp $
+#	$NetBSD: files.rockchip,v 1.14 2018/07/01 18:16:58 jmcneill Exp $
 #
 # Configuration info for Rockchip family SoCs
 #
@@ -29,6 +29,11 @@ device	rkgpio: gpiobus
 attach	rkgpio at rkiomux with rk_gpio
 file	arch/arm/rockchip/rk_gpio.c		rk_gpio
 
+# I2C
+device	rkiic: i2cbus, i2cexec
+attach	rkiic at fdt with rk_i2c
+file	arch/arm/rockchip/rk_i2c.c		rk_i2c
+
 # USB PHY
 device	rkusb { }
 attach	rkusb at fdt with rk_usb

Added files:

Index: src/sys/arch/arm/rockchip/rk_i2c.c
diff -u /dev/null src/sys/arch/arm/rockchip/rk_i2c.c:1.1
--- /dev/null	Sun Jul  1 18:16:58 2018
+++ src/sys/arch/arm/rockchip/rk_i2c.c	Sun Jul  1 18:16:58 2018
@@ -0,0 +1,435 @@
+/* $NetBSD: rk_i2c.c,v 1.1 2018/07/01 18:16:58 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+
+__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.1 2018/07/01 18:16:58 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	RKI2C_CON		0x000
+#define	 RKI2C_CON_ACT2NAK	__BIT(6)
+#define	 RKI2C_CON_ACK		__BIT(5)
+#define	 RKI2C_CON_STOP		__BIT(4)
+#define	 RKI2C_CON_START	__BIT(3)
+#define	 RKI2C_CON_I2C_MODE	__BITS(2,1)
+#define	  RKI2C_CON_I2C_MODE_TX		0
+#define	  RKI2C_CON_I2C_MODE_RTX	1
+#define	  RKI2C_CON_I2C_MODE_RX		2
+#define	  RKI2C_CON_I2C_MODE_RRX	3
+#define	 RKI2C_CON_I2C_EN	__BIT(0)
+
+#define	RKI2C_CLKDIV		0x004
+#define	 RKI2C_CLKDIV_CLKDIVH	__BITS(31,16)
+#define	 RKI2C_CLKDIV_CLKDIVL	__BITS(15,0)
+
+#define	RKI2C_MRXADDR		0x008
+#define	 RKI2C_MRXADDR_ADDHVLD	__BIT(26)
+#define	 RKI2C_MRXADDR_ADDMVLD	__BIT(25)
+#define	 RKI2C_MRXADDR_ADDLVLD	__BIT(24)
+#define	 RKI2C_MRXADDR_SADDR	__BITS(23,0)
+
+#define	RKI2C_MRXRADDR		0x00c
+#define	 RKI2C_MRXRADDR_ADDHVLD	__BIT(26)
+#define	 RKI2C_MRXRADDR_ADDMVLD	__BIT(25)
+#define	 RKI2C_MRXRADDR_ADDLVLD	__BIT(24)
+#define	 RKI2C_MRXRADDR_SADDR	__BITS(23,0)
+
+#define	RKI2C_MTXCNT		0x010
+#define	 RKI2C_MTXCNT_MTXCNT	__BITS(5,0)
+
+#define	RKI2C_MRXCNT		0x014
+#define	 RKI2C_MRXCNT_MRXCNT	__BITS(5,0)
+
+#define	RKI2C_IEN		0x018
+#define	 RKI2C_IEN_NAKRCVIEN	__BIT(6)
+#define	 RKI2C_IEN_STOPIEN	__BIT(5)
+#define	 RKI2C_IEN_STARTIEN	__BIT(4)
+#define	 RKI2C_IEN_MBRFIEN	__BIT(3)
+#define	 RKI2C_IEN_MBTFIEN	__BIT(2)
+#define	 RKI2C_IEN_BRFIEN	__BIT(1)
+#define	 RKI2C_IEN_BTFIEN	__BIT(0)
+
+#define	RKI2C_IPD		0x01c
+#define	 RKI2C_IPD_NAKRCVIPD	__BIT(6)
+#define	 RKI2C_IPD_STOPIPD	__BIT(5)
+#define	 RKI2C_IPD_STARTIPD	__BIT(4)
+#define	 RKI2C_IPD_MBRFIPD	__BIT(3)
+#define	 RKI2C_IPD_MBTFIPD	__BIT(2)
+#define	 RKI2C_IPD_BRFIPD	__BIT(1)
+#define	 RKI2C_IPD_BTFIPD	__BIT(0)
+
+#define	RKI2C_FCNT		0x020
+#define	 RKI2C_FCNT_FCNT	__BITS(5,0)
+
+#define	

CVS commit: src/sys/dev/fdt

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 18:16:40 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_i2c.c fdtvar.h

Log Message:
Add fdtbus_attach_i2cbus, used to attach an i2cbus to an fdt device node.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_i2c.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/fdt/fdtvar.h

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

Modified files:

Index: src/sys/dev/fdt/fdt_i2c.c
diff -u src/sys/dev/fdt/fdt_i2c.c:1.3 src/sys/dev/fdt/fdt_i2c.c:1.4
--- src/sys/dev/fdt/fdt_i2c.c:1.3	Sat Jun 30 20:34:43 2018
+++ src/sys/dev/fdt/fdt_i2c.c	Sun Jul  1 18:16:40 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_i2c.c,v 1.3 2018/06/30 20:34:43 jmcneill Exp $ */
+/* $NetBSD: fdt_i2c.c,v 1.4 2018/07/01 18:16:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_i2c.c,v 1.3 2018/06/30 20:34:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_i2c.c,v 1.4 2018/07/01 18:16:40 jmcneill Exp $");
 
 #include 
 #include 
@@ -88,3 +88,26 @@ fdtbus_get_i2c_tag(int phandle)
 
 	return i2c->i2c_funcs->get_tag(i2c->i2c_dev);
 }
+
+device_t
+fdtbus_attach_i2cbus(device_t dev, int phandle, i2c_tag_t tag, cfprint_t print)
+{
+	struct i2cbus_attach_args iba;
+	prop_dictionary_t devs;
+	u_int address_cells;
+
+	devs = prop_dictionary_create();
+	if (of_getprop_uint32(phandle, "#address-cells", _cells))
+		address_cells = 1;
+
+	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
+
+	memset(, 0, sizeof(iba));
+	iba.iba_tag = tag;
+	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
+	if (iba.iba_child_devices)
+		prop_object_retain(iba.iba_child_devices);
+	prop_object_release(devs);
+
+	return config_found_ia(dev, "i2cbus", , print);
+}

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.37 src/sys/dev/fdt/fdtvar.h:1.38
--- src/sys/dev/fdt/fdtvar.h:1.37	Sat Jun 30 18:07:12 2018
+++ src/sys/dev/fdt/fdtvar.h	Sun Jul  1 18:16:40 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.37 2018/06/30 18:07:12 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.38 2018/07/01 18:16:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -333,6 +333,8 @@ int		fdtbus_todr_attach(device_t, int, t
 void		fdtbus_power_reset(void);
 void		fdtbus_power_poweroff(void);
 
+device_t	fdtbus_attach_i2cbus(device_t, int, i2c_tag_t, cfprint_t);
+
 bool		fdtbus_set_data(const void *);
 const void *	fdtbus_get_data(void);
 int		fdtbus_phandle2offset(int);



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 18:15:19 UTC 2018

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

Log Message:
Add i2c clocks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk3328_cru.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk3328_cru.c
diff -u src/sys/arch/arm/rockchip/rk3328_cru.c:1.2 src/sys/arch/arm/rockchip/rk3328_cru.c:1.3
--- src/sys/arch/arm/rockchip/rk3328_cru.c:1.2	Sat Jun 16 23:14:47 2018
+++ src/sys/arch/arm/rockchip/rk3328_cru.c	Sun Jul  1 18:15:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328_cru.c,v 1.2 2018/06/16 23:14:47 jmcneill Exp $ */
+/* $NetBSD: rk3328_cru.c,v 1.3 2018/07/01 18:15:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3328_cru.c,v 1.2 2018/06/16 23:14:47 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3328_cru.c,v 1.3 2018/07/01 18:15:19 jmcneill Exp $");
 
 #include 
 #include 
@@ -299,6 +299,34 @@ static struct rk_cru_clk rk3328_cru_clks
 		 CLKGATE_CON(3),	/* gate_reg */
 		 __BIT(5),		/* gate_mask */
 		 0),
+	RK_COMPOSITE(RK3328_SCLK_I2C0, "clk_i2c0", mux_2plls_parents,
+		 CLKSEL_CON(34),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(2),	/* gate_reg */
+		 __BIT(9),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3328_SCLK_I2C1, "clk_i2c1", mux_2plls_parents,
+		 CLKSEL_CON(34),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(2),	/* gate_reg */
+		 __BIT(10),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3328_SCLK_I2C2, "clk_i2c2", mux_2plls_parents,
+		 CLKSEL_CON(35),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(2),	/* gate_reg */
+		 __BIT(11),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3328_SCLK_I2C3, "clk_i2c3", mux_2plls_parents,
+		 CLKSEL_CON(35),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(2),	/* gate_reg */
+		 __BIT(12),		/* gate_mask */
+		 0),
 
 	RK_GATE(0, "apll_core", "apll", CLKGATE_CON(0), 0),
 	RK_GATE(0, "dpll_core", "dpll", CLKGATE_CON(0), 1),
@@ -310,6 +338,10 @@ static struct rk_cru_clk rk3328_cru_clks
 	RK_GATE(0, "pclk_bus", "pclk_bus_pre", CLKGATE_CON(8), 3),
 	RK_GATE(0, "pclk_phy_pre", "pclk_bus_pre", CLKGATE_CON(8), 4),
 	RK_GATE(RK3328_ACLK_PERI, "aclk_peri", "aclk_peri_pre", CLKGATE_CON(10), 0),
+	RK_GATE(RK3328_PCLK_I2C0, "pclk_i2c0", "pclk_bus", CLKGATE_CON(15), 10),
+	RK_GATE(RK3328_PCLK_I2C1, "pclk_i2c1", "pclk_bus", CLKGATE_CON(16), 0),
+	RK_GATE(RK3328_PCLK_I2C2, "pclk_i2c2", "pclk_bus", CLKGATE_CON(16), 1),
+	RK_GATE(RK3328_PCLK_I2C3, "pclk_i2c3", "pclk_bus", CLKGATE_CON(16), 2),
 	RK_GATE(RK3328_PCLK_GPIO0, "pclk_gpio0", "pclk_bus", CLKGATE_CON(16), 7),
 	RK_GATE(RK3328_PCLK_GPIO1, "pclk_gpio1", "pclk_bus", CLKGATE_CON(16), 8),
 	RK_GATE(RK3328_PCLK_GPIO2, "pclk_gpio2", "pclk_bus", CLKGATE_CON(16), 9),



CVS commit: src/external/gpl3/gcc/lib

2018-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  1 17:41:50 UTC 2018

Modified Files:
src/external/gpl3/gcc/lib: Makefile.sanitizer
src/external/gpl3/gcc/lib/libasan: Makefile
src/external/gpl3/gcc/lib/liblsan: Makefile
src/external/gpl3/gcc/lib/libubsan: Makefile

Log Message:
vaxinate the sanitizer build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc/lib/Makefile.sanitizer
cvs rdiff -u -r1.25 -r1.26 src/external/gpl3/gcc/lib/libasan/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/lib/liblsan/Makefile
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/lib/libubsan/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/lib/Makefile.sanitizer
diff -u src/external/gpl3/gcc/lib/Makefile.sanitizer:1.5 src/external/gpl3/gcc/lib/Makefile.sanitizer:1.6
--- src/external/gpl3/gcc/lib/Makefile.sanitizer:1.5	Sat Jun  9 18:40:00 2018
+++ src/external/gpl3/gcc/lib/Makefile.sanitizer	Sun Jul  1 13:41:49 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sanitizer,v 1.5 2018/06/09 22:40:00 christos Exp $
+#	$NetBSD: Makefile.sanitizer,v 1.6 2018/07/01 17:41:49 christos Exp $
 
 SANITIZER=${GCCDIST}/libsanitizer
 .PATH: ${SANITIZER}/interception ${SANITIZER}/sanitizer_common
@@ -79,13 +79,18 @@ COPTS+=-fno-builtin -fno-exceptions -fno
 
 .if ${MACHINE_ARCH} == "vax"
 COPTS.sanitizer_allocator.cc += -O1
+COPTS.sanitizer_common.cc += -O1
+COPTS.sanitizer_common_libcdep.cc += -O1
 COPTS.sanitizer_coverage_libcdep.cc += -O1
 COPTS.sanitizer_coverage_mapping_libcdep.cc += -O1
 COPTS.sanitizer_deadlock_detector1.cc += -O1
 COPTS.sanitizer_mac.cc += -O1
 COPTS.sanitizer_netbsd.cc += -O1
+COPTS.sanitizer_posix.cc += -O1
 COPTS.sanitizer_printf.cc += -O1
 COPTS.sanitizer_procmaps_common.cc += -O1
 COPTS.sanitizer_stackdepot.cc += -O1
 COPTS.sanitizer_symbolizer_libcdep.cc += -O1
+COPTS.ubsan_diag.cc += -O1
+COPTS.ubsan_init.cc += -O1
 .endif

Index: src/external/gpl3/gcc/lib/libasan/Makefile
diff -u src/external/gpl3/gcc/lib/libasan/Makefile:1.25 src/external/gpl3/gcc/lib/libasan/Makefile:1.26
--- src/external/gpl3/gcc/lib/libasan/Makefile:1.25	Thu Jun 28 06:15:01 2018
+++ src/external/gpl3/gcc/lib/libasan/Makefile	Sun Jul  1 13:41:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2018/06/28 10:15:01 christos Exp $
+# $NetBSD: Makefile,v 1.26 2018/07/01 17:41:49 christos Exp $
 
 UNSUPPORTED_COMPILER.clang=	# defined
 NOSANITIZER=	# defined
@@ -43,9 +43,6 @@ LIBDPLIBS+= rt ${NETBSDSRCDIR}/lib/librt
 .if ${MACHINE_ARCH} == "vax"
 COPTS.asan_allocator.cc += -O1
 COPTS.asan_report.cc += -O1
-COPTS.sanitizer_common.cc += -O1
-COPTS.sanitizer_common_libcdep.cc += -O1
-COPTS.sanitizer_posix.cc += -O1
 COPTS.ubsan_diag.cc += -O1
 COPTS.ubsan_init.cc += -O1
 .endif

Index: src/external/gpl3/gcc/lib/liblsan/Makefile
diff -u src/external/gpl3/gcc/lib/liblsan/Makefile:1.2 src/external/gpl3/gcc/lib/liblsan/Makefile:1.3
--- src/external/gpl3/gcc/lib/liblsan/Makefile:1.2	Tue Jun 26 17:06:45 2018
+++ src/external/gpl3/gcc/lib/liblsan/Makefile	Sun Jul  1 13:41:50 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2018/06/26 21:06:45 christos Exp $
+# $NetBSD: Makefile,v 1.3 2018/07/01 17:41:50 christos Exp $
 
 .include 
 
@@ -16,6 +16,9 @@ lsan_interceptors.cc \
 lsan_preinit.cc \
 lsan_thread.cc
 
+.if ${MACHINE_ARCH} == "vax"
+COPTS.lsan_allocator.cc += -O1
+.endif
 
 LIB=	lsan
 SRCS+=	${LSAN_SRCS}

Index: src/external/gpl3/gcc/lib/libubsan/Makefile
diff -u src/external/gpl3/gcc/lib/libubsan/Makefile:1.7 src/external/gpl3/gcc/lib/libubsan/Makefile:1.8
--- src/external/gpl3/gcc/lib/libubsan/Makefile:1.7	Mon Jun 11 11:29:33 2018
+++ src/external/gpl3/gcc/lib/libubsan/Makefile	Sun Jul  1 13:41:50 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2018/06/11 15:29:33 christos Exp $
+#	$NetBSD: Makefile,v 1.8 2018/07/01 17:41:50 christos Exp $
 
 UNSUPPORTED_COMPILER.clang=	# defined
 LIBISCXX = yes
@@ -31,8 +31,4 @@ LIB=	ubsan
 SRCS+=	${UBSAN_SRCS}
 LIBDPLIBS+= rt ${NETBSDSRCDIR}/lib/librt
 
-.if ${MACHINE_ARCH} == "vax"
-COPTS += -O1
-.endif
-
 .include 



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

2018-07-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  1 15:33:29 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64 RPI RPI2 RPI64

Log Message:
Add bcm2835-rpi-zero-w.dts and bcm2837-rpi-3-b-plus.dts as appropriate

PR/53284 -  Support RPI3B+,RPI0W,RPI2-1.2


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/RPI2
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/RPI64

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.23 src/sys/arch/evbarm/conf/GENERIC64:1.24
--- src/sys/arch/evbarm/conf/GENERIC64:1.23	Sat Jun 30 16:48:49 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Jul  1 15:33:29 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.23 2018/06/30 16:48:49 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.24 2018/07/01 15:33:29 skrll Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -17,6 +17,7 @@ makeoptions	DTSGNUARCH="arm arm64"
 makeoptions	DTSSUBDIR="allwinner broadcom nvidia rockchip"
 makeoptions	DTS="
 	bcm2837-rpi-3-b.dts
+	bcm2837-rpi-3-b-plus.dts
 
 	rk3328-evb.dts
 	rk3328-roc-cc.dts

Index: src/sys/arch/evbarm/conf/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.81 src/sys/arch/evbarm/conf/RPI:1.82
--- src/sys/arch/evbarm/conf/RPI:1.81	Sat Jun 30 16:48:49 2018
+++ src/sys/arch/evbarm/conf/RPI	Sun Jul  1 15:33:29 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.81 2018/06/30 16:48:49 jmcneill Exp $
+#	$NetBSD: RPI,v 1.82 2018/07/01 15:33:29 skrll Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -17,6 +17,7 @@ makeoptions	DTS="
 	bcm2835-rpi-b-plus.dts
 	bcm2835-rpi-b-rev2.dts
 	bcm2835-rpi-zero.dts
+	bcm2835-rpi-zero-w.dts
 "
 
 options 	CPU_ARM1176

Index: src/sys/arch/evbarm/conf/RPI2
diff -u src/sys/arch/evbarm/conf/RPI2:1.5 src/sys/arch/evbarm/conf/RPI2:1.6
--- src/sys/arch/evbarm/conf/RPI2:1.5	Wed Jun 27 11:12:14 2018
+++ src/sys/arch/evbarm/conf/RPI2	Sun Jul  1 15:33:29 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI2,v 1.5 2018/06/27 11:12:14 ryo Exp $
+#	$NetBSD: RPI2,v 1.6 2018/07/01 15:33:29 skrll Exp $
 #
 #	RPi2 -- Raspberry Pi 2
 #
@@ -30,6 +30,7 @@ options 	__HAVE_GENERIC_CPU_INITCLOCKS
 makeoptions	DTS="
 	bcm2836-rpi-2-b.dts
 	bcm2837-rpi-3-b.dts
+	bcm2837-rpi-3-b-plus.dts
 "
 # Architecture options
 

Index: src/sys/arch/evbarm/conf/RPI64
diff -u src/sys/arch/evbarm/conf/RPI64:1.4 src/sys/arch/evbarm/conf/RPI64:1.5
--- src/sys/arch/evbarm/conf/RPI64:1.4	Sat Jun 30 16:48:49 2018
+++ src/sys/arch/evbarm/conf/RPI64	Sun Jul  1 15:33:29 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI64,v 1.4 2018/06/30 16:48:49 jmcneill Exp $
+#	$NetBSD: RPI64,v 1.5 2018/07/01 15:33:29 skrll Exp $
 #
 #	RPI64 - Raspberry Pi 3 and Pi 2 v1.2 in AARCH64 mode
 #
@@ -13,6 +13,7 @@ makeoptions DTSSUBDIR="broadcom"
 
 makeoptions	DTS="
 	bcm2837-rpi-3-b.dts
+	bcm2837-rpi-3-b-plus.dts
 "
 
 # CPU options



CVS commit: src/sys/kern

2018-07-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul  1 15:12:06 UTC 2018

Modified Files:
src/sys/kern: kern_ntptime.c kern_tc.c

Log Message:
Revert "Sprinkle cold conditionals to make tc_ticktock before inittimecounter."

Not needed if we're no longer doing tc_ticktock in printf.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_ntptime.c
cvs rdiff -u -r1.50 -r1.51 src/sys/kern/kern_tc.c

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

Modified files:

Index: src/sys/kern/kern_ntptime.c
diff -u src/sys/kern/kern_ntptime.c:1.58 src/sys/kern/kern_ntptime.c:1.59
--- src/sys/kern/kern_ntptime.c:1.58	Sat Jun 30 22:47:51 2018
+++ src/sys/kern/kern_ntptime.c	Sun Jul  1 15:12:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ntptime.c,v 1.58 2018/06/30 22:47:51 riastradh Exp $	*/
+/*	$NetBSD: kern_ntptime.c,v 1.59 2018/07/01 15:12:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.58 2018/06/30 22:47:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.59 2018/07/01 15:12:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -418,7 +418,7 @@ ntp_update_second(int64_t *adjustment, t
 	int tickrate;
 	l_fp ftemp;		/* 32/64-bit temporary */
 
-	KASSERT(__predict_false(cold) || mutex_owned(_lock));
+	KASSERT(mutex_owned(_lock));
 
 #ifdef NTP
 

Index: src/sys/kern/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.50 src/sys/kern/kern_tc.c:1.51
--- src/sys/kern/kern_tc.c:1.50	Sat Jun 30 22:47:51 2018
+++ src/sys/kern/kern_tc.c	Sun Jul  1 15:12:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.50 2018/06/30 22:47:51 riastradh Exp $ */
+/* $NetBSD: kern_tc.c,v 1.51 2018/07/01 15:12:06 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.50 2018/06/30 22:47:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.51 2018/07/01 15:12:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -572,7 +572,7 @@ tc_pick(void)
 {
 	struct timecounter *best, *tc;
 
-	KASSERT(__predict_false(cold) || mutex_owned(_lock));
+	KASSERT(mutex_owned(_lock));
 
 	for (best = tc = timecounters; tc != NULL; tc = tc->tc_next) {
 		if (tc->tc_quality > best->tc_quality)
@@ -731,7 +731,7 @@ tc_windup(void)
 	int i, s_update;
 	time_t t;
 
-	KASSERT(__predict_false(cold) || mutex_owned(_lock));
+	KASSERT(mutex_owned(_lock));
 
 	s_update = 0;
 
@@ -1308,8 +1308,7 @@ tc_ticktock(void)
 	if (++count < tc_tick)
 		return;
 	count = 0;
-	if (__predict_true(!cold))
-		mutex_spin_enter(_lock);
+	mutex_spin_enter(_lock);
 	if (timecounter_bad != 0) {
 		/* An existing timecounter has gone bad, pick a new one. */
 		(void)atomic_swap_uint(_bad, 0);
@@ -1318,8 +1317,7 @@ tc_ticktock(void)
 		}
 	}
 	tc_windup();
-	if (__predict_true(!cold))
-		mutex_spin_exit(_lock);
+	mutex_spin_exit(_lock);
 }
 
 void



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2018-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  1 14:20:23 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_allocator.h

Log Message:
disable one more size check for _LP32 to make pcc build.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_allocator.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_allocator.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_allocator.h:1.2 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_allocator.h:1.3
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_allocator.h:1.2	Wed Jun 27 11:57:20 2018
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_allocator.h	Sun Jul  1 10:20:23 2018
@@ -497,7 +497,9 @@ class SizeClassAllocator64 {
 uptr mapped_meta;  // Bytes mapped for metadata.
 uptr n_allocated, n_freed;  // Just stats.
   };
+#if _LP64
   COMPILER_CHECK(sizeof(RegionInfo) >= kCacheLineSize);
+#endif
 
   RegionInfo *GetRegionInfo(uptr class_id) {
 CHECK_LT(class_id, kNumClasses);



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 10:46:02 UTC 2018

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

Log Message:
Build fix


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

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_xusb.c
diff -u src/sys/arch/arm/nvidia/tegra_xusb.c:1.13 src/sys/arch/arm/nvidia/tegra_xusb.c:1.14
--- src/sys/arch/arm/nvidia/tegra_xusb.c:1.13	Fri Jun 29 17:48:24 2018
+++ src/sys/arch/arm/nvidia/tegra_xusb.c	Sun Jul  1 10:46:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_xusb.c,v 1.13 2018/06/29 17:48:24 msaitoh Exp $ */
+/* $NetBSD: tegra_xusb.c,v 1.14 2018/07/01 10:46:02 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2016 Jonathan A. Kollasch
@@ -30,7 +30,7 @@
 #include "opt_tegra.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.13 2018/06/29 17:48:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.14 2018/07/01 10:46:02 jmcneill Exp $");
 
 #include 
 #include 
@@ -428,13 +428,12 @@ tegra_xusb_mountroot(device_t self)
 		break;
 	default:
 		if (val < PCI_USBREV_3_0) {
-			aprint_error_dev(self, "Unknown revision (%02x)\n",
-			usbrev);
+			aprint_error_dev(self, "Unknown revision (%02x)\n", val);
 			sc->sc_bus.ub_revision = USBREV_UNKNOWN;
 		} else {
 			/* Default to the latest revision */
 			aprint_normal_dev(self,
-			"Unknown revision (%02x). Set to 3.1.\n", usbrev);
+			"Unknown revision (%02x). Set to 3.1.\n", val);
 			sc->sc_bus.ub_revision = USBREV_3_1;
 		}
 		break;



CVS commit: src/external/mit/lua/dist/src

2018-07-01 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Jul  1 10:08:38 UTC 2018

Modified Files:
src/external/mit/lua/dist/src: ltable.c

Log Message:
Apply bugfix #7 from lua.org/bugs.html: Memory-allocation error when resizing
a table can leave it in an inconsistent state.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/ltable.c

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

Modified files:

Index: src/external/mit/lua/dist/src/ltable.c
diff -u src/external/mit/lua/dist/src/ltable.c:1.9 src/external/mit/lua/dist/src/ltable.c:1.10
--- src/external/mit/lua/dist/src/ltable.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/ltable.c	Sun Jul  1 10:08:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ltable.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: ltable.c,v 1.10 2018/07/01 10:08:38 mbalmer Exp $	*/
 
 /*
 ** Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp 
@@ -338,17 +338,34 @@ static void setnodevector (lua_State *L,
 }
 
 
+typedef struct {
+  Table *t;
+  unsigned int nhsize;
+} AuxsetnodeT;
+
+
+static void auxsetnode (lua_State *L, void *ud) {
+  AuxsetnodeT *asn = cast(AuxsetnodeT *, ud);
+  setnodevector(L, asn->t, asn->nhsize);
+}
+
+
 void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
   unsigned int nhsize) {
   unsigned int i;
   int j;
+  AuxsetnodeT asn;
   unsigned int oldasize = t->sizearray;
   int oldhsize = allocsizenode(t);
   Node *nold = t->node;  /* save old hash ... */
   if (nasize > oldasize)  /* array part must grow? */
 setarrayvector(L, t, nasize);
   /* create new hash part with appropriate size */
-  setnodevector(L, t, nhsize);
+  asn.t = t; asn.nhsize = nhsize;
+  if (luaD_rawrunprotected(L, auxsetnode, ) != LUA_OK) {  /* mem. error? */
+setarrayvector(L, t, oldasize);  /* array back to its original size */
+luaD_throw(L, LUA_ERRMEM);  /* rethrow memory error */
+  }
   if (nasize < oldasize) {  /* array part must shrink? */
 t->sizearray = nasize;
 /* re-insert elements from vanishing slice */



CVS commit: src/sys/kern

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 09:53:54 UTC 2018

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

Log Message:
Revert previous


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/kern/subr_prf.c

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

Modified files:

Index: src/sys/kern/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.172 src/sys/kern/subr_prf.c:1.173
--- src/sys/kern/subr_prf.c:1.172	Sat Jun 30 17:15:01 2018
+++ src/sys/kern/subr_prf.c	Sun Jul  1 09:53:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.172 2018/06/30 17:15:01 jmcneill Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.173 2018/07/01 09:53:54 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.172 2018/06/30 17:15:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.173 2018/07/01 09:53:54 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -68,7 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -504,9 +503,6 @@ addtstamp(int flags, struct tty *tp)
 		log_ts_prec = prec;
 	}
 
-	if (cold)
-		tc_ticktock();
-
 	getnanouptime();
 
 	for (n = prec, fsec = ts.tv_nsec; n < 8; n++)



CVS commit: [netbsd-7-0] xsrc/xfree/xc/programs/mkfontscale

2018-07-01 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Jul  1 09:30:38 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-7-0]: ident.c

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

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.38.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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

Modified files:

Index: xsrc/xfree/xc/programs/mkfontscale/ident.c
diff -u xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1 xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1.38.1
--- xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1	Fri Mar  5 14:26:48 2004
+++ xsrc/xfree/xc/programs/mkfontscale/ident.c	Sun Jul  1 09:30:38 2018
@@ -213,7 +213,7 @@ pcfIdentify(gzFile f, char **name)
 #define NKEY 20
 
 static char*
-getKeyword(gzFile *f, int *eol)
+getKeyword(gzFile f, int *eol)
 {
 static char keyword[NKEY + 1];
 int c, i;
@@ -236,7 +236,7 @@ getKeyword(gzFile *f, int *eol)
 }
 
 static int
-bdfskip(gzFile *f)
+bdfskip(gzFile f)
 {
 int c;
 do {
@@ -248,7 +248,7 @@ bdfskip(gzFile *f)
 }
 
 static char *
-bdfend(gzFile *f)
+bdfend(gzFile f)
 {
 int c;
 char *buf = NULL;



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

2018-07-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  1 08:32:41 UTC 2018

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

Log Message:
Use a variable-sized memcpy, instead of copying the PCB and then adding
the extra bytes. The PCB embeds the biggest static FPU state, but our
real FPU state may be smaller (FNSAVE), so we don't need to memcpy the
extra unused bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x86/x86/vm_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.45 src/sys/arch/x86/x86/fpu.c:1.46
--- src/sys/arch/x86/x86/fpu.c:1.45	Sun Jul  1 07:18:56 2018
+++ src/sys/arch/x86/x86/fpu.c	Sun Jul  1 08:32:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.45 2018/07/01 07:18:56 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.46 2018/07/01 08:32:41 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.45 2018/07/01 07:18:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.46 2018/07/01 08:32:41 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -723,17 +723,10 @@ fpu_save_area_reset(struct lwp *l)
 void
 fpu_save_area_fork(struct pcb *pcb2, const struct pcb *pcb1)
 {
-	ssize_t extra;
+	const uint8_t *src = (const uint8_t *)>pcb_savefpu;
+	uint8_t *dst = (uint8_t *)>pcb_savefpu;
 
-	/*
-	 * The pcb itself has been copied, but the xsave area
-	 * extends further.
-	 */
-	extra = offsetof(struct pcb, pcb_savefpu) + x86_fpu_save_size -
-	sizeof (struct pcb);
-
-	if (extra > 0)
-		memcpy(pcb2 + 1, pcb1 + 1, extra);
+	memcpy(dst, src, x86_fpu_save_size);
 
 	KASSERT(pcb2->pcb_fpcpu == NULL);
 }

Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.34 src/sys/arch/x86/x86/vm_machdep.c:1.35
--- src/sys/arch/x86/x86/vm_machdep.c:1.34	Tue Jun 19 07:23:44 2018
+++ src/sys/arch/x86/x86/vm_machdep.c	Sun Jul  1 08:32:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.34 2018/06/19 07:23:44 maxv Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.35 2018/07/01 08:32:41 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.34 2018/06/19 07:23:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.35 2018/07/01 08:32:41 maxv Exp $");
 
 #include "opt_mtrr.h"
 
@@ -155,13 +155,13 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 		KASSERT(l1 == );
 	}
 
-	/* Copy the PCB from parent. */
-	memcpy(pcb2, pcb1, sizeof(struct pcb));
+	/* Copy the PCB from parent, except the FPU state. */
+	memcpy(pcb2, pcb1, offsetof(struct pcb, pcb_savefpu));
 
 	/* FPU state not installed. */
 	pcb2->pcb_fpcpu = NULL;
 
-	/* Copy any additional fpu state */
+	/* Copy FPU state. */
 	fpu_save_area_fork(pcb2, pcb1);
 
 	/* Never inherit CPU Debug Registers */



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

2018-07-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  1 07:59:30 UTC 2018

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

Log Message:
Optimize FNSAVE. The size of its save area is 108 bytes, so don't set
x86_fpu_save_size = 512, because otherwise we uselessly memset extra
bytes at execve time.

While here use sizeof instead of hardcoded values.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.77 src/sys/arch/x86/x86/identcpu.c:1.78
--- src/sys/arch/x86/x86/identcpu.c:1.77	Sat Jun 23 10:30:22 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sun Jul  1 07:59:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.77 2018/06/23 10:30:22 jdolecek Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.78 2018/07/01 07:59:30 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.77 2018/06/23 10:30:22 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.78 2018/07/01 07:59:30 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -66,7 +66,7 @@ int cpu_vendor;
 char cpu_brand_string[49];
 
 int x86_fpu_save __read_mostly;
-unsigned int x86_fpu_save_size __read_mostly = 512;
+unsigned int x86_fpu_save_size __read_mostly = sizeof(struct save87);
 uint64_t x86_xsave_features __read_mostly = 0;
 
 /*
@@ -768,7 +768,7 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	x86_fpu_save = FPU_SAVE_FSAVE;
 
-#ifdef i386 /* amd64 always has fxsave, sse and sse2 */
+#ifdef i386
 	/* If we have FXSAVE/FXRESTOR, use them. */
 	if ((ci->ci_feat_val[0] & CPUID_FXSR) == 0) {
 		i386_use_fxsave = 0;
@@ -789,11 +789,12 @@ cpu_probe_fpu(struct cpu_info *ci)
 #else
 	/*
 	 * For amd64 i386_use_fxsave, i386_has_sse and i386_has_sse2 are
-	 * #defined to 1.
+	 * #defined to 1, because fxsave/sse/sse2 are always present.
 	 */
-#endif	/* i386 */
+#endif
 
 	x86_fpu_save = FPU_SAVE_FXSAVE;
+	x86_fpu_save_size = sizeof(struct fxsave);
 
 	/* See if xsave (for AVX) is supported */
 	if ((ci->ci_feat_val[1] & CPUID2_XSAVE) == 0)
@@ -822,7 +823,7 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	/* Get features and maximum size of the save area */
 	x86_cpuid(0xd, descs);
-	if (descs[2] > 512)
+	if (descs[2] > sizeof(struct fxsave))
 		x86_fpu_save_size = descs[2];
 
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];



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

2018-07-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  1 07:18:56 UTC 2018

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

Log Message:
Use a switch, we can (and will) optimize each case separately. No
functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/x86/fpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.44 src/sys/arch/x86/x86/fpu.c:1.45
--- src/sys/arch/x86/x86/fpu.c:1.44	Fri Jun 29 19:34:35 2018
+++ src/sys/arch/x86/x86/fpu.c	Sun Jul  1 07:18:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.44 2018/06/29 19:34:35 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.45 2018/07/01 07:18:56 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.44 2018/06/29 19:34:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.45 2018/07/01 07:18:56 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -661,24 +661,36 @@ fpu_save_area_clear(struct lwp *l, unsig
 	}
 	KASSERT(pcb->pcb_fpcpu == NULL);
 
-	if (i386_use_fxsave) {
+	switch (x86_fpu_save) {
+	case FPU_SAVE_FSAVE:
+		memset(_save->sv_87, 0, x86_fpu_save_size);
+		fpu_save->sv_87.s87_tw = 0x;
+		fpu_save->sv_87.s87_cw = x87_cw;
+		break;
+	case FPU_SAVE_FXSAVE:
+		memset(_save->sv_xmm, 0, x86_fpu_save_size);
+		fpu_save->sv_xmm.fx_mxcsr = __INITIAL_MXCSR__;
+		fpu_save->sv_xmm.fx_mxcsr_mask = x86_fpu_mxcsr_mask;
+		fpu_save->sv_xmm.fx_cw = x87_cw;
+		break;
+	case FPU_SAVE_XSAVE:
+	case FPU_SAVE_XSAVEOPT:
 		memset(_save->sv_xmm, 0, x86_fpu_save_size);
 		fpu_save->sv_xmm.fx_mxcsr = __INITIAL_MXCSR__;
 		fpu_save->sv_xmm.fx_mxcsr_mask = x86_fpu_mxcsr_mask;
 		fpu_save->sv_xmm.fx_cw = x87_cw;
 
-		/* Force a reload of CW */
-		if ((x87_cw != __INITIAL_NPXCW__) &&
-		(x86_fpu_save == FPU_SAVE_XSAVE ||
-		x86_fpu_save == FPU_SAVE_XSAVEOPT)) {
+		/*
+		 * Force a reload of CW if we're using the non-default
+		 * value.
+		 */
+		if (__predict_false(x87_cw != __INITIAL_NPXCW__)) {
 			fpu_save->sv_xsave_hdr.xsh_xstate_bv |=
 			XCR0_X87;
 		}
-	} else {
-		memset(_save->sv_87, 0, x86_fpu_save_size);
-		fpu_save->sv_87.s87_tw = 0x;
-		fpu_save->sv_87.s87_cw = x87_cw;
+		break;
 	}
+
 	pcb->pcb_fpu_dflt_cw = x87_cw;
 
 	if (x86_fpu_eager) {