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...
Mark Johnston
markj at FreeBSD.org
Tue Sep 13 20:13:22 UTC 2016
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 <dev/mmc/mmcreg.h>
#include <dev/mmc/mmcbrvar.h>
-#include <arm/allwinner/aw_machdep.h>
#include <arm/allwinner/a10_mmc.h>
#include <dev/extres/clk/clk.h>
#include <dev/extres/hwreset/hwreset.h>
@@ -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 ***
More information about the svn-src-user
mailing list