Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 2014 17:46:56 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r262612 - in projects/clang-sparc64: bin/sh bin/sh/tests/builtins cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc cddl/contrib/opensolaris/lib/libzfs/common cddl/lib/libdtrace ...
Message-ID:  <201402281746.s1SHku20002690@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Fri Feb 28 17:46:56 2014
New Revision: 262612
URL: http://svnweb.freebsd.org/changeset/base/262612

Log:
  Merge from head up to r262611.

Added:
  projects/clang-sparc64/bin/sh/tests/builtins/lineno2.0
     - copied unchanged from r262611, head/bin/sh/tests/builtins/lineno2.0
  projects/clang-sparc64/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh
     - copied unchanged from r262611, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh
  projects/clang-sparc64/sys/arm/at91/at91_sdramc.c
     - copied unchanged from r262611, head/sys/arm/at91/at91_sdramc.c
  projects/clang-sparc64/sys/arm/at91/at91_shdwc.c
     - copied unchanged from r262611, head/sys/arm/at91/at91_shdwc.c
  projects/clang-sparc64/sys/arm/at91/at91_tcb.c
     - copied unchanged from r262611, head/sys/arm/at91/at91_tcb.c
  projects/clang-sparc64/sys/arm/freescale/vybrid/vf_i2c.c
     - copied unchanged from r262611, head/sys/arm/freescale/vybrid/vf_i2c.c
  projects/clang-sparc64/sys/cddl/dev/dtrace/x86/
     - copied from r262611, head/sys/cddl/dev/dtrace/x86/
  projects/clang-sparc64/sys/dev/usb/controller/at91dci_fdt.c
     - copied unchanged from r262611, head/sys/dev/usb/controller/at91dci_fdt.c
  projects/clang-sparc64/sys/dev/usb/controller/ohci_fdt.c
     - copied unchanged from r262611, head/sys/dev/usb/controller/ohci_fdt.c
     - copied from r262611, head/sys/gnu/dts/
Directory Properties:
  projects/clang-sparc64/sys/gnu/dts/   (props changed)
Deleted:
  projects/clang-sparc64/sys/cddl/dev/dtrace/amd64/dis_tables.c
  projects/clang-sparc64/sys/cddl/dev/dtrace/amd64/dis_tables.h
  projects/clang-sparc64/sys/cddl/dev/dtrace/amd64/regset.h
  projects/clang-sparc64/sys/cddl/dev/dtrace/i386/dis_tables.c
  projects/clang-sparc64/sys/cddl/dev/dtrace/i386/dis_tables.h
  projects/clang-sparc64/sys/cddl/dev/dtrace/i386/regset.h
Modified:
  projects/clang-sparc64/bin/sh/expand.c
  projects/clang-sparc64/bin/sh/tests/builtins/Makefile
  projects/clang-sparc64/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  projects/clang-sparc64/cddl/lib/libdtrace/Makefile
  projects/clang-sparc64/contrib/llvm/include/llvm/MC/MCContext.h
  projects/clang-sparc64/contrib/llvm/lib/MC/MCContext.cpp
  projects/clang-sparc64/contrib/llvm/lib/MC/MCDwarf.cpp
  projects/clang-sparc64/lib/libc/sys/sync.2
  projects/clang-sparc64/release/doc/en_US.ISO8859-1/hardware/article.xml
  projects/clang-sparc64/release/doc/share/misc/dev.archlist.txt
  projects/clang-sparc64/share/man/man4/nvd.4
  projects/clang-sparc64/share/man/man4/nvme.4
  projects/clang-sparc64/sys/arm/arm/cpufunc.c
  projects/clang-sparc64/sys/arm/arm/cpufunc_asm_armv7.S
  projects/clang-sparc64/sys/arm/arm/mp_machdep.c
  projects/clang-sparc64/sys/arm/arm/mpcore_timer.c
  projects/clang-sparc64/sys/arm/at91/uart_dev_at91usart.c
  projects/clang-sparc64/sys/arm/conf/VYBRID.common
  projects/clang-sparc64/sys/arm/freescale/imx/imx6_anatop.c
  projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccm.c
  projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccmreg.h
  projects/clang-sparc64/sys/arm/freescale/vybrid/files.vybrid
  projects/clang-sparc64/sys/arm/include/cpufunc.h
  projects/clang-sparc64/sys/boot/forth/loader.conf
  projects/clang-sparc64/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  projects/clang-sparc64/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
  projects/clang-sparc64/sys/compat/linprocfs/linprocfs.c
  projects/clang-sparc64/sys/dev/aic7xxx/aicasm/Makefile
  projects/clang-sparc64/sys/dev/etherswitch/ip17x/ip17x.c
  projects/clang-sparc64/sys/dev/etherswitch/ip17x/ip17x_phy.c
  projects/clang-sparc64/sys/dev/etherswitch/ip17x/ip17x_vlans.c
  projects/clang-sparc64/sys/dev/hwpmc/hwpmc_powerpc.c
  projects/clang-sparc64/sys/dev/mps/mps.c
  projects/clang-sparc64/sys/dev/mps/mps_sas.c
  projects/clang-sparc64/sys/dev/nand/nfc_at91.c
  projects/clang-sparc64/sys/dev/tws/tws.h
  projects/clang-sparc64/sys/dev/tws/tws_cam.c
  projects/clang-sparc64/sys/dev/tws/tws_user.c
  projects/clang-sparc64/sys/dev/usb/usb_dev.c
  projects/clang-sparc64/sys/modules/dtrace/dtrace/Makefile
  projects/clang-sparc64/sys/modules/geom/geom_uncompress/Makefile
  projects/clang-sparc64/sys/modules/gpio/gpiobus/Makefile
  projects/clang-sparc64/sys/modules/gpio/gpioiic/Makefile
  projects/clang-sparc64/sys/modules/gpio/gpioled/Makefile
  projects/clang-sparc64/usr.sbin/ntp/sntp/Makefile
Directory Properties:
  projects/clang-sparc64/   (props changed)
  projects/clang-sparc64/cddl/   (props changed)
  projects/clang-sparc64/cddl/contrib/opensolaris/   (props changed)
  projects/clang-sparc64/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  projects/clang-sparc64/contrib/llvm/   (props changed)
  projects/clang-sparc64/lib/libc/   (props changed)
  projects/clang-sparc64/share/man/man4/   (props changed)
  projects/clang-sparc64/sys/   (props changed)
  projects/clang-sparc64/sys/boot/   (props changed)
  projects/clang-sparc64/sys/cddl/contrib/opensolaris/   (props changed)

Modified: projects/clang-sparc64/bin/sh/expand.c
==============================================================================
--- projects/clang-sparc64/bin/sh/expand.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/bin/sh/expand.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -672,10 +672,8 @@ evalvar(char *p, int flag)
 again: /* jump here after setting a variable with ${var=text} */
 	if (varflags & VSLINENO) {
 		set = 1;
-		special = 0;
-		val = var;
-		p[-1] = '\0';	/* temporarily overwrite '=' to have \0
-				   terminated string */
+		special = 1;
+		val = NULL;
 	} else if (special) {
 		set = varisset(var, varflags & VSNUL);
 		val = NULL;
@@ -704,7 +702,10 @@ again: /* jump here after setting a vari
 	if (set && subtype != VSPLUS) {
 		/* insert the value of the variable */
 		if (special) {
-			varvalue(var, varflags & VSQUOTE, subtype, flag);
+			if (varflags & VSLINENO)
+				STPUTBIN(var, p - var - 1, expdest);
+			else
+				varvalue(var, varflags & VSQUOTE, subtype, flag);
 			if (subtype == VSLENGTH) {
 				varlenb = expdest - stackblock() - startloc;
 				varlen = varlenb;
@@ -816,7 +817,6 @@ record:
 	default:
 		abort();
 	}
-	p[-1] = '=';	/* recover overwritten '=' */
 
 	if (subtype != VSNORMAL) {	/* skip to end of alternative */
 		int nesting = 1;

Modified: projects/clang-sparc64/bin/sh/tests/builtins/Makefile
==============================================================================
--- projects/clang-sparc64/bin/sh/tests/builtins/Makefile	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/bin/sh/tests/builtins/Makefile	Fri Feb 28 17:46:56 2014	(r262612)
@@ -87,6 +87,7 @@ FILES+=		hash4.0
 FILES+=		jobid1.0
 FILES+=		jobid2.0
 FILES+=		lineno.0 lineno.0.stdout
+FILES+=		lineno2.0
 FILES+=		local1.0
 FILES+=		local2.0
 FILES+=		local3.0

Copied: projects/clang-sparc64/bin/sh/tests/builtins/lineno2.0 (from r262611, head/bin/sh/tests/builtins/lineno2.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang-sparc64/bin/sh/tests/builtins/lineno2.0	Fri Feb 28 17:46:56 2014	(r262612, copy of r262611, head/bin/sh/tests/builtins/lineno2.0)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+f() {
+	: ${LINENO+${x?}}
+}
+
+unset -v x
+command eval f 2>/dev/null && exit 3
+x=1
+f

Copied: projects/clang-sparc64/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh (from r262611, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang-sparc64/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh	Fri Feb 28 17:46:56 2014	(r262612, copy of r262611, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh)
@@ -0,0 +1,97 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+let j=8
+
+enable()
+{
+	prog=/var/tmp/dtest.$$.d
+	err=/var/tmp/dtest.$$.err
+
+	nawk -v nprobes=$1 'BEGIN { \
+		for (i = 0; i < nprobes - 1; i++) { 		\
+			printf("dtrace:::BEGIN,\n");		\
+		}						\
+								\
+		printf("dtrace:::BEGIN { exit(0); }\n");	\
+	}' /dev/null > $prog
+
+	dtrace -qs $prog > /dev/null 2> $err
+
+	if [[ "$?" -eq 0 ]]; then
+		return 0
+	else
+		if ! grep "DIF program exceeds maximum program size" $err \
+		    1> /dev/null 2>&1 ; then 
+			echo "failed to enable $prog: `cat $err`"
+			exit 1
+		fi
+
+		return 1
+	fi
+}
+
+#
+# First, establish an upper bound
+#
+let upper=1
+
+while enable $upper ; do
+	let lower=upper
+	let upper=upper+upper
+	echo success at $lower, raised to $upper
+done
+
+#
+# Now search for the highest value that can be enabled
+#
+while [[ "$lower" -lt "$upper" ]]; do
+	let guess=$(((lower + upper) / 2))
+	echo "lower is $lower; upper is $upper; guess is $guess\c"
+
+	if enable $guess ; then
+		if [[ $((upper - lower)) -le 2 ]]; then
+			let upper=guess
+		fi
+
+		echo " (success)"
+		let lower=guess
+	else
+		echo " (failure)"
+		let upper=guess
+	fi
+done
+
+let expected=10000
+
+if [[ "$lower" -lt "$expected" ]]; then
+	echo "expected support for enablings of at least $expected probes; \c"
+	echo "found $lower"
+	exit 1
+fi
+
+echo "maximum supported enabled probes found to be $lower"
+exit 0
+

Modified: projects/clang-sparc64/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==============================================================================
--- projects/clang-sparc64/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -20,8 +20,8 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  */
 
 /*
@@ -1613,9 +1613,16 @@ zpool_in_use(libzfs_handle_t *hdl, int f
 		 * its state to active.
 		 */
 		if (pool_active(hdl, name, guid, &isactive) == 0 && isactive &&
-		    (zhp = zpool_open_canfail(hdl, name)) != NULL &&
-		    zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
-			stateval = POOL_STATE_ACTIVE;
+		    (zhp = zpool_open_canfail(hdl, name)) != NULL) {
+			if (zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
+				stateval = POOL_STATE_ACTIVE;
+
+			/*
+			 * All we needed the zpool handle for is the
+			 * readonly prop check.
+			 */
+			zpool_close(zhp);
+		}
 
 		ret = B_TRUE;
 		break;

Modified: projects/clang-sparc64/cddl/lib/libdtrace/Makefile
==============================================================================
--- projects/clang-sparc64/cddl/lib/libdtrace/Makefile	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/cddl/lib/libdtrace/Makefile	Fri Feb 28 17:46:56 2014	(r262612)
@@ -69,9 +69,11 @@ CFLAGS+=	-I${.OBJDIR} -I${.CURDIR} \
 #CFLAGS+=	-DYYDEBUG
 
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+=	-I${.CURDIR}/../../../sys/cddl/dev/dtrace/x86
 CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM
 .PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/i386
 .PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH}
+.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/x86
 .elif ${MACHINE_CPUARCH} == "sparc64"
 CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
 .PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/sparc

Modified: projects/clang-sparc64/contrib/llvm/include/llvm/MC/MCContext.h
==============================================================================
--- projects/clang-sparc64/contrib/llvm/include/llvm/MC/MCContext.h	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/contrib/llvm/include/llvm/MC/MCContext.h	Fri Feb 28 17:46:56 2014	(r262612)
@@ -278,6 +278,7 @@ namespace llvm {
     /// This can be overridden by clients which want to control the reported
     /// compilation directory and have it be something other than the current
     /// working directory.
+    /// Returns an empty string if the current directory cannot be determined.
     StringRef getCompilationDir() const { return CompilationDir; }
 
     /// \brief Set the compilation directory for DW_AT_comp_dir

Modified: projects/clang-sparc64/contrib/llvm/lib/MC/MCContext.cpp
==============================================================================
--- projects/clang-sparc64/contrib/llvm/lib/MC/MCContext.cpp	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/contrib/llvm/lib/MC/MCContext.cpp	Fri Feb 28 17:46:56 2014	(r262612)
@@ -47,8 +47,8 @@ MCContext::MCContext(const MCAsmInfo *ma
   AllowTemporaryLabels(true), DwarfCompileUnitID(0), AutoReset(DoAutoReset) {
 
   error_code EC = llvm::sys::fs::current_path(CompilationDir);
-  assert(!EC && "Could not determine the current directory");
-  (void)EC;
+  if (EC)
+    CompilationDir.clear();
 
   MachOUniquingMap = 0;
   ELFUniquingMap = 0;

Modified: projects/clang-sparc64/contrib/llvm/lib/MC/MCDwarf.cpp
==============================================================================
--- projects/clang-sparc64/contrib/llvm/lib/MC/MCDwarf.cpp	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/contrib/llvm/lib/MC/MCDwarf.cpp	Fri Feb 28 17:46:56 2014	(r262612)
@@ -467,7 +467,8 @@ static void EmitGenDwarfAbbrev(MCStreame
   EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
   EmitAbbrev(MCOS, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr);
   EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
-  EmitAbbrev(MCOS, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string);
+  if (!context.getCompilationDir().empty())
+    EmitAbbrev(MCOS, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string);
   StringRef DwarfDebugFlags = context.getDwarfDebugFlags();
   if (!DwarfDebugFlags.empty())
     EmitAbbrev(MCOS, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string);
@@ -643,8 +644,10 @@ static void EmitGenDwarfInfo(MCStreamer 
   MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
 
   // AT_comp_dir, the working directory the assembly was done in.
-  MCOS->EmitBytes(context.getCompilationDir());
-  MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
+  if (!context.getCompilationDir().empty()) {
+    MCOS->EmitBytes(context.getCompilationDir());
+    MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
+  }
 
   // AT_APPLE_flags, the command line arguments of the assembler tool.
   StringRef DwarfDebugFlags = context.getDwarfDebugFlags();

Modified: projects/clang-sparc64/lib/libc/sys/sync.2
==============================================================================
--- projects/clang-sparc64/lib/libc/sys/sync.2	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/lib/libc/sys/sync.2	Fri Feb 28 17:46:56 2014	(r262612)
@@ -52,7 +52,7 @@ As information in the cache is lost afte
 .Fn sync
 system call is issued
 frequently
-by the user process
+by the kernel process
 .Xr syncer 4
 (about every 30 seconds).
 .Pp

Modified: projects/clang-sparc64/release/doc/en_US.ISO8859-1/hardware/article.xml
==============================================================================
--- projects/clang-sparc64/release/doc/en_US.ISO8859-1/hardware/article.xml	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/release/doc/en_US.ISO8859-1/hardware/article.xml	Fri Feb 28 17:46:56 2014	(r262612)
@@ -758,6 +758,8 @@
 
       &hwlist.twe;
 
+      &hwlist.tws;
+
       &hwlist.vpo;
 
       <para>[&arch.i386;] The wds(4) driver supports the WD7000 SCSI

Modified: projects/clang-sparc64/release/doc/share/misc/dev.archlist.txt
==============================================================================
--- projects/clang-sparc64/release/doc/share/misc/dev.archlist.txt	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/release/doc/share/misc/dev.archlist.txt	Fri Feb 28 17:46:56 2014	(r262612)
@@ -152,6 +152,7 @@ tl	i386,pc98,amd64
 trm	i386,amd64
 twa	i386,amd64
 twe	i386,amd64
+tws	i386,amd64
 ubsa	i386,pc98,amd64
 ubsec	i386,pc98,amd64
 ubser	i386,pc98,amd64

Modified: projects/clang-sparc64/share/man/man4/nvd.4
==============================================================================
--- projects/clang-sparc64/share/man/man4/nvd.4	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/share/man/man4/nvd.4	Fri Feb 28 17:46:56 2014	(r262612)
@@ -65,7 +65,7 @@ I/O commands.
 .Sh SEE ALSO
 .Xr nvme 4 ,
 .Xr nvmecontrol 8 ,
-.Xr disk 9 .
+.Xr disk 9
 .Sh HISTORY
 The
 .Nm

Modified: projects/clang-sparc64/share/man/man4/nvme.4
==============================================================================
--- projects/clang-sparc64/share/man/man4/nvme.4	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/share/man/man4/nvme.4	Fri Feb 28 17:46:56 2014	(r262612)
@@ -73,9 +73,13 @@ API for registering NVMe namespace consu
 API for submitting NVM commands to namespaces
 .It
 Ioctls for controller and namespace configuration and management
+.Pp
 .Nm
-creates controller devices in the format /dev/nvmeX and namespace devices in
-the format /dev/nvmeXnsY.
+creates controller devices in the format
+.Pa /dev/nvmeX
+and namespace devices in
+the format
+.Pa /dev/nvmeXnsY .
 Note that the NVM Express specification starts numbering namespaces at 1,
 not 0, and this driver follows that convention.
 .El
@@ -104,7 +108,8 @@ Note that use of INTx implies disabling 
 The following controller-level sysctls are currently implemented:
 .Bl -tag -width indent
 .It Va dev.nvme.0.int_coal_time
-(R/W) Interrupt coalescing timer period in microseconds.  Set to 0 to disable.
+(R/W) Interrupt coalescing timer period in microseconds.
+Set to 0 to disable.
 .It Va dev.nvme.0.int_coal_threshold
 (R/W) Interrupt coalescing threshold in number of command completions.
 Set to 0 to disable.
@@ -146,7 +151,7 @@ and completion queues to the console.
 .Xr nvd 4 ,
 .Xr pci 4 ,
 .Xr nvmecontrol 8 ,
-.Xr disk 9 .
+.Xr disk 9
 .Sh HISTORY
 The
 .Nm

Modified: projects/clang-sparc64/sys/arm/arm/cpufunc.c
==============================================================================
--- projects/clang-sparc64/sys/arm/arm/cpufunc.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/arm/cpufunc.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -1107,7 +1107,7 @@ struct cpu_functions cortexa_cpufuncs = 
 	cpufunc_nullop,                 /* flush_brnchtgt_C     */
 	(void *)cpufunc_nullop,         /* flush_brnchtgt_E     */
 	
-	arm11_sleep,                    /* sleep                */
+	armv7_sleep,                    /* sleep                */
 	
 	/* Soft functions */
 	

Modified: projects/clang-sparc64/sys/arm/arm/cpufunc_asm_armv7.S
==============================================================================
--- projects/clang-sparc64/sys/arm/arm/cpufunc_asm_armv7.S	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/arm/cpufunc_asm_armv7.S	Fri Feb 28 17:46:56 2014	(r262612)
@@ -343,3 +343,9 @@ ENTRY(armv7_idcache_inv_all)
 	bx      lr                      @ return
 END(armv7_l1cache_inv_all)
 
+ENTRY_NP(armv7_sleep)
+	dsb
+	wfi
+	bx	lr
+END(armv7_sleep)
+

Modified: projects/clang-sparc64/sys/arm/arm/mp_machdep.c
==============================================================================
--- projects/clang-sparc64/sys/arm/arm/mp_machdep.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/arm/mp_machdep.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -372,7 +372,7 @@ struct cpu_group *
 cpu_topo(void)
 {
 
-	return (smp_topo_1level(CG_SHARE_L2, 1, 0));
+	return (smp_topo_1level(CG_SHARE_L2, mp_ncpus, 0));
 }
 
 void

Modified: projects/clang-sparc64/sys/arm/arm/mpcore_timer.c
==============================================================================
--- projects/clang-sparc64/sys/arm/arm/mpcore_timer.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/arm/mpcore_timer.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -129,12 +129,12 @@ uint32_t platform_arm_tmr_freq = 0;
 static timecounter_get_t arm_tmr_get_timecount;
 
 static struct timecounter arm_tmr_timecount = {
-	.tc_name           = "ARM MPCore Timecounter",
+	.tc_name           = "MPCore",
 	.tc_get_timecount  = arm_tmr_get_timecount,
 	.tc_poll_pps       = NULL,
 	.tc_counter_mask   = ~0u,
 	.tc_frequency      = 0,
-	.tc_quality        = 1000,
+	.tc_quality        = 800,
 };
 
 /**
@@ -254,7 +254,7 @@ arm_tmr_probe(device_t dev)
 	if (!ofw_bus_is_compatible(dev, "arm,mpcore-timers"))
 		return (ENXIO);
 
-	device_set_desc(dev, "ARM Generic MPCore Timers");
+	device_set_desc(dev, "ARM MPCore Timers");
 	return (BUS_PROBE_DEFAULT);
 }
 
@@ -327,7 +327,7 @@ arm_tmr_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	sc->et.et_name = "ARM MPCore Eventtimer";
+	sc->et.et_name = "MPCore";
 	sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU;
 	sc->et.et_quality = 1000;
 
@@ -369,8 +369,8 @@ DRIVER_MODULE(mp_tmr, simplebus, arm_tmr
  *	RETURNS:
  *	nothing
  */
-void
-DELAY(int usec)
+static void
+arm_tmr_DELAY(int usec)
 {
 	int32_t counts_per_usec;
 	int32_t counts;
@@ -408,3 +408,11 @@ DELAY(int usec)
 		first = last;
 	}
 }
+
+/*
+ * Supply a DELAY() implementation via weak linkage.  A platform may want to use
+ * the mpcore per-cpu eventtimers but provide its own DELAY() routine,
+ * especially when the core frequency can change on the fly.
+ */
+__weak_reference(arm_tmr_DELAY, DELAY);
+

Copied: projects/clang-sparc64/sys/arm/at91/at91_sdramc.c (from r262611, head/sys/arm/at91/at91_sdramc.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang-sparc64/sys/arm/at91/at91_sdramc.c	Fri Feb 28 17:46:56 2014	(r262612, copy of r262611, head/sys/arm/at91/at91_sdramc.c)
@@ -0,0 +1,105 @@
+/*-
+ * Copyright (c) 2014 Warner Losh.  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 AUTHOR 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 AUTHOR 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 "opt_platform.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/resource.h>
+#include <sys/systm.h>
+#include <sys/rman.h>
+
+#include <machine/bus.h>
+
+#include <arm/at91/at91var.h>
+#include <arm/at91/at91_aicreg.h>
+
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#endif
+
+struct sdramc_softc {
+	struct resource	*mem_res;	/* Memory resource */
+	device_t	sc_dev;
+};
+
+static int
+at91_sdramc_probe(device_t dev)
+{
+#ifdef FDT
+	if (!ofw_bus_is_compatible(dev, "atmel,at91sam9260-sdramc"))
+		return (ENXIO);
+#endif
+	device_set_desc(dev, "SDRAMC");
+        return (0);
+}
+
+static int
+at91_sdramc_attach(device_t dev)
+{
+	int rid, err = 0;
+	struct sdramc_softc *sc;
+
+	sc = device_get_softc(dev);
+	sc->sc_dev = dev;
+
+	rid = 0;
+	sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+	    RF_ACTIVE);
+
+	if (sc->mem_res == NULL)
+		panic("couldn't allocate register resources");
+
+	return (err);
+}
+
+static device_method_t at91_sdramc_methods[] = {
+	DEVMETHOD(device_probe, at91_sdramc_probe),
+	DEVMETHOD(device_attach, at91_sdramc_attach),
+	DEVMETHOD_END
+};
+
+static driver_t at91_sdramc_driver = {
+	"at91_sdramc",
+	at91_sdramc_methods,
+	sizeof(struct sdramc_softc),
+};
+
+static devclass_t at91_sdramc_devclass;
+
+#ifdef FDT
+DRIVER_MODULE(at91_sdramc, simplebus, at91_sdramc_driver, at91_sdramc_devclass, NULL,
+    NULL);
+#else
+DRIVER_MODULE(at91_sdramc, atmelarm, at91_sdramc_driver, at91_sdramc_devclass, NULL,
+    NULL);
+#endif

Copied: projects/clang-sparc64/sys/arm/at91/at91_shdwc.c (from r262611, head/sys/arm/at91/at91_shdwc.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang-sparc64/sys/arm/at91/at91_shdwc.c	Fri Feb 28 17:46:56 2014	(r262612, copy of r262611, head/sys/arm/at91/at91_shdwc.c)
@@ -0,0 +1,105 @@
+/*-
+ * Copyright (c) 2014 Warner Losh.  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 AUTHOR 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 AUTHOR 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 "opt_platform.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/resource.h>
+#include <sys/systm.h>
+#include <sys/rman.h>
+
+#include <machine/bus.h>
+
+#include <arm/at91/at91var.h>
+#include <arm/at91/at91_aicreg.h>
+
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#endif
+
+struct shdwc_softc {
+	struct resource	*mem_res;	/* Memory resource */
+	device_t	sc_dev;
+};
+
+static int
+at91_shdwc_probe(device_t dev)
+{
+#ifdef FDT
+	if (!ofw_bus_is_compatible(dev, "atmel,at91sam9260-shdwc"))
+		return (ENXIO);
+#endif
+	device_set_desc(dev, "SHDWC");
+        return (0);
+}
+
+static int
+at91_shdwc_attach(device_t dev)
+{
+	int rid, err = 0;
+	struct shdwc_softc *sc;
+
+	sc = device_get_softc(dev);
+	sc->sc_dev = dev;
+
+	rid = 0;
+	sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+	    RF_ACTIVE);
+
+	if (sc->mem_res == NULL)
+		panic("couldn't allocate register resources");
+
+	return (err);
+}
+
+static device_method_t at91_shdwc_methods[] = {
+	DEVMETHOD(device_probe, at91_shdwc_probe),
+	DEVMETHOD(device_attach, at91_shdwc_attach),
+	DEVMETHOD_END
+};
+
+static driver_t at91_shdwc_driver = {
+	"at91_shdwc",
+	at91_shdwc_methods,
+	sizeof(struct shdwc_softc),
+};
+
+static devclass_t at91_shdwc_devclass;
+
+#ifdef FDT
+DRIVER_MODULE(at91_shdwc, simplebus, at91_shdwc_driver, at91_shdwc_devclass, NULL,
+    NULL);
+#else
+DRIVER_MODULE(at91_shdwc, atmelarm, at91_shdwc_driver, at91_shdwc_devclass, NULL,
+    NULL);
+#endif

Copied: projects/clang-sparc64/sys/arm/at91/at91_tcb.c (from r262611, head/sys/arm/at91/at91_tcb.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang-sparc64/sys/arm/at91/at91_tcb.c	Fri Feb 28 17:46:56 2014	(r262612, copy of r262611, head/sys/arm/at91/at91_tcb.c)
@@ -0,0 +1,105 @@
+/*-
+ * Copyright (c) 2014 Warner Losh.  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 AUTHOR 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 AUTHOR 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 "opt_platform.h"
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/resource.h>
+#include <sys/systm.h>
+#include <sys/rman.h>
+
+#include <machine/bus.h>
+
+#include <arm/at91/at91var.h>
+#include <arm/at91/at91_aicreg.h>
+
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#endif
+
+struct tcb_softc {
+	struct resource	*mem_res;	/* Memory resource */
+	device_t	sc_dev;
+};
+
+static int
+at91_tcb_probe(device_t dev)
+{
+#ifdef FDT
+	if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-tcb"))
+		return (ENXIO);
+#endif
+	device_set_desc(dev, "TCB");
+        return (0);
+}
+
+static int
+at91_tcb_attach(device_t dev)
+{
+	int rid, err = 0;
+	struct tcb_softc *sc;
+
+	sc = device_get_softc(dev);
+	sc->sc_dev = dev;
+
+	rid = 0;
+	sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+	    RF_ACTIVE);
+
+	if (sc->mem_res == NULL)
+		panic("couldn't allocate register resources");
+
+	return (err);
+}
+
+static device_method_t at91_tcb_methods[] = {
+	DEVMETHOD(device_probe, at91_tcb_probe),
+	DEVMETHOD(device_attach, at91_tcb_attach),
+	DEVMETHOD_END
+};
+
+static driver_t at91_tcb_driver = {
+	"at91_tcb",
+	at91_tcb_methods,
+	sizeof(struct tcb_softc),
+};
+
+static devclass_t at91_tcb_devclass;
+
+#ifdef FDT
+DRIVER_MODULE(at91_tcb, simplebus, at91_tcb_driver, at91_tcb_devclass, NULL,
+    NULL);
+#else
+DRIVER_MODULE(at91_tcb, atmelarm, at91_tcb_driver, at91_tcb_devclass, NULL,
+    NULL);
+#endif

Modified: projects/clang-sparc64/sys/arm/at91/uart_dev_at91usart.c
==============================================================================
--- projects/clang-sparc64/sys/arm/at91/uart_dev_at91usart.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/at91/uart_dev_at91usart.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -279,7 +279,7 @@ at91_usart_init(struct uart_bas *bas, in
 	 * we don't want to hang here forever if the hardware is in a bad state.
 	 */
 	if (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY))
-	    DELAY(1000);
+		DELAY(10000);
 
 	at91_usart_param(bas, baudrate, databits, stopbits, parity);
 

Modified: projects/clang-sparc64/sys/arm/conf/VYBRID.common
==============================================================================
--- projects/clang-sparc64/sys/arm/conf/VYBRID.common	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/conf/VYBRID.common	Fri Feb 28 17:46:56 2014	(r262612)
@@ -124,8 +124,8 @@ device		nand
 device		uart
 
 # I2C (TWSI)
-#device		iic
-#device		iicbus
+device		iic
+device		iicbus
 
 # Ethernet
 device		ether

Modified: projects/clang-sparc64/sys/arm/freescale/imx/imx6_anatop.c
==============================================================================
--- projects/clang-sparc64/sys/arm/freescale/imx/imx6_anatop.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/freescale/imx/imx6_anatop.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/ofw/ofw_bus_subr.h>
 
 #include <machine/bus.h>
+#include <machine/fdt.h>
 
 #include <arm/freescale/fsl_ocotpreg.h>
 #include <arm/freescale/fsl_ocotpvar.h>
@@ -85,8 +86,11 @@ struct imx6_anatop_softc {
 	struct resource	*res[2];
 	uint32_t	cpu_curhz;
 	uint32_t	cpu_curmhz;
+	uint32_t	cpu_curmv;
 	uint32_t	cpu_minhz;
+	uint32_t	cpu_minmv;
 	uint32_t	cpu_maxhz;
+	uint32_t	cpu_maxmv;
 	uint32_t	refosc_hz;
 	void		*temp_intrhand;
 	uint32_t	temp_high_val;
@@ -103,12 +107,15 @@ struct imx6_anatop_softc {
 static struct imx6_anatop_softc *imx6_anatop_sc;
 
 /*
- * Table of CPU max frequencies.  This is indexed by the max frequency value
- * (0-3) from the ocotp CFG3 register.
+ * Tables of CPU max frequencies and corresponding voltages.  This is indexed by
+ * the max frequency value (0-3) from the ocotp CFG3 register.
  */
 static uint32_t imx6_cpu_maxhz_tab[] = {
 	 792000000, 852000000, 996000000, 1200000000
 };
+static uint32_t imx6_cpu_millivolt_tab[] = {
+	1150, 1225, 1225, 1275
+};
 
 #define	TZ_ZEROC	2732	/* deci-Kelvin <-> deci-Celcius offset. */
 
@@ -130,6 +137,64 @@ imx6_anatop_write_4(bus_size_t offset, u
 	bus_write_4(imx6_anatop_sc->res[MEMRES], offset, value);
 }
 
+static void
+vdd_set(struct imx6_anatop_softc *sc, int mv)
+{
+	int newtarg, oldtarg;
+	uint32_t delay, pmureg;
+	static boolean_t init_done = false;
+
+	/*
+	 * The datasheet says VDD_PU and VDD_SOC must be equal, and VDD_ARM
+	 * can't be more than 50mV above or 200mV below them.  For now to keep
+	 * things simple we set all three to the same value.
+	 */
+
+	pmureg = imx6_anatop_read_4(IMX6_ANALOG_PMU_REG_CORE);
+	oldtarg = pmureg & IMX6_ANALOG_PMU_REG0_TARG_MASK;
+
+	/* Convert mV to target value.  Clamp target to valid range. */
+	if (mv < 725)
+		newtarg = 0x00;
+	else if (mv > 1450)
+		newtarg = 0x1F;
+	else
+		newtarg = (mv - 700) / 25;
+
+	/*
+	 * The first time through the 3 voltages might not be equal so use a
+	 * long conservative delay.  After that we need to delay 3uS for every
+	 * 25mV step upward.  No need to delay at all when lowering.
+	 */
+	if (init_done) {
+		if (newtarg == oldtarg)
+			return;
+		else if (newtarg > oldtarg)
+			delay = (newtarg - oldtarg) * 3;
+		else
+			delay = 0;
+	} else {
+		delay = 700 / 25 * 3;
+		init_done = true;
+	}
+
+	/*
+	 * Make the change and wait for it to take effect.
+	 */
+	pmureg &= ~(IMX6_ANALOG_PMU_REG0_TARG_MASK |
+	    IMX6_ANALOG_PMU_REG1_TARG_MASK |
+	    IMX6_ANALOG_PMU_REG2_TARG_MASK);
+
+	pmureg |= newtarg << IMX6_ANALOG_PMU_REG0_TARG_SHIFT;
+	pmureg |= newtarg << IMX6_ANALOG_PMU_REG1_TARG_SHIFT;
+	pmureg |= newtarg << IMX6_ANALOG_PMU_REG2_TARG_SHIFT;
+
+	imx6_anatop_write_4(IMX6_ANALOG_PMU_REG_CORE, pmureg);
+	DELAY(delay);
+	sc->cpu_curmv = newtarg * 25 + 700;
+	device_printf(sc->dev, "voltage set to %u\n", sc->cpu_curmv);
+}
+
 static inline uint32_t
 cpufreq_hz_from_div(struct imx6_anatop_softc *sc, uint32_t div)
 {
@@ -231,7 +296,9 @@ cpufreq_initialize(struct imx6_anatop_so
 	    FSL_OCOTP_CFG3_SPEED_MASK) >> FSL_OCOTP_CFG3_SPEED_SHIFT;
 
 	sc->cpu_minhz = cpufreq_actual_hz(sc, imx6_cpu_maxhz_tab[0]);
+	sc->cpu_minmv = imx6_cpu_millivolt_tab[0];
 	sc->cpu_maxhz = cpufreq_actual_hz(sc, imx6_cpu_maxhz_tab[cfg3speed]);
+	sc->cpu_maxmv = imx6_cpu_millivolt_tab[cfg3speed];
 
 	/*
 	 * Set the CPU to maximum speed.
@@ -241,6 +308,7 @@ cpufreq_initialize(struct imx6_anatop_so
 	 * basically assumes that a single core can't overheat before interrupts
 	 * are enabled; empirical testing shows that to be a safe assumption.
 	 */
+	vdd_set(sc, sc->cpu_maxmv);
 	cpufreq_set_clock(sc, sc->cpu_maxhz);
 	device_printf(sc->dev, "CPU frequency %uMHz\n", sc->cpu_curmhz);
 }
@@ -321,6 +389,7 @@ tempmon_gofast(struct imx6_anatop_softc 
 {
 
 	if (sc->cpu_curhz < sc->cpu_maxhz) {
+		vdd_set(sc, sc->cpu_maxmv);
 		cpufreq_set_clock(sc, sc->cpu_maxhz);
 	}
 }
@@ -331,6 +400,7 @@ tempmon_goslow(struct imx6_anatop_softc 
 
 	if (sc->cpu_curhz > sc->cpu_minhz) {
 		cpufreq_set_clock(sc, sc->cpu_minhz);
+		vdd_set(sc, sc->cpu_minmv);
 	}
 }
 
@@ -451,6 +521,11 @@ imx6_anatop_attach(device_t dev)
 	if (err != 0)
 		goto out;
 
+	SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc->dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)),
+	    OID_AUTO, "cpu_voltage", CTLFLAG_RD,
+	    &sc->cpu_curmv, 0, "Current CPU voltage in millivolts");
+
 	imx6_anatop_sc = sc;
 
 	/*

Modified: projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccm.c
==============================================================================
--- projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccm.c	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccm.c	Fri Feb 28 17:46:56 2014	(r262612)
@@ -92,6 +92,7 @@ ccm_attach(device_t dev)
 {
 	struct ccm_softc *sc;
 	int err, rid;
+	uint32_t reg;
 
 	sc = device_get_softc(dev);
 	err = 0;
@@ -107,6 +108,26 @@ ccm_attach(device_t dev)
 	}
 
 	ccm_sc = sc;
+
+	/*
+	 * Configure the Low Power Mode setting to leave the ARM core power on
+	 * when a WFI instruction is executed.  This lets the MPCore timers and
+	 * GIC continue to run, which is helpful when the only thing that can
+	 * wake you up is an MPCore Private Timer interrupt delivered via GIC.
+	 *
+	 * XXX Based on the docs, setting CCM_CGPR_INT_MEM_CLK_LPM shouldn't be
+	 * required when the LPM bits are set to LPM_RUN.  But experimentally
+	 * I've experienced a fairly rare lockup when not setting it.  I was
+	 * unable to prove conclusively that the lockup was related to power
+	 * management or that this definitively fixes it.  Revisit this.
+	 */
+	reg = RD4(sc, CCM_CGPR);
+	reg |= CCM_CGPR_INT_MEM_CLK_LPM;
+	WR4(sc, CCM_CGPR, reg);
+	reg = RD4(sc, CCM_CLPCR);
+	reg = (reg & ~CCM_CLPCR_LPM_MASK) | CCM_CLPCR_LPM_RUN;
+	WR4(sc, CCM_CLPCR, reg);
+
 	err = 0;
 
 out:

Modified: projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccmreg.h
==============================================================================
--- projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccmreg.h	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/freescale/imx/imx6_ccmreg.h	Fri Feb 28 17:46:56 2014	(r262612)
@@ -29,13 +29,20 @@
 #ifndef	IMX6_CCMREG_H
 #define	IMX6_CCMREG_H
 
-#define	CCM_CCGR1		0x06C
-#define	CCM_CCGR2		0x070
-#define	CCM_CCGR3		0x074
-#define	CCM_CCGR4		0x078
-#define	CCM_CCGR5		0x07C
-#define	CCM_CCGR6		0x080
-#define	CCM_CMEOR		0x088
+#define	CCM_CLPCR			0x054
+#define	  CCM_CLPCR_LPM_MASK		  0x03
+#define	  CCM_CLPCR_LPM_RUN		  0x00
+#define	  CCM_CLPCR_LPM_WAIT		  0x01
+#define	  CCM_CLPCR_LPM_STOP		  0x02
+#define	CCM_CGPR			0x064
+#define	  CCM_CGPR_INT_MEM_CLK_LPM	  (1 << 17)
+#define	CCM_CCGR1			0x06C
+#define	CCM_CCGR2			0x070
+#define	CCM_CCGR3			0x074
+#define	CCM_CCGR4			0x078
+#define	CCM_CCGR5			0x07C
+#define	CCM_CCGR6			0x080
+#define	CCM_CMEOR			0x088
                   
 
 #endif

Modified: projects/clang-sparc64/sys/arm/freescale/vybrid/files.vybrid
==============================================================================
--- projects/clang-sparc64/sys/arm/freescale/vybrid/files.vybrid	Fri Feb 28 17:12:31 2014	(r262611)
+++ projects/clang-sparc64/sys/arm/freescale/vybrid/files.vybrid	Fri Feb 28 17:46:56 2014	(r262612)
@@ -23,6 +23,7 @@ arm/freescale/vybrid/vf_mscm.c			standar
 arm/freescale/vybrid/vf_src.c			standard
 arm/freescale/vybrid/vf_edma.c			standard
 arm/freescale/vybrid/vf_dmamux.c		standard
+arm/freescale/vybrid/vf_i2c.c			optional	iicbus
 arm/freescale/vybrid/vf_tcon.c			optional	vt
 arm/freescale/vybrid/vf_dcu4.c			optional	vt
 arm/freescale/vybrid/vf_nfc.c			optional	nand

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402281746.s1SHku20002690>