Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Apr 2014 08:02:55 +0000 (UTC)
From:      Mark Murray <markm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r265005 - in projects/random_number_generator: . bin/date release/amd64 secure/usr.sbin/sshd sys/amd64/amd64 sys/amd64/conf sys/amd64/vmm/intel sys/arm/arm sys/arm/freescale/imx sys/arm...
Message-ID:  <201404270802.s3R82tNG018957@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markm
Date: Sun Apr 27 08:02:55 2014
New Revision: 265005
URL: http://svnweb.freebsd.org/changeset/base/265005

Log:
  MFC - tracking commit

Added:
  projects/random_number_generator/release/amd64/mkisoimages-uefi.sh
     - copied unchanged from r265004, head/release/amd64/mkisoimages-uefi.sh
  projects/random_number_generator/sys/arm/freescale/imx/imx_ccmvar.h
     - copied unchanged from r265004, head/sys/arm/freescale/imx/imx_ccmvar.h
  projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile.fat
     - copied unchanged from r265004, head/sys/boot/amd64/boot1.efi/Makefile.fat
  projects/random_number_generator/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu
     - copied unchanged from r265004, head/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu
  projects/random_number_generator/sys/boot/amd64/boot1.efi/generate-fat.sh
     - copied unchanged from r265004, head/sys/boot/amd64/boot1.efi/generate-fat.sh
  projects/random_number_generator/sys/dev/uart/uart_dev_imx.h
     - copied unchanged from r265004, head/sys/dev/uart/uart_dev_imx.h
Deleted:
  projects/random_number_generator/sys/amd64/conf/UEFI
  projects/random_number_generator/sys/dev/uart/uart_dev_imx5xx.h
Modified:
  projects/random_number_generator/Makefile.inc1
  projects/random_number_generator/bin/date/date.1
  projects/random_number_generator/bin/date/date.c
  projects/random_number_generator/release/amd64/make-uefi-memstick.sh
  projects/random_number_generator/secure/usr.sbin/sshd/Makefile
  projects/random_number_generator/sys/amd64/amd64/mp_machdep.c
  projects/random_number_generator/sys/amd64/amd64/vm_machdep.c
  projects/random_number_generator/sys/amd64/conf/VT
  projects/random_number_generator/sys/amd64/vmm/intel/vmx.c
  projects/random_number_generator/sys/arm/arm/cpufunc.c
  projects/random_number_generator/sys/arm/arm/cpufunc_asm_armv7.S
  projects/random_number_generator/sys/arm/arm/elf_machdep.c
  projects/random_number_generator/sys/arm/arm/mp_machdep.c
  projects/random_number_generator/sys/arm/freescale/imx/imx51_ccm.c
  projects/random_number_generator/sys/arm/freescale/imx/imx6_ccm.c
  projects/random_number_generator/sys/arm/freescale/imx/imx6_usbphy.c
  projects/random_number_generator/sys/arm/freescale/imx/imx_gpt.c
  projects/random_number_generator/sys/arm/freescale/imx/imx_machdep.h
  projects/random_number_generator/sys/arm/freescale/imx/imx_nop_usbphy.c
  projects/random_number_generator/sys/arm/freescale/imx/imx_sdhci.c
  projects/random_number_generator/sys/arm/include/cpufunc.h
  projects/random_number_generator/sys/arm/include/kdb.h
  projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile
  projects/random_number_generator/sys/dev/uart/uart_dev_imx.c
  projects/random_number_generator/sys/dev/usb/controller/ehci_imx.c
  projects/random_number_generator/sys/dev/usb/wlan/if_urtwn.c
  projects/random_number_generator/sys/dev/vt/hw/vga/vga.c
  projects/random_number_generator/sys/dev/vt/vt.h
  projects/random_number_generator/sys/i386/i386/mp_machdep.c
  projects/random_number_generator/sys/i386/i386/vm_machdep.c
  projects/random_number_generator/sys/i386/xen/mp_machdep.c
  projects/random_number_generator/sys/ia64/ia64/mp_machdep.c
  projects/random_number_generator/sys/kern/kern_cpu.c
  projects/random_number_generator/sys/kern/subr_smp.c
  projects/random_number_generator/sys/mips/mips/mp_machdep.c
  projects/random_number_generator/sys/net/if.c
  projects/random_number_generator/sys/net/route.c
  projects/random_number_generator/sys/net/route.h
  projects/random_number_generator/sys/net/rtsock.c
  projects/random_number_generator/sys/net80211/ieee80211_ioctl.c
  projects/random_number_generator/sys/netinet6/ip6_input.c
  projects/random_number_generator/sys/netinet6/nd6_nbr.c
  projects/random_number_generator/sys/powerpc/powerpc/mp_machdep.c
  projects/random_number_generator/sys/sparc64/sparc64/mp_machdep.c
  projects/random_number_generator/sys/sys/smp.h
  projects/random_number_generator/sys/vm/swap_pager.c
  projects/random_number_generator/sys/vm/vm_fault.c
  projects/random_number_generator/tools/regression/vfs/trailing_slash.t
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/gpart_ops.c
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/partedit.h
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/partedit_generic.c
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/partedit_pc98.c
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/partedit_powerpc.c
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/partedit_sparc64.c
  projects/random_number_generator/usr.sbin/bsdinstall/partedit/partedit_x86.c
  projects/random_number_generator/usr.sbin/ifmcstat/ifmcstat.c
Directory Properties:
  projects/random_number_generator/   (props changed)
  projects/random_number_generator/sys/   (props changed)
  projects/random_number_generator/sys/amd64/vmm/   (props changed)
  projects/random_number_generator/sys/boot/   (props changed)

Modified: projects/random_number_generator/Makefile.inc1
==============================================================================
--- projects/random_number_generator/Makefile.inc1	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/Makefile.inc1	Sun Apr 27 08:02:55 2014	(r265005)
@@ -1833,7 +1833,7 @@ builddtb:
 		echo "ERROR: FDT_DTS_FILE must be specified!"; \
 		exit 1; \
 	fi;	\
-	if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; then \
+	if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${TARGET}/${FDT_DTS_FILE} ]; then \
 		echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
 			exist!"; \
 		exit 1;	\
@@ -1843,6 +1843,7 @@ builddtb:
 			directory"; \
 	fi
 	@PATH=${TMPPATH} \
+	MACHINE=${TARGET} \
 	${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
 	    ${FDT_DTS_FILE} \
 	    ${DTBOUTPUTPATH}/`basename ${FDT_DTS_FILE} .dts`

Modified: projects/random_number_generator/bin/date/date.1
==============================================================================
--- projects/random_number_generator/bin/date/date.1	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/bin/date/date.1	Sun Apr 27 08:02:55 2014	(r265005)
@@ -32,7 +32,7 @@
 .\"     @(#)date.1	8.3 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd June 3, 2010
+.Dd April 26, 2014
 .Dt DATE 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd display or set date and time
 .Sh SYNOPSIS
 .Nm
-.Op Fl ju
+.Op Fl jRu
 .Op Fl r Ar seconds
 .Oo
 .Fl v
@@ -58,7 +58,7 @@
 .Ar MM Op Ar .ss
 .Sm on
 .Nm
-.Op Fl jnu
+.Op Fl jnRu
 .Fl f Ar input_fmt new_date
 .Op Cm + Ns Ar output_fmt
 .Nm
@@ -130,6 +130,16 @@ The
 .Fl n
 option suppresses this behavior and causes the time to be set only on the
 current machine.
+.It Fl R
+Use RFC 2822 date and time output format. This is equivalent to use
+.Dq Li %a, %d %b %Y \&%T %z
+as
+.Ar output_fmt
+while
+.Ev LC_TIME
+is set to the
+.Dq C
+locale .
 .It Fl r Ar seconds
 Print the date and time represented by
 .Ar seconds ,

Modified: projects/random_number_generator/bin/date/date.c
==============================================================================
--- projects/random_number_generator/bin/date/date.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/bin/date/date.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -69,12 +69,14 @@ static void setthetime(const char *, con
 static void badformat(void);
 static void usage(void);
 
+static const char *rfc2822_format = "%a, %d %b %Y %T %z";
+
 int
 main(int argc, char *argv[])
 {
 	struct timezone tz;
 	int ch, rflag;
-	int jflag, nflag;
+	int jflag, nflag, Rflag;
 	const char *format;
 	char buf[1024];
 	char *endptr, *fmt;
@@ -89,9 +91,9 @@ main(int argc, char *argv[])
 	(void) setlocale(LC_TIME, "");
 	tz.tz_dsttime = tz.tz_minuteswest = 0;
 	rflag = 0;
-	jflag = nflag = 0;
+	jflag = nflag = Rflag = 0;
 	set_timezone = 0;
-	while ((ch = getopt(argc, argv, "d:f:jnr:t:uv:")) != -1)
+	while ((ch = getopt(argc, argv, "d:f:jnRr:t:uv:")) != -1)
 		switch((char)ch) {
 		case 'd':		/* daylight savings time */
 			tz.tz_dsttime = strtol(optarg, &endptr, 10) ? 1 : 0;
@@ -108,6 +110,9 @@ main(int argc, char *argv[])
 		case 'n':		/* don't set network */
 			nflag = 1;
 			break;
+		case 'R':		/* RFC 2822 datetime format */
+			Rflag = 1;
+			break;
 		case 'r':		/* user specified seconds */
 			rflag = 1;
 			tval = strtoq(optarg, &tmp, 0);
@@ -145,6 +150,9 @@ main(int argc, char *argv[])
 
 	format = "%+";
 
+	if (Rflag)
+		format = rfc2822_format;
+
 	/* allow the operands in any order */
 	if (*argv && **argv == '+') {
 		format = *argv + 1;
@@ -169,6 +177,14 @@ main(int argc, char *argv[])
 		usage();
 	}
 	vary_destroy(v);
+
+	if (format == rfc2822_format)
+		/*
+		 * When using RFC 2822 datetime format, don't honor the
+		 * locale.
+		 */
+		setlocale(LC_TIME, "C");
+
 	(void)strftime(buf, sizeof(buf), format, &lt);
 	(void)printf("%s\n", buf);
 	if (fflush(stdout))
@@ -301,7 +317,7 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr, "%s\n%s\n",
-	    "usage: date [-jnu] [-d dst] [-r seconds] [-t west] "
+	    "usage: date [-jnRu] [-d dst] [-r seconds] [-t west] "
 	    "[-v[+|-]val[ymwdHMS]] ... ",
 	    "            "
 	    "[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]");

Modified: projects/random_number_generator/release/amd64/make-uefi-memstick.sh
==============================================================================
--- projects/random_number_generator/release/amd64/make-uefi-memstick.sh	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/release/amd64/make-uefi-memstick.sh	Sun Apr 27 08:02:55 2014	(r265005)
@@ -1,12 +1,9 @@
 #!/bin/sh
 #
-# This script generates a "memstick image" for UEFI-capable systems.
-#
-# Prerequisites:
-#  - 'make release'
-#  - KERNCONF *must* be VT (or vt_efifb(4) compiled into the kernel)
-#
-# Note:  This only works for amd64, because i386 lacks the EFI boot bits.
+# This script generates a "memstick image" (image that can be copied to a
+# USB memory stick) from a directory tree.  Note that the script does not
+# clean up after itself very well for error conditions on purpose so the
+# problem can be diagnosed (full filesystem most likely but ...).
 #
 # Usage: make-memstick.sh <directory tree> <image filename>
 #
@@ -31,43 +28,14 @@ if [ -e ${2} ]; then
 	exit 1
 fi
 
-dirsize=$(du -shLm ${1} | awk '{print $1}')
-dirsize=$(( $(( $(( ${dirsize} + 256 )) * 1024 * 1024 )) ))
-truncate -s ${dirsize} ${2}
-
-unit=$(mdconfig -a -t vnode -f ${2})
-gpart create -s mbr /dev/${unit}
-gpart add -t '!0xEF' -s 32M /dev/${unit}
-gpart add -t freebsd /dev/${unit}
-gpart set -a active -i 2 /dev/${unit}
-gpart bootcode -b ${1}/boot/boot0 /dev/${unit}
-gpart create -s bsd -n 20 /dev/${unit}s2
-gpart add -t freebsd-ufs /dev/${unit}s2
-gpart bootcode -b ${1}/boot/boot /dev/${unit}s2
-newfs_msdos /dev/${unit}s1
-newfs -L rootfs /dev/${unit}s2a
-mkdir -p ${1}/mnt
-mount -t msdosfs /dev/${unit}s1 ${1}/mnt
-mkdir -p ${1}/mnt/efi/boot
-cp -p ${1}/boot/boot1.efi ${1}/mnt/efi/boot/BOOTx64.efi
-
-while ! umount ${1}/mnt; do
-	sleep 1
-done
-
-mkdir -p mnt
-mount /dev/${unit}s2a mnt
-tar -cf - -C ${1} . | tar -xf - -C mnt
-echo "/dev/ufs/rootfs / ufs ro,noatime 1 1" > mnt/etc/fstab
-
-while ! umount mnt; do
-	sleep 1
-done
-
-# Default boot selection to MBR so systems that do not support UEFI
-# do not fail to boot without human interaction.
-boot0cfg -s 2 /dev/${unit}
+echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab
+makefs -B little -o label=FreeBSD_Install ${2}.part ${1}
+if [ $? -ne 0 ]; then
+	echo "makefs failed"
+	exit 1
+fi
+rm ${1}/etc/fstab
 
-mdconfig -d -u ${unit}
-rmdir mnt
+mkimg -s gpt -b ${1}/boot/pmbr -p freebsd-boot:=${1}/boot/gptboot -p efi:=${1}/boot/boot1.efifat -p freebsd-ufs:=${2}.part -o ${2}
+rm ${2}.part
 

Copied: projects/random_number_generator/release/amd64/mkisoimages-uefi.sh (from r265004, head/release/amd64/mkisoimages-uefi.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/release/amd64/mkisoimages-uefi.sh	Sun Apr 27 08:02:55 2014	(r265005, copy of r265004, head/release/amd64/mkisoimages-uefi.sh)
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Module: mkisoimages.sh
+# Author: Jordan K Hubbard
+# Date:   22 June 2001
+#
+# $FreeBSD$
+#
+# This script is used by release/Makefile to build the (optional) ISO images
+# for a FreeBSD release.  It is considered architecture dependent since each
+# platform has a slightly unique way of making bootable CDs.  This script
+# is also allowed to generate any number of images since that is more of
+# publishing decision than anything else.
+#
+# Usage:
+#
+# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
+#
+# Where -b is passed if the ISO image should be made "bootable" by
+# whatever standards this architecture supports (may be unsupported),
+# image-label is the ISO image label, image-name is the filename of the
+# resulting ISO image, base-bits-dir contains the image contents and
+# extra-bits-dir, if provided, contains additional files to be merged
+# into base-bits-dir as part of making the image.
+
+if [ "x$1" = "x-b" ]; then
+	# This is highly x86-centric and will be used directly below.
+	bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
+
+	# Make EFI system partition (should be done with makefs in the future)
+	dd if=/dev/zero of=efiboot.img bs=4k count=100
+	device=`mdconfig -a -t vnode -f efiboot.img`
+	newfs_msdos -F 12 -m 0xf8 /dev/$device
+	mkdir efi
+	mount -t msdosfs /dev/$device efi
+	mkdir -p efi/efi/boot
+	cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi
+	umount efi
+	rmdir efi
+	mdconfig -d -u $device
+	bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable"
+	
+	shift
+else
+	bootable=""
+fi
+
+if [ $# -lt 3 ]; then
+	echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
+	exit 1
+fi
+
+LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
+NAME=$1; shift
+
+publisher="The FreeBSD Project.  http://www.FreeBSD.org/"
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
+makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
+rm $1/etc/fstab
+rm -f efiboot.img

Modified: projects/random_number_generator/secure/usr.sbin/sshd/Makefile
==============================================================================
--- projects/random_number_generator/secure/usr.sbin/sshd/Makefile	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/secure/usr.sbin/sshd/Makefile	Sun Apr 27 08:02:55 2014	(r265005)
@@ -57,6 +57,16 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
 DPADD+= ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
 LDADD+= -lcrypt -lcrypto -lz
 
+# Fix the order of NEEDED entries for libthr and libc. The libthr
+# needs to interpose libc symbols, leaving the libthr loading as
+# dependency of krb causes reversed order and broken interposing. Put
+# the threading library last on the linker command line, just before
+# the -lc added by a compiler driver.
+.if ${MK_KERBEROS_SUPPORT} != "no"
+DPADD+= ${LIBPTHREAD}
+LDADD+= -lpthread
+.endif
+
 .if defined(LOCALBASE)
 CFLAGS+= -DXAUTH_PATH=\"${LOCALBASE}/bin/xauth\"
 .endif

Modified: projects/random_number_generator/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- projects/random_number_generator/sys/amd64/amd64/mp_machdep.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/amd64/amd64/mp_machdep.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -771,7 +771,6 @@ init_secondary(void)
 	if (smp_cpus == mp_ncpus) {
 		/* enable IPI's, tlb shootdown, freezes etc */
 		atomic_store_rel_int(&smp_started, 1);
-		smp_active = 1;	 /* historic */
 	}
 
 	/*
@@ -1567,6 +1566,7 @@ invlpg_handler(void)
 void
 invlpg_pcid_handler(void)
 {
+	uint64_t cr3;
 #ifdef COUNT_XINVLTLB_HITS
 	xhits_pg[PCPU_GET(cpuid)]++;
 #endif /* COUNT_XINVLTLB_HITS */
@@ -1574,15 +1574,13 @@ invlpg_pcid_handler(void)
 	(*ipi_invlpg_counts[PCPU_GET(cpuid)])++;
 #endif /* COUNT_IPIS */
 
-	if (invpcid_works) {
-		invpcid(&smp_tlb_invpcid, INVPCID_ADDR);
+	if (smp_tlb_invpcid.pcid == (uint64_t)-1) {
+		invltlb_globpcid();
 	} else if (smp_tlb_invpcid.pcid == 0) {
 		invlpg(smp_tlb_invpcid.addr);
-	} else if (smp_tlb_invpcid.pcid == (uint64_t)-1) {
-		invltlb_globpcid();
+	} else if (invpcid_works) {
+		invpcid(&smp_tlb_invpcid, INVPCID_ADDR);
 	} else {
-		uint64_t cr3;
-
 		/*
 		 * PCID supported, but INVPCID is not.
 		 * Temporarily switch to the target address

Modified: projects/random_number_generator/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- projects/random_number_generator/sys/amd64/amd64/vm_machdep.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/amd64/amd64/vm_machdep.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -597,7 +597,7 @@ cpu_reset()
 	cpuset_t map;
 	u_int cnt;
 
-	if (smp_active) {
+	if (smp_started) {
 		map = all_cpus;
 		CPU_CLR(PCPU_GET(cpuid), &map);
 		CPU_NAND(&map, &stopped_cpus);

Modified: projects/random_number_generator/sys/amd64/conf/VT
==============================================================================
--- projects/random_number_generator/sys/amd64/conf/VT	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/amd64/conf/VT	Sun Apr 27 08:02:55 2014	(r265005)
@@ -12,3 +12,4 @@ nodevice	vga
 
 device		vt
 device		vt_vga
+device		vt_efifb

Modified: projects/random_number_generator/sys/amd64/vmm/intel/vmx.c
==============================================================================
--- projects/random_number_generator/sys/amd64/vmm/intel/vmx.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/amd64/vmm/intel/vmx.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -2234,7 +2234,7 @@ vmx_run(void *arg, int vcpu, register_t 
 static void
 vmx_vmcleanup(void *arg)
 {
-	int i, error;
+	int i;
 	struct vmx *vmx = arg;
 
 	if (apic_access_virtualization(vmx, 0))
@@ -2243,13 +2243,6 @@ vmx_vmcleanup(void *arg)
 	for (i = 0; i < VM_MAXCPU; i++)
 		vpid_free(vmx->state[i].vpid);
 
-	/*
-	 * XXXSMP we also need to clear the VMCS active on the other vcpus.
-	 */
-	error = vmclear(&vmx->vmcs[0]);
-	if (error != 0)
-		panic("vmx_vmcleanup: vmclear error %d on vcpu 0", error);
-
 	free(vmx, M_VMX);
 
 	return;

Modified: projects/random_number_generator/sys/arm/arm/cpufunc.c
==============================================================================
--- projects/random_number_generator/sys/arm/arm/cpufunc.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/arm/cpufunc.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -769,7 +769,7 @@ struct cpu_functions cortexa_cpufuncs = 
 	
 	/* Cache operations */
 	
-	armv7_idcache_wbinv_all,         /* icache_sync_all      */
+	armv7_icache_sync_all, 	        /* icache_sync_all      */
 	armv7_icache_sync_range,        /* icache_sync_range    */
 	
 	armv7_dcache_wbinv_all,         /* dcache_wbinv_all     */

Modified: projects/random_number_generator/sys/arm/arm/cpufunc_asm_armv7.S
==============================================================================
--- projects/random_number_generator/sys/arm/arm/cpufunc_asm_armv7.S	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/arm/cpufunc_asm_armv7.S	Sun Apr 27 08:02:55 2014	(r265005)
@@ -250,6 +250,13 @@ ENTRY(armv7_idcache_wbinv_range)
 	RET
 END(armv7_idcache_wbinv_range)
 
+ENTRY_NP(armv7_icache_sync_all)
+	mcr	p15, 0, r0, c7, c1, 0	/* Invalidate all I cache to PoU Inner Shareable */
+	isb				/* instruction synchronization barrier */
+	dsb				/* data synchronization barrier */
+	RET
+END(armv7_icache_sync_all)
+
 ENTRY_NP(armv7_icache_sync_range)
 	ldr	ip, .Larmv7_line_size
 .Larmv7_sync_next:

Modified: projects/random_number_generator/sys/arm/arm/elf_machdep.c
==============================================================================
--- projects/random_number_generator/sys/arm/arm/elf_machdep.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/arm/elf_machdep.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -220,9 +220,19 @@ int
 elf_cpu_load_file(linker_file_t lf __unused)
 {
 
-	cpu_idcache_wbinv_all();
-	cpu_l2cache_wbinv_all();
-	cpu_tlb_flushID();
+	/*
+	 * The pmap code does not do an icache sync upon establishing executable
+	 * mappings in the kernel pmap.  It's an optimization based on the fact
+	 * that kernel memory allocations always have EXECUTABLE protection even
+	 * when the memory isn't going to hold executable code.  The only time
+	 * kernel memory holding instructions does need a sync is after loading
+	 * a kernel module, and that's when this function gets called.  Normal
+	 * data cache maintenance has already been done by the IO code, and TLB
+	 * maintenance has been done by the pmap code, so all we have to do here
+	 * is invalidate the instruction cache (which also invalidates the
+	 * branch predictor cache on platforms that have one).
+	 */
+	cpu_icache_sync_all();
 	return (0);
 }
 

Modified: projects/random_number_generator/sys/arm/arm/mp_machdep.c
==============================================================================
--- projects/random_number_generator/sys/arm/arm/mp_machdep.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/arm/mp_machdep.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -219,7 +219,6 @@ init_secondary(int cpu)
 	if (smp_cpus == mp_ncpus) {
 		/* enable IPI's, tlb shootdown, freezes etc */
 		atomic_store_rel_int(&smp_started, 1);
-		smp_active = 1;
 	}
 
 	mtx_unlock_spin(&ap_boot_mtx);

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx51_ccm.c
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx51_ccm.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx51_ccm.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
 #include <arm/freescale/imx/imx51_ccmvar.h>
 #include <arm/freescale/imx/imx51_ccmreg.h>
 #include <arm/freescale/imx/imx51_dpllreg.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 #include <arm/freescale/imx/imx_machdep.h>
 
 #define	IMXCCMDEBUG
@@ -552,3 +553,30 @@ imx_ccm_usbphy_enable(device_t dev)
 	}
 }
 
+uint32_t
+imx_ccm_ipg_hz(void)
+{
+
+	return (imx51_get_clock(IMX51CLK_IPG_CLK_ROOT));
+}
+
+uint32_t
+imx_ccm_sdhci_hz(void)
+{
+
+	return (imx51_get_clock(IMX51CLK_ESDHC1_CLK_ROOT));
+}
+
+uint32_t
+imx_ccm_perclk_hz(void)
+{
+
+	return (imx51_get_clock(IMX51CLK_PERCLK_ROOT));
+}
+
+uint32_t
+imx_ccm_uart_hz(void)
+{
+
+	return (imx51_get_clock(IMX51CLK_UART_CLK_ROOT));
+}

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx6_ccm.c
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx6_ccm.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx6_ccm.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -45,13 +45,15 @@ __FBSDID("$FreeBSD$");
 
 #include <arm/freescale/imx/imx6_anatopreg.h>
 #include <arm/freescale/imx/imx6_anatopvar.h>
-#include <arm/freescale/imx/imx_machdep.h>
 #include <arm/freescale/imx/imx6_ccmreg.h>
+#include <arm/freescale/imx/imx_machdep.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 
-
-/* XXX temp kludge for imx51_get_clock. */
-#include <arm/freescale/imx/imx51_ccmvar.h>
-#include <arm/freescale/imx/imx51_ccmreg.h>
+#ifndef CCGR_CLK_MODE_ALWAYS
+#define	CCGR_CLK_MODE_OFF		0
+#define	CCGR_CLK_MODE_RUNMODE		1
+#define	CCGR_CLK_MODE_ALWAYS		3
+#endif
 
 struct ccm_softc {
 	device_t	dev;
@@ -208,24 +210,32 @@ imx_ccm_usbphy_enable(device_t _phydev)
 #endif
 }
 
+uint32_t
+imx_ccm_ipg_hz(void)
+{
 
+	return (66000000);
+}
 
+uint32_t
+imx_ccm_perclk_hz(void)
+{
 
+	return (66000000);
+}
 
-// XXX Fix this.  This has to be here for other code to link,
-// but it doesn't have to return anything useful for imx6 right now.
-u_int
-imx51_get_clock(enum imx51_clock clk)
-{
-	switch (clk)
-	{
-	case IMX51CLK_IPG_CLK_ROOT:
-		return 66000000;
-	default:
-		printf("imx51_get_clock() on imx6 doesn't know about clock %d\n", clk);
-		break;
-	}
-	return 0;
+uint32_t
+imx_ccm_sdhci_hz(void)
+{
+
+	return (200000000);
+}
+
+uint32_t
+imx_ccm_uart_hz(void)
+{
+
+	return (80000000);
 }
 
 static device_method_t ccm_methods[] = {

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx6_usbphy.c
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx6_usbphy.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx6_usbphy.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 
-#include <arm/freescale/imx/imx_machdep.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 #include <arm/freescale/imx/imx6_anatopreg.h>
 #include <arm/freescale/imx/imx6_anatopvar.h>
 

Copied: projects/random_number_generator/sys/arm/freescale/imx/imx_ccmvar.h (from r265004, head/sys/arm/freescale/imx/imx_ccmvar.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx_ccmvar.h	Sun Apr 27 08:02:55 2014	(r265005, copy of r265004, head/sys/arm/freescale/imx/imx_ccmvar.h)
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	IMX_CCMVAR_H
+#define	IMX_CCMVAR_H
+
+/*
+ * We need a clock management system that works across unrelated SoCs and
+ * devices.  For now, to keep imx development moving, define some barebones
+ * functionality that can be shared within the imx family by having each SoC
+ * implement functions with a common name.
+ *
+ * The usb enable functions are best-effort.  They turn on the usb otg, host,
+ * and phy clocks in a SoC-specific manner, but it may take a lot more than that
+ * to make usb work on a given board.  In particular, it can require specific
+ * pinmux setup of gpio pins connected to external phy parts, voltage regulators
+ * and overcurrent detectors, and so on.  On such boards, u-boot or other early
+ * board setup code has to handle those things.
+ */
+
+uint32_t imx_ccm_ipg_hz(void);
+uint32_t imx_ccm_perclk_hz(void);
+uint32_t imx_ccm_sdhci_hz(void);
+uint32_t imx_ccm_uart_hz(void);
+
+void imx_ccm_usb_enable(device_t _usbdev);
+void imx_ccm_usbphy_enable(device_t _phydev);
+
+#endif

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx_gpt.c
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx_gpt.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx_gpt.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <arm/freescale/imx/imx_gptreg.h>
 
 #include <sys/kdb.h>
-#include <arm/freescale/imx/imx51_ccmvar.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 
 #define	WRITE4(_sc, _r, _v)						\
 	    bus_space_write_4((_sc)->sc_iot, (_sc)->sc_ioh, (_r), (_v))
@@ -164,10 +164,10 @@ imx_gpt_attach(device_t dev)
 		basefreq = 32768;
 		break;
 	case GPT_CR_CLKSRC_IPG:
-		basefreq = imx51_get_clock(IMX51CLK_IPG_CLK_ROOT);
+		basefreq = imx_ccm_ipg_hz();
 		break;
 	case GPT_CR_CLKSRC_IPG_HIGH:
-		basefreq = imx51_get_clock(IMX51CLK_IPG_CLK_ROOT) * 2;
+		basefreq = imx_ccm_ipg_hz() * 2;
 		break;
 	case GPT_CR_CLKSRC_24M:
 		ctlreg |= GPT_CR_24MEN;

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx_machdep.h
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx_machdep.h	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx_machdep.h	Sun Apr 27 08:02:55 2014	(r265005)
@@ -56,21 +56,5 @@ void imx_wdog_cpu_reset(vm_offset_t _wdc
 u_int imx_soc_type(void);
 u_int imx_soc_family(void);
 
-/*
- * We need a clock management system that works across unrelated SoCs and
- * devices.  For now, to keep imx development moving, define some barebones
- * functionality that can be shared within the imx family by having each SoC
- * implement functions with a common name.
- *
- * The usb enable functions are best-effort.  They turn on the usb otg, host,
- * and phy clocks in a SoC-specific manner, but it may take a lot more than that
- * to make usb work on a given board.  In particular, it can require specific
- * pinmux setup of gpio pins connected to external phy parts, voltage regulators
- * and overcurrent detectors, and so on.  On such boards, u-boot or other early
- * board setup code has to handle those things.
- */
-void imx_ccm_usb_enable(device_t _usbdev);
-void imx_ccm_usbphy_enable(device_t _phydev);
-
 #endif
 

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx_nop_usbphy.c
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx_nop_usbphy.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx_nop_usbphy.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 
-#include <arm/freescale/imx/imx_machdep.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 
 /*
  * Table of supported FDT compat strings.

Modified: projects/random_number_generator/sys/arm/freescale/imx/imx_sdhci.c
==============================================================================
--- projects/random_number_generator/sys/arm/freescale/imx/imx_sdhci.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/freescale/imx/imx_sdhci.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 #include <machine/intr.h>
 
-#include <arm/freescale/imx/imx51_ccmvar.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
@@ -723,12 +723,7 @@ imx_sdhci_attach(device_t dev)
 	 */
 	WR4(sc, SDHC_WTMK_LVL, 0x08800880);
 
-	/* XXX get imx6 clock frequency from CCM */
-	if (sc->hwtype == HWTYPE_USDHC) {
-		sc->baseclk_hz = 200000000;
-	} else if (sc->hwtype == HWTYPE_ESDHC) {
-		sc->baseclk_hz = imx51_get_clock(IMX51CLK_PERCLK_ROOT);
-	}
+	sc->baseclk_hz = imx_ccm_sdhci_hz();
 
 	/*
 	 * If the slot is flagged with the non-removable property, set our flag

Modified: projects/random_number_generator/sys/arm/include/cpufunc.h
==============================================================================
--- projects/random_number_generator/sys/arm/include/cpufunc.h	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/include/cpufunc.h	Sun Apr 27 08:02:55 2014	(r265005)
@@ -411,6 +411,7 @@ void	armv6_idcache_wbinv_range	(vm_offse
 void	armv7_setttb			(u_int);
 void	armv7_tlb_flushID		(void);
 void	armv7_tlb_flushID_SE		(u_int);
+void	armv7_icache_sync_all		();
 void	armv7_icache_sync_range		(vm_offset_t, vm_size_t);
 void	armv7_idcache_wbinv_range	(vm_offset_t, vm_size_t);
 void	armv7_idcache_inv_all		(void);

Modified: projects/random_number_generator/sys/arm/include/kdb.h
==============================================================================
--- projects/random_number_generator/sys/arm/include/kdb.h	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/arm/include/kdb.h	Sun Apr 27 08:02:55 2014	(r265005)
@@ -49,7 +49,7 @@ static __inline void
 kdb_cpu_sync_icache(unsigned char *addr, size_t size)
 {
 
-	cpu_icache_sync_all();
+	cpu_icache_sync_range((vm_offset_t)addr, size);
 }
 
 static __inline void

Modified: projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile
==============================================================================
--- projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile	Sun Apr 27 08:02:55 2014	(r265005)
@@ -26,7 +26,7 @@ CFLAGS+=	-I${.CURDIR}/../../..
 .PATH:		${.CURDIR}/../efi ${.CURDIR}/../../common
 CFLAGS+=	-I${.CURDIR}/../../common
 
-FILES=	boot1.efi
+FILES=	boot1.efi boot1.efifat
 FILESMODE_boot1.efi=	${BINMODE}
 
 LDSCRIPT=	${.CURDIR}/../efi/ldscript.${MACHINE_CPUARCH}
@@ -57,6 +57,20 @@ CFLAGS+=	-I${.CURDIR}/../../common
 
 boot1.o: ${.CURDIR}/../../common/ufsread.c
 
+# The following inserts out objects into a template FAT file system
+# created by generate-fat.sh
+
+.include "${.CURDIR}/Makefile.fat"
+
+boot1.efifat: boot1.efi
+	echo ${.OBJDIR}
+	uudecode ${.CURDIR}/fat.tmpl.bz2.uu
+	mv fat.tmpl.bz2 ${.TARGET}.bz2
+	bzip2 -f -d ${.TARGET}.bz2
+	dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
+
+CLEANFILES= boot1.efifat
+
 .endif # ${COMPILER_TYPE} != "gcc"
 
 .include <bsd.prog.mk>

Copied: projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile.fat (from r265004, head/sys/boot/amd64/boot1.efi/Makefile.fat)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/sys/boot/amd64/boot1.efi/Makefile.fat	Sun Apr 27 08:02:55 2014	(r265005, copy of r265004, head/sys/boot/amd64/boot1.efi/Makefile.fat)
@@ -0,0 +1,3 @@
+# This file autogenerated by generate-fat.sh - DO NOT EDIT
+# $FreeBSD$
+BOOT1_OFFSET=0x2d

Copied: projects/random_number_generator/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu (from r265004, head/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu	Sun Apr 27 08:02:55 2014	(r265005, copy of r265004, head/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu)
@@ -0,0 +1,21 @@
+FAT template boot filesystem created by generate-fat.sh
+DO NOT EDIT
+$FreeBSD$
+begin 644 fat.tmpl.bz2
+M0EIH.3%!62936=AO?&0`&J9____[ZZKJJ_^N_ZO^Z_^[OO_\`5`(0!0&#$D"
+M0$)$2&(<P`(\K5,M9"5%&DQ---,FAH,0```T````R-!HQ`&30`-&"#)ID$JF
+M1)[U4_5-&@`T```#0&AH````````````(,F`$P`!,`1IA&````"9-,308`1@
+M````!))!BDVI/U0`]0R>H:`81HT#)D!H-#U`T#31IH-&(``R8$9_I)6[MY/,
+M(H=/()+4&!(3V0"20C3J5$L5@2`219,"T6JI,@0"2*2\=LAD6=>N6<O!'F<.
+MQ2`;9$.P]202R&N9I3BX[E0;C7/9BF'`((K?M1ZK0B2Q;BLJ9!(`21P&1:;B
+MDD)S!-L5BL5BL/173`@@M!!!!!X@BQ0@@@@@@CJ"A!!!"!`TWD!B!`@0($"J
+M9(E`B,1(D2)$B;V]S&-,&#!@P8,'1\*$+59`:41,';;/)32*G*Q52N![20F8
+M9CCYSB#!2=[EG.),$:P,>(8QSW'U+N42P^'5X@7X``23=EA``#Z,O)^-VTX@
+M`+E!=,&6PV11C:*D8K#^<%FTG-%!@PR72@\ZU0B<D6I$FT/1\<A#/`;ET5$)
+MKT-MBW97\J.P/H0ADE"(EBN6";@5#$2#!(\F/E8M+!8-A-S"+$U5[\J>F1Y]
+MF-FPGL2L>4QCU&O/>89^#H$6^<;&WKC9W52KUX."CM6+GD;(=1!MUD,,?Y[]
+MTLAG0];,:B^]M%BH0J1":_C-*2I9R3AS#,&0>$RCY'T/R?HR!?'5$MILQ:!"
+M+;10A*!&^<(_/8>D8<CDN9]HO)OH13W(Q())?'R2WTV9*G_4T<=Y!'1+'9,(
+J1-/V<ME.&9Q3LKI2S$(`$D,``'_=FF*).\[A.)#4HU1=R13A0D-AO?&0
+`
+end

Copied: projects/random_number_generator/sys/boot/amd64/boot1.efi/generate-fat.sh (from r265004, head/sys/boot/amd64/boot1.efi/generate-fat.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/sys/boot/amd64/boot1.efi/generate-fat.sh	Sun Apr 27 08:02:55 2014	(r265005, copy of r265004, head/sys/boot/amd64/boot1.efi/generate-fat.sh)
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# This script generates the dummy FAT filesystem used for the EFI boot
+# blocks. It uses newfs_msdos to generate a template filesystem with the
+# relevant interesting files. These are then found by grep, and the offsets
+# written to a Makefile snippet.
+#
+# Because it requires root, and because it is overkill, we do not
+# do this as part of the normal build. If makefs(8) grows workable FAT
+# support, this should be revisited.
+
+# $FreeBSD$
+
+FAT_SIZE=1600 			#Size in 512-byte blocks of the produced image
+
+BOOT1_SIZE=64k
+
+# Generate 800K FAT image
+OUTPUT_FILE=fat.tmpl
+
+dd if=/dev/zero of=$OUTPUT_FILE bs=512 count=$FAT_SIZE
+DEVICE=`mdconfig -a -f $OUTPUT_FILE`
+newfs_msdos -F 12 $DEVICE
+mkdir stub
+mount -t msdosfs /dev/$DEVICE stub
+
+# Create and bless a directory for the boot loader
+mkdir -p stub/efi/boot
+
+# Make a dummy file for boot1
+echo 'Boot1 START' | dd of=stub/efi/boot/BOOTx64.efi cbs=$BOOT1_SIZE count=1 conv=block
+
+umount stub
+mdconfig -d -u $DEVICE
+rmdir stub
+
+# Locate the offsets of the two fake files
+BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ')
+
+# Convert to numbers of blocks
+BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}')
+
+echo '# This file autogenerated by generate-fat.sh - DO NOT EDIT' > Makefile.fat
+echo '# $FreeBSD$' >> Makefile.fat
+echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.fat
+
+bzip2 $OUTPUT_FILE
+echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu
+echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu
+echo '$FreeBSD$' >> $OUTPUT_FILE.bz2.uu
+
+uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu
+rm $OUTPUT_FILE.bz2
+

Modified: projects/random_number_generator/sys/dev/uart/uart_dev_imx.c
==============================================================================
--- projects/random_number_generator/sys/dev/uart/uart_dev_imx.c	Sun Apr 27 05:37:01 2014	(r265004)
+++ projects/random_number_generator/sys/dev/uart/uart_dev_imx.c	Sun Apr 27 08:02:55 2014	(r265005)
@@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$");
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_cpu.h>
 #include <dev/uart/uart_bus.h>
+#include <dev/uart/uart_dev_imx.h>
+#include "uart_if.h"
 
-#include <dev/uart/uart_dev_imx5xx.h>
+#include <arm/freescale/imx/imx_ccmvar.h>
 
-#include "uart_if.h"
 /*
  * Low-level UART interface.
  */
@@ -66,6 +67,22 @@ static struct uart_ops uart_imx_uart_ops
 	.getc = imx_uart_getc,
 };
 
+#if 0 /* Handy when debugging. */
+static void
+dumpregs(struct uart_bas *bas, const char * msg)
+{
+
+	if (!bootverbose)
+		return;
+	printf("%s bsh 0x%08lx UCR1 0x%08x UCR2 0x%08x "
+		"UCR3 0x%08x UCR4 0x%08x USR1 0x%08x USR2 0x%08x\n",
+	    msg, bas->bsh,
+	    GETREG(bas, REG(UCR1)), GETREG(bas, REG(UCR2)), 
+	    GETREG(bas, REG(UCR3)), GETREG(bas, REG(UCR4)),
+	    GETREG(bas, REG(USR1)), GETREG(bas, REG(USR2)));
+}
+#endif
+
 static int
 imx_uart_probe(struct uart_bas *bas)
 {
@@ -77,7 +94,60 @@ static void
 imx_uart_init(struct uart_bas *bas, int baudrate, int databits, 
     int stopbits, int parity)
 {
+	uint32_t baseclk, reg;
 
+        /* Enable the device and the RX/TX channels. */
+	SET(bas, REG(UCR1), FLD(UCR1, UARTEN));
+	SET(bas, REG(UCR2), FLD(UCR2, RXEN) | FLD(UCR2, TXEN));
+
+	if (databits == 7)
+		DIS(bas, UCR2, WS);
+	else
+		ENA(bas, UCR2, WS);
+
+	if (stopbits == 2)
+		ENA(bas, UCR2, STPB);
+	else
+		DIS(bas, UCR2, STPB);
+
+	switch (parity) {
+	case UART_PARITY_ODD:
+		DIS(bas, UCR2, PROE);
+		ENA(bas, UCR2, PREN);
+		break;
+	case UART_PARITY_EVEN:
+		ENA(bas, UCR2, PROE);
+		ENA(bas, UCR2, PREN);
+		break;
+	case UART_PARITY_MARK:
+	case UART_PARITY_SPACE:
+                /* FALLTHROUGH: Hardware doesn't support mark/space. */
+	case UART_PARITY_NONE:
+	default:
+		DIS(bas, UCR2, PREN);
+		break;
+	}
+
+	/*
+	 * The hardware has an extremely flexible baud clock: it allows setting
+	 * both the numerator and denominator of the divider, as well as a
+	 * separate pre-divider.  We simplify the problem of coming up with a
+	 * workable pair of numbers by assuming a pre-divider and numerator of
+	 * one because our base clock is so fast we can reach virtually any
+	 * reasonable speed with a simple divisor.  The numerator value actually
+	 * includes the 16x over-sampling (so a value of 16 means divide by 1);
+	 * the register value is the numerator-1, so we have a hard-coded 15.
+	 * Note that a quirk of the hardware requires that both UBIR and UBMR be
+	 * set back to back in order for the change to take effect.
+	 */
+	if (baudrate > 0) {
+		baseclk = imx_ccm_uart_hz();
+		reg = GETREG(bas, REG(UFCR));
+		reg = (reg & ~IMXUART_UFCR_RFDIV_MASK) | IMXUART_UFCR_RFDIV_DIV1;
+		SETREG(bas, REG(UFCR), reg);
+		SETREG(bas, REG(UBIR), 15);
+		SETREG(bas, REG(UBMR), (baseclk / baudrate) - 1);
+	}
 }
 
 static void
@@ -218,6 +288,8 @@ imx_uart_bus_attach(struct uart_softc *s
 	DIS(bas, UCR3, RI);
 	DIS(bas, UCR3, DCD);
 	DIS(bas, UCR3, DTRDEN);
+	ENA(bas, UCR2, IRTS);
+	ENA(bas, UCR3, RXDMUXSEL);
 
 	/* ACK all interrupts */
 	SETREG(bas, REG(USR1), 0xffff);

Copied: projects/random_number_generator/sys/dev/uart/uart_dev_imx.h (from r265004, head/sys/dev/uart/uart_dev_imx.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/sys/dev/uart/uart_dev_imx.h	Sun Apr 27 08:02:55 2014	(r265005, copy of r265004, head/sys/dev/uart/uart_dev_imx.h)
@@ -0,0 +1,222 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Oleksandr Rybalko under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.	Redistributions of source code must retain the above copyright
+ *	notice, this list of conditions and the following disclaimer.
+ * 2.	Redistributions in binary form must reproduce the above copyright
+ *	notice, this list of conditions and the following disclaimer in the
+ *	documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	_UART_DEV_IMX5XX_H
+#define	_UART_DEV_IMX5XX_H
+
+#define	IMXUART_URXD_REG	0x0000 /* UART Receiver Register */
+#define		IMXUART_URXD_CHARRDY		(1 << 15)
+#define		IMXUART_URXD_ERR		(1 << 14)
+#define		IMXUART_URXD_OVRRUN		(1 << 13)
+#define		IMXUART_URXD_FRMERR		(1 << 12)
+#define		IMXUART_URXD_BRK		(1 << 11)
+#define		IMXUART_URXD_PRERR		(1 << 10)
+#define		IMXUART_URXD_RX_DATA_MASK	0xff
+
+#define	IMXUART_UTXD_REG	0x0040 /* UART Transmitter Register */
+#define		IMXUART_UTXD_TX_DATA_MASK	0xff
+
+#define	IMXUART_UCR1_REG	0x0080 /* UART Control Register 1 */
+#define		IMXUART_UCR1_ADEN		(1 << 15)
+#define		IMXUART_UCR1_ADBR		(1 << 14)

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



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