From owner-svn-src-user@freebsd.org Tue Sep 13 13:23:26 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C416BD9FC2 for ; Tue, 13 Sep 2016 13:23:26 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAE49940; Tue, 13 Sep 2016 13:23:25 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DDNPnk076141; Tue, 13 Sep 2016 13:23:25 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DDNO9m076136; Tue, 13 Sep 2016 13:23:24 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201609131323.u8DDNO9m076136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 13 Sep 2016 13:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r305766 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 13:23:26 -0000 Author: pho Date: Tue Sep 13 13:23:24 2016 New Revision: 305766 URL: https://svnweb.freebsd.org/changeset/base/305766 Log: Added new regression tests. Sponsored by: Dell EMC Isilon Added: user/pho/stress2/misc/ftruncate.sh (contents, props changed) user/pho/stress2/misc/mmap29.sh (contents, props changed) user/pho/stress2/misc/tmpfs14.sh (contents, props changed) user/pho/stress2/misc/unix_socket_detach2.sh (contents, props changed) Added: user/pho/stress2/misc/ftruncate.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/ftruncate.sh Tue Sep 13 13:23:24 2016 (r305766) @@ -0,0 +1,195 @@ +#!/bin/sh + +# +# Copyright (c) 2016 EMC Corp. +# 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$ +# + +# ftruncate(2) fuzz. + +# "panic: softdep_deallocate_dependencies: dangling deps" seen in +# 10.3-STABLE: +# https://people.freebsd.org/~pho/stress/log/ftruncate.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +dir=$RUNDIR + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > ftruncate.c +rm -f /tmp/ftruncate +mycc -o ftruncate -Wall -Wextra -O2 -g ftruncate.c -lpthread || exit 1 +rm -f ftruncate.c + +rm -rf $dir +mkdir -p $dir +chmod 777 $dir + +cd $dir +jot 500 | xargs touch +jot 500 | xargs chmod 666 +cd $odir + +(cd /tmp; /tmp/ftruncate $dir) +e=$? + +rm -rf $dir + +rm -f /tmp/ftruncate +exit $e +EOF +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define N (128 * 1024 / (int)sizeof(u_int32_t)) +#define RUNTIME 180 +#define THREADS 2 + +static int fd[900]; +static u_int32_t r[N]; +static char *args[2]; + +static unsigned long +makearg(void) +{ + unsigned long val; + + val = arc4random(); +#if defined(__LP64__) + val = (val << 32) | arc4random(); + val = val & 0x00007fffffffffffUL; +#endif + + return(val); +} + +static void * +test(void *arg __unused) +{ + FTS *fts; + FTSENT *p; + int ftsoptions, i, n; + + ftsoptions = FTS_PHYSICAL; + + for (;;) { + for (i = 0; i < N; i++) + r[i] = arc4random(); + if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) + err(1, "fts_open"); + + i = n = 0; + while ((p = fts_read(fts)) != NULL) { + if (fd[i] > 0) + close(fd[i]); + if ((fd[i] = open(p->fts_path, O_RDWR)) == -1) + if ((fd[i] = open(p->fts_path, O_WRONLY)) == -1) + continue; + i++; + i = i % nitems(fd); + } + + if (fts_close(fts) == -1) + err(1, "fts_close()"); + sleep(1); + } + return(0); +} + +static void * +calls(void *arg __unused) +{ + off_t offset; + time_t start; + int fd2; + + start = time(NULL); + while ((time(NULL) - start) < RUNTIME) { + fd2 = makearg() % nitems(fd) + 3; + offset = makearg(); + if (ftruncate(fd2, offset) == 0) { + if (lseek(fd2, offset - 1, SEEK_SET) != -1) + write(fd2, "x", 1); + } + + } + + return (0); +} + +int +main(int argc, char **argv) +{ + struct passwd *pw; + pthread_t rp, cp[THREADS]; + int e, i; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + args[0] = argv[1]; + args[1] = 0; + + if ((pw = getpwnam("nobody")) == NULL) + err(1, "failed to resolve nobody"); + if (setgroups(1, &pw->pw_gid) || + setegid(pw->pw_gid) || setgid(pw->pw_gid) || + seteuid(pw->pw_uid) || setuid(pw->pw_uid)) + err(1, "Can't drop privileges to \"nobody\""); + endpwent(); + + arc4random_stir(); + if ((e = pthread_create(&rp, NULL, test, NULL)) != 0) + errc(1, e, "pthread_create"); + usleep(1000); + for (i = 0; i < THREADS; i++) + if ((e = pthread_create(&cp[i], NULL, calls, NULL)) != 0) + errc(1, e, "pthread_create"); + for (i = 0; i < THREADS; i++) + pthread_join(cp[i], NULL); + + return (0); +} Added: user/pho/stress2/misc/mmap29.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/mmap29.sh Tue Sep 13 13:23:24 2016 (r305766) @@ -0,0 +1,72 @@ +#!/bin/sh + +# $FreeBSD$ + +# Test scenario by: David Cross + +# "panic: softdep_deallocate_dependencies: dangling deps" seen. +# https://people.freebsd.org/~pho/stress/log/mmap29.txt +# Fixed by: r302567. + +. ../default.cfg +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +[ -z "`which timeout`" ] && exit 0 +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 2g -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto +newfs -U md${mdstart}$part > /dev/null +mount /dev/md${mdstart}$part $mntpoint + +mkdir /mnt/mmap29 +cd /tmp +cat > mmap29.c < +#include +#include + +#include +#include +#include +#include +#include + +int +main(int argc, char **argv) +{ + int fd; + unsigned char *memrange; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + unlink(argv[1]); + if ((fd = open(argv[1], O_RDWR | O_CREAT, DEFFILEMODE)) == -1) + err(1, "open(%s)", argv[1]); + lseek(fd, 0xbfff, SEEK_SET); + write(fd, "\0", 1); + if ((memrange = mmap(0, 0x2b6000, PROT_READ | PROT_WRITE, MAP_SHARED | + MAP_HASSEMAPHORE | MAP_NOSYNC, fd, 0)) == MAP_FAILED) + err(1, "mmap"); + memrange[0] = 5; + munmap(memrange, 0x2b6000); + close(fd); + + return (0); +} +EOFHERE + +cc -o mmap29 -Wall -Wextra -O0 -g mmap29.c || exit 1 +rm mmap29.c +./mmap29 /mnt/mmap29/mmap291 +old=`sysctl -n kern.maxvnodes` +trap "sysctl kern.maxvnodes=$old" EXIT INT +sysctl kern.maxvnodes=2000 +timeout 60 find / -xdev -print >/dev/null +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +rm mmap29 +exit 0 Added: user/pho/stress2/misc/tmpfs14.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/tmpfs14.sh Tue Sep 13 13:23:24 2016 (r305766) @@ -0,0 +1,114 @@ +#!/bin/sh + +# +# Copyright (c) 2015 EMC Corp. +# 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$ +# + +# Verify that mmap access updates mtime and ctime on files located on a +# tmpfs FS. +# Fixed by r277828 and r277969. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > tmpfs14.c +rm -f /tmp/tmpfs14 +mycc -o tmpfs14 -Wall -Wextra -g -O2 tmpfs14.c || exit 1 +rm -f tmpfs14.c +cd $odir + +mount | grep -q "$mntpoint " && umount -f $mntpoint +mount -t tmpfs tmpfs /mnt + +(cd $mntpoint; /tmp/tmpfs14) & + +sleep .5 +set `stat -f "%m %c" $mntpoint/test` +m1=$1 +c1=$2 +while pgrep -q tmpfs14; do + set `stat -f "%m %c" $mntpoint/test` + [ "$m1" != "$1" ] && break + [ "$c1" != "$2" ] && break + sleep 1 +done +[ "$m1" = "$1" -o "$c1" = "$2" ] && + echo "FAIL Unchanged time $m1 $c1 / $1 $2" +wait + +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +rm -f /tmp/tmpfs14 +exit 0 +EOF + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +char *file = "test"; + +int +main(void) +{ + char *p; + size_t len; + int fd, i; + + if ((fd = open(file, O_RDWR | O_CREAT, 0644)) == -1) + err(1, "open(%s)", file); + if (write(fd, "abcdef", 7) < 0) + err(1, "write"); + close(fd); + + len = getpagesize(); + for (i = 0; i < 10; i++) { + sleep(1); + if ((fd = open(file, O_RDWR | O_CREAT, 0644)) == -1) + err(1, "open(%s)", file); + + if ((p = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) + err(1, "mmap"); + + p[0] = '0' + i; + munmap(p, len); + close(fd); + } + + return 0; +} Added: user/pho/stress2/misc/unix_socket_detach2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/unix_socket_detach2.sh Tue Sep 13 13:23:24 2016 (r305766) @@ -0,0 +1,159 @@ +#!/bin/sh + +# +# Copyright (c) 2016 EMC Corp. +# 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$ +# + +# Threaded version of unix_socket_detach.sh by +# Mark Johnston + +# "panic: __rw_wlock_hard: recursing but non-recursive rw unp_link_rwlock @ +# ../../../kern/uipc_usrreq.c:655" seen. +# Fixed in r303855. + +. ../default.cfg + +cd /tmp +cat > unix_socket_detach2.c < +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static sig_atomic_t done_testing; +static struct sockaddr_un sun; +static long success; +static char *file; + +static void +handler(int i __unused) { + done_testing = 1; +} + +static void * +t1(void *data __unused) +{ + int one, sd; + + while (done_testing == 0) { + sd = socket(PF_LOCAL, SOCK_STREAM, 0); + if (sd < 0) + err(1, "socket"); + one = 1; + if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &one, + sizeof(one)) < 0) + err(1, "setsockopt"); + if (bind(sd, (struct sockaddr *)&sun, sizeof(sun)) < 0) { + close(sd); + continue; + } + if (listen(sd, 10) != 0) + err(1, "listen"); + usleep(random() % 10); + success++; + (void)close(sd); + (void)unlink(file); + } + + return (NULL); +} + +static void * +t2(void *data __unused) +{ + int flags, sd; + + while (done_testing == 0) { + sd = socket(PF_LOCAL, SOCK_STREAM, 0); + if (sd < 0) + err(1, "socket"); + if ((flags = fcntl(sd, F_GETFL, 0)) < 0) + err(1, "fcntl(F_GETFL)"); + flags |= O_NONBLOCK; + if (fcntl(sd, F_SETFL, flags) < 0) + err(1, "fcntl(F_SETFL)"); + (void)connect(sd, (struct sockaddr *)&sun, sizeof(sun)); + usleep(random() % 10); + (void)close(sd); + } + + return (NULL); +} + +int +main(void) +{ + pthread_t tid[2]; + int r; + + file = "unix_socket_detach2.socket"; + memset(&sun, 0, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", file); + + signal(SIGALRM, handler); + alarm(300); + + if ((r = pthread_create(&tid[0], NULL, t1, NULL)) != 0) + errc(1, r, "pthread_create"); + if ((r = pthread_create(&tid[1], NULL, t2, NULL)) != 0) + errc(1, r, "pthread_create"); + + if ((r = pthread_join(tid[0], NULL)) != 0) + errc(1, r, "pthread_join"); + if ((r = pthread_join(tid[1], NULL)) != 0) + errc(1, r, "pthread_join"); + + if (success < 100) { + fprintf(stderr, "FAIL with only %ld\n", success); + return (1); + } + + return (0); +} +EOF + +mycc -o unix_socket_detach2 -Wall -Wextra -O2 -g unix_socket_detach2.c \ + -lpthread || exit 1 + +rm -f unix_socket_detach2.socket +/tmp/unix_socket_detach2 +s=$? + +rm -f unix_socket_detach2.c unix_socket_detach2 unix_socket_detach2.socket +exit $s From owner-svn-src-user@freebsd.org Tue Sep 13 20:13:22 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C28A0BD9166 for ; Tue, 13 Sep 2016 20:13:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 605D57F6; Tue, 13 Sep 2016 20:13:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DKDLJU040000; Tue, 13 Sep 2016 20:13:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DKDKdc039985; Tue, 13 Sep 2016 20:13:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609132013.u8DKDKdc039985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Sep 2016 20:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r305782 - in user/alc/PQ_LAUNDRY: . etc/mtree include lib/libc/sys lib/libifconfig lib/libstand release/arm share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/allwinner sys/arm/co... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 20:13:22 -0000 Author: markj Date: Tue Sep 13 20:13:19 2016 New Revision: 305782 URL: https://svnweb.freebsd.org/changeset/base/305782 Log: MFH r305781 Added: user/alc/PQ_LAUNDRY/sys/dev/evdev/ - copied from r305781, head/sys/dev/evdev/ Deleted: user/alc/PQ_LAUNDRY/sys/arm/conf/CUBIEBOARD Modified: user/alc/PQ_LAUNDRY/ObsoleteFiles.inc user/alc/PQ_LAUNDRY/etc/mtree/BSD.include.dist user/alc/PQ_LAUNDRY/include/Makefile user/alc/PQ_LAUNDRY/lib/libc/sys/cap_enter.2 user/alc/PQ_LAUNDRY/lib/libifconfig/Makefile user/alc/PQ_LAUNDRY/lib/libstand/net.h user/alc/PQ_LAUNDRY/release/arm/CUBIEBOARD.conf user/alc/PQ_LAUNDRY/share/man/man9/device_quiet.9 user/alc/PQ_LAUNDRY/share/man/man9/fpu_kern.9 user/alc/PQ_LAUNDRY/sys/amd64/amd64/fpu.c user/alc/PQ_LAUNDRY/sys/amd64/include/fpu.h user/alc/PQ_LAUNDRY/sys/amd64/include/pcb.h user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.c user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.h user/alc/PQ_LAUNDRY/sys/arm/conf/BEAGLEBONE user/alc/PQ_LAUNDRY/sys/arm/ti/ti_adc.c user/alc/PQ_LAUNDRY/sys/arm/ti/ti_adcreg.h user/alc/PQ_LAUNDRY/sys/arm/ti/ti_adcvar.h user/alc/PQ_LAUNDRY/sys/arm/ti/ti_cpuid.c user/alc/PQ_LAUNDRY/sys/arm64/arm64/db_trace.c user/alc/PQ_LAUNDRY/sys/arm64/arm64/debug_monitor.c user/alc/PQ_LAUNDRY/sys/arm64/arm64/identcpu.c user/alc/PQ_LAUNDRY/sys/arm64/include/debug_monitor.h user/alc/PQ_LAUNDRY/sys/boot/common/dev_net.c user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c user/alc/PQ_LAUNDRY/sys/conf/NOTES user/alc/PQ_LAUNDRY/sys/conf/files user/alc/PQ_LAUNDRY/sys/conf/files.arm64 user/alc/PQ_LAUNDRY/sys/conf/options user/alc/PQ_LAUNDRY/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c user/alc/PQ_LAUNDRY/sys/dev/ath/if_ath_tx.c user/alc/PQ_LAUNDRY/sys/dev/ath/if_ath_tx_edma.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/adapter.h user/alc/PQ_LAUNDRY/sys/dev/cxgbe/common/t4_hw.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/common/t4vf_hw.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/firmware/t4fw_interface.h user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_iov.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_main.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_netmap.c user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_sge.c user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_net_vsc.c user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_net_vsc.h user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_rndis_filter.c user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_rndis_filter.h user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/if_hnvar.h user/alc/PQ_LAUNDRY/sys/dev/ioat/ioat.c user/alc/PQ_LAUNDRY/sys/dev/urtwn/if_urtwn.c user/alc/PQ_LAUNDRY/sys/kern/kern_descrip.c user/alc/PQ_LAUNDRY/sys/kern/subr_bus.c user/alc/PQ_LAUNDRY/sys/mips/malta/asm_malta.S user/alc/PQ_LAUNDRY/sys/mips/malta/malta_mp.c user/alc/PQ_LAUNDRY/sys/mips/mips/locore.S user/alc/PQ_LAUNDRY/sys/net80211/ieee80211_adhoc.c user/alc/PQ_LAUNDRY/sys/netpfil/ipfw/ip_fw_table.c user/alc/PQ_LAUNDRY/sys/sys/filedesc.h user/alc/PQ_LAUNDRY/sys/x86/x86/identcpu.c user/alc/PQ_LAUNDRY/sys/x86/x86/intr_machdep.c user/alc/PQ_LAUNDRY/usr.bin/bsdiff/bspatch/bspatch.c user/alc/PQ_LAUNDRY/usr.sbin/amd/amd/Makefile user/alc/PQ_LAUNDRY/usr.sbin/pw/pw.8 user/alc/PQ_LAUNDRY/usr.sbin/syslogd/syslogd.c Directory Properties: user/alc/PQ_LAUNDRY/ (props changed) user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/ (props changed) Modified: user/alc/PQ_LAUNDRY/ObsoleteFiles.inc ============================================================================== --- user/alc/PQ_LAUNDRY/ObsoleteFiles.inc Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/ObsoleteFiles.inc Tue Sep 13 20:13:19 2016 (r305782) @@ -41,6 +41,8 @@ # 20160906: libkqueue tests moved to /usr/tests/sys/kqueue/libkqueue OLD_FILES+=usr/tests/sys/kqueue/kqtest OLD_FILES+=usr/tests/sys/kqueue/kqueue_test +# 20160903: idle page zeroing support removed +OLD_FILES+=usr/share/man/man9/pmap_zero_idle.9.gz # 20160901: Remove digi(4) OLD_FILES+=usr/share/man/man4/digi.4.gz # 20160819: Remove ie(4) @@ -59,6 +61,8 @@ OLD_FILES+=usr/share/man/man8/sicontrol. OLD_FILES+=usr/share/man/man4/scd.4.gz # 20160815: Remove mcd(4) OLD_FILES+=usr/share/man/man4/mcd.4.gz +# 20160805: lockmgr_waiters(9) removed +OLD_FILES+=usr/share/man/man9/lockmgr_waiters.9.gz # 20160703: POSIXify locales with variants OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_COLLATE OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_CTYPE @@ -213,18 +217,23 @@ OLD_LIBS+=usr/lib32/pam_unix.so.5 OLD_FILES+=usr/include/altq/altq_codel.h OLD_FILES+=usr/include/altq/altq_fairq.h # 20160519: remove DTrace Toolkit from base +OLD_FILES+=usr/sbin/dtruss OLD_FILES+=usr/share/dtrace/toolkit/execsnoop OLD_FILES+=usr/share/dtrace/toolkit/hotkernel OLD_FILES+=usr/share/dtrace/toolkit/hotuser OLD_FILES+=usr/share/dtrace/toolkit/opensnoop OLD_FILES+=usr/share/dtrace/toolkit/procsystime OLD_DIRS+=usr/share/dtrace/toolkit +OLD_FILES+=usr/share/man/man1/dtruss.1.gz # 20160519: stale MLINK removed OLD_FILES+=usr/share/man/man9/rman_await_resource.9.gz # 20160517: ReiserFS removed OLD_FILES+=usr/share/man/man5/reiserfs.5.gz +# 20160504: tests rework +OLD_FILES+=usr/tests/lib/libc/regex/data/README # 20160430: kvm_getfiles(3) removed from kvm(3) OLD_LIBS+=lib/libkvm.so.6 +OLD_LIBS+=usr/lib32/libkvm.so.6 OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz # 20160423: remove mroute6d OLD_FILES+=etc/rc.d/mroute6d @@ -372,12 +381,18 @@ OLD_LIBS+=usr/lib32/libcapsicum.so.0 OLD_FILES+=usr/lib32/libcapsicum_p.a # 20160223: functionality from mkulzma(1) merged into mkuzip(1) OLD_FILES+=usr/bin/mkulzma +OLD_FILES+=usr/share/man/man4/geom_uncompress.4.gz +OLD_FILES+=usr/share/man/man8/mkulzma.8.gz # 20160211: Remove obsolete unbound-control-setup OLD_FILES+=usr/sbin/unbound-control-setup +# 20160121: cc.h moved +OLD_FILES+=usr/include/netinet/cc.h # 20160116: Update mandoc to cvs snapshot 20160116 OLD_FILES+=usr/share/mdocml/example.style.css OLD_FILES+=usr/share/mdocml/style.css OLD_DIRS+=usr/share/mdocml +# 20160114: SA-16:06.snmpd +OLD_FILES+=usr/share/examples/etc/snmpd.config # 20151225: new clang import which bumps version from 3.7.0 to 3.7.1. OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/asan_interface.h @@ -462,6 +477,9 @@ OLD_FILES+=usr/lib/clang/3.7.0/lib/freeb OLD_DIRS+=usr/lib/clang/3.7.0/lib/freebsd OLD_DIRS+=usr/lib/clang/3.7.0/lib OLD_DIRS+=usr/lib/clang/3.7.0 +# 20151201: mqueue tests 3 and 4 disabled +OLD_FILES+=usr/tests/sys/mqueue/mqtest3 +OLD_FILES+=usr/tests/sys/mqueue/mqtest4 # 20151130: libelf moved from /usr/lib to /lib (libkvm dependency in r291406) OLD_LIBS+=usr/lib/libelf.so.2 # 20151115: Fox bad upgrade scheme @@ -596,6 +614,8 @@ OLD_LIBS+=lib/libcrypto.so.7 OLD_LIBS+=usr/lib/libssl.so.7 OLD_LIBS+=usr/lib32/libcrypto.so.7 OLD_LIBS+=usr/lib32/libssl.so.7 +# 20151029: LinuxKPI moved to sys/compat/linuxkpi +OLD_FILES+=usr/include/dev/usb/usb_compat_linux.h # 20151015: test symbols moved to /usr/lib/debug OLD_DIRS+=usr/tests/lib/atf/libatf-c++/.debug OLD_FILES+=usr/tests/lib/atf/libatf-c++/.debug/atf_c++_test.debug Modified: user/alc/PQ_LAUNDRY/etc/mtree/BSD.include.dist ============================================================================== --- user/alc/PQ_LAUNDRY/etc/mtree/BSD.include.dist Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/etc/mtree/BSD.include.dist Tue Sep 13 20:13:19 2016 (r305782) @@ -110,6 +110,8 @@ .. ciss .. + evdev + .. filemon .. firewire Modified: user/alc/PQ_LAUNDRY/include/Makefile ============================================================================== --- user/alc/PQ_LAUNDRY/include/Makefile Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/include/Makefile Tue Sep 13 20:13:19 2016 (r305782) @@ -154,7 +154,7 @@ copies: .PHONY .META done; \ fi .endfor -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} cd ${.CURDIR}/../sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${DESTDIR}${INCLUDEDIR}/$i @@ -177,6 +177,13 @@ copies: .PHONY .META ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ ${DESTDIR}${INCLUDEDIR}/dev/nand .endif + cd ${.CURDIR}/../sys/dev/evdev; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input.h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev cd ${.CURDIR}/../sys/dev/pci; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ ${DESTDIR}${INCLUDEDIR}/dev/pci @@ -238,7 +245,7 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ done .endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} cd ${.CURDIR}/../sys/$i; \ for h in *.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ @@ -266,6 +273,11 @@ symlinks: .PHONY .META ${DESTDIR}${INCLUDEDIR}/dev/nand; \ done .endif + cd ${.CURDIR}/../sys/dev/evdev; \ + for h in input.h input-event-codes.h uinput.h; do \ + ln -fs ../../../../sys/dev/evdev/$$h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ + done cd ${.CURDIR}/../sys/dev/pci; \ for h in pcireg.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ Modified: user/alc/PQ_LAUNDRY/lib/libc/sys/cap_enter.2 ============================================================================== --- user/alc/PQ_LAUNDRY/lib/libc/sys/cap_enter.2 Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/lib/libc/sys/cap_enter.2 Tue Sep 13 20:13:19 2016 (r305782) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd September 10, 2016 .Dt CAP_ENTER 2 .Os .Sh NAME @@ -84,6 +84,11 @@ to create a runtime environment inside t acquired rights as possible. .Sh RETURN VALUES .Rv -std cap_enter cap_getmode +.Pp +When the process is in capability mode, +.Fn cap_getmode +sets the flag to a non-zero value. +A zero value means the process is not in capability mode. .Sh ERRORS The .Fn cap_enter Modified: user/alc/PQ_LAUNDRY/lib/libifconfig/Makefile ============================================================================== --- user/alc/PQ_LAUNDRY/lib/libifconfig/Makefile Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/lib/libifconfig/Makefile Tue Sep 13 20:13:19 2016 (r305782) @@ -2,6 +2,7 @@ PACKAGE= lib${LIB} LIB= ifconfig +PRIVATELIB= true # Don't build shared library, for now. NO_PIC= Modified: user/alc/PQ_LAUNDRY/lib/libstand/net.h ============================================================================== --- user/alc/PQ_LAUNDRY/lib/libstand/net.h Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/lib/libstand/net.h Tue Sep 13 20:13:19 2016 (r305782) @@ -130,4 +130,4 @@ n_long inet_addr(char *); /* Machine-dependent functions: */ time_t getsecs(void); -#endif +#endif /* ! _STAND_NET_H */ Modified: user/alc/PQ_LAUNDRY/release/arm/CUBIEBOARD.conf ============================================================================== --- user/alc/PQ_LAUNDRY/release/arm/CUBIEBOARD.conf Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/release/arm/CUBIEBOARD.conf Tue Sep 13 20:13:19 2016 (r305782) @@ -7,7 +7,7 @@ EMBEDDEDBUILD=1 EMBEDDED_TARGET="arm" EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-cubieboard" -KERNEL="CUBIEBOARD" +KERNEL="ALLWINNER_UP" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" Modified: user/alc/PQ_LAUNDRY/share/man/man9/device_quiet.9 ============================================================================== --- user/alc/PQ_LAUNDRY/share/man/man9/device_quiet.9 Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/share/man/man9/device_quiet.9 Tue Sep 13 20:13:19 2016 (r305782) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 1999 +.Dd September 12, 2016 .Dt DEVICE_QUIET 9 .Os .Sh NAME @@ -49,16 +49,18 @@ Each device has a quiet flag associated with it. A device is verbose by default when it is created but may be quieted to prevent -the device identification string to be printed during probe. +printing of the device identification string during attach +and printing of a message during detach. To quiet a device, call -.Fn device_quiet , -to re-enable to probe message (to make the message appear again, for -example after a -.Xr device_detach 9 ) +.Fn device_quiet +during a device driver probe routine. +To re-enable probe messages, call .Fn device_verbose . To test to see if a device is quieted, call .Fn device_is_quiet . +.Pp +Devices are implicitly marked verbose after a driver detaches. .Sh SEE ALSO .Xr device 9 .Sh AUTHORS Modified: user/alc/PQ_LAUNDRY/share/man/man9/fpu_kern.9 ============================================================================== --- user/alc/PQ_LAUNDRY/share/man/man9/fpu_kern.9 Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/share/man/man9/fpu_kern.9 Tue Sep 13 20:13:19 2016 (r305782) @@ -120,6 +120,16 @@ could be used from both kernel thread an The .Fn fpu_kern_leave function correctly handles such contexts. +.It Dv FPU_KERN_NOCTX +Avoid nesting save area. +If the flag is specified, the +.Fa ctx +must be passed as +.Va NULL . +The flag should only be used for really short code blocks +which can be executed in a critical section. +It avoids the need to allocate the FPU context by the cost +of increased system latency. .El .El .Pp Modified: user/alc/PQ_LAUNDRY/sys/amd64/amd64/fpu.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/amd64/amd64/fpu.c Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/sys/amd64/amd64/fpu.c Tue Sep 13 20:13:19 2016 (r305782) @@ -633,6 +633,8 @@ fpudna(void) */ critical_enter(); + KASSERT((curpcb->pcb_flags & PCB_FPUNOSAVE) == 0, + ("fpudna while in fpu_kern_enter(FPU_KERN_NOCTX)")); if (PCPU_GET(fpcurthread) == curthread) { printf("fpudna: fpcurthread == curthread\n"); stop_emulating(); @@ -964,13 +966,39 @@ fpu_kern_enter(struct thread *td, struct { struct pcb *pcb; - KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) == 0, ("using inuse ctx")); + pcb = td->td_pcb; + KASSERT((flags & FPU_KERN_NOCTX) != 0 || ctx != NULL, + ("ctx is required when !FPU_KERN_NOCTX")); + KASSERT(ctx == NULL || (ctx->flags & FPU_KERN_CTX_INUSE) == 0, + ("using inuse ctx")); + KASSERT((pcb->pcb_flags & PCB_FPUNOSAVE) == 0, + ("recursive fpu_kern_enter while in PCB_FPUNOSAVE state")); + if ((flags & FPU_KERN_NOCTX) != 0) { + critical_enter(); + stop_emulating(); + if (curthread == PCPU_GET(fpcurthread)) { + fpusave(curpcb->pcb_save); + PCPU_SET(fpcurthread, NULL); + } else { + KASSERT(PCPU_GET(fpcurthread) == NULL, + ("invalid fpcurthread")); + } + + /* + * This breaks XSAVEOPT tracker, but + * PCB_FPUNOSAVE state is supposed to never need to + * save FPU context at all. + */ + fpurestore(fpu_initialstate); + set_pcb_flags(pcb, PCB_KERNFPU | PCB_FPUNOSAVE | + PCB_FPUINITDONE); + return (0); + } if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; return (0); } - pcb = td->td_pcb; KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = FPU_KERN_CTX_INUSE; @@ -989,19 +1017,34 @@ fpu_kern_leave(struct thread *td, struct { struct pcb *pcb; - KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) != 0, - ("leaving not inuse ctx")); - ctx->flags &= ~FPU_KERN_CTX_INUSE; - - if (is_fpu_kern_thread(0) && (ctx->flags & FPU_KERN_CTX_DUMMY) != 0) - return (0); - KASSERT((ctx->flags & FPU_KERN_CTX_DUMMY) == 0, ("dummy ctx")); pcb = td->td_pcb; - critical_enter(); - if (curthread == PCPU_GET(fpcurthread)) - fpudrop(); - critical_exit(); - pcb->pcb_save = ctx->prev; + + if ((pcb->pcb_flags & PCB_FPUNOSAVE) != 0) { + KASSERT(ctx == NULL, ("non-null ctx after FPU_KERN_NOCTX")); + KASSERT(PCPU_GET(fpcurthread) == NULL, + ("non-NULL fpcurthread for PCB_FPUNOSAVE")); + CRITICAL_ASSERT(td); + + clear_pcb_flags(pcb, PCB_FPUNOSAVE | PCB_FPUINITDONE); + start_emulating(); + critical_exit(); + } else { + KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) != 0, + ("leaving not inuse ctx")); + ctx->flags &= ~FPU_KERN_CTX_INUSE; + + if (is_fpu_kern_thread(0) && + (ctx->flags & FPU_KERN_CTX_DUMMY) != 0) + return (0); + KASSERT((ctx->flags & FPU_KERN_CTX_DUMMY) == 0, + ("dummy ctx")); + critical_enter(); + if (curthread == PCPU_GET(fpcurthread)) + fpudrop(); + critical_exit(); + pcb->pcb_save = ctx->prev; + } + if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_USERFPUINITDONE) != 0) { set_pcb_flags(pcb, PCB_FPUINITDONE); Modified: user/alc/PQ_LAUNDRY/sys/amd64/include/fpu.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/amd64/include/fpu.h Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/sys/amd64/include/fpu.h Tue Sep 13 20:13:19 2016 (r305782) @@ -86,6 +86,7 @@ void fpu_save_area_reset(struct savefpu #define FPU_KERN_NORMAL 0x0000 #define FPU_KERN_NOWAIT 0x0001 #define FPU_KERN_KTHR 0x0002 +#define FPU_KERN_NOCTX 0x0004 #endif Modified: user/alc/PQ_LAUNDRY/sys/amd64/include/pcb.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/amd64/include/pcb.h Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/sys/amd64/include/pcb.h Tue Sep 13 20:13:19 2016 (r305782) @@ -83,6 +83,7 @@ struct pcb { #define PCB_FPUINITDONE 0x08 /* fpu state is initialized */ #define PCB_USERFPUINITDONE 0x10 /* fpu user state is initialized */ #define PCB_32BIT 0x40 /* process has 32 bit context (segs etc) */ +#define PCB_FPUNOSAVE 0x80 /* no save area for current FPU ctx */ uint16_t pcb_initial_fpucw; Modified: user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.c Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.c Tue Sep 13 20:13:19 2016 (r305782) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -56,16 +55,12 @@ __FBSDID("$FreeBSD$"); #define A10_MMC_MEMRES 0 #define A10_MMC_IRQRES 1 #define A10_MMC_RESSZ 2 -#define A10_MMC_DMA_SEGS 16 +#define A10_MMC_DMA_SEGS ((MAXPHYS / PAGE_SIZE) + 1) #define A10_MMC_DMA_MAX_SIZE 0x2000 #define A10_MMC_DMA_FTRGLEVEL 0x20070008 #define CARD_ID_FREQUENCY 400000 -static int a10_mmc_pio_mode = 0; - -TUNABLE_INT("hw.a10.mmc.pio_mode", &a10_mmc_pio_mode); - static struct ofw_compat_data compat_data[] = { {"allwinner,sun4i-a10-mmc", 1}, {"allwinner,sun5i-a13-mmc", 1}, @@ -73,14 +68,11 @@ static struct ofw_compat_data compat_dat }; struct a10_mmc_softc { - bus_space_handle_t a10_bsh; - bus_space_tag_t a10_bst; device_t a10_dev; clk_t a10_clk_ahb; clk_t a10_clk_mmc; hwreset_t a10_rst_ahb; int a10_bus_busy; - int a10_id; int a10_resid; int a10_timeout; struct callout a10_timeoutc; @@ -91,7 +83,6 @@ struct a10_mmc_softc { uint32_t a10_intr; uint32_t a10_intr_wait; void * a10_intrhand; - bus_size_t a10_fifo_reg; /* Fields required for DMA access. */ bus_addr_t a10_dma_desc_phys; @@ -100,7 +91,6 @@ struct a10_mmc_softc { void * a10_dma_desc; bus_dmamap_t a10_dma_buf_map; bus_dma_tag_t a10_dma_buf_tag; - int a10_dma_inuse; int a10_dma_map_err; }; @@ -116,7 +106,7 @@ static int a10_mmc_detach(device_t); static int a10_mmc_setup_dma(struct a10_mmc_softc *); static int a10_mmc_reset(struct a10_mmc_softc *); static void a10_mmc_intr(void *); -static int a10_mmc_update_clock(struct a10_mmc_softc *); +static int a10_mmc_update_clock(struct a10_mmc_softc *, uint32_t); static int a10_mmc_update_ios(device_t, device_t); static int a10_mmc_request(device_t, device_t, struct mmc_request *); @@ -127,9 +117,9 @@ static int a10_mmc_release_host(device_t #define A10_MMC_LOCK(_sc) mtx_lock(&(_sc)->a10_mtx) #define A10_MMC_UNLOCK(_sc) mtx_unlock(&(_sc)->a10_mtx) #define A10_MMC_READ_4(_sc, _reg) \ - bus_space_read_4((_sc)->a10_bst, (_sc)->a10_bsh, _reg) + bus_read_4((_sc)->a10_res[A10_MMC_MEMRES], _reg) #define A10_MMC_WRITE_4(_sc, _reg, _value) \ - bus_space_write_4((_sc)->a10_bst, (_sc)->a10_bsh, _reg, _value) + bus_write_4((_sc)->a10_res[A10_MMC_MEMRES], _reg, _value) static int a10_mmc_probe(device_t dev) @@ -160,17 +150,10 @@ a10_mmc_attach(device_t dev) sc = device_get_softc(dev); sc->a10_dev = dev; sc->a10_req = NULL; - sc->a10_id = device_get_unit(dev); - if (sc->a10_id > 3) { - device_printf(dev, "only 4 hosts are supported (0-3)\n"); - return (ENXIO); - } if (bus_alloc_resources(dev, a10_mmc_res_spec, sc->a10_res) != 0) { device_printf(dev, "cannot allocate device resources\n"); return (ENXIO); } - sc->a10_bst = rman_get_bustag(sc->a10_res[A10_MMC_MEMRES]); - sc->a10_bsh = rman_get_bushandle(sc->a10_res[A10_MMC_MEMRES]); if (bus_setup_intr(dev, sc->a10_res[A10_MMC_IRQRES], INTR_TYPE_MISC | INTR_MPSAFE, NULL, a10_mmc_intr, sc, &sc->a10_intrhand)) { @@ -182,31 +165,12 @@ a10_mmc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->a10_timeoutc, &sc->a10_mtx, 0); -#if defined(__arm__) - /* - * Later chips use a different FIFO offset. Unfortunately the FDT - * uses the same compatible string for old and new implementations. - */ - switch (allwinner_soc_family()) { - case ALLWINNERSOC_SUN4I: - case ALLWINNERSOC_SUN5I: - case ALLWINNERSOC_SUN7I: - sc->a10_fifo_reg = A10_MMC_FIFO; - break; - default: - sc->a10_fifo_reg = A31_MMC_FIFO; - break; - } -#else /* __aarch64__ */ - sc->a10_fifo_reg = A31_MMC_FIFO; -#endif - /* De-assert reset */ if (hwreset_get_by_ofw_name(dev, 0, "ahb", &sc->a10_rst_ahb) == 0) { error = hwreset_deassert(sc->a10_rst_ahb); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); - return (error); + goto fail; } } @@ -244,19 +208,22 @@ a10_mmc_attach(device_t dev) SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "req_timeout", CTLFLAG_RW, &sc->a10_timeout, 0, "Request timeout in seconds"); - /* Reset controller. */ + /* Hardware reset */ + A10_MMC_WRITE_4(sc, A10_MMC_HWRST, 1); + DELAY(100); + A10_MMC_WRITE_4(sc, A10_MMC_HWRST, 0); + DELAY(500); + + /* Soft Reset controller. */ if (a10_mmc_reset(sc) != 0) { device_printf(dev, "cannot reset the controller\n"); goto fail; } - if (a10_mmc_pio_mode == 0 && a10_mmc_setup_dma(sc) != 0) { + if (a10_mmc_setup_dma(sc) != 0) { device_printf(sc->a10_dev, "Couldn't setup DMA!\n"); - a10_mmc_pio_mode = 1; + goto fail; } - if (bootverbose) - device_printf(sc->a10_dev, "DMA status: %s\n", - a10_mmc_pio_mode ? "disabled" : "enabled"); if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) bus_width = 4; @@ -369,7 +336,6 @@ a10_dma_cb(void *arg, bus_dma_segment_t return; dma_desc = sc->a10_dma_desc; - /* Note nsegs is guaranteed to be zero if err is non-zero. */ for (i = 0; i < nsegs; i++) { dma_desc[i].buf_size = segs[i].ds_len; dma_desc[i].buf_addr = segs[i].ds_addr; @@ -386,7 +352,7 @@ a10_dma_cb(void *arg, bus_dma_segment_t A10_MMC_DMA_CONFIG_ER; dma_desc[i].next = 0; } - } + } } static int @@ -401,13 +367,12 @@ a10_mmc_prepare_dma(struct a10_mmc_softc if (cmd->data->len > A10_MMC_DMA_MAX_SIZE * A10_MMC_DMA_SEGS) return (EFBIG); error = bus_dmamap_load(sc->a10_dma_buf_tag, sc->a10_dma_buf_map, - cmd->data->data, cmd->data->len, a10_dma_cb, sc, BUS_DMA_NOWAIT); + cmd->data->data, cmd->data->len, a10_dma_cb, sc, 0); if (error) return (error); if (sc->a10_dma_map_err) return (sc->a10_dma_map_err); - sc->a10_dma_inuse = 1; if (cmd->data->flags & MMC_DATA_WRITE) sync_op = BUS_DMASYNC_PREWRITE; else @@ -415,27 +380,32 @@ a10_mmc_prepare_dma(struct a10_mmc_softc bus_dmamap_sync(sc->a10_dma_buf_tag, sc->a10_dma_buf_map, sync_op); bus_dmamap_sync(sc->a10_dma_tag, sc->a10_dma_map, BUS_DMASYNC_PREWRITE); - val = A10_MMC_READ_4(sc, A10_MMC_IMASK); - val &= ~(A10_MMC_RX_DATA_REQ | A10_MMC_TX_DATA_REQ); - A10_MMC_WRITE_4(sc, A10_MMC_IMASK, val); - val = A10_MMC_READ_4(sc, A10_MMC_GCTRL); - val &= ~A10_MMC_ACCESS_BY_AHB; - val |= A10_MMC_DMA_ENABLE; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, val); - val |= A10_MMC_DMA_RESET; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, val); - A10_MMC_WRITE_4(sc, A10_MMC_DMAC, A10_MMC_IDMAC_SOFT_RST); + /* Enable DMA */ + val = A10_MMC_READ_4(sc, A10_MMC_GCTL); + val &= ~A10_MMC_CTRL_FIFO_AC_MOD; + val |= A10_MMC_CTRL_DMA_ENB; + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, val); + + /* Reset DMA */ + val |= A10_MMC_CTRL_DMA_RST; + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, val); + + A10_MMC_WRITE_4(sc, A10_MMC_DMAC, A10_MMC_DMAC_IDMAC_SOFT_RST); A10_MMC_WRITE_4(sc, A10_MMC_DMAC, - A10_MMC_IDMAC_IDMA_ON | A10_MMC_IDMAC_FIX_BURST); - val = A10_MMC_READ_4(sc, A10_MMC_IDIE); - val &= ~(A10_MMC_IDMAC_RECEIVE_INT | A10_MMC_IDMAC_TRANSMIT_INT); + A10_MMC_DMAC_IDMAC_IDMA_ON | A10_MMC_DMAC_IDMAC_FIX_BURST); + + /* Enable RX or TX DMA interrupt */ if (cmd->data->flags & MMC_DATA_WRITE) - val |= A10_MMC_IDMAC_TRANSMIT_INT; + val |= A10_MMC_IDST_TX_INT; else - val |= A10_MMC_IDMAC_RECEIVE_INT; + val |= A10_MMC_IDST_RX_INT; A10_MMC_WRITE_4(sc, A10_MMC_IDIE, val); + + /* Set DMA descritptor list address */ A10_MMC_WRITE_4(sc, A10_MMC_DLBA, sc->a10_dma_desc_phys); - A10_MMC_WRITE_4(sc, A10_MMC_FTRGL, A10_MMC_DMA_FTRGLEVEL); + + /* FIFO trigger level */ + A10_MMC_WRITE_4(sc, A10_MMC_FWLR, A10_MMC_DMA_FTRGLEVEL); return (0); } @@ -445,11 +415,10 @@ a10_mmc_reset(struct a10_mmc_softc *sc) { int timeout; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, - A10_MMC_READ_4(sc, A10_MMC_GCTRL) | A10_MMC_RESET); + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, A10_MMC_RESET); timeout = 1000; while (--timeout > 0) { - if ((A10_MMC_READ_4(sc, A10_MMC_GCTRL) & A10_MMC_RESET) == 0) + if ((A10_MMC_READ_4(sc, A10_MMC_GCTL) & A10_MMC_RESET) == 0) break; DELAY(100); } @@ -457,18 +426,20 @@ a10_mmc_reset(struct a10_mmc_softc *sc) return (ETIMEDOUT); /* Set the timeout. */ - A10_MMC_WRITE_4(sc, A10_MMC_TIMEOUT, 0xffffffff); + A10_MMC_WRITE_4(sc, A10_MMC_TMOR, + A10_MMC_TMOR_DTO_LMT_SHIFT(A10_MMC_TMOR_DTO_LMT_MASK) | + A10_MMC_TMOR_RTO_LMT_SHIFT(A10_MMC_TMOR_RTO_LMT_MASK)); /* Clear pending interrupts. */ - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, 0xffffffff); + A10_MMC_WRITE_4(sc, A10_MMC_RISR, 0xffffffff); A10_MMC_WRITE_4(sc, A10_MMC_IDST, 0xffffffff); /* Unmask interrupts. */ - A10_MMC_WRITE_4(sc, A10_MMC_IMASK, - A10_MMC_CMD_DONE | A10_MMC_INT_ERR_BIT | - A10_MMC_DATA_OVER | A10_MMC_AUTOCMD_DONE); + A10_MMC_WRITE_4(sc, A10_MMC_IMKR, + A10_MMC_INT_CMD_DONE | A10_MMC_INT_ERR_BIT | + A10_MMC_INT_DATA_OVER | A10_MMC_INT_AUTO_STOP_DONE); /* Enable interrupts and AHB access. */ - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, - A10_MMC_READ_4(sc, A10_MMC_GCTRL) | A10_MMC_INT_ENABLE); + A10_MMC_WRITE_4(sc, A10_MMC_GCTL, + A10_MMC_READ_4(sc, A10_MMC_GCTL) | A10_MMC_CTRL_INT_ENB); return (0); } @@ -483,12 +454,6 @@ a10_mmc_req_done(struct a10_mmc_softc *s if (cmd->error != MMC_ERR_NONE) { /* Reset the controller. */ a10_mmc_reset(sc); - a10_mmc_update_clock(sc); - } - if (sc->a10_dma_inuse == 0) { - /* Reset the FIFO. */ - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, - A10_MMC_READ_4(sc, A10_MMC_GCTRL) | A10_MMC_FIFO_RESET); } req = sc->a10_req; @@ -496,7 +461,6 @@ a10_mmc_req_done(struct a10_mmc_softc *s sc->a10_req = NULL; sc->a10_intr = 0; sc->a10_resid = 0; - sc->a10_dma_inuse = 0; sc->a10_dma_map_err = 0; sc->a10_intr_wait = 0; req->done(req); @@ -511,8 +475,8 @@ a10_mmc_req_ok(struct a10_mmc_softc *sc) timeout = 1000; while (--timeout > 0) { - status = A10_MMC_READ_4(sc, A10_MMC_STAS); - if ((status & A10_MMC_CARD_DATA_BUSY) == 0) + status = A10_MMC_READ_4(sc, A10_MMC_STAR); + if ((status & A10_MMC_STAR_CARD_BUSY) == 0) break; DELAY(1000); } @@ -552,28 +516,6 @@ a10_mmc_timeout(void *arg) "Spurious timeout - no active request\n"); } -static int -a10_mmc_pio_transfer(struct a10_mmc_softc *sc, struct mmc_data *data) -{ - int i, write; - uint32_t bit, *buf; - - buf = (uint32_t *)data->data; - write = (data->flags & MMC_DATA_WRITE) ? 1 : 0; - bit = write ? A10_MMC_FIFO_FULL : A10_MMC_FIFO_EMPTY; - for (i = sc->a10_resid; i < (data->len >> 2); i++) { - if ((A10_MMC_READ_4(sc, A10_MMC_STAS) & bit)) - return (1); - if (write) - A10_MMC_WRITE_4(sc, sc->a10_fifo_reg, buf[i]); - else - buf[i] = A10_MMC_READ_4(sc, sc->a10_fifo_reg); - sc->a10_resid = i + 1; - } - - return (0); -} - static void a10_mmc_intr(void *arg) { @@ -584,9 +526,9 @@ a10_mmc_intr(void *arg) sc = (struct a10_mmc_softc *)arg; A10_MMC_LOCK(sc); - rint = A10_MMC_READ_4(sc, A10_MMC_RINTR); + rint = A10_MMC_READ_4(sc, A10_MMC_RISR); idst = A10_MMC_READ_4(sc, A10_MMC_IDST); - imask = A10_MMC_READ_4(sc, A10_MMC_IMASK); + imask = A10_MMC_READ_4(sc, A10_MMC_IMKR); if (idst == 0 && imask == 0 && rint == 0) { A10_MMC_UNLOCK(sc); return; @@ -603,14 +545,14 @@ a10_mmc_intr(void *arg) } if (rint & A10_MMC_INT_ERR_BIT) { device_printf(sc->a10_dev, "error rint: 0x%08X\n", rint); - if (rint & A10_MMC_RESP_TIMEOUT) + if (rint & A10_MMC_INT_RESP_TIMEOUT) sc->a10_req->cmd->error = MMC_ERR_TIMEOUT; else sc->a10_req->cmd->error = MMC_ERR_FAILED; a10_mmc_req_done(sc); goto end; } - if (idst & A10_MMC_IDMAC_ERROR) { + if (idst & A10_MMC_IDST_ERROR) { device_printf(sc->a10_dev, "error idst: 0x%08x\n", idst); sc->a10_req->cmd->error = MMC_ERR_FAILED; a10_mmc_req_done(sc); @@ -619,8 +561,7 @@ a10_mmc_intr(void *arg) sc->a10_intr |= rint; data = sc->a10_req->cmd->data; - if (data != NULL && sc->a10_dma_inuse == 1 && - (idst & A10_MMC_IDMAC_COMPLETE)) { + if (data != NULL && (idst & A10_MMC_IDST_COMPLETE) != 0) { if (data->flags & MMC_DATA_WRITE) sync_op = BUS_DMASYNC_POSTWRITE; else @@ -631,16 +572,13 @@ a10_mmc_intr(void *arg) BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->a10_dma_buf_tag, sc->a10_dma_buf_map); sc->a10_resid = data->len >> 2; - } else if (data != NULL && sc->a10_dma_inuse == 0 && - (rint & (A10_MMC_DATA_OVER | A10_MMC_RX_DATA_REQ | - A10_MMC_TX_DATA_REQ)) != 0) - a10_mmc_pio_transfer(sc, data); + } if ((sc->a10_intr & sc->a10_intr_wait) == sc->a10_intr_wait) a10_mmc_req_ok(sc); end: A10_MMC_WRITE_4(sc, A10_MMC_IDST, idst); - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, rint); + A10_MMC_WRITE_4(sc, A10_MMC_RISR, rint); A10_MMC_UNLOCK(sc); } @@ -650,7 +588,8 @@ a10_mmc_request(device_t bus, device_t c int blksz; struct a10_mmc_softc *sc; struct mmc_command *cmd; - uint32_t cmdreg, val; + uint32_t cmdreg; + int err; sc = device_get_softc(bus); A10_MMC_LOCK(sc); @@ -660,48 +599,39 @@ a10_mmc_request(device_t bus, device_t c } sc->a10_req = req; cmd = req->cmd; - cmdreg = A10_MMC_START; + cmdreg = A10_MMC_CMDR_LOAD; if (cmd->opcode == MMC_GO_IDLE_STATE) - cmdreg |= A10_MMC_SEND_INIT_SEQ; + cmdreg |= A10_MMC_CMDR_SEND_INIT_SEQ; if (cmd->flags & MMC_RSP_PRESENT) - cmdreg |= A10_MMC_RESP_EXP; + cmdreg |= A10_MMC_CMDR_RESP_RCV; if (cmd->flags & MMC_RSP_136) - cmdreg |= A10_MMC_LONG_RESP; + cmdreg |= A10_MMC_CMDR_LONG_RESP; if (cmd->flags & MMC_RSP_CRC) - cmdreg |= A10_MMC_CHECK_RESP_CRC; + cmdreg |= A10_MMC_CMDR_CHK_RESP_CRC; sc->a10_intr = 0; sc->a10_resid = 0; - sc->a10_intr_wait = A10_MMC_CMD_DONE; + sc->a10_intr_wait = A10_MMC_INT_CMD_DONE; cmd->error = MMC_ERR_NONE; if (cmd->data != NULL) { - sc->a10_intr_wait |= A10_MMC_DATA_OVER; - cmdreg |= A10_MMC_DATA_EXP | A10_MMC_WAIT_PREOVER; + sc->a10_intr_wait |= A10_MMC_INT_DATA_OVER; + cmdreg |= A10_MMC_CMDR_DATA_TRANS | A10_MMC_CMDR_WAIT_PRE_OVER; if (cmd->data->flags & MMC_DATA_MULTI) { - cmdreg |= A10_MMC_SEND_AUTOSTOP; - sc->a10_intr_wait |= A10_MMC_AUTOCMD_DONE; + cmdreg |= A10_MMC_CMDR_STOP_CMD_FLAG; + sc->a10_intr_wait |= A10_MMC_INT_AUTO_STOP_DONE; } if (cmd->data->flags & MMC_DATA_WRITE) - cmdreg |= A10_MMC_WRITE; + cmdreg |= A10_MMC_CMDR_DIR_WRITE; blksz = min(cmd->data->len, MMC_SECTOR_SIZE); - A10_MMC_WRITE_4(sc, A10_MMC_BLKSZ, blksz); - A10_MMC_WRITE_4(sc, A10_MMC_BCNTR, cmd->data->len); + A10_MMC_WRITE_4(sc, A10_MMC_BKSR, blksz); + A10_MMC_WRITE_4(sc, A10_MMC_BYCR, cmd->data->len); - if (a10_mmc_pio_mode == 0) - a10_mmc_prepare_dma(sc); - /* Enable PIO access if sc->a10_dma_inuse is not set. */ - if (sc->a10_dma_inuse == 0) { - val = A10_MMC_READ_4(sc, A10_MMC_GCTRL); - val &= ~A10_MMC_DMA_ENABLE; - val |= A10_MMC_ACCESS_BY_AHB; - A10_MMC_WRITE_4(sc, A10_MMC_GCTRL, val); - val = A10_MMC_READ_4(sc, A10_MMC_IMASK); - val |= A10_MMC_RX_DATA_REQ | A10_MMC_TX_DATA_REQ; - A10_MMC_WRITE_4(sc, A10_MMC_IMASK, val); - } + err = a10_mmc_prepare_dma(sc); + if (err != 0) + device_printf(sc->a10_dev, "prepare_dma failed: %d\n", err); } - A10_MMC_WRITE_4(sc, A10_MMC_CARG, cmd->arg); + A10_MMC_WRITE_4(sc, A10_MMC_CAGR, cmd->arg); A10_MMC_WRITE_4(sc, A10_MMC_CMDR, cmdreg | cmd->opcode); callout_reset(&sc->a10_timeoutc, sc->a10_timeout * hz, a10_mmc_timeout, sc); @@ -811,23 +741,32 @@ a10_mmc_write_ivar(device_t bus, device_ } static int -a10_mmc_update_clock(struct a10_mmc_softc *sc) +a10_mmc_update_clock(struct a10_mmc_softc *sc, uint32_t clkon) { uint32_t cmdreg; int retry; + uint32_t ckcr; - cmdreg = A10_MMC_START | A10_MMC_UPCLK_ONLY | - A10_MMC_WAIT_PREOVER; + ckcr = A10_MMC_READ_4(sc, A10_MMC_CKCR); + ckcr &= ~(A10_MMC_CKCR_CCLK_ENB | A10_MMC_CKCR_CCLK_CTRL); + + if (clkon) + ckcr |= A10_MMC_CKCR_CCLK_ENB; + + A10_MMC_WRITE_4(sc, A10_MMC_CKCR, ckcr); + + cmdreg = A10_MMC_CMDR_LOAD | A10_MMC_CMDR_PRG_CLK | + A10_MMC_CMDR_WAIT_PRE_OVER; A10_MMC_WRITE_4(sc, A10_MMC_CMDR, cmdreg); retry = 0xfffff; while (--retry > 0) { - if ((A10_MMC_READ_4(sc, A10_MMC_CMDR) & A10_MMC_START) == 0) { - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, 0xffffffff); + if ((A10_MMC_READ_4(sc, A10_MMC_CMDR) & A10_MMC_CMDR_LOAD) == 0) { + A10_MMC_WRITE_4(sc, A10_MMC_RISR, 0xffffffff); return (0); } DELAY(10); } - A10_MMC_WRITE_4(sc, A10_MMC_RINTR, 0xffffffff); + A10_MMC_WRITE_4(sc, A10_MMC_RISR, 0xffffffff); device_printf(sc->a10_dev, "timeout updating clock\n"); return (ETIMEDOUT); @@ -839,28 +778,37 @@ a10_mmc_update_ios(device_t bus, device_ int error; struct a10_mmc_softc *sc; struct mmc_ios *ios; - uint32_t clkcr; + uint32_t ckcr; sc = device_get_softc(bus); - clkcr = A10_MMC_READ_4(sc, A10_MMC_CLKCR); - if (clkcr & A10_MMC_CARD_CLK_ON) { - /* Disable clock. */ - clkcr &= ~A10_MMC_CARD_CLK_ON; - A10_MMC_WRITE_4(sc, A10_MMC_CLKCR, clkcr); - error = a10_mmc_update_clock(sc); - if (error != 0) - return (error); - } ios = &sc->a10_host.ios; + + /* Set the bus width. */ + switch (ios->bus_width) { + case bus_width_1: + A10_MMC_WRITE_4(sc, A10_MMC_BWDR, A10_MMC_BWDR1); + break; + case bus_width_4: + A10_MMC_WRITE_4(sc, A10_MMC_BWDR, A10_MMC_BWDR4); + break; + case bus_width_8: + A10_MMC_WRITE_4(sc, A10_MMC_BWDR, A10_MMC_BWDR8); + break; + } + if (ios->clock) { - /* Reset the divider. */ - clkcr &= ~A10_MMC_CLKCR_DIV; - A10_MMC_WRITE_4(sc, A10_MMC_CLKCR, clkcr); - error = a10_mmc_update_clock(sc); + + /* Disable clock */ + error = a10_mmc_update_clock(sc, 0); if (error != 0) return (error); + /* Reset the divider. */ + ckcr = A10_MMC_READ_4(sc, A10_MMC_CKCR); + ckcr &= ~A10_MMC_CKCR_CCLK_DIV; + A10_MMC_WRITE_4(sc, A10_MMC_CKCR, ckcr); + /* Set the MMC clock. */ error = clk_set_freq(sc->a10_clk_mmc, ios->clock, CLK_SET_ROUND_DOWN); @@ -872,25 +820,11 @@ a10_mmc_update_ios(device_t bus, device_ } /* Enable clock. */ - clkcr |= A10_MMC_CARD_CLK_ON; - A10_MMC_WRITE_4(sc, A10_MMC_CLKCR, clkcr); - error = a10_mmc_update_clock(sc); + error = a10_mmc_update_clock(sc, 1); if (error != 0) return (error); } - /* Set the bus width. */ - switch (ios->bus_width) { - case bus_width_1: - A10_MMC_WRITE_4(sc, A10_MMC_WIDTH, A10_MMC_WIDTH1); - break; - case bus_width_4: - A10_MMC_WRITE_4(sc, A10_MMC_WIDTH, A10_MMC_WIDTH4); - break; - case bus_width_8: - A10_MMC_WRITE_4(sc, A10_MMC_WIDTH, A10_MMC_WIDTH8); - break; - } return (0); } Modified: user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.h Tue Sep 13 19:59:29 2016 (r305781) +++ user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_mmc.h Tue Sep 13 20:13:19 2016 (r305782) @@ -29,117 +29,120 @@ #ifndef _A10_MMC_H_ #define _A10_MMC_H_ -#define A10_MMC_GCTRL 0x00 /* Global Control Register */ -#define A10_MMC_CLKCR 0x04 /* Clock Control Register */ -#define A10_MMC_TIMEOUT 0x08 /* Timeout Register */ -#define A10_MMC_WIDTH 0x0C /* Bus Width Register */ -#define A10_MMC_BLKSZ 0x10 /* Block Size Register */ -#define A10_MMC_BCNTR 0x14 /* Byte Count Register */ +#define A10_MMC_GCTL 0x00 /* Control Register */ +#define A10_MMC_CKCR 0x04 /* Clock Control Register */ +#define A10_MMC_TMOR 0x08 /* Timeout Register */ +#define A10_MMC_BWDR 0x0C /* Bus Width Register */ +#define A10_MMC_BKSR 0x10 /* Block Size Register */ +#define A10_MMC_BYCR 0x14 /* Byte Count Register */ #define A10_MMC_CMDR 0x18 /* Command Register */ -#define A10_MMC_CARG 0x1C /* Argument Register */ +#define A10_MMC_CAGR 0x1C /* Argument Register */ #define A10_MMC_RESP0 0x20 /* Response Register 0 */ #define A10_MMC_RESP1 0x24 /* Response Register 1 */ #define A10_MMC_RESP2 0x28 /* Response Register 2 */ #define A10_MMC_RESP3 0x2C /* Response Register 3 */ -#define A10_MMC_IMASK 0x30 /* Interrupt Mask Register */ -#define A10_MMC_MISTA 0x34 /* Masked Interrupt Status Register */ -#define A10_MMC_RINTR 0x38 /* Raw Interrupt Status Register */ -#define A10_MMC_STAS 0x3C /* Status Register */ -#define A10_MMC_FTRGL 0x40 /* FIFO Threshold Watermark Register */ +#define A10_MMC_IMKR 0x30 /* Interrupt Mask Register */ +#define A10_MMC_MISR 0x34 /* Masked Interrupt Status Register */ +#define A10_MMC_RISR 0x38 /* Raw Interrupt Status Register */ +#define A10_MMC_STAR 0x3C /* Status Register */ +#define A10_MMC_FWLR 0x40 /* FIFO Threshold Watermark Register */ #define A10_MMC_FUNS 0x44 /* Function Select Register */ -#define A10_MMC_CBCR 0x48 /* CIU Byte Count Register */ -#define A10_MMC_BBCR 0x4C /* BIU Byte Count Register */ -#define A10_MMC_DBGC 0x50 /* Debug Enable Register */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***